Skip to content

Commit

Permalink
✨ Add oracle tests to EVM diff tests
Browse files Browse the repository at this point in the history
  • Loading branch information
clabby committed Sep 23, 2023
1 parent 13eb11c commit dbb7c98
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 19 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion crates/mipsevm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ once_cell = "1.18.0"
serde = { version = "1.0.188", features = ["derive"] }
serde_json = "1.0.106"
fnv = "1.0.7"
cfg-if = "1.0.0"

# misc
anyhow = "1.0.75"
Expand Down
1 change: 0 additions & 1 deletion crates/mipsevm/src/mips/mips_vm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,6 @@ where
// Nothing to do; Leave v0 and v1 zero, read nothing, and give no error.
}
Ok(Fd::PreimageRead) => {
dbg!("moose");
let effective_address = (a1 & 0xFFFFFFFC) as Address;

self.track_mem_access(effective_address)?;
Expand Down
8 changes: 2 additions & 6 deletions crates/mipsevm/src/test_utils/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ impl MipsEVM<CacheDB<EmptyDB>> {
// Deploy the MIPS contract prior to deploying it manually. This contract has an immutable
// variable, so we let the creation code fill this in for us, and then deploy it to the
// test address.
let encoded_preimage_addr = Address::from_slice(MIPS_ADDR.as_slice()).into_word();
let encoded_preimage_addr =
Address::from_slice(PREIMAGE_ORACLE_ADDR.as_slice()).into_word();
let mips_creation_heap = hex::decode(MIPS_CREATION_CODE)?
.into_iter()
.chain(encoded_preimage_addr)
Expand Down Expand Up @@ -286,11 +287,6 @@ mod test {
let file_name = String::from(f.file_name().to_str().unwrap());
println!(" -> Running test: {file_name}");

if file_name.starts_with("oracle") {
println!("skipping oracle test");
continue;
}

// Short circuit early for `exit_group.bin`
let exit_group = file_name == "exit_group.bin";

Expand Down
11 changes: 1 addition & 10 deletions crates/mipsevm/src/witness.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,8 @@ impl StepWitness {
/// ### Returns
/// - The ABI encoded input to the MIPS step function.
pub fn encode_step_input(&self) -> Bytes {
let mut abi_state_len = self.state.len();
if abi_state_len % 32 != 0 {
abi_state_len += 32 - (abi_state_len % 32);
}

// Pad state to 32 byte multiple per ABI
let mut abi_state = vec![0u8; abi_state_len];
abi_state[..self.state.len()].copy_from_slice(&self.state);

let call = stepCall {
_0: abi_state,
_0: self.state.to_vec(),
_1: self.mem_proof.clone(),
};

Expand Down

0 comments on commit dbb7c98

Please sign in to comment.