difftreelog
build update frontier
in: master
14 files changed
crates/evm-coder/Cargo.tomldiffbeforeafterboth--- a/crates/evm-coder/Cargo.toml
+++ b/crates/evm-coder/Cargo.toml
@@ -7,8 +7,8 @@
evm-coder-macros = { path = "../evm-coder-macros" }
primitive-types = { version = "0.10.1", default-features = false }
hex-literal = "0.3.3"
-ethereum = { version = "0.9", git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }
-evm-core = { default-features = false, git = "https://github.com/uniquenetwork/evm.git", branch="precompile-output-parachain" }
+ethereum = { version = "0.10.0", default-features = false }
+evm-core = { default-features = false, git = "https://github.com/uniquenetwork/evm.git", branch = "unique-weights" }
impl-trait-for-tuples = "0.2.1"
[dev-dependencies]
pallets/common/src/erc.rsdiffbeforeafterboth--- a/pallets/common/src/erc.rs
+++ b/pallets/common/src/erc.rs
@@ -1,4 +1,5 @@
pub use pallet_evm::PrecompileOutput;
+pub use pallet_evm::PrecompileResult;
use sp_core::{H160, U256};
/// Does not always represent a full collection, for RFT it is either
@@ -6,5 +7,5 @@
pub trait CommonEvmHandler {
const CODE: &'static [u8];
- fn call(self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileOutput>;
+ fn call(self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileResult>;
}
pallets/evm-coder-substrate/Cargo.tomldiffbeforeafterboth--- a/pallets/evm-coder-substrate/Cargo.toml
+++ b/pallets/evm-coder-substrate/Cargo.toml
@@ -9,7 +9,7 @@
] }
sp-std = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
sp-core = { default-features = false, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
-ethereum = { version = "0.9", git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }
+ethereum = { version = "0.10.0", default-features = false }
evm-coder = { default-features = false, path = "../../crates/evm-coder" }
pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }
pallets/evm-coder-substrate/src/lib.rsdiffbeforeafterboth--- a/pallets/evm-coder-substrate/src/lib.rs
+++ b/pallets/evm-coder-substrate/src/lib.rs
@@ -20,7 +20,8 @@
};
use frame_support::{ensure};
use pallet_evm::{
- ExitError, ExitReason, ExitRevert, ExitSucceed, PrecompileOutput, GasWeightMapping,
+ ExitError, ExitRevert, ExitSucceed, GasWeightMapping, PrecompileFailure, PrecompileOutput,
+ PrecompileResult,
};
use frame_system::ensure_signed;
pub use frame_support::dispatch::DispatchResult;
@@ -158,26 +159,28 @@
pub fn evm_to_precompile_output(
self,
result: evm_coder::execution::Result<Option<AbiWriter>>,
- ) -> Option<PrecompileOutput> {
+ ) -> Option<PrecompileResult> {
use evm_coder::execution::Error;
- let (writer, reason) = match result {
- Ok(Some(v)) => (v, ExitReason::Succeed(ExitSucceed::Returned)),
+ Some(match result {
+ Ok(Some(v)) => Ok(PrecompileOutput {
+ exit_status: ExitSucceed::Returned,
+ cost: self.initial_gas - self.gas_left(),
+ logs: self.retrieve_logs(),
+ output: v.finish(),
+ }),
Ok(None) => return None,
Err(Error::Revert(e)) => {
let mut writer = AbiWriter::new_call(evm_coder::fn_selector!(Error(string)));
(&e as &str).abi_write(&mut writer);
- (writer, ExitReason::Revert(ExitRevert::Reverted))
+ Err(PrecompileFailure::Revert {
+ exit_status: ExitRevert::Reverted,
+ cost: self.initial_gas - self.gas_left(),
+ output: writer.finish(),
+ })
}
- Err(Error::Fatal(f)) => (AbiWriter::new(), ExitReason::Fatal(f)),
- Err(Error::Error(e)) => (AbiWriter::new(), ExitReason::Error(e)),
- };
-
- Some(PrecompileOutput {
- cost: self.initial_gas - self.gas_left(),
- exit_status: reason,
- logs: self.retrieve_logs(),
- output: writer.finish(),
+ Err(Error::Fatal(f)) => Err(f.into()),
+ Err(Error::Error(e)) => Err(e.into()),
})
}
@@ -234,7 +237,7 @@
mut e: E,
value: value,
input: &[u8],
- ) -> Option<PrecompileOutput> {
+ ) -> Option<PrecompileResult> {
let result = call_internal(caller, &mut e, value, input);
e.into_recorder().evm_to_precompile_output(result)
}
pallets/evm-contract-helpers/src/eth.rsdiffbeforeafterboth--- a/pallets/evm-contract-helpers/src/eth.rs
+++ b/pallets/evm-contract-helpers/src/eth.rs
@@ -1,7 +1,10 @@
use core::marker::PhantomData;
use evm_coder::{abi::AbiWriter, execution::Result, generate_stubgen, solidity_interface, types::*};
use pallet_evm_coder_substrate::{SubstrateRecorder, WithRecorder};
-use pallet_evm::{ExitReason, ExitRevert, OnCreate, OnMethodCall, PrecompileOutput};
+use pallet_evm::{
+ ExitReason, ExitRevert, OnCreate, OnMethodCall, PrecompileOutput, PrecompileResult,
+ PrecompileFailure,
+};
use sp_core::H160;
use crate::{
AllowlistEnabled, Config, Owner, Pallet, SelfSponsoring, SponsorBasket, SponsoringRateLimit,
@@ -109,19 +112,18 @@
gas_left: u64,
input: &[u8],
value: sp_core::U256,
- ) -> Option<PrecompileOutput> {
+ ) -> Option<PrecompileResult> {
// TODO: Extract to another OnMethodCall handler
if <AllowlistEnabled<T>>::get(target) && !<Pallet<T>>::allowed(*target, *source) {
- return Some(PrecompileOutput {
- exit_status: ExitReason::Revert(ExitRevert::Reverted),
+ return Some(Err(PrecompileFailure::Revert {
+ exit_status: ExitRevert::Reverted,
cost: 0,
output: {
let mut writer = AbiWriter::new_call(evm_coder::fn_selector!(Error(string)));
writer.string("Target contract is allowlisted");
writer.finish()
},
- logs: sp_std::vec![],
- });
+ }));
}
if target != &T::ContractAddress::get() {
pallets/evm-migration/src/lib.rsdiffbeforeafterboth--- a/pallets/evm-migration/src/lib.rs
+++ b/pallets/evm-migration/src/lib.rs
@@ -98,7 +98,7 @@
_gas_left: u64,
_input: &[u8],
_value: sp_core::U256,
- ) -> Option<pallet_evm::PrecompileOutput> {
+ ) -> Option<pallet_evm::PrecompileResult> {
None
}
pallets/fungible/Cargo.tomldiffbeforeafterboth--- a/pallets/fungible/Cargo.toml
+++ b/pallets/fungible/Cargo.toml
@@ -19,7 +19,7 @@
nft-data-structs = { default-features = false, path = '../../primitives/nft' }
evm-coder = { default-features = false, path = '../../crates/evm-coder' }
pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }
-ethereum = { git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }
+ethereum = { version = "0.10.0", default-features = false }
frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
scale-info = { version = "1.0.0", default-features = false, features = [
"derive",
pallets/fungible/src/erc.rsdiffbeforeafterboth--- a/pallets/fungible/src/erc.rs
+++ b/pallets/fungible/src/erc.rs
@@ -2,7 +2,7 @@
use core::convert::TryInto;
use evm_coder::{ToLog, execution::*, generate_stubgen, solidity_interface, types::*, weight};
use nft_data_structs::CollectionMode;
-use pallet_common::erc::CommonEvmHandler;
+use pallet_common::erc::{CommonEvmHandler, PrecompileResult};
use sp_core::{H160, U256};
use sp_std::vec::Vec;
use pallet_common::account::CrossAccountId;
@@ -127,7 +127,7 @@
impl<T: Config> CommonEvmHandler for FungibleHandle<T> {
const CODE: &'static [u8] = include_bytes!("./stubs/UniqueFungible.raw");
- fn call(self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileOutput> {
+ fn call(self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileResult> {
call::<T, UniqueFungibleCall<T>, _>(*source, self, value, input)
}
}
pallets/nft/Cargo.tomldiffbeforeafterboth1################################################################################2# Package34[package]5authors = ['Unique Network <support@uniquenetwork.io>']6description = 'Substrate node nft'7edition = '2018'8homepage = 'https://unique.network'9license = 'All Rights Reserved'10name = 'pallet-nft'11repository = 'https://github.com/usetech-llc/nft_private/'12version = '3.0.0'1314[package.metadata.docs.rs]15targets = ['x86_64-unknown-linux-gnu']1617[features]18default = ['std']19runtime-benchmarks = ['frame-benchmarking', 'pallet-common/runtime-benchmarks']20std = [21 'codec/std',22 'serde/std',23 'frame-support/std',24 'frame-system/std',25 'pallet-balances/std',26 'pallet-evm/std',27 'pallet-timestamp/std',28 'pallet-randomness-collective-flip/std',29 'pallet-transaction-payment/std',30 'pallet-common/std',31 'pallet-fungible/std',32 'pallet-nonfungible/std',33 'pallet-refungible/std',34 'fp-evm/std',35 'nft-data-structs/std',36 'up-sponsorship/std',37 'up-evm-mapping/std',38 'sp-std/std',39 'sp-api/std',40 'sp-runtime/std',41 'frame-benchmarking/std',42 'ethereum/std',43 'rlp/std',4445 'primitive-types/std',46 'evm-coder/std',47 'pallet-evm-coder-substrate/std',48]49limit-testing = ["nft-data-structs/limit-testing"]5051################################################################################52# Substrate Dependencies5354[dependencies.codec]55default-features = false56features = ['derive']57package = 'parity-scale-codec'58version = '2.3.0'5960[dependencies.frame-benchmarking]61default-features = false62optional = true63git = 'https://github.com/paritytech/substrate.git'64branch = 'polkadot-v0.9.12'6566[dependencies.frame-support]67default-features = false68git = 'https://github.com/paritytech/substrate.git'69branch = 'polkadot-v0.9.12'7071[dependencies.frame-system]72default-features = false73git = 'https://github.com/paritytech/substrate.git'74branch = 'polkadot-v0.9.12'7576[dependencies.pallet-balances]77default-features = false78git = 'https://github.com/paritytech/substrate.git'79branch = 'polkadot-v0.9.12'8081[dependencies.pallet-timestamp]82default-features = false83git = 'https://github.com/paritytech/substrate.git'84branch = 'polkadot-v0.9.12'8586[dependencies.pallet-randomness-collective-flip]87default-features = false88git = 'https://github.com/paritytech/substrate.git'89branch = 'polkadot-v0.9.12'9091[dependencies.sp-std]92default-features = false93git = 'https://github.com/paritytech/substrate.git'94branch = 'polkadot-v0.9.12'9596[dependencies.pallet-transaction-payment]97default-features = false98git = 'https://github.com/paritytech/substrate.git'99branch = 'polkadot-v0.9.12'100101[dependencies.serde]102default-features = false103features = ['derive']104version = '1.0.130'105106[dependencies.sp-runtime]107default-features = false108git = 'https://github.com/paritytech/substrate.git'109branch = 'polkadot-v0.9.12'110111[dependencies.sp-core]112default-features = false113git = 'https://github.com/paritytech/substrate.git'114branch = 'polkadot-v0.9.12'115116[dependencies.sp-io]117default-features = false118git = 'https://github.com/paritytech/substrate.git'119branch = 'polkadot-v0.9.12'120121122################################################################################123# Local Dependencies124125[dependencies.nft-data-structs]126default-features = false127path = '../../primitives/nft'128version = '0.9.0'129130[dependencies]131scale-info = { version = "1.0.0", default-features = false, features = [132 "derive",133] }134ethereum = { version = "0.9", git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }135rlp = { default-features = false, version = "0.5.0" }136sp-api = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.12" }137138up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/UniqueNetwork/pallet-sponsoring" }139up-evm-mapping = { default-features = false, path = "../../primitives/evm-mapping" }140evm-coder = { default-features = false, path = "../../crates/evm-coder" }141pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }142primitive-types = { version = "0.10.1", default-features = false, features = [143 "serde_no_std",144] }145146pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }147pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }148fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }149hex-literal = "0.3.3"150151pallet-common = { default-features = false, path = "../common" }152pallet-fungible = { default-features = false, path = "../fungible" }153pallet-nonfungible = { default-features = false, path = "../nonfungible" }154pallet-refungible = { default-features = false, path = "../refungible" }1################################################################################2# Package34[package]5authors = ['Unique Network <support@uniquenetwork.io>']6description = 'Substrate node nft'7edition = '2018'8homepage = 'https://unique.network'9license = 'All Rights Reserved'10name = 'pallet-nft'11repository = 'https://github.com/usetech-llc/nft_private/'12version = '3.0.0'1314[package.metadata.docs.rs]15targets = ['x86_64-unknown-linux-gnu']1617[features]18default = ['std']19runtime-benchmarks = ['frame-benchmarking', 'pallet-common/runtime-benchmarks']20std = [21 'codec/std',22 'serde/std',23 'frame-support/std',24 'frame-system/std',25 'pallet-balances/std',26 'pallet-evm/std',27 'pallet-timestamp/std',28 'pallet-randomness-collective-flip/std',29 'pallet-transaction-payment/std',30 'pallet-common/std',31 'pallet-fungible/std',32 'pallet-nonfungible/std',33 'pallet-refungible/std',34 'fp-evm/std',35 'nft-data-structs/std',36 'up-sponsorship/std',37 'up-evm-mapping/std',38 'sp-std/std',39 'sp-api/std',40 'sp-runtime/std',41 'frame-benchmarking/std',42 'ethereum/std',43 'rlp/std',4445 'primitive-types/std',46 'evm-coder/std',47 'pallet-evm-coder-substrate/std',48]49limit-testing = ["nft-data-structs/limit-testing"]5051################################################################################52# Substrate Dependencies5354[dependencies.codec]55default-features = false56features = ['derive']57package = 'parity-scale-codec'58version = '2.3.0'5960[dependencies.frame-benchmarking]61default-features = false62optional = true63git = 'https://github.com/paritytech/substrate.git'64branch = 'polkadot-v0.9.12'6566[dependencies.frame-support]67default-features = false68git = 'https://github.com/paritytech/substrate.git'69branch = 'polkadot-v0.9.12'7071[dependencies.frame-system]72default-features = false73git = 'https://github.com/paritytech/substrate.git'74branch = 'polkadot-v0.9.12'7576[dependencies.pallet-balances]77default-features = false78git = 'https://github.com/paritytech/substrate.git'79branch = 'polkadot-v0.9.12'8081[dependencies.pallet-timestamp]82default-features = false83git = 'https://github.com/paritytech/substrate.git'84branch = 'polkadot-v0.9.12'8586[dependencies.pallet-randomness-collective-flip]87default-features = false88git = 'https://github.com/paritytech/substrate.git'89branch = 'polkadot-v0.9.12'9091[dependencies.sp-std]92default-features = false93git = 'https://github.com/paritytech/substrate.git'94branch = 'polkadot-v0.9.12'9596[dependencies.pallet-transaction-payment]97default-features = false98git = 'https://github.com/paritytech/substrate.git'99branch = 'polkadot-v0.9.12'100101[dependencies.serde]102default-features = false103features = ['derive']104version = '1.0.130'105106[dependencies.sp-runtime]107default-features = false108git = 'https://github.com/paritytech/substrate.git'109branch = 'polkadot-v0.9.12'110111[dependencies.sp-core]112default-features = false113git = 'https://github.com/paritytech/substrate.git'114branch = 'polkadot-v0.9.12'115116[dependencies.sp-io]117default-features = false118git = 'https://github.com/paritytech/substrate.git'119branch = 'polkadot-v0.9.12'120121122################################################################################123# Local Dependencies124125[dependencies.nft-data-structs]126default-features = false127path = '../../primitives/nft'128version = '0.9.0'129130[dependencies]131scale-info = { version = "1.0.0", default-features = false, features = [132 "derive",133] }134ethereum = { version = "0.10.0", default-features = false }135rlp = { default-features = false, version = "0.5.0" }136sp-api = { default-features = false, git = "https://github.com/paritytech/substrate.git", branch = "polkadot-v0.9.12" }137138up-sponsorship = { version = "0.1.0", default-features = false, git = "https://github.com/UniqueNetwork/pallet-sponsoring" }139up-evm-mapping = { default-features = false, path = "../../primitives/evm-mapping" }140evm-coder = { default-features = false, path = "../../crates/evm-coder" }141pallet-evm-coder-substrate = { default-features = false, path = "../../pallets/evm-coder-substrate" }142primitive-types = { version = "0.10.1", default-features = false, features = [143 "serde_no_std",144] }145146pallet-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }147pallet-ethereum = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }148fp-evm = { default-features = false, git = "https://github.com/uniquenetwork/frontier.git", branch = "unique-polkadot-v0.9.12-weights" }149hex-literal = "0.3.3"150151pallet-common = { default-features = false, path = "../common" }152pallet-fungible = { default-features = false, path = "../fungible" }153pallet-nonfungible = { default-features = false, path = "../nonfungible" }154pallet-refungible = { default-features = false, path = "../refungible" }pallets/nft/src/eth/mod.rsdiffbeforeafterboth--- a/pallets/nft/src/eth/mod.rs
+++ b/pallets/nft/src/eth/mod.rs
@@ -1,5 +1,6 @@
pub mod sponsoring;
+use fp_evm::PrecompileResult;
use pallet_common::{
CollectionById,
erc::CommonEvmHandler,
@@ -10,7 +11,6 @@
use pallet_refungible::{RefungibleHandle, erc::RefungibleTokenHandle};
use sp_std::borrow::ToOwned;
use sp_std::vec::Vec;
-use pallet_evm::{PrecompileOutput};
use sp_core::{H160, U256};
use crate::{CollectionMode, Config, dispatch::Dispatched};
use pallet_common::CollectionHandle;
@@ -54,7 +54,7 @@
gas_limit: u64,
input: &[u8],
value: U256,
- ) -> Option<PrecompileOutput> {
+ ) -> Option<PrecompileResult> {
if let Some(collection_id) = map_eth_to_id(target) {
let collection = <CollectionHandle<T>>::new_with_gas_limit(collection_id, gas_limit)?;
let dispatched = Dispatched::dispatch(collection);
pallets/nft/src/eth/sponsoring.rsdiffbeforeafterboth--- a/pallets/nft/src/eth/sponsoring.rs
+++ b/pallets/nft/src/eth/sponsoring.rs
@@ -27,7 +27,7 @@
let (method_id, mut reader) = AbiReader::new_call(&call.1).ok()?;
match &collection.mode {
crate::CollectionMode::NFT => {
- let call = UniqueNFTCall::parse(method_id, &mut reader).ok()??;
+ let call = <UniqueNFTCall<T>>::parse(method_id, &mut reader).ok()??;
match call {
UniqueNFTCall::ERC721UniqueExtensions(
ERC721UniqueExtensionsCall::Transfer { token_id, .. },
@@ -49,7 +49,7 @@
}
}
crate::CollectionMode::Fungible(_) => {
- let call = UniqueFungibleCall::parse(method_id, &mut reader).ok()??;
+ let call = <UniqueFungibleCall<T>>::parse(method_id, &mut reader).ok()??;
#[allow(clippy::single_match)]
match call {
UniqueFungibleCall::ERC20(ERC20Call::Transfer { .. }) => {
pallets/nonfungible/Cargo.tomldiffbeforeafterboth--- a/pallets/nonfungible/Cargo.toml
+++ b/pallets/nonfungible/Cargo.toml
@@ -19,7 +19,7 @@
nft-data-structs = { default-features = false, path = '../../primitives/nft' }
evm-coder = { default-features = false, path = '../../crates/evm-coder' }
pallet-evm-coder-substrate = { default-features = false, path = '../evm-coder-substrate' }
-ethereum = { git = "https://github.com/purestake/ethereum", branch = "joshy-scale-info", default-features = false }
+ethereum = { version = "0.10.0", default-features = false }
frame-benchmarking = { default-features = false, optional = true, git = 'https://github.com/paritytech/substrate.git', branch = 'polkadot-v0.9.12' }
scale-info = { version = "1.0.0", default-features = false, features = [
"derive",
pallets/nonfungible/src/erc.rsdiffbeforeafterboth--- a/pallets/nonfungible/src/erc.rs
+++ b/pallets/nonfungible/src/erc.rs
@@ -8,7 +8,10 @@
use pallet_evm_coder_substrate::dispatch_to_evm;
use sp_core::{H160, U256};
use sp_std::{vec::Vec, vec};
-use pallet_common::{account::CrossAccountId, erc::CommonEvmHandler};
+use pallet_common::{
+ account::CrossAccountId,
+ erc::{CommonEvmHandler, PrecompileResult},
+};
use pallet_evm_coder_substrate::call;
use pallet_common::erc::PrecompileOutput;
@@ -434,7 +437,7 @@
impl<T: Config> CommonEvmHandler for NonfungibleHandle<T> {
const CODE: &'static [u8] = include_bytes!("./stubs/UniqueNFT.raw");
- fn call(self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileOutput> {
+ fn call(self, source: &H160, input: &[u8], value: U256) -> Option<PrecompileResult> {
call::<T, UniqueNFTCall<T>, _>(*source, self, value, input)
}
}
pallets/refungible/src/erc.rsdiffbeforeafterboth--- a/pallets/refungible/src/erc.rs
+++ b/pallets/refungible/src/erc.rs
@@ -11,7 +11,7 @@
_source: &sp_core::H160,
_input: &[u8],
_value: sp_core::U256,
- ) -> Option<pallet_common::erc::PrecompileOutput> {
+ ) -> Option<pallet_common::erc::PrecompileResult> {
// TODO: Implement RFT variant of ERC721
None
}
@@ -27,7 +27,7 @@
_source: &sp_core::H160,
_input: &[u8],
_value: sp_core::U256,
- ) -> Option<pallet_common::erc::PrecompileOutput> {
+ ) -> Option<pallet_common::erc::PrecompileResult> {
// TODO: Implement RFT variant of ERC20
None
}