Skip to content

Commit

Permalink
Esad/add sys tx to e2e tests (#357)
Browse files Browse the repository at this point in the history
* remove block header from chain init

* add predeploys to genesis files

* small fixes

* better lock handling in mock da

* use nonce 1 for contracts as per eip-161

* solve state commitment bug on contract storage keys

* lint

* in evmdb commit, collect changed storaged keys into BTreeMap instead of Vec + sort

* remove unused lifetime
  • Loading branch information
eyusufatik authored Apr 8, 2024
1 parent 0d9c833 commit d01f9ca
Show file tree
Hide file tree
Showing 24 changed files with 101 additions and 108 deletions.
2 changes: 1 addition & 1 deletion bin/citrea/configs/mock-dockerized/rollup_config.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sequencer_public_key = "204040e364c10f2bec9c1fe500a1cd4c247c89d650a01ed7e82caba867877c21"
include_tx_body = false

sequencer_da_pub_key = "7777777777777777777777777777777777777777777777777777777777777777"
sequencer_da_pub_key = "0000000000000000000000000000000000000000000000000000000000000000"
prover_da_pub_key = ""

[da]
Expand Down
4 changes: 2 additions & 2 deletions bin/citrea/configs/mock/rollup_config.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
sequencer_public_key = "204040e364c10f2bec9c1fe500a1cd4c247c89d650a01ed7e82caba867877c21"
include_tx_body = false

sequencer_da_pub_key = "7777777777777777777777777777777777777777777777777777777777777777"
sequencer_da_pub_key = "0000000000000000000000000000000000000000000000000000000000000000"
prover_da_pub_key = ""

[da]
sender_address = "7777777777777777777777777777777777777777777777777777777777777777"
sender_address = "0000000000000000000000000000000000000000000000000000000000000000"

[storage]
# The path to the rollup's data directory. Paths that do not begin with `/` are interpreted as relative paths.
Expand Down
2 changes: 1 addition & 1 deletion bin/citrea/configs/mock/sequencer_rollup_config.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sequencer_public_key = "204040e364c10f2bec9c1fe500a1cd4c247c89d650a01ed7e82caba867877c21"
include_tx_body = true

sequencer_da_pub_key = "7777777777777777777777777777777777777777777777777777777777777777"
sequencer_da_pub_key = "0000000000000000000000000000000000000000000000000000000000000000"
prover_da_pub_key = ""

[da]
Expand Down
2 changes: 1 addition & 1 deletion bin/citrea/configs/mocknet/rollup_config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ sequencer_public_key = "204040e364c10f2bec9c1fe500a1cd4c247c89d650a01ed7e82caba8
min_soft_confirmations_per_commitment = 1000
include_tx_body = false

sequencer_da_pub_key = "7777777777777777777777777777777777777777777777777777777777777777"
sequencer_da_pub_key = "0000000000000000000000000000000000000000000000000000000000000000"
prover_da_pub_key = ""

[da]
Expand Down
3 changes: 3 additions & 0 deletions bin/citrea/configs/mocknet/sequencer_rollup_config.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
sequencer_public_key = "204040e364c10f2bec9c1fe500a1cd4c247c89d650a01ed7e82caba867877c21"
include_tx_body = true

sequencer_da_pub_key = "0000000000000000000000000000000000000000000000000000000000000000"
prover_da_pub_key = ""

[da]
sender_address = "0000000000000000000000000000000000000000000000000000000000000000"

Expand Down
2 changes: 1 addition & 1 deletion bin/citrea/tests/evm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ async fn execute(client: &Box<TestClient>) -> Result<(), Box<dyn std::error::Err
.eth_get_block_by_number(Some(BlockNumberOrTag::Number(1)))
.await;
assert_eq!(first_block.number.unwrap().as_u64(), 1);
assert_eq!(first_block.transactions.len(), 1);
assert_eq!(first_block.transactions.len(), 3);

let set_arg = 923;
let tx_hash = {
Expand Down
4 changes: 2 additions & 2 deletions bin/citrea/tests/test_helpers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ pub async fn start_rollup(
},
},
da: MockDaConfig {
sender_address: MockAddress::from([5; 32]),
sender_address: MockAddress::from([0; 32]),
},
prover_service: ProverServiceConfig {
aggregated_proof_block_jump: 1,
Expand All @@ -76,7 +76,7 @@ pub async fn start_rollup(
}
NodeMode::SequencerNode => None,
},
sequencer_da_pub_key: vec![5; 32],
sequencer_da_pub_key: vec![0; 32],
prover_da_pub_key: vec![],
include_tx_body,
};
Expand Down
10 changes: 10 additions & 0 deletions bin/test-data/genesis/demo-tests/bitcoin-regtest/evm.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
"code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
"code": "0x",
"nonce": 0
},
{
"address": "0x3100000000000000000000000000000000000001",
"balance": "0x00",
"code_hash": "0xf6aebab66d7995edb5fda848698e2b3d7921aec3647193011ca7155150403f32",
"code": "0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c806379ba50971161008c578063e30c397811610066578063e30c3978146101c0578063ee82ac5e146101d3578063f2fde38b146101f3578063fe5a53771461020657600080fd5b806379ba50971461016d5780638da5cb5b14610175578063be7d4fb1146101a057600080fd5b80630e27bc11146100d45780631f578333146100e957806334cdf78d146100fc5780633dc090b31461012f57806357e871e71461015c578063715018a614610165575b600080fd5b6100e76100e2366004610550565b610226565b005b6100e76100f7366004610572565b610319565b61011c61010a366004610572565b60026020526000908152604090205481565b6040519081526020015b60405180910390f35b61011c61013d366004610572565b6000908152600260209081526040808320548352600390915290205490565b61011c60045481565b6100e761038e565b6100e7610404565b600054610188906001600160a01b031681565b6040516001600160a01b039091168152602001610126565b61011c6101ae366004610572565b60009081526003602052604090205490565b600154610188906001600160a01b031681565b61011c6101e1366004610572565b60009081526002602052604090205490565b6100e761020136600461058b565b6104ca565b61011c610214366004610572565b60036020526000908152604090205481565b6000546001600160a01b031633146102595760405162461bcd60e51b8152600401610250906105bb565b60405180910390fd5b600454600081900361029f5760405162461bcd60e51b815260206004820152600f60248201526e139bdd081a5b9a5d1a585b1a5e9959608a1b6044820152606401610250565b60008181526002602052604090208390556102bb8160016105e8565b60049081556000848152600360209081526040918290208590559154815190815291820185905281018390527f32eff959e2e8d1609edc4b39ccf75900aa6c1da5719f8432752963fdf008234f9060600160405180910390a1505050565b6000546001600160a01b031633146103435760405162461bcd60e51b8152600401610250906105bb565b600454156103895760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b6044820152606401610250565b600455565b6000546001600160a01b031633146103b85760405162461bcd60e51b8152600401610250906105bb565b600080546001600160a01b03191681556040805182815260208101929092527f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0910160405180910390a1565b6001546001600160a01b0316331461045e5760405162461bcd60e51b815260206004820152601b60248201527f43616c6c6572206973206e6f742070656e64696e67206f776e657200000000006044820152606401610250565b60008054600180546001600160a01b03198084166001600160a01b038084169190911786559116909155604080519190921680825260208201939093527f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091015b60405180910390a150565b6000546001600160a01b031633146104f45760405162461bcd60e51b8152600401610250906105bb565b600180546001600160a01b0319166001600160a01b038381169182179092556000546040805191909316815260208101919091527fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae127891016104bf565b6000806040838503121561056357600080fd5b50508035926020909101359150565b60006020828403121561058457600080fd5b5035919050565b60006020828403121561059d57600080fd5b81356001600160a01b03811681146105b457600080fd5b9392505050565b60208082526013908201527221b0b63632b91034b9903737ba1037bbb732b960691b604082015260600190565b8082018082111561060957634e487b7160e01b600052601160045260246000fd5b9291505056fea26469706673582212205dfa4db05d69b0ec5242ffb4b3b1827ebae2a2d822480dd81d73892aca15054264736f6c63430008190033",
"nonce": 1,
"storage": {
"0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddeaddead"
}
}
],
"chain_id": 5655,
Expand Down
3 changes: 0 additions & 3 deletions bin/test-data/genesis/demo-tests/celestia/accounts.json

