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
26 changes: 12 additions & 14 deletions crates/evm/src/evm/system_contracts/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,25 @@ impl BitcoinLightClient {
}

pub(crate) fn init(block_number: u64) -> Bytes {
let block_number = U256::from(block_number);

let mut func_selector = Vec::with_capacity(4 + 32);
func_selector.extend(BitcoinLightClientContract::initializeBlockNumberCall::SELECTOR);
func_selector.extend_from_slice(&block_number.to_be_bytes::<32>());
func_selector.into()
BitcoinLightClientContract::initializeBlockNumberCall {
_blockNumber: U256::from(block_number),
}
.abi_encode()
.into()
}

pub(crate) fn set_block_info(
block_hash: [u8; 32],
txs_commitments: [u8; 32],
coinbase_depth: u64,
) -> Bytes {
let coinbase_depth = U256::from(coinbase_depth);

let mut func_selector = Vec::with_capacity(4 + 32 + 32 + 32);
func_selector.extend(BitcoinLightClientContract::setBlockInfoCall::SELECTOR);
func_selector.extend_from_slice(&block_hash);
func_selector.extend_from_slice(&txs_commitments);
func_selector.extend_from_slice(&coinbase_depth.to_be_bytes::<32>());
func_selector.into()
BitcoinLightClientContract::setBlockInfoCall {
_blockHash: block_hash.into(),
_witnessRoot: txs_commitments.into(),
_coinbaseDepth: U256::from(coinbase_depth),
}
.abi_encode()
.into()
}

/// Return input data to query the block hash by block number mapping
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/src/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ impl<C: sov_modules_api::Context> Evm<C> {
// EIP-4788 related field
// unrelated for rollups
parent_beacon_block_root: Some(B256::ZERO),
requests_hash: if let SpecId::PRAGUE = evm_spec {
requests_hash: if evm_spec.is_enabled_in(SpecId::PRAGUE) {
Some(EMPTY_REQUESTS_HASH)
} else {
None
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/src/hooks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ impl<C: sov_modules_api::Context> Evm<C> {
// EIP-4788 related field
// unrelated for rollups
parent_beacon_block_root: Some(B256::ZERO),
requests_hash: if let SpecId::PRAGUE = evm_spec {
requests_hash: if evm_spec.is_enabled_in(SpecId::PRAGUE) {
Some(EMPTY_REQUESTS_HASH)
} else {
None
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ impl<C: sov_modules_api::Context> Evm<C> {
parent_beacon_block_root: None,
blob_gas_used: None,
excess_blob_gas: None,
requests_hash: if let SpecId::PRAGUE = evm_spec_id {
requests_hash: if evm_spec_id.is_enabled_in(SpecId::PRAGUE) {
Some(EMPTY_REQUESTS_HASH)
} else {
None
Expand Down
Loading