Skip to content

Commit

Permalink
fix test compilation errors and clippy warnings.
Browse files Browse the repository at this point in the history
  • Loading branch information
raulk committed Aug 15, 2022
1 parent d9ce5c1 commit 8ac9939
Show file tree
Hide file tree
Showing 8 changed files with 155 additions and 18 deletions.
144 changes: 137 additions & 7 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions actors/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ hex = "0.4.3"

[dev-dependencies]
fil_actors_runtime = { path = "../../runtime", features = ["test_utils", "sector-default"] }
libsecp256k1 = { version = "0.7.0", features = ["static-context"] }
hex-literal = "0.3.4"

[features]
fil-actor = ["fil_actors_runtime/fil-actor"]
Expand Down
4 changes: 2 additions & 2 deletions actors/evm/src/interpreter/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,12 +109,12 @@ pub fn execute<'r, BS: Blockstore, RT: Runtime<BS>>(
OpCode::MSTORE => memory::mstore(runtime)?,
OpCode::MSTORE8 => memory::mstore8(runtime)?,
OpCode::JUMP => {
pc = control::jump(&mut runtime.stack, &bytecode)?;
pc = control::jump(&mut runtime.stack, bytecode)?;
continue; // don't increment PC after the jump
}
OpCode::JUMPI => {
// conditional jump
if let Some(dest) = control::jumpi(&mut runtime.stack, &bytecode)? {
if let Some(dest) = control::jumpi(&mut runtime.stack, bytecode)? {
pc = dest; // condition met, set program counter
continue; // don't increment PC after jump
}
Expand Down
6 changes: 3 additions & 3 deletions actors/evm/src/interpreter/instructions/bitwise.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ pub fn shl(stack: &mut Stack) {
if *value == U256::zero() || shift >= U256::from(256) {
*value = U256::zero();
} else {
*value <<= U256::from(shift)
*value <<= shift
};
}

Expand All @@ -45,7 +45,7 @@ pub fn shr(stack: &mut Stack) {
if *value == U256::zero() || shift >= U256::from(256) {
*value = U256::zero()
} else {
*value >>= U256::from(shift)
*value >>= shift
};
}

Expand Down Expand Up @@ -80,7 +80,7 @@ pub fn sar(stack: &mut Stack) {

#[cfg(test)]
mod tests {
use {super::*, crate::uints::u128_words_to_u256};
use {super::*, crate::interpreter::uints::u128_words_to_u256};

#[test]
fn test_instruction_byte() {
Expand Down
2 changes: 1 addition & 1 deletion actors/evm/src/interpreter/system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub struct System<'r, BS: Blockstore, RT: Runtime<BS>> {

impl<'r, BS: Blockstore, RT: Runtime<BS>> System<'r, BS, RT> {
pub fn new(rt: &'r RT, state_cid: Cid) -> anyhow::Result<Self> {
Ok(Self { rt: rt, state: RefCell::new(Hamt::load(&state_cid, rt.store())?) })
Ok(Self { rt, state: RefCell::new(Hamt::load(&state_cid, rt.store())?) })
}

pub fn flush_state(&self) -> Result<Cid, ActorError> {
Expand Down
8 changes: 4 additions & 4 deletions actors/evm/src/interpreter/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@ impl Debug for Transaction {
#[cfg(test)]
mod tests {
use {
crate::{
crate::interpreter::{
transaction::{AccessListItem, Transaction, TransactionAction},
SignedTransaction, H160, H256, U256,
},
Expand Down Expand Up @@ -641,7 +641,7 @@ mod tests {
&input
);
} else {
assert!(false, "decoded into wrong transaction type");
panic!("decoded into wrong transaction type");
}
}

Expand Down Expand Up @@ -719,7 +719,7 @@ mod tests {
access_list
)
} else {
assert!(false, "decoded into wrong transaction type");
panic!("decoded into wrong transaction type");
}
}

Expand Down Expand Up @@ -779,7 +779,7 @@ mod tests {
action
);
} else {
assert!(false, "decoded into wrong transaction type");
panic!("decoded into wrong transaction type");
}
}
}
5 changes: 5 additions & 0 deletions actors/evm/src/interpreter/uints.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
#![allow(dead_code)]

// to silence construct_uint! clippy warnings
// see https://github.com/paritytech/parity-common/issues/660
#![allow(clippy::ptr_offset_with_cast,clippy::assign_op_pattern)]

use {
fixed_hash::construct_fixed_hash,
impl_serde::{impl_fixed_hash_serde, impl_uint_serde},
Expand Down
2 changes: 1 addition & 1 deletion actors/evm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ impl EvmRuntimeActor {
{
// constructor ran to completion successfully and returned
// the resulting bytecode.
let contract_bytecode = exec_status.output_data.clone();
let contract_bytecode = exec_status.output_data;

let contract_state_cid = system.flush_state()?;

Expand Down

0 comments on commit 8ac9939

Please sign in to comment.