Skip to content

Commit

Permalink
fix evm
Browse files Browse the repository at this point in the history
  • Loading branch information
ncitron committed Aug 21, 2023
1 parent 1572c4b commit a3ed492
Show file tree
Hide file tree
Showing 9 changed files with 792 additions and 570 deletions.
540 changes: 357 additions & 183 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ milagro_bls = { git = "https://github.com/Snowfork/milagro_bls" }

# execution
ethers = "2.0.2"
revm = { version = "2.3", default-features = false, features = ["std", "k256", "with-serde"] }
revm = { version = "3.3.0", default-features = false, features = ["std", "secp256k1", "serde"] }
triehash-ethereum = { git = "https://github.com/openethereum/parity-ethereum", rev = "55c90d4016505317034e3e98f699af07f5404b63" }

# async/futures
Expand Down
35 changes: 11 additions & 24 deletions client/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use config::Config;

use consensus::rpc::nimbus_rpc::NimbusRpc;
use consensus::ConsensusClient;
// use execution::evm::Evm;
use execution::evm::Evm;
use execution::rpc::http_rpc::HttpRpc;
use execution::types::CallOpts;
use execution::ExecutionClient;
Expand Down Expand Up @@ -62,34 +62,21 @@ impl Node {
}

pub async fn call(&self, opts: &CallOpts, block: BlockTag) -> Result<Vec<u8>, NodeError> {
// self.check_blocktag_age(&block)?;
self.check_blocktag_age(&block)?;

// let payload = self.get_payload(block)?;
// let mut evm = Evm::new(
// self.execution.clone(),
// payload,
// &self.payloads,
// self.chain_id(),
// );
// evm.call(opts).await.map_err(NodeError::ExecutionEvmError)
let mut evm = Evm::new(self.execution.clone(), self.chain_id(), block);

unimplemented!()
evm.call(opts).await.map_err(NodeError::ExecutionEvmError)
}

pub async fn estimate_gas(&self, opts: &CallOpts) -> Result<u64, NodeError> {
// self.check_head_age()?;

// let payload = self.get_payload(BlockTag::Latest)?;
// let mut evm = Evm::new(
// self.execution.clone(),
// payload,
// &self.payloads,
// self.chain_id(),
// );
// evm.estimate_gas(opts)
// .await
// .map_err(NodeError::ExecutionEvmError)
unimplemented!()
self.check_head_age()?;

let mut evm = Evm::new(self.execution.clone(), self.chain_id(), BlockTag::Latest);

evm.estimate_gas(opts)
.await
.map_err(NodeError::ExecutionEvmError)
}

pub async fn get_balance(&self, address: &Address, tag: BlockTag) -> Result<U256> {
Expand Down
3 changes: 0 additions & 3 deletions execution/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ pub enum EvmError {
#[error("evm error: {0:?}")]
Generic(String),

#[error("evm execution failed: {0:?}")]
Revm(revm::Return),

#[error("rpc error: {0:?}")]
RpcError(Report),
}
Expand Down
Loading

0 comments on commit a3ed492

Please sign in to comment.