Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Implements json_metadata RPC call #692

Merged
merged 13 commits into from
Sep 10, 2018
Merged

Implements json_metadata RPC call #692

merged 13 commits into from
Sep 10, 2018

Conversation

bkchr
Copy link
Member

@bkchr bkchr commented Sep 7, 2018

No description provided.

@@ -229,9 +229,20 @@ pub type CheckedExtrinsic = generic::CheckedExtrinsic<AccountId, Index, Call>;
pub type Executive = executive::Executive<Runtime, Block, Balances, Balances,
(((((), Council), Democracy), Staking), Session)>;

impl_json_metadata!(for Runtime with modules
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: "all-or-nothing" indentation with close-paren on its own line.

pub fn json_metadata(&self, id: &BlockId<Block>) -> error::Result<String> {
self.executor.call(id, "json_metadata",&[])
.and_then(|r| String::decode(&mut &r.return_data[..])
.ok_or("Metadata decoding failed".into()))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check style guide on indentation. basically, it's only ever a single tab at a time, never ever mix tabs + spaces.

}

impl_json_metadata!(for TestRuntime with modules
event_module::Module,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more bad intentation

Copy link
Member

@gavofyork gavofyork left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI fails because you're trying to use format! in the runtime. That's not allowed: format! brings way too much baggage with it. You'll need to either rearrange the macro to concat the &'static str fragments using concat! or pass them back to the client and do formatting in native code.

@bkchr
Copy link
Member Author

bkchr commented Sep 8, 2018

@gavofyork The wasm stuff is compiled with a nightly compiler and the native stuff is compiled with a stable compiler? Just asking, because I thought of using const fn, but that is still unstable.

@gavofyork
Copy link
Member

that's right - wasm with nightly (it doesn't compile using stable yet)

@bkchr
Copy link
Member Author

bkchr commented Sep 10, 2018

Now, it compiles on wasm and native.


client.justify_and_import(BlockOrigin::Own, builder.bake().unwrap()).unwrap();

assert_eq!(client.json_metadata(&BlockId::Number(1)).unwrap(), r#"{ "events": "events" }"#);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what does this test?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That just tests that the json_metadata function of the test-client is getting called.

) => {
impl $runtime {
pub fn json_metadata() -> $crate::metadata::Vec<$crate::metadata::JSONMetadata> {
__impl_json_metadata!($runtime;
Copy link
Member

@gavofyork gavofyork Sep 10, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sueprfluous indent level

@gavofyork gavofyork added A0-please_review Pull request needs code review. and removed A4-gotissues labels Sep 10, 2018
@gavofyork gavofyork added A8-looksgood and removed A0-please_review Pull request needs code review. labels Sep 10, 2018
@gavofyork gavofyork merged commit 11ee362 into master Sep 10, 2018
@gavofyork gavofyork deleted the json-metadata-rpc branch September 10, 2018 16:34
liuchengxu pushed a commit to chainx-org/substrate that referenced this pull request Aug 23, 2021
* Add LastRenominationOf

Close paritytech#692

* Fix renominate tests

* Build wasm
liuchengxu added a commit to chainx-org/substrate that referenced this pull request Aug 23, 2021
* Introduce Delta

* Add VoteWeightBase

* Upper bound of intention (paritytech#796)

* Add UpperBoundFactor

Close paritytech#672

* Check if the intention is nominating itself and add tests

* Add set_upper_bound_factor and build wasm

* Add LastRenominationOf (paritytech#794)

* Add LastRenominationOf

Close paritytech#692

* Fix renominate tests

* Build wasm

* genesis bitcoin (paritytech#799)

genesis runtime wasm

notice, do not copy wasm file into cli/src for develop!

* Add MaxUnbondEntriesPerIntention (paritytech#800)

* Add MaxUnbondEntriesPerIntention

Close paritytech#681

* Add test

* Nits

* Nit

* Pass tests

* Replace settle_amount() with settle_and_set_amount()

* Nit

* Build wasm

* Rename set_new_state to set_state

* Rebuild wasm
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants