Skip to content

Commit

Permalink
rpcsrv: return error on invalid proof from verifyProof
Browse files Browse the repository at this point in the history
This change makes code incompatible with C# node,
because currently no error is returned on invalid proof.
According to proposal:
neo-project/proposals#156
Also adding `verifyProof` descpiption in docs/rpc.md.

Signed-off-by: Tatiana Nesterenko <tatiana@nspcc.io>
  • Loading branch information
tatiana-nspcc committed Aug 16, 2023
1 parent 2598257 commit f557959
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions docs/rpc.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,11 @@ enabled in the server's protocol configuration.
##### `getnep11transfers` and `getnep17transfers`
`transfernotifyindex` is not tracked by NeoGo, thus this field is always zero.

##### `verifyProof`

NeoGo can generate an error in response to an invalid proof, unlike
the error-free C# implementation.

### Unsupported methods

Methods listed below are not going to be supported for various reasons
Expand Down
5 changes: 3 additions & 2 deletions pkg/services/rpcsrv/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -1531,9 +1531,10 @@ func (s *Server) verifyProof(ps params.Params) (any, *neorpc.Error) {
}
vp := new(result.VerifyProof)
val, ok := mpt.VerifyProof(root, p.Key, p.Proof)
if ok {
vp.Value = val
if !ok {
return nil, neorpc.ErrInvalidProof
}
vp.Value = val
return vp, nil
}

Expand Down

0 comments on commit f557959

Please sign in to comment.