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

To polkadot-v0.9.38 #1007

Merged
merged 195 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
195 commits
Select commit Hold shift + click to select a range
5c3606a
Darwinia 2.0
AurevoirXavier Nov 4, 2022
11780e3
Darwinia shell chain (#27)
AurevoirXavier Nov 10, 2022
1aa4cc0
Docs & formatting (#33)
AurevoirXavier Nov 11, 2022
e5dfcd6
Add EVM stuff (#30)
boundless-forest Nov 14, 2022
56b31f8
Polish RPC & service (#36)
AurevoirXavier Nov 14, 2022
4e5fac1
Extract darwinia-runtime (#32)
jiguantong Nov 15, 2022
a33bd4f
Polish service (#38)
jiguantong Nov 15, 2022
b27c66d
Enable `FrontierDb` subcommand (#37)
boundless-forest Nov 16, 2022
46c6002
Use zero existential deposit (#48)
boundless-forest Nov 17, 2022
0009119
Add messages-substrate deps (#49)
jiguantong Nov 21, 2022
28db256
Process system and balances state (#39)
AurevoirXavier Nov 21, 2022
4b40193
Add darwinia's precompiles (#50)
boundless-forest Nov 22, 2022
c841631
Use `H160` as `AccountId` (#55)
AurevoirXavier Nov 22, 2022
86e2899
Testnet preparation (#57)
AurevoirXavier Nov 22, 2022
15d93e0
Adjust genesis accounts (#59)
AurevoirXavier Nov 23, 2022
3571868
Adjust runtime and add pallets (#60)
AurevoirXavier Nov 23, 2022
e5be305
Crab & Pangolin Runtime (#56)
jiguantong Nov 25, 2022
fc0ea38
Add assets component (#69)
boundless-forest Nov 29, 2022
f12766b
Bridge related pallets (#70)
jiguantong Nov 30, 2022
e68b051
Fix #72 (#79)
jiguantong Nov 30, 2022
7845ccd
Add `message-transact` back (#74)
boundless-forest Nov 30, 2022
15ae806
Update chain id (#85)
boundless-forest Dec 2, 2022
124031d
Update parachain IDs (#89)
jiguantong Dec 5, 2022
dc9c57f
Correct block time (#93)
AurevoirXavier Dec 6, 2022
b8a195c
Add parachain staking (#68)
AurevoirXavier Dec 6, 2022
fa47263
Avoid large enum variant (#98)
AurevoirXavier Dec 6, 2022
a2d5ae8
Add account migration pallet (#86)
boundless-forest Dec 6, 2022
1720db6
Handle reference count (#102)
AurevoirXavier Dec 6, 2022
437b769
Housekeeping (#105)
AurevoirXavier Dec 6, 2022
14b7e7b
Adjust path style (#99)
jiguantong Dec 6, 2022
509bf6a
Add sudo key (#107)
AurevoirXavier Dec 6, 2022
4d167f0
Update XCM filter (#88)
jiguantong Dec 7, 2022
8943e2d
Improve code (#111)
AurevoirXavier Dec 7, 2022
97ff5cc
Update AssetId (#109)
boundless-forest Dec 7, 2022
e5b6409
Release collator staking restriction (#114)
AurevoirXavier Dec 8, 2022
4f78cb8
Account migration (#108)
AurevoirXavier Dec 8, 2022
1da4e6c
Add `staking` and `deposit` pre-compiles (#81)
boundless-forest Dec 8, 2022
222d968
Some optimization (#116)
AurevoirXavier Dec 8, 2022
d27513a
Add staking & deposit to Crab & Pangolin (#112)
jiguantong Dec 8, 2022
f2ce40c
Some adjustment (#120)
AurevoirXavier Dec 9, 2022
5b19e28
Add `bridge_parachains` pallet (#122)
jiguantong Dec 12, 2022
d4922e1
Account genesis (#123)
AurevoirXavier Dec 14, 2022
5b5a7d9
Vesting genesis (#127)
AurevoirXavier Dec 14, 2022
807b99c
Merge balance after update decimal (#128)
boundless-forest Dec 14, 2022
16ad250
Update reserve transfer filter (#130)
jiguantong Dec 15, 2022
1b9a5fc
Frontier pallets storage process (#121)
boundless-forest Dec 15, 2022
ab8261a
Configure instant sealing for dev chains (#119)
jiguantong Dec 15, 2022
d29a9bd
Optimize storage (#132)
AurevoirXavier Dec 15, 2022
b161ead
Update bridge deps (#134)
jiguantong Dec 16, 2022
4187b7b
Fix account insert key (#139)
boundless-forest Dec 20, 2022
02b2ccb
Correct `RuntimeApi` & `RuntimeExecutor` (#141)
jiguantong Dec 20, 2022
ba6a50c
Convert the rest locations to H160 by hashing it (#138)
jiguantong Dec 20, 2022
ced7f23
Process staking (#133)
AurevoirXavier Dec 20, 2022
7fd05bc
Fix vesting processor (#144)
AurevoirXavier Dec 20, 2022
c9fdfa1
Update KTON owner (#145)
AurevoirXavier Dec 20, 2022
acc0c60
Add genesis (#148)
AurevoirXavier Dec 21, 2022
e4cf09a
Clippy (#150)
AurevoirXavier Dec 21, 2022
893a46e
Fix revert (#149)
boundless-forest Dec 21, 2022
22e95f7
Fix hash key (#152)
AurevoirXavier Dec 21, 2022
08b703a
Process indices & more utility fns (#151)
AurevoirXavier Dec 21, 2022
8b46c6c
Fix contract account `sufficients` (#146)
boundless-forest Dec 22, 2022
5138fd0
Fix type & code optimization (#154)
AurevoirXavier Dec 22, 2022
49ff38c
Fix bonded prefix (#155)
AurevoirXavier Dec 22, 2022
56164de
Update type (#156)
boundless-forest Dec 22, 2022
e775dcd
Kton state migrate (#137)
boundless-forest Dec 23, 2022
5c1e385
Cross compile support (#159)
AurevoirXavier Dec 25, 2022
5c4a9c0
Improve deposit (#160)
AurevoirXavier Dec 26, 2022
d8885cd
Some fixes (#162)
AurevoirXavier Dec 27, 2022
7a322a7
Improve config for pallet_bridge_grandpa (#161)
fewensa Dec 27, 2022
a29b2cc
Improve kton migration (#163)
AurevoirXavier Dec 28, 2022
85b70e2
Use `DealWithFees` in `transaction_payment` (#164)
Dec 29, 2022
77c6788
Add `claim_with_penalty` interface (#165)
boundless-forest Dec 29, 2022
60766d0
Handle different account types (#168)
AurevoirXavier Dec 30, 2022
d21847e
State process test (#153)
boundless-forest Jan 3, 2023
114f3fe
Happy new year (#170)
AurevoirXavier Jan 3, 2023
431c1b1
Process proxy and support generic runtime (#172)
AurevoirXavier Jan 4, 2023
015eed1
Adjust XCM trader (#143)
Jan 4, 2023
2e78ca7
Adjust common functions (#167)
Jan 4, 2023
7a77e00
Pangolin2 preparation (#174)
AurevoirXavier Jan 4, 2023
459beca
Add darwinia dispatch precompile (#173)
boundless-forest Jan 4, 2023
702cdea
Process sudo (#177)
AurevoirXavier Jan 5, 2023
511c26e
Fixes (#179)
AurevoirXavier Jan 5, 2023
0a7b510
Fund Alith (#182)
AurevoirXavier Jan 5, 2023
95ef1e9
Optional download (#183)
AurevoirXavier Jan 5, 2023
5bb61bf
Fix processor tests (#175)
boundless-forest Jan 5, 2023
b57fb01
ECDSA authority (#184)
AurevoirXavier Jan 6, 2023
f348232
Add `restake` and fix some bugs (#188)
AurevoirXavier Jan 6, 2023
82b9a73
Add restake interface (#189)
boundless-forest Jan 9, 2023
f720b56
Add `Proxy` tests (#190)
boundless-forest Jan 9, 2023
f15a0bc
Improve existing check (#191)
AurevoirXavier Jan 9, 2023
b0686ee
Modify testnet time (#192)
AurevoirXavier Jan 10, 2023
756fcaf
`account-migration` runtime tests (#169)
boundless-forest Jan 11, 2023
db36081
Human readable sign message (#195)
AurevoirXavier Jan 11, 2023
7982fa7
Update proxy filter (#197)
AurevoirXavier Jan 11, 2023
0fae7a1
Use features check action (#198)
AurevoirXavier Jan 11, 2023
943d7c4
Merge collator payout (#200)
AurevoirXavier Jan 12, 2023
c9f54e3
Refactor runtime tests (#204)
AurevoirXavier Jan 12, 2023
9c05f55
Test only code (#206)
AurevoirXavier Jan 13, 2023
9317165
Fix precompiles genesis (#207)
boundless-forest Jan 13, 2023
0c7cfa0
Use check runtime action (#208)
AurevoirXavier Jan 13, 2023
a32342f
To `polkadot-v0.9.33` and some other changes (#171)
Jan 16, 2023
ed7da51
pallet-identity state process (#124)
boundless-forest Jan 16, 2023
cadfb76
Keep identity judgments (#210)
AurevoirXavier Jan 17, 2023
5aaffee
Bump toolchain to `nightly-2022-11-15` (#212)
AurevoirXavier Jan 17, 2023
2301211
Add metadata for front end (#219)
AurevoirXavier Jan 18, 2023
8f08de1
Burn parachain backing RING (#218)
AurevoirXavier Jan 18, 2023
ca2dd66
Fix state judgement (#222)
boundless-forest Jan 18, 2023
a7bfc4a
Readable address (#224)
AurevoirXavier Jan 18, 2023
3ad6cc8
Add missing field (#226)
AurevoirXavier Jan 19, 2023
668fde3
Fix `try-runtime` (#223)
boundless-forest Jan 19, 2023
cf9038f
Adjust session consumer part.1 (#229)
AurevoirXavier Jan 19, 2023
77f399d
Clean unused deps (#228)
Jan 19, 2023
a266d90
Adapt PolkadotJS (#231)
AurevoirXavier Jan 19, 2023
8ba1ff7
Release Pangolin2 (#225)
AurevoirXavier Jan 19, 2023
ff23cac
State types check (#230)
boundless-forest Jan 28, 2023
14f9beb
Account migration signer tool (#235)
AurevoirXavier Jan 29, 2023
4a9ea62
Update docs (#237)
boundless-forest Jan 29, 2023
be849d0
Fix call indexes (#238)
AurevoirXavier Jan 30, 2023
d1a3b8c
Fix signer cli (#239)
boundless-forest Jan 30, 2023
0626861
Improve testing (#241)
AurevoirXavier Jan 31, 2023
3399b66
Rebuild accounts' reservation (#242)
AurevoirXavier Feb 1, 2023
1537527
Add EVM tests (#234)
boundless-forest Feb 2, 2023
dae3f31
Use `impl_self_contained_call` (#250)
boundless-forest Feb 2, 2023
aa17f3e
Rebuild account reference counters (#249)
AurevoirXavier Feb 2, 2023
9fc1dad
Add evm checks (#252)
AurevoirXavier Feb 2, 2023
40d7eaa
Clean empty ledger (#253)
AurevoirXavier Feb 3, 2023
4d1b188
Add bridge extension validation (#251)
boundless-forest Feb 3, 2023
6aa85cd
Add `reserve` and `references count` tests (#259)
boundless-forest Feb 7, 2023
7ecbe10
Handle special accounts (#265)
AurevoirXavier Feb 7, 2023
60d19da
Add staging workflow (#258)
fewensa Feb 7, 2023
ead3449
To `polkadot-v0.9.36` (#213)
Feb 7, 2023
b69b7b5
Migrate `pallet-assets` (#260)
boundless-forest Feb 8, 2023
93aff17
Clean imports (#271)
AurevoirXavier Feb 8, 2023
9057d49
Migrate multisig (#272)
AurevoirXavier Feb 9, 2023
0e336a2
Add special accounts migration test (#268)
boundless-forest Feb 9, 2023
4c13c4c
Update state storage filter (#273)
boundless-forest Feb 9, 2023
1a63edb
Manage runtime through features (#274)
AurevoirXavier Feb 9, 2023
6a75a6a
Total issuance assertions (#276)
AurevoirXavier Feb 10, 2023
a661f99
Process parachain system (#278)
AurevoirXavier Feb 13, 2023
efb9440
Try workspace's new feature (#277)
boundless-forest Feb 14, 2023
ef31b59
Rename `Staking` to `DarwiniaStaking` (#279)
AurevoirXavier Feb 14, 2023
af75e3a
Format (#280)
AurevoirXavier Feb 14, 2023
49a48eb
Add Pangoro2 (#281)
AurevoirXavier Feb 15, 2023
e6c048c
To `polkadot-v0.9.37` (#266)
Feb 15, 2023
59e08ee
Pangolin2 `6005` runtime upgrade (#283)
AurevoirXavier Feb 15, 2023
a3403ce
Set payout fraction to 40% (#284)
AurevoirXavier Feb 16, 2023
62c77fd
Add evm estimate gas tests (#282)
boundless-forest Feb 16, 2023
19f643c
Fix ethereum block author (#286)
boundless-forest Feb 17, 2023
8f2c12a
Pangolin2 <> Pangoro2 bridge (#285)
Feb 20, 2023
6117f68
Update nonce test (#288)
boundless-forest Feb 20, 2023
85157b7
Remove assertions in HRMP&DMP (#290)
Feb 20, 2023
c46aa63
Preparation of Pangoro2 (#291)
AurevoirXavier Feb 20, 2023
f24def2
Update evm module runtime name (#293)
boundless-forest Feb 22, 2023
6132743
Bench upstream pallets (#292)
Feb 22, 2023
f81ccd3
Add benchmarking items and bench darwinia-deposit (#294)
AurevoirXavier Feb 22, 2023
31b79c5
Auto load large genesis (#295)
AurevoirXavier Feb 23, 2023
3ae132a
Fix broken CI (#296)
boundless-forest Feb 24, 2023
0f93b32
Remove multisig (#299)
AurevoirXavier Feb 24, 2023
5356f0b
Update Pangoro2 parachain id (#304)
AurevoirXavier Feb 27, 2023
b2b0305
Update cross compile docker image (#303)
AurevoirXavier Feb 27, 2023
8ddcaa4
Easy make (#305)
AurevoirXavier Feb 27, 2023
9253372
Update EthBlockGasLimit (#306)
boundless-forest Mar 1, 2023
b490d8d
Anchor v0.9.38
Mar 1, 2023
c92e180
Companion for paritytech/cumulus#2067
Mar 2, 2023
4140e16
Companion for paritytech/cumulus#697 XCM v3
Mar 2, 2023
8a59e12
Companion for paritytech/cumulus#2096
Mar 2, 2023
373ef3b
Companion for paritytech/cumulus#1863
Mar 2, 2023
3506b41
Companion for paritytech/cumulus#2073
Mar 2, 2023
e1ca540
Companion for paritytech/cumulus#2126
Mar 2, 2023
857a05a
Use prepare branch
Mar 2, 2023
5acfb7e
Companion for paritytech/substrate#13216
Mar 2, 2023
7c67b90
Companion for darwinia-messages-substrate#254
Mar 2, 2023
412a7eb
Companion for paritytech/polkadot#4097
Mar 2, 2023
8c6a3fd
Part companion for paritytech/cumulus#2067
Mar 2, 2023
25a7b33
Correct companion for cumulus#2073
Mar 2, 2023
fe23fd2
Fix xcm compilation
Mar 2, 2023
d36bd4d
Fix compilation done
Mar 2, 2023
731a4e6
Fix compilation with benchmark
Mar 2, 2023
b3b86e2
Replace prepare branch
Mar 2, 2023
0d4adba
Format
Mar 2, 2023
027ffd3
Merge branch 'main' of https://github.com/darwinia-network/darwinia i…
Mar 9, 2023
9d424b6
Merge branch 'main' into guantong/prepare-polkadot-v0.9.38
Mar 22, 2023
a1ff86d
Fix compile
Mar 22, 2023
3367203
Merge branch 'main' into guantong/prepare-polkadot-v0.9.38
AurevoirXavier Mar 24, 2023
9d4fd65
Format
Mar 24, 2023
30b8964
Fix CI check features
Mar 24, 2023
a6d030e
Merge branch 'main' into guantong/prepare-polkadot-v0.9.38
AurevoirXavier Mar 24, 2023
9bf6c37
Format
AurevoirXavier Mar 27, 2023
c8e5609
Patch cumulus assertion branch v0.9.38
Mar 28, 2023
e42cf68
Companion for paritytech/cumulus#2287
Mar 28, 2023
ebe2dec
Remove unused polkadot-service
Mar 28, 2023
287bac7
Merge branch 'main' into guantong/prepare-polkadot-v0.9.38
Mar 28, 2023
9832e82
Merge branch 'main' into guantong/prepare-polkadot-v0.9.38
jiguantong Mar 28, 2023
64556ff
Revert changes
AurevoirXavier Mar 28, 2023
379c577
Format
AurevoirXavier Mar 28, 2023
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
902 changes: 472 additions & 430 deletions Cargo.lock

Large diffs are not rendered by default.

461 changes: 149 additions & 312 deletions Cargo.toml

Large diffs are not rendered by default.

6 changes: 2 additions & 4 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ substrate-build-script-utils = { workspace = true }
# crates.io
array-bytes = { workspace = true }
async-trait = { version = "0.1" }
clap = { version = "4.0", features = ["derive"] }
clap = { version = "4.1", features = ["derive"] }
codec = { workspace = true, package = "parity-scale-codec" }
futures = { version = "0.3" }
jsonrpsee = { version = "0.16", features = ["server"] }
Expand Down Expand Up @@ -52,12 +52,11 @@ fp-storage = { workspace = true }
# polkadot
polkadot-cli = { workspace = true }
polkadot-primitives = { workspace = true }
polkadot-service = { workspace = true }
xcm = { workspace = true }

# substrate
frame-benchmarking = { workspace = true, optional = true }
frame-benchmarking-cli = { workspace = true, optional = true }
frame-benchmarking-cli = { workspace = true }
pallet-transaction-payment-rpc = { workspace = true }
sc-basic-authorship = { workspace = true }
sc-chain-spec = { workspace = true }
Expand Down Expand Up @@ -119,7 +118,6 @@ runtime-benchmarks = [

# substrate
"frame-benchmarking",
"frame-benchmarking-cli",
]

try-runtime = [
Expand Down
9 changes: 3 additions & 6 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -652,14 +652,11 @@ pub fn run() -> Result<()> {

runner.run_node_until_exit(|config| async move {
let chain_spec = &config.chain_spec;
let hwbench = if !cli.no_hardware_benchmarks {
let hwbench = (!cli.no_hardware_benchmarks).then_some(
config.database.path().map(|database_path| {
let _ = std::fs::create_dir_all(database_path);
sc_sysinfo::gather_hwbench(Some(database_path))
})
} else {
None
};
})).flatten();

set_default_ss58_version(chain_spec);

Expand All @@ -672,7 +669,7 @@ pub fn run() -> Result<()> {
);
let id = ParaId::from(para_id);
let parachain_account =
AccountIdConversion::<polkadot_primitives::v2::AccountId>::into_account_truncating(&id);
AccountIdConversion::<polkadot_primitives::AccountId>::into_account_truncating(&id);
let state_version = Cli::native_runtime_version(&config.chain_spec).state_version();
let block: Block =
cumulus_client_cli::generate_genesis_block(&*config.chain_spec, state_version)
Expand Down
17 changes: 11 additions & 6 deletions node/src/service/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,12 +312,7 @@ where
hwbench.clone(),
)
.await
.map_err(|e| match e {
cumulus_relay_chain_interface::RelayChainError::ServiceError(
polkadot_service::Error::Sub(x),
) => x,
s => s.to_string().into(),
})?;
.map_err(|e| sc_service::Error::Application(Box::new(e) as Box<_>))?;

let block_announce_validator =
cumulus_client_network::BlockAnnounceValidator::new(relay_chain_interface.clone(), para_id);
Expand Down Expand Up @@ -418,6 +413,16 @@ where

if let Some(hwbench) = hwbench {
sc_sysinfo::print_hwbench(&hwbench);
// Here you can check whether the hardware meets your chains' requirements. Putting a link
// in there and swapping out the requirements for your own are probably a good idea. The
// requirements for a para-chain are dictated by its relay-chain.
if !frame_benchmarking_cli::SUBSTRATE_REFERENCE_HARDWARE.check_hardware(&hwbench)
&& validator
{
log::warn!(
"⚠️ The hardware does not meet the minimal requirements for role 'Authority'."
);
}

if let Some(ref mut telemetry) = telemetry {
let telemetry_handle = telemetry.handle();
Expand Down
5 changes: 4 additions & 1 deletion pallet/message-gadget/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,7 @@ std = [
"sp-io/std",
]

try-runtime = ["frame-support/try-runtime"]
try-runtime = [
# substrate
"frame-support/try-runtime",
]
7 changes: 6 additions & 1 deletion pallet/message-transact/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,9 @@ std = [
"sp-std/std",
]

try-runtime = ["frame-support/try-runtime"]
runtime-benchmarks = []

try-runtime = [
# substrate
"frame-support/try-runtime",
]
12 changes: 9 additions & 3 deletions pallet/message-transact/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ use fp_ethereum::{TransactionData, ValidatedTransaction};
use fp_evm::{CheckEvmTransaction, CheckEvmTransactionConfig, InvalidEvmTransactionError};
use pallet_evm::{FeeCalculator, GasWeightMapping};
// substrate
use frame_support::{traits::EnsureOrigin, PalletError, RuntimeDebug};
use frame_support::{
sp_runtime::traits::BadOrigin, traits::EnsureOrigin, PalletError, RuntimeDebug,
};
use sp_core::{H160, U256};
use sp_std::boxed::Box;

Expand All @@ -63,15 +65,19 @@ impl<O: Into<Result<LcmpEthOrigin, O>> + From<LcmpEthOrigin>> EnsureOrigin<O>
{
type Success = H160;

fn ensure_origin(o: O) -> Result<Self::Success, BadOrigin> {
Self::try_origin(o).map_err(|_| BadOrigin)
}

fn try_origin(o: O) -> Result<Self::Success, O> {
o.into().map(|o| match o {
LcmpEthOrigin::MessageTransact(id) => id,
})
}

#[cfg(feature = "runtime-benchmarks")]
fn successful_origin() -> O {
O::from(LcmpEthOrigin::MessageTransact(Default::default()))
fn try_successful_origin() -> Result<O, ()> {
Ok(O::from(LcmpEthOrigin::MessageTransact(Default::default())))
}
}

Expand Down
8 changes: 0 additions & 8 deletions pallet/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -992,14 +992,6 @@ where
fn note_author(author: T::AccountId) {
Self::reward_by_ids(&[(author, 20)])
}

fn note_uncle(uncle_author: T::AccountId, _age: T::BlockNumber) {
if let Some(block_author) = <pallet_authorship::Pallet<T>>::author() {
Self::reward_by_ids(&[(block_author, 2), (uncle_author, 1)])
} else {
log::error!("[pallet::staking] block author not set, this should never happen; qed");
}
}
}

// Play the role of the session manager.
Expand Down
25 changes: 12 additions & 13 deletions runtime/common/src/xcm_configs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ where
{
fn should_execute<RuntimeCall>(
origin: &MultiLocation,
message: &mut Xcm<RuntimeCall>,
max_weight: XcmWeight,
weight_credit: &mut XcmWeight,
message: &mut [Instruction<RuntimeCall>],
max_weight: Weight,
weight_credit: &mut Weight,
) -> Result<(), ()> {
Deny::should_execute(origin, message, max_weight, weight_credit)?;
Allow::should_execute(origin, message, max_weight, weight_credit)
Expand All @@ -83,12 +83,11 @@ pub struct DenyReserveTransferToRelayChain;
impl ShouldExecute for DenyReserveTransferToRelayChain {
fn should_execute<RuntimeCall>(
origin: &MultiLocation,

message: &mut Xcm<RuntimeCall>,
_max_weight: XcmWeight,
_weight_credit: &mut XcmWeight,
message: &mut [Instruction<RuntimeCall>],
_max_weight: Weight,
_weight_credit: &mut Weight,
) -> Result<(), ()> {
if message.0.iter().any(|inst| {
if message.iter().any(|inst| {
matches!(
inst,
InitiateReserveWithdraw {
Expand All @@ -107,7 +106,7 @@ impl ShouldExecute for DenyReserveTransferToRelayChain {
// An unexpected reserve transfer has arrived from the Relay Chain. Generally, `IsReserve`
// should not allow this, but we just log it here.
if matches!(origin, MultiLocation { parents: 1, interior: Here })
&& message.0.iter().any(|inst| matches!(inst, ReserveAssetDeposited { .. }))
&& message.iter().any(|inst| matches!(inst, ReserveAssetDeposited { .. }))
{
log::warn!(
target: "xcm::barriers",
Expand Down Expand Up @@ -147,7 +146,7 @@ pub struct LocalAssetTrader<
OnUnbalanced: OnUnbalancedT<Currency::NegativeImbalance>,
R: TakeRevenue,
>(
XcmWeight,
Weight,
Currency::Balance,
PhantomData<(WeightToFee, AssetId, AccountId, Currency, OnUnbalanced, R)>,
);
Expand All @@ -161,12 +160,12 @@ impl<
> WeightTrader for LocalAssetTrader<WeightToFee, AssetId, AccountId, Currency, OnUnbalanced, R>
{
fn new() -> Self {
Self(0, Zero::zero(), PhantomData)
Self(Weight::zero(), Zero::zero(), PhantomData)
}

fn buy_weight(&mut self, weight: XcmWeight, payment: Assets) -> Result<Assets, XcmError> {
log::trace!(target: "xcm::weight", "LocalAssetTrader::buy_weight weight: {:?}, payment: {:?}", weight, payment);
let amount = WeightToFee::weight_to_fee(&Weight::from_ref_time(weight));
let amount = WeightToFee::weight_to_fee(&weight);
let u128_amount: u128 = amount.try_into().map_err(|_| XcmError::Overflow)?;
let required: MultiAsset = (Concrete(AssetId::get()), u128_amount).into();
let unused = payment.checked_sub(required.clone()).map_err(|_| XcmError::TooExpensive)?;
Expand All @@ -179,7 +178,7 @@ impl<
fn refund_weight(&mut self, weight: XcmWeight) -> Option<MultiAsset> {
log::trace!(target: "xcm::weight", "LocalAssetTrader::refund_weight weight: {:?}", weight);
let weight = weight.min(self.0);
let amount = WeightToFee::weight_to_fee(&Weight::from_ref_time(weight));
let amount = WeightToFee::weight_to_fee(&weight);
self.0 -= weight;
self.1 = self.1.saturating_sub(amount);
let amount: u128 = amount.saturated_into();
Expand Down
1 change: 1 addition & 0 deletions runtime/crab/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ runtime-benchmarks = [
"darwinia-common-runtime/runtime-benchmarks",
"darwinia-deposit/runtime-benchmarks",
"darwinia-ecdsa-authority/runtime-benchmarks",
"darwinia-message-transact/runtime-benchmarks",
"darwinia-staking/runtime-benchmarks",

# darwinia-messages-substrate
Expand Down
1 change: 0 additions & 1 deletion runtime/crab/src/bridges_message/darwinia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ impl MessageBridge for WithDarwiniaMessageBridge {
const BRIDGED_CHAIN_ID: bp_runtime::ChainId = DARWINIA_CHAIN_ID;
const BRIDGED_MESSAGES_PALLET_NAME: &'static str =
bridge_runtime_common::pallets::WITH_CRAB_MESSAGES_PALLET_NAME;
const RELAYER_FEE_PERCENT: u32 = 10;
const THIS_CHAIN_ID: bp_runtime::ChainId = CRAB_CHAIN_ID;
}

Expand Down
12 changes: 12 additions & 0 deletions runtime/crab/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,12 @@ sp_api::impl_runtime_apis! {
) -> pallet_transaction_payment::FeeDetails<Balance> {
TransactionPayment::query_fee_details(uxt, len)
}
fn query_weight_to_fee(weight: frame_support::weights::Weight) -> Balance {
TransactionPayment::weight_to_fee(weight)
}
fn query_length_to_fee(length: u32) -> Balance {
TransactionPayment::length_to_fee(length)
}
}

impl pallet_transaction_payment_rpc_runtime_api::TransactionPaymentCallApi<Block, Balance, RuntimeCall>
Expand All @@ -329,6 +335,12 @@ sp_api::impl_runtime_apis! {
) -> pallet_transaction_payment::FeeDetails<Balance> {
TransactionPayment::query_call_fee_details(call, len)
}
fn query_weight_to_fee(weight: frame_support::weights::Weight) -> Balance {
TransactionPayment::weight_to_fee(weight)
}
fn query_length_to_fee(length: u32) -> Balance {
TransactionPayment::length_to_fee(length)
}
}

impl cumulus_primitives_core::CollectCollationInfo<Block> for Runtime {
Expand Down
2 changes: 0 additions & 2 deletions runtime/crab/src/pallets/authorship.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,5 @@ use crate::*;

impl pallet_authorship::Config for Runtime {
type EventHandler = (DarwiniaStaking,);
type FilterUncle = ();
type FindAuthor = pallet_session::FindAccountFromAuthorIndex<Self, Aura>;
type UncleGenerations = ConstU32<0>;
}
Loading