-
Notifications
You must be signed in to change notification settings - Fork 133
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
feat: add upgrade functionality for light account to msca #298
feat: add upgrade functionality for light account to msca #298
Conversation
Current dependencies on/for this PR:
This stack of pull requests is managed by Graphite. |
a09a936
to
67db9b9
Compare
@@ -195,6 +200,52 @@ describe("Light Account Tests", () => { | |||
expect(newOwnerViaProvider).not.toBe(oldOwner); | |||
expect(newOwnerViaProvider).toBe(newOwner); | |||
}, 100000); | |||
|
|||
it("should upgrade a deployed light account to msca successfully", async () => { |
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.
I tested undeployed light account using our gas manager, but now since aa-alchemy optionally depends on aa-accounts, making aa-alchemy a dev dependency of aa-accounts introduces a circular dependency that won't build correctly.
67db9b9
to
5926ddc
Compare
5926ddc
to
71fc692
Compare
71fc692
to
24fddf7
Compare
2cddc7e
to
922486f
Compare
@@ -16,7 +16,7 @@ export interface IMSCA< | |||
|
|||
extendWithPluginMethods: <AD, PD>( | |||
plugin: Plugin<AD, PD> | |||
) => IMSCA<TTransport, TProviderDecorators & PD> & AD; | |||
) => this & IMSCA<TTransport, TProviderDecorators & PD> & AD; |
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 this
necessary? why?
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.
yea, so before if you didn't include it then if you previously extended the account you would lose them on the second extend.
If you try it out on the main
branch right now, you can see that happening in the multi owner builder function. Once you extend with TokenReceiver, the methods for MultiOwner no longer resolve
cb33f09
to
e91fc85
Compare
70480cb
to
b488adf
Compare
b488adf
to
461d54a
Compare
eef3bcf
to
eda1989
Compare
461d54a
to
45913e5
Compare
eda1989
to
56c92ef
Compare
45913e5
to
a3773dd
Compare
56c92ef
to
4ac15f7
Compare
a3773dd
to
1c02c4c
Compare
22020f4
to
2ebec5d
Compare
1c02c4c
to
53f6a9f
Compare
53f6a9f
to
2b90751
Compare
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.
some open questions, but overall lgtm. looks like you can approve it when you make any necessary changes since it was my og pr haha.
const storage = await provider.getStorageAt({ | ||
address: accountAddress, | ||
slot: "0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc", | ||
}); |
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.
wanna leave a comment to humanize the slot and why this is where we look?
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.
ah yea lemme do that
new LightSmartContractAccount({ | ||
rpcClient, | ||
chain: rpcClient.chain, | ||
owner: newOwner, | ||
entryPointAddress: provider.account.getEntryPointAddress(), | ||
factoryAddress: provider.account.getFactoryAddress(), | ||
index: provider.account.index, | ||
initCode, | ||
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 there a reason reconnect the provider with the same initCode as the original provider's account? can't we just set the owner to the new owner?
also, do we need to first disconnect at all if we're going to reconnect?
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.
yea I don't know if we do need it since we send a UO anyways so it will get deployed with the only account, but just in case I wanted to keep it here
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.
I was disconnecting first since I wanna make some changes to disconnect to clear out the provider methods that connect adds
value: toHex(1000000000000000n), | ||
}); | ||
|
||
const { connectFn, ...upgradeToData } = await getMSCAUpgradeToData( |
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.
oh this is cool, but do we think we should just make this (upgradeToData) an actual field on the returned object and nest the implAddress + initializationData, or leave them as top-line field? do we think devs would ever want to decouple them?
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.
I decoupled them here because having the connect happen as part of the upgrade call makes typing super hard. so this makes it a bit easier for peeps
Co-authored-by: Ajay Vasisht <43521356+avasisht23@users.noreply.github.com>
Pull Request Checklist
yarn test
)site
folder, and guidelines for updating/adding docs can be found in the contribution guide)feat!: breaking change
)yarn lint:check
) and fix any issues? (yarn lint:fix
)development
and notmain
?PR-Codex overview
Detailed summary
@alchemy/aa-core
dependency to version1.2.4
in multiple packages.encodeUpgradeToAndCall
method toISmartContractAccount
interface.upgradeAccount
method toISmartAccountProvider
interface.encodeUpgradeToAndCall
method toLightSmartContractAccount
class.upgradeAccount
method toSmartAccountProvider
class.