mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-04-22 11:27:59 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0edfb3a36e |
@@ -27,8 +27,8 @@ use semver::Version;
|
|||||||
|
|
||||||
use revive_dt_format::case::Case;
|
use revive_dt_format::case::Case;
|
||||||
use revive_dt_format::input::{
|
use revive_dt_format::input::{
|
||||||
BalanceAssertion, Calldata, EtherValue, Expected, ExpectedOutput, Input, Method, StepIdx,
|
BalanceAssertionStep, Calldata, EtherValue, Expected, ExpectedOutput, FunctionCallStep, Method,
|
||||||
StorageEmptyAssertion,
|
StepIdx, StorageEmptyAssertionStep,
|
||||||
};
|
};
|
||||||
use revive_dt_format::metadata::{ContractIdent, ContractInstance, ContractPathAndIdent};
|
use revive_dt_format::metadata::{ContractIdent, ContractInstance, ContractPathAndIdent};
|
||||||
use revive_dt_format::{input::Step, metadata::Metadata};
|
use revive_dt_format::{input::Step, metadata::Metadata};
|
||||||
@@ -36,6 +36,7 @@ use revive_dt_node_interaction::EthereumNode;
|
|||||||
use tokio::try_join;
|
use tokio::try_join;
|
||||||
use tracing::{Instrument, info, info_span, instrument};
|
use tracing::{Instrument, info, info_span, instrument};
|
||||||
|
|
||||||
|
#[derive(Clone)]
|
||||||
pub struct CaseState {
|
pub struct CaseState {
|
||||||
/// A map of all of the compiled contracts for the given metadata file.
|
/// A map of all of the compiled contracts for the given metadata file.
|
||||||
compiled_contracts: HashMap<PathBuf, HashMap<String, (String, JsonAbi)>>,
|
compiled_contracts: HashMap<PathBuf, HashMap<String, (String, JsonAbi)>>,
|
||||||
@@ -96,6 +97,17 @@ impl CaseState {
|
|||||||
.context("Failed to handle storage empty assertion step")?;
|
.context("Failed to handle storage empty assertion step")?;
|
||||||
Ok(StepOutput::StorageEmptyAssertion)
|
Ok(StepOutput::StorageEmptyAssertion)
|
||||||
}
|
}
|
||||||
|
Step::Repeat(repetition_step) => {
|
||||||
|
self.handle_repeat(
|
||||||
|
metadata,
|
||||||
|
repetition_step.repeat,
|
||||||
|
&repetition_step.steps,
|
||||||
|
node,
|
||||||
|
)
|
||||||
|
.await
|
||||||
|
.context("Failed to handle the repetition step")?;
|
||||||
|
Ok(StepOutput::Repetition)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
.inspect(|_| info!("Step Succeeded"))
|
.inspect(|_| info!("Step Succeeded"))
|
||||||
}
|
}
|
||||||
@@ -104,7 +116,7 @@ impl CaseState {
|
|||||||
pub async fn handle_input(
|
pub async fn handle_input(
|
||||||
&mut self,
|
&mut self,
|
||||||
metadata: &Metadata,
|
metadata: &Metadata,
|
||||||
input: &Input,
|
input: &FunctionCallStep,
|
||||||
node: &dyn EthereumNode,
|
node: &dyn EthereumNode,
|
||||||
) -> anyhow::Result<(TransactionReceipt, GethTrace, DiffMode)> {
|
) -> anyhow::Result<(TransactionReceipt, GethTrace, DiffMode)> {
|
||||||
let resolver = node.resolver().await?;
|
let resolver = node.resolver().await?;
|
||||||
@@ -140,7 +152,7 @@ impl CaseState {
|
|||||||
pub async fn handle_balance_assertion(
|
pub async fn handle_balance_assertion(
|
||||||
&mut self,
|
&mut self,
|
||||||
metadata: &Metadata,
|
metadata: &Metadata,
|
||||||
balance_assertion: &BalanceAssertion,
|
balance_assertion: &BalanceAssertionStep,
|
||||||
node: &dyn EthereumNode,
|
node: &dyn EthereumNode,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
self.handle_balance_assertion_contract_deployment(metadata, balance_assertion, node)
|
self.handle_balance_assertion_contract_deployment(metadata, balance_assertion, node)
|
||||||
@@ -156,7 +168,7 @@ impl CaseState {
|
|||||||
pub async fn handle_storage_empty(
|
pub async fn handle_storage_empty(
|
||||||
&mut self,
|
&mut self,
|
||||||
metadata: &Metadata,
|
metadata: &Metadata,
|
||||||
storage_empty: &StorageEmptyAssertion,
|
storage_empty: &StorageEmptyAssertionStep,
|
||||||
node: &dyn EthereumNode,
|
node: &dyn EthereumNode,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
self.handle_storage_empty_assertion_contract_deployment(metadata, storage_empty, node)
|
self.handle_storage_empty_assertion_contract_deployment(metadata, storage_empty, node)
|
||||||
@@ -168,12 +180,33 @@ impl CaseState {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[instrument(level = "info", name = "Handling Repetition", skip_all)]
|
||||||
|
pub async fn handle_repeat(
|
||||||
|
&mut self,
|
||||||
|
metadata: &Metadata,
|
||||||
|
repetitions: usize,
|
||||||
|
steps: &[Step],
|
||||||
|
node: &dyn EthereumNode,
|
||||||
|
) -> anyhow::Result<()> {
|
||||||
|
let tasks = (0..repetitions).map(|_| {
|
||||||
|
let mut state = self.clone();
|
||||||
|
async move {
|
||||||
|
for step in steps {
|
||||||
|
state.handle_step(metadata, step, node).await?;
|
||||||
|
}
|
||||||
|
Ok::<(), anyhow::Error>(())
|
||||||
|
}
|
||||||
|
});
|
||||||
|
try_join_all(tasks).await?;
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
/// Handles the contract deployment for a given input performing it if it needs to be performed.
|
/// Handles the contract deployment for a given input performing it if it needs to be performed.
|
||||||
#[instrument(level = "info", skip_all)]
|
#[instrument(level = "info", skip_all)]
|
||||||
async fn handle_input_contract_deployment(
|
async fn handle_input_contract_deployment(
|
||||||
&mut self,
|
&mut self,
|
||||||
metadata: &Metadata,
|
metadata: &Metadata,
|
||||||
input: &Input,
|
input: &FunctionCallStep,
|
||||||
node: &dyn EthereumNode,
|
node: &dyn EthereumNode,
|
||||||
) -> anyhow::Result<HashMap<ContractInstance, TransactionReceipt>> {
|
) -> anyhow::Result<HashMap<ContractInstance, TransactionReceipt>> {
|
||||||
let mut instances_we_must_deploy = IndexMap::<ContractInstance, bool>::new();
|
let mut instances_we_must_deploy = IndexMap::<ContractInstance, bool>::new();
|
||||||
@@ -217,7 +250,7 @@ impl CaseState {
|
|||||||
#[instrument(level = "info", skip_all)]
|
#[instrument(level = "info", skip_all)]
|
||||||
async fn handle_input_execution(
|
async fn handle_input_execution(
|
||||||
&mut self,
|
&mut self,
|
||||||
input: &Input,
|
input: &FunctionCallStep,
|
||||||
mut deployment_receipts: HashMap<ContractInstance, TransactionReceipt>,
|
mut deployment_receipts: HashMap<ContractInstance, TransactionReceipt>,
|
||||||
node: &dyn EthereumNode,
|
node: &dyn EthereumNode,
|
||||||
) -> anyhow::Result<TransactionReceipt> {
|
) -> anyhow::Result<TransactionReceipt> {
|
||||||
@@ -281,7 +314,7 @@ impl CaseState {
|
|||||||
#[instrument(level = "info", skip_all)]
|
#[instrument(level = "info", skip_all)]
|
||||||
fn handle_input_variable_assignment(
|
fn handle_input_variable_assignment(
|
||||||
&mut self,
|
&mut self,
|
||||||
input: &Input,
|
input: &FunctionCallStep,
|
||||||
tracing_result: &CallFrame,
|
tracing_result: &CallFrame,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let Some(ref assignments) = input.variable_assignments else {
|
let Some(ref assignments) = input.variable_assignments else {
|
||||||
@@ -312,26 +345,26 @@ impl CaseState {
|
|||||||
#[instrument(level = "info", skip_all)]
|
#[instrument(level = "info", skip_all)]
|
||||||
async fn handle_input_expectations(
|
async fn handle_input_expectations(
|
||||||
&self,
|
&self,
|
||||||
input: &Input,
|
input: &FunctionCallStep,
|
||||||
execution_receipt: &TransactionReceipt,
|
execution_receipt: &TransactionReceipt,
|
||||||
resolver: &(impl ResolverApi + ?Sized),
|
resolver: &(impl ResolverApi + ?Sized),
|
||||||
tracing_result: &CallFrame,
|
tracing_result: &CallFrame,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
// Resolving the `input.expected` into a series of expectations that we can then assert on.
|
// Resolving the `input.expected` into a series of expectations that we can then assert on.
|
||||||
let mut expectations = match input {
|
let mut expectations = match input {
|
||||||
Input {
|
FunctionCallStep {
|
||||||
expected: Some(Expected::Calldata(calldata)),
|
expected: Some(Expected::Calldata(calldata)),
|
||||||
..
|
..
|
||||||
} => vec![ExpectedOutput::new().with_calldata(calldata.clone())],
|
} => vec![ExpectedOutput::new().with_calldata(calldata.clone())],
|
||||||
Input {
|
FunctionCallStep {
|
||||||
expected: Some(Expected::Expected(expected)),
|
expected: Some(Expected::Expected(expected)),
|
||||||
..
|
..
|
||||||
} => vec![expected.clone()],
|
} => vec![expected.clone()],
|
||||||
Input {
|
FunctionCallStep {
|
||||||
expected: Some(Expected::ExpectedMany(expected)),
|
expected: Some(Expected::ExpectedMany(expected)),
|
||||||
..
|
..
|
||||||
} => expected.clone(),
|
} => expected.clone(),
|
||||||
Input { expected: None, .. } => vec![ExpectedOutput::new().with_success()],
|
FunctionCallStep { expected: None, .. } => vec![ExpectedOutput::new().with_success()],
|
||||||
};
|
};
|
||||||
|
|
||||||
// This is a bit of a special case and we have to support it separately on it's own. If it's
|
// This is a bit of a special case and we have to support it separately on it's own. If it's
|
||||||
@@ -532,7 +565,7 @@ impl CaseState {
|
|||||||
pub async fn handle_balance_assertion_contract_deployment(
|
pub async fn handle_balance_assertion_contract_deployment(
|
||||||
&mut self,
|
&mut self,
|
||||||
metadata: &Metadata,
|
metadata: &Metadata,
|
||||||
balance_assertion: &BalanceAssertion,
|
balance_assertion: &BalanceAssertionStep,
|
||||||
node: &dyn EthereumNode,
|
node: &dyn EthereumNode,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let Some(instance) = balance_assertion
|
let Some(instance) = balance_assertion
|
||||||
@@ -545,7 +578,7 @@ impl CaseState {
|
|||||||
self.get_or_deploy_contract_instance(
|
self.get_or_deploy_contract_instance(
|
||||||
&instance,
|
&instance,
|
||||||
metadata,
|
metadata,
|
||||||
Input::default_caller(),
|
FunctionCallStep::default_caller(),
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
node,
|
node,
|
||||||
@@ -557,11 +590,11 @@ impl CaseState {
|
|||||||
#[instrument(level = "info", skip_all)]
|
#[instrument(level = "info", skip_all)]
|
||||||
pub async fn handle_balance_assertion_execution(
|
pub async fn handle_balance_assertion_execution(
|
||||||
&mut self,
|
&mut self,
|
||||||
BalanceAssertion {
|
BalanceAssertionStep {
|
||||||
address: address_string,
|
address: address_string,
|
||||||
expected_balance: amount,
|
expected_balance: amount,
|
||||||
..
|
..
|
||||||
}: &BalanceAssertion,
|
}: &BalanceAssertionStep,
|
||||||
node: &dyn EthereumNode,
|
node: &dyn EthereumNode,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let resolver = node.resolver().await?;
|
let resolver = node.resolver().await?;
|
||||||
@@ -595,7 +628,7 @@ impl CaseState {
|
|||||||
pub async fn handle_storage_empty_assertion_contract_deployment(
|
pub async fn handle_storage_empty_assertion_contract_deployment(
|
||||||
&mut self,
|
&mut self,
|
||||||
metadata: &Metadata,
|
metadata: &Metadata,
|
||||||
storage_empty_assertion: &StorageEmptyAssertion,
|
storage_empty_assertion: &StorageEmptyAssertionStep,
|
||||||
node: &dyn EthereumNode,
|
node: &dyn EthereumNode,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let Some(instance) = storage_empty_assertion
|
let Some(instance) = storage_empty_assertion
|
||||||
@@ -608,7 +641,7 @@ impl CaseState {
|
|||||||
self.get_or_deploy_contract_instance(
|
self.get_or_deploy_contract_instance(
|
||||||
&instance,
|
&instance,
|
||||||
metadata,
|
metadata,
|
||||||
Input::default_caller(),
|
FunctionCallStep::default_caller(),
|
||||||
None,
|
None,
|
||||||
None,
|
None,
|
||||||
node,
|
node,
|
||||||
@@ -620,11 +653,11 @@ impl CaseState {
|
|||||||
#[instrument(level = "info", skip_all)]
|
#[instrument(level = "info", skip_all)]
|
||||||
pub async fn handle_storage_empty_assertion_execution(
|
pub async fn handle_storage_empty_assertion_execution(
|
||||||
&mut self,
|
&mut self,
|
||||||
StorageEmptyAssertion {
|
StorageEmptyAssertionStep {
|
||||||
address: address_string,
|
address: address_string,
|
||||||
is_storage_empty,
|
is_storage_empty,
|
||||||
..
|
..
|
||||||
}: &StorageEmptyAssertion,
|
}: &StorageEmptyAssertionStep,
|
||||||
node: &dyn EthereumNode,
|
node: &dyn EthereumNode,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let resolver = node.resolver().await?;
|
let resolver = node.resolver().await?;
|
||||||
@@ -841,4 +874,5 @@ pub enum StepOutput {
|
|||||||
FunctionCall(TransactionReceipt, GethTrace, DiffMode),
|
FunctionCall(TransactionReceipt, GethTrace, DiffMode),
|
||||||
BalanceAssertion,
|
BalanceAssertion,
|
||||||
StorageEmptyAssertion,
|
StorageEmptyAssertion,
|
||||||
|
Repetition,
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ use revive_dt_core::{
|
|||||||
use revive_dt_format::{
|
use revive_dt_format::{
|
||||||
case::{Case, CaseIdx},
|
case::{Case, CaseIdx},
|
||||||
corpus::Corpus,
|
corpus::Corpus,
|
||||||
input::{Input, Step},
|
input::{FunctionCallStep, Step},
|
||||||
metadata::{ContractPathAndIdent, Metadata, MetadataFile},
|
metadata::{ContractPathAndIdent, Metadata, MetadataFile},
|
||||||
mode::ParsedMode,
|
mode::ParsedMode,
|
||||||
};
|
};
|
||||||
@@ -514,9 +514,10 @@ async fn handle_case_driver<'a>(
|
|||||||
Step::FunctionCall(input) => Some(input.caller),
|
Step::FunctionCall(input) => Some(input.caller),
|
||||||
Step::BalanceAssertion(..) => None,
|
Step::BalanceAssertion(..) => None,
|
||||||
Step::StorageEmptyAssertion(..) => None,
|
Step::StorageEmptyAssertion(..) => None,
|
||||||
|
Step::Repeat(..) => None,
|
||||||
})
|
})
|
||||||
.next()
|
.next()
|
||||||
.unwrap_or(Input::default_caller());
|
.unwrap_or(FunctionCallStep::default_caller());
|
||||||
let tx = TransactionBuilder::<Ethereum>::with_deploy_code(
|
let tx = TransactionBuilder::<Ethereum>::with_deploy_code(
|
||||||
TransactionRequest::default().from(deployer_address),
|
TransactionRequest::default().from(deployer_address),
|
||||||
code,
|
code,
|
||||||
|
|||||||
+27
-12
@@ -28,11 +28,13 @@ use crate::{metadata::ContractInstance, traits::ResolutionContext};
|
|||||||
#[serde(untagged)]
|
#[serde(untagged)]
|
||||||
pub enum Step {
|
pub enum Step {
|
||||||
/// A function call or an invocation to some function on some smart contract.
|
/// A function call or an invocation to some function on some smart contract.
|
||||||
FunctionCall(Box<Input>),
|
FunctionCall(Box<FunctionCallStep>),
|
||||||
/// A step for performing a balance assertion on some account or contract.
|
/// A step for performing a balance assertion on some account or contract.
|
||||||
BalanceAssertion(Box<BalanceAssertion>),
|
BalanceAssertion(Box<BalanceAssertionStep>),
|
||||||
/// A step for asserting that the storage of some contract or account is empty.
|
/// A step for asserting that the storage of some contract or account is empty.
|
||||||
StorageEmptyAssertion(Box<StorageEmptyAssertion>),
|
StorageEmptyAssertion(Box<StorageEmptyAssertionStep>),
|
||||||
|
/// A special step for repeating a bunch of steps a certain number of times.
|
||||||
|
Repeat(Box<RepeatStep>),
|
||||||
}
|
}
|
||||||
|
|
||||||
define_wrapper_type!(
|
define_wrapper_type!(
|
||||||
@@ -43,9 +45,9 @@ define_wrapper_type!(
|
|||||||
/// This is an input step which is a transaction description that the framework translates into a
|
/// This is an input step which is a transaction description that the framework translates into a
|
||||||
/// transaction and executes on the nodes.
|
/// transaction and executes on the nodes.
|
||||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, Eq, PartialEq, JsonSchema)]
|
#[derive(Clone, Debug, Default, Serialize, Deserialize, Eq, PartialEq, JsonSchema)]
|
||||||
pub struct Input {
|
pub struct FunctionCallStep {
|
||||||
/// The address of the account performing the call and paying the fees for it.
|
/// The address of the account performing the call and paying the fees for it.
|
||||||
#[serde(default = "Input::default_caller")]
|
#[serde(default = "FunctionCallStep::default_caller")]
|
||||||
#[schemars(with = "String")]
|
#[schemars(with = "String")]
|
||||||
pub caller: Address,
|
pub caller: Address,
|
||||||
|
|
||||||
@@ -54,7 +56,7 @@ pub struct Input {
|
|||||||
pub comment: Option<String>,
|
pub comment: Option<String>,
|
||||||
|
|
||||||
/// The contract instance that's being called in this transaction step.
|
/// The contract instance that's being called in this transaction step.
|
||||||
#[serde(default = "Input::default_instance")]
|
#[serde(default = "FunctionCallStep::default_instance")]
|
||||||
pub instance: ContractInstance,
|
pub instance: ContractInstance,
|
||||||
|
|
||||||
/// The method that's being called in this step.
|
/// The method that's being called in this step.
|
||||||
@@ -85,7 +87,7 @@ pub struct Input {
|
|||||||
/// This represents a balance assertion step where the framework needs to query the balance of some
|
/// This represents a balance assertion step where the framework needs to query the balance of some
|
||||||
/// account or contract and assert that it's some amount.
|
/// account or contract and assert that it's some amount.
|
||||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, Eq, PartialEq, JsonSchema)]
|
#[derive(Clone, Debug, Default, Serialize, Deserialize, Eq, PartialEq, JsonSchema)]
|
||||||
pub struct BalanceAssertion {
|
pub struct BalanceAssertionStep {
|
||||||
/// An optional comment on the balance assertion.
|
/// An optional comment on the balance assertion.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub comment: Option<String>,
|
pub comment: Option<String>,
|
||||||
@@ -104,8 +106,10 @@ pub struct BalanceAssertion {
|
|||||||
pub expected_balance: U256,
|
pub expected_balance: U256,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// This represents an assertion for the storage of some contract or account and whether it's empty
|
||||||
|
/// or not.
|
||||||
#[derive(Clone, Debug, Default, Serialize, Deserialize, Eq, PartialEq, JsonSchema)]
|
#[derive(Clone, Debug, Default, Serialize, Deserialize, Eq, PartialEq, JsonSchema)]
|
||||||
pub struct StorageEmptyAssertion {
|
pub struct StorageEmptyAssertionStep {
|
||||||
/// An optional comment on the storage empty assertion.
|
/// An optional comment on the storage empty assertion.
|
||||||
#[serde(skip_serializing_if = "Option::is_none")]
|
#[serde(skip_serializing_if = "Option::is_none")]
|
||||||
pub comment: Option<String>,
|
pub comment: Option<String>,
|
||||||
@@ -122,6 +126,17 @@ pub struct StorageEmptyAssertion {
|
|||||||
pub is_storage_empty: bool,
|
pub is_storage_empty: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// This represents a repetition step which is a special step type that allows for a sequence of
|
||||||
|
/// steps to be repeated (on different drivers) a certain number of times.
|
||||||
|
#[derive(Clone, Debug, Default, Serialize, Deserialize, Eq, PartialEq, JsonSchema)]
|
||||||
|
pub struct RepeatStep {
|
||||||
|
/// The number of repetitions that the steps should be repeated for.
|
||||||
|
pub repeat: usize,
|
||||||
|
|
||||||
|
/// The sequence of steps to repeat for the above defined number of repetitions.
|
||||||
|
pub steps: Vec<Step>,
|
||||||
|
}
|
||||||
|
|
||||||
/// A set of expectations and assertions to make about the transaction after it ran.
|
/// A set of expectations and assertions to make about the transaction after it ran.
|
||||||
///
|
///
|
||||||
/// If this is not specified then the only assertion that will be ran is that the transaction
|
/// If this is not specified then the only assertion that will be ran is that the transaction
|
||||||
@@ -295,7 +310,7 @@ pub struct VariableAssignments {
|
|||||||
pub return_data: Vec<String>,
|
pub return_data: Vec<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Input {
|
impl FunctionCallStep {
|
||||||
pub const fn default_caller() -> Address {
|
pub const fn default_caller() -> Address {
|
||||||
Address(FixedBytes(alloy::hex!(
|
Address(FixedBytes(alloy::hex!(
|
||||||
"0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1"
|
"0x90F8bf6A479f320ead074411a4B0e7944Ea8c9C1"
|
||||||
@@ -890,7 +905,7 @@ mod tests {
|
|||||||
.selector()
|
.selector()
|
||||||
.0;
|
.0;
|
||||||
|
|
||||||
let input = Input {
|
let input = FunctionCallStep {
|
||||||
instance: ContractInstance::new("Contract"),
|
instance: ContractInstance::new("Contract"),
|
||||||
method: Method::FunctionName("store".to_owned()),
|
method: Method::FunctionName("store".to_owned()),
|
||||||
calldata: Calldata::new_compound(["42"]),
|
calldata: Calldata::new_compound(["42"]),
|
||||||
@@ -934,7 +949,7 @@ mod tests {
|
|||||||
.selector()
|
.selector()
|
||||||
.0;
|
.0;
|
||||||
|
|
||||||
let input: Input = Input {
|
let input: FunctionCallStep = FunctionCallStep {
|
||||||
instance: "Contract".to_owned().into(),
|
instance: "Contract".to_owned().into(),
|
||||||
method: Method::FunctionName("send(address)".to_owned()),
|
method: Method::FunctionName("send(address)".to_owned()),
|
||||||
calldata: Calldata::new_compound(["0x1000000000000000000000000000000000000001"]),
|
calldata: Calldata::new_compound(["0x1000000000000000000000000000000000000001"]),
|
||||||
@@ -981,7 +996,7 @@ mod tests {
|
|||||||
.selector()
|
.selector()
|
||||||
.0;
|
.0;
|
||||||
|
|
||||||
let input: Input = Input {
|
let input: FunctionCallStep = FunctionCallStep {
|
||||||
instance: ContractInstance::new("Contract"),
|
instance: ContractInstance::new("Contract"),
|
||||||
method: Method::FunctionName("send".to_owned()),
|
method: Method::FunctionName("send".to_owned()),
|
||||||
calldata: Calldata::new_compound(["0x1000000000000000000000000000000000000001"]),
|
calldata: Calldata::new_compound(["0x1000000000000000000000000000000000000001"]),
|
||||||
|
|||||||
@@ -95,7 +95,6 @@ RUST_LOG="info" cargo run --release -- execute-tests \
|
|||||||
--corpus "$CORPUS_FILE" \
|
--corpus "$CORPUS_FILE" \
|
||||||
--working-directory "$WORKDIR" \
|
--working-directory "$WORKDIR" \
|
||||||
--concurrency.number-of-nodes 5 \
|
--concurrency.number-of-nodes 5 \
|
||||||
--concurrency.ignore-concurrency-limit \
|
|
||||||
--kitchensink.path "$SUBSTRATE_NODE_BIN" \
|
--kitchensink.path "$SUBSTRATE_NODE_BIN" \
|
||||||
--revive-dev-node.path "$REVIVE_DEV_NODE_BIN" \
|
--revive-dev-node.path "$REVIVE_DEV_NODE_BIN" \
|
||||||
--eth-rpc.path "$ETH_RPC_BIN" \
|
--eth-rpc.path "$ETH_RPC_BIN" \
|
||||||
|
|||||||
+55
-7
@@ -25,7 +25,7 @@
|
|||||||
"null"
|
"null"
|
||||||
],
|
],
|
||||||
"items": {
|
"items": {
|
||||||
"type": "string"
|
"$ref": "#/$defs/VmIdentifier"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cases": {
|
"cases": {
|
||||||
@@ -95,6 +95,26 @@
|
|||||||
"cases"
|
"cases"
|
||||||
],
|
],
|
||||||
"$defs": {
|
"$defs": {
|
||||||
|
"VmIdentifier": {
|
||||||
|
"description": "An enum representing the identifiers of the supported VMs.",
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"description": "The ethereum virtual machine.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "evm"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "The EraVM virtual machine.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "eravm"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "Polkadot's PolaVM Risc-v based virtual machine.",
|
||||||
|
"type": "string",
|
||||||
|
"const": "polkavm"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"Case": {
|
"Case": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -168,19 +188,23 @@
|
|||||||
"anyOf": [
|
"anyOf": [
|
||||||
{
|
{
|
||||||
"description": "A function call or an invocation to some function on some smart contract.",
|
"description": "A function call or an invocation to some function on some smart contract.",
|
||||||
"$ref": "#/$defs/Input"
|
"$ref": "#/$defs/FunctionCallStep"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "A step for performing a balance assertion on some account or contract.",
|
"description": "A step for performing a balance assertion on some account or contract.",
|
||||||
"$ref": "#/$defs/BalanceAssertion"
|
"$ref": "#/$defs/BalanceAssertionStep"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"description": "A step for asserting that the storage of some contract or account is empty.",
|
"description": "A step for asserting that the storage of some contract or account is empty.",
|
||||||
"$ref": "#/$defs/StorageEmptyAssertion"
|
"$ref": "#/$defs/StorageEmptyAssertionStep"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"description": "A special step for repeating a bunch of steps a certain number of times.",
|
||||||
|
"$ref": "#/$defs/RepeatStep"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"Input": {
|
"FunctionCallStep": {
|
||||||
"description": "This is an input step which is a transaction description that the framework translates into a\ntransaction and executes on the nodes.",
|
"description": "This is an input step which is a transaction description that the framework translates into a\ntransaction and executes on the nodes.",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -394,7 +418,7 @@
|
|||||||
"return_data"
|
"return_data"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"BalanceAssertion": {
|
"BalanceAssertionStep": {
|
||||||
"description": "This represents a balance assertion step where the framework needs to query the balance of some\naccount or contract and assert that it's some amount.",
|
"description": "This represents a balance assertion step where the framework needs to query the balance of some\naccount or contract and assert that it's some amount.",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
@@ -419,7 +443,8 @@
|
|||||||
"expected_balance"
|
"expected_balance"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"StorageEmptyAssertion": {
|
"StorageEmptyAssertionStep": {
|
||||||
|
"description": "This represents an assertion for the storage of some contract or account and whether it's empty\nor not.",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"comment": {
|
"comment": {
|
||||||
@@ -443,6 +468,29 @@
|
|||||||
"is_storage_empty"
|
"is_storage_empty"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
"RepeatStep": {
|
||||||
|
"description": "This represents a repetition step which is a special step type that allows for a sequence of\nsteps to be repeated (on different drivers) a certain number of times.",
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"repeat": {
|
||||||
|
"description": "The number of repetitions that the steps should be repeated for.",
|
||||||
|
"type": "integer",
|
||||||
|
"format": "uint",
|
||||||
|
"minimum": 0
|
||||||
|
},
|
||||||
|
"steps": {
|
||||||
|
"description": "The sequence of steps to repeat for the above defined number of repetitions.",
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"$ref": "#/$defs/Step"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": [
|
||||||
|
"repeat",
|
||||||
|
"steps"
|
||||||
|
]
|
||||||
|
},
|
||||||
"ContractPathAndIdent": {
|
"ContractPathAndIdent": {
|
||||||
"description": "Represents an identifier used for contracts.\n\nThe type supports serialization from and into the following string format:\n\n```text\n${path}:${contract_ident}\n```",
|
"description": "Represents an identifier used for contracts.\n\nThe type supports serialization from and into the following string format:\n\n```text\n${path}:${contract_ident}\n```",
|
||||||
"type": "string"
|
"type": "string"
|
||||||
|
|||||||
Reference in New Issue
Block a user