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
669 changes: 575 additions & 94 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -928,7 +928,7 @@ node-rpc = { path = "substrate/bin/node/rpc" }
node-testing = { path = "substrate/bin/node/testing" }
nohash-hasher = { version = "0.2.0" }
novelpoly = { version = "2.0.0", package = "reed-solomon-novelpoly" }
num-bigint = { version = "0.4.3", default-features = false }
num-bigint = { version = "0.4.6", default-features = false }
num-format = { version = "0.4.3" }
num-integer = { version = "0.1.46", default-features = false }
num-rational = { version = "0.4.1" }
Expand Down Expand Up @@ -1190,6 +1190,7 @@ regex = { version = "1.10.2" }
relay-substrate-client = { path = "bridges/relays/client-substrate" }
relay-utils = { path = "bridges/relays/utils" }
remote-externalities = { path = "substrate/utils/frame/remote-externalities", default-features = false, package = "frame-remote-externalities" }
revm = { version = "27.0.2", default-features = false }
ripemd = { version = "0.1.3", default-features = false }
rlp = { version = "0.6.1", default-features = false }
rococo-emulated-chain = { path = "cumulus/parachains/integration-tests/emulated/chains/relays/rococo" }
Expand Down
25 changes: 13 additions & 12 deletions cumulus/parachains/runtimes/assets/asset-hub-westend/tests/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,16 @@ const ALICE: [u8; 32] = [1u8; 32];
const BOB: [u8; 32] = [2u8; 32];
const SOME_ASSET_ADMIN: [u8; 32] = [5u8; 32];

const ERC20_PVM: &[u8] =
include_bytes!("../../../../../../substrate/frame/revive/fixtures/erc20/erc20.polkavm");

const FAKE_ERC20_PVM: &[u8] =
include_bytes!("../../../../../../substrate/frame/revive/fixtures/erc20/fake_erc20.polkavm");

const EXPENSIVE_ERC20_PVM: &[u8] = include_bytes!(
"../../../../../../substrate/frame/revive/fixtures/erc20/expensive_erc20.polkavm"
);

parameter_types! {
pub Governance: GovernanceOrigin<RuntimeOrigin> = GovernanceOrigin::Origin(RuntimeOrigin::root());
}
Expand Down Expand Up @@ -1670,10 +1680,7 @@ fn withdraw_and_deposit_erc20s() {
assert_ok!(Revive::map_account(RuntimeOrigin::signed(sender.clone())));
assert_ok!(Revive::map_account(RuntimeOrigin::signed(beneficiary.clone())));

let code = include_bytes!(
"../../../../../../substrate/frame/revive/fixtures/contracts/erc20.polkavm"
)
.to_vec();
let code = ERC20_PVM.to_vec();

let initial_amount_u256 = U256::from(1_000_000_000_000u128);
let constructor_data = sol_data::Uint::<256>::abi_encode(&initial_amount_u256);
Expand Down Expand Up @@ -1832,10 +1839,7 @@ fn smart_contract_does_not_return_bool_fails() {
assert_ok!(Revive::map_account(RuntimeOrigin::signed(beneficiary.clone())));

// This contract implements the ERC20 interface for `transfer` except it returns a uint256.
let code = include_bytes!(
"../../../../../../substrate/frame/revive/fixtures/contracts/fake_erc20.polkavm"
)
.to_vec();
let code = FAKE_ERC20_PVM.to_vec();

let initial_amount_u256 = U256::from(1_000_000_000_000u128);
let constructor_data = sol_data::Uint::<256>::abi_encode(&initial_amount_u256);
Expand Down Expand Up @@ -1888,10 +1892,7 @@ fn expensive_erc20_runs_out_of_gas() {
assert_ok!(Revive::map_account(RuntimeOrigin::signed(beneficiary.clone())));

// This contract does a lot more storage writes in `transfer`.
let code = include_bytes!(
"../../../../../../substrate/frame/revive/fixtures/contracts/expensive_erc20.polkavm"
)
.to_vec();
let code = EXPENSIVE_ERC20_PVM.to_vec();

let initial_amount_u256 = U256::from(1_000_000_000_000u128);
let constructor_data = sol_data::Uint::<256>::abi_encode(&initial_amount_u256);
Expand Down
13 changes: 13 additions & 0 deletions prdoc/pr_9501.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
title: '[revive] revm move existing files'
doc:
- audience: Runtime Dev
description: |-
- Move exisiting files in pallet-revive to accomodate the upcoming EVM backend
- Add solc/resolc compilation feature for fixtures
crates:
- name: asset-hub-westend-runtime
bump: patch
- name: pallet-revive
bump: patch
- name: pallet-revive-fixtures
bump: patch
2 changes: 2 additions & 0 deletions substrate/frame/revive/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ polkavm = { version = "0.27.0", default-features = false }
polkavm-common = { version = "0.27.0", default-features = false, features = ["alloc"] }
rand = { workspace = true, optional = true }
rand_pcg = { workspace = true, optional = true }
revm = { workspace = true }
rlp = { workspace = true }
scale-info = { features = ["derive"], workspace = true }
serde = { features = ["alloc", "derive"], workspace = true, default-features = false }
Expand Down Expand Up @@ -98,6 +99,7 @@ std = [
"polkavm-common/std",
"polkavm/std",
"rand?/std",
"revm/std",
"ripemd/std",
"rlp/std",
"scale-info/std",
Expand Down
12 changes: 11 additions & 1 deletion substrate/frame/revive/fixtures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,28 @@ exclude-from-umbrella = true
workspace = true

[dependencies]
alloy-core = { workspace = true, default-features = true, features = ["sol-types"], optional = true }
anyhow = { workspace = true, default-features = true, optional = true }
sp-core = { workspace = true, default-features = true, optional = true }
sp-io = { workspace = true, default-features = true, optional = true }

[build-dependencies]
anyhow = { workspace = true, default-features = true }
cargo_metadata = { workspace = true }
hex = { workspace = true, features = ["alloc"] }
pallet-revive-uapi = { workspace = true }
polkavm-linker = { version = "0.27.0" }
serde_json = { workspace = true }
toml = { workspace = true }

[features]
default = ["std"]
# only when std is enabled all fixtures are available
std = ["anyhow", "sp-core", "sp-io"]
std = [
"alloy-core",
"anyhow",
"hex/std",
"serde_json/std",
"sp-core",
"sp-io",
]
Loading
Loading