From 8d67a03aec9dded83930c85d22ad244d7d2d2364 Mon Sep 17 00:00:00 2001 From: Evgeniy Stratonikov Date: Mon, 28 Jun 2021 18:07:25 +0300 Subject: [PATCH] stackitem: fix `Buffer` deserialization Fix incorrect application log for transaction in N3 testnet 8eb4076f1f1c07e693eda7e810779488a2d2b50aba9b727fd237cbc3adbec9e9 Signed-off-by: Evgeniy Stratonikov --- cli/nep11_test.go | 2 +- pkg/vm/stackitem/serialization.go | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/cli/nep11_test.go b/cli/nep11_test.go index a1d967cc9..519f152ce 100644 --- a/cli/nep11_test.go +++ b/cli/nep11_test.go @@ -312,7 +312,7 @@ func TestNEP11_OwnerOf_BalanceOf_Transfer(t *testing.T) { ScriptHash: verifyH, Name: "OnNEP11Payment", Item: stackitem.NewArray([]stackitem.Item{ - stackitem.NewByteArray(nftOwnerHash.BytesBE()), + stackitem.NewBuffer(nftOwnerHash.BytesBE()), stackitem.NewBigInteger(big.NewInt(1)), stackitem.NewByteArray(tokenID1), stackitem.NewByteArray([]byte("some_data")), diff --git a/pkg/vm/stackitem/serialization.go b/pkg/vm/stackitem/serialization.go index 3a40f4590..b30cb02c1 100644 --- a/pkg/vm/stackitem/serialization.go +++ b/pkg/vm/stackitem/serialization.go @@ -129,7 +129,10 @@ func decodeBinaryStackItem(r *io.BinReader, allowInvalid bool) Item { switch t { case ByteArrayT, BufferT: data := r.ReadVarBytes(MaxSize) - return NewByteArray(data) + if t == ByteArrayT { + return NewByteArray(data) + } + return NewBuffer(data) case BooleanT: var b = r.ReadBool() return NewBool(b)