-
Notifications
You must be signed in to change notification settings - Fork 15
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
SIP-26: Non-EVM protocol support #147
Conversation
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.
Left a couple of small comments, overall this looks like a good improvement to handle multichain requests and scale the wallet beyond EVM chains
SIPS/sip-26.md
Outdated
- **Account Router**: Native component that forwards signing requests to the | ||
appropriate Account Snap or native implementation. |
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 see that the Account Router
is the one that registers signing methods to the RPC Router
, but how are the signing methods registered into the Account Router
?
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.
They are listed in the account object in the methods
field.
But it made me think of another problem: the account doesn't list the supported chains (there is a method to get this information, but we should probably move it into the account object).
Co-authored-by: Gustavo Antunes <17601467+gantunesr@users.noreply.github.com>
Co-authored-by: Charly Chevalier <charlyy.chevalier@gmail.com>
SIPS/sip-26.md
Outdated
- **Account Address Resolution Snaps**: Snaps that implement the | ||
`resolveAccountAddress` method to extract the account address from the | ||
request object. |
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.
Can these Snaps be the same as Account and Protocol Snaps, or do they have to be separate?
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.
After talking with @Mrtenz, I believe the Snaps should remain separate. Our goal is for these Snaps to operate without special permissions. Additionally, we should have only one Account Address Resolution Snap per blockchain. This will help simplify the Account (CAIP-2) Snap and prevent any confusion about which Account Address Resolution Snap to use.
SIPS/sip-26.md
Outdated
- **Account Snaps**: Snaps that implement the Keyring API and are responsible | ||
for signing requests and managing accounts. | ||
|
||
- **Protocol Snaps**: Snaps that implement protocol methods that do not require | ||
an account to be executed. |
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 thought per our discussions with @rekmarks we'd determined that we can't enforce separation of Account + Protocol Snaps?
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 I now see the language in your diagram saying that these can be combined. I think its more confusing to represent them as (sortof) separate in the diagram.
As I believe I said in our meeting I don't think we're really getting anything by having these non signing protocol snaps that implement non signing methods if the signing snaps can trivially handle those requests too.
In that case I feel like its clearer to call them something more general than "Account Snaps" since they are not just handling accounts. Maybe "Protocol Snaps" or "CAIP-2 Snaps" (though I'd prefer something that clearly states its purpose without external reference).
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.
To restate what I said in a meeting: As I read it, they are just two separate permissions that a Snap may or may not put together, and some Snaps (e.g. hardware wallet or SCAs) may want to only ship the account part.
SIPS/sip-26.md
Outdated
account: { | ||
id: '74bb3393-f267-48ee-855a-2ba575291ab0', | ||
type: 'eip155:eoa', | ||
address: '0x1234567890123456789012345678901234567890', |
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.
this should be a caip-10 address to include the chainid which is missing context here when creating an account:
eip155:1:0xab16a96D359eC26a11e2C2b3d8f8B8942d5Bfcdb
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 agreed. We will need some way to associate this account with the appropriate CAIP-2 identifier for routing purposes, whether its making these CAIP-10 addresses or adding a CAIP-2 property on the object.
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.
This is not a 1:1 mapping to the blockchain account, and for EVM chains the address is the same accross all networks, so I think CAIP-2 addresses are not suitable here.
We have thought about using CAIP-2 namespaces, but it's not in the scope of this SIP, this snippet is an example of the existing API.
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.
🤔 Do we have a plan for how to handle types that are not eip155:eoa
(EVM SCAs and other non-evm chains where the account type might not provide enough to be sure that the account can be used on all subchains) then? Seems like we should include a CAIP-2 scope(s) property 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.
is there documentation we could link to where this type
property is defined/scoped?
SIPS/sip-26.md
Outdated
type: 'eip155:eoa', | ||
address: '0x1234567890123456789012345678901234567890', | ||
methods: ['eth_signTypedData_v4'], | ||
options: {}, |
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.
what would go in options
?
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.
This is part of the Keyring API and is used by Snap devs to store implementation-dependent information about the account. An example would be to use it to store the tresholds, index, and other metadata used by MPC accounts.
* SIP-26: Update Snaps-specific parts of the specification * Minor updates * Reword slightly * Update SIPS/sip-26.md Co-authored-by: Alex Donesky <alex.donesky@consensys.net> --------- Co-authored-by: Alex Donesky <alex.donesky@consensys.net>
Co-authored-by: Frederik Bolding <frederik.bolding@gmail.com>
Awaiting sign off from @adonesky1 before merging |
#### RPC Router | ||
|
||
The RPC Router will be a new native component responsible for routing JSON-RPC | ||
requests to the appropriate Snap or keyring. |
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 it confusing to separate keyring
from Snap here since all the keyrings we route to are Snap keyrings?
requests to the appropriate Snap or keyring. | |
requests to the appropriate Snap. |
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 dunno this isn't a big deal and maybe its better as is
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.
Personally I think this is fine as-is since we don't wanna route directly to keyring Snaps, but to the native keyring controlling them. It is a minor detail though
type: "eip155:eoa", | ||
address: "0x1234567890123456789012345678901234567890", | ||
methods: ["eth_signTypedData_v4"], |
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.
[nit] since this SIP is for non-evm snaps should we provide a non-evm example 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.
Also I'm still wondering how we plan to standardize non-evm account types. Currently our documentation only appears to describe eip155:eoa
or eip155:erc4337
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 have been requesting this as well, we need a more generic type that allows any protocol. IIRC @danroc and team are thinking about how to do that.
Co-authored-by: Alex Donesky <alex.donesky@consensys.net>
7b35ebc
Abstract
This SIP presents an architecture to enable Snaps to expose blockchain-specific methods to dapps, extending MetaMask's functionality to support a multichain ecosystem.
Motivation
Currently, MetaMask is limited to EVM-compatible networks. This proposal aims to empower developers, both first- and third-party, to use Snaps to add native support for non-EVM-compatible chains within MetaMask.
Fixes: https://github.com/MetaMask/accounts-planning/issues/542