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

Implements json_metadata RPC call - #692

Merged
gavofyork merged 13 commits into
masterfrom
json-metadata-rpc
Sep 10, 2018
Merged

Implements json_metadata RPC call#692
gavofyork merged 13 commits into
masterfrom
json-metadata-rpc

Conversation

@bkchr

@bkchrbkchr commented Sep 7, 2018

Copy link
Copy Markdown
Member

No description provided.

Comment threaddemo/runtime/src/lib.rs Outdated
pub type Executive = executive::Executive<Runtime, Block, Balances, Balances,
(((((), Council), Democracy), Staking), Session)>;

impl_json_metadata!(for Runtime with modules

Copy link
Copy Markdown
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.

Comment threadsubstrate/runtime-support/src/metadata.rs
Comment threadsubstrate/client/src/client.rs Outdated
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
Copy Markdown
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
Copy Markdown
Member

Choose a reason for hiding this comment

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

more bad intentation

@gavofyorkgavofyork left a comment

Copy link
Copy Markdown
Member

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

bkchr commented Sep 8, 2018

Copy link
Copy Markdown
MemberAuthor

@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
Copy Markdown
Member

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

@bkchr

Copy link
Copy Markdown
MemberAuthor

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
Copy Markdown
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
Copy Markdown
MemberAuthor

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;

@gavofyorkgavofyorkSep 10, 2018

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

sueprfluous indent level

@gavofyorkgavofyork added A0-please_review Pull request needs code review. and removed A4-gotissues labels Sep 10, 2018
@gavofyorkgavofyork added A8-looksgood and removed A0-please_review Pull request needs code review. labels Sep 10, 2018
@gavofyork
gavofyork merged commit 11ee362 into masterSep 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
Closeparitytech#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
Closeparitytech#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
Closeparitytech#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
Closeparitytech#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 freeto 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

@bkchr@gavofyork@rphmeier