This file was deleted.

23 changes: 0 additions & 23 deletions bin/test-data/genesis/demo-tests/celestia/evm.json

This file was deleted.

This file was deleted.

10 changes: 10 additions & 0 deletions bin/test-data/genesis/demo-tests/mock/evm.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@
"code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
"code": "0x",
"nonce": 0
},
{
"address": "0x3100000000000000000000000000000000000001",
"balance": "0x00",
"code_hash": "0xf6aebab66d7995edb5fda848698e2b3d7921aec3647193011ca7155150403f32",
"code": "0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c806379ba50971161008c578063e30c397811610066578063e30c3978146101c0578063ee82ac5e146101d3578063f2fde38b146101f3578063fe5a53771461020657600080fd5b806379ba50971461016d5780638da5cb5b14610175578063be7d4fb1146101a057600080fd5b80630e27bc11146100d45780631f578333146100e957806334cdf78d146100fc5780633dc090b31461012f57806357e871e71461015c578063715018a614610165575b600080fd5b6100e76100e2366004610550565b610226565b005b6100e76100f7366004610572565b610319565b61011c61010a366004610572565b60026020526000908152604090205481565b6040519081526020015b60405180910390f35b61011c61013d366004610572565b6000908152600260209081526040808320548352600390915290205490565b61011c60045481565b6100e761038e565b6100e7610404565b600054610188906001600160a01b031681565b6040516001600160a01b039091168152602001610126565b61011c6101ae366004610572565b60009081526003602052604090205490565b600154610188906001600160a01b031681565b61011c6101e1366004610572565b60009081526002602052604090205490565b6100e761020136600461058b565b6104ca565b61011c610214366004610572565b60036020526000908152604090205481565b6000546001600160a01b031633146102595760405162461bcd60e51b8152600401610250906105bb565b60405180910390fd5b600454600081900361029f5760405162461bcd60e51b815260206004820152600f60248201526e139bdd081a5b9a5d1a585b1a5e9959608a1b6044820152606401610250565b60008181526002602052604090208390556102bb8160016105e8565b60049081556000848152600360209081526040918290208590559154815190815291820185905281018390527f32eff959e2e8d1609edc4b39ccf75900aa6c1da5719f8432752963fdf008234f9060600160405180910390a1505050565b6000546001600160a01b031633146103435760405162461bcd60e51b8152600401610250906105bb565b600454156103895760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b6044820152606401610250565b600455565b6000546001600160a01b031633146103b85760405162461bcd60e51b8152600401610250906105bb565b600080546001600160a01b03191681556040805182815260208101929092527f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0910160405180910390a1565b6001546001600160a01b0316331461045e5760405162461bcd60e51b815260206004820152601b60248201527f43616c6c6572206973206e6f742070656e64696e67206f776e657200000000006044820152606401610250565b60008054600180546001600160a01b03198084166001600160a01b038084169190911786559116909155604080519190921680825260208201939093527f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091015b60405180910390a150565b6000546001600160a01b031633146104f45760405162461bcd60e51b8152600401610250906105bb565b600180546001600160a01b0319166001600160a01b038381169182179092556000546040805191909316815260208101919091527fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae127891016104bf565b6000806040838503121561056357600080fd5b50508035926020909101359150565b60006020828403121561058457600080fd5b5035919050565b60006020828403121561059d57600080fd5b81356001600160a01b03811681146105b457600080fd5b9392505050565b60208082526013908201527221b0b63632b91034b9903737ba1037bbb732b960691b604082015260600190565b8082018082111561060957634e487b7160e01b600052601160045260246000fd5b9291505056fea26469706673582212205dfa4db05d69b0ec5242ffb4b3b1827ebae2a2d822480dd81d73892aca15054264736f6c63430008190033",
"nonce": 1,
"storage": {
"0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddeaddead"
}
}
],
"chain_id": 5655,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
"code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
"code": "0x",
"nonce": 0
},
{
"address": "0x3100000000000000000000000000000000000001",
"balance": "0x00",
"code_hash": "0xf6aebab66d7995edb5fda848698e2b3d7921aec3647193011ca7155150403f32",
"code": "0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c806379ba50971161008c578063e30c397811610066578063e30c3978146101c0578063ee82ac5e146101d3578063f2fde38b146101f3578063fe5a53771461020657600080fd5b806379ba50971461016d5780638da5cb5b14610175578063be7d4fb1146101a057600080fd5b80630e27bc11146100d45780631f578333146100e957806334cdf78d146100fc5780633dc090b31461012f57806357e871e71461015c578063715018a614610165575b600080fd5b6100e76100e2366004610550565b610226565b005b6100e76100f7366004610572565b610319565b61011c61010a366004610572565b60026020526000908152604090205481565b6040519081526020015b60405180910390f35b61011c61013d366004610572565b6000908152600260209081526040808320548352600390915290205490565b61011c60045481565b6100e761038e565b6100e7610404565b600054610188906001600160a01b031681565b6040516001600160a01b039091168152602001610126565b61011c6101ae366004610572565b60009081526003602052604090205490565b600154610188906001600160a01b031681565b61011c6101e1366004610572565b60009081526002602052604090205490565b6100e761020136600461058b565b6104ca565b61011c610214366004610572565b60036020526000908152604090205481565b6000546001600160a01b031633146102595760405162461bcd60e51b8152600401610250906105bb565b60405180910390fd5b600454600081900361029f5760405162461bcd60e51b815260206004820152600f60248201526e139bdd081a5b9a5d1a585b1a5e9959608a1b6044820152606401610250565b60008181526002602052604090208390556102bb8160016105e8565b60049081556000848152600360209081526040918290208590559154815190815291820185905281018390527f32eff959e2e8d1609edc4b39ccf75900aa6c1da5719f8432752963fdf008234f9060600160405180910390a1505050565b6000546001600160a01b031633146103435760405162461bcd60e51b8152600401610250906105bb565b600454156103895760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b6044820152606401610250565b600455565b6000546001600160a01b031633146103b85760405162461bcd60e51b8152600401610250906105bb565b600080546001600160a01b03191681556040805182815260208101929092527f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0910160405180910390a1565b6001546001600160a01b0316331461045e5760405162461bcd60e51b815260206004820152601b60248201527f43616c6c6572206973206e6f742070656e64696e67206f776e657200000000006044820152606401610250565b60008054600180546001600160a01b03198084166001600160a01b038084169190911786559116909155604080519190921680825260208201939093527f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091015b60405180910390a150565b6000546001600160a01b031633146104f45760405162461bcd60e51b8152600401610250906105bb565b600180546001600160a01b0319166001600160a01b038381169182179092556000546040805191909316815260208101919091527fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae127891016104bf565b6000806040838503121561056357600080fd5b50508035926020909101359150565b60006020828403121561058457600080fd5b5035919050565b60006020828403121561059d57600080fd5b81356001600160a01b03811681146105b457600080fd5b9392505050565b60208082526013908201527221b0b63632b91034b9903737ba1037bbb732b960691b604082015260600190565b8082018082111561060957634e487b7160e01b600052601160045260246000fd5b9291505056fea26469706673582212205dfa4db05d69b0ec5242ffb4b3b1827ebae2a2d822480dd81d73892aca15054264736f6c63430008190033",
"nonce": 1,
"storage": {
"0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddeaddead"
}
}
],
"chain_id": 5655,
Expand Down
10 changes: 10 additions & 0 deletions bin/test-data/genesis/integration-tests/evm.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,16 @@
"code_hash": "0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",
"code": "0x",
"nonce": 0
},
{
"address": "0x3100000000000000000000000000000000000001",
"balance": "0x00",
"code_hash": "0xf6aebab66d7995edb5fda848698e2b3d7921aec3647193011ca7155150403f32",
"code": "0x608060405234801561001057600080fd5b50600436106100cf5760003560e01c806379ba50971161008c578063e30c397811610066578063e30c3978146101c0578063ee82ac5e146101d3578063f2fde38b146101f3578063fe5a53771461020657600080fd5b806379ba50971461016d5780638da5cb5b14610175578063be7d4fb1146101a057600080fd5b80630e27bc11146100d45780631f578333146100e957806334cdf78d146100fc5780633dc090b31461012f57806357e871e71461015c578063715018a614610165575b600080fd5b6100e76100e2366004610550565b610226565b005b6100e76100f7366004610572565b610319565b61011c61010a366004610572565b60026020526000908152604090205481565b6040519081526020015b60405180910390f35b61011c61013d366004610572565b6000908152600260209081526040808320548352600390915290205490565b61011c60045481565b6100e761038e565b6100e7610404565b600054610188906001600160a01b031681565b6040516001600160a01b039091168152602001610126565b61011c6101ae366004610572565b60009081526003602052604090205490565b600154610188906001600160a01b031681565b61011c6101e1366004610572565b60009081526002602052604090205490565b6100e761020136600461058b565b6104ca565b61011c610214366004610572565b60036020526000908152604090205481565b6000546001600160a01b031633146102595760405162461bcd60e51b8152600401610250906105bb565b60405180910390fd5b600454600081900361029f5760405162461bcd60e51b815260206004820152600f60248201526e139bdd081a5b9a5d1a585b1a5e9959608a1b6044820152606401610250565b60008181526002602052604090208390556102bb8160016105e8565b60049081556000848152600360209081526040918290208590559154815190815291820185905281018390527f32eff959e2e8d1609edc4b39ccf75900aa6c1da5719f8432752963fdf008234f9060600160405180910390a1505050565b6000546001600160a01b031633146103435760405162461bcd60e51b8152600401610250906105bb565b600454156103895760405162461bcd60e51b8152602060048201526013602482015272105b1c9958591e481a5b9a5d1a585b1a5e9959606a1b6044820152606401610250565b600455565b6000546001600160a01b031633146103b85760405162461bcd60e51b8152600401610250906105bb565b600080546001600160a01b03191681556040805182815260208101929092527f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0910160405180910390a1565b6001546001600160a01b0316331461045e5760405162461bcd60e51b815260206004820152601b60248201527f43616c6c6572206973206e6f742070656e64696e67206f776e657200000000006044820152606401610250565b60008054600180546001600160a01b03198084166001600160a01b038084169190911786559116909155604080519190921680825260208201939093527f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e091015b60405180910390a150565b6000546001600160a01b031633146104f45760405162461bcd60e51b8152600401610250906105bb565b600180546001600160a01b0319166001600160a01b038381169182179092556000546040805191909316815260208101919091527fed8889f560326eb138920d842192f0eb3dd22b4f139c87a2c57538e05bae127891016104bf565b6000806040838503121561056357600080fd5b50508035926020909101359150565b60006020828403121561058457600080fd5b5035919050565b60006020828403121561059d57600080fd5b81356001600160a01b03811681146105b457600080fd5b9392505050565b60208082526013908201527221b0b63632b91034b9903737ba1037bbb732b960691b604082015260600190565b8082018082111561060957634e487b7160e01b600052601160045260246000fd5b9291505056fea26469706673582212205dfa4db05d69b0ec5242ffb4b3b1827ebae2a2d822480dd81d73892aca15054264736f6c63430008190033",
"nonce": 1,
"storage": {
"0x0000000000000000000000000000000000000000000000000000000000000000": "0x000000000000000000000000deaddeaddeaddeaddeaddeaddeaddeaddeaddead"
}
}
],
"chain_id": 5655,
Expand Down
8 changes: 2 additions & 6 deletions crates/evm/src/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,6 @@ impl<C: sov_modules_api::Context> Evm<C> {
system_events: Vec<SystemEvent>,
working_set: &mut WorkingSet<C>,
) {
if system_events.is_empty() {
return;
}

let block_env = self
.block_env
.get(working_set)
Expand Down Expand Up @@ -217,12 +213,12 @@ impl<C: sov_modules_api::Context> Evm<C> {
// Adopted from https://github.com/paradigmxyz/reth/blob/main/crates/payload/basic/src/lib.rs#L884
Err(err) => match err {
EVMError::Transaction(_) => {
tracing::debug!("evm: Transaction error: {:?}", err);
tracing::error!("evm: Transaction error: {:?}", err);
// This is a transactional error, so we can skip it without doing anything.
continue;
}
err => {
tracing::debug!("evm: Transaction error: {:?}", err);
tracing::error!("evm: Transaction error: {:?}", err);
// This is a fatal error, so we need to return it.
return Err(err.into());
}
Expand Down
Loading

0 comments on commit d01f9ca

Please sign in to comment.