From 037076f2ee8d26b8c89384d93e1d40086c30d87c Mon Sep 17 00:00:00 2001 From: Evgeniy Stratonikov Date: Wed, 9 Feb 2022 15:38:22 +0300 Subject: [PATCH] rpc/request: return error from `ExpandArrayIntoScript` if any Signed-off-by: Evgeniy Stratonikov --- pkg/rpc/request/txBuilder.go | 2 +- pkg/rpc/request/tx_builder_test.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/rpc/request/txBuilder.go b/pkg/rpc/request/txBuilder.go index 044db0b2e..e98afec8f 100644 --- a/pkg/rpc/request/txBuilder.go +++ b/pkg/rpc/request/txBuilder.go @@ -97,7 +97,7 @@ func ExpandArrayIntoScript(script *io.BinWriter, slice []Param) error { return fmt.Errorf("parameter type %v is not supported", fp.Type) } } - return nil + return script.Err } // CreateFunctionInvocationScript creates a script to invoke given contract with diff --git a/pkg/rpc/request/tx_builder_test.go b/pkg/rpc/request/tx_builder_test.go index b5d056667..62ae926d1 100644 --- a/pkg/rpc/request/tx_builder_test.go +++ b/pkg/rpc/request/tx_builder_test.go @@ -135,6 +135,10 @@ func TestExpandArrayIntoScript(t *testing.T) { { {RawMessage: []byte(`{"type": "Array", "value": null}`)}, }, + { + {RawMessage: []byte(`{"type": "Integer", "value": "` + + new(big.Int).Lsh(big.NewInt(1), 255).String() + `"}`)}, + }, } for _, c := range errorCases { script := io.NewBufBinWriter()