Skip to content
Closed
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
Original file line number Diff line number Diff line change
Expand Up @@ -1192,6 +1192,7 @@ impl pallet_revive::Config for Runtime {
type NativeToEthRatio = ConstU32<1_000_000>; // 10^(18 - 12) Eth is 10^18, Native is 10^12.
type EthGasEncoder = ();
type FindAuthor = <Runtime as pallet_authorship::Config>::FindAuthor;
type DepositSource = ();
}

parameter_types! {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ use frame_support::{
use hex_literal::hex;
use pallet_revive::{
test_utils::builder::{BareInstantiateBuilder, Contract},
Code, DepositLimit,
Code,
};
use pallet_revive_fixtures::compile_module;
use pallet_uniques::{asset_ops::Item, asset_strategies::Attribute};
Expand Down Expand Up @@ -1689,7 +1689,7 @@ fn withdraw_and_deposit_erc20s() {
let constructor_data = sol_data::Uint::<256>::abi_encode(&initial_amount_u256);
let Contract { addr: erc20_address, .. } = bare_instantiate(&sender, code)
.gas_limit(Weight::from_parts(2_000_000_000, 200_000))
.storage_deposit_limit(DepositLimit::Balance(Balance::MAX))
.storage_deposit_limit(Balance::MAX)
.data(constructor_data)
.build_and_unwrap_contract();

Expand Down Expand Up @@ -1802,7 +1802,7 @@ fn smart_contract_not_erc20_will_error() {

let Contract { addr: non_erc20_address, .. } = bare_instantiate(&sender, code)
.gas_limit(Weight::from_parts(2_000_000_000, 200_000))
.storage_deposit_limit(DepositLimit::Balance(Balance::MAX))
.storage_deposit_limit(Balance::MAX)
.build_and_unwrap_contract();

let wnd_amount_for_fees = 1_000_000_000_000u128;
Expand Down Expand Up @@ -1860,7 +1860,7 @@ fn smart_contract_does_not_return_bool_fails() {

let Contract { addr: non_erc20_address, .. } = bare_instantiate(&sender, code)
.gas_limit(Weight::from_parts(2_000_000_000, 200_000))
.storage_deposit_limit(DepositLimit::Balance(Balance::MAX))
.storage_deposit_limit(Balance::MAX)
.data(constructor_data)
.build_and_unwrap_contract();

Expand Down Expand Up @@ -1916,7 +1916,7 @@ fn expensive_erc20_runs_out_of_gas() {
let constructor_data = sol_data::Uint::<256>::abi_encode(&initial_amount_u256);
let Contract { addr: non_erc20_address, .. } = bare_instantiate(&sender, code)
.gas_limit(Weight::from_parts(2_000_000_000, 200_000))
.storage_deposit_limit(DepositLimit::Balance(Balance::MAX))
.storage_deposit_limit(Balance::MAX)
.data(constructor_data)
.build_and_unwrap_contract();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ use pallet_revive::{
primitives::{Address, U256 as EU256},
sol_types::SolCall,
},
AddressMapper, ContractResult, DepositLimit, MomentOf,
AddressMapper, ContractResult, ExecConfig, MomentOf,
};
use sp_core::{Get, H160, H256, U256};
use sp_runtime::Weight;
Expand Down Expand Up @@ -126,8 +126,9 @@ where
asset_id,
U256::zero(),
gas_limit,
DepositLimit::Balance(StorageDepositLimit::get()),
StorageDepositLimit::get(),
data,
ExecConfig::new_substrate_tx(),
);
// We need to return this surplus for the executor to allow refunding it.
let surplus = gas_limit.saturating_sub(gas_consumed);
Expand Down Expand Up @@ -184,8 +185,9 @@ where
asset_id,
U256::zero(),
gas_limit,
DepositLimit::Balance(StorageDepositLimit::get()),
StorageDepositLimit::get(),
data,
ExecConfig::new_substrate_tx(),
);
// We need to return this surplus for the executor to allow refunding it.
let surplus = gas_limit.saturating_sub(gas_consumed);
Expand Down
1 change: 1 addition & 0 deletions cumulus/parachains/runtimes/testing/penpal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -832,6 +832,7 @@ impl pallet_revive::Config for Runtime {
type NativeToEthRatio = ConstU32<1_000_000>; // 10^(18 - 12) Eth is 10^18, Native is 10^12.
type EthGasEncoder = ();
type FindAuthor = <Runtime as pallet_authorship::Config>::FindAuthor;
type DepositSource = ();
}

impl pallet_sudo::Config for Runtime {
Expand Down
56 changes: 37 additions & 19 deletions polkadot/xcm/pallet-xcm/src/precompiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ mod test {
},
H160,
},
DepositLimit, U256,
ExecConfig, U256,
};
use polkadot_parachain_primitives::primitives::Id as ParaId;
use sp_runtime::traits::AccountIdConversion;
Expand Down Expand Up @@ -231,8 +231,9 @@ mod test {
xcm_precompile_addr,
U256::zero(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u128::MAX,
encoded_call,
ExecConfig::new_substrate_tx(),
);
assert!(result.result.is_ok());
let sent_message = Xcm(Some(DescendOrigin(sender.clone().try_into().unwrap()))
Expand Down Expand Up @@ -279,8 +280,9 @@ mod test {
xcm_precompile_addr,
U256::zero(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u128::MAX,
encoded_call,
ExecConfig::new_substrate_tx(),
);

assert!(result.result.is_ok());
Expand Down Expand Up @@ -327,8 +329,9 @@ mod test {
xcm_precompile_addr,
U256::zero(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u128::MAX,
encoded_call,
ExecConfig::new_substrate_tx(),
);
let return_value = match result.result {
Ok(value) => value,
Expand Down Expand Up @@ -376,8 +379,9 @@ mod test {
xcm_precompile_addr,
U256::zero(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u128::MAX,
encoded_call,
ExecConfig::new_substrate_tx(),
);
let return_value = match result.result {
Ok(value) => value,
Expand All @@ -402,8 +406,9 @@ mod test {
xcm_precompile_addr,
U256::zero(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u128::MAX,
encoded_call,
ExecConfig::new_substrate_tx(),
);
let return_value = match result.result {
Ok(value) => value,
Expand Down Expand Up @@ -451,8 +456,9 @@ mod test {
xcm_precompile_addr,
U256::zero(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u128::MAX,
encoded_call,
ExecConfig::new_substrate_tx(),
);
let return_value = match result.result {
Ok(value) => value,
Expand All @@ -478,8 +484,9 @@ mod test {
xcm_precompile_addr,
U256::zero(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u128::MAX,
encoded_call,
ExecConfig::new_substrate_tx(),
);
let return_value = match result.result {
Ok(value) => value,
Expand Down Expand Up @@ -520,8 +527,9 @@ mod test {
xcm_precompile_addr,
U256::zero(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u128::MAX,
encoded_weight_call,
ExecConfig::new_substrate_tx(),
);

let weight_result = match xcm_weight_results.result {
Expand All @@ -542,8 +550,9 @@ mod test {
xcm_precompile_addr,
U256::zero(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u128::MAX,
encoded_call,
ExecConfig::new_substrate_tx(),
);

assert!(result.result.is_ok());
Expand Down Expand Up @@ -580,8 +589,9 @@ mod test {
xcm_precompile_addr,
U256::zero(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u128::MAX,
encoded_weight_call,
ExecConfig::new_substrate_tx(),
);

let weight_result = match xcm_weight_results.result {
Expand All @@ -602,8 +612,9 @@ mod test {
xcm_precompile_addr,
U256::zero(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u128::MAX,
encoded_call,
ExecConfig::new_substrate_tx(),
);

let return_value = match result.result {
Expand Down Expand Up @@ -648,8 +659,9 @@ mod test {
xcm_precompile_addr,
U256::zero(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u128::MAX,
encoded_weight_call,
ExecConfig::new_substrate_tx(),
);

let weight_result = match xcm_weight_results.result {
Expand All @@ -670,8 +682,9 @@ mod test {
xcm_precompile_addr,
U256::zero(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u128::MAX,
encoded_call,
ExecConfig::new_substrate_tx(),
);
let return_value = match result.result {
Ok(value) => value,
Expand Down Expand Up @@ -715,8 +728,9 @@ mod test {
xcm_precompile_addr,
U256::zero(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u128::MAX,
encoded_weight_call,
ExecConfig::new_substrate_tx(),
);

let weight_result = match xcm_weight_results.result {
Expand Down Expand Up @@ -744,8 +758,9 @@ mod test {
xcm_precompile_addr,
U256::zero(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u128::MAX,
encoded_call,
ExecConfig::new_substrate_tx(),
);

let return_value = match result.result {
Expand All @@ -770,8 +785,9 @@ mod test {
xcm_precompile_addr,
U256::zero(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u128::MAX,
encoded_call,
ExecConfig::new_substrate_tx(),
);

let return_value = match result.result {
Expand Down Expand Up @@ -818,8 +834,9 @@ mod test {
xcm_precompile_addr,
U256::zero(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u128::MAX,
encoded_weight_call,
ExecConfig::new_substrate_tx(),
);

let result = match xcm_weight_results.result {
Expand All @@ -842,8 +859,9 @@ mod test {
xcm_precompile_addr,
U256::zero(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u128::MAX,
encoded_weight_call,
ExecConfig::new_substrate_tx(),
);

let result = match xcm_weight_results.result {
Expand Down
1 change: 1 addition & 0 deletions substrate/bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1492,6 +1492,7 @@ impl pallet_revive::Config for Runtime {
type EthGasEncoder = ();
type FindAuthor = <Runtime as pallet_authorship::Config>::FindAuthor;
type AllowEVMBytecode = ConstBool<true>;
type DepositSource = ();
}

impl pallet_sudo::Config for Runtime {
Expand Down
20 changes: 13 additions & 7 deletions substrate/frame/assets/src/precompiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ mod test {
};
use alloy::primitives::U256;
use frame_support::{assert_ok, traits::Currency};
use pallet_revive::DepositLimit;
use pallet_revive::ExecConfig;
use sp_core::H160;
use sp_runtime::Weight;

Expand Down Expand Up @@ -371,8 +371,9 @@ mod test {
H160::from(asset_addr),
0u32.into(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u64::MAX,
data,
ExecConfig::new_substrate_tx(),
);

assert_contract_event(
Expand Down Expand Up @@ -407,8 +408,9 @@ mod test {
H160::from(asset_addr),
0u32.into(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u64::MAX,
data,
ExecConfig::new_substrate_tx(),
)
.result
.unwrap()
Expand Down Expand Up @@ -438,8 +440,9 @@ mod test {
H160::from(asset_addr),
0u32.into(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u64::MAX,
data,
ExecConfig::new_substrate_tx(),
)
.result
.unwrap()
Expand Down Expand Up @@ -484,8 +487,9 @@ mod test {
H160::from(asset_addr),
0u32.into(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u64::MAX,
data,
ExecConfig::new_substrate_tx(),
);

assert_contract_event(
Expand All @@ -508,8 +512,9 @@ mod test {
H160::from(asset_addr),
0u32.into(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u64::MAX,
data,
ExecConfig::new_substrate_tx(),
)
.result
.unwrap()
Expand All @@ -530,8 +535,9 @@ mod test {
H160::from(asset_addr),
0u32.into(),
Weight::MAX,
DepositLimit::UnsafeOnlyForDryRun,
u64::MAX,
data,
ExecConfig::new_substrate_tx(),
);
assert_eq!(Assets::balance(asset_id, owner), 90);
assert_eq!(Assets::allowance(asset_id, &owner, &spender), 15);
Expand Down
Loading
Loading