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

Method build

crates/execution/node/src/node.rs:134–190  ·  view source on GitHub ↗
(
        &self,
        parent: &SealedHeader<alloy_consensus::Header>,
    )

Source from the content-addressed store, hash-verified

132 for BaseLocalPayloadAttributesBuilder
133{
134 fn build(
135 &self,
136 parent: &SealedHeader<alloy_consensus::Header>,
137 ) -> BasePayloadBuilderAttributes<BaseTxEnvelope> {
138 /// Dummy system transaction for dev mode.
139 const TX_SET_L1_BLOCK_BASE_MAINNET_BLOCK_1: [u8; 349] = alloy_primitives::hex!(
140 "7ef90159a024fa2288af14732611c4b9a8f99b2c929eaf2af8fb45981a752a01417994df3b94deaddeaddeaddeaddeaddeaddeaddeaddead00019442000000000000000000000000000000000000158080830f424080b90104015d8eb900000000000000000000000000000000000000000000000000000000010ac02800000000000000000000000000000000000000000000000000000000648a5ce300000000000000000000000000000000000000000000000000000003ded24b5e5c13d307623a926cd31415036c8b7fa14572f9dac64528e857a470511fc3077100000000000000000000000000000000000000000000000000000000000000010000000000000000000000005050f69a9786f081509234f1a7f4684b5e5b76c900000000000000000000000000000000000000000000000000000000000000bc00000000000000000000000000000000000000000000000000000000000a6fe0"
141 );
142
143 let timestamp = std::cmp::max(
144 parent.timestamp().saturating_add(1),
145 std::time::SystemTime::now().duration_since(std::time::UNIX_EPOCH).unwrap().as_secs(),
146 );
147
148 let default_eip_1559_params = BaseFeeParams::optimism();
149 let denominator = std::env::var("BASE_DEV_EIP1559_DENOMINATOR")
150 .ok()
151 .and_then(|v| v.parse::<u32>().ok())
152 .unwrap_or(default_eip_1559_params.max_change_denominator as u32);
153 let elasticity = std::env::var("BASE_DEV_EIP1559_ELASTICITY")
154 .ok()
155 .and_then(|v| v.parse::<u32>().ok())
156 .unwrap_or(default_eip_1559_params.elasticity_multiplier as u32);
157 let gas_limit =
158 std::env::var("BASE_DEV_GAS_LIMIT").ok().and_then(|v| v.parse::<u64>().ok());
159
160 let mut eip1559_bytes = [0u8; 8];
161 eip1559_bytes[0..4].copy_from_slice(&denominator.to_be_bytes());
162 eip1559_bytes[4..8].copy_from_slice(&elasticity.to_be_bytes());
163 let eip_1559_params = Some(B64::from(eip1559_bytes));
164
165 let attributes = BasePayloadAttributes {
166 payload_attributes: alloy_rpc_types_engine::PayloadAttributes {
167 timestamp,
168 prev_randao: B256::random(),
169 suggested_fee_recipient: Address::random(),
170 withdrawals: self
171 .chain_spec
172 .is_canyon_active_at_timestamp(timestamp)
173 .then(Default::default),
174 parent_beacon_block_root: self
175 .chain_spec
176 .is_ecotone_active_at_timestamp(timestamp)
177 .then(B256::random),
178 slot_number: None,
179 target_gas_limit: None,
180 },
181 transactions: Some(vec![TX_SET_L1_BLOCK_BASE_MAINNET_BLOCK_1.into()]),
182 no_tx_pool: None,
183 gas_limit,
184 eip_1559_params,
185 min_base_fee: Some(0),
186 };
187
188 BasePayloadBuilderAttributes::try_new(parent.hash(), attributes, 3)
189 .expect("static dev payload attributes must decode")
190 }
191}

Callers 13

setupFunction · 0.45
build_engine_apiMethod · 0.45
denim_validatorFunction · 0.45
install_proofs_historyFunction · 0.45
add_onsMethod · 0.45
defaultMethod · 0.45
discv5_configMethod · 0.45

Calls 11

okMethod · 0.80
with_tokio_runtimeMethod · 0.80
newFunction · 0.50
timestampMethod · 0.45
hashMethod · 0.45
with_sequencerMethod · 0.45
cloneMethod · 0.45