update cargo dependencies (#395)

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
xermicus
2025-10-29 10:01:05 +01:00
committed by GitHub
parent 6549a4f825
commit 42cac55be8
10 changed files with 2257 additions and 1703 deletions
+15 -1
View File
@@ -27,6 +27,8 @@ use std::time::Duration;
use hex::{FromHex, ToHex};
use pallet_revive::{AddressMapper, ExecReturnValue, InstantiateReturnValue};
use polkadot_sdk::frame_support::traits::Currency;
use polkadot_sdk::pallet_revive::{Config, Pallet};
use polkadot_sdk::*;
use polkadot_sdk::{
pallet_revive::ContractResult,
@@ -58,6 +60,8 @@ pub const CHARLIE: H160 = H160([3u8; 20]);
pub const GAS_LIMIT: Weight = Weight::from_parts(100_000_000_000_000, 3 * 1024 * 1024 * 1024);
/// Default deposit limit
pub const DEPOSIT_LIMIT: Balance = 10_000_000;
/// The native to ETH balance factor.
pub const ETH_RATIO: Balance = 1_000_000;
/// Externalities builder
#[derive(Default)]
@@ -80,18 +84,28 @@ impl ExtBuilder {
/// Build the externalities
pub fn build(self) -> sp_io::TestExternalities {
sp_tracing::try_init_simple();
let mut t = frame_system::GenesisConfig::<Runtime>::default()
.build_storage()
.unwrap();
pallet_balances::GenesisConfig::<Runtime> {
balances: self.balance_genesis_config,
dev_accounts: None,
}
.assimilate_storage(&mut t)
.unwrap();
let mut ext = sp_io::TestExternalities::new(t);
ext.register_extension(KeystoreExt::new(MemoryKeystore::new()));
ext.execute_with(|| System::set_block_number(1));
ext.execute_with(|| {
let _ = <Runtime as Config>::Currency::deposit_creating(
&Pallet::<Runtime>::account_id(),
<Runtime as Config>::Currency::minimum_balance(),
);
System::set_block_number(1);
});
ext
}
+3 -4
View File
@@ -74,19 +74,18 @@ parameter_types! {
impl pallet_revive::Config for Runtime {
type Time = Timestamp;
type Currency = Balances;
type CallFilter = ();
type ChainExtension = ();
type DepositPerByte = DepositPerByte;
type DepositPerItem = DepositPerItem;
type AddressMapper = AccountId32Mapper<Self>;
type RuntimeMemory = ConstU32<{ 512 * 1024 * 1024 }>;
type PVFMemory = ConstU32<{ 1024 * 1024 * 1024 }>;
type UnsafeUnstableInterface = UnstableInterface;
type UploadOrigin = EnsureSigned<AccountId32>;
type InstantiateOrigin = EnsureSigned<AccountId32>;
type UploadOrigin = EnsureSigned<Self::AccountId>;
type InstantiateOrigin = EnsureSigned<Self::AccountId>;
type CodeHashLockupDepositPercent = CodeHashLockupDepositPercent;
type ChainId = ConstU64<420_420_420>;
type FindAuthor = Self;
type NativeToEthRatio = ConstU32<{ crate::ETH_RATIO as u32 }>;
}
impl FindAuthor<<Runtime as frame_system::Config>::AccountId> for Runtime {
+8 -4
View File
@@ -1,5 +1,6 @@
use std::{str::FromStr, time::Instant};
use polkadot_sdk::pallet_revive::Pallet;
use serde::{Deserialize, Serialize};
use crate::*;
@@ -445,12 +446,13 @@ impl Specs {
let time_start = Instant::now();
let result = Contracts::bare_instantiate(
origin,
value,
value.into(),
gas_limit.unwrap_or(GAS_LIMIT),
storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT).into(),
code,
data,
salt.0,
pallet_revive::BumpNonce::No,
);
results.push(CallResult::Instantiate {
result,
@@ -483,7 +485,7 @@ impl Specs {
let result = Contracts::bare_call(
RuntimeOrigin::signed(origin.to_account_id(&results)),
dest.to_eth_addr(&results),
value,
value.into(),
gas_limit.unwrap_or(GAS_LIMIT),
storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT).into(),
data,
@@ -497,8 +499,10 @@ impl Specs {
expectation.verify(results.last().expect("No call to verify"));
}
VerifyBalance { origin, expected } => {
let balance = Balances::usable_balance(origin.to_account_id(&results));
assert_eq!(balance, expected);
assert_eq!(
Pallet::<Runtime>::evm_balance(&origin.to_eth_addr(&results)),
expected.into()
);
}
VerifyStorage {
contract,