Skip to content

adm: add mainchain update-contract command#3799

Open
End-rey wants to merge 1 commit intomasterfrom
adm-update-chain-contract
Open

adm: add mainchain update-contract command#3799
End-rey wants to merge 1 commit intomasterfrom
adm-update-chain-contract

Conversation

@End-rey
Copy link
Contributor

@End-rey End-rey commented Feb 3, 2026

Closes #3464.

@End-rey End-rey self-assigned this Feb 3, 2026
@End-rey End-rey force-pushed the adm-update-chain-contract branch from 866b45b to 9f6b6a1 Compare February 3, 2026 14:28
@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

❌ Patch coverage is 0% with 209 lines in your changes missing coverage. Please review.
✅ Project coverage is 25.41%. Comparing base (827cad9) to head (fccb48d).

Files with missing lines Patch % Lines
cmd/neofs-adm/internal/modules/mainchain/update.go 0.00% 182 Missing ⚠️
...d/neofs-adm/internal/modules/fschain/initialize.go 0.00% 5 Missing ⚠️
cmd/neofs-adm/internal/modules/mainchain/root.go 0.00% 3 Missing ⚠️
cmd/neofs-adm/internal/modules/fschain/balance.go 0.00% 2 Missing ⚠️
...md/neofs-adm/internal/modules/fschain/container.go 0.00% 2 Missing ⚠️
cmd/neofs-adm/internal/modules/fschain/load.go 0.00% 2 Missing ⚠️
cmd/neofs-adm/internal/modules/fschain/quota.go 0.00% 2 Missing ⚠️
...s-adm/internal/modules/fschain/verified_domains.go 0.00% 2 Missing ⚠️
cmd/neofs-adm/internal/modules/fschain/config.go 0.00% 1 Missing ⚠️
.../neofs-adm/internal/modules/fschain/dump_hashes.go 0.00% 1 Missing ⚠️
... and 7 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3799      +/-   ##
==========================================
- Coverage   25.52%   25.41%   -0.12%     
==========================================
  Files         660      662       +2     
  Lines       42636    42822     +186     
==========================================
- Hits        10884    10883       -1     
- Misses      30749    30937     +188     
+ Partials     1003     1002       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@End-rey End-rey force-pushed the adm-update-chain-contract branch from 9f6b6a1 to fccb48d Compare February 4, 2026 14:37
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.

Closes #3464.

Signed-off-by: Andrey Butusov <andrey@nspcc.io>

gasWalletPath, _ := cmd.Flags().GetString(gasWalletFlag)
if gasWalletPath == "" {
return errors.New("gas wallet is required (use --gas-wallet flag)")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can be a flag const and fmt.Errorf

}

w := io2.NewBufBinWriter()
emit.AppCall(w.BinWriter, contractHash, "update", callflag.All, nefBytes, manifestBytes, data)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@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

cmd.Printf("Transaction sent successfully!\n")
cmd.Printf("Transaction hash: %s\n", txHash.StringLE())

await, _ := cmd.Flags().GetBool(awaitFlag)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no Waiter functionality used? manual for and sleep? i think we need to try to use the new neo-go API for such things

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Adm command to update main chain neofs contract

2 participants