mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-04-22 07:57:58 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8c09428be5 | |||
| ac6387b6f0 |
Generated
+71
-65
@@ -67,9 +67,9 @@ checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
|
||||
|
||||
[[package]]
|
||||
name = "alloy"
|
||||
version = "1.0.20"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ae58d888221eecf621595e2096836ce7cfc37be06bfa39d7f64aa6a3ea4c9e5b"
|
||||
checksum = "8ad4eb51e7845257b70c51b38ef8d842d5e5e93196701fcbd757577971a043c6"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-contract",
|
||||
@@ -102,15 +102,16 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-consensus"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ad451f9a70c341d951bca4e811d74dbe1e193897acd17e9dbac1353698cc430b"
|
||||
checksum = "ca3b746060277f3d7f9c36903bb39b593a741cb7afcb0044164c28f0e9b673f0"
|
||||
dependencies = [
|
||||
"alloy-eips",
|
||||
"alloy-primitives",
|
||||
"alloy-rlp",
|
||||
"alloy-serde",
|
||||
"alloy-trie",
|
||||
"alloy-tx-macros",
|
||||
"auto_impl",
|
||||
"c-kzg",
|
||||
"derive_more 2.0.1",
|
||||
@@ -126,9 +127,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-consensus-any"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "142daffb15d5be1a2b20d2cd540edbcef03037b55d4ff69dc06beb4d06286dba"
|
||||
checksum = "bf98679329fa708fa809ea596db6d974da892b068ad45e48ac1956f582edf946"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
@@ -140,9 +141,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-contract"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ebf25443920ecb9728cb087fe4dc04a0b290bd6ac85638c58fe94aba70f1a44e"
|
||||
checksum = "a10e47f5305ea08c37b1772086c1573e9a0a257227143996841172d37d3831bb"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-dyn-abi",
|
||||
@@ -157,6 +158,7 @@ dependencies = [
|
||||
"alloy-transport",
|
||||
"futures",
|
||||
"futures-util",
|
||||
"serde_json",
|
||||
"thiserror 2.0.12",
|
||||
]
|
||||
|
||||
@@ -227,9 +229,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-eips"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "3056872f6da48046913e76edb5ddced272861f6032f09461aea1a2497be5ae5d"
|
||||
checksum = "f562a81278a3ed83290e68361f2d1c75d018ae3b8589a314faf9303883e18ec9"
|
||||
dependencies = [
|
||||
"alloy-eip2124",
|
||||
"alloy-eip2930",
|
||||
@@ -247,15 +249,16 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-genesis"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c98fb40f07997529235cc474de814cd7bd9de561e101716289095696c0e4639d"
|
||||
checksum = "dc41384e9ab8c9b2fb387c52774d9d432656a28edcda1c2d4083e96051524518"
|
||||
dependencies = [
|
||||
"alloy-eips",
|
||||
"alloy-primitives",
|
||||
"alloy-serde",
|
||||
"alloy-trie",
|
||||
"serde",
|
||||
"serde_with",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@@ -272,12 +275,13 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-json-rpc"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "dc08b31ebf9273839bd9a01f9333cbb7a3abb4e820c312ade349dd18bdc79581"
|
||||
checksum = "12c454fcfcd5d26ed3b8cae5933cbee9da5f0b05df19b46d4bd4446d1f082565"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-sol-types",
|
||||
"http",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"thiserror 2.0.12",
|
||||
@@ -286,9 +290,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-network"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "ed117b08f0cc190312bf0c38c34cf4f0dabfb4ea8f330071c587cd7160a88cb2"
|
||||
checksum = "42d6d39eabe5c7b3d8f23ac47b0b683b99faa4359797114636c66e0743103d05"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-consensus-any",
|
||||
@@ -312,9 +316,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-network-primitives"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c7162ff7be8649c0c391f4e248d1273e85c62076703a1f3ec7daf76b283d886d"
|
||||
checksum = "3704fa8b7ba9ba3f378d99b3d628c8bc8c2fc431b709947930f154e22a8368b6"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-eips",
|
||||
@@ -352,9 +356,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-provider"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d84eba1fd8b6fe8b02f2acd5dd7033d0f179e304bd722d11e817db570d1fa6c4"
|
||||
checksum = "08800e8cbe70c19e2eb7cf3d7ff4b28bdd9b3933f8e1c8136c7d910617ba03bf"
|
||||
dependencies = [
|
||||
"alloy-chains",
|
||||
"alloy-consensus",
|
||||
@@ -380,6 +384,7 @@ dependencies = [
|
||||
"either",
|
||||
"futures",
|
||||
"futures-utils-wasm",
|
||||
"http",
|
||||
"lru",
|
||||
"parking_lot",
|
||||
"pin-project",
|
||||
@@ -395,9 +400,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-pubsub"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8550f7306e0230fc835eb2ff4af0a96362db4b6fc3f25767d161e0ad0ac765bf"
|
||||
checksum = "ae68457a2c2ead6bd7d7acb5bf5f1623324b1962d4f8e7b0250657a3c3ab0a0b"
|
||||
dependencies = [
|
||||
"alloy-json-rpc",
|
||||
"alloy-primitives",
|
||||
@@ -438,9 +443,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-rpc-client"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "518a699422a3eab800f3dac2130d8f2edba8e4fff267b27a9c7dc6a2b0d313ee"
|
||||
checksum = "162301b5a57d4d8f000bf30f4dcb82f9f468f3e5e846eeb8598dd39e7886932c"
|
||||
dependencies = [
|
||||
"alloy-json-rpc",
|
||||
"alloy-primitives",
|
||||
@@ -448,7 +453,6 @@ dependencies = [
|
||||
"alloy-transport",
|
||||
"alloy-transport-http",
|
||||
"alloy-transport-ipc",
|
||||
"async-stream",
|
||||
"futures",
|
||||
"pin-project",
|
||||
"reqwest",
|
||||
@@ -458,16 +462,15 @@ dependencies = [
|
||||
"tokio-stream",
|
||||
"tower",
|
||||
"tracing",
|
||||
"tracing-futures",
|
||||
"url",
|
||||
"wasmtimer",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-rpc-types"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "c000cab4ec26a4b3e29d144e999e1c539c2fa0abed871bf90311eb3466187ca8"
|
||||
checksum = "6cd8ca94ae7e2b32cc3895d9981f3772aab0b4756aa60e9ed0bcfee50f0e1328"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-rpc-types-eth",
|
||||
@@ -478,9 +481,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-any"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "508b2fbe66d952089aa694e53802327798806498cd29ff88c75135770ecaabfc"
|
||||
checksum = "076b47e834b367d8618c52dd0a0d6a711ddf66154636df394805300af4923b8a"
|
||||
dependencies = [
|
||||
"alloy-consensus-any",
|
||||
"alloy-rpc-types-eth",
|
||||
@@ -489,9 +492,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-debug"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8c832f2e851801093928dbb4b7bd83cd22270faf76b2e080646b806a285c8757"
|
||||
checksum = "94a2a86ad7b7d718c15e79d0779bd255561b6b22968dc5ed2e7c0fbc43bb55fe"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"serde",
|
||||
@@ -499,9 +502,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-eth"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fcaf7dff0fdd756a714d58014f4f8354a1706ebf9fa2cf73431e0aeec3c9431e"
|
||||
checksum = "2c2f847e635ec0be819d06e2ada4bcc4e4204026a83c4bfd78ae8d550e027ae7"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-consensus-any",
|
||||
@@ -514,14 +517,15 @@ dependencies = [
|
||||
"itertools 0.14.0",
|
||||
"serde",
|
||||
"serde_json",
|
||||
"serde_with",
|
||||
"thiserror 2.0.12",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-rpc-types-trace"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6e3507a04e868dd83219ad3cd6a8c58aefccb64d33f426b3934423a206343e84"
|
||||
checksum = "6fc58180302a94c934d455eeedb3ecb99cdc93da1dbddcdbbdb79dd6fe618b2a"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-rpc-types-eth",
|
||||
@@ -533,9 +537,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-serde"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "730e8f2edf2fc224cabd1c25d090e1655fa6137b2e409f92e5eec735903f1507"
|
||||
checksum = "ae699248d02ade9db493bbdae61822277dc14ae0f82a5a4153203b60e34422a6"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"serde",
|
||||
@@ -544,9 +548,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-signer"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6b0d2428445ec13edc711909e023d7779618504c4800be055a5b940025dbafe3"
|
||||
checksum = "3cf7d793c813515e2b627b19a15693960b3ed06670f9f66759396d06ebe5747b"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"async-trait",
|
||||
@@ -559,9 +563,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-signer-local"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e14fe6fedb7fe6e0dfae47fe020684f1d8e063274ef14bca387ddb7a6efa8ec1"
|
||||
checksum = "51a424bc5a11df0d898ce0fd15906b88ebe2a6e4f17a514b51bc93946bb756bd"
|
||||
dependencies = [
|
||||
"alloy-consensus",
|
||||
"alloy-network",
|
||||
@@ -648,9 +652,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-transport"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "a712bdfeff42401a7dd9518f72f617574c36226a9b5414537fedc34350b73bf9"
|
||||
checksum = "4f317d20f047b3de4d9728c556e2e9a92c9a507702d2016424cd8be13a74ca5e"
|
||||
dependencies = [
|
||||
"alloy-json-rpc",
|
||||
"alloy-primitives",
|
||||
@@ -671,9 +675,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-transport-http"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "7ea5a76d7f2572174a382aedf36875bedf60bcc41116c9f031cf08040703a2dc"
|
||||
checksum = "ff084ac7b1f318c87b579d221f11b748341d68b9ddaa4ffca5e62ed2b8cfefb4"
|
||||
dependencies = [
|
||||
"alloy-json-rpc",
|
||||
"alloy-transport",
|
||||
@@ -686,9 +690,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-transport-ipc"
|
||||
version = "1.0.9"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "606af17a7e064d219746f6d2625676122c79d78bf73dfe746d6db9ecd7dbcb85"
|
||||
checksum = "edb099cdad8ed2e6a80811cdf9bbf715ebf4e34c981b4a6e2d1f9daacbf8b218"
|
||||
dependencies = [
|
||||
"alloy-json-rpc",
|
||||
"alloy-pubsub",
|
||||
@@ -706,9 +710,9 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "alloy-trie"
|
||||
version = "0.8.1"
|
||||
version = "0.9.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "983d99aa81f586cef9dae38443245e585840fcf0fc58b09aee0b1f27aed1d500"
|
||||
checksum = "bada1fc392a33665de0dc50d401a3701b62583c655e3522a323490a5da016962"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"alloy-rlp",
|
||||
@@ -720,6 +724,19 @@ dependencies = [
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "alloy-tx-macros"
|
||||
version = "1.0.22"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1154c8187a5ff985c95a8b2daa2fedcf778b17d7668e5e50e556c4ff9c881154"
|
||||
dependencies = [
|
||||
"alloy-primitives",
|
||||
"darling",
|
||||
"proc-macro2",
|
||||
"quote",
|
||||
"syn 2.0.101",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "android-tzdata"
|
||||
version = "0.1.1"
|
||||
@@ -3268,13 +3285,14 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nybbles"
|
||||
version = "0.3.4"
|
||||
version = "0.4.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "8983bb634df7248924ee0c4c3a749609b5abcb082c28fffe3254b3eb3602b307"
|
||||
checksum = "675b3a54e5b12af997abc8b6638b0aee51a28caedab70d4967e0d5db3a3f1d06"
|
||||
dependencies = [
|
||||
"alloy-rlp",
|
||||
"const-hex",
|
||||
"cfg-if",
|
||||
"proptest",
|
||||
"ruint",
|
||||
"serde",
|
||||
"smallvec",
|
||||
]
|
||||
@@ -5489,18 +5507,6 @@ dependencies = [
|
||||
"valuable",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-futures"
|
||||
version = "0.2.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2"
|
||||
dependencies = [
|
||||
"futures",
|
||||
"futures-task",
|
||||
"pin-project",
|
||||
"tracing",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "tracing-log"
|
||||
version = "0.2.0"
|
||||
|
||||
+2
-1
@@ -59,7 +59,7 @@ revive-common = { git = "https://github.com/paritytech/revive", rev = "3389865af
|
||||
revive-differential = { git = "https://github.com/paritytech/revive", rev = "3389865af7c3ff6f29a586d82157e8bc573c1a8e" }
|
||||
|
||||
[workspace.dependencies.alloy]
|
||||
version = "1.0"
|
||||
version = "1.0.22"
|
||||
default-features = false
|
||||
features = [
|
||||
"json-abi",
|
||||
@@ -73,6 +73,7 @@ features = [
|
||||
"network",
|
||||
"serde",
|
||||
"rpc-types-eth",
|
||||
"genesis",
|
||||
]
|
||||
|
||||
[profile.bench]
|
||||
|
||||
@@ -123,16 +123,18 @@ impl Arguments {
|
||||
panic!("should have a workdir configured")
|
||||
}
|
||||
|
||||
/// Try to parse `self.account` into a [PrivateKeySigner],
|
||||
/// panicing on error.
|
||||
pub fn wallet(&self) -> EthereumWallet {
|
||||
let signer = self
|
||||
.account
|
||||
pub fn signer(&self) -> PrivateKeySigner {
|
||||
self.account
|
||||
.parse::<PrivateKeySigner>()
|
||||
.unwrap_or_else(|error| {
|
||||
panic!("private key '{}' parsing error: {error}", self.account);
|
||||
});
|
||||
EthereumWallet::new(signer)
|
||||
})
|
||||
}
|
||||
|
||||
/// Try to parse `self.account` into a [PrivateKeySigner],
|
||||
/// panicing on error.
|
||||
pub fn wallet(&self) -> EthereumWallet {
|
||||
EthereumWallet::new(self.signer())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+31
-8
@@ -1,5 +1,6 @@
|
||||
use std::{collections::HashMap, sync::LazyLock};
|
||||
|
||||
use alloy::primitives::Address;
|
||||
use clap::Parser;
|
||||
use rayon::{ThreadPoolBuilder, prelude::*};
|
||||
|
||||
@@ -8,7 +9,7 @@ use revive_dt_core::{
|
||||
Geth, Kitchensink, Platform,
|
||||
driver::{Driver, State},
|
||||
};
|
||||
use revive_dt_format::{corpus::Corpus, metadata::MetadataFile};
|
||||
use revive_dt_format::{corpus::Corpus, input::default_caller, metadata::MetadataFile};
|
||||
use revive_dt_node::pool::NodePool;
|
||||
use revive_dt_report::reporter::{Report, Span};
|
||||
use temp_dir::TempDir;
|
||||
@@ -20,12 +21,24 @@ static TEMP_DIR: LazyLock<TempDir> = LazyLock::new(|| TempDir::new().unwrap());
|
||||
fn main() -> anyhow::Result<()> {
|
||||
let args = init_cli()?;
|
||||
|
||||
let corpora = collect_corpora(&args)?;
|
||||
let additional_callers = corpora
|
||||
.values()
|
||||
.flat_map(|value| value.iter().map(|metadata| &metadata.cases))
|
||||
.flat_map(|case| case.iter().map(|case| &case.inputs))
|
||||
.flatten()
|
||||
.map(|input| input.caller)
|
||||
.filter(|caller| caller != &default_caller())
|
||||
.collect::<Vec<_>>();
|
||||
|
||||
tracing::debug!(?additional_callers, "Discovered callers");
|
||||
|
||||
for (corpus, tests) in collect_corpora(&args)? {
|
||||
let span = Span::new(corpus, args.clone())?;
|
||||
|
||||
match &args.compile_only {
|
||||
Some(platform) => compile_corpus(&args, &tests, platform, span),
|
||||
None => execute_corpus(&args, &tests, span)?,
|
||||
None => execute_corpus(&args, &tests, &additional_callers, span)?,
|
||||
}
|
||||
|
||||
Report::save()?;
|
||||
@@ -83,15 +96,20 @@ fn collect_corpora(args: &Arguments) -> anyhow::Result<HashMap<Corpus, Vec<Metad
|
||||
Ok(corpora)
|
||||
}
|
||||
|
||||
fn run_driver<L, F>(args: &Arguments, tests: &[MetadataFile], span: Span) -> anyhow::Result<()>
|
||||
fn run_driver<L, F>(
|
||||
args: &Arguments,
|
||||
tests: &[MetadataFile],
|
||||
additional_callers: &[Address],
|
||||
span: Span,
|
||||
) -> anyhow::Result<()>
|
||||
where
|
||||
L: Platform,
|
||||
F: Platform,
|
||||
L::Blockchain: revive_dt_node::Node + Send + Sync + 'static,
|
||||
F::Blockchain: revive_dt_node::Node + Send + Sync + 'static,
|
||||
{
|
||||
let leader_nodes = NodePool::<L::Blockchain>::new(args)?;
|
||||
let follower_nodes = NodePool::<F::Blockchain>::new(args)?;
|
||||
let leader_nodes = NodePool::<L::Blockchain>::new(args, additional_callers)?;
|
||||
let follower_nodes = NodePool::<F::Blockchain>::new(args, additional_callers)?;
|
||||
|
||||
tests.par_iter().for_each(
|
||||
|MetadataFile {
|
||||
@@ -141,13 +159,18 @@ where
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn execute_corpus(args: &Arguments, tests: &[MetadataFile], span: Span) -> anyhow::Result<()> {
|
||||
fn execute_corpus(
|
||||
args: &Arguments,
|
||||
tests: &[MetadataFile],
|
||||
additional_callers: &[Address],
|
||||
span: Span,
|
||||
) -> anyhow::Result<()> {
|
||||
match (&args.leader, &args.follower) {
|
||||
(TestingPlatform::Geth, TestingPlatform::Kitchensink) => {
|
||||
run_driver::<Geth, Kitchensink>(args, tests, span)?
|
||||
run_driver::<Geth, Kitchensink>(args, tests, additional_callers, span)?
|
||||
}
|
||||
(TestingPlatform::Geth, TestingPlatform::Geth) => {
|
||||
run_driver::<Geth, Geth>(args, tests, span)?
|
||||
run_driver::<Geth, Geth>(args, tests, additional_callers, span)?
|
||||
}
|
||||
_ => unimplemented!(),
|
||||
}
|
||||
|
||||
@@ -269,11 +269,11 @@ impl Input {
|
||||
}
|
||||
}
|
||||
|
||||
fn default_instance() -> ContractInstance {
|
||||
pub fn default_instance() -> ContractInstance {
|
||||
ContractInstance::new_from("Test")
|
||||
}
|
||||
|
||||
fn default_caller() -> Address {
|
||||
pub fn default_caller() -> Address {
|
||||
"90F8bf6A479f320ead074411a4B0e7944Ea8c9C1".parse().unwrap()
|
||||
}
|
||||
|
||||
|
||||
@@ -1,9 +1,14 @@
|
||||
use ::core::pin::Pin;
|
||||
|
||||
use alloy::{
|
||||
network::{Network, TransactionBuilder},
|
||||
consensus::SignableTransaction,
|
||||
network::{Network, TransactionBuilder, TxSigner},
|
||||
primitives::Address,
|
||||
providers::{
|
||||
Provider, SendableTx,
|
||||
fillers::{GasFiller, TxFiller},
|
||||
},
|
||||
signers::{Signature, local::PrivateKeySigner},
|
||||
transports::TransportResult,
|
||||
};
|
||||
|
||||
@@ -76,3 +81,28 @@ where
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// This is a signer that is able to sign transactions for a specific address with another private
|
||||
/// key.
|
||||
pub struct AddressSigner {
|
||||
pub private_key: PrivateKeySigner,
|
||||
pub address: Address,
|
||||
}
|
||||
|
||||
impl TxSigner<Signature> for AddressSigner {
|
||||
fn address(&self) -> Address {
|
||||
self.address
|
||||
}
|
||||
|
||||
fn sign_transaction<'a, 'b, 'c>(
|
||||
&'a self,
|
||||
tx: &'b mut dyn SignableTransaction<Signature>,
|
||||
) -> Pin<Box<dyn Future<Output = Result<Signature, alloy::signers::Error>> + Send + 'c>>
|
||||
where
|
||||
'a: 'c,
|
||||
'b: 'c,
|
||||
Self: 'c,
|
||||
{
|
||||
<PrivateKeySigner as TxSigner<Signature>>::sign_transaction(&self.private_key, tx)
|
||||
}
|
||||
}
|
||||
|
||||
+33
-7
@@ -11,6 +11,7 @@ use std::{
|
||||
|
||||
use alloy::{
|
||||
eips::BlockNumberOrTag,
|
||||
genesis::Genesis,
|
||||
network::{Ethereum, EthereumWallet},
|
||||
primitives::{Address, BlockHash, BlockNumber, BlockTimestamp, U256},
|
||||
providers::{
|
||||
@@ -22,12 +23,16 @@ use alloy::{
|
||||
TransactionReceipt, TransactionRequest,
|
||||
trace::geth::{DiffMode, GethDebugTracingOptions, PreStateConfig, PreStateFrame},
|
||||
},
|
||||
signers::local::PrivateKeySigner,
|
||||
};
|
||||
use revive_dt_config::Arguments;
|
||||
use revive_dt_node_interaction::{BlockingExecutor, EthereumNode};
|
||||
use tracing::Level;
|
||||
|
||||
use crate::{Node, common::FallbackGasFiller};
|
||||
use crate::{
|
||||
Node,
|
||||
common::{AddressSigner, FallbackGasFiller},
|
||||
};
|
||||
|
||||
static NODE_COUNT: AtomicU32 = AtomicU32::new(0);
|
||||
|
||||
@@ -50,7 +55,10 @@ pub struct Instance {
|
||||
network_id: u64,
|
||||
start_timeout: u64,
|
||||
wallet: EthereumWallet,
|
||||
private_key: PrivateKeySigner,
|
||||
nonce_manager: CachedNonceManager,
|
||||
additional_callers: Vec<Address>,
|
||||
|
||||
/// This vector stores [`File`] objects that we use for logging which we want to flush when the
|
||||
/// node object is dropped. We do not store them in a structured fashion at the moment (in
|
||||
/// separate fields) as the logic that we need to apply to them is all the same regardless of
|
||||
@@ -78,8 +86,24 @@ impl Instance {
|
||||
create_dir_all(&self.base_directory)?;
|
||||
create_dir_all(&self.logs_directory)?;
|
||||
|
||||
// Modifying the genesis file so that we get our private key to control the other accounts.
|
||||
let mut genesis = serde_json::from_str::<Genesis>(&genesis)?;
|
||||
for additional_caller in self.additional_callers.iter() {
|
||||
let account = genesis.alloc.entry(*additional_caller).or_default();
|
||||
account.private_key = Some(self.private_key.to_bytes());
|
||||
*account = account
|
||||
.clone()
|
||||
.with_balance("1000000000000000000".parse().expect("Can't fail"));
|
||||
}
|
||||
let genesis_path = self.base_directory.join(Self::GENESIS_JSON_FILE);
|
||||
File::create(&genesis_path)?.write_all(genesis.as_bytes())?;
|
||||
serde_json::to_writer(File::create(&genesis_path)?, &genesis)?;
|
||||
|
||||
for additional_caller in self.additional_callers.iter() {
|
||||
self.wallet.register_signer(AddressSigner {
|
||||
private_key: self.private_key.clone(),
|
||||
address: *additional_caller,
|
||||
});
|
||||
}
|
||||
|
||||
let mut child = Command::new(&self.geth)
|
||||
.arg("init")
|
||||
@@ -424,7 +448,7 @@ impl EthereumNode for Instance {
|
||||
}
|
||||
|
||||
impl Node for Instance {
|
||||
fn new(config: &Arguments) -> Self {
|
||||
fn new(config: &Arguments, additional_callers: &[Address]) -> Self {
|
||||
let geth_directory = config.directory().join(Self::BASE_DIRECTORY);
|
||||
let id = NODE_COUNT.fetch_add(1, Ordering::SeqCst);
|
||||
let base_directory = geth_directory.join(id.to_string());
|
||||
@@ -444,6 +468,8 @@ impl Node for Instance {
|
||||
// the vector. It's the stdout and stderr of the geth node.
|
||||
logs_file_to_flush: Vec::with_capacity(2),
|
||||
nonce_manager: Default::default(),
|
||||
additional_callers: additional_callers.to_vec(),
|
||||
private_key: config.signer(),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -520,7 +546,7 @@ mod tests {
|
||||
|
||||
fn new_node() -> (Instance, TempDir) {
|
||||
let (args, temp_dir) = test_config();
|
||||
let mut node = Instance::new(&args);
|
||||
let mut node = Instance::new(&args, &[]);
|
||||
node.init(GENESIS_JSON.to_owned())
|
||||
.expect("Failed to initialize the node")
|
||||
.spawn_process()
|
||||
@@ -530,21 +556,21 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn init_works() {
|
||||
Instance::new(&test_config().0)
|
||||
Instance::new(&test_config().0, &[])
|
||||
.init(GENESIS_JSON.to_string())
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn spawn_works() {
|
||||
Instance::new(&test_config().0)
|
||||
Instance::new(&test_config().0, &[])
|
||||
.spawn(GENESIS_JSON.to_string())
|
||||
.unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn version_works() {
|
||||
let version = Instance::new(&test_config().0).version().unwrap();
|
||||
let version = Instance::new(&test_config().0, &[]).version().unwrap();
|
||||
assert!(
|
||||
version.starts_with("geth version"),
|
||||
"expected version string, got: '{version}'"
|
||||
|
||||
@@ -507,7 +507,7 @@ impl EthereumNode for KitchensinkNode {
|
||||
}
|
||||
|
||||
impl Node for KitchensinkNode {
|
||||
fn new(config: &Arguments) -> Self {
|
||||
fn new(config: &Arguments, _additional_callers: &[Address]) -> Self {
|
||||
let kitchensink_directory = config.directory().join(Self::BASE_DIRECTORY);
|
||||
let id = NODE_COUNT.fetch_add(1, Ordering::SeqCst);
|
||||
let base_directory = kitchensink_directory.join(id.to_string());
|
||||
@@ -814,6 +814,12 @@ impl TransactionBuilder<KitchenSinkNetwork> for <Ethereum as Network>::Transacti
|
||||
> {
|
||||
Ok(wallet.sign_request(self).await?)
|
||||
}
|
||||
|
||||
fn take_nonce(&mut self) -> Option<u64> {
|
||||
<<Ethereum as Network>::TransactionRequest as TransactionBuilder<Ethereum>>::take_nonce(
|
||||
self,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, PartialEq, Eq, Hash, Serialize, Deserialize)]
|
||||
@@ -1054,7 +1060,7 @@ mod tests {
|
||||
let _guard = NODE_START_MUTEX.lock().unwrap();
|
||||
|
||||
let (args, temp_dir) = test_config();
|
||||
let mut node = KitchensinkNode::new(&args);
|
||||
let mut node = KitchensinkNode::new(&args, &[]);
|
||||
node.init(GENESIS_JSON)
|
||||
.expect("Failed to initialize the node")
|
||||
.spawn_process()
|
||||
@@ -1109,7 +1115,7 @@ mod tests {
|
||||
}
|
||||
"#;
|
||||
|
||||
let mut dummy_node = KitchensinkNode::new(&test_config().0);
|
||||
let mut dummy_node = KitchensinkNode::new(&test_config().0, &[]);
|
||||
|
||||
// Call `init()`
|
||||
dummy_node.init(genesis_content).expect("init failed");
|
||||
@@ -1153,7 +1159,7 @@ mod tests {
|
||||
}
|
||||
"#;
|
||||
|
||||
let node = KitchensinkNode::new(&test_config().0);
|
||||
let node = KitchensinkNode::new(&test_config().0, &[]);
|
||||
|
||||
let result = node
|
||||
.extract_balance_from_genesis_file(genesis_json)
|
||||
@@ -1226,7 +1232,7 @@ mod tests {
|
||||
fn spawn_works() {
|
||||
let (config, _temp_dir) = test_config();
|
||||
|
||||
let mut node = KitchensinkNode::new(&config);
|
||||
let mut node = KitchensinkNode::new(&config, &[]);
|
||||
node.spawn(GENESIS_JSON.to_string()).unwrap();
|
||||
}
|
||||
|
||||
@@ -1234,7 +1240,7 @@ mod tests {
|
||||
fn version_works() {
|
||||
let (config, _temp_dir) = test_config();
|
||||
|
||||
let node = KitchensinkNode::new(&config);
|
||||
let node = KitchensinkNode::new(&config, &[]);
|
||||
let version = node.version().unwrap();
|
||||
|
||||
assert!(
|
||||
@@ -1247,7 +1253,7 @@ mod tests {
|
||||
fn eth_rpc_version_works() {
|
||||
let (config, _temp_dir) = test_config();
|
||||
|
||||
let node = KitchensinkNode::new(&config);
|
||||
let node = KitchensinkNode::new(&config, &[]);
|
||||
let version = node.eth_rpc_version().unwrap();
|
||||
|
||||
assert!(
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
//! This crate implements the testing nodes.
|
||||
|
||||
use alloy::primitives::Address;
|
||||
use revive_dt_config::Arguments;
|
||||
use revive_dt_node_interaction::EthereumNode;
|
||||
|
||||
@@ -14,7 +15,7 @@ pub const GENESIS_JSON: &str = include_str!("../../../genesis.json");
|
||||
/// An abstract interface for testing nodes.
|
||||
pub trait Node: EthereumNode {
|
||||
/// Create a new uninitialized instance.
|
||||
fn new(config: &Arguments) -> Self;
|
||||
fn new(config: &Arguments, additional_callers: &[Address]) -> Self;
|
||||
|
||||
/// Spawns a node configured according to the genesis json.
|
||||
///
|
||||
|
||||
+12
-4
@@ -6,6 +6,7 @@ use std::{
|
||||
thread,
|
||||
};
|
||||
|
||||
use alloy::primitives::Address;
|
||||
use anyhow::Context;
|
||||
use revive_dt_config::Arguments;
|
||||
|
||||
@@ -23,7 +24,7 @@ where
|
||||
T: Node + Send + 'static,
|
||||
{
|
||||
/// Create a new Pool. This will start as many nodes as there are workers in `config`.
|
||||
pub fn new(config: &Arguments) -> anyhow::Result<Self> {
|
||||
pub fn new(config: &Arguments, additional_callers: &[Address]) -> anyhow::Result<Self> {
|
||||
let nodes = config.workers;
|
||||
let genesis = read_to_string(&config.genesis_file).context(format!(
|
||||
"can not read genesis file: {}",
|
||||
@@ -34,7 +35,10 @@ where
|
||||
for _ in 0..nodes {
|
||||
let config = config.clone();
|
||||
let genesis = genesis.clone();
|
||||
handles.push(thread::spawn(move || spawn_node::<T>(&config, genesis)));
|
||||
let additional_callers = additional_callers.to_vec();
|
||||
handles.push(thread::spawn(move || {
|
||||
spawn_node::<T>(&config, genesis, &additional_callers)
|
||||
}));
|
||||
}
|
||||
|
||||
let mut nodes = Vec::with_capacity(nodes);
|
||||
@@ -60,8 +64,12 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
fn spawn_node<T: Node + Send>(args: &Arguments, genesis: String) -> anyhow::Result<T> {
|
||||
let mut node = T::new(args);
|
||||
fn spawn_node<T: Node + Send>(
|
||||
args: &Arguments,
|
||||
genesis: String,
|
||||
additional_callers: &[Address],
|
||||
) -> anyhow::Result<T> {
|
||||
let mut node = T::new(args, additional_callers);
|
||||
tracing::info!("starting node: {}", node.connection_string());
|
||||
node.spawn(genesis)?;
|
||||
Ok(node)
|
||||
|
||||
Reference in New Issue
Block a user