MCPcopy Create free account
hub / github.com/base/base / create_static_fixture

Method create_static_fixture

crates/proof/executor/src/test_utils.rs:111–215  ·  view source on GitHub ↗

Create a static test fixture with the configuration provided.

(self)

Source from the content-addressed store, hash-verified

109impl ExecutorTestFixtureCreator {
110 /// Create a static test fixture with the configuration provided.
111 pub async fn create_static_fixture(self) {
112 let chain_id = self.provider.get_chain_id().await.expect("Failed to get chain ID");
113 let rollup_config =
114 base_common_chains::rollup_config!(chain_id).expect("Rollup config not found");
115
116 let executing_block = self
117 .provider
118 .get_block_by_number(self.block_number.into())
119 .await
120 .expect("Failed to get parent block")
121 .expect("Block not found");
122 let parent_block = self
123 .provider
124 .get_block_by_number((self.block_number - 1).into())
125 .await
126 .expect("Failed to get parent block")
127 .expect("Block not found");
128
129 let executing_header = executing_block.header;
130 let parent_header = parent_block.header.inner.seal_slow();
131
132 let encoded_executing_transactions = match executing_block.transactions {
133 BlockTransactions::Hashes(transactions) => {
134 let mut encoded_transactions = Vec::with_capacity(transactions.len());
135 for tx_hash in transactions {
136 let tx = self
137 .provider
138 .client()
139 .request::<&[B256; 1], Bytes>("debug_getRawTransaction", &[tx_hash])
140 .await
141 .expect("Block not found");
142 encoded_transactions.push(tx);
143 }
144 encoded_transactions
145 }
146 _ => panic!("Only BlockTransactions::Hashes are supported."),
147 };
148
149 let payload_attrs = BasePayloadAttributes {
150 payload_attributes: PayloadAttributes {
151 timestamp: executing_header.timestamp,
152 parent_beacon_block_root: executing_header.parent_beacon_block_root,
153 prev_randao: executing_header.mix_hash,
154 withdrawals: Default::default(),
155 suggested_fee_recipient: executing_header.beneficiary,
156 slot_number: None,
157 },
158 gas_limit: Some(executing_header.gas_limit),
159 transactions: Some(encoded_executing_transactions),
160 no_tx_pool: None,
161 eip_1559_params: rollup_config.is_holocene_active(executing_header.timestamp).then(
162 || {
163 executing_header.extra_data[1..9]
164 .try_into()
165 .expect("Invalid header format for Holocene")
166 },
167 ),
168 min_base_fee: rollup_config.is_jovian_active(executing_header.timestamp).then(|| {

Callers

nothing calls this directly

Calls 14

try_intoMethod · 0.80
is_jovian_activeMethod · 0.80
hash_slowMethod · 0.80
outputMethod · 0.80
with_extensionMethod · 0.80
get_block_by_numberMethod · 0.45
lenMethod · 0.45
clientMethod · 0.45
pushMethod · 0.45
is_holocene_activeMethod · 0.45
cloneMethod · 0.45
innerMethod · 0.45

Tested by

no test coverage detected