Skip to content

Commit

Permalink
Release v6.7.0 (#1599)
Browse files Browse the repository at this point in the history
* Audit review

* Release `v6.7.0`

* Format

Signed-off-by: Xavier Lau <x@acg.box>

* Fix try-runtime

Signed-off-by: Xavier Lau <x@acg.box>

---------

Signed-off-by: Xavier Lau <x@acg.box>
  • Loading branch information
AurevoirXavier authored Sep 24, 2024
1 parent 941b687 commit 70233a7
Show file tree
Hide file tree
Showing 20 changed files with 81 additions and 43 deletions.
36 changes: 18 additions & 18 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ edition = "2021"
homepage = "https://darwinia.network"
license = "GPL-3.0"
repository = "https://github.com/darwinia-network/darwinia"
version = "6.6.5"
version = "6.7.0"

[workspace.dependencies]
# crates.io
Expand Down
2 changes: 1 addition & 1 deletion node/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
///
/// The worker binaries associated to the node binary should ensure that they are using the same
/// version as the main node that started them.
pub const NODE_VERSION: &str = "6.6.5";
pub const NODE_VERSION: &str = "6.7.0";

/// Sub-commands supported by the collator.
#[derive(Debug, clap::Subcommand)]
Expand Down
2 changes: 1 addition & 1 deletion pallet/account-migration/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pub const VERSION: sp_version::RuntimeVersion = sp_version::RuntimeVersion {
spec_name: sp_runtime::create_runtime_str!("Darwinia2"),
impl_name: sp_runtime::create_runtime_str!("DarwiniaOfficialRust"),
authoring_version: 0,
spec_version: 6_6_5_0,
spec_version: 6_6_7_0,
impl_version: 0,
apis: sp_version::create_apis_vec!([]),
transaction_version: 0,
Expand Down
3 changes: 3 additions & 0 deletions pallet/deposit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ runtime-benchmarks = [
]

try-runtime = [
# darwinia
"darwinia-ethtx-forwarder/try-runtime",

# polkadot-sdk
"frame-support/try-runtime",
"frame-system/try-runtime",
Expand Down
10 changes: 10 additions & 0 deletions pallet/ethtx-forwarder/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,16 @@ runtime-benchmarks = [
"frame-system/runtime-benchmarks",
]

try-runtime = [
# frontier
"pallet-evm/try-runtime",

# polkadot-sdk
"frame-support/try-runtime",
"frame-system/try-runtime",
"sp-runtime/try-runtime",
]

evm-tracing = [
# moonbeam
"moonbeam-evm-tracer",
Expand Down
3 changes: 3 additions & 0 deletions pallet/staking/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ runtime-benchmarks = [
]

try-runtime = [
# darwinia
"darwinia-ethtx-forwarder/try-runtime",

# polkadot-sdk
"frame-support/try-runtime",
"frame-system/try-runtime",
Expand Down
9 changes: 7 additions & 2 deletions pallet/staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,11 @@ pub mod pallet {
// let cs_from_contract = Self::elect_from_contract(n1)?;
// let cs_from_pallet = Self::elect(n2)?;
let cs_from_contract = Self::elect_from_contract(n1).unwrap_or_default();
let cs_from_pallet = Self::elect(n2).unwrap_or_default();
let cs_from_pallet = Self::elect(n2)
.unwrap_or_default()
.into_iter()
.filter(|c| !cs_from_contract.contains(c))
.collect();

log::info!("collators from contract {cs_from_contract:?}");
log::info!("collators from pallet {cs_from_pallet:?}");
Expand Down Expand Up @@ -1356,7 +1360,8 @@ where
PalletId(*b"da/staki").into_account_truncating()
}

fn now<T>() -> Moment
/// The current time in milliseconds.
pub fn now<T>() -> Moment
where
T: Config,
{
Expand Down
14 changes: 9 additions & 5 deletions pallet/staking/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,13 +266,17 @@ impl crate::Election<AccountId> for RingStaking {
.map(|i| {
let who = AccountId(i);

assert_ok!(Session::set_keys(
if Session::set_keys(
RuntimeOrigin::signed(who),
SessionKeys { uint: i.into() },
Vec::new()
));

who
Vec::new(),
)
.is_ok()
{
who
} else {
AccountId(0)
}
})
.collect(),
)
Expand Down
18 changes: 18 additions & 0 deletions pallet/staking/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -845,6 +845,24 @@ fn hybrid_election_should_work() {
});
}

#[test]
fn dedup_election_should_work() {
ExtBuilder::default().collator_count(10).build().execute_with(|| {
let who = AccountId(100);
let _ = <pallet_balances::Pallet<Runtime>>::deposit_creating(&who, 100 as _);

assert_ok!(Staking::stake(RuntimeOrigin::signed(who), 100 as _, Vec::new()));
assert_ok!(Staking::collect(RuntimeOrigin::signed(who), Perbill::zero()));
assert_ok!(Staking::nominate(RuntimeOrigin::signed(who), who));

Timestamp::set_timestamp(30 * DAY_IN_MILLIS);
new_session();
new_session();

assert_eq!(vec![who], <pallet_session::Validators<Runtime>>::get());
});
}

#[test]
fn hybrid_payout_should_work() {
ExtBuilder::default().collator_count(10).inflation_type(1).build().execute_with(|| {
Expand Down
11 changes: 0 additions & 11 deletions precompile/deposit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,15 +90,4 @@ where

Ok(true)
}

#[precompile::public("migrate(address)")]
fn migrate(handle: &mut impl PrecompileHandle, who: Address) -> EvmResult<bool> {
let origin: AccountIdOf<Runtime> = handle.context().caller.into();
RuntimeHelper::<Runtime>::try_dispatch(
handle,
Some(origin).into(),
darwinia_deposit::Call::<Runtime>::migrate { who: H160::from(who).into() },
)?;
Ok(true)
}
}
1 change: 0 additions & 1 deletion precompile/deposit/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ fn selectors() {
assert!(PCall::lock_selectors().contains(&0x998e4242));
assert!(PCall::claim_selectors().contains(&0x4e71d92d));
assert!(PCall::claim_with_penalty_selectors().contains(&0xfa04a9bf));
assert!(PCall::migrate_selectors().contains(&0xce5494bb));
}

#[test]
Expand Down
1 change: 1 addition & 0 deletions runtime/crab/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,7 @@ try-runtime = [
# darwinia
"darwinia-account-migration/try-runtime",
"darwinia-deposit/try-runtime",
"darwinia-ethtx-forwarder/try-runtime",
"darwinia-staking/try-runtime",

# frontier
Expand Down
2 changes: 1 addition & 1 deletion runtime/crab/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pub const VERSION: sp_version::RuntimeVersion = sp_version::RuntimeVersion {
spec_name: sp_runtime::create_runtime_str!("Crab2"),
impl_name: sp_runtime::create_runtime_str!("DarwiniaOfficialRust"),
authoring_version: 0,
spec_version: 6_6_5_0,
spec_version: 6_6_7_0,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 0,
Expand Down
2 changes: 2 additions & 0 deletions runtime/crab/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,8 @@ fn migrate() -> frame_support::weights::Weight {
<darwinia_staking::RingStakingContract<Runtime>>::put(who);
}

<darwinia_staking::MigrationStartPoint<Runtime>>::put(darwinia_staking::now::<Runtime>());

// frame_support::weights::Weight::zero()
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(7, 7)
}
1 change: 1 addition & 0 deletions runtime/darwinia/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ try-runtime = [
"darwinia-account-migration/try-runtime",
"darwinia-asset-limit/try-runtime",
"darwinia-deposit/try-runtime",
"darwinia-ethtx-forwarder/try-runtime",
"darwinia-staking/try-runtime",

# frontier
Expand Down
2 changes: 1 addition & 1 deletion runtime/darwinia/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pub const VERSION: sp_version::RuntimeVersion = sp_version::RuntimeVersion {
spec_name: sp_runtime::create_runtime_str!("Darwinia2"),
impl_name: sp_runtime::create_runtime_str!("DarwiniaOfficialRust"),
authoring_version: 0,
spec_version: 6_6_5_0,
spec_version: 6_6_7_0,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 0,
Expand Down
2 changes: 2 additions & 0 deletions runtime/darwinia/src/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ fn migrate() -> frame_support::weights::Weight {
<darwinia_staking::RingStakingContract<Runtime>>::put(who);
}

<darwinia_staking::MigrationStartPoint<Runtime>>::put(darwinia_staking::now::<Runtime>());

// frame_support::weights::Weight::zero()
<Runtime as frame_system::Config>::DbWeight::get().reads_writes(7, 107)
}
1 change: 1 addition & 0 deletions runtime/koi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ try-runtime = [
# darwinia
"darwinia-asset-limit/try-runtime",
"darwinia-deposit/try-runtime",
"darwinia-ethtx-forwarder/try-runtime",
"darwinia-staking/try-runtime",

# moonbeam
Expand Down
2 changes: 1 addition & 1 deletion runtime/koi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pub const VERSION: sp_version::RuntimeVersion = sp_version::RuntimeVersion {
spec_name: sp_runtime::create_runtime_str!("Darwinia Koi"),
impl_name: sp_runtime::create_runtime_str!("DarwiniaOfficialRust"),
authoring_version: 0,
spec_version: 6_6_6_2,
spec_version: 6_6_7_0,
impl_version: 0,
apis: RUNTIME_API_VERSIONS,
transaction_version: 0,
Expand Down

0 comments on commit 70233a7

Please sign in to comment.