update to polkadot-sdk unstable2507 (#431)

Support for `polkadot-sdk` release `unstable2507`. This release will be
deployed to Kusama and is supposed the first one on Polkadot.

---------

Signed-off-by: xermicus <cyrill@parity.io>
Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
This commit is contained in:
xermicus
2025-12-15 14:02:48 +01:00
committed by GitHub
parent 11f82c8488
commit e568a924ae
10 changed files with 1055 additions and 1047 deletions
+2 -1
View File
@@ -4,7 +4,7 @@
This is a development pre-release. This is a development pre-release.
Supported `polkadot-sdk` rev: `2509.0.0` Supported `polkadot-sdk` rev: `unstable2507`
### Added ### Added
- The comprehensive revive compiler book documentation page: https://paritytech.github.io/revive/ - The comprehensive revive compiler book documentation page: https://paritytech.github.io/revive/
@@ -14,6 +14,7 @@ Supported `polkadot-sdk` rev: `2509.0.0`
### Changed ### Changed
- Instruct the LLVM backend and linker to `--relax` (may lead to smaller contract code size). - Instruct the LLVM backend and linker to `--relax` (may lead to smaller contract code size).
- Standard JSON mode: Don't forward EVM bytecode related output selections to solc. - Standard JSON mode: Don't forward EVM bytecode related output selections to solc.
- The supported `polkadot-sdk` release is `unstable2507`.
### Fixed: ### Fixed:
- The missing `STOP` instruction at the end of `code` blocks. - The missing `STOP` instruction at the end of `code` blocks.
Generated
+1023 -1026
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -76,7 +76,7 @@ normpath = "1.5"
# polkadot-sdk and friends # polkadot-sdk and friends
codec = { version = "3.7.5", default-features = false, package = "parity-scale-codec" } codec = { version = "3.7.5", default-features = false, package = "parity-scale-codec" }
scale-info = { version = "2.11.6", default-features = false } scale-info = { version = "2.11.6", default-features = false }
polkadot-sdk = { version = "2509.0.0" } polkadot-sdk = { version = "=2507.4.0" }
# llvm # llvm
[workspace.dependencies.inkwell] [workspace.dependencies.inkwell]
+1 -1
View File
@@ -26,6 +26,6 @@ pragma solidity ^0.8;
contract BaseFee { contract BaseFee {
constructor() payable { constructor() payable {
assert(block.basefee == 0); assert(block.basefee > 0);
} }
} }
-1
View File
@@ -26,7 +26,6 @@ pragma solidity ^0.8;
contract GasLeft { contract GasLeft {
constructor() payable { constructor() payable {
assert(gasleft() > gasleft());
assert(gasleft() > 0 && gasleft() < 0xffffffffffffffff); assert(gasleft() > 0 && gasleft() < 0xffffffffffffffff);
} }
} }
+1 -1
View File
@@ -26,6 +26,6 @@ pragma solidity ^0.8;
contract GasLimit { contract GasLimit {
constructor() payable { constructor() payable {
assert(block.gaslimit == 2000000000000); assert(block.gaslimit > 0);
} }
} }
+1 -1
View File
@@ -26,6 +26,6 @@ pragma solidity ^0.8;
contract GasPrice { contract GasPrice {
constructor() payable { constructor() payable {
assert(tx.gasprice == 1000); assert(tx.gasprice > 1000);
} }
} }
+10 -5
View File
@@ -59,7 +59,7 @@ pub const CHARLIE: H160 = H160([3u8; 20]);
/// Default gas limit /// Default gas limit
pub const GAS_LIMIT: Weight = Weight::from_parts(100_000_000_000_000, 3 * 1024 * 1024 * 1024); pub const GAS_LIMIT: Weight = Weight::from_parts(100_000_000_000_000, 3 * 1024 * 1024 * 1024);
/// Default deposit limit /// Default deposit limit
pub const DEPOSIT_LIMIT: Balance = 10_000_000; pub const DEPOSIT_LIMIT: Balance = 100_000_000_000;
/// The native to ETH balance factor. /// The native to ETH balance factor.
pub const ETH_RATIO: Balance = 1_000_000; pub const ETH_RATIO: Balance = 1_000_000;
@@ -97,14 +97,19 @@ impl ExtBuilder {
.unwrap(); .unwrap();
let mut ext = sp_io::TestExternalities::new(t); let mut ext = sp_io::TestExternalities::new(t);
let checking_account = Pallet::<Runtime>::account_id();
ext.register_extension(KeystoreExt::new(MemoryKeystore::new())); ext.register_extension(KeystoreExt::new(MemoryKeystore::new()));
ext.execute_with(|| { ext.execute_with(|| {
let _ = <Runtime as Config>::Currency::deposit_creating( let _ = <Runtime as Config>::Currency::deposit_creating(
&Pallet::<Runtime>::account_id(), &checking_account,
<Runtime as Config>::Currency::minimum_balance(), 1_000_000_000_000,
); );
System::set_block_number(1); System::set_block_number(1);
assert_ok!(Pallet::<Runtime>::map_account(RuntimeOrigin::signed(
checking_account
)));
}); });
ext ext
@@ -115,7 +120,7 @@ impl ExtBuilder {
#[derive(Debug, Clone, Serialize, Deserialize)] #[derive(Debug, Clone, Serialize, Deserialize)]
pub struct VerifyCallExpectation { pub struct VerifyCallExpectation {
/// When provided, the expected gas consumed /// When provided, the expected gas consumed
pub gas_consumed: Option<Weight>, pub gas_consumed: Option<u128>,
/// When provided, the expected output /// When provided, the expected output
#[serde(default, with = "hex")] #[serde(default, with = "hex")]
pub output: OptionalHex<Vec<u8>>, pub output: OptionalHex<Vec<u8>>,
@@ -238,7 +243,7 @@ impl CallResult {
} }
/// Get the gas consumed by the call /// Get the gas consumed by the call
fn gas_consumed(&self) -> Weight { fn gas_consumed(&self) -> u128 {
match self { match self {
Self::Exec { result, .. } => result.gas_consumed, Self::Exec { result, .. } => result.gas_consumed,
Self::Instantiate { result, .. } => result.gas_consumed, Self::Instantiate { result, .. } => result.gas_consumed,
+2 -1
View File
@@ -2,7 +2,7 @@ use frame_support::{runtime, traits::FindAuthor, weights::constants::WEIGHT_REF_
use pallet_revive::AccountId32Mapper; use pallet_revive::AccountId32Mapper;
use polkadot_sdk::*; use polkadot_sdk::*;
use polkadot_sdk::{ use polkadot_sdk::{
polkadot_sdk_frame::{log, runtime::prelude::*}, polkadot_sdk_frame::runtime::prelude::*,
sp_runtime::{AccountId32, Perbill}, sp_runtime::{AccountId32, Perbill},
}; };
@@ -72,6 +72,7 @@ parameter_types! {
#[derive_impl(pallet_revive::config_preludes::TestDefaultConfig)] #[derive_impl(pallet_revive::config_preludes::TestDefaultConfig)]
impl pallet_revive::Config for Runtime { impl pallet_revive::Config for Runtime {
type Balance = Balance;
type Time = Timestamp; type Time = Timestamp;
type Currency = Balances; type Currency = Balances;
type DepositPerByte = DepositPerByte; type DepositPerByte = DepositPerByte;
+14 -9
View File
@@ -1,6 +1,6 @@
use std::{str::FromStr, time::Instant}; use std::{str::FromStr, time::Instant};
use polkadot_sdk::pallet_revive::Pallet; use polkadot_sdk::pallet_revive::{ExecConfig, Pallet, TransactionLimits};
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use crate::*; use crate::*;
@@ -210,9 +210,9 @@ impl Default for Specs {
Self { Self {
differential: false, differential: false,
balances: vec![ balances: vec![
(ALICE, 1_000_000_000), (ALICE, 1_000_000_000_000),
(BOB, 1_000_000_000), (BOB, 1_000_000_000_000),
(CHARLIE, 1_000_000_000), (CHARLIE, 1_000_000_000_000),
], ],
actions: Default::default(), actions: Default::default(),
} }
@@ -447,12 +447,14 @@ impl Specs {
let result = Contracts::bare_instantiate( let result = Contracts::bare_instantiate(
origin, origin,
value.into(), value.into(),
gas_limit.unwrap_or(GAS_LIMIT), TransactionLimits::WeightAndDeposit {
storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT).into(), weight_limit: gas_limit.unwrap_or(GAS_LIMIT),
deposit_limit: storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT),
},
code, code,
data, data,
salt.0, salt.0,
pallet_revive::BumpNonce::No, ExecConfig::new_substrate_tx(),
); );
results.push(CallResult::Instantiate { results.push(CallResult::Instantiate {
result, result,
@@ -486,9 +488,12 @@ impl Specs {
RuntimeOrigin::signed(origin.to_account_id(&results)), RuntimeOrigin::signed(origin.to_account_id(&results)),
dest.to_eth_addr(&results), dest.to_eth_addr(&results),
value.into(), value.into(),
gas_limit.unwrap_or(GAS_LIMIT), TransactionLimits::WeightAndDeposit {
storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT).into(), weight_limit: gas_limit.unwrap_or(GAS_LIMIT),
deposit_limit: storage_deposit_limit.unwrap_or(DEPOSIT_LIMIT),
},
data, data,
ExecConfig::new_substrate_tx(),
); );
results.push(CallResult::Exec { results.push(CallResult::Exec {
result, result,