From 2c9d57a11573a1e47eeef9e83d8fac983b9885e4 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Fri, 16 Feb 2024 09:27:48 -0700 Subject: [PATCH 1/5] unsafe impls --- Cargo.lock | 134 +++++++++++++++--------------- Cargo.toml | 9 +- core/Cargo.toml | 2 - core/src/console/mod.rs | 2 +- core/src/coprocessor.rs | 20 ++++- core/src/database/mod.rs | 4 +- core/src/errors.rs | 2 +- core/src/middleware/connection.rs | 3 + core/src/middleware/mod.rs | 19 ++--- 9 files changed, 103 insertions(+), 92 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5a5750c2..949374a1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -100,9 +100,9 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4b6fb2b432ff223d513db7f908937f63c252bee0af9b82bfd25b0a5dd1eb0d8" +checksum = "ef197eb250c64962003cb08b90b17f0882c192f4a6f2f544809d424fd7cb0e7d" dependencies = [ "alloy-rlp", "bytes", @@ -139,7 +139,7 @@ checksum = "1a047897373be4bbb0224c1afdabca92648dc57a9c9ef6e7b0be3aff7a859c83" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -217,10 +217,10 @@ version = "0.4.16" dependencies = [ "Inflector", "anyhow", - "arbiter-bindings 0.1.4", + "arbiter-bindings 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "arbiter-core 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", - "arbiter-engine 0.2.0", - "arbiter-macros 0.1.1", + "arbiter-engine 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", + "arbiter-macros 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "assert_cmd", "async-trait", "clap", @@ -230,10 +230,9 @@ dependencies = [ "proc-macro2", "rayon", "revm", - "revm-primitives 2.0.0", "serde", "serde_json", - "syn 2.0.48", + "syn 2.0.49", "tempfile", "thiserror", "tokio", @@ -244,9 +243,7 @@ dependencies = [ [[package]] name = "arbiter-bindings" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d0333ea5e6f32bef018cd4a035ff0241899947d8e0c87346c868ec5d4bb51fc" +version = "0.1.5" dependencies = [ "ethers", "serde", @@ -255,6 +252,8 @@ dependencies = [ [[package]] name = "arbiter-bindings" version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e69527689b456659deaccdba142ae92796f74b829e6e8fd0e2ce80807f479d6" dependencies = [ "ethers", "serde", @@ -264,7 +263,7 @@ dependencies = [ name = "arbiter-core" version = "0.10.2" dependencies = [ - "arbiter-bindings 0.1.4", + "arbiter-bindings 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "assert_matches", "async-stream", "async-trait", @@ -282,7 +281,6 @@ dependencies = [ "polars", "rand", "revm", - "revm-primitives 2.0.0", "serde", "serde_json", "thiserror", @@ -298,7 +296,7 @@ version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7a6168baef0eb9e7c22d4b02e1edf526a4588edc97551b0cde96ec296f9b801b" dependencies = [ - "arbiter-bindings 0.1.4", + "arbiter-bindings 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "async-stream", "async-trait", "bytes", @@ -323,14 +321,12 @@ dependencies = [ [[package]] name = "arbiter-engine" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fe11da508518e823bf75dd0e4c20fed24214c09f2458e7db933c9f6dbfd885e" +version = "0.2.1" dependencies = [ "anyhow", - "arbiter-bindings 0.1.4", + "arbiter-bindings 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "arbiter-core 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", - "arbiter-macros 0.1.1", + "arbiter-macros 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "async-stream", "async-trait", "crossbeam-channel", @@ -344,16 +340,20 @@ dependencies = [ "tokio-stream", "toml 0.8.10", "tracing", + "tracing-subscriber", + "tracing-test", ] [[package]] name = "arbiter-engine" version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d6ebcaf22f7788d59a92ff30d68c9bdf8ec62ffe5370b6b8b5fe6db7cfb403" dependencies = [ "anyhow", - "arbiter-bindings 0.1.4", + "arbiter-bindings 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "arbiter-core 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", - "arbiter-macros 0.1.1", + "arbiter-macros 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", "async-stream", "async-trait", "crossbeam-channel", @@ -367,26 +367,24 @@ dependencies = [ "tokio-stream", "toml 0.8.10", "tracing", - "tracing-subscriber", - "tracing-test", ] [[package]] name = "arbiter-macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a685a9ee2090c7113919cb78d9e87e294b4f65e22f43c5938c301b853b78e411" +version = "0.1.2" dependencies = [ "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] name = "arbiter-macros" version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622766e957f73f9cbe425ca4533746b563a3b3a959697f178bb6789f3b8871be" dependencies = [ "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -583,7 +581,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -594,7 +592,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -650,7 +648,7 @@ checksum = "823b8bb275161044e2ac7a25879cb3e2480cb403e3943022c7c769c599b756aa" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -818,9 +816,9 @@ checksum = "b4ae4235e6dac0694637c763029ecea1a2ec9e4e06ec2729bd21ba4d9c863eb7" [[package]] name = "bumpalo" -version = "3.14.0" +version = "3.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" +checksum = "d32a994c2b3ca201d9b263612a374263f05e7adde37c4707f693dcd375076d1f" [[package]] name = "byte-slice-cast" @@ -845,7 +843,7 @@ checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -994,9 +992,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.0" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80c21025abd42669a92efc996ef13cfb2c5c627858421ea58d5c3b331a6c134f" +checksum = "c918d541ef2913577a0f9566e9ce27cb35b6df072075769e0b26cb5a554520da" dependencies = [ "clap_builder", "clap_derive", @@ -1004,9 +1002,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.0" +version = "4.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "458bf1f341769dfcf849846f65dffdf9146daa56bcd2a47cb4e1de9915567c99" +checksum = "9f3e7391dad68afb0c2ede1bf619f579a3dc9c2ec67f089baa397123a2f3d1eb" dependencies = [ "anstream", "anstyle", @@ -1023,7 +1021,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1553,7 +1551,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1564,7 +1562,7 @@ checksum = "6fd000fd6988e73bbe993ea3db9b1aa64906ab88766d654973924340c8cddb42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1719,7 +1717,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "syn 2.0.48", + "syn 2.0.49", "toml 0.8.10", "walkdir", ] @@ -1737,7 +1735,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -1763,7 +1761,7 @@ dependencies = [ "serde", "serde_json", "strum", - "syn 2.0.48", + "syn 2.0.49", "tempfile", "thiserror", "tiny-keccak", @@ -2147,7 +2145,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3095,7 +3093,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3305,7 +3303,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3354,7 +3352,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3428,7 +3426,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3466,7 +3464,7 @@ checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3935,7 +3933,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" dependencies = [ "proc-macro2", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -3997,7 +3995,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", "version_check", "yansi 1.0.0-rc.1", ] @@ -4149,7 +4147,7 @@ checksum = "5fddb4f8d99b0a2ebafc65a87a69a7b9875e4b1ae1f00db265d300ef7f28bccc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -4311,7 +4309,7 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4b3683a40f1e94e7389c8e81e5f26bb5d30875ed0b48ab07985ec32eb6d6c712" dependencies = [ - "alloy-primitives 0.6.2", + "alloy-primitives 0.6.3", "auto_impl", "bitflags 2.4.2", "bitvec", @@ -4710,7 +4708,7 @@ checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -5020,7 +5018,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -5088,9 +5086,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.48" +version = "2.0.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" +checksum = "915aea9e586f80826ee59f8453c1101f9d1c4b3964cd2460185ee8e299ada496" dependencies = [ "proc-macro2", "quote", @@ -5196,7 +5194,7 @@ checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -5300,7 +5298,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -5375,7 +5373,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.5", + "toml_edit 0.22.6", ] [[package]] @@ -5424,9 +5422,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.5" +version = "0.22.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99e68c159e8f5ba8a28c4eb7b0c0c190d77bb479047ca713270048145a9ad28a" +checksum = "2c1b5fd4128cc8d3e0cb74d4ed9a9cc7c7284becd4df68f5f940e1ad123606f6" dependencies = [ "indexmap", "serde", @@ -5460,7 +5458,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -5772,7 +5770,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", "wasm-bindgen-shared", ] @@ -5806,7 +5804,7 @@ checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -6115,7 +6113,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] @@ -6135,7 +6133,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.48", + "syn 2.0.49", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 085e1b7e..d396b9f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -46,7 +46,6 @@ arbiter-engine = "0.2.0" arbiter-macros = "0.1.1" revm = { version = "5.0.0", features = ["ethersdb", "std", "serde"] } -revm-primitives = "=2.0.0" ethers = { version = "2.0.13" } serde = { version = "1.0.193", features = ["derive"] } @@ -94,7 +93,6 @@ thiserror.workspace = true arbiter-bindings.workspace = true arbiter-engine.workspace = true arbiter-macros.workspace = true -revm-primitives.workspace = true serde.workspace = true async-trait.workspace = true anyhow.workspace = true @@ -114,3 +112,10 @@ lto = true # The Rust compiler splits your crate into multiple codegen units to parallelize (and thus speed up) compilation but at the cost of optimization. # This setting tells the compiler to use only one codegen unit, which will slow down compilation but improve optimization. codegen-units = 1 +opt-level = 3 + + +[profile.bench] +lto = true +codegen-units = 1 +opt-level = 3 diff --git a/core/Cargo.toml b/core/Cargo.toml index 98ffef02..af83d085 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -18,8 +18,6 @@ arbiter-bindings.workspace = true # Ethereum and EVM ethers.workspace = true revm.workspace = true -revm-primitives.workspace = true - # Serialization serde.workspace = true diff --git a/core/src/console/mod.rs b/core/src/console/mod.rs index 70dcb555..062e0cdb 100644 --- a/core/src/console/mod.rs +++ b/core/src/console/mod.rs @@ -1,7 +1,7 @@ //! This module contains the backend for the `console2.log` Solidity function so //! that these logs can be read in Arbiter. -use revm_primitives::address; +use revm::primitives::address; use super::*; diff --git a/core/src/coprocessor.rs b/core/src/coprocessor.rs index 2686d60b..560224fa 100644 --- a/core/src/coprocessor.rs +++ b/core/src/coprocessor.rs @@ -4,7 +4,10 @@ use std::convert::Infallible; -use revm_primitives::{EVMError, ResultAndState}; +use revm::inspector_handle_register; +use revm::primitives::{EVMError, ResultAndState}; + +use self::database::inspector::ArbiterInspector; use super::*; use crate::environment::Environment; @@ -14,15 +17,21 @@ use crate::environment::Environment; /// parallelized compute for agents that are not currently sending transactions /// that need to be processed by the [`Environment`], but are instead using the /// current state to make decisions. +#[derive(Debug)] pub struct Coprocessor<'a> { - evm: Evm<'a, (), ArbiterDB>, + evm: Evm<'a, ArbiterInspector, ArbiterDB>, } impl<'a> Coprocessor<'a> { /// Create a new `Coprocessor` with the given `Environment`. pub fn new(environment: &Environment) -> Self { + let inspector = ArbiterInspector::new(true, false); let db = environment.db.clone(); - let evm = Evm::builder().with_db(db).build(); + let evm = Evm::builder() + .with_db(db) + .with_external_context(inspector) + .append_handler_register(inspector_handle_register) + .build(); Self { evm } } @@ -33,9 +42,12 @@ impl<'a> Coprocessor<'a> { } } +unsafe impl Sync for Coprocessor<'_> {} +unsafe impl Send for Coprocessor<'_> {} + #[cfg(test)] mod tests { - use revm_primitives::{InvalidTransaction, U256}; + use revm::primitives::{InvalidTransaction, U256}; use super::*; diff --git a/core/src/database/mod.rs b/core/src/database/mod.rs index 10e9ab1a..631600e2 100644 --- a/core/src/database/mod.rs +++ b/core/src/database/mod.rs @@ -151,7 +151,7 @@ pub struct AccountRecord { /// The bytecode of the account. If empty, the account is an EOA. pub code: Bytes, /// The storage mapping of the account. - pub storage: revm_primitives::HashMap, + pub storage: revm::primitives::HashMap, } impl TryFrom for CacheDB { @@ -182,7 +182,7 @@ impl TryFrom for CacheDB { #[cfg(test)] mod tests { - use revm_primitives::{address, bytes}; + use revm::primitives::{address, bytes}; use super::*; diff --git a/core/src/errors.rs b/core/src/errors.rs index 3a67728a..8e8413ff 100644 --- a/core/src/errors.rs +++ b/core/src/errors.rs @@ -7,7 +7,7 @@ use ethers::{ providers::{MiddlewareError, ProviderError}, signers::WalletError, }; -use revm_primitives::{EVMError, HaltReason}; +use revm::primitives::{EVMError, HaltReason}; use thiserror::Error; use self::environment::instruction::{Instruction, Outcome}; diff --git a/core/src/middleware/connection.rs b/core/src/middleware/connection.rs index ca8253b5..857a5520 100644 --- a/core/src/middleware/connection.rs +++ b/core/src/middleware/connection.rs @@ -27,6 +27,8 @@ pub struct Connection { /// A collection of `FilterReceiver`s that will receive outgoing logs /// generated by `revm` and output by the [`Environment`]. pub(crate) filter_receivers: Arc>>, + + pub(crate) coprocessor: Coprocessor<'static>, } impl From<&Environment> for Connection { @@ -39,6 +41,7 @@ impl From<&Environment> for Connection { outcome_receiver, event_sender: environment.socket.event_broadcaster.clone(), filter_receivers: Arc::new(Mutex::new(HashMap::new())), + coprocessor: Coprocessor::new(&environment), } } } diff --git a/core/src/middleware/mod.rs b/core/src/middleware/mod.rs index 42bd5224..31371350 100644 --- a/core/src/middleware/mod.rs +++ b/core/src/middleware/mod.rs @@ -39,7 +39,10 @@ use serde::de::DeserializeOwned; use serde_json::value::RawValue; use super::*; -use crate::environment::{instruction::*, Broadcast, Environment}; +use crate::{ + coprocessor::Coprocessor, + environment::{instruction::*, Broadcast, Environment}, +}; pub mod connection; use connection::*; @@ -257,15 +260,7 @@ impl ArbiterMiddleware { forked_eoa: eAddress, ) -> Result, ArbiterCoreError> { let instruction_sender = &Arc::clone(&environment.socket.instruction_sender); - let (outcome_sender, outcome_receiver) = crossbeam_channel::unbounded(); - - let connection = Connection { - instruction_sender: Arc::downgrade(instruction_sender), - outcome_sender, - outcome_receiver: outcome_receiver.clone(), - event_sender: environment.socket.event_broadcaster.clone(), - filter_receivers: Arc::new(Mutex::new(HashMap::new())), - }; + let connection = Connection::from(environment); let provider = Provider::new(connection); info!( "Created new `ArbiterMiddleware` instance from a fork -- attached to environment labeled: {:?}", @@ -433,7 +428,7 @@ impl Middleware for ArbiterMiddleware { gas_priority_fee: None, transact_to, value: U256::ZERO, - data: revm_primitives::Bytes(bytes::Bytes::from( + data: revm::primitives::Bytes(bytes::Bytes::from( tx.data() .ok_or(ArbiterCoreError::MissingDataError)? .to_vec(), @@ -628,7 +623,7 @@ impl Middleware for ArbiterMiddleware { gas_priority_fee: None, transact_to, value: U256::ZERO, - data: revm_primitives::Bytes(bytes::Bytes::from( + data: revm::primitives::Bytes(bytes::Bytes::from( tx.data() .ok_or(ArbiterCoreError::MissingDataError)? .to_vec(), From a9213c4b597b6fbade55adee3ea8212b858ad58b Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Thu, 29 Feb 2024 05:51:59 -0700 Subject: [PATCH 2/5] Squashed commit of the following: commit 16bf32ee580d5cc082be6c203694d70051cf992e Author: Colin Roberts Date: Wed Feb 28 19:57:55 2024 -0700 feat: environment logs (#911) * feat: logs * feat: filter on logs * refactor: `ArbiterDB` and `Environment` commit dbca2d41adf78ff19810b8a19a3a5f94ebe0471e Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed Feb 28 14:05:43 2024 -0700 build(deps): bump crossbeam-channel from 0.5.11 to 0.5.12 (#919) Bumps [crossbeam-channel](https://github.com/crossbeam-rs/crossbeam) from 0.5.11 to 0.5.12. - [Release notes](https://github.com/crossbeam-rs/crossbeam/releases) - [Changelog](https://github.com/crossbeam-rs/crossbeam/blob/master/CHANGELOG.md) - [Commits](https://github.com/crossbeam-rs/crossbeam/compare/crossbeam-channel-0.5.11...crossbeam-channel-0.5.12) --- updated-dependencies: - dependency-name: crossbeam-channel dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 63f167b0152e535cee5647e681c52ca11580562f Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed Feb 28 14:05:33 2024 -0700 build(deps): bump syn from 2.0.51 to 2.0.52 (#920) Bumps [syn](https://github.com/dtolnay/syn) from 2.0.51 to 2.0.52. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/2.0.51...2.0.52) --- updated-dependencies: - dependency-name: syn dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit de894a38388d6301328ecac21d24bf2c8656d396 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed Feb 28 14:05:20 2024 -0700 build(deps): bump tempfile from 3.10.0 to 3.10.1 (#917) Bumps [tempfile](https://github.com/Stebalien/tempfile) from 3.10.0 to 3.10.1. - [Changelog](https://github.com/Stebalien/tempfile/blob/master/CHANGELOG.md) - [Commits](https://github.com/Stebalien/tempfile/compare/v3.10.0...v3.10.1) --- updated-dependencies: - dependency-name: tempfile dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 50bfbd31ff4a437f0e29c3f8cec41fb5b4667763 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Feb 26 13:38:48 2024 -0700 build(deps): bump syn from 2.0.50 to 2.0.51 (#915) Bumps [syn](https://github.com/dtolnay/syn) from 2.0.50 to 2.0.51. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/2.0.50...2.0.51) --- updated-dependencies: - dependency-name: syn dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 1db6bece8476aec5e650da32b17295dd8d4e9813 Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Mon Feb 26 10:47:13 2024 -0700 chore: release (#914) Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> commit 8211c6ea175e43f9ca22f283607db21cee5b600b Author: Colin Roberts Date: Mon Feb 26 10:42:46 2024 -0700 feat: `error!` output from behavior (#913) * feat: `error!` output from behavior * submodule: update `template` * fix: `minter` example * fix: clippy commit 509b624ddb8470828adb73ada99d66239dbc8bb4 Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed Feb 21 14:50:30 2024 -0700 chore: release (#905) Signed-off-by: GitHub Action Co-authored-by: GitHub Action commit 1df12a30c0def8e04f1535d9d4de3f17a1968805 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue Feb 20 15:55:07 2024 -0700 build(deps): bump serde from 1.0.196 to 1.0.197 (#910) Bumps [serde](https://github.com/serde-rs/serde) from 1.0.196 to 1.0.197. - [Release notes](https://github.com/serde-rs/serde/releases) - [Commits](https://github.com/serde-rs/serde/compare/v1.0.196...v1.0.197) --- updated-dependencies: - dependency-name: serde dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 875c2600420b5d13397fe6754d81330875023881 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue Feb 20 15:48:10 2024 -0700 build(deps): bump syn from 2.0.49 to 2.0.50 (#908) Bumps [syn](https://github.com/dtolnay/syn) from 2.0.49 to 2.0.50. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/2.0.49...2.0.50) --- updated-dependencies: - dependency-name: syn dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 2d7e2863d0c9b3e1ea3830e6e4c2c17b4f12d3f8 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue Feb 20 15:47:57 2024 -0700 build(deps): bump serde_json from 1.0.113 to 1.0.114 (#909) Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.113 to 1.0.114. - [Release notes](https://github.com/serde-rs/json/releases) - [Commits](https://github.com/serde-rs/json/compare/v1.0.113...v1.0.114) --- updated-dependencies: - dependency-name: serde_json dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 66be5ea35d5549b0de9d6c97aa3eeba65a1d89b7 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Feb 19 20:39:07 2024 -0700 build(deps): bump assert_cmd from 2.0.13 to 2.0.14 (#907) Bumps [assert_cmd](https://github.com/assert-rs/assert_cmd) from 2.0.13 to 2.0.14. - [Changelog](https://github.com/assert-rs/assert_cmd/blob/master/CHANGELOG.md) - [Commits](https://github.com/assert-rs/assert_cmd/compare/v2.0.13...v2.0.14) --- updated-dependencies: - dependency-name: assert_cmd dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 6f7f14c4de626ef24a18fe1afdbce957397960ed Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon Feb 19 20:38:30 2024 -0700 build(deps): bump anyhow from 1.0.79 to 1.0.80 (#906) Bumps [anyhow](https://github.com/dtolnay/anyhow) from 1.0.79 to 1.0.80. - [Release notes](https://github.com/dtolnay/anyhow/releases) - [Commits](https://github.com/dtolnay/anyhow/compare/1.0.79...1.0.80) --- updated-dependencies: - dependency-name: anyhow dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 85c7987ee54d197ba0ca6a94925ec48a127f37a2 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri Feb 16 17:54:05 2024 -0700 build(deps): bump arbiter-engine from 0.2.0 to 0.3.0 (#902) Bumps [arbiter-engine](https://github.com/primitivefinance/arbiter) from 0.2.0 to 0.3.0. - [Release notes](https://github.com/primitivefinance/arbiter/releases) - [Changelog](https://github.com/primitivefinance/arbiter/blob/main/CHANGELOG.md) - [Commits](https://github.com/primitivefinance/arbiter/compare/v0.2.0...arbiter-engine-v0.3.0) --- updated-dependencies: - dependency-name: arbiter-engine dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 300eaa8316efd29df9411fb65c0cc22173d0a453 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri Feb 16 17:53:46 2024 -0700 build(deps): bump clap from 4.5.0 to 4.5.1 (#903) Bumps [clap](https://github.com/clap-rs/clap) from 4.5.0 to 4.5.1. - [Release notes](https://github.com/clap-rs/clap/releases) - [Changelog](https://github.com/clap-rs/clap/blob/master/CHANGELOG.md) - [Commits](https://github.com/clap-rs/clap/compare/clap_complete-v4.5.0...v4.5.1) --- updated-dependencies: - dependency-name: clap dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 13418001a2e16a9a98dca4396683e4ad8793b034 Author: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri Feb 16 17:53:31 2024 -0700 build(deps): bump syn from 2.0.48 to 2.0.49 (#901) Bumps [syn](https://github.com/dtolnay/syn) from 2.0.48 to 2.0.49. - [Release notes](https://github.com/dtolnay/syn/releases) - [Commits](https://github.com/dtolnay/syn/compare/2.0.48...2.0.49) --- updated-dependencies: - dependency-name: syn dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> commit 2913315ea6b9577f525d0b4d39013104bacc120e Author: ts0yu <120932697+ts0yu@users.noreply.github.com> Date: Fri Feb 16 21:04:05 2024 +0000 docs: incorrect method (#904) commit d768fd785b385f4ad194258d1b7d023a619c8100 Author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri Feb 16 12:16:33 2024 -0700 chore: release (#896) commit 0522476a177d6e510c33aa53cdb3d3ca0692c10d Author: Colin Roberts Date: Fri Feb 16 12:11:38 2024 -0700 feat(engine): optional stream for behaviors (#899) * feat: optional stream and default impl * test: no-stream --- CHANGELOG.md | 23 ++ Cargo.lock | 303 +++++++++--------- Cargo.toml | 20 +- bindings/CHANGELOG.md | 5 + bindings/Cargo.toml | 2 +- core/CHANGELOG.md | 5 + core/Cargo.toml | 2 +- core/src/database/inspector.rs | 12 +- core/src/database/mod.rs | 66 +++- core/src/environment/instruction.rs | 7 + core/src/environment/mod.rs | 167 +++++++--- core/src/errors.rs | 12 + core/src/lib.rs | 2 +- core/src/middleware/mod.rs | 26 +- core/tests/environment_integration.rs | 45 ++- core/tests/middleware_integration.rs | 36 +++ .../arbiter_engine/agents_and_engines.md | 4 +- engine/CHANGELOG.md | 18 ++ engine/Cargo.toml | 2 +- engine/src/machine.rs | 55 +++- engine/tests/common.rs | 10 +- engine/tests/machine_integration.rs | 28 ++ examples/minter/behaviors/token_admin.rs | 4 +- examples/minter/behaviors/token_requester.rs | 4 +- examples/template | 2 +- macros/CHANGELOG.md | 5 + macros/Cargo.toml | 2 +- 27 files changed, 607 insertions(+), 260 deletions(-) create mode 100644 engine/tests/machine_integration.rs diff --git a/CHANGELOG.md b/CHANGELOG.md index d3fcd92f..f033c731 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.4.19](https://github.com/primitivefinance/arbiter/compare/arbiter-v0.4.18...arbiter-v0.4.19) - 2024-02-26 + +### Added +- `error!` output from behavior ([#913](https://github.com/primitivefinance/arbiter/pull/913)) + +## [0.4.18](https://github.com/primitivefinance/arbiter/compare/arbiter-v0.4.17...arbiter-v0.4.18) - 2024-02-20 + +### Other +- *(deps)* bump serde from 1.0.196 to 1.0.197 ([#910](https://github.com/primitivefinance/arbiter/pull/910)) +- *(deps)* bump syn from 2.0.49 to 2.0.50 ([#908](https://github.com/primitivefinance/arbiter/pull/908)) +- *(deps)* bump serde_json from 1.0.113 to 1.0.114 ([#909](https://github.com/primitivefinance/arbiter/pull/909)) +- *(deps)* bump assert_cmd from 2.0.13 to 2.0.14 ([#907](https://github.com/primitivefinance/arbiter/pull/907)) +- *(deps)* bump anyhow from 1.0.79 to 1.0.80 ([#906](https://github.com/primitivefinance/arbiter/pull/906)) +- *(deps)* bump arbiter-engine from 0.2.0 to 0.3.0 ([#902](https://github.com/primitivefinance/arbiter/pull/902)) +- *(deps)* bump clap from 4.5.0 to 4.5.1 ([#903](https://github.com/primitivefinance/arbiter/pull/903)) +- *(deps)* bump syn from 2.0.48 to 2.0.49 ([#901](https://github.com/primitivefinance/arbiter/pull/901)) +- incorrect method ([#904](https://github.com/primitivefinance/arbiter/pull/904)) + +## [0.4.17](https://github.com/primitivefinance/arbiter/compare/arbiter-v0.4.16...arbiter-v0.4.17) - 2024-02-16 + +### Added +- *(engine)* optional stream for behaviors ([#899](https://github.com/primitivefinance/arbiter/pull/899)) + ## [0.4.16](https://github.com/primitivefinance/arbiter/compare/arbiter-v0.4.15...arbiter-v0.4.16) - 2024-02-15 ### Other diff --git a/Cargo.lock b/Cargo.lock index 949374a1..267acd45 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -40,9 +40,9 @@ dependencies = [ [[package]] name = "ahash" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42cd52102d3df161c77a887b608d7a4897d7cc112886a9537b738a887a03aaff" +checksum = "d713b3834d76b85304d4d525563c1276e2e30dc97cc67bfb4585a4a29fc2c89f" dependencies = [ "cfg-if", "getrandom", @@ -139,7 +139,7 @@ checksum = "1a047897373be4bbb0224c1afdabca92648dc57a9c9ef6e7b0be3aff7a859c83" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -159,9 +159,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.11" +version = "0.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" +checksum = "96b09b5178381e0874812a9b157f7fe84982617e48f71f4e3235482775e5b540" dependencies = [ "anstyle", "anstyle-parse", @@ -207,20 +207,20 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.79" +version = "1.0.80" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" +checksum = "5ad32ce52e4161730f7098c077cd2ed6229b5804ccf99e5366be1ab72a98b4e1" [[package]] name = "arbiter" -version = "0.4.16" +version = "0.4.19" dependencies = [ "Inflector", "anyhow", - "arbiter-bindings 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "arbiter-core 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", - "arbiter-engine 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)", - "arbiter-macros 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "arbiter-bindings 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "arbiter-core 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", + "arbiter-engine 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "arbiter-macros 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "assert_cmd", "async-trait", "clap", @@ -230,9 +230,10 @@ dependencies = [ "proc-macro2", "rayon", "revm", + "revm-primitives 2.0.0", "serde", "serde_json", - "syn 2.0.49", + "syn 2.0.52", "tempfile", "thiserror", "tokio", @@ -243,7 +244,7 @@ dependencies = [ [[package]] name = "arbiter-bindings" -version = "0.1.5" +version = "0.1.6" dependencies = [ "ethers", "serde", @@ -251,9 +252,9 @@ dependencies = [ [[package]] name = "arbiter-bindings" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e69527689b456659deaccdba142ae92796f74b829e6e8fd0e2ce80807f479d6" +checksum = "f7189a325b0e3e56b5e695d3c2fbe8dd70fffcb04b13678ff2be1ad2bb754a38" dependencies = [ "ethers", "serde", @@ -261,9 +262,9 @@ dependencies = [ [[package]] name = "arbiter-core" -version = "0.10.2" +version = "0.10.3" dependencies = [ - "arbiter-bindings 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "arbiter-bindings 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "assert_matches", "async-stream", "async-trait", @@ -281,6 +282,7 @@ dependencies = [ "polars", "rand", "revm", + "revm-primitives 2.0.0", "serde", "serde_json", "thiserror", @@ -292,11 +294,11 @@ dependencies = [ [[package]] name = "arbiter-core" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6168baef0eb9e7c22d4b02e1edf526a4588edc97551b0cde96ec296f9b801b" +checksum = "1761b5f12d6e4bb74264a863a0612031555817d78334513c40a0677c4ef6a596" dependencies = [ - "arbiter-bindings 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", + "arbiter-bindings 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "async-stream", "async-trait", "bytes", @@ -321,12 +323,12 @@ dependencies = [ [[package]] name = "arbiter-engine" -version = "0.2.1" +version = "0.3.2" dependencies = [ "anyhow", - "arbiter-bindings 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "arbiter-core 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", - "arbiter-macros 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "arbiter-bindings 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "arbiter-core 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", + "arbiter-macros 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "async-stream", "async-trait", "crossbeam-channel", @@ -346,14 +348,14 @@ dependencies = [ [[package]] name = "arbiter-engine" -version = "0.2.1" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "47d6ebcaf22f7788d59a92ff30d68c9bdf8ec62ffe5370b6b8b5fe6db7cfb403" +checksum = "0553d66d507f24b9a7f63b783e9a2a37edaa5d93bfc9f23a3587dfcd65c0c3a6" dependencies = [ "anyhow", - "arbiter-bindings 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", - "arbiter-core 0.10.2 (registry+https://github.com/rust-lang/crates.io-index)", - "arbiter-macros 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", + "arbiter-bindings 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", + "arbiter-core 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", + "arbiter-macros 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "async-stream", "async-trait", "crossbeam-channel", @@ -371,20 +373,20 @@ dependencies = [ [[package]] name = "arbiter-macros" -version = "0.1.2" +version = "0.1.3" dependencies = [ "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] name = "arbiter-macros" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622766e957f73f9cbe425ca4533746b563a3b3a959697f178bb6789f3b8871be" +checksum = "ac4a04ffa19e2845c4ea58bb8470d19b13d3c95a8c846e7524d718b7dc182020" dependencies = [ "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -543,9 +545,9 @@ dependencies = [ [[package]] name = "assert_cmd" -version = "2.0.13" +version = "2.0.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00ad3f3a942eee60335ab4342358c161ee296829e0d16ff42fc1d6cb07815467" +checksum = "ed72493ac66d5804837f480ab3766c72bdfab91a65e565fc54fa9e42db0073a8" dependencies = [ "anstyle", "bstr", @@ -581,7 +583,7 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -592,7 +594,7 @@ checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -648,7 +650,7 @@ checksum = "823b8bb275161044e2ac7a25879cb3e2480cb403e3943022c7c769c599b756aa" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -799,9 +801,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.9.0" +version = "1.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc" +checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" dependencies = [ "memchr", "regex-automata 0.4.5", @@ -816,9 +818,9 @@ checksum = "b4ae4235e6dac0694637c763029ecea1a2ec9e4e06ec2729bd21ba4d9c863eb7" [[package]] name = "bumpalo" -version = "3.15.0" +version = "3.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32a994c2b3ca201d9b263612a374263f05e7adde37c4707f693dcd375076d1f" +checksum = "8ea184aa71bb362a1157c896979544cc23974e08fd265f29ea96b59f0b4a555b" [[package]] name = "byte-slice-cast" @@ -843,7 +845,7 @@ checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -884,9 +886,9 @@ dependencies = [ [[package]] name = "c-kzg" -version = "0.4.1" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9d8c306be83ec04bf5f73710badd8edf56dea23f2f0d8b7f9fe4644d371c758" +checksum = "94a4bc5367b6284358d2a6a6a1dc2d92ec4b86034561c3b9d3341909752fd848" dependencies = [ "blst", "cc", @@ -922,7 +924,7 @@ checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" dependencies = [ "camino", "cargo-platform", - "semver 1.0.21", + "semver 1.0.22", "serde", "serde_json", "thiserror", @@ -930,11 +932,10 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.83" +version = "1.0.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" +checksum = "3286b845d0fccbdd15af433f61c5970e711987036cb468f437ff6badd70f4e24" dependencies = [ - "jobserver", "libc", ] @@ -955,7 +956,7 @@ dependencies = [ "js-sys", "num-traits", "wasm-bindgen", - "windows-targets 0.52.0", + "windows-targets 0.52.3", ] [[package]] @@ -1021,7 +1022,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -1122,9 +1123,9 @@ dependencies = [ [[package]] name = "const-hex" -version = "1.11.0" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18d59688ad0945eaf6b84cb44fedbe93484c81b48970e98f09db8a22832d7961" +checksum = "efbd12d49ab0eaf8193ba9175e45f56bbc2e4b27d57b8cfe62aa47942a46b9a9" dependencies = [ "cfg-if", "cpufeatures", @@ -1216,9 +1217,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.11" +version = "0.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "176dc175b78f56c0f321911d9c8eb2b77a78a4860b9c19db83835fea1a46649b" +checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" dependencies = [ "crossbeam-utils", ] @@ -1551,7 +1552,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -1562,7 +1563,7 @@ checksum = "6fd000fd6988e73bbe993ea3db9b1aa64906ab88766d654973924340c8cddb42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -1717,7 +1718,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "syn 2.0.49", + "syn 2.0.52", "toml 0.8.10", "walkdir", ] @@ -1735,7 +1736,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -1761,7 +1762,7 @@ dependencies = [ "serde", "serde_json", "strum", - "syn 2.0.49", + "syn 2.0.52", "tempfile", "thiserror", "tiny-keccak", @@ -1777,7 +1778,7 @@ dependencies = [ "chrono", "ethers-core", "reqwest", - "semver 1.0.21", + "semver 1.0.22", "serde", "serde_json", "thiserror", @@ -1888,7 +1889,7 @@ dependencies = [ "path-slash", "rayon", "regex", - "semver 1.0.21", + "semver 1.0.22", "serde", "serde_json", "sha2", @@ -2051,7 +2052,7 @@ dependencies = [ "regex", "reqwest", "revm-primitives 1.3.0", - "semver 1.0.21", + "semver 1.0.22", "serde", "serde_json", "serde_regex", @@ -2145,7 +2146,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -2336,9 +2337,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.6" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd5256b483761cd23699d0da46cc6fd2ee3be420bbe6d020ae4a091e70b7e9fd" +checksum = "379dada1584ad501b383485dd706b8afb7a70fcbc7f4da7d780638a5a6124a60" [[package]] name = "hex" @@ -2603,15 +2604,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9028f49264629065d057f340a86acb84867925865f73bbf8d47b4d149a7e88b8" -[[package]] -name = "jobserver" -version = "0.1.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab46a6e9526ddef3ae7f787c06f0f2600639ba80ea3eade3d8e670a2230f51d6" -dependencies = [ - "libc", -] - [[package]] name = "js-sys" version = "0.3.68" @@ -3093,7 +3085,7 @@ dependencies = [ "proc-macro-crate 3.1.0", "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -3303,7 +3295,7 @@ dependencies = [ "proc-macro2", "proc-macro2-diagnostics", "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -3352,7 +3344,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -3426,7 +3418,7 @@ dependencies = [ "phf_shared 0.11.2", "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -3464,7 +3456,7 @@ checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -3933,7 +3925,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" dependencies = [ "proc-macro2", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -3995,7 +3987,7 @@ checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", "version_check", "yansi 1.0.0-rc.1", ] @@ -4147,7 +4139,7 @@ checksum = "5fddb4f8d99b0a2ebafc65a87a69a7b9875e4b1ae1f00db265d300ef7f28bccc" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -4351,16 +4343,17 @@ dependencies = [ [[package]] name = "ring" -version = "0.17.7" +version = "0.17.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", + "cfg-if", "getrandom", "libc", "spin 0.9.8", "untrusted 0.9.0", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -4473,7 +4466,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" dependencies = [ - "semver 1.0.21", + "semver 1.0.22", ] [[package]] @@ -4496,7 +4489,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ "log", - "ring 0.17.7", + "ring 0.17.8", "rustls-webpki", "sct", ] @@ -4516,7 +4509,7 @@ version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring 0.17.7", + "ring 0.17.8", "untrusted 0.9.0", ] @@ -4540,9 +4533,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.16" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" +checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" [[package]] name = "salsa20" @@ -4610,7 +4603,7 @@ version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring 0.17.7", + "ring 0.17.8", "untrusted 0.9.0", ] @@ -4657,9 +4650,9 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.21" +version = "1.0.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" +checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" dependencies = [ "serde", ] @@ -4693,29 +4686,29 @@ checksum = "a3f0bf26fd526d2a95683cd0f87bf103b8539e2ca1ef48ce002d67aad59aa0b4" [[package]] name = "serde" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" +checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.196" +version = "1.0.197" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" +checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] name = "serde_json" -version = "1.0.113" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" +checksum = "c5f09b1bd632ef549eaa9f60a1f8de742bdbc698e6cee2095fc84dde5f549ae0" dependencies = [ "indexmap", "itoa", @@ -4900,12 +4893,12 @@ checksum = "1b6b67fb9a61334225b5b790716f609cd58395f895b3fe8b328786812a40bc3b" [[package]] name = "socket2" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" +checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" dependencies = [ "libc", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -5018,7 +5011,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -5051,7 +5044,7 @@ dependencies = [ "hex", "once_cell", "reqwest", - "semver 1.0.21", + "semver 1.0.22", "serde", "serde_json", "sha2", @@ -5068,7 +5061,7 @@ checksum = "aa64b5e8eecd3a8af7cfc311e29db31a268a62d5953233d3e8243ec77a71c4e3" dependencies = [ "build_const", "hex", - "semver 1.0.21", + "semver 1.0.22", "serde_json", "svm-rs", ] @@ -5086,9 +5079,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.49" +version = "2.0.52" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915aea9e586f80826ee59f8453c1101f9d1c4b3964cd2460185ee8e299ada496" +checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07" dependencies = [ "proc-macro2", "quote", @@ -5150,9 +5143,9 @@ checksum = "cfb5fa503293557c5158bd215fdc225695e567a77e453f5d4452a50a193969bd" [[package]] name = "tempfile" -version = "3.10.0" +version = "3.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" +checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" dependencies = [ "cfg-if", "fastrand", @@ -5194,14 +5187,14 @@ checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] name = "thread_local" -version = "1.1.7" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" dependencies = [ "cfg-if", "once_cell", @@ -5298,7 +5291,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -5430,7 +5423,7 @@ dependencies = [ "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.1", + "winnow 0.6.2", ] [[package]] @@ -5458,7 +5451,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -5612,9 +5605,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-normalization" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" +checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" dependencies = [ "tinyvec", ] @@ -5770,7 +5763,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", "wasm-bindgen-shared", ] @@ -5804,7 +5797,7 @@ checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -5869,7 +5862,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e48a53791691ab099e5e2ad123536d0fff50652600abaf43bbf952894110d0be" dependencies = [ "windows-core", - "windows-targets 0.52.0", + "windows-targets 0.52.3", ] [[package]] @@ -5878,7 +5871,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.3", ] [[package]] @@ -5896,7 +5889,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.0", + "windows-targets 0.52.3", ] [[package]] @@ -5916,17 +5909,17 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +checksum = "d380ba1dc7187569a8a9e91ed34b8ccfc33123bbacb8c0aed2d1ad7f3ef2dc5f" dependencies = [ - "windows_aarch64_gnullvm 0.52.0", - "windows_aarch64_msvc 0.52.0", - "windows_i686_gnu 0.52.0", - "windows_i686_msvc 0.52.0", - "windows_x86_64_gnu 0.52.0", - "windows_x86_64_gnullvm 0.52.0", - "windows_x86_64_msvc 0.52.0", + "windows_aarch64_gnullvm 0.52.3", + "windows_aarch64_msvc 0.52.3", + "windows_i686_gnu 0.52.3", + "windows_i686_msvc 0.52.3", + "windows_x86_64_gnu 0.52.3", + "windows_x86_64_gnullvm 0.52.3", + "windows_x86_64_msvc 0.52.3", ] [[package]] @@ -5937,9 +5930,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" +checksum = "68e5dcfb9413f53afd9c8f86e56a7b4d86d9a2fa26090ea2dc9e40fba56c6ec6" [[package]] name = "windows_aarch64_msvc" @@ -5949,9 +5942,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" +checksum = "8dab469ebbc45798319e69eebf92308e541ce46760b49b18c6b3fe5e8965b30f" [[package]] name = "windows_i686_gnu" @@ -5961,9 +5954,9 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" +checksum = "2a4e9b6a7cac734a8b4138a4e1044eac3404d8326b6c0f939276560687a033fb" [[package]] name = "windows_i686_msvc" @@ -5973,9 +5966,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" +checksum = "28b0ec9c422ca95ff34a78755cfa6ad4a51371da2a5ace67500cf7ca5f232c58" [[package]] name = "windows_x86_64_gnu" @@ -5985,9 +5978,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" +checksum = "704131571ba93e89d7cd43482277d6632589b18ecf4468f591fbae0a8b101614" [[package]] name = "windows_x86_64_gnullvm" @@ -5997,9 +5990,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" +checksum = "42079295511643151e98d61c38c0acc444e52dd42ab456f7ccfd5152e8ecf21c" [[package]] name = "windows_x86_64_msvc" @@ -6009,9 +6002,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.0" +version = "0.52.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" +checksum = "0770833d60a970638e989b3fa9fd2bb1aaadcf88963d1659fd7d9990196ed2d6" [[package]] name = "winnow" @@ -6024,9 +6017,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.1" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d90f4e0f530c4c69f62b80d839e9ef3855edc9cba471a160c4d692deed62b401" +checksum = "7a4191c47f15cc3ec71fcb4913cb83d58def65dd3787610213c649283b5ce178" dependencies = [ "memchr", ] @@ -6071,9 +6064,9 @@ dependencies = [ [[package]] name = "xxhash-rust" -version = "0.8.8" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53be06678ed9e83edb1745eb72efc0bbcd7b5c3c35711a860906aed827a13d61" +checksum = "927da81e25be1e1a2901d59b81b37dd2efd1fc9c9345a55007f09bf5a2d3ee03" [[package]] name = "yaml-rust" @@ -6113,7 +6106,7 @@ checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] @@ -6133,7 +6126,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.49", + "syn 2.0.52", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index d396b9f4..9c8024b9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,7 +8,7 @@ exclude = ["benches", "docs"] # Package configuration [package] name = "arbiter" -version = "0.4.16" +version = "0.4.19" edition = "2021" authors = [ "Waylon Jepsen ", @@ -42,14 +42,14 @@ path = "examples/minter/main.rs" # Arbiter crates.io for release, these need to be used to do crate releases! arbiter-bindings = "0.1.4" arbiter-core = "0.10.2" -arbiter-engine = "0.2.0" +arbiter-engine = "0.3.0" arbiter-macros = "0.1.1" revm = { version = "5.0.0", features = ["ethersdb", "std", "serde"] } ethers = { version = "2.0.13" } -serde = { version = "1.0.193", features = ["derive"] } -serde_json = { version = "1.0.113" } +serde = { version = "1.0.197", features = ["derive"] } +serde_json = { version = "1.0.114" } toml = "0.8.10" tokio = { version = "1.36.0", features = ["macros", "full"] } @@ -57,21 +57,21 @@ futures = "0.3.30" futures-util = { version = "0.3.30" } async-stream = "0.3.5" async-trait = { version = "0.1.77" } -crossbeam-channel = { version = "0.5.11" } +crossbeam-channel = { version = "0.5.12" } -syn = { version = "2.0.48", features = ["full"] } +syn = { version = "2.0.52", features = ["full"] } proc-macro2 = { version = "1.0.78" } tracing = "0.1.40" thiserror = { version = "1.0.57" } -anyhow = "1.0.79" +anyhow = "1.0.80" # Dependencies for the release build of Arbiter bin [dependencies] arbiter-core.workspace = true # Command line and config -clap = { version = "4.5.0", features = ["derive"] } +clap = { version = "4.5.1", features = ["derive"] } serde.workspace = true serde_json.workspace = true config = { version = "=0.14.0" } @@ -84,7 +84,7 @@ Inflector = { version = "=0.11.4" } # Building files foundry-config = { version = "=0.2.0" } -tempfile = { version = "3.10.0" } +tempfile = { version = "3.10.1" } # Errors thiserror.workspace = true @@ -102,7 +102,7 @@ rayon = { version = "1.8.0" } tokio.workspace = true tracing.workspace = true tracing-subscriber = "0.3.18" -assert_cmd = { version = "=2.0.13" } +assert_cmd = { version = "=2.0.14" } # Release profile diff --git a/bindings/CHANGELOG.md b/bindings/CHANGELOG.md index 387f9caf..3caec95f 100644 --- a/bindings/CHANGELOG.md +++ b/bindings/CHANGELOG.md @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.1.6](https://github.com/primitivefinance/arbiter/compare/arbiter-bindings-v0.1.5...arbiter-bindings-v0.1.6) - 2024-02-20 + +### Other +- update Cargo.toml dependencies + ## [0.1.5](https://github.com/primitivefinance/arbiter/compare/arbiter-bindings-v0.1.4...arbiter-bindings-v0.1.5) - 2024-02-15 ### Other diff --git a/bindings/Cargo.toml b/bindings/Cargo.toml index 3f074a1a..bc2d58c3 100644 --- a/bindings/Cargo.toml +++ b/bindings/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "arbiter-bindings" -version = "0.1.5" +version = "0.1.6" edition = "2021" description = "Rust bindings for common solidity smart contracts" license = "Apache-2.0" diff --git a/core/CHANGELOG.md b/core/CHANGELOG.md index bd8b3bce..0575683e 100644 --- a/core/CHANGELOG.md +++ b/core/CHANGELOG.md @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.10.3](https://github.com/primitivefinance/arbiter/compare/arbiter-core-v0.10.2...arbiter-core-v0.10.3) - 2024-02-20 + +### Other +- update Cargo.toml dependencies + ## [0.10.2](https://github.com/primitivefinance/arbiter/compare/arbiter-core-v0.10.1...arbiter-core-v0.10.2) - 2024-02-13 ### Added diff --git a/core/Cargo.toml b/core/Cargo.toml index af83d085..5e7bb08c 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "arbiter-core" -version = "0.10.2" +version = "0.10.3" edition = "2021" authors = [ "Waylon Jepsen ", diff --git a/core/src/database/inspector.rs b/core/src/database/inspector.rs index 51f80e17..c1c1a22c 100644 --- a/core/src/database/inspector.rs +++ b/core/src/database/inspector.rs @@ -42,16 +42,16 @@ impl ArbiterInspector { } } -impl Inspector for ArbiterInspector { +impl Inspector for ArbiterInspector { #[inline] - fn initialize_interp(&mut self, interp: &mut Interpreter, context: &mut EvmContext) { + fn initialize_interp(&mut self, interp: &mut Interpreter, context: &mut EvmContext) { if let Some(gas) = &mut self.gas { gas.initialize_interp(interp, context); } } #[inline] - fn step_end(&mut self, interp: &mut Interpreter, context: &mut EvmContext) { + fn step_end(&mut self, interp: &mut Interpreter, context: &mut EvmContext) { if let Some(gas) = &mut self.gas { gas.step_end(interp, context); } @@ -60,7 +60,7 @@ impl Inspector for ArbiterInspector { #[inline] fn call( &mut self, - context: &mut EvmContext, + context: &mut EvmContext, inputs: &mut CallInputs, return_memory_offset: Range, ) -> Option { @@ -74,7 +74,7 @@ impl Inspector for ArbiterInspector { #[inline] fn call_end( &mut self, - context: &mut EvmContext, + context: &mut EvmContext, inputs: &CallInputs, outcome: CallOutcome, ) -> CallOutcome { @@ -88,7 +88,7 @@ impl Inspector for ArbiterInspector { #[inline] fn create_end( &mut self, - _context: &mut EvmContext, + _context: &mut EvmContext, _inputs: &CreateInputs, outcome: CreateOutcome, ) -> CreateOutcome { diff --git a/core/src/database/mod.rs b/core/src/database/mod.rs index 631600e2..9ea55b78 100644 --- a/core/src/database/mod.rs +++ b/core/src/database/mod.rs @@ -21,19 +21,42 @@ use super::*; pub mod fork; pub mod inspector; -/// A [`ArbiterDB`] is a wrapper around a [`CacheDB`] that is used to provide -/// access to the [`environment::Environment`]'s database to multiple +/// A [`ArbiterDB`] is contains both a [`CacheDB`] that is used to provide +/// state for the [`environment::Environment`]'s as well as for multiple /// [`coprocessor::Coprocessor`]s. -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct ArbiterDB(pub Arc>>); +/// The `logs` field is a [`HashMap`] to store [`ethers::types::Log`]s that can +/// be queried from at any point. +#[derive(Debug, Serialize, Deserialize)] +pub struct ArbiterDB { + /// The state of the `ArbiterDB`. This is a `CacheDB` that is used to + /// provide a db for the `Environment` to use. + pub state: Arc>>, + + /// The logs of the `ArbiterDB`. This is a `HashMap` that is used to store + /// logs that can be queried from at any point. + pub logs: Arc>>>, +} + +// Implement `Clone` by hand so we utilize the `Arc`'s `Clone` implementation. +impl Clone for ArbiterDB { + fn clone(&self) -> Self { + Self { + state: self.state.clone(), + logs: self.logs.clone(), + } + } +} impl ArbiterDB { /// Create a new `ArbiterDB`. pub fn new() -> Self { - Self(Arc::new(RwLock::new(CacheDB::new(EmptyDB::new())))) + Self { + state: Arc::new(RwLock::new(CacheDB::new(EmptyDB::new()))), + logs: Arc::new(RwLock::new(HashMap::new())), + } } - /// Write the `ArbiterDB` to a file at the given path. + /// Write the `ArbiterDB` to a file at the given path.`` pub fn write_to_file(&self, path: &str) -> io::Result<()> { // Serialize the ArbiterDB let serialized = serde_json::to_string(self)?; @@ -49,9 +72,18 @@ impl ArbiterDB { let mut file = fs::File::open(path)?; let mut contents = String::new(); file.read_to_string(&mut contents)?; + // Deserialize the content into ArbiterDB - let cache_db = serde_json::from_str(&contents)?; - Ok(Self(Arc::new(RwLock::new(cache_db)))) + #[derive(Deserialize)] + struct TempDB { + state: Option>, + logs: Option>>, + } + let temp_db: TempDB = serde_json::from_str(&contents)?; + Ok(Self { + state: Arc::new(RwLock::new(temp_db.state.unwrap_or_default())), + logs: Arc::new(RwLock::new(temp_db.logs.unwrap_or_default())), + }) } } @@ -77,11 +109,11 @@ impl Database for ArbiterDB { &mut self, address: revm::primitives::Address, ) -> Result, Self::Error> { - self.0.write().unwrap().basic(address) + self.state.write().unwrap().basic(address) } fn code_by_hash(&mut self, code_hash: B256) -> Result { - self.0.write().unwrap().code_by_hash(code_hash) + self.state.write().unwrap().code_by_hash(code_hash) } fn storage( @@ -89,11 +121,11 @@ impl Database for ArbiterDB { address: revm::primitives::Address, index: U256, ) -> Result { - self.0.write().unwrap().storage(address, index) + self.state.write().unwrap().storage(address, index) } fn block_hash(&mut self, number: U256) -> Result { - self.0.write().unwrap().block_hash(number) + self.state.write().unwrap().block_hash(number) } } @@ -104,11 +136,11 @@ impl DatabaseRef for ArbiterDB { &self, address: revm::primitives::Address, ) -> Result, Self::Error> { - self.0.read().unwrap().basic_ref(address) + self.state.read().unwrap().basic_ref(address) } fn code_by_hash_ref(&self, code_hash: B256) -> Result { - self.0.read().unwrap().code_by_hash_ref(code_hash) + self.state.read().unwrap().code_by_hash_ref(code_hash) } fn storage_ref( @@ -116,11 +148,11 @@ impl DatabaseRef for ArbiterDB { address: revm::primitives::Address, index: U256, ) -> Result { - self.0.read().unwrap().storage_ref(address, index) + self.state.read().unwrap().storage_ref(address, index) } fn block_hash_ref(&self, number: U256) -> Result { - self.0.read().unwrap().block_hash_ref(number) + self.state.read().unwrap().block_hash_ref(number) } } @@ -129,7 +161,7 @@ impl DatabaseCommit for ArbiterDB { &mut self, changes: hashbrown::HashMap, ) { - self.0.write().unwrap().commit(changes) + self.state.write().unwrap().commit(changes) } } diff --git a/core/src/environment/instruction.rs b/core/src/environment/instruction.rs index e9e159e8..e655a6bf 100644 --- a/core/src/environment/instruction.rs +++ b/core/src/environment/instruction.rs @@ -145,6 +145,7 @@ pub(crate) enum Outcome { /// Currently this may be the block number, block timestamp, gas price, or /// balance of an account. #[derive(Debug, Clone, Serialize, Deserialize, PartialEq)] +#[allow(clippy::large_enum_variant)] pub(crate) enum EnvironmentData { /// The query is for the block number of the [`EVM`]. BlockNumber, @@ -161,6 +162,12 @@ pub(crate) enum EnvironmentData { // TODO: Rename this to `Nonce`? /// The query is for the nonce of an account given by the inner `Address`. TransactionCount(eAddress), + + /// Query for logs in a range of blocks. + Logs { + /// The filter to use to query for logs + filter: Filter, + }, } /// [`ReceiptData`] is a structure that holds the block number, transaction diff --git a/core/src/environment/mod.rs b/core/src/environment/mod.rs index a4ba178c..d47eada8 100644 --- a/core/src/environment/mod.rs +++ b/core/src/environment/mod.rs @@ -20,7 +20,7 @@ use std::thread::{self, JoinHandle}; use crossbeam_channel::{bounded, unbounded, Receiver, Sender}; -use ethers::abi::AbiDecode; +use ethers::{abi::AbiDecode, types::ValueOrArray}; use revm::{ db::AccountState, inspector_handle_register, @@ -33,7 +33,10 @@ use super::*; #[cfg_attr(doc, allow(unused_imports))] #[cfg(doc)] use crate::middleware::ArbiterMiddleware; -use crate::{console::abi::HardhatConsoleCalls, database::inspector::ArbiterInspector}; +use crate::{ + console::abi::HardhatConsoleCalls, database::inspector::ArbiterInspector, + middleware::connection::revm_logs_to_ethers_logs, +}; pub mod instruction; use instruction::*; @@ -142,10 +145,28 @@ impl EnvironmentBuilder { self } - /// Sets the database for the [`Environment`]. This can come from a - /// [`fork::Fork`]. - pub fn with_db(mut self, db: impl Into>) -> Self { - self.db = ArbiterDB(Arc::new(RwLock::new(db.into()))); + /// Sets the state for the [`Environment`]. This can come from a saved state + /// of a simulation or a [`database::fork::Fork`]. + pub fn with_state(mut self, state: impl Into>) -> Self { + self.db.state = Arc::new(RwLock::new(state.into())); + self + } + + /// Sets the logs for the [`Environment`]. This can come from a saved state + /// of a simulation and can be useful for doing analysis. + pub fn with_logs( + mut self, + logs: impl Into>>, + ) -> Self { + self.db.logs = Arc::new(RwLock::new(logs.into())); + self + } + + /// Sets the entire database for the [`Environment`] including both the + /// state and logs. This can come from the saved state of a simulation and + /// can be useful for doing analysis. + pub fn with_arbiter_db(mut self, db: ArbiterDB) -> Self { + self.db = db; self } @@ -170,7 +191,7 @@ impl Environment { pub fn builder() -> EnvironmentBuilder { EnvironmentBuilder { parameters: EnvironmentParameters::default(), - db: ArbiterDB(Arc::new(RwLock::new(CacheDB::new(EmptyDB::new())))), + db: ArbiterDB::default(), } } @@ -207,7 +228,8 @@ impl Environment { // Bring in parameters for the `Environment`. let label = self.parameters.label.clone(); - // Bring in the EVM db by cloning the interior Arc (lightweight). + // Bring in the EVM db and log storage by cloning the interior Arc + // (lightweight). let db = self.db.clone(); // Bring in the EVM ENV @@ -225,7 +247,7 @@ impl Environment { let handle = thread::spawn(move || { // Create a new EVM builder let mut evm = Evm::builder() - .with_db(db) + .with_db(db.clone()) .with_env(Box::new(env)) .with_external_context(inspector) .append_handler_register(inspector_handle_register) @@ -253,14 +275,7 @@ impl Environment { account_state: AccountState::None, storage: HashMap::new(), }; - let db = &mut evm.context.evm.db; - match db - .0 - .write() - .unwrap() - .accounts - .insert(recast_address, account) - { + match db.state.write()?.accounts.insert(recast_address, account) { None => outcome_sender.send(Ok(Outcome::AddAccountCompleted))?, Some(_) => { outcome_sender.send(Err(ArbiterCoreError::AccountCreationError))?; @@ -273,12 +288,12 @@ impl Environment { outcome_sender, } => { // Return the old block data in a `ReceiptData` + let old_block_number = evm.block().number; let receipt_data = ReceiptData { - block_number: convert_uint_to_u64(evm.block().number).unwrap(), + block_number: convert_uint_to_u64(old_block_number)?, transaction_index, cumulative_gas_per_block, }; - outcome_sender.send(Ok(Outcome::BlockUpdateCompleted(receipt_data)))?; // Update the block number and timestamp evm.block_mut().number = U256::from_limbs(block_number.0); @@ -287,6 +302,9 @@ impl Environment { // Reset the counters. transaction_index = U64::from(0); cumulative_gas_per_block = eU256::from(0); + + // Return the old block data in a `ReceiptData` after the block update. + outcome_sender.send(Ok(Outcome::BlockUpdateCompleted(receipt_data)))?; } Instruction::Cheatcode { cheatcode, @@ -297,13 +315,11 @@ impl Environment { key, block: _, } => { - let db = &mut evm.context.evm.db; - let recast_address = Address::from(account.as_fixed_bytes()); let recast_key = B256::from(key.as_fixed_bytes()).into(); // Get the account storage value at the key in the db. - match db.0.write().unwrap().accounts.get_mut(&recast_address) { + match db.state.write()?.accounts.get_mut(&recast_address) { Some(account) => { // Returns zero if the account is missing. let value: U256 = match account.storage.get::(&recast_key) @@ -326,16 +342,13 @@ impl Environment { key, value, } => { - // Get the underlying database - let db = &mut evm.context.evm.db; - let recast_address = Address::from(account.as_fixed_bytes()); let recast_key = B256::from(key.as_fixed_bytes()); let recast_value = B256::from(value.as_fixed_bytes()); // Mutate the db by inserting the new key-value pair into the account's // storage and send the successful CheatcodeCompleted outcome. - match db.0.write().unwrap().accounts.get_mut(&recast_address) { + match db.state.write()?.accounts.get_mut(&recast_address) { Some(account) => { account .storage @@ -352,9 +365,8 @@ impl Environment { }; } Cheatcodes::Deal { address, amount } => { - let db = &mut evm.context.evm.db; let recast_address = Address::from(address.as_fixed_bytes()); - match db.0.write().unwrap().accounts.get_mut(&recast_address) { + match db.state.write()?.accounts.get_mut(&recast_address) { Some(account) => { account.info.balance += U256::from_limbs(amount.0); outcome_sender.send(Ok(Outcome::CheatcodeReturn( @@ -368,10 +380,8 @@ impl Environment { }; } Cheatcodes::Access { address } => { - let db = &mut evm.context.evm.db; let recast_address = Address::from(address.as_fixed_bytes()); - - match db.0.write().unwrap().accounts.get(&recast_address) { + match db.state.write()?.accounts.get(&recast_address) { Some(account) => { let account_state = match account.account_state { AccountState::None => AccountStateSerializable::None, @@ -408,11 +418,12 @@ impl Environment { // Set the tx_env and prepare to process it *evm.tx_mut() = tx_env; - // TODO: Is `transact()` the function we want? let result = evm.transact()?.result; if let Some(console_log) = &mut evm.context.external.console_log { console_log.0.drain(..).for_each(|log| { + // This unwrap is safe because the logs are guaranteed to be + // `HardhatConsoleCalls` by the `ArbiterInspector`. trace!( "Console logs: {:?}", HardhatConsoleCalls::decode(log).unwrap().to_string() @@ -442,6 +453,8 @@ impl Environment { Ok(result) => { if let Some(console_log) = &mut evm.context.external.console_log { console_log.0.drain(..).for_each(|log| { + // This unwrap is safe because the logs are guaranteed to be + // `HardhatConsoleCalls` by the `ArbiterInspector`. trace!( "Console logs: {:?}", HardhatConsoleCalls::decode(log).unwrap().to_string() @@ -455,14 +468,33 @@ impl Environment { continue; } }; - cumulative_gas_per_block += - eU256::from(execution_result.clone().gas_used()); + cumulative_gas_per_block += eU256::from(execution_result.gas_used()); let block_number = convert_uint_to_u64(evm.block().number)?; let receipt_data = ReceiptData { block_number, transaction_index, cumulative_gas_per_block, }; + + let mut logs = db.logs.write()?; + match logs.get_mut(&evm.block().number) { + Some(log_vec) => { + log_vec.extend(revm_logs_to_ethers_logs( + execution_result.logs(), + &receipt_data, + )); + } + None => { + logs.insert( + evm.block().number, + revm_logs_to_ethers_logs( + execution_result.logs(), + &receipt_data, + ), + ); + } + } + match event_broadcaster.send(Broadcast::Event( execution_result.logs(), receipt_data.clone(), @@ -496,10 +528,8 @@ impl Environment { Ok(Outcome::QueryReturn(evm.tx().gas_price.to_string())) } EnvironmentData::Balance(address) => { - // This unwrap should never fail. - let db = &mut evm.context.evm.db; match db - .0 + .state .read() .unwrap() .accounts @@ -511,11 +541,9 @@ impl Environment { None => Err(ArbiterCoreError::AccountDoesNotExistError), } } - EnvironmentData::TransactionCount(address) => { - let db = &mut evm.context.evm.db; match db - .0 + .state .read() .unwrap() .accounts @@ -527,6 +555,64 @@ impl Environment { None => Err(ArbiterCoreError::AccountDoesNotExistError), } } + EnvironmentData::Logs { filter } => { + let logs = db.logs.read().unwrap(); + let from_block = U256::from( + filter + .block_option + .get_from_block() + .ok_or(ArbiterCoreError::MissingDataError)? + .as_number() + .ok_or(ArbiterCoreError::MissingDataError)? + .0[0], + ); + let to_block = U256::from( + filter + .block_option + .get_to_block() + .ok_or(ArbiterCoreError::MissingDataError)? + .as_number() + .ok_or(ArbiterCoreError::MissingDataError)? + .0[0], + ); + let mut return_logs = Vec::new(); + logs.keys().for_each(|blocknum| { + if blocknum >= &from_block && blocknum <= &to_block { + return_logs.extend(logs.get(blocknum).cloned().unwrap()); + } + }); + return_logs.retain(|log| { + filter.topics.iter().any(|topic_option| match topic_option { + Some(topic_val_or_array) => match topic_val_or_array { + ValueOrArray::Value(topic) => match topic { + Some(topic) => log.topics.contains(topic), + None => true, + }, + ValueOrArray::Array(topics) => { + topics.iter().any(|topic| match topic { + Some(topic) => log.topics.contains(topic), + None => true, + }) + } + }, + None => true, + }) + }); + return_logs.retain(|log| { + filter.address.iter().any(|address_value_or_array| { + match address_value_or_array { + ValueOrArray::Value(address) => &log.address == address, + + ValueOrArray::Array(addresses) => { + addresses.iter().any(|addr| &log.address == addr) + } + } + }) + }); + Ok(Outcome::QueryReturn( + serde_json::to_string(&return_logs).unwrap(), + )) + } }; outcome_sender.send(outcome)?; } @@ -537,7 +623,6 @@ impl Environment { warn!("Stop signal was not sent to any listeners. Are there any listeners?") } } - let (db, _) = evm.into_db_and_env_with_handler_cfg(); outcome_sender.send(Ok(Outcome::StopCompleted(db)))?; break; } diff --git a/core/src/errors.rs b/core/src/errors.rs index 8e8413ff..5acd9b18 100644 --- a/core/src/errors.rs +++ b/core/src/errors.rs @@ -1,6 +1,8 @@ //! Errors that can occur when managing or interfacing with Arbiter's sandboxed //! Ethereum environment. +use std::sync::{PoisonError, RwLockWriteGuard}; + // use crossbeam_channel::SendError; use crossbeam_channel::{RecvError, SendError}; use ethers::{ @@ -101,6 +103,10 @@ pub enum ArbiterCoreError { /// Failed to reply to instruction. #[error("{0}")] ReplyError(String), + + /// Failed to grab a lock. + #[error("{0}")] + RwLockError(String), } impl From>> for ArbiterCoreError { @@ -109,6 +115,12 @@ impl From>> for ArbiterCoreError { } } +impl From>> for ArbiterCoreError { + fn from(e: PoisonError>) -> Self { + ArbiterCoreError::RwLockError(e.to_string()) + } +} + impl MiddlewareError for ArbiterCoreError { type Inner = ProviderError; diff --git a/core/src/lib.rs b/core/src/lib.rs index 8a9399e2..b8cab2c2 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -46,7 +46,7 @@ use std::{ }; use async_trait::async_trait; -use ethers::types::{Address as eAddress, Filter, H256, U256 as eU256, U64}; +use ethers::types::{Address as eAddress, Filter, Log as eLog, H256, U256 as eU256, U64}; use revm::{ db::{CacheDB, EmptyDB}, interpreter::{CallInputs, CallOutcome}, diff --git a/core/src/middleware/mod.rs b/core/src/middleware/mod.rs index 31371350..15e6ea48 100644 --- a/core/src/middleware/mod.rs +++ b/core/src/middleware/mod.rs @@ -27,8 +27,8 @@ use ethers::{ signers::{Signer, Wallet}, types::{ transaction::{eip2718::TypedTransaction, eip712::Eip712}, - Address as eAddress, BlockId, Bloom, Bytes as eBytes, FilteredParams, Log as eLog, - NameOrAddress, Signature, Transaction, TransactionReceipt, + Address as eAddress, BlockId, Bloom, Bytes as eBytes, FilteredParams, NameOrAddress, + Signature, Transaction, TransactionReceipt, }, }; use futures_timer::Delay; @@ -704,6 +704,28 @@ impl Middleware for ArbiterMiddleware { Ok(id) } + async fn get_logs(&self, filter: &Filter) -> Result, Self::Error> { + let provider = self.provider.as_ref(); + provider + .instruction_sender + .upgrade() + .ok_or(ArbiterCoreError::UpgradeSenderError)? + .send(Instruction::Query { + environment_data: EnvironmentData::Logs { + filter: filter.clone(), + }, + outcome_sender: provider.outcome_sender.clone(), + })?; + let outcome = provider.outcome_receiver.recv()??; + match outcome { + Outcome::QueryReturn(outcome) => { + let logs: Vec = serde_json::from_str(outcome.as_ref())?; + Ok(logs) + } + _ => unreachable!(), + } + } + /// Starts watching for logs that match a specific filter. /// /// This method creates a filter watcher that continuously checks for new diff --git a/core/tests/environment_integration.rs b/core/tests/environment_integration.rs index 29eed338..30611405 100644 --- a/core/tests/environment_integration.rs +++ b/core/tests/environment_integration.rs @@ -86,7 +86,7 @@ async fn fork_into_arbiter() { let fork = Fork::from_disk("tests/fork.json").unwrap(); // Get the environment going - let environment = Environment::builder().with_db(fork.db).build(); + let environment = Environment::builder().with_state(fork.db).build(); // Create a client let client = ArbiterMiddleware::new(&environment, Some("name")).unwrap(); @@ -118,7 +118,7 @@ async fn middleware_from_forked_eo() { let fork = Fork::from_disk("tests/fork.json").unwrap(); // Get the environment going - let environment = Environment::builder().with_db(fork.db).build(); + let environment = Environment::builder().with_state(fork.db).build(); let vitalik_address = fork.eoa.get("vitalik").unwrap(); let vitalik_as_a_client = @@ -146,5 +146,44 @@ async fn env_returns_db() { let (environment, client) = startup(); deploy_arbx(client).await; let db = environment.stop().unwrap(); - assert!(!db.0.read().unwrap().accounts.is_empty()) + assert!(!db.state.read().unwrap().accounts.is_empty()) +} + +#[tokio::test] +async fn block_logs() { + let (environment, client) = startup(); + + let arbiter_token = deploy_arbx(client.clone()).await; + arbiter_token + .mint(Address::zero(), eU256::from(1000)) + .send() + .await + .unwrap() + .await + .unwrap(); + + let new_block_number = 69; + let new_block_timestamp = 420; + + client + .update_block(new_block_number, new_block_timestamp) + .unwrap(); + + arbiter_token + .approve(Address::zero(), eU256::from(1000)) + .send() + .await + .unwrap() + .await + .unwrap(); + client.update_block(6969, 420420).unwrap(); + + let db = environment.stop().unwrap(); + let logs = db.logs.read().unwrap(); + println!("DB Logs: {:?}\n", logs); + assert_eq!(logs.get(&revm::primitives::U256::from(0)).unwrap().len(), 1); + assert_eq!( + logs.get(&revm::primitives::U256::from(69)).unwrap().len(), + 1 + ); } diff --git a/core/tests/middleware_integration.rs b/core/tests/middleware_integration.rs index e9d95f42..c1705cfe 100644 --- a/core/tests/middleware_integration.rs +++ b/core/tests/middleware_integration.rs @@ -625,3 +625,39 @@ async fn stream_with_meta() { assert_eq!(format!("{:?}", stream.next().await), "Some(Ok((ApprovalFilter(ApprovalFilter { owner: 0x2efdc9eecfee3a776209fcb8e9a83a6b221d74f5, spender: 0x2efdc9eecfee3a776209fcb8e9a83a6b221d74f5, amount: 1 }), LogMeta { address: 0x067ea9e44c76a2620f10b39a1b51d5124a299192, block_number: 0, block_hash: 0x0000000000000000000000000000000000000000000000000000000000000000, transaction_hash: 0x0000000000000000000000000000000000000000000000000000000000000000, transaction_index: 2, log_index: 0 })))"); assert_eq!(format!("{:?}", stream.next().await), "Some(Ok((ApprovalFilter(ApprovalFilter { owner: 0x2efdc9eecfee3a776209fcb8e9a83a6b221d74f5, spender: 0x2efdc9eecfee3a776209fcb8e9a83a6b221d74f5, amount: 1 }), LogMeta { address: 0x067ea9e44c76a2620f10b39a1b51d5124a299192, block_number: 1, block_hash: 0x0000000000000000000000000000000000000000000000000000000000000000, transaction_hash: 0x0000000000000000000000000000000000000000000000000000000000000000, transaction_index: 0, log_index: 0 })))"); } + +#[tokio::test] +async fn get_logs() { + let (_environment, client) = startup(); + + let arbx = deploy_arbx(client.clone()).await; + + for _ in 0..2 { + arbx.approve(client.address(), eU256::from(1)) + .send() + .await + .unwrap() + .await + .unwrap(); + } + + client.update_block(1, 1).unwrap(); + + arbx.approve(client.address(), eU256::from(1)) + .send() + .await + .unwrap() + .await + .unwrap(); + + let filter = arbx + .approval_filter() + .filter + .from_block(0) + .to_block(1) + .address(arbx.address()); + println!("filter: {:#?}", filter); + let logs = client.get_logs(&filter).await.unwrap(); + println!("logs: {:#?}", logs); + assert_eq!(logs.len(), 3); +} diff --git a/docs/src/usage/arbiter_engine/agents_and_engines.md b/docs/src/usage/arbiter_engine/agents_and_engines.md index e477c8ec..baac9746 100644 --- a/docs/src/usage/arbiter_engine/agents_and_engines.md +++ b/docs/src/usage/arbiter_engine/agents_and_engines.md @@ -46,7 +46,7 @@ use crate::Replier; fn setup() { let ping_replier = Replier::new("ping", "pong", 5, None); let pong_replier = Replier::new("pong", "ping", 5, Some("ping")); - let agent = Agent::new("my_agent") + let agent = Agent::builder("my_agent") .with_behavior(ping_replier) .with_behavior(pong_replier); } @@ -55,4 +55,4 @@ In this example, we have created an `Agent` with two `Replier` behaviors. The `ping_replier` will reply to a message with "pong" and the `pong_replier` will reply to a message with "ping". Given that the `pong_replier` has a `startup_message` of "ping", it will send a message to everyone (including the "my_agent" itself who holds the `ping_replier` behavior) when it starts up. This will start a chain of messages that will continue in a "ping" "pong" fashion until the `max_count` is reached. -``` \ No newline at end of file +``` diff --git a/engine/CHANGELOG.md b/engine/CHANGELOG.md index 50a30f4c..f5d82788 100644 --- a/engine/CHANGELOG.md +++ b/engine/CHANGELOG.md @@ -6,6 +6,24 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.3.2](https://github.com/primitivefinance/arbiter/compare/arbiter-engine-v0.3.1...arbiter-engine-v0.3.2) - 2024-02-26 + +### Added +- `error!` output from behavior ([#913](https://github.com/primitivefinance/arbiter/pull/913)) + +## [0.3.1](https://github.com/primitivefinance/arbiter/compare/arbiter-engine-v0.3.0...arbiter-engine-v0.3.1) - 2024-02-20 + +### Other +- update Cargo.toml dependencies + +## [0.3.0](https://github.com/primitivefinance/arbiter/compare/arbiter-engine-v0.2.1...arbiter-engine-v0.3.0) - 2024-02-16 + +### Added +- *(engine)* optional stream for behaviors ([#899](https://github.com/primitivefinance/arbiter/pull/899)) + +### Other +- refactor engine tests and examples ([#895](https://github.com/primitivefinance/arbiter/pull/895)) + ## [0.2.1](https://github.com/primitivefinance/arbiter/compare/arbiter-engine-v0.2.0...arbiter-engine-v0.2.1) - 2024-02-15 ### Other diff --git a/engine/Cargo.toml b/engine/Cargo.toml index a60da25b..69996c26 100644 --- a/engine/Cargo.toml +++ b/engine/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "arbiter-engine" -version = "0.2.1" +version = "0.3.2" edition = "2021" authors = [ "Waylon Jepsen ", diff --git a/engine/src/machine.rs b/engine/src/machine.rs index d00e476d..d6e3d888 100644 --- a/engine/src/machine.rs +++ b/engine/src/machine.rs @@ -7,6 +7,7 @@ use anyhow::Result; use arbiter_core::middleware::ArbiterMiddleware; use futures_util::{Stream, StreamExt}; use tokio::task::JoinHandle; +use tracing::error; use super::*; @@ -70,7 +71,9 @@ pub enum State { /// The [`Behavior`] trait is the lowest level functionality that will be used /// by a [`StateMachine`]. This constitutes what each state transition will do. #[async_trait::async_trait] -pub trait Behavior: Serialize + DeserializeOwned + Send + Sync + Debug + 'static { +pub trait Behavior: + Serialize + DeserializeOwned + Send + Sync + Debug + 'static +{ /// Used to start the agent. /// This is where the agent can engage in its specific start up activities /// that it can do given the current state of the world. @@ -78,12 +81,14 @@ pub trait Behavior: Serialize + DeserializeOwned + Send + Sync + Debug + 'sta &mut self, client: Arc, messager: Messager, - ) -> Result>; + ) -> Result>>; /// Used to process events. /// This is where the agent can engage in its specific processing /// of events that can lead to actions being taken. - async fn process(&mut self, event: E) -> Result; + async fn process(&mut self, _event: E) -> Result { + Ok(ControlFlow::Halt) + } } /// A trait for creating a state machine. /// @@ -140,7 +145,7 @@ pub trait StateMachine: Send + Sync + Debug + 'static { /// This method does not return a value, but it may result in state changes /// within the implementing type or the generation of further instructions /// or events. - async fn execute(&mut self, instruction: MachineInstruction) -> Result<()>; + async fn execute(&mut self, _instruction: MachineInstruction) -> Result<()>; } /// The `Engine` struct represents the core logic unit of a state machine-based @@ -161,6 +166,7 @@ pub trait StateMachine: Send + Sync + Debug + 'static { pub struct Engine where B: Behavior, + E: Send + 'static, { /// The behavior the `Engine` runs. behavior: Option, @@ -211,22 +217,47 @@ where async fn execute(&mut self, instruction: MachineInstruction) -> Result<()> { // NOTE: The unwraps here are safe because the `Behavior` in an engine is only // accessed here and it is private. + let id: Option; match instruction { MachineInstruction::Start(client, messager) => { + id = messager.id.clone(); + let id_clone = id.clone(); self.state = State::Starting; let mut behavior = self.behavior.take().unwrap(); - let behavior_task: JoinHandle, B)>> = + let behavior_task: JoinHandle>, B)>> = tokio::spawn(async move { - let id = messager.id.clone(); - let stream = behavior.startup(client, messager).await?; - debug!("startup complete for behavior {:?}", id); + let stream = match behavior.startup(client, messager).await { + Ok(stream) => stream, + Err(e) => { + error!( + "startup failed for behavior {:?}: \n reason: {:?}", + id_clone, e + ); + // Throw a panic as we cannot recover from this for now. + panic!(); + } + }; + debug!("startup complete for behavior {:?}", id_clone); Ok((stream, behavior)) }); let (stream, behavior) = behavior_task.await??; - self.event_stream = Some(stream); - self.behavior = Some(behavior); - self.execute(MachineInstruction::Process).await?; - Ok(()) + match stream { + Some(stream) => { + self.event_stream = Some(stream); + self.behavior = Some(behavior); + match self.execute(MachineInstruction::Process).await { + Ok(_) => {} + Err(e) => { + error!("process failed for behavior {:?}: \n reason: {:?}", id, e); + } + } + Ok(()) + } + None => { + self.behavior = Some(behavior); + Ok(()) + } + } } MachineInstruction::Process => { trace!("Behavior is starting up."); diff --git a/engine/tests/common.rs b/engine/tests/common.rs index 883ef2ef..9416f270 100644 --- a/engine/tests/common.rs +++ b/engine/tests/common.rs @@ -8,6 +8,12 @@ use arbiter_engine::{ }; use serde::{Deserialize, Serialize}; +#[allow(unused)] +fn trace() { + std::env::set_var("RUST_LOG", "trace"); + tracing_subscriber::fmt::init(); +} + fn default_max_count() -> Option { Some(3) } @@ -53,12 +59,12 @@ impl Behavior for TimedMessage { &mut self, _client: Arc, messager: Messager, - ) -> Result> { + ) -> Result>> { if let Some(startup_message) = &self.startup_message { messager.send(To::All, startup_message).await?; } self.messager = Some(messager.clone()); - Ok(messager.stream()?) + Ok(Some(messager.stream()?)) } async fn process(&mut self, event: Message) -> Result { diff --git a/engine/tests/machine_integration.rs b/engine/tests/machine_integration.rs new file mode 100644 index 00000000..3538daea --- /dev/null +++ b/engine/tests/machine_integration.rs @@ -0,0 +1,28 @@ +use arbiter_engine::{agent::Agent, world::World}; + +include!("common.rs"); + +#[derive(Debug, Deserialize, Serialize)] +struct MockBehavior; + +#[async_trait::async_trait] +impl Behavior<()> for MockBehavior { + async fn startup( + &mut self, + _client: Arc, + _messager: Messager, + ) -> Result>> { + Ok(None) + } +} + +#[tokio::test] +async fn behavior_no_stream() { + trace(); + let mut world = World::new("test"); + let behavior = MockBehavior; + let agent = Agent::builder("agent").with_behavior(behavior); + world.add_agent(agent); + + world.run().await.unwrap(); +} diff --git a/examples/minter/behaviors/token_admin.rs b/examples/minter/behaviors/token_admin.rs index f6669605..496f1901 100644 --- a/examples/minter/behaviors/token_admin.rs +++ b/examples/minter/behaviors/token_admin.rs @@ -52,7 +52,7 @@ impl Behavior for TokenAdmin { &mut self, client: Arc, messager: Messager, - ) -> Result> { + ) -> Result>> { self.messager = Some(messager.clone()); self.client = Some(client.clone()); for token_data in self.token_data.values_mut() { @@ -74,7 +74,7 @@ impl Behavior for TokenAdmin { .get_or_insert_with(HashMap::new) .insert(token_data.name.clone(), token.clone()); } - Ok(messager.stream()?) + Ok(Some(messager.stream()?)) } #[tracing::instrument(skip(self), fields(id = diff --git a/examples/minter/behaviors/token_requester.rs b/examples/minter/behaviors/token_requester.rs index 03c9d9db..e8fcb741 100644 --- a/examples/minter/behaviors/token_requester.rs +++ b/examples/minter/behaviors/token_requester.rs @@ -35,7 +35,7 @@ impl Behavior for TokenRequester { &mut self, client: Arc, mut messager: Messager, - ) -> Result> { + ) -> Result>> { messager .send( To::Agent(self.request_to.clone()), @@ -59,7 +59,7 @@ impl Behavior for TokenRequester { self.messager = Some(messager.clone()); self.client = Some(client.clone()); let transfer_stream = stream_event(token.transfer_filter()); - Ok(transfer_stream) + Ok(Some(transfer_stream)) } #[tracing::instrument(skip(self), fields(id = diff --git a/examples/template b/examples/template index c04df2a2..6211811e 160000 --- a/examples/template +++ b/examples/template @@ -1 +1 @@ -Subproject commit c04df2a2c8d8a06ab1f4339142de1d1fa940d196 +Subproject commit 6211811ee2748d803fa27a755d51f5298a80f9e4 diff --git a/macros/CHANGELOG.md b/macros/CHANGELOG.md index d4189c5f..572c34ec 100644 --- a/macros/CHANGELOG.md +++ b/macros/CHANGELOG.md @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [0.1.3](https://github.com/primitivefinance/arbiter/compare/arbiter-macros-v0.1.2...arbiter-macros-v0.1.3) - 2024-02-20 + +### Other +- update Cargo.toml dependencies + ## [0.1.2](https://github.com/primitivefinance/arbiter/compare/arbiter-macros-v0.1.1...arbiter-macros-v0.1.2) - 2024-02-15 ### Other diff --git a/macros/Cargo.toml b/macros/Cargo.toml index b55df67c..203db20e 100644 --- a/macros/Cargo.toml +++ b/macros/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "arbiter-macros" -version = "0.1.2" +version = "0.1.3" edition = "2021" authors = [ "Matt Czernik ", From 87626b216dcfa8e8cf8d7f9cc3d278147715c3f7 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Thu, 29 Feb 2024 05:57:43 -0700 Subject: [PATCH 3/5] feat: txenv in coprocessor transact --- Cargo.lock | 16 +++++++--------- core/src/coprocessor.rs | 11 +++++++---- examples/template | 2 +- 3 files changed, 15 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 267acd45..8fbaae32 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -219,7 +219,7 @@ dependencies = [ "anyhow", "arbiter-bindings 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", "arbiter-core 0.10.3 (registry+https://github.com/rust-lang/crates.io-index)", - "arbiter-engine 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "arbiter-engine 0.3.1", "arbiter-macros 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", "assert_cmd", "async-trait", @@ -230,7 +230,6 @@ dependencies = [ "proc-macro2", "rayon", "revm", - "revm-primitives 2.0.0", "serde", "serde_json", "syn 2.0.52", @@ -282,7 +281,6 @@ dependencies = [ "polars", "rand", "revm", - "revm-primitives 2.0.0", "serde", "serde_json", "thiserror", @@ -323,7 +321,9 @@ dependencies = [ [[package]] name = "arbiter-engine" -version = "0.3.2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0553d66d507f24b9a7f63b783e9a2a37edaa5d93bfc9f23a3587dfcd65c0c3a6" dependencies = [ "anyhow", "arbiter-bindings 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -342,15 +342,11 @@ dependencies = [ "tokio-stream", "toml 0.8.10", "tracing", - "tracing-subscriber", - "tracing-test", ] [[package]] name = "arbiter-engine" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0553d66d507f24b9a7f63b783e9a2a37edaa5d93bfc9f23a3587dfcd65c0c3a6" +version = "0.3.2" dependencies = [ "anyhow", "arbiter-bindings 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -369,6 +365,8 @@ dependencies = [ "tokio-stream", "toml 0.8.10", "tracing", + "tracing-subscriber", + "tracing-test", ] [[package]] diff --git a/core/src/coprocessor.rs b/core/src/coprocessor.rs index 560224fa..839c5335 100644 --- a/core/src/coprocessor.rs +++ b/core/src/coprocessor.rs @@ -35,9 +35,9 @@ impl<'a> Coprocessor<'a> { Self { evm } } - // TODO: Should probably take in a TxEnv or something. /// Used as an entrypoint to process a call with the `Coprocessor`. - pub fn transact(&mut self) -> Result> { + pub fn transact(&mut self, tx_env: TxEnv) -> Result> { + *self.evm.tx_mut() = tx_env; self.evm.transact() } } @@ -55,8 +55,11 @@ mod tests { fn coprocessor() { let environment = Environment::builder().build(); let mut coprocessor = Coprocessor::new(&environment); - coprocessor.evm.tx_mut().value = U256::from(100); - let outcome = coprocessor.transact(); + let tx_env = TxEnv { + value: U256::from(100), + ..Default::default() + }; + let outcome = coprocessor.transact(tx_env); if let Err(EVMError::Transaction(InvalidTransaction::LackOfFundForMaxFee { fee, balance, diff --git a/examples/template b/examples/template index 6211811e..c04df2a2 160000 --- a/examples/template +++ b/examples/template @@ -1 +1 @@ -Subproject commit 6211811ee2748d803fa27a755d51f5298a80f9e4 +Subproject commit c04df2a2c8d8a06ab1f4339142de1d1fa940d196 From f905cf6e0b3e99feeed7b92569b45ad2565a7390 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Thu, 29 Feb 2024 06:14:13 -0700 Subject: [PATCH 4/5] feat: `get_block_timestamp` with `coprocessor` --- core/src/coprocessor.rs | 3 ++- core/src/middleware/connection.rs | 2 +- core/src/middleware/mod.rs | 20 +++----------------- 3 files changed, 6 insertions(+), 19 deletions(-) diff --git a/core/src/coprocessor.rs b/core/src/coprocessor.rs index 839c5335..042bea12 100644 --- a/core/src/coprocessor.rs +++ b/core/src/coprocessor.rs @@ -19,7 +19,7 @@ use crate::environment::Environment; /// current state to make decisions. #[derive(Debug)] pub struct Coprocessor<'a> { - evm: Evm<'a, ArbiterInspector, ArbiterDB>, + pub(crate) evm: Evm<'a, ArbiterInspector, ArbiterDB>, } impl<'a> Coprocessor<'a> { @@ -32,6 +32,7 @@ impl<'a> Coprocessor<'a> { .with_external_context(inspector) .append_handler_register(inspector_handle_register) .build(); + println!("Coprocessor timestamp: {:?}", evm.block().timestamp); Self { evm } } diff --git a/core/src/middleware/connection.rs b/core/src/middleware/connection.rs index 857a5520..59a7d0c0 100644 --- a/core/src/middleware/connection.rs +++ b/core/src/middleware/connection.rs @@ -41,7 +41,7 @@ impl From<&Environment> for Connection { outcome_receiver, event_sender: environment.socket.event_broadcaster.clone(), filter_receivers: Arc::new(Mutex::new(HashMap::new())), - coprocessor: Coprocessor::new(&environment), + coprocessor: Coprocessor::new(environment), } } } diff --git a/core/src/middleware/mod.rs b/core/src/middleware/mod.rs index 15e6ea48..c7a1543e 100644 --- a/core/src/middleware/mod.rs +++ b/core/src/middleware/mod.rs @@ -79,7 +79,6 @@ pub struct ArbiterMiddleware { provider: Provider, wallet: EOA, /// An optional label for the middleware instance - #[allow(unused)] pub label: Option, } @@ -259,7 +258,6 @@ impl ArbiterMiddleware { environment: &Environment, forked_eoa: eAddress, ) -> Result, ArbiterCoreError> { - let instruction_sender = &Arc::clone(&environment.socket.instruction_sender); let connection = Connection::from(environment); let provider = Provider::new(connection); info!( @@ -300,21 +298,9 @@ impl ArbiterMiddleware { /// Returns the timestamp of the current block. pub async fn get_block_timestamp(&self) -> Result { let provider = self.provider().as_ref(); - provider - .instruction_sender - .upgrade() - .ok_or(ArbiterCoreError::UpgradeSenderError)? - .send(Instruction::Query { - environment_data: EnvironmentData::BlockTimestamp, - outcome_sender: provider.outcome_sender.clone(), - })?; - - match provider.outcome_receiver.recv()?? { - Outcome::QueryReturn(outcome) => { - Ok(ethers::types::U256::from_str_radix(outcome.as_ref(), 10)?) - } - _ => unreachable!(), - } + Ok(eU256::from_little_endian( + &provider.coprocessor.evm.block().timestamp.as_le_bytes(), + )) } /// Sends a cheatcode instruction to the environment. From 9719da59001ab5da57f36ca45b430012958cdcc9 Mon Sep 17 00:00:00 2001 From: Colin Roberts Date: Thu, 29 Feb 2024 07:00:28 -0700 Subject: [PATCH 5/5] bug: need shared env context --- core/src/coprocessor.rs | 1 - core/tests/middleware_integration.rs | 10 ++++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/core/src/coprocessor.rs b/core/src/coprocessor.rs index 042bea12..1e33ee6c 100644 --- a/core/src/coprocessor.rs +++ b/core/src/coprocessor.rs @@ -32,7 +32,6 @@ impl<'a> Coprocessor<'a> { .with_external_context(inspector) .append_handler_register(inspector_handle_register) .build(); - println!("Coprocessor timestamp: {:?}", evm.block().timestamp); Self { evm } } diff --git a/core/tests/middleware_integration.rs b/core/tests/middleware_integration.rs index c1705cfe..31c848d2 100644 --- a/core/tests/middleware_integration.rs +++ b/core/tests/middleware_integration.rs @@ -263,6 +263,16 @@ async fn get_block_timestamp() { assert_eq!(block_timestamp, eU256::from(1)) } +#[tokio::test] +async fn update_block_timestamp() { + let (_environment, client) = startup(); + let block_timestamp = client.get_block_timestamp().await.unwrap(); + assert_eq!(block_timestamp, eU256::from(1)); + client.update_block(1, 100).unwrap(); + let block_timestamp = client.get_block_timestamp().await.unwrap(); + assert_eq!(block_timestamp, eU256::from(100)); +} + #[tokio::test] async fn get_gas_price() { // User controlled should have 0 gas price initially