-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
fix the issue of network is not known to be merged #6649
Conversation
@Rjected PTAL |
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.
hmm, perhaps this is the easiest solution.
but we only need this for displaying, and adding an additional field just for that seems a bit odd, especially if we already have something like this on the Chainspec struct:
reth/crates/primitives/src/chain/spec.rs
Lines 606 to 608 in 6204ec7
/// The block at which [Hardfork::Paris] was activated and the final difficulty at this block. | |
#[serde(skip, default)] | |
pub paris_block_and_final_difficulty: Option<(u64, U256)>, |
perhaps we use that in DisplayHardforks
instead for the None case?
wdyt @Rjected
crates/primitives/src/chain/spec.rs
Outdated
@@ -31,7 +31,7 @@ pub static MAINNET: Lazy<Arc<ChainSpec>> = Lazy::new(|| { | |||
// <https://etherscan.io/block/15537394> | |||
paris_block_and_final_difficulty: Some(( | |||
15537394, | |||
U256::from(58_750_003_716_598_352_816_469u128), | |||
U256::from(58_750_003_716_598_352_816_469_u128), |
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.
U256::from(58_750_003_716_598_352_816_469_u128), | |
U256::from(58_750_003_716_598_352_816_469u128), |
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, as I mentioned in the issue, we should be using paris_block_and_total_difficulty
@Rjected Sorry, I missed the previous comments. I would like to confirm if I truly understand what you mean, is that correct? We can pass impl DisplayHardforks {
/// Creates a new [`DisplayHardforks`] from an iterator of hardforks.
pub fn new(hardforks: &BTreeMap<Hardfork, ForkCondition>, ttd: U256) -> Self {
Self::from_iter(hardforks.iter().map(|(fork, condition)| (fork, condition, ttd)))
}
}
impl<'a, 'b> FromIterator<(&'a Hardfork, &'b ForkCondition)> for DisplayHardforks {
fn from_iter<T: IntoIterator<Item = (&'a Hardfork, &'b ForkCondition, U256)>>(iter: T) -> Self {
let mut pre_merge = Vec::new();
let mut with_merge = Vec::new();
let mut post_merge = Vec::new();
for (fork, condition, ttd) in iter {
let display_fork =
DisplayFork { name: fork.to_string(), activated_at: *condition, eip: None, ttd };
match condition {
ForkCondition::Block(_) => {
pre_merge.push(display_fork);
}
ForkCondition::TTD { .. } => {
with_merge.push(display_fork);
}
ForkCondition::Timestamp(_) => {
post_merge.push(display_fork);
}
ForkCondition::Never => continue,
}
}
Self { pre_merge, with_merge, post_merge }
}
} |
yeah, we can remove the from iter impl, and add and we can add |
…merged activated or not Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
…o check merged activated or not" This reverts commit 1e7cbf1. Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
27132cc
to
e2a2369
Compare
@mattsse thanks for the advice, adjusted, and PTAL |
Signed-off-by: jsvisa <[email protected]>
Signed-off-by: jsvisa <[email protected]>
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
pending @Rjected + lint fixes
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 looks good to me, thanks!
close #6453