Skip to content

Commit

Permalink
upgrade polkadot-sdk to stable2412
Browse files Browse the repository at this point in the history
  • Loading branch information
0xbillw committed Dec 31, 2024
1 parent 11f8340 commit 7023a01
Show file tree
Hide file tree
Showing 54 changed files with 4,464 additions and 2,104 deletions.
5,881 changes: 4,088 additions & 1,793 deletions Cargo.lock

Large diffs are not rendered by default.

163 changes: 87 additions & 76 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 }
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::Deref, 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
2 changes: 1 addition & 1 deletion client/rpc/src/eth/execute.rs
Original file line number Diff line number Diff line change
Expand Up @@ -979,7 +979,7 @@ pub fn error_on_execution_failure(reason: &ExitReason, data: &[u8]) -> RpcResult
// 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>();
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: 2 additions & 2 deletions client/rpc/src/eth/pending.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};

// Substrate
use sc_client_api::{
Expand Down Expand Up @@ -131,7 +131,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
4 changes: 2 additions & 2 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 }
scale-codec = { workspace = true }
scale-info = { workspace = true }
# Substrate
frame-support = { workspace = true }
Expand Down
7 changes: 5 additions & 2 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,7 +631,7 @@ 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])
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
4 changes: 2 additions & 2 deletions frame/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ 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
3 changes: 1 addition & 2 deletions frame/evm/precompile/bn128/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,7 @@ impl Precompile for Bn128Pairing {
}
};

let mut buf = [0u8; 32];
ret_val.to_big_endian(&mut buf);
let buf = ret_val.to_big_endian();

Ok(PrecompileOutput {
exit_status: ExitSucceed::Returned,
Expand Down
2 changes: 1 addition & 1 deletion frame/evm/precompile/dispatch/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ edition = { workspace = true }
repository = { workspace = true }

[dependencies]
scale-codec = { package = "parity-scale-codec", workspace = true }
scale-codec = { workspace = true }
# Substrate
frame-support = { workspace = true }
sp-runtime = { workspace = true }
Expand Down
Loading

0 comments on commit 7023a01

Please sign in to comment.