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

Function build_empty_payload

crates/execution/payload/src/builder.rs:1851–1888  ·  view source on GitHub ↗
(state_root_handle: PayloadStateRootHandle)

Source from the content-addressed store, hash-verified

1849 }
1850
1851 fn build_empty_payload(state_root_handle: PayloadStateRootHandle) -> B256 {
1852 let chain_spec = Arc::new(BaseChainSpec::from(ChainSpec::default()));
1853 let parent = Arc::new(SealedHeader::seal_slow(Header {
1854 gas_limit: 30_000_000,
1855 ..Default::default()
1856 }));
1857 let payload_id = PayloadId::new([0; 8]);
1858 let attributes = BasePayloadBuilderAttributes::<BaseTxEnvelope> {
1859 payload_attributes: EthPayloadBuilderAttributes {
1860 id: payload_id,
1861 parent: parent.hash(),
1862 timestamp: 2,
1863 parent_beacon_block_root: Some(B256::ZERO),
1864 ..Default::default()
1865 },
1866 no_tx_pool: true,
1867 gas_limit: Some(parent.gas_limit),
1868 ..Default::default()
1869 };
1870 let ctx = BasePayloadBuilderCtx {
1871 evm_config: BaseEvmConfig::<_, BasePrimitives>::base(Arc::clone(&chain_spec)),
1872 builder_config: BaseBuilderConfig::default(),
1873 chain_spec,
1874 config: PayloadConfig::new(parent, attributes, payload_id),
1875 cancel: Default::default(),
1876 best_payload: None,
1877 };
1878 let provider = NoopProvider::default();
1879 let builder =
1880 Builder::new(|_, _| NoopPayloadTransactions::<BasePooledTransaction>::default());
1881 let outcome = builder
1882 .build(StateProviderDatabase::new(&provider), &provider, Some(state_root_handle), ctx)
1883 .expect("empty payload must build");
1884 let BuildOutcomeKind::Freeze(payload) = outcome else {
1885 panic!("no-tx-pool payload must freeze")
1886 };
1887 payload.block().state_root
1888 }
1889
1890 /// The block gas reservation must include EIP-8130 `payer_auth` on top of the
1891 /// declared `gas_limit`: a transaction that fits on `gas_limit` alone is still

Calls 4

newFunction · 0.50
hashMethod · 0.45
buildMethod · 0.45
blockMethod · 0.45