Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions prdoc/pr_7885.prdoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
title: Rename archive call method result to value

doc:
- audience: [Node Dev, Node Operator]
description: |
Previously, the method result was encoded to a json containing a "result" field. However,
the spec specifies a "value" field. This aims to rectify that.

crates:
- name: sc-rpc-spec-v2
bump: major
6 changes: 3 additions & 3 deletions substrate/client/rpc-spec-v2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ pub enum MethodResult {
impl MethodResult {
/// Constructs a successful result.
pub fn ok(result: impl Into<String>) -> MethodResult {
MethodResult::Ok(MethodResultOk { success: true, result: result.into() })
MethodResult::Ok(MethodResultOk { success: true, value: result.into() })
Copy link
Contributor

Choose a reason for hiding this comment

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

is this only used by the archive API?
why not move it to the archive module so it doesn't get used by something else?

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, these are only used by the archive APIs

Copy link
Contributor

Choose a reason for hiding this comment

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

}

/// Constructs an error result.
Expand All @@ -65,7 +65,7 @@ pub struct MethodResultOk {
/// Method was successful.
success: bool,
/// The result of the method.
pub result: String,
pub value: String,
}

/// The error result of an RPC method.
Expand All @@ -92,7 +92,7 @@ mod tests {
let ok = MethodResult::ok("hello");

let ser = serde_json::to_string(&ok).unwrap();
let exp = r#"{"success":true,"result":"hello"}"#;
let exp = r#"{"success":true,"value":"hello"}"#;
assert_eq!(ser, exp);

let ok_dec: MethodResult = serde_json::from_str(exp).unwrap();
Expand Down
Loading