From e1a1e4d88d80cd3883de008378ba5a6d043be362 Mon Sep 17 00:00:00 2001
From: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>
Date: Fri, 21 Mar 2025 10:50:54 +0200
Subject: [PATCH] rpc-v2/archive: Rename archive call method result to value
 (#7885)

This PR modifies the archive_call method result to align with the rpc-v2
spec:
-
https://github.com/paritytech/json-rpc-interface-spec/blob/main/src/api/archive_unstable_call.md

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.

cc @paritytech/subxt-team

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: Niklas Adolfsson <niklasadolfsson1@gmail.com>
---
 prdoc/pr_7885.prdoc                     | 11 +++++++++++
 substrate/client/rpc-spec-v2/src/lib.rs |  6 +++---
 2 files changed, 14 insertions(+), 3 deletions(-)
 create mode 100644 prdoc/pr_7885.prdoc

diff --git a/prdoc/pr_7885.prdoc b/prdoc/pr_7885.prdoc
new file mode 100644
index 00000000000..bfea03d6041
--- /dev/null
+++ b/prdoc/pr_7885.prdoc
@@ -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
diff --git a/substrate/client/rpc-spec-v2/src/lib.rs b/substrate/client/rpc-spec-v2/src/lib.rs
index fa822fd446b..7bda8370eb5 100644
--- a/substrate/client/rpc-spec-v2/src/lib.rs
+++ b/substrate/client/rpc-spec-v2/src/lib.rs
@@ -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() })
 	}
 
 	/// Constructs an error result.
@@ -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.
@@ -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();
-- 
GitLab