From 3b29720298c7386901f7cdf41f41db7b6c7c4953 Mon Sep 17 00:00:00 2001 From: Tatiana Nesterenko Date: Tue, 15 Aug 2023 21:53:29 +0100 Subject: [PATCH] neorpc: add deprecated error codes for C#-compatibility While our server no longer uses these codes (-100, -400) they still can come from C# servers and while we consider them deprecated we better at least have some definition of them until C# implements our proposal: https://github.com/neo-project/proposals/pull/156 Also adding description of deprecated RPC error codes in ROADMAP.md. Signed-off-by: Tatiana Nesterenko --- ROADMAP.md | 8 ++++++++ pkg/neorpc/errors.go | 15 +++++++++++++++ 2 files changed, 23 insertions(+) diff --git a/ROADMAP.md b/ROADMAP.md index bfe2aa845..dbc48f246 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -139,3 +139,11 @@ hidden under `version` label and `server_id` contains network server ID hidden under `server_id` label. Removal of `serv_node_version` is scheduled for Sep-Oct 2023 (~0.105.0 release). + +## RPC error codes returned by old versions and C#-nodes + +NeoGo retains certain deprecated error codes: `neorpc.ErrCompatGeneric`, +`neorpc.ErrCompatNoOpenedWallet`. They returned by nodes not compliant with the +neo-project/proposals#156 (NeoGo pre-0.102.0 and all known C# versions). + +Removal of the deprecated RPC error codes is planned once all nodes adopt the new error standard. \ No newline at end of file diff --git a/pkg/neorpc/errors.go b/pkg/neorpc/errors.go index c7ec5cc00..d6488283a 100644 --- a/pkg/neorpc/errors.go +++ b/pkg/neorpc/errors.go @@ -138,6 +138,21 @@ const ( ErrExecutionFailedCode = -608 ) +var ( + // ErrCompatGeneric is an error returned by nodes not compliant with the neo-project/proposals#156 + // (NeoGo pre-0.102.0 and all known C# versions). + // It can be returned for any call and doesn't have any specific meaning. + // + // Deprecated: to be removed after all nodes adopt new error standard. + ErrCompatGeneric = NewErrorWithCode(-100, "RPC error") + + // ErrCompatNoOpenedWallet is an error code returned by nodes not compliant with the neo-project/proposals#156 + // (all known C# versions, NeoGo never used this code). It can be returned for wallet-related operations. + // + // Deprecated: to be removed after all nodes adopt new error standard. + ErrCompatNoOpenedWallet = NewErrorWithCode(-400, "No opened wallet") +) + var ( // ErrInvalidParams represents a generic "Invalid params" error. ErrInvalidParams = NewInvalidParamsError("Invalid params")