From 29f1e646edd71d59cddba5c3863449f24b57af96 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Mon, 6 Jul 2020 14:35:55 +0300 Subject: [PATCH 1/2] vm: fix stackitem serialisation We're able to serialise Buffer stackitem, but can not deserealise it which leads to errors. Fixed. --- pkg/vm/stackitem/serialization.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pkg/vm/stackitem/serialization.go b/pkg/vm/stackitem/serialization.go index 17b3dec95..b3b111a7d 100644 --- a/pkg/vm/stackitem/serialization.go +++ b/pkg/vm/stackitem/serialization.go @@ -2,6 +2,7 @@ package stackitem import ( "errors" + "fmt" "math/big" "github.com/nspcc-dev/neo-go/pkg/encoding/bigint" @@ -96,7 +97,7 @@ func DecodeBinaryStackItem(r *io.BinReader) Item { } switch t { - case ByteArrayT: + case ByteArrayT, BufferT: data := r.ReadVarBytes() return NewByteArray(data) case BooleanT: @@ -132,7 +133,7 @@ func DecodeBinaryStackItem(r *io.BinReader) Item { case AnyT: return Null{} default: - r.Err = errors.New("unknown type") + r.Err = fmt.Errorf("unknown type: %v", t) return nil } } From 1755ce10ac200f9f676f67b3fb2678dcb35db128 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Mon, 6 Jul 2020 14:39:38 +0300 Subject: [PATCH 2/2] rpc: make `getapplicationlog` error more deterministic --- pkg/rpc/server/server.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/rpc/server/server.go b/pkg/rpc/server/server.go index 03399574c..edea05edf 100644 --- a/pkg/rpc/server/server.go +++ b/pkg/rpc/server/server.go @@ -488,7 +488,7 @@ func (s *Server) getApplicationLog(reqParams request.Params) (interface{}, *resp appExecResult, err := s.chain.GetAppExecResult(txHash) if err != nil { - return nil, response.NewRPCError("Unknown transaction", "", nil) + return nil, response.NewRPCError("Unknown transaction", "", err) } return result.NewApplicationLog(appExecResult), nil