-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: add multi-owner modular account updateOwners test #1160
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -165,6 +165,64 @@ describe("Modular Account Multi Owner Account Tests", async () => { | |
`); | ||
}, 100000); | ||
|
||
it("should update ownership successfully", async () => { | ||
const provider = await givenConnectedProvider({ | ||
signer: signer2, | ||
owners, | ||
}); | ||
await setBalance(instance.getClient(), { | ||
address: provider.getAddress(), | ||
value: parseEther("1000"), | ||
}); | ||
const signer3 = LocalAccountSigner.mnemonicToAccountSigner( | ||
MODULAR_MULTIOWNER_ACCOUNT_OWNER_MNEMONIC, | ||
{ accountIndex: 2 } | ||
); | ||
|
||
// Deploy account and update owners. Remove signer1 and add signer3. | ||
let result = await provider.updateOwners({ | ||
args: [[await signer3.getAddress()], [await signer1.getAddress()]], | ||
}); | ||
await provider.waitForUserOperationTransaction(result); | ||
|
||
let newOwnerAddresses = await provider.readOwners({ | ||
pluginAddress: "0xcE0000007B008F50d762D155002600004cD6c647", | ||
}); | ||
expect(newOwnerAddresses).not.toContain(await signer1.getAddress()); | ||
expect(newOwnerAddresses).toHaveLength(2); | ||
expect(newOwnerAddresses).toEqual( | ||
expect.arrayContaining([ | ||
await signer2.getAddress(), | ||
await signer3.getAddress(), | ||
]) | ||
); | ||
|
||
// Update owners again. This time, remove signer3 and add signer1. | ||
result = await provider.updateOwners({ | ||
args: [[await signer1.getAddress()], [await signer3.getAddress()]], | ||
overrides: { | ||
maxFeePerGas: 1_851_972_078n * 2n, | ||
maxPriorityFeePerGas: 1_000_000_000n * 2n, | ||
callGasLimit: 43_960n * 2n, | ||
verificationGasLimit: 92_326n * 2n, | ||
preVerificationGas: 46_248n * 2n, | ||
}, | ||
Comment on lines
+203
to
+209
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Need to figure out why these values need to be increased. Doubling the derived values got the UO to succeed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. heads up: each of these fields supports a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmmm that's strange... we still need to merge in wevm/prool#26 because our tests use maybe we should fork prool and use that instead |
||
}); | ||
await provider.waitForUserOperationTransaction(result); | ||
|
||
newOwnerAddresses = await provider.readOwners({ | ||
pluginAddress: "0xcE0000007B008F50d762D155002600004cD6c647", | ||
}); | ||
expect(newOwnerAddresses).not.toContain(await signer3.getAddress()); | ||
expect(newOwnerAddresses).toHaveLength(2); | ||
expect(newOwnerAddresses).toEqual( | ||
expect.arrayContaining([ | ||
await signer1.getAddress(), | ||
await signer2.getAddress(), | ||
]) | ||
); | ||
}, 100000); | ||
|
||
const givenConnectedProvider = ({ | ||
signer, | ||
accountAddress, | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is signer1 already on the account? or is this part of the test -- it should not revert if a signer is not on the account?
I ask because you attach
signer2
above to this and wanted to make sure this was intentionalThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
signer1
andsigner2
are the initial owners. So here we deploy, set the initial owners, and update them at the same time. This one doesn't revert.