Skip to content

Commit

Permalink
Astar Collator release 2.6.0 (#473)
Browse files Browse the repository at this point in the history
* Add staking precompiles & bump collator version

* Weights adjustment for Shiden and Shibuya (#475)

* Shiden: fix dapps staking block reward handle (#474)

* Migrate Shibuya into Azores relay

Co-authored-by: Dinonard <[email protected]>
  • Loading branch information
akru and Dinonard authored Oct 13, 2021
1 parent 76101ba commit eec37b6
Show file tree
Hide file tree
Showing 11 changed files with 215 additions and 175 deletions.
33 changes: 17 additions & 16 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 bin/collator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "astar-collator"
version = "2.5.2"
version = "2.6.0"
authors = ["Stake Technologies <[email protected]>"]
description = "Astar collator implementation in Rust."
build = "build.rs"
Expand Down
176 changes: 176 additions & 0 deletions bin/collator/res/azores.raw.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion bin/collator/res/shibuya.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"tokenDecimals": 18,
"tokenSymbol": "SBY"
},
"relayChain": "tokyo",
"relayChain": "azores",
"paraId": 1000,
"consensusEngine": null,
"codeSubstitutes": {},
Expand Down
2 changes: 1 addition & 1 deletion bin/collator/res/shibuya.raw.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
"tokenDecimals": 18,
"tokenSymbol": "SBY"
},
"relayChain": "tokyo",
"relayChain": "azores",
"paraId": 1000,
"consensusEngine": null,
"codeSubstitutes": {},
Expand Down
147 changes: 0 additions & 147 deletions bin/collator/res/tokyo.raw.json

This file was deleted.

6 changes: 3 additions & 3 deletions bin/collator/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,10 @@ impl SubstrateCli for RelayChainCli {
}

fn load_spec(&self, id: &str) -> std::result::Result<Box<dyn sc_service::ChainSpec>, String> {
if id == "tokyo" {
if id == "azores" {
Ok(Box::new(
polkadot_service::RococoChainSpec::from_json_bytes(
&include_bytes!("../res/tokyo.raw.json")[..],
polkadot_service::WestendChainSpec::from_json_bytes(
&include_bytes!("../res/azores.raw.json")[..],
)
.unwrap(),
))
Expand Down
2 changes: 1 addition & 1 deletion runtime/local/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "local-runtime"
version = "2.5.2"
version = "2.6.0"
authors = ["Stake Technologies <[email protected]>"]
edition = "2018"
build = "build.rs"
Expand Down
2 changes: 1 addition & 1 deletion runtime/shibuya/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "shibuya-runtime"
version = "2.5.2"
version = "2.6.0"
authors = ["Stake Technologies <[email protected]>"]
edition = "2018"
build = "build.rs"
Expand Down
4 changes: 3 additions & 1 deletion runtime/shiden/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "shiden-runtime"
version = "2.5.2"
version = "2.6.0"
authors = ["Stake Technologies <[email protected]>"]
edition = "2018"
build = "build.rs"
Expand Down Expand Up @@ -78,6 +78,7 @@ pallet-collective = { git = "https://github.com/paritytech/substrate", branch =
# Astar pallets
pallet-block-reward = { path = "../../frame/block-reward", default-features = false }
pallet-custom-signatures = { path = "../../frame/custom-signatures", default-features = false }
pallet-precompile-staking = { path = "../../precompiles/staking", default-features = false }
pallet-dapps-staking = { path = "../../frame/dapps-staking", default-features = false }

[build-dependencies]
Expand Down Expand Up @@ -116,6 +117,7 @@ std = [
"pallet-evm-precompile-dispatch/std",
"pallet-evm-precompile-modexp/std",
"pallet-evm-precompile-sha3fips/std",
"pallet-precompile-staking/std",
"pallet-dapps-staking/std",
"pallet-identity/std",
"pallet-multisig/std",
Expand Down
14 changes: 11 additions & 3 deletions runtime/shiden/src/precompiles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use pallet_evm_precompile_dispatch::Dispatch;
use pallet_evm_precompile_modexp::Modexp;
use pallet_evm_precompile_sha3fips::Sha3FIPS256;
use pallet_evm_precompile_simple::{ECRecover, ECRecoverPublicKey, Identity, Ripemd160, Sha256};
use pallet_precompile_staking::Staking;
use sp_core::H160;
use sp_std::fmt::Debug;
use sp_std::marker::PhantomData;
Expand All @@ -23,7 +24,7 @@ impl<R> ShidenNetworkPrecompiles<R> {
/// Return all addresses that contain precompiles. This can be used to populate dummy code
/// under the precompile.
pub fn used_addresses<AccountId: From<H160>>() -> impl Iterator<Item = AccountId> {
sp_std::vec![1, 2, 3, 4, 5, 6, 7, 8, 1024, 1025, 1026]
sp_std::vec![1, 2, 3, 4, 5, 6, 7, 8, 1024, 1025, 1026, 20480]
.into_iter()
.map(|x| hash(x).into())
}
Expand All @@ -32,10 +33,15 @@ impl<R> ShidenNetworkPrecompiles<R> {
/// The following distribution has been decided for the precompiles
/// 0-1023: Ethereum Mainnet Precompiles
/// 1024-2047 Precompiles that are not in Ethereum Mainnet
impl<R: pallet_evm::Config> PrecompileSet for ShidenNetworkPrecompiles<R>
impl<R> PrecompileSet for ShidenNetworkPrecompiles<R>
where
R::Call: Dispatchable<PostInfo = PostDispatchInfo> + GetDispatchInfo + Decode,
R: pallet_evm::Config + pallet_session::Config + pallet_collator_selection::Config,
<R::Call as Dispatchable>::Origin: From<Option<R::AccountId>>,
R::Call: From<pallet_session::Call<R>>
+ From<pallet_collator_selection::Call<R>>
+ Dispatchable<PostInfo = PostDispatchInfo>
+ GetDispatchInfo
+ Decode,
{
fn execute(
address: H160,
Expand All @@ -57,6 +63,8 @@ where
a if a == hash(1024) => Some(Sha3FIPS256::execute(input, target_gas, context)),
a if a == hash(1025) => Some(Dispatch::<R>::execute(input, target_gas, context)),
a if a == hash(1026) => Some(ECRecoverPublicKey::execute(input, target_gas, context)),
// Astar precompiles (starts from 0x5000):
a if a == hash(20480) => Some(Staking::<R>::execute(input, target_gas, context)),
// Default
_ => None,
}
Expand Down

0 comments on commit eec37b6

Please sign in to comment.