neoneo-go/pkg/core/transaction
Anna Shaleva c5c5e4c208 core: do not panic if transaction with empty script is being serialized
See https://github.com/nspcc-dev/neo-go/pull/2485#discussion_r872695786.

Allows to avoid panic:
```
(18:28:29)[sergio@transient:morph-control-load]% downloads/neofs-adm morph -c configuration/config.yaml init --contracts downloads/neofs-contract-v0.15.1
Stage 1: transfer GAS to alphabet nodes.
Waiting for transactions to persist...
Stage 2: set notary and alphabet nodes in designate contract.
Stage 2: already performed.
Stage 3: deploy NNS contract.
NNS contract is already deployed.
Stage 4: deploy NeoFS contracts.
Alphabet contract #0 is already deployed.
Alphabet contract #1 is already deployed.
Alphabet contract #2 is already deployed.
Alphabet contract #3 is already deployed.
audit contract is already deployed.
balance contract is already deployed.
container contract is already deployed.
neofsid contract is already deployed.
netmap contract is already deployed.
proxy contract is already deployed.
reputation contract is already deployed.
subnet contract is already deployed.
Waiting for transactions to persist...
Stage 4.1: Transfer GAS to proxy contract.
Stage 5: register candidates.
Stage 6: transfer NEO to alphabet contracts.
Stage 7: set addresses in NNS.
NNS: Set alphabet0.neofs -> 2efeb27866fa774ec6bfb43babaadcc7b28f9bb7
NNS: Set alphabet1.neofs -> 5606bc6598a538ac59ded3caa842247b9b26097a
NNS: Set alphabet2.neofs -> 2a8308cfd2706ddd5f67adfdf3954c6836806b5d
NNS: Set alphabet3.neofs -> 718d0459e6787f0f13f1e1898bf2ce6bc4bb452d
NNS: Set audit.neofs -> 54d516b36c3380efa2b2f26bda300b6c6302b8e7
NNS: Set balance.neofs -> 72b3255944524cb822788a7542c9d06cba208c0c
NNS: Set container.neofs -> 20a20f4352a49f161eccb7d5a806fd46dcab81ea
NNS: Set neofsid.neofs -> 04a3a71535689b820093cefe7ae188ed7591ad27
NNS: Set netmap.neofs -> 9a34c97b2ba6bd986fd9140a9c3d59059fa430f4
NNS: Set proxy.neofs -> 4eba34ec016f8709a511b02765a1195e31a921ea
NNS: Set reputation.neofs -> 77b5b2cf596957cc05ca3d57503ef08d72792301
NNS: Set subnet.neofs -> b0abe16bc7f56b2e7e0694ae2b36207c6aaa8636
panic: error serializing *transaction.Transaction: transaction has no script

goroutine 1 [running]:
github.com/nspcc-dev/neo-go/pkg/io.GetVarSize({0xbf6240, 0xc0003634a0})
	github.com/nspcc-dev/neo-go@v0.98.2/pkg/io/size.go:68 +0x6fd
github.com/nspcc-dev/neo-go/pkg/rpc/client.(*Client).AddNetworkFee(0xc0004080c0, 0xc0003634a0, 0x0, {0xc00000e248, 0x1, 0x93})
	github.com/nspcc-dev/neo-go@v0.98.2/pkg/rpc/client/rpc.go:966 +0x6b
github.com/nspcc-dev/neo-go/pkg/rpc/client.(*Client).CreateTxFromScript(0x0, {0x0, 0x0, 0x0}, 0x1, 0x0, 0x0, {0xc0001c7990, 0x1, 0x1})
	github.com/nspcc-dev/neo-go@v0.98.2/pkg/rpc/client/nep17.go:128 +0x345
github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/morph.(*initializeContext).sendCommitteeTx(0xc00014a370, {0x0, 0x0, 0x0}, 0xc0016bcf30, 0x2)
	github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/morph/initialize.go:336 +0x131
github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/morph.(*initializeContext).updateNNSGroup(0xc0001c7c88, {0x13, 0xd3, 0x6b, 0x85, 0x3e, 0x86, 0xbe, 0x77, 0xb7, ...}, ...)
	github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/morph/initialize_nns.go:89 +0x134
github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/morph.(*initializeContext).setNNS(0xc00014a370)
	github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/morph/initialize_nns.go:74 +0x8c5
github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/morph.initializeSideChainCmd(0x12a00e0, {0xc22a22, 0x4, 0x4})
	github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/morph/initialize.go:94 +0x2bc
github.com/spf13/cobra.(*Command).execute(0x12a00e0, {0xc00013a6c0, 0x4, 0x4})
	github.com/spf13/cobra@v1.1.3/command.go:852 +0x60e
github.com/spf13/cobra.(*Command).ExecuteC(0x129c760)
	github.com/spf13/cobra@v1.1.3/command.go:960 +0x3ad
github.com/spf13/cobra.(*Command).Execute(...)
	github.com/spf13/cobra@v1.1.3/command.go:897
github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules.Execute(...)
	github.com/nspcc-dev/neofs-node/cmd/neofs-adm/internal/modules/root.go:48
main.main()
	github.com/nspcc-dev/neofs-node/cmd/neofs-adm/main.go:10 +0x25
zsh: exit 2     downloads/neofs-adm morph -c configuration/config.yaml init --contracts
```
2022-05-16 15:19:17 +03:00
..
attribute.go [#2442] English Check 2022-05-04 19:48:27 +03:00
attribute_test.go transaction: marshal oracle response codes as strings 2021-04-06 22:50:42 +03:00
attrtype.go *: enable godot linter and fix all its warnings 2021-05-12 23:17:03 +03:00
attrtype_string.go core: add NotaryAssisted transaction attribute 2020-11-25 18:37:29 +03:00
bench_test.go transaction: add benchmark for transaction serialization 2021-08-09 12:01:38 +03:00
conflicts.go [#2442] English Check 2022-05-04 19:48:27 +03:00
doc.go *: add more package-specific documentation 2021-03-19 16:18:45 +03:00
helper_test.go *: enable godot linter and fix all its warnings 2021-05-12 23:17:03 +03:00
not_valid_before.go [#2442] English Check 2022-05-04 19:48:27 +03:00
notary_assisted.go [#2442] English Check 2022-05-04 19:48:27 +03:00
oracle.go [#2442] English Check 2022-05-04 19:48:27 +03:00
oracle_test.go pkg: move internal/ package to the root directory 2020-11-24 16:39:56 +03:00
oracleresponsecode_string.go oracle: check response Content-Type 2021-07-12 13:13:48 +03:00
reserved.go [#2442] English Check 2022-05-04 19:48:27 +03:00
signer.go [#2442] English Check 2022-05-04 19:48:27 +03:00
signer_test.go core: consider Rules witness scope as valid 2022-04-27 12:48:33 +03:00
transaction.go core: do not panic if transaction with empty script is being serialized 2022-05-16 15:19:17 +03:00
transaction_test.go core: do not panic if transaction with empty script is being serialized 2022-05-16 15:19:17 +03:00
witness.go [#2442] English Check 2022-05-04 19:48:27 +03:00
witness_condition.go Merge pull request #2466 from nspcc-dev/rules-fixes 2022-05-06 11:09:39 +03:00
witness_condition_test.go core: add getTransactionSigners method to native Ledger 2022-04-29 11:18:58 +03:00
witness_rule.go [#2442] English Check 2022-05-04 19:48:27 +03:00
witness_rule_test.go core: add getTransactionSigners method to native Ledger 2022-04-29 11:18:58 +03:00
witness_scope.go Merge pull request #2466 from nspcc-dev/rules-fixes 2022-05-06 11:09:39 +03:00
witness_scope_string.go transaction: fix Rules stringer, it's WitnessRules in C# 2022-05-06 10:08:09 +03:00
witness_scope_test.go transaction: fix ineffassign GoReportCard issue 2020-08-14 12:08:16 +03:00
witness_test.go pkg: move internal/ package to the root directory 2020-11-24 16:39:56 +03:00
witnessaction_string.go transaction: add new Rules witness scope 2021-11-12 15:29:28 +03:00
witnessconditiontype_string.go transaction: add new Rules witness scope 2021-11-12 15:29:28 +03:00