-
Notifications
You must be signed in to change notification settings - Fork 245
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(alloy-genesis
): pk support
#171
Conversation
cf1a1a8
to
01d3522
Compare
crates/genesis/Cargo.toml
Outdated
@@ -14,6 +14,8 @@ exclude.workspace = true | |||
[dependencies] | |||
alloy-primitives.workspace = true | |||
alloy-rpc-types.workspace = true | |||
alloy-signer.workspace = true | |||
k256.workspace = true |
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.
we should re-export k256 from alloy-signer actually
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.
k256 u mean right?
crates/genesis/src/lib.rs
Outdated
skip_serializing_if = "Option::is_none", | ||
with = "secret_key" | ||
)] | ||
pub private_key: Option<LocalWallet>, |
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 we just do B256?
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.
yeah would prefer that actually. wdyt @mattsse
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.
@Evalir I'd actually prefer just B256 as well.
point in my review still stands, we should have functions on LocalWallet that take care of that
crates/genesis/src/lib.rs
Outdated
pub mod secret_key { | ||
use alloy_primitives::Bytes; | ||
use alloy_signer::LocalWallet; | ||
use k256::{ecdsa::SigningKey, SecretKey}; |
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 not be required here,
the LocalWallet type should have all the necessary functions, if not we should add
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.
Not a great idea to serialize pk as raw bytes in general
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, lets add an issue for the b256 -> LocalWallet and LocalWallet -> B256 calls?
Motivation
missing pk support.
Solution
Adds missing private key support to alloy genesis, see foundry-rs/foundry#6970 (review).
PR Checklist