-
Notifications
You must be signed in to change notification settings - Fork 840
Move external_tracer
from bus mapping to new crate only for test
#303
Move external_tracer
from bus mapping to new crate only for test
#303
Conversation
I add a new struct There are two places of |
After taking a look at the changes I want to share some thoughts:
These are used both in the bus-mapping and the circuits for testing. In the current form of this PR the mock functionality is split into different parts (bus-mapping, bus-mapping with cfg test, external-tracer, geth_types). I think it's useful to keep them together, so what about moving the complete original let block_trace =
bus_mapping::mock::BlockData::new_single_tx_trace_code_gas(
&bytecode,
Gas(config.gas_limit),
)
.unwrap(); Instead of let accounts = [bus_mapping::mock::new_tracer_account(&bytecode)];
let geth_data = external_tracer::create_tx_by_accounts(
&accounts,
Gas(config.gas_limit),
)
.unwrap();
let block_trace =
bus_mapping::mock::BlockData::new_single_tx_trace(&accounts, geth_data)
.unwrap(); Also I think mock data shouldn't belong in geth_types (MOCK_CHAIN_ID, MOCK_GAS, etc). Also the structs originally found at Finally, I think that by moving the full What do you think about moving the complete original |
@ed255 Yes. I think it should be better to move mod And I have a question about mod But if I create a new mock crate, both |
Ah, you're completely right! It's not straight forward to move the complete So here's a new proposal:
So now we can have a mock crate imported only as testing, and a very small let block_trace =
bus_mapping::mock::BlockData::new_from_geth_data(
mock::geth_data::new_single_tx_trace_code_gas(
&bytecode,
Gas(config.gas_limit),
).unwrap()
); Unfortunately the Nevertheless I still think that all the mock constants (currently in eth-types::geth_types) can be moved to the mock crate. The rest of types currently defined in eth-types::geth_types (that is So in the end the mock crate would only contain methods to generate |
…r-from-bus-mapping-to-new-crate-only-for-test
Hi @ed255 , according to your code review, I make the below fixes:
Please help review when you have time. Thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! LGTM!
@silathdiir everything looks good! Once you bring this branch up to date with main and resolve the conflicts, we can merge this :) |
…r-from-bus-mapping-to-new-crate-only-for-test
* Fix to pass `is_staticcall` to CommonCallGadget, and check with `has_value`. And fix to pass `is_call` to `gas_cost_expr` in `ErrorOOGCallGadget`. * Add constraint of `has_value` and `is_static`.
Close scroll-tech#61
Close #272
Summary
etc-types/src/geth_types.rs
.bus_mapping::mock::BlockData
to test implement (commented with#[cfg(test)]
) and common implement (exported for test of zkevm-circuit).