feat: bump alloy (#12930)

Co-authored-by: Ryan Schneider <ryanleeschneider@gmail.com>
This commit is contained in:
Arsenii Kulikov
2024-12-02 04:55:17 +04:00
committed by GitHub
parent 890f082453
commit 7f88e62781
41 changed files with 386 additions and 204 deletions

View File

@ -332,6 +332,8 @@ mod tests {
.unwrap(),
withdrawals: None,
parent_beacon_block_root: None,
target_blobs_per_block: None,
max_blobs_per_block: None,
};
// Verify that the generated payload ID matches the expected value
@ -369,6 +371,8 @@ mod tests {
},
]),
parent_beacon_block_root: None,
target_blobs_per_block: None,
max_blobs_per_block: None,
};
// Verify that the generated payload ID matches the expected value
@ -401,6 +405,8 @@ mod tests {
)
.unwrap(),
),
target_blobs_per_block: None,
max_blobs_per_block: None,
};
// Verify that the generated payload ID matches the expected value

View File

@ -4,7 +4,7 @@ use crate::{
dao_fork::{DAO_HARDFORK_BENEFICIARY, DAO_HARDKFORK_ACCOUNTS},
EthEvmConfig,
};
use alloc::{boxed::Box, sync::Arc, vec, vec::Vec};
use alloc::{boxed::Box, sync::Arc, vec::Vec};
use alloy_consensus::Transaction as _;
use alloy_eips::eip7685::Requests;
use core::fmt::Display;
@ -232,7 +232,12 @@ where
let deposit_requests =
crate::eip6110::parse_deposits_from_receipts(&self.chain_spec, receipts)?;
let mut requests = Requests::new(vec![deposit_requests]);
let mut requests = Requests::default();
if !deposit_requests.is_empty() {
requests.push_request(core::iter::once(0).chain(deposit_requests).collect());
}
requests.extend(self.system_caller.apply_post_execution_changes(&mut evm)?);
requests
} else {
@ -1127,9 +1132,9 @@ mod tests {
let receipt = receipts.first().unwrap();
assert!(receipt.success);
assert!(requests[0].is_empty(), "there should be no deposits");
assert!(!requests[1].is_empty(), "there should be a withdrawal");
assert!(requests[2].is_empty(), "there should be no consolidations");
// There should be exactly one entry with withdrawal requests
assert_eq!(requests.len(), 1);
assert_eq!(requests[0][0], 1);
}
#[test]

View File

@ -1,5 +1,5 @@
use crate::utils::eth_payload_attributes;
use alloy_eips::{calc_next_block_base_fee, eip2718::Encodable2718};
use alloy_eips::{calc_next_block_base_fee, eip2718::Encodable2718, eip4844};
use alloy_primitives::{Address, B256, U256};
use alloy_provider::{network::EthereumWallet, Provider, ProviderBuilder, SendableTx};
use alloy_rpc_types_beacon::relay::{
@ -240,6 +240,7 @@ async fn test_flashbots_validate_v4() -> eyre::Result<()> {
execution_payload: block_to_payload_v3(payload.block().clone()),
blobs_bundle: BlobsBundleV1::new([]),
execution_requests: payload.requests().unwrap_or_default().to_vec(),
target_blobs_per_block: eip4844::TARGET_BLOBS_PER_BLOCK,
signature: Default::default(),
},
parent_beacon_block_root: attrs.parent_beacon_block_root.unwrap(),

View File

@ -26,6 +26,8 @@ pub(crate) fn eth_payload_attributes(timestamp: u64) -> EthPayloadBuilderAttribu
suggested_fee_recipient: Address::ZERO,
withdrawals: Some(vec![]),
parent_beacon_block_root: Some(B256::ZERO),
target_blobs_per_block: None,
max_blobs_per_block: None,
};
EthPayloadBuilderAttributes::new(B256::ZERO, attributes)
}

View File

@ -10,7 +10,10 @@
#![allow(clippy::useless_let_if_seq)]
use alloy_consensus::{Header, EMPTY_OMMER_ROOT_HASH};
use alloy_eips::{eip4844::MAX_DATA_GAS_PER_BLOCK, eip7685::Requests, merge::BEACON_NONCE};
use alloy_eips::{
eip4844::MAX_DATA_GAS_PER_BLOCK, eip7002::WITHDRAWAL_REQUEST_TYPE,
eip7251::CONSOLIDATION_REQUEST_TYPE, eip7685::Requests, merge::BEACON_NONCE,
};
use alloy_primitives::U256;
use reth_basic_payload_builder::{
commit_withdrawals, is_better_payload, BuildArguments, BuildOutcome, PayloadBuilder,
@ -365,7 +368,27 @@ where
)
.map_err(|err| PayloadBuilderError::Internal(err.into()))?;
Some(Requests::new(vec![deposit_requests, withdrawal_requests, consolidation_requests]))
let mut requests = Requests::default();
if !deposit_requests.is_empty() {
requests.push_request(core::iter::once(0).chain(deposit_requests).collect());
}
if !withdrawal_requests.is_empty() {
requests.push_request(
core::iter::once(WITHDRAWAL_REQUEST_TYPE).chain(withdrawal_requests).collect(),
);
}
if !consolidation_requests.is_empty() {
requests.push_request(
core::iter::once(CONSOLIDATION_REQUEST_TYPE)
.chain(consolidation_requests)
.collect(),
);
}
Some(requests)
} else {
None
};
@ -452,6 +475,7 @@ where
blob_gas_used: blob_gas_used.map(Into::into),
excess_blob_gas: excess_blob_gas.map(Into::into),
requests_hash,
target_blobs_per_block: None,
};
let withdrawals = chain_spec