Skip to content

Commit

Permalink
chore(runtime): move SS58 prefix to primitives (#3604)
Browse files Browse the repository at this point in the history
  • Loading branch information
clearloop authored Dec 19, 2023
1 parent e0ddb93 commit 9e9072c
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion 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 gcli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ reqwest = { workspace = true, default-features = false, features = [ "json", "ru
etc.workspace = true
sp-io = { workspace = true, features = [ "std" ] }
sp-core = { workspace = true, features = [ "std" ] }
runtime-primitives.workspace = true
# TODO: use wasmi from workspace (#3214)
wasmi = { version = "0.30.0", features = ["std"] }

Expand All @@ -51,7 +52,6 @@ demo-messager.workspace = true
demo-new-meta.workspace = true
demo-waiter.workspace = true
gsdk = { workspace = true, features = ["testing"] }
vara-runtime = { workspace = true, features = [ "std", "dev" ] }

[build-dependencies]
which.workspace = true
Expand Down
2 changes: 1 addition & 1 deletion gcli/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pub trait App: Parser + Sync {
/// and verbose level.
async fn run(&self) -> Result<()> {
color_eyre::install()?;
sp_core::crypto::set_default_ss58_version(crate::VARA_SS58_PREFIX.into());
sp_core::crypto::set_default_ss58_version(runtime_primitives::VARA_SS58_PREFIX.into());

let name = Self::command().get_name().to_string();
let filter = match self.verbose() {
Expand Down
5 changes: 0 additions & 5 deletions gcli/tests/gear.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,3 @@ fn paths() {
}
})
}

#[test]
fn ss58_prefix() {
assert_eq!(gcli::VARA_SS58_PREFIX, vara_runtime::SS58Prefix::get());
}
3 changes: 3 additions & 0 deletions runtime/primitives/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,3 +68,6 @@ pub type Header = generic::Header<BlockNumber, BlakeTwo256>;
pub type Block = generic::Block<Header, OpaqueExtrinsic>;
/// Block ID.
pub type BlockId = generic::BlockId<Block>;

/// SS58 prefix of VARA.
pub const VARA_SS58_PREFIX: u8 = 137;
4 changes: 2 additions & 2 deletions runtime/vara/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ pub use runtime_common::{
impl_runtime_apis_plus_common, BlockHashCount, DealWithFees, AVERAGE_ON_INITIALIZE_RATIO,
GAS_LIMIT_MIN_PERCENTAGE_NUM, NORMAL_DISPATCH_RATIO, VALUE_PER_GAS,
};
pub use runtime_primitives::{AccountId, Signature};
pub use runtime_primitives::{AccountId, Signature, VARA_SS58_PREFIX};
use runtime_primitives::{Balance, BlockNumber, Hash, Index, Moment};
use sp_api::impl_runtime_apis;
use sp_core::{crypto::KeyTypeId, ConstBool, ConstU64, OpaqueMetadata, H256};
Expand Down Expand Up @@ -189,7 +189,7 @@ pub fn native_version() -> NativeVersion {

parameter_types! {
pub const Version: RuntimeVersion = VERSION;
pub const SS58Prefix: u8 = 137;
pub const SS58Prefix: u8 = VARA_SS58_PREFIX;
pub RuntimeBlockWeights: BlockWeights = runtime_common::block_weights_for(MAXIMUM_BLOCK_WEIGHT);
pub RuntimeBlockLength: BlockLength =
BlockLength::max_with_normal_ratio(5 * 1024 * 1024, NORMAL_DISPATCH_RATIO);
Expand Down

0 comments on commit 9e9072c

Please sign in to comment.