-
Notifications
You must be signed in to change notification settings - Fork 240
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(signer): ethereum implementation #1501
Conversation
74f6beb
to
b394b36
Compare
b394b36
to
c109482
Compare
signer/Cargo.toml
Outdated
@@ -15,7 +15,7 @@ description = "Sign extrinsics to be submitted by Subxt" | |||
keywords = ["parity", "subxt", "extrinsic", "signer"] | |||
|
|||
[features] | |||
default = ["sr25519", "ecdsa", "subxt", "std", "native"] | |||
default = ["sr25519", "ecdsa", "eth", "subxt", "std", "native"] |
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 wonder whether this should be a default feature because I reckon "eth accounts/signer" is rather niche use case and most users won't need it.
Doesn't matter that much it's easy to opt-out anyway, @jsdw thoughts?
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.
The only reason I tend to default to having all feature flags is for nicer IDE/docs support (otherwise loads of stuff is greyed out). So this is consistent with what I did with the other signers, but I'd be very open to figuring out an approach which has IDEs/docs working nicely even without feature flags enabled here; I just haven't given it any thought :)
So there is a difference in the But the ecdsa implementation does not allow soft junctions. https://github.com/paritytech/subxt/blob/master/signer/src/ecdsa.rs#L144 pub fn derive<Js: IntoIterator<Item = DeriveJunction>>(
&self,
junctions: Js,
) -> Result<Self, Error> {
let mut acc = self.0.secret_key().clone().secret_bytes();
for junction in junctions {
match junction {
DeriveJunction::Soft(_) => return Err(Error::SoftJunction),
DeriveJunction::Hard(junction_bytes) => {
acc = ("Secp256k1HDKD", acc, junction_bytes)
.using_encoded(sp_crypto_hashing::blake2_256)
}
}
}
Self::from_seed(acc)
} |
I've removed In Ethereum you have two contenders for derivation paths: Soft derivation: See: https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki So the Maybe we should also bring back the private key constructor since I imagine it would be handy. I've also updated the dev account to match moonbeam's and confirmed they also work on another EVM compatible parachain. |
e63897b
to
22e2a21
Compare
386c4dc
to
2513744
Compare
2513744
to
89931d5
Compare
* Tidy DerivationPath, make no-std compatible, misc bits * fmt * Improve comments and hide bip32 lib from pub interface * remove unstable-eth from defaults again * from_seed => from_secret_key, and check bip39 compliance eg no derivation path mnemonics vs seeds * from_seed to from_Secret_key in sr25519 one; all of them are actually taking secret key bytes
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.
as it stands now I'm happy to merge this once CI is happy; Great job @ryanleecode!
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.
LGTM! Nice once @ryanleecode ! 🚀
This pull request has been mentioned on Polkadot Forum. There might be relevant details there: https://forum.polkadot.network/t/paritytech-update-for-april/7646/1 |
Description
Fixes: #1467
Adds an ethereum signer implementation to the signer crate.
Notes
for _ in 0..20
to add fuzzing to the tests, I'm using proptestTesting
You can test this against moonbeam using chopsticks with the gist provided in the original issue:
https://gist.github.com/jsdw/13240f9341e433ea639b89d0d4235c8b
npx @acala-network/chopsticks@latest --config=chopsticks.yml
chopsticks.yml