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

Method build

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

Source from the content-addressed store, hash-verified

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

Calls 11

okMethod · 0.80
timestampMethod · 0.45
hashMethod · 0.45
with_tokio_runtimeMethod · 0.45
with_sequencerMethod · 0.45
cloneMethod · 0.45
providerMethod · 0.45