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

Method build

crates/execution/flashblocks-node/src/test_harness.rs:587–632  ·  view source on GitHub ↗

Build the flashblock.

(&self)

Source from the content-addressed store, hash-verified

585
586 /// Build the flashblock.
587 pub fn build(&self) -> Flashblock {
588 let current_block = self.harness.node.latest_block();
589 let canonical_block_num =
590 self.canonical_block_number.unwrap_or_else(|| current_block.number) + 1;
591
592 let base = if self.index == 0 {
593 Some(ExecutionPayloadBaseV1 {
594 parent_beacon_block_root: current_block
595 .parent_beacon_block_root()
596 .unwrap_or_default(),
597 parent_hash: current_block.hash(),
598 fee_recipient: Address::random(),
599 prev_randao: B256::random(),
600 block_number: canonical_block_num,
601 gas_limit: current_block.gas_limit,
602 timestamp: current_block.timestamp + 2,
603 extra_data: Bytes::new(),
604 base_fee_per_gas: U256::from(100),
605 })
606 } else {
607 None
608 };
609
610 let mut transactions = self.transactions.clone();
611 if self.auto_deposit {
612 transactions.insert(0, build_unique_deposit_tx(canonical_block_num));
613 }
614
615 Flashblock {
616 payload_id: PayloadId::default(),
617 index: self.index,
618 base,
619 diff: ExecutionPayloadFlashblockDeltaV1 {
620 state_root: B256::default(),
621 receipts_root: B256::default(),
622 block_hash: B256::default(),
623 gas_used: 0,
624 withdrawals: Vec::new(),
625 logs_bloom: Default::default(),
626 withdrawals_root: Default::default(),
627 transactions,
628 blob_gas_used: Default::default(),
629 },
630 metadata: Metadata::new(canonical_block_num),
631 }
632 }
633}
634
635/// Build a deposit transaction whose `tx_hash` is unique per `block_number`.

Calls 6

build_unique_deposit_txFunction · 0.85
latest_blockMethod · 0.80
hashMethod · 0.45
cloneMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected