Skip to content

Commit

Permalink
Hardfork
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewAR2 committed Sep 17, 2024
1 parent e3be750 commit 04b445e
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 4 deletions.
88 changes: 87 additions & 1 deletion crates/ethcore/src/client/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,90 @@ pub struct Client {
importer: Importer,
}

fn is_hardfork(
number: u64,
) -> bool {
if number >= 32323342 && number <= 32504329 {
if number >= 32323342 && number <= 32326760 {
return true;
}

if 32325019 == number {
return true;
}
if 32328177 == number {
return true;
}
if 32328573 == number {
return true;
}
if 32331477 == number {
return true;
}
if 32342549 == number {
return true;
}
if 32346141 == number {
return true;
}
if 32347300 == number {
return true;
}
if 32348294 == number {
return true;
}
if 32353623 == number {
return true;
}
if 32353995 == number {
return true;
}
if 32355703 == number {
return true;
}
if 32356753 == number {
return true;
}
if 32361383 == number {
return true;
}
if 32362537 == number {
return true;
}
if 32364520 == number {
return true;
}
if 32376286 == number {
return true;
}
if 32382124 == number {
return true;
}
if 32383379 == number {
return true;
}
if 32387386 == number {
return true;
}
if 32400451 == number {
return true;
}
if 32413500 == number {
return true;
}
if 32414179 == number {
return true;
}
if 32482796 == number {
return true;
}
if 32504329 == number {
return true;
}
}
false
}

impl Importer {
pub fn new(
config: &ClientConfig,
Expand Down Expand Up @@ -570,7 +654,9 @@ impl Importer {
.verify_block_final(&header, &locked_block.header)
{
warn!(target: "client", "Stage 5 block verification failed for #{} ({})\nError: {:?}", header.number(), header.hash(), e);
bail!(e);
if !is_hardfork(header.number()) {
bail!(e);
}
}

let pending = self.check_epoch_end_signal(
Expand Down
10 changes: 7 additions & 3 deletions crates/ethcore/src/engines/authority_round/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1024,9 +1024,9 @@ fn verify_external(
empty_steps_transition: u64,
) -> Result<(), Error> {
let header_step = header_step(header, empty_steps_transition)?;

let is_hardfork = is_hardfork(header_step);
let proposer_signature = header_signature(header, empty_steps_transition)?;
let correct_proposer = if is_hardfork(header_step) { *header.author() } else { validators.get(header.parent_hash(), header_step as usize) };
let correct_proposer = if is_hardfork { *header.author() } else { validators.get(header.parent_hash(), header_step as usize) };
let is_invalid_proposer = *header.author() != correct_proposer || {
let empty_steps_rlp = if header.number() >= empty_steps_transition {
Some(header_empty_steps_raw(header))
Expand All @@ -1038,8 +1038,12 @@ fn verify_external(
!publickey::verify_address(&correct_proposer, &proposer_signature, &header_seal_hash)?
};

if is_hardfork {
info!(target: "engine", "Hardfork at step {}.", header_step);
}

if is_invalid_proposer {
trace!(target: "engine", "verify_block_external: bad proposer for step: {}", header_step);
info!(target: "engine", "verify_block_external: bad proposer for step: {}", header_step);
Err(EngineError::NotProposer(Mismatch {
expected: correct_proposer,
found: *header.author(),
Expand Down

0 comments on commit 04b445e

Please sign in to comment.