Skip to content
Merged
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
28 changes: 18 additions & 10 deletions silkworm/core/protocol/merge_rule_set.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,18 +87,26 @@ void MergeRuleSet::initialize(EVM& evm) {
return;
}

if (evm.revision() < EVMC_CANCUN) {
return;
if (evm.revision() >= EVMC_CANCUN) {
// EIP-4788: Beacon block root in the EVM
SILKWORM_ASSERT(header.parent_beacon_block_root);
Transaction system_txn{};
system_txn.type = TransactionType::kSystem;
system_txn.to = kBeaconRootsAddress;
system_txn.data = Bytes{ByteView{*header.parent_beacon_block_root}};
system_txn.set_sender(kSystemAddress);
evm.execute(system_txn, kSystemCallGasLimit);
}

// EIP-4788: Beacon block root in the EVM
SILKWORM_ASSERT(header.parent_beacon_block_root);
Transaction system_txn{};
system_txn.type = TransactionType::kSystem;
system_txn.to = kBeaconRootsAddress;
system_txn.data = Bytes{ByteView{*header.parent_beacon_block_root}};
system_txn.set_sender(kSystemAddress);
evm.execute(system_txn, kSystemCallGasLimit);
if (evm.revision() >= EVMC_PRAGUE) {
// EIP-2935: Serve historical block hashes from state
Transaction system_txn{};
system_txn.type = TransactionType::kSystem;
system_txn.to = kHistoryStorageAddress;
system_txn.data = Bytes{ByteView{header.parent_hash}};
system_txn.set_sender(kSystemAddress);
evm.execute(system_txn, kSystemCallGasLimit);
}
}

void MergeRuleSet::finalize(IntraBlockState& state, const Block& block) {
Expand Down
3 changes: 3 additions & 0 deletions silkworm/core/protocol/param.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ inline constexpr uint64_t kSystemCallGasLimit{30'000'000};
inline constexpr evmc::address kSystemAddress{0xfffffffffffffffffffffffffffffffffffffffe_address};
inline constexpr evmc::address kBeaconRootsAddress{0x000F3df6D732807Ef1319fB7B8bB8522d0Beac02_address};

// EIP-2935: Serve historical block hashes from state
inline constexpr evmc::address kHistoryStorageAddress{0x0aae40965e6800cd9b1f4b05ff21581047e3f91e_address};

// Used in Bor
inline constexpr size_t kExtraSealSize{65};

Expand Down
Loading