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

Function test_initialization

crates/execution/evm/src/config.rs:554–616  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

552
553 #[test]
554 fn test_initialization() {
555 // Create a new BundleState object with initial data
556 let bundle = BundleState::new(
557 vec![(Address::new([2; 20]), None, Some(AccountInfo::default()), HashMap::default())],
558 vec![vec![(Address::new([2; 20]), None, vec![])]],
559 vec![],
560 );
561
562 // Create a Receipts object with a vector of receipt vectors
563 let receipts = vec![vec![Some(BaseReceipt::Legacy(Receipt::<Log> {
564 cumulative_gas_used: 46913,
565 logs: vec![],
566 status: true.into(),
567 }))]];
568
569 // Create a Requests object with a vector of requests
570 let requests = vec![Requests::new(vec![bytes!("dead"), bytes!("beef"), bytes!("beebee")])];
571
572 // Define the first block number
573 let first_block = 123;
574
575 // Create a ExecutionOutcome object with the created bundle, receipts, requests, and
576 // first_block
577 let exec_res = ExecutionOutcome {
578 bundle: bundle.clone(),
579 receipts: receipts.clone(),
580 requests: requests.clone(),
581 first_block,
582 };
583
584 // Assert that creating a new ExecutionOutcome using the constructor matches exec_res
585 assert_eq!(
586 ExecutionOutcome::new(bundle, receipts.clone(), first_block, requests.clone()),
587 exec_res
588 );
589
590 // Create a BundleStateInit object and insert initial data
591 let mut state_init: BundleStateInit = AddressMap::default();
592 state_init
593 .insert(Address::new([2; 20]), (None, Some(Account::default()), B256Map::default()));
594
595 // Create an AddressMap for account reverts and insert initial data
596 let mut revert_inner: AddressMap<AccountRevertInit> = AddressMap::default();
597 revert_inner.insert(Address::new([2; 20]), (None, vec![]));
598
599 // Create a RevertsInit object and insert the revert_inner data
600 let mut revert_init: RevertsInit = HashMap::default();
601 revert_init.insert(123, revert_inner);
602
603 // Assert that creating a new ExecutionOutcome using the new_init method matches
604 // exec_res
605 assert_eq!(
606 ExecutionOutcome::new_init(
607 state_init,
608 revert_init,
609 vec![],
610 receipts,
611 first_block,

Callers

nothing calls this directly

Calls 2

cloneMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected