adm: add mainchain update-contract command#3799
Conversation
866b45b to
9f6b6a1
Compare
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #3799 +/- ##
==========================================
- Coverage 25.51% 25.44% -0.07%
==========================================
Files 664 668 +4
Lines 42689 42821 +132
==========================================
+ Hits 10892 10897 +5
- Misses 30794 30922 +128
+ Partials 1003 1002 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
9f6b6a1 to
fccb48d
Compare
|
|
||
| gasWalletPath, _ := cmd.Flags().GetString(gasWalletFlag) | ||
| if gasWalletPath == "" { | ||
| return errors.New("gas wallet is required (use --gas-wallet flag)") |
There was a problem hiding this comment.
can be a flag const and fmt.Errorf
| } | ||
|
|
||
| w := io2.NewBufBinWriter() | ||
| emit.AppCall(w.BinWriter, contractHash, "update", callflag.All, nefBytes, manifestBytes, data) |
There was a problem hiding this comment.
@roman-khimov , @AnnaShaleva, cant this be simpler to update a contract? rpc bingings or smth. likely, no emit package and manual invocation scripts should be used, and most of the things should be done much easier, try to look at https://github.com/nspcc-dev/neofs-contract/blob/f228d5018923fa9d6d14bf363670e9159c0e79c7/rpc/neofs/rpcbinding.go#L106
There was a problem hiding this comment.
Yes, NEP-22 bindings better be used here.
There was a problem hiding this comment.
Used contract method from NEP-22.
| cmd.Printf("Transaction sent successfully!\n") | ||
| cmd.Printf("Transaction hash: %s\n", txHash.StringLE()) | ||
|
|
||
| await, _ := cmd.Flags().GetBool(awaitFlag) |
There was a problem hiding this comment.
i feel like any update should be in await mode always, no need for this to be flag'ed
|
|
||
| func waitForTxMainChain(c fschain.Client, hash util.Uint256, vub uint32) error { | ||
| for range maxAttemptsTxWait { | ||
| time.Sleep(time.Second) |
There was a problem hiding this comment.
no Waiter functionality used? manual for and sleep? i think we need to try to use the new neo-go API for such things
| } | ||
|
|
||
| w := io2.NewBufBinWriter() | ||
| emit.AppCall(w.BinWriter, contractHash, "update", callflag.All, nefBytes, manifestBytes, data) |
There was a problem hiding this comment.
Yes, NEP-22 bindings better be used here.
fccb48d to
b07d7a6
Compare
b07d7a6 to
0286d6a
Compare
0286d6a to
d3f4459
Compare
d3f4459 to
9593761
Compare
Instead of several `neo-go` commands to create update contract transaction in the main chain and sign them, it allows using a single `adm` command. Grouped some shared functions into a `n3util` package. Closes #3464. Signed-off-by: Andrey Butusov <andrey@nspcc.io>
Closes #3464.