Skip to content

Commit

Permalink
update primitives rpc and self contained to latest TransactionExtensi…
Browse files Browse the repository at this point in the history
…on API
  • Loading branch information
4meta5 committed Jan 12, 2025
1 parent 7fe1127 commit b6df361
Show file tree
Hide file tree
Showing 8 changed files with 600 additions and 248 deletions.
409 changes: 388 additions & 21 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-s
pallet-aura = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412", default-features = false }
pallet-balances = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412", default-features = false }
pallet-grandpa = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412", default-features = false }
pallet-revive = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412", default-features = false }
pallet-sudo = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412", default-features = false }
pallet-timestamp = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412", default-features = false }
pallet-transaction-payment = { git = "https://github.com/paritytech/polkadot-sdk", tag = "polkadot-stable2412", default-features = false }
Expand Down
14 changes: 7 additions & 7 deletions frame/evm/src/runner/stack.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ where
gas_limit: u64,
max_fee_per_gas: Option<U256>,
max_priority_fee_per_gas: Option<U256>,
config: &'config evm::Config,
config: &'config evm::standard::Config,
precompiles: &'precompiles T::PrecompilesType,
is_transactional: bool,
weight_limit: Option<Weight>,
Expand Down Expand Up @@ -160,7 +160,7 @@ where
mut gas_limit: u64,
max_fee_per_gas: Option<U256>,
max_priority_fee_per_gas: Option<U256>,
config: &'config evm::Config,
config: &'config evm::standard::Config,
precompiles: &'precompiles T::PrecompilesType,
is_transactional: bool,
f: F,
Expand Down Expand Up @@ -415,7 +415,7 @@ where
is_transactional: bool,
weight_limit: Option<Weight>,
proof_size_base_cost: Option<u64>,
evm_config: &evm::Config,
evm_config: &evm::standard::Config,
) -> Result<(), RunnerError<Self::Error>> {
let (base_fee, mut weight) = T::FeeCalculator::min_gas_price();
let (source_account, inner_weight) = Pallet::<T>::account_basic(&source);
Expand Down Expand Up @@ -465,7 +465,7 @@ where
validate: bool,
weight_limit: Option<Weight>,
proof_size_base_cost: Option<u64>,
config: &evm::Config,
config: &evm::standard::Config,
) -> Result<CallInfo, RunnerError<Self::Error>> {
if validate {
Self::validate(
Expand Down Expand Up @@ -513,7 +513,7 @@ where
validate: bool,
weight_limit: Option<Weight>,
proof_size_base_cost: Option<u64>,
config: &evm::Config,
config: &evm::standard::Config,
) -> Result<CreateInfo, RunnerError<Self::Error>> {
if validate {
Self::validate(
Expand Down Expand Up @@ -568,7 +568,7 @@ where
validate: bool,
weight_limit: Option<Weight>,
proof_size_base_cost: Option<u64>,
config: &evm::Config,
config: &evm::standard::Config,
) -> Result<CreateInfo, RunnerError<Self::Error>> {
if validate {
Self::validate(
Expand Down Expand Up @@ -1266,7 +1266,7 @@ mod tests {

#[test]
fn test_evm_reentrancy() {
let config = evm::Config::istanbul();
let config = evm::standard::Config::istanbul();

// Should fail with the appropriate error if there is reentrancy
let res = Runner::<Test>::execute(
Expand Down
6 changes: 4 additions & 2 deletions primitives/evm/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,10 @@ use alloc::vec::Vec;
use evm::standard::GasometerState;
use frame_support::weights::Weight;
use sp_core::{H160, H256, U256};
use scale_codec::{Decode, Encode, MaxEncodedLen};
use scale_info::TypeInfo;

#[derive(Debug)]
#[derive(Debug, Encode, Decode, MaxEncodedLen, TypeInfo)]
pub struct Account {
balance: U256,
nonce: U256,
Expand Down Expand Up @@ -264,7 +266,7 @@ mod tests {
UnknownError,
}

static SHANGHAI_CONFIG: evm::Config = evm::Config::shanghai();
static SHANGHAI_CONFIG: evm::standard::Config = evm::standard::Config::shanghai();

impl From<TransactionValidationError> for TestError {
fn from(e: TransactionValidationError) -> Self {
Expand Down
17 changes: 2 additions & 15 deletions primitives/self-contained/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,15 @@ repository = { workspace = true }
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
scale-codec = { workspace = true }
scale-info = { workspace = true }
serde = { workspace = true, optional = true }
# Substrate
frame-support = { workspace = true }
pallet-revive = { workspace = true }
sp-runtime = { workspace = true }

[features]
default = ["std"]
std = [
"scale-codec/std",
"scale-info/std",
"serde/std",
# Substrate
"frame-support/std",
"pallet-revive/std",
"sp-runtime/std",
]
serde = [
"dep:serde",
"scale-info/serde",
"sp-runtime/serde",
]
try-runtime = [
"sp-runtime/try-runtime",
]
10 changes: 2 additions & 8 deletions primitives/self-contained/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,8 @@
#![cfg_attr(not(feature = "std"), no_std)]
#![warn(unused_crate_dependencies)]

mod checked_extrinsic;
mod unchecked_extrinsic;

pub use crate::{
checked_extrinsic::{CheckedExtrinsic, CheckedSignature},
unchecked_extrinsic::UncheckedExtrinsic,
};

pub use pallet_revive::evm::runtime::UncheckedExtrinsic;
pub use sp_runtime::generic::{CheckedExtrinsic, ExtrinsicFormat};
use sp_runtime::{
traits::{DispatchInfoOf, Dispatchable, PostDispatchInfoOf},
transaction_validity::{TransactionValidity, TransactionValidityError},
Expand Down
Loading

0 comments on commit b6df361

Please sign in to comment.