Skip to content

Commit b1e45cd

Browse files
authored
P-901: replace orml with pallet_assets (#2895)
* feat: initial replace orml with pallet_assets * chore * chore * chore: cargo lock * chore: rust toolchain * chore: rust toolchain * debug: copy right * debug: copy right * feat: use polkadot frontier instead * feat: using polkadot frontier * debug: add utils locally * chore * chore * chore * chore * feat: improve evm precompiles * chore * chore * chore * chore * chore * chore * chore * chore * chore * chore * chore * chore * chore * chore: cargo lock * chore * chore * chore * chore * chore * chore: try make sp-runtime with std feature * chore * chore * chore * chore * chore: precompiles utils macro with features to include sp-runtime std feature * chore: clippy * chore * chore * chore: limit pallet_assets creating origin * chore * chore: use Fungibles instead of Orml trait in test * fix * chore * chore * chore * chore * chore * chore * chore * chore * chore * chore * chore * chore * chore: repalce pallet_assets impl with stricter prohibit creating * chore * chore * chore * chore: weird clippy, allow items_after_test_module * debug: fix std feature * chore * chore * chore * chore * chore: this should work * chore * chore: try replace with sp-runtime std * chore * chore: I do not want to change in this way, but need confirm why * chore * chore * chore * chore * chore * feat: exclude precompiles-utils as memebrs to avoid clippy check * chore * debug: add missing asset registing for testing * chore: Cargo lock * feat: rely on external package for avoiding all-features clippy check * feat: disable integration ts test on precompile * debug: add comment/license --------- Signed-off-by: WMQ <46511820+wangminqi@users.noreply.github.com>
1 parent 6d7bc4d commit b1e45cd

File tree

50 files changed

+2712
-3483
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+2712
-3483
lines changed

Cargo.lock

Lines changed: 189 additions & 44 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ members = [
1717
'pallets/teebag',
1818
'pallets/vc-management',
1919
'pallets/xcm-asset-manager',
20-
'precompiles/*',
21-
'precompiles/utils/macro',
2220
'primitives/core',
2321
'primitives/core/proc-macros',
2422
'primitives/core/macros',
@@ -59,6 +57,8 @@ clap = { version = "4.3", features = ["derive"] }
5957
der = { version = "0.6.0", default-features = false }
6058
derive_more = { version = "0.99" }
6159
env_logger = { version = "0.10.2" }
60+
environmental = { version = "1.1.2", default-features = false }
61+
evm = { version = "0.41.1", default-features = false }
6262
impl-trait-for-tuples = { version = "0.2.2" }
6363
log = { version = "0.4", default-features = false }
6464
proc-macro2 = { version = "1" }
@@ -68,6 +68,7 @@ scale-info = { version = "2.11", default-features = false, features = ["derive"]
6868
parity-scale-codec = { version = "3.6", default-features = false, features = ["derive", "max-encoded-len"] }
6969
serde = { version = "1.0", default-features = false, features = ["derive", "alloc"] }
7070
serde_json = { version = "1.0", default-features = false }
71+
slices = { version = "0.2.0" }
7172
hex = { version = "0.4", default-features = false }
7273
hex-literal = { version = "0.4.1", default-features = false }
7374
similar-asserts = { version = "1.5.0" }
@@ -161,6 +162,7 @@ sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "
161162
sp-blockchain = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
162163
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
163164
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
165+
sp-core-hashing = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
164166
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
165167
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
166168
sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
@@ -179,6 +181,7 @@ frame-support = { git = "https://github.com/paritytech/substrate", branch = "pol
179181
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
180182
frame-system-rpc-runtime-api = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
181183
frame-try-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
184+
pallet-assets = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
182185
pallet-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
183186
pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
184187
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.42", default-features = false }
@@ -223,7 +226,6 @@ pallet-collator-selection = { git = "https://github.com/paritytech/cumulus", bra
223226
parachain-info = { git = "https://github.com/paritytech/cumulus", branch = "polkadot-v0.9.42", default-features = false }
224227

225228
substrate-fixed = { git = "https://github.com/encointer/substrate-fixed", default-features = false }
226-
orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.42", default-features = false }
227229
orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.42", default-features = false }
228230
orml-xtokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.42", default-features = false }
229231

@@ -257,10 +259,13 @@ pallet-parachain-staking = { path = "pallets/parachain-staking", default-feature
257259
pallet-score-staking = { path = "pallets/score-staking", default-features = false }
258260
pallet-teebag = { path = "pallets/teebag", default-features = false }
259261
pallet-vc-management = { path = "pallets/vc-management", default-features = false }
260-
precompile-utils = { path = "precompiles/utils", default-features = false }
262+
pallet-evm-precompile-assets-erc20 = { path = "precompiles/assets-erc20", default-features = false }
261263
pallet-evm-precompile-bridge-transfer = { path = "precompiles/bridge-transfer", default-features = false }
262264
pallet-evm-precompile-parachain-staking = { path = "precompiles/parachain-staking", default-features = false }
263265
pallet-evm-assertions = { path = "pallets/evm-assertions", default-features = false }
266+
# This is a temporary pallet copy from Astar with polkadot-0.9.43
267+
# The official release of this pallet will be in frontier repo
268+
precompile-utils = { git = "https://github.com/litentry/precompile-utils", branch = "main", default-features = false }
264269

265270
[patch.crates-io]
266271
ring = { git = "https://github.com/betrusted-io/ring-xous", branch = "0.16.20-cleanup" }

bitacross-worker/docker/litentry/rococo-dev-2106.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
"polkadotXcm": {
118118
"safeXcmVersion": 3
119119
},
120-
"tokens": {
120+
"assets": {
121121
"balances": []
122122
},
123123
"identityManagement": {

node/src/chain_specs/litentry.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ fn generate_genesis(
230230
parachain_system: Default::default(),
231231
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) },
232232
transaction_payment: Default::default(),
233-
tokens: Default::default(),
233+
assets: Default::default(),
234234
teebag: TeebagConfig {
235235
allow_sgx_debug_mode: true,
236236
admin: None,

node/src/chain_specs/litmus.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ fn generate_genesis(
239239
parachain_system: Default::default(),
240240
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) },
241241
transaction_payment: Default::default(),
242-
tokens: Default::default(),
242+
assets: Default::default(),
243243
teebag: TeebagConfig {
244244
allow_sgx_debug_mode: true,
245245
admin: None,

node/src/chain_specs/rococo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ fn generate_genesis(
247247
polkadot_xcm: PolkadotXcmConfig { safe_xcm_version: Some(SAFE_XCM_VERSION) },
248248
vc_management: VCManagementConfig { admin: Some(root_key.clone()) },
249249
transaction_payment: Default::default(),
250-
tokens: Default::default(),
250+
assets: Default::default(),
251251
ethereum: Default::default(),
252252
evm: Default::default(),
253253
teebag: TeebagConfig {

node/src/tracing.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
// You should have received a copy of the GNU General Public License
1515
// along with Litentry. If not, see <https://www.gnu.org/licenses/>.
1616

17-
///! EVM tracing RPC support.
17+
//! EVM tracing RPC support.
1818
use crate::evm_tracing_types::{EthApi as EthApiCmd, EvmTracingConfig};
1919

2020
use fc_rpc::OverrideHandle;

pallets/bridge-transfer/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ pub mod pallet {
4545

4646
type ResourceId = bridge::ResourceId;
4747

48-
type BalanceOf<T> = <<T as bridge::Config>::Currency as Currency<
48+
pub type BalanceOf<T> = <<T as bridge::Config>::Currency as Currency<
4949
<T as frame_system::Config>::AccountId,
5050
>>::Balance;
5151

pallets/bridge/src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,10 @@ pub mod pallet {
4242
pallet_prelude::*,
4343
{self as system},
4444
};
45-
use parity_scale_codec::{Decode, Encode, EncodeLike};
46-
use scale_info::TypeInfo;
45+
use parity_scale_codec::EncodeLike;
4746
use sp_runtime::{
4847
traits::{AccountIdConversion, Dispatchable},
49-
RuntimeDebug, SaturatedConversion,
48+
SaturatedConversion,
5049
};
5150
use sp_std::prelude::*;
5251

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,54 @@
11
[package]
2+
name = "pallet-evm-precompile-assets-erc20"
23
authors = ["Trust Computing GmbH <info@litentry.com>"]
34
edition = '2021'
4-
name = 'precompile-utils'
55
version = '0.1.0'
66

77
[dependencies]
8-
assert_matches = { workspace = true }
9-
impl-trait-for-tuples = { workspace = true }
108
log = { workspace = true }
119
num_enum = { workspace = true }
12-
parity-scale-codec = { workspace = true }
13-
sha3 = { workspace = true }
14-
similar-asserts = { workspace = true, optional = true }
10+
slices = { workspace = true }
1511

16-
precompile-utils-macro = { path = "macro" }
12+
precompile-utils = { workspace = true }
1713

18-
fp-evm = { workspace = true }
14+
# Substrate
1915
frame-support = { workspace = true }
2016
frame-system = { workspace = true }
21-
pallet-evm = { workspace = true }
17+
pallet-assets = { workspace = true }
18+
pallet-balances = { workspace = true }
19+
parity-scale-codec = { workspace = true, features = ["max-encoded-len"] }
2220
sp-core = { workspace = true }
2321
sp-io = { workspace = true }
2422
sp-runtime = { workspace = true }
2523
sp-std = { workspace = true }
26-
xcm = { workspace = true }
2724

28-
# There's a problem with --all-features when this is moved under dev-deps
29-
evm = { git = "https://github.com/rust-blockchain/evm", rev = "b7b82c7e1fc57b7449d6dfa6826600de37cc1e65", default-features = false, optional = true }
25+
# Frontier
26+
fp-evm = { workspace = true }
27+
pallet-evm = { workspace = true }
3028

3129
[dev-dependencies]
32-
hex-literal = { workspace = true }
30+
derive_more = { workspace = true }
31+
serde = { workspace = true }
32+
sha3 = { workspace = true }
33+
scale-info = { workspace = true }
34+
35+
precompile-utils = { workspace = true, features = ["testing"] }
36+
pallet-timestamp = { workspace = true, features = ["std"] }
3337

3438
[features]
3539
default = ["std"]
3640
std = [
37-
"evm/std",
3841
"parity-scale-codec/std",
3942
"fp-evm/std",
4043
"frame-support/std",
4144
"frame-system/std",
45+
"pallet-assets/std",
4246
"pallet-evm/std",
47+
"pallet-balances/std",
48+
"precompile-utils/std",
4349
"sp-core/std",
4450
"sp-io/std",
4551
"sp-runtime/std",
4652
"sp-std/std",
47-
"xcm/std",
4853
]
49-
testing = ["similar-asserts", "std"]
54+
runtime-benchmarks = []

0 commit comments

Comments
 (0)