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

Function test_commit_mint_value

crates/common/evm/src/handler.rs:685–719  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

683
684 #[test]
685 fn test_commit_mint_value() {
686 let caller = Address::ZERO;
687 let mut db = InMemoryDB::default();
688 db.insert_account_info(
689 caller,
690 AccountInfo { balance: U256::from(1000), ..Default::default() },
691 );
692
693 let mut ctx = Context::base()
694 .with_db(db)
695 .with_chain(L1BlockInfo {
696 l1_base_fee: U256::from(1_000),
697 l1_fee_overhead: Some(U256::from(1_000)),
698 l1_base_fee_scalar: U256::from(1_000),
699 ..Default::default()
700 })
701 .with_cfg(CfgEnv::new_with_spec(BaseSpecId::new(BaseUpgrade::Regolith)));
702 ctx.modify_tx(|tx| {
703 tx.deposit.source_hash = B256::from([1u8; 32]);
704 tx.deposit.mint = Some(10);
705 });
706
707 let mut evm = ctx.build_base();
708
709 let handler =
710 BaseHandler::<_, EVMError<_, BaseTransactionError>, EthFrame<EthInterpreter>>::new();
711 let mut init_and_floor_gas = InitialAndFloorGas::new(0, 0);
712 handler
713 .validate_against_state_and_deduct_caller(&mut evm, &mut init_and_floor_gas)
714 .unwrap();
715
716 // Check the account balance is updated.
717 let account = evm.ctx_mut().journal_mut().load_account(caller).unwrap();
718 assert_eq!(account.info.balance, U256::from(1010));
719 }
720
721 #[test]
722 fn test_remove_l1_cost_non_deposit() {

Callers

nothing calls this directly

Calls 4

build_baseMethod · 0.80
ctx_mutMethod · 0.80
newFunction · 0.50

Tested by

no test coverage detected