Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

All notable changes to arc-node are documented in this file.

## [Unreleased]

### Fixes

- [EL] Restore Zero6 registration gate for the PQ precompile (regressed in v0.8.0); pre-Zero6 blocks no longer execute the verifier on replay

## [v0.8.0]

**Changes:** [v0.7.3...v0.8.0](https://github.com/circlefin/arc-node/compare/v0.7.3...v0.8.0) -- [release notes](https://github.com/circlefin/arc-node/releases/tag/v0.8.0)
Expand Down
35 changes: 27 additions & 8 deletions crates/precompiles/src/precompile_provider.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::pq::{run_pq, PQ_ADDRESS};
use crate::system_accounting::{run_system_accounting, SYSTEM_ACCOUNTING_ADDRESS};
use alloy_evm::precompiles::PrecompilesMap;
use alloy_primitives::Address;
use arc_execution_config::hardforks::ArcHardforkFlags;
use arc_execution_config::hardforks::{ArcHardfork, ArcHardforkFlags};
use reth_ethereum::evm::revm::precompile::PrecompileSpecId;
use reth_ethereum::evm::revm::precompile::Precompiles;
use reth_evm::precompiles::DynPrecompile;
Expand Down Expand Up @@ -60,10 +60,16 @@ impl ArcPrecompileProvider {
PrecompileId::Custom("SYSTEM_ACCOUNTING".into()),
move |input| run_system_accounting(input, hardfork_flags),
)),
PQ_ADDRESS => Some(DynPrecompile::new_stateful(
PrecompileId::Custom("PQ".into()),
move |input| run_pq(input, hardfork_flags),
)),
PQ_ADDRESS => {
// Only register PQ precompile if Zero6 hardfork is active
if !hardfork_flags.is_active(ArcHardfork::Zero6) {
return None;
}
Some(DynPrecompile::new_stateful(
PrecompileId::Custom("PQ".into()),
move |input| run_pq(input, hardfork_flags),
))
}
_ => handle_unknown_precompile(address),
});
precompile_map
Expand Down Expand Up @@ -117,15 +123,28 @@ mod tests {
}

#[test]
fn test_pq_precompile_available() {
fn test_pq_precompile_available_with_zero6() {
let precompiles = ArcPrecompileProvider::create_precompiles_map(
SpecId::PRAGUE,
ArcHardforkFlags::default(),
ArcHardforkFlags::with(&[ArcHardfork::Zero6]),
);

assert!(
precompiles.get(&PQ_ADDRESS).is_some(),
"PQ precompile should be available"
"PQ precompile should be available when Zero6 is active"
);
}

#[test]
fn test_pq_precompile_not_available_without_zero6() {
let precompiles = ArcPrecompileProvider::create_precompiles_map(
SpecId::PRAGUE,
ArcHardforkFlags::default(),
);

assert!(
precompiles.get(&PQ_ADDRESS).is_none(),
"PQ precompile should NOT be available without Zero6"
);
}

Expand Down