Skip to content

Commit

Permalink
Update gsdk metadata
Browse files Browse the repository at this point in the history
  • Loading branch information
breathx committed Sep 14, 2023
1 parent 4e263f0 commit 4a7432b
Show file tree
Hide file tree
Showing 5 changed files with 1,589 additions and 7,780 deletions.
18 changes: 7 additions & 11 deletions gsdk/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use std::{
const GSDK_API_GEN: &str = "GSDK_API_GEN";
const GSDK_API_GEN_PKG: &str = "gsdk-api-gen";
const GSDK_API_GEN_RELATIVE_PATH: &str = "gsdk-api-gen";
const VARA_RUNTIME_PKG: &str = "vara-runtime";
const VARA_RUNTIME_RELATIVE_PATH: &str = "wbuild/vara-runtime/vara_runtime.compact.compressed.wasm";
const RUNTIME_PKG: &str = "gear-runtime";
const RUNTIME_RELATIVE_PATH: &str = "wbuild/gear-runtime/gear_runtime.compact.compressed.wasm";
const GENERATED_API_PATH: &str = "src/metadata/generated.rs";
const ENV_RUNTIME_WASM: &str = "RUNTIME_WASM";

Expand Down Expand Up @@ -37,21 +37,17 @@ fn generate_api() -> Vec<u8> {
let root = env!("CARGO_MANIFEST_DIR");
let profile = env::var("PROFILE").expect("Environment PROFILE not found.");

// NOTE: use vara here since vara includes all pallets gear have,
// and the API we are building here is for both vara and gear.
let [vara_runtime, api_gen] = [
(
VARA_RUNTIME_RELATIVE_PATH,
VARA_RUNTIME_PKG,
vec!["debug-mode"],
),
// NOTE: use gear here since gear includes all pallets vara have that we use,
// and the API we are building here is for both gear and vara.
let [gear_runtime, api_gen] = [
(RUNTIME_RELATIVE_PATH, RUNTIME_PKG, vec!["debug-mode"]),
(GSDK_API_GEN_RELATIVE_PATH, GSDK_API_GEN_PKG, vec![]),
]
.map(|(relative_path, pkg, features)| get_path(root, &profile, relative_path, pkg, features));

// Generate api
let code = Command::new(api_gen)
.env(ENV_RUNTIME_WASM, vara_runtime)
.env(ENV_RUNTIME_WASM, gear_runtime)
.output()
.expect("Failed to generate client api.")
.stdout;
Expand Down
56 changes: 28 additions & 28 deletions gsdk/src/metadata/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,21 +61,21 @@ macro_rules! export_module_error {
error: raw.error,
},
}),*,
// `pallet_fellowship_referenda => 19`
//
// shares the same error with
//
// `pallet_fellowship_collective => 18`
19 => {
let mb_error = RanckedCollective::decode(&mut raw.error.as_ref());
match mb_error {
Ok(e) => ModuleError::RanckedCollective(e),
Err(_) => ModuleError::Unknown {
pallet_index: raw.pallet_index,
error: raw.error,
},
}
},
// // `pallet_fellowship_referenda => 19`
// //
// // shares the same error with
// //
// // `pallet_fellowship_collective => 18`
// 19 => {
// let mb_error = RanckedCollective::decode(&mut raw.error.as_ref());
// match mb_error {
// Ok(e) => ModuleError::RanckedCollective(e),
// Err(_) => ModuleError::Unknown {
// pallet_index: raw.pallet_index,
// error: raw.error,
// },
// }
// },
_ => ModuleError::Unknown {
pallet_index: raw.pallet_index,
error: raw.error,
Expand Down Expand Up @@ -104,22 +104,22 @@ export_module_error! {
frame_system => System => 0,
pallet_grandpa => Grandpa => 4,
pallet_balances => Balances => 5,
pallet_vesting => Vesting => 10,
pallet_bags_list => BagsList => 11,
pallet_im_online => ImOnline => 12,
pallet_staking::pallet => Staking => 13,
// pallet_vesting => Vesting => 10,
// pallet_bags_list => BagsList => 11,
// pallet_im_online => ImOnline => 12,
// pallet_staking::pallet => Staking => 13,
pallet_session => Session => 7,
pallet_treasury => Treasury => 14,
pallet_conviction_voting => ConvictionVoting => 16,
pallet_referenda => Referenda => 17,
pallet_ranked_collective => RanckedCollective => 18,
pallet_whitelist => Whitelist => 21,
// pallet_treasury => Treasury => 14,
// pallet_conviction_voting => ConvictionVoting => 16,
// pallet_referenda => Referenda => 17,
// pallet_ranked_collective => RanckedCollective => 18,
// pallet_whitelist => Whitelist => 21,
pallet_sudo => Sudo => 99,
pallet_scheduler => Scheduler => 22,
pallet_preimage => Preimage => 23,
pallet_identity => Identity => 24,
// pallet_scheduler => Scheduler => 22,
// pallet_preimage => Preimage => 23,
// pallet_identity => Identity => 24,
pallet_utility => Utility => 8,
pallet_gear => Gear => 104,
pallet_gear_staking_rewards => GearStakingRewards => 106,
// pallet_gear_staking_rewards => GearStakingRewards => 106,
pallet_gear_debug => GearDebug => 199
}
Loading

0 comments on commit 4a7432b

Please sign in to comment.