Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ jobs:

clippy:
runs-on: ubuntu-latest
timeout-minutes: 30
timeout-minutes: 60
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@clippy
Expand Down
47 changes: 39 additions & 8 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion crates/cast/src/rlp_converter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use std::fmt;
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Item {
Data(Vec<u8>),
Array(Vec<Item>),
Array(Vec<Self>),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why are this change needed, they don't seem related to the PR

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is reported by clippy

}

impl Encodable for Item {
Expand Down
12 changes: 6 additions & 6 deletions crates/chisel/src/executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -542,22 +542,22 @@ enum Type {
Builtin(DynSolType),

/// (type)
Array(Box<Type>),
Array(Box<Self>),

/// (type, length)
FixedArray(Box<Type>, usize),
FixedArray(Box<Self>, usize),

/// (type, index)
ArrayIndex(Box<Type>, Option<usize>),
ArrayIndex(Box<Self>, Option<usize>),

/// (types)
Tuple(Vec<Option<Type>>),
Tuple(Vec<Option<Self>>),

/// (name, params, returns)
Function(Box<Type>, Vec<Option<Type>>, Vec<Option<Type>>),
Function(Box<Self>, Vec<Option<Self>>, Vec<Option<Self>>),

/// (lhs, rhs)
Access(Box<Type>, String),
Access(Box<Self>, String),

/// (types)
Custom(Vec<String>),
Expand Down
14 changes: 7 additions & 7 deletions crates/cli/src/opts/build/revive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ pub struct ResolcOpts {
)]
pub resolc_compile: Option<bool>,

/// Enable PVM mode at startup (independent of compilation)
/// Use pallet-revive runtime backend
#[arg(
long = "resolc-startup",
help = "Enable PVM mode at startup",
value_name = "RESOLC_STARTUP",
long = "polkadot",
help = "Use pallet-revive runtime backend",
value_name = "POLKADOT",
action = clap::ArgAction::SetTrue
)]
pub resolc_startup: Option<bool>,
pub polkadot: Option<bool>,

/// Specify the resolc version, or a path to a local resolc, to build with.
///
Expand Down Expand Up @@ -88,8 +88,8 @@ impl ResolcOpts {
resolc.resolc_compile
);
set_if_some!(
self.resolc_startup.and_then(|v| if v { Some(true) } else { None }),
resolc.resolc_startup
self.polkadot.and_then(|v| if v { Some(true) } else { None }),
resolc.polkadot
);
set_if_some!(
self.use_resolc.as_ref().map(|v| SolcReq::from(v.trim_start_matches("resolc:"))),
Expand Down
29 changes: 22 additions & 7 deletions crates/cli/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,28 @@ pub fn get_provider_builder(config: &Config) -> Result<ProviderBuilder> {

/// Return an [ExecutorStrategy] via the config.
pub fn get_executor_strategy(config: &Config) -> ExecutorStrategy {
// TODO: using resolc compiler: `[FAIL: EvmError: StackUnderflow] constructor() (gas: 0)`
if config.resolc.resolc_compile {
info!("using revive strategy");
use revive_strategy::ReviveExecutorStrategyBuilder;
ExecutorStrategy::new_revive(config.resolc.resolc_startup)
} else {
ExecutorStrategy::new_evm()
use revive_strategy::{ReviveExecutorStrategyBuilder, ReviveRuntimeMode};

let polkadot = config.resolc.polkadot;
let resolc = config.resolc.resolc_compile;

match (resolc, polkadot) {
// (default) - Standard Foundry EVM test
(false, false) => {
info!("using standard EVM strategy");
ExecutorStrategy::new_evm()
}
// --resolc - Run PolkaVM backend on pallet-revive (PVM)
// --resolc --polkadot - Run PolkaVM backend on pallet-revive (PVM)
(true, false) | (true, true) => {
info!("using revive strategy with PVM backend");
ExecutorStrategy::new_revive(ReviveRuntimeMode::Pvm)
}
// --polkadot (without resolc) - Run EVM backend on pallet-revive
(false, true) => {
info!("using revive strategy with EVM backend on pallet-revive");
ExecutorStrategy::new_revive(ReviveRuntimeMode::Evm)
}
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/config/src/revive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ pub struct ResolcConfig {
/// Enable compilation using resolc
pub resolc_compile: bool,

/// Enable PVM mode at startup (independent of compilation)
pub resolc_startup: bool,
/// Use pallet-revive runtime backend
pub polkadot: bool,

/// The resolc compiler
pub resolc: Option<SolcReq>,
Expand Down
1 change: 1 addition & 0 deletions crates/forge/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ serial_test.workspace = true
mockall = "0.13"
globset = "0.4"
paste = "1.0"
rstest = "0.24"
similar-asserts.workspace = true
svm = { package = "svm-rs", version = "0.5", default-features = false, features = [
"rustls",
Expand Down
2 changes: 1 addition & 1 deletion crates/forge/src/runner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,7 @@ impl<'a> ContractRunner<'a> {
f()
}
};
let backend = if self.config.resolc.resolc_compile {
let backend = if self.config.resolc.resolc_compile || self.config.resolc.polkadot {
Some(revive_strategy::Backend::get())
} else {
None
Expand Down
4 changes: 2 additions & 2 deletions crates/forge/tests/cli/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1065,7 +1065,7 @@ path = "out"

[profile.default.resolc]
resolc_compile = false
resolc_startup = false
polkadot = false

[fmt]
line_length = 120
Expand Down Expand Up @@ -1345,7 +1345,7 @@ exclude = []
"script_execution_protection": true,
"resolc": {
"resolc_compile": false,
"resolc_startup": false,
"polkadot": false,
"resolc": null,
"optimizer_mode": null,
"heap_size": null,
Expand Down
Loading
Loading