Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Commit

Permalink
Add failing test
Browse files Browse the repository at this point in the history
  • Loading branch information
Mason Liang committed Sep 21, 2023
1 parent 9c2a22f commit 771f58f
Showing 1 changed file with 27 additions and 4 deletions.
31 changes: 27 additions & 4 deletions zkevm-circuits/src/evm_circuit/execution/begin_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -634,13 +634,12 @@ impl<F: Field> ExecutionGadget<F> for BeginTxGadget<F> {

#[cfg(test)]
mod test {
use std::vec;

use crate::{evm_circuit::test::rand_bytes, test_util::CircuitTestBuilder};
use bus_mapping::evm::OpcodeId;
use eth_types::{self, bytecode, evm_types::GasCost, word, Bytecode, Word};

use eth_types::{self, bytecode, evm_types::GasCost, word, Address, Bytecode, Word};
use ethers_core::utils::get_contract_address;
use mock::{eth, gwei, MockTransaction, TestContext, MOCK_ACCOUNTS};
use std::vec;

fn gas(call_data: &[u8]) -> Word {
Word::from(
Expand Down Expand Up @@ -920,4 +919,28 @@ mod test {
begin_tx_deploy(0x1020304050607080u64);
begin_tx_deploy(0xfffffffffffffffeu64);
}

#[test]
fn create_tx_for_existing_account() {
let address = Address::repeat_byte(23);
let nonce = 10;
let new_address = get_contract_address(address, nonce + 1);

let ctx = TestContext::<1, 2>::new(
None,
|accs| {
accs[0].address(address).nonce(nonce).balance(eth(10));
},
|mut txs, _| {
txs[0].from(address).to(new_address).value(eth(2));
txs[1].from(address);
},
|block, _| block,
)
.unwrap();

CircuitTestBuilder::new_from_test_ctx(ctx).run();

panic!();
}
}

0 comments on commit 771f58f

Please sign in to comment.