Skip to content

Commit

Permalink
Update substrate, evm and ethereum versions (#275)
Browse files Browse the repository at this point in the history
  • Loading branch information
sorpaas authored Jan 27, 2021
1 parent fe13ec2 commit bdbabac
Show file tree
Hide file tree
Showing 32 changed files with 1,211 additions and 1,199 deletions.
2,025 changes: 1,029 additions & 996 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion client/rpc-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ jsonrpc-core-client = "14.0.3"
jsonrpc-derive = "14.0.3"
jsonrpc-pubsub = "15.0.0"
rustc-hex = "2.1.0"
ethereum-types = "0.9.0"
ethereum-types = "0.10.0"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
6 changes: 3 additions & 3 deletions client/rpc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jsonrpc-derive = "14.0.3"
jsonrpc-core-client = "14.0.3"
jsonrpc-pubsub = "15.0.0"
log = "0.4.8"
ethereum-types = "0.9.0"
ethereum-types = "0.10.0"
fc-consensus = { path = "../consensus" }
fc-rpc-core = { path = "../rpc-core" }
fp-rpc = { path = "../../primitives/rpc" }
Expand All @@ -28,9 +28,9 @@ sc-rpc = { git = "https://github.com/paritytech/substrate.git", branch = "fronti
sc-network = { git = "https://github.com/paritytech/substrate.git", branch = "frontier" }
pallet-evm = { path = "../../frame/evm" }
pallet-ethereum = { path = "../../frame/ethereum" }
ethereum = { version = "0.5", features = ["with-codec"] }
ethereum = { version = "0.6", features = ["with-codec"] }
codec = { package = "parity-scale-codec", version = "1.0.0" }
rlp = "0.4"
rlp = "0.5"
futures = { version = "0.3.1", features = ["compat"] }
sha3 = "0.8"
rustc-hex = { version = "2.1.0", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions client/rpc/src/eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use sc_network::{NetworkService, ExHashT};
use fc_rpc_core::{EthApi as EthApiT, NetApi as NetApiT, Web3Api as Web3ApiT};
use fc_rpc_core::types::{
BlockNumber, Bytes, CallRequest, Filter, FilteredParams, Index, Log, Receipt, RichBlock,
SyncStatus, SyncInfo, Transaction, Work, Rich, Block, BlockTransactions, VariadicValue,
SyncStatus, SyncInfo, Transaction, Work, Rich, Block, BlockTransactions,
TransactionRequest, PendingTransactions, PendingTransaction,
};
use fp_rpc::{EthereumRuntimeRPCApi, ConvertTransaction, TransactionStatus};
Expand Down Expand Up @@ -187,7 +187,7 @@ fn transaction_build(
gas: transaction.gas_limit,
input: Bytes(transaction.clone().input),
creates: status.as_ref().map_or(None, |status| status.contract_address),
raw: Bytes(rlp::encode(&transaction)),
raw: Bytes(rlp::encode(&transaction).to_vec()),
public_key: pubkey.as_ref().map(|pk| H512::from(pk)),
chain_id: transaction.signature.chain_id().map(U64::from),
standard_v: U256::from(transaction.signature.standard_v()),
Expand Down
8 changes: 4 additions & 4 deletions frame/ethereum/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ sp-runtime = { version = "2.0.0-dev", default-features = false, git = "https://g
sp-std = { version = "2.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "frontier" }
sp-io = { version = "2.0.0-dev", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "frontier" }
fp-evm = { version = "0.8.0", default-features = false, path = "../../primitives/evm" }
evm = { version = "0.20.0", features = ["with-codec"], default-features = false }
ethereum = { version = "0.5", default-features = false, features = ["with-codec"] }
ethereum-types = { version = "0.9", default-features = false }
rlp = { version = "0.4", default-features = false }
evm = { version = "0.21.0", features = ["with-codec"], default-features = false }
ethereum = { version = "0.6", default-features = false, features = ["with-codec"] }
ethereum-types = { version = "0.10", default-features = false }
rlp = { version = "0.5", default-features = false }
sha3 = { version = "0.8", default-features = false }
libsecp256k1 = { version = "0.3", default-features = false }
fp-consensus = { path = "../../primitives/consensus", default-features = false }
Expand Down
4 changes: 2 additions & 2 deletions frame/ethereum/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ impl<T: Config> Module<T> {
target,
input.clone(),
value,
gas_limit.low_u32(),
gas_limit.low_u64(),
gas_price,
nonce,
config.as_ref().unwrap_or(T::config()),
Expand All @@ -414,7 +414,7 @@ impl<T: Config> Module<T> {
from,
input.clone(),
value,
gas_limit.low_u32(),
gas_limit.low_u64(),
gas_price,
nonce,
config.as_ref().unwrap_or(T::config()),
Expand Down
28 changes: 12 additions & 16 deletions frame/ethereum/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ use super::*;
use crate::{Module, Config, IntermediateStateRoot};
use ethereum::{TransactionAction, TransactionSignature};
use frame_support::{
impl_outer_origin, parameter_types, weights::Weight, ConsensusEngineId
impl_outer_origin, parameter_types, ConsensusEngineId
};
use pallet_evm::{FeeCalculator, AddressMapping, EnsureAddressTruncated};
use rlp::*;
use sp_core::{H160, H256, U256};
use sp_runtime::{
testing::Header,
traits::{BlakeTwo256, IdentityLookup},
ModuleId, Perbill,
ModuleId,
};
use sp_runtime::AccountId32;

Expand All @@ -44,36 +44,32 @@ impl_outer_origin! {
pub struct Test;
parameter_types! {
pub const BlockHashCount: u64 = 250;
pub const MaximumBlockWeight: Weight = 1024;
pub const MaximumBlockLength: u32 = 2 * 1024;
pub const AvailableBlockRatio: Perbill = Perbill::from_percent(75);
pub BlockWeights: frame_system::limits::BlockWeights =
frame_system::limits::BlockWeights::simple_max(1024);
}
impl frame_system::Config for Test {
type BaseCallFilter = ();
type SystemWeightInfo = ();
type BlockWeights = ();
type BlockLength = ();
type DbWeight = ();
type Origin = Origin;
type Call = ();
type Index = u64;
type BlockNumber = u64;
type Hash = H256;
type Call = ();
type Hashing = BlakeTwo256;
type AccountId = AccountId32;
type Lookup = IdentityLookup<Self::AccountId>;
type Header = Header;
type Event = ();
type BlockHashCount = BlockHashCount;
type MaximumBlockWeight = MaximumBlockWeight;
type DbWeight = ();
type BlockExecutionWeight = ();
type ExtrinsicBaseWeight = ();
type MaximumExtrinsicWeight = MaximumBlockWeight;
type MaximumBlockLength = MaximumBlockLength;
type AvailableBlockRatio = AvailableBlockRatio;
type Version = ();
type PalletInfo = ();
type AccountData = pallet_balances::AccountData<u64>;
type OnNewAccount = ();
type OnKilledAccount = ();
type SystemWeightInfo = ();
type SS58Prefix = ();
}

parameter_types! {
Expand Down Expand Up @@ -221,7 +217,7 @@ pub fn contract_address(sender: H160, nonce: u64) -> H160 {
rlp.append(&sender);
rlp.append(&nonce);

H160::from_slice(&Keccak256::digest(rlp.out().as_slice())[12..])
H160::from_slice(&Keccak256::digest(&rlp.out())[12..])
}

pub fn storage_address(sender: H160, slot: H256) -> H256 {
Expand Down Expand Up @@ -256,7 +252,7 @@ impl UnsignedTransaction {
fn signing_hash(&self) -> H256 {
let mut stream = RlpStream::new();
self.signing_rlp_append(&mut stream);
H256::from_slice(&Keccak256::digest(&stream.drain()).as_slice())
H256::from_slice(&Keccak256::digest(&stream.out()).as_slice())
}

pub fn sign(&self, key: &H256) -> Transaction {
Expand Down
10 changes: 5 additions & 5 deletions frame/evm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ sp-runtime = { version = "2.0.0", default-features = false, git = "https://githu
sp-std = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "frontier" }
sp-io = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "frontier" }
fp-evm = { version = "0.8.0", default-features = false, path = "../../primitives/evm" }
primitive-types = { version = "0.7.0", default-features = false, features = ["rlp", "byteorder"] }
rlp = { version = "0.4", default-features = false }
evm = { version = "0.20.0", default-features = false, features = ["with-codec"] }
evm-runtime = { version = "0.20.0", default-features = false }
evm-gasometer = { version = "0.20.0", default-features = false }
primitive-types = { version = "0.8.0", default-features = false, features = ["rlp", "byteorder"] }
rlp = { version = "0.5", default-features = false }
evm = { version = "0.21.0", default-features = false, features = ["with-codec"] }
evm-runtime = { version = "0.21.0", default-features = false }
evm-gasometer = { version = "0.21.0", default-features = false }
sha3 = { version = "0.8", default-features = false }

[features]
Expand Down
2 changes: 1 addition & 1 deletion frame/evm/precompile/blake2/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ description = "BLAKE2 precompiles for EVM pallet."
sp-core = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "frontier" }
sp-io = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "frontier" }
fp-evm = { version = "0.8.0", default-features = false, path = "../../../../primitives/evm" }
evm = { version = "0.20.0", default-features = false, features = ["with-codec"] }
evm = { version = "0.21.0", default-features = false, features = ["with-codec"] }

[features]
default = ["std"]
Expand Down
6 changes: 3 additions & 3 deletions frame/evm/precompile/blake2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ use evm::{ExitSucceed, ExitError};
pub struct Blake2F;

impl LinearCostPrecompile for Blake2F {
const BASE: usize = 15;
const WORD: usize = 3;
const BASE: u64 = 15;
const WORD: u64 = 3;

/// Format of `input`:
/// [4 bytes for rounds][64 bytes for h][128 bytes for m][8 bytes for t_0][8 bytes for t_1][1 byte for f]
fn execute(
input: &[u8],
_: usize,
_: u64,
) -> core::result::Result<(ExitSucceed, Vec<u8>), ExitError> {
const BLAKE2_F_ARG_LEN: usize = 213;

Expand Down
2 changes: 1 addition & 1 deletion frame/evm/precompile/bn128/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ description = "BN128 precompiles for EVM pallet."
sp-core = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "frontier" }
sp-io = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "frontier" }
fp-evm = { version = "0.8.0", default-features = false, path = "../../../../primitives/evm" }
evm = { version = "0.20.0", default-features = false, features = ["with-codec"] }
evm = { version = "0.21.0", default-features = false, features = ["with-codec"] }
bn = { package = "substrate-bn", version = "0.5", default-features = false }

[features]
Expand Down
18 changes: 9 additions & 9 deletions frame/evm/precompile/bn128/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ fn read_point(input: &[u8], start_inx: usize) -> Result<bn::G1, ExitError> {
pub struct Bn128Add;

impl LinearCostPrecompile for Bn128Add {
const BASE: usize = 15;
const WORD: usize = 3;
const BASE: u64 = 15;
const WORD: u64 = 3;

fn execute(
input: &[u8],
_: usize,
_: u64,
) -> core::result::Result<(ExitSucceed, Vec<u8>), ExitError> {
use bn::AffineG1;

Expand All @@ -73,12 +73,12 @@ impl LinearCostPrecompile for Bn128Add {
pub struct Bn128Mul;

impl LinearCostPrecompile for Bn128Mul {
const BASE: usize = 15;
const WORD: usize = 3;
const BASE: u64 = 15;
const WORD: u64 = 3;

fn execute(
input: &[u8],
_: usize,
_: u64,
) -> core::result::Result<(ExitSucceed, Vec<u8>), ExitError> {
use bn::AffineG1;

Expand All @@ -100,12 +100,12 @@ impl LinearCostPrecompile for Bn128Mul {
pub struct Bn128Pairing;

impl LinearCostPrecompile for Bn128Pairing {
const BASE: usize = 15;
const WORD: usize = 3;
const BASE: u64 = 15;
const WORD: u64 = 3;

fn execute(
input: &[u8],
_: usize,
_: u64,
) -> core::result::Result<(ExitSucceed, Vec<u8>), ExitError> {
use bn::{AffineG1, AffineG2, Fq, Fq2, pairing_batch, G1, G2, Gt, Group};

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 @@ -14,7 +14,7 @@ sp-io = { version = "2.0.0", default-features = false, git = "https://github.com
frame-support = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "frontier" }
pallet-evm = { version = "2.0.0", default-features = false, path = "../.." }
fp-evm = { version = "0.8.0", default-features = false, path = "../../../../primitives/evm" }
evm = { version = "0.20.0", default-features = false, features = ["with-codec"] }
evm = { version = "0.21.0", default-features = false, features = ["with-codec"] }
codec = { package = "parity-scale-codec", version = "1.3.5", default-features = false }

[features]
Expand Down
4 changes: 2 additions & 2 deletions frame/evm/precompile/dispatch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ impl<T> Precompile for Dispatch<T> where
{
fn execute(
input: &[u8],
target_gas: Option<usize>,
target_gas: Option<u64>,
context: &Context,
) -> core::result::Result<(ExitSucceed, Vec<u8>, usize), ExitError> {
) -> core::result::Result<(ExitSucceed, Vec<u8>, u64), ExitError> {
let call = T::Call::decode(&mut &input[..]).map_err(|_| ExitError::Other("decode failed".into()))?;
let info = call.get_dispatch_info();

Expand Down
2 changes: 1 addition & 1 deletion frame/evm/precompile/ed25519/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ description = "ED25519 precompiles for EVM pallet."
sp-core = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "frontier" }
sp-io = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "frontier" }
fp-evm = { version = "0.8.0", default-features = false, path = "../../../../primitives/evm" }
evm = { version = "0.20.0", default-features = false, features = ["with-codec"] }
evm = { version = "0.21.0", default-features = false, features = ["with-codec"] }
ed25519-dalek = { version = "1.0.0", features = ["alloc", "u64_backend"], default-features = false }

[features]
Expand Down
10 changes: 5 additions & 5 deletions frame/evm/precompile/ed25519/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ use ed25519_dalek::{PublicKey, Verifier, Signature};
pub struct Ed25519Verify;

impl LinearCostPrecompile for Ed25519Verify {
const BASE: usize = 15;
const WORD: usize = 3;
const BASE: u64 = 15;
const WORD: u64 = 3;

fn execute(
input: &[u8],
_: usize,
_: u64,
) -> core::result::Result<(ExitSucceed, Vec<u8>), ExitError> {
if input.len() < 128 {
return Err(ExitError::Other("input must contain 128 bytes".into()));
Expand Down Expand Up @@ -70,7 +70,7 @@ mod tests {
fn test_empty_input() -> std::result::Result<(), ExitError> {

let input: [u8; 0] = [];
let cost: usize = 1;
let cost: u64 = 1;

match Ed25519Verify::execute(&input, cost) {
Ok((_, _)) => {
Expand Down Expand Up @@ -112,7 +112,7 @@ mod tests {
input.extend_from_slice(&signature.to_bytes());
assert_eq!(input.len(), 128);

let cost: usize = 1;
let cost: u64 = 1;

match Ed25519Verify::execute(&input, cost) {
Ok((_, output)) => {
Expand Down
2 changes: 1 addition & 1 deletion frame/evm/precompile/modexp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ description = "MODEXP precompiles for EVM pallet."
sp-core = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "frontier" }
sp-io = { version = "2.0.0", default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "frontier" }
fp-evm = { version = "0.8.0", default-features = false, path = "../../../../primitives/evm" }
evm = { version = "0.20.0", default-features = false, features = ["with-codec"] }
evm = { version = "0.21.0", default-features = false, features = ["with-codec"] }
num = { version = "0.3", features = ["alloc"], default-features = false }

[dev-dependencies]
Expand Down
Loading

0 comments on commit bdbabac

Please sign in to comment.