Skip to content

Commit

Permalink
Allow launch to accept any string (#239)
Browse files Browse the repository at this point in the history
* Allow launch to accept any string

* launch H256

* Update tests

* Update tests and dependencies
  • Loading branch information
Vourhey authored Feb 18, 2022
1 parent 5be0fb9 commit 4906440
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 16 deletions.
9 changes: 5 additions & 4 deletions Cargo.lock

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

3 changes: 2 additions & 1 deletion frame/launch/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "pallet-robonomics-launch"
description = "Robonomics Network robot launch Substrate runtime module"
version = "0.3.1"
version = "0.4.0"
authors = ["Airalab <[email protected]>"]
edition = "2018"

Expand All @@ -12,6 +12,7 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", branch = "polkad
frame-system = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false }
frame-support = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16", default-features = false, optional = true }
bs58 = "0.4.0"

[dev-dependencies]
sp-io = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.16" }
Expand Down
11 changes: 9 additions & 2 deletions frame/launch/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ mod tests {
}

impl Config for Runtime {
type Parameter = bool;
//type Parameter = bool;
type Parameter = H256;
type Event = Event;
}

Expand All @@ -150,11 +151,17 @@ mod tests {
storage.into()
}

use bs58;
#[test]
fn test_store_data() {
new_test_ext().execute_with(|| {
let sender = 1;
let param = true;
//let param = true;
let mut decoded = [0; 34];
bs58::decode("QmY91yTMHzAd9csvKtPF1b1NS5CVhdoSRz2CBwTGTxkvST")
.into(&mut decoded)
.expect("Couldn't decode from Base58");
let param = H256::from_slice(&decoded[2..34]);
let data = 0;
assert_ok!(Launch::launch(Origin::signed(sender), data, param.clone()));
})
Expand Down
2 changes: 1 addition & 1 deletion runtime/alpha/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "alpha-runtime"
version = "1.7.0"
version = "1.7.1"
authors = ["Airalab <[email protected]>"]
edition = "2018"
build = "build.rs"
Expand Down
4 changes: 2 additions & 2 deletions runtime/alpha/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ use sp_api::impl_runtime_apis;
use sp_core::{
crypto::KeyTypeId,
u32_trait::{_1, _2, _3, _5},
OpaqueMetadata,
OpaqueMetadata, H256,
};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
Expand Down Expand Up @@ -664,7 +664,7 @@ impl pallet_robonomics_datalog::Config for Runtime {
}

impl pallet_robonomics_launch::Config for Runtime {
type Parameter = bool;
type Parameter = H256;
type Event = Event;
}

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 = "1.7.0"
version = "1.7.1"
authors = ["Airalab <[email protected]>"]
edition = "2018"
build = "build.rs"
Expand Down
4 changes: 2 additions & 2 deletions runtime/local/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ use robonomics_primitives::{AccountId, Balance, BlockNumber, Hash, Index, Moment
use sp_api::impl_runtime_apis;
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_core::u32_trait::{_1, _2, _3};
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256};
use sp_inherents::{CheckInherentsResult, InherentData};
use sp_runtime::traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto, NumberFor};
use sp_runtime::transaction_validity::{TransactionSource, TransactionValidity};
Expand Down Expand Up @@ -486,7 +486,7 @@ impl pallet_robonomics_datalog::Config for Runtime {
}

impl pallet_robonomics_launch::Config for Runtime {
type Parameter = bool;
type Parameter = H256;
type Event = Event;
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/main/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "main-runtime"
version = "1.7.0"
version = "1.7.1"
authors = ["Airalab <[email protected]>"]
edition = "2018"
build = "build.rs"
Expand Down
4 changes: 2 additions & 2 deletions runtime/main/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ use pallet_transaction_payment_rpc_runtime_api::{FeeDetails, RuntimeDispatchInfo
use robonomics_primitives::{AccountId, Balance, BlockNumber, Hash, Index, Moment, Signature};
use sp_api::impl_runtime_apis;
use sp_core::u32_trait::{_1, _2, _3};
use sp_core::{crypto::KeyTypeId, OpaqueMetadata};
use sp_core::{crypto::KeyTypeId, OpaqueMetadata, H256};
use sp_runtime::{
create_runtime_str, generic, impl_opaque_keys,
traits::{AccountIdLookup, BlakeTwo256, Block as BlockT, ConvertInto},
Expand Down Expand Up @@ -522,7 +522,7 @@ impl pallet_robonomics_datalog::Config for Runtime {
}

impl pallet_robonomics_launch::Config for Runtime {
type Parameter = bool;
type Parameter = H256;
type Event = Event;
}

Expand Down

0 comments on commit 4906440

Please sign in to comment.