Skip to content

adm: add mainchain update-contract command#3799

Merged
roman-khimov merged 1 commit intomasterfrom
adm-update-chain-contract
Feb 9, 2026
Merged

adm: add mainchain update-contract command#3799
roman-khimov merged 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 200 lines in your changes missing coverage. Please review.
✅ Project coverage is 25.44%. Comparing base (dea6fad) to head (9593761).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
cmd/neofs-adm/internal/modules/mainchain/update.go 0.00% 121 Missing ⚠️
cmd/neofs-adm/internal/modules/n3util/wallet.go 0.00% 35 Missing ⚠️
cmd/neofs-adm/internal/modules/n3util/client.go 0.00% 18 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 ⚠️
... and 8 more
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.
📢 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

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

}

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

Copy link
Member

Choose a reason for hiding this comment

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

Yes, NEP-22 bindings better be used here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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)
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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dropped the flag.


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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

}

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.

Yes, NEP-22 bindings better be used here.

@End-rey End-rey force-pushed the adm-update-chain-contract branch from fccb48d to b07d7a6 Compare February 9, 2026 12:42
@End-rey End-rey force-pushed the adm-update-chain-contract branch from b07d7a6 to 0286d6a Compare February 9, 2026 12:50
Copy link
Member

@roman-khimov roman-khimov left a comment

Choose a reason for hiding this comment

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

OK otherwise.

@End-rey End-rey force-pushed the adm-update-chain-contract branch from 0286d6a to d3f4459 Compare February 9, 2026 15:19
@End-rey End-rey force-pushed the adm-update-chain-contract branch from d3f4459 to 9593761 Compare February 9, 2026 20:29
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>
@roman-khimov roman-khimov merged commit fe64931 into master Feb 9, 2026
15 of 19 checks passed
@roman-khimov roman-khimov deleted the adm-update-chain-contract branch February 9, 2026 20:38
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

3 participants