-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
add alloy_chains #5952
add alloy_chains #5952
Conversation
Hey @mattsse I have just started the work of switching to alloy_chains, just added few lines now. |
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 missing impls are hidden behind features
@@ -101,7 +102,7 @@ pub enum EthHandshakeError { | |||
MismatchedProtocolVersion(GotExpected<u8>), | |||
#[error("mismatched chain in status message: {0}")] | |||
/// Mismatch in chain details in status messages. | |||
MismatchedChain(GotExpected<Chain>), | |||
MismatchedChain(GotExpected<ChainKind>), |
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 remain Chain
@@ -24,7 +25,7 @@ pub struct Status { | |||
|
|||
/// The chain id, as introduced in | |||
/// [EIP155](https://eips.ethereum.org/EIPS/eip-155#list-of-chain-ids). | |||
pub chain: Chain, | |||
pub chain: ChainKind, |
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.
should remain Chain
Cargo.toml
Outdated
@@ -150,6 +150,7 @@ alloy-primitives = "0.5" | |||
alloy-dyn-abi = "0.5" | |||
alloy-sol-types = "0.5" | |||
alloy-rlp = "0.3" | |||
alloy-chains = "0.1.7" |
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.
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.
okay got it
bin/reth/src/dirs.rs
Outdated
@@ -12,8 +12,8 @@ use std::{ | |||
/// Constructs a string to be used as a path for configuration and db paths. | |||
pub fn config_path_prefix(chain: Chain) -> String { | |||
match chain { |
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.
here whether I use Named of from_named, I am getting the same errror, need some help 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 think this can be used
pub fn config_path_prefix(chain: Chain) -> String {
if let Some(named) = chain.named() {
named.to_string()
} else {
chain.id().to_string()
}
}
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.
should we move this to a Display
/ ToString
impl?
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.
seems like Chain
already implements Display
(which gets us ToString
)
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.
needs rebase and some changes to pass tests and satisfy clippy.
for parse
test errors this should work: .parse::<alloy_chains::Chain>().unwrap()
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.
great, one more nit
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.
there are lots of unrelated changes (semicolon), please discard those.
and we don't want to add the alloy chains dep everywhere instead we should continue to re-export Chain from the primitives crate
@@ -101,7 +101,7 @@ impl DatabaseInstance { | |||
#[cfg(test)] | |||
mod tests { | |||
use super::*; | |||
use reth_primitives::Chain; | |||
use alloy_chains::Chain; |
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 still use from pritimitives
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.
ig but the db functions are using alloy_chains::Chain, if I use reth_primitives::Chain it will give a mismatch type error
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.
it should be the same exact type.
I have removed the semicolon issue, can you give more details on the second one? |
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.
sorry I overlooked that this PR didn't actually remove the all the reth_primitive::Chain types:
https://github.com/paradigmxyz/reth/blob/main/crates/primitives/src/chain/mod.rs#L99-L99
which was the actual goal of this PR
@@ -101,7 +101,7 @@ impl DatabaseInstance { | |||
#[cfg(test)] | |||
mod tests { | |||
use super::*; | |||
use reth_primitives::Chain; | |||
use alloy_chains::Chain; |
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.
it should be the same exact type.
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.
great!
I simply removed the reth-primitive chain def and replaced it with the reexport.
now this is complete, ty!
pub const SUPPORTED_CHAINS: &[&str] = &["base", "base_goerli", "base_sepolia"]; | ||
pub const SUPPORTED_CHAINS: &[&str] = &["base", "base-goerli", "base-sepolia"]; |
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 a breaking change in the CLI right, we should communicate that in the release notes
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 but this now mirrors what op-geth accepts so this is a good change
resolves #5429