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

Function test_builder_pattern

crates/consensus/engine/src/test_utils/engine_client.rs:843–880  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

841
842 #[tokio::test]
843 async fn test_builder_pattern() {
844 let cfg = Arc::new(RollupConfig::default());
845 let status =
846 PayloadStatus { status: PayloadStatusEnum::Valid, latest_valid_hash: Some(B256::ZERO) };
847
848 let mock = MockEngineClient::builder()
849 .with_config(Arc::clone(&cfg))
850 .with_new_payload_v2_response(status.clone())
851 .build();
852
853 // Verify the config was set
854 assert_eq!(mock.cfg().block_time, cfg.block_time);
855
856 // Create a minimal ExecutionPayloadInputV2 for testing
857 let payload = ExecutionPayloadInputV2 {
858 execution_payload: ExecutionPayloadV1 {
859 parent_hash: B256::ZERO,
860 fee_recipient: Default::default(),
861 state_root: B256::ZERO,
862 receipts_root: B256::ZERO,
863 logs_bloom: Default::default(),
864 prev_randao: B256::ZERO,
865 block_number: 0,
866 gas_limit: 0,
867 gas_used: 0,
868 timestamp: 0,
869 extra_data: Bytes::new(),
870 base_fee_per_gas: U256::ZERO,
871 block_hash: B256::ZERO,
872 transactions: vec![],
873 },
874 withdrawals: None,
875 };
876
877 // Verify the pre-configured response is returned
878 let result = mock.new_payload_v2(payload).await.unwrap();
879 assert_eq!(result.status, status.status);
880 }
881}

Callers

nothing calls this directly

Calls 7

newFunction · 0.50
builderFunction · 0.50
buildMethod · 0.45
with_configMethod · 0.45
cloneMethod · 0.45
new_payload_v2Method · 0.45

Tested by

no test coverage detected