Skip to content

Commit

Permalink
Fix integration test (privacy-scaling-explorations#389)
Browse files Browse the repository at this point in the history
* fix: add block proposer to AccessSet and comment unimplemented! in BeginTx

* refactor: use match instead of if/if-else/else
  • Loading branch information
han0110 authored Mar 14, 2022
1 parent f2799bc commit 4cd7254
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
8 changes: 7 additions & 1 deletion bus-mapping/src/circuit_input_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1741,7 +1741,13 @@ impl<P: JsonRpcClient> BuilderClient<P> {
eth_block: &EthBlock,
geth_traces: &[eth_types::GethExecTrace],
) -> Result<AccessSet, Error> {
let mut block_access_trace = Vec::new();
let mut block_access_trace = vec![Access {
step_index: None,
rw: RW::WRITE,
value: AccessValue::Account {
address: eth_block.author,
},
}];
for (tx_index, tx) in eth_block.transactions.iter().enumerate() {
let geth_trace = &geth_traces[tx_index];
let tx_access_trace = gen_state_access_trace(eth_block, tx, geth_trace)?;
Expand Down
32 changes: 18 additions & 14 deletions bus-mapping/src/evm/opcodes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -324,20 +324,24 @@ pub fn gen_begin_tx_ops(state: &mut CircuitInputStateRef) -> Result<(), Error> {
},
)?;

if call.is_create() {
unimplemented!("Creation transaction is not yet implemented")
} else if state.is_precompiled(&call.address) {
unimplemented!("Call to precompiled is not yet implemented")
} else {
state.push_op(
RW::READ,
AccountOp {
address: call.address,
field: AccountField::CodeHash,
value: code_hash.to_word(),
value_prev: code_hash.to_word(),
},
);
match (call.is_create(), state.is_precompiled(&call.address)) {
(true, _) => {
// TODO: Implement creation transaction
}
(_, true) => {
// TODO: Implement calling to precompiled
}
_ => {
state.push_op(
RW::READ,
AccountOp {
address: call.address,
field: AccountField::CodeHash,
value: code_hash.to_word(),
value_prev: code_hash.to_word(),
},
);
}
}

for (field, value) in [
Expand Down

0 comments on commit 4cd7254

Please sign in to comment.