Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to polkadot2412 #3

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft
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
6,686 changes: 4,724 additions & 1,962 deletions Cargo.lock

Large diffs are not rendered by default.

151 changes: 76 additions & 75 deletions Cargo.toml

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
async-trait = { workspace = true }
scale-codec = { package = "parity-scale-codec", workspace = true }
scale-codec = { workspace = true }
# Substrate
sp-core = { workspace = true, features = ["default"] }
sp-runtime = { workspace = true, features = ["default"] }
Expand Down
2 changes: 1 addition & 1 deletion client/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ fp-storage = { workspace = true, features = ["default"] }

[dev-dependencies]
futures = { workspace = true }
scale-codec = { package = "parity-scale-codec", workspace = true }
scale-codec = { workspace = true }
tempfile = "3.3.0"
# Substrate
sc-block-builder = { workspace = true }
Expand Down
4 changes: 2 additions & 2 deletions client/db/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
async-trait = { workspace = true }
ethereum = { workspace = true, features = ["with-codec"], optional = true }
ethereum = { workspace = true, features = ["with-scale"], optional = true }
futures = { workspace = true, optional = true }
kvdb-rocksdb = { workspace = true, optional = true }
log = { workspace = true }
parity-db = { workspace = true }
parking_lot = { workspace = true }
scale-codec = { package = "parity-scale-codec", workspace = true }
scale-codec = { workspace = true }
smallvec = { version = "1.13", optional = true }
sqlx = { workspace = true, features = ["runtime-tokio-native-tls", "sqlite"], optional = true }
tokio = { workspace = true, features = ["macros", "sync"], optional = true }
Expand Down
2 changes: 1 addition & 1 deletion client/mapping-sync/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fp-rpc = { workspace = true, features = ["default"] }
[dev-dependencies]
ethereum = { workspace = true }
ethereum-types = { workspace = true }
scale-codec = { package = "parity-scale-codec", workspace = true }
scale-codec = { workspace = true }
sqlx = { workspace = true, features = ["runtime-tokio-native-tls", "sqlite"] }
tempfile = "3.10.1"
tokio = { workspace = true, features = ["sync"] }
Expand Down
2 changes: 1 addition & 1 deletion client/rpc-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repository = { workspace = true }
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
ethereum = { workspace = true, features = ["with-codec", "with-serde"] }
ethereum = { workspace = true, features = ["with-scale", "with-serde"] }
ethereum-types = { workspace = true }
jsonrpsee = { workspace = true, features = ["server", "macros"] }
rlp = { workspace = true }
Expand Down
12 changes: 6 additions & 6 deletions client/rpc-core/src/types/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ impl BuildFrom for Transaction {
access_list: None,
y_parity: None,
v: Some(U256::from(t.signature.v())),
r: U256::from(t.signature.r().as_bytes()),
s: U256::from(t.signature.s().as_bytes()),
r: U256::from_big_endian(t.signature.r().as_bytes()),
s: U256::from_big_endian(t.signature.s().as_bytes()),
},
EthereumTransaction::EIP2930(t) => Self {
transaction_type: U256::from(1),
Expand All @@ -134,8 +134,8 @@ impl BuildFrom for Transaction {
access_list: Some(t.access_list.clone()),
y_parity: Some(U256::from(t.odd_y_parity as u8)),
v: Some(U256::from(t.odd_y_parity as u8)),
r: U256::from(t.r.as_bytes()),
s: U256::from(t.s.as_bytes()),
r: U256::from_big_endian(t.r.as_bytes()),
s: U256::from_big_endian(t.s.as_bytes()),
},
EthereumTransaction::EIP1559(t) => Self {
transaction_type: U256::from(2),
Expand All @@ -161,8 +161,8 @@ impl BuildFrom for Transaction {
access_list: Some(t.access_list.clone()),
y_parity: Some(U256::from(t.odd_y_parity as u8)),
v: Some(U256::from(t.odd_y_parity as u8)),
r: U256::from(t.r.as_bytes()),
s: U256::from(t.s.as_bytes()),
r: U256::from_big_endian(t.r.as_bytes()),
s: U256::from_big_endian(t.s.as_bytes()),
},
}
}
Expand Down
4 changes: 2 additions & 2 deletions client/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repository = { workspace = true }
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
ethereum = { workspace = true, features = ["with-codec"] }
ethereum = { workspace = true, features = ["with-scale"] }
ethereum-types = { workspace = true }
evm = { workspace = true }
futures = { workspace = true }
Expand All @@ -22,7 +22,7 @@ log = { workspace = true }
prometheus = { version = "0.13.4", default-features = false }
rand = "0.8"
rlp = { workspace = true }
scale-codec = { package = "parity-scale-codec", workspace = true }
scale-codec = { workspace = true }
schnellru = "0.2.3"
serde = { workspace = true, optional = true }
thiserror = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions client/rpc/src/eth/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use std::sync::Arc;
use std::{ops::Deef, sync::Arc};

use ethereum_types::{H256, U256};
use jsonrpsee::core::RpcResult;
Expand Down Expand Up @@ -147,7 +147,7 @@ where
graph
.validated_pool()
.ready()
.map(|in_pool_tx| in_pool_tx.data().clone())
.map(|in_pool_tx| in_pool_tx.data().deref().clone())
.collect::<Vec<<B as BlockT>::Extrinsic>>(),
);

Expand All @@ -157,7 +157,7 @@ where
.validated_pool()
.futures()
.iter()
.map(|(_hash, extrinsic)| extrinsic.clone())
.map(|(_hash, extrinsic)| extrinsic.deref().clone())
.collect::<Vec<<B as BlockT>::Extrinsic>>(),
);

Expand Down
4 changes: 2 additions & 2 deletions client/rpc/src/eth/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -978,8 +978,8 @@ pub fn error_on_execution_failure(reason: &ExitReason, data: &[u8]) -> RpcResult
// A minimum size of error function selector (4) + offset (32) + string length (32)
// should contain a utf-8 encoded revert reason.
if data.len() > MESSAGE_START {
let message_len =
U256::from(&data[LEN_START..MESSAGE_START]).saturated_into::<usize>();
let message_len = U256::from_big_endian(&data[LEN_START..MESSAGE_START])
.saturated_into::<usize>();
let message_end = MESSAGE_START.saturating_add(message_len);

if data.len() >= message_end {
Expand Down
5 changes: 3 additions & 2 deletions client/rpc/src/eth/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use std::{
collections::{BTreeMap, HashSet},
marker::PhantomData,
ops::Deref,
sync::Arc,
time::{Duration, Instant},
};
Expand Down Expand Up @@ -111,7 +112,7 @@ where
.graph
.validated_pool()
.ready()
.map(|in_pool_tx| in_pool_tx.data().clone())
.map(|in_pool_tx| in_pool_tx.data().deref().clone())
.collect();
// Use the runtime to match the (here) opaque extrinsics against ethereum transactions.
let api = self.client.runtime_api();
Expand Down Expand Up @@ -225,7 +226,7 @@ where
.graph
.validated_pool()
.ready()
.map(|in_pool_tx| in_pool_tx.data().clone())
.map(|in_pool_tx| in_pool_tx.data().deref().clone())
.collect();
// Use the runtime to match the (here) opaque extrinsics against ethereum transactions.
let api = self.client.runtime_api();
Expand Down
4 changes: 3 additions & 1 deletion client/rpc/src/eth/pending.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use std::ops::Deref;

// Substrate
use sc_client_api::backend::{Backend, StorageProvider};
use sc_transaction_pool::ChainApi;
Expand Down Expand Up @@ -125,7 +127,7 @@ where
.graph
.validated_pool()
.ready()
.map(|in_pool_tx| in_pool_tx.data().clone())
.map(|in_pool_tx| in_pool_tx.data().deref().clone())
.collect::<Vec<<B as BlockT>::Extrinsic>>();
log::debug!(target: LOG_TARGET, "Pending runtime API: extrinsic len = {}", extrinsics.len());
// Apply the extrinsics from the ready queue to the pending block's state.
Expand Down
6 changes: 3 additions & 3 deletions client/rpc/src/eth/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use std::sync::Arc;
use std::{ops::Deref, sync::Arc};

use ethereum::TransactionV2 as EthereumTransaction;
use ethereum_types::{H256, U256, U64};
Expand Down Expand Up @@ -81,7 +81,7 @@ where
graph
.validated_pool()
.ready()
.map(|in_pool_tx| in_pool_tx.data().clone())
.map(|in_pool_tx| in_pool_tx.data().deref().clone())
.collect::<Vec<<B as BlockT>::Extrinsic>>(),
);

Expand All @@ -91,7 +91,7 @@ where
.validated_pool()
.futures()
.iter()
.map(|(_hash, extrinsic)| extrinsic.clone())
.map(|(_hash, extrinsic)| extrinsic.deref().clone())
.collect::<Vec<<B as BlockT>::Extrinsic>>(),
);

Expand Down
4 changes: 2 additions & 2 deletions client/rpc/src/eth_pubsub.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use std::{marker::PhantomData, sync::Arc};
use std::{marker::PhantomData, ops::Deref, sync::Arc};

use ethereum::TransactionV2 as EthereumTransaction;
use futures::{future, FutureExt as _, StreamExt as _};
Expand Down Expand Up @@ -165,7 +165,7 @@ where
return future::ready(None);
};

let xts = vec![xt.data().clone()];
let xts = vec![xt.data().deref().clone()];

let txs: Option<Vec<EthereumTransaction>> = if api_version > 1 {
api.extrinsic_filter(best_block, xts).ok()
Expand Down
6 changes: 3 additions & 3 deletions client/rpc/src/txpool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use std::{marker::PhantomData, sync::Arc};
use std::{marker::PhantomData, ops::Deref, sync::Arc};

use ethereum::TransactionV2 as EthereumTransaction;
use ethereum_types::{H160, H256, U256};
Expand Down Expand Up @@ -109,7 +109,7 @@ where
.graph
.validated_pool()
.ready()
.map(|in_pool_tx| in_pool_tx.data().clone())
.map(|in_pool_tx| in_pool_tx.data().deref().clone())
.collect();

// Collect extrinsics in the future validated pool.
Expand All @@ -118,7 +118,7 @@ where
.validated_pool()
.futures()
.iter()
.map(|(_, extrinsic)| extrinsic.clone())
.map(|(_, extrinsic)| extrinsic.deref().clone())
.collect();

// Use the runtime to match the (here) opaque extrinsics against ethereum transactions.
Expand Down
4 changes: 2 additions & 2 deletions client/storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ repository = { workspace = true }
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
ethereum = { workspace = true, features = ["with-codec"] }
ethereum = { workspace = true, features = ["with-scale"] }
ethereum-types = { workspace = true }
scale-codec = { package = "parity-scale-codec", workspace = true }
scale-codec = { workspace = true }

# Substrate
sc-client-api = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion client/storage/src/overrides/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ where

pub fn account_storage(&self, at: B::Hash, address: Address, index: U256) -> Option<H256> {
let tmp: &mut [u8; 32] = &mut [0; 32];
index.to_big_endian(tmp);
index.write_as_big_endian(tmp);

let mut key: Vec<u8> = storage_prefix_build(PALLET_EVM, EVM_ACCOUNT_STORAGES);
key.extend(blake2_128_extend(address.as_bytes()));
Expand Down
2 changes: 1 addition & 1 deletion frame/base-fee/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repository = { workspace = true }
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
scale-codec = { package = "parity-scale-codec", workspace = true }
scale-codec = { workspace = true }
scale-info = { workspace = true }
# Substrate
frame-support = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion frame/dynamic-fee/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repository = { workspace = true }
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
scale-codec = { package = "parity-scale-codec", workspace = true }
scale-codec = { workspace = true }
scale-info = { workspace = true }
# Substrate
frame-support = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions frame/ethereum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ repository = { workspace = true }
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
ethereum = { workspace = true, features = ["with-codec"] }
ethereum = { workspace = true, features = ["with-scale"] }
ethereum-types = { workspace = true }
evm = { workspace = true, features = ["with-codec"] }
scale-codec = { package = "parity-scale-codec", workspace = true }
evm = { workspace = true, features = ["scale"] }
scale-codec = { workspace = true }
scale-info = { workspace = true }
# Substrate
frame-support = { workspace = true }
Expand Down
10 changes: 7 additions & 3 deletions frame/ethereum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,10 @@ where
len: usize,
) -> Option<Result<(), TransactionValidityError>> {
if let Call::transact { transaction } = self {
if let Err(e) = CheckWeight::<T>::do_pre_dispatch(dispatch_info, len) {
if let Err(e) =
CheckWeight::<T>::do_validate(dispatch_info, len).and_then(|(_, next_len)| {
CheckWeight::<T>::do_prepare(dispatch_info, len, next_len)
}) {
return Some(Err(e));
}

Expand Down Expand Up @@ -628,8 +631,9 @@ impl<T: Config> Pallet<T> {
let data = info.value;
let data_len = data.len();
if data_len > MESSAGE_START {
let message_len = U256::from(&data[LEN_START..MESSAGE_START])
.saturated_into::<usize>();
let message_len =
U256::from_big_endian(&data[LEN_START..MESSAGE_START])
.saturated_into::<usize>();
let message_end = MESSAGE_START.saturating_add(
message_len.min(T::ExtraDataLength::get() as usize),
);
Expand Down
2 changes: 1 addition & 1 deletion frame/evm-chain-id/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ repository = { workspace = true }
targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
scale-codec = { package = "parity-scale-codec", workspace = true }
scale-codec = { workspace = true }
scale-info = { workspace = true }
# Substrate
frame-support = { workspace = true }
Expand Down
6 changes: 3 additions & 3 deletions frame/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ targets = ["x86_64-unknown-linux-gnu"]

[dependencies]
environmental = { workspace = true, optional = true }
evm = { workspace = true, features = ["with-codec"] }
evm = { workspace = true, features = ["scale"] }
hash-db = { workspace = true }
hex-literal = { workspace = true }
impl-trait-for-tuples = "0.2.2"
log = { workspace = true }
scale-codec = { package = "parity-scale-codec", workspace = true }
scale-codec = { workspace = true }
scale-info = { workspace = true }
# Substrate
frame-benchmarking = { workspace = true, optional = true }
Expand All @@ -43,7 +43,7 @@ default = ["std"]
std = [
"environmental?/std",
"evm/std",
"evm/with-serde",
"evm/serde",
"hex/std",
"log/std",
"scale-codec/std",
Expand Down
Loading
Loading