Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/Separate deploying contract and NNS updating transaction #1683

Merged
merged 2 commits into from
Aug 24, 2022
Merged

Fix/Separate deploying contract and NNS updating transaction #1683

merged 2 commits into from
Aug 24, 2022

Conversation

carpawell
Copy link
Member

Deploy contract in one transaction and register NNS record in another to
prevent GAS limit exceeding due to the fact that registration always takes
10+ GAS.

Signed-off-by: Pavel Karpy carpawell@nspcc.ru

Closes #1675.

@carpawell carpawell added enhancement Improving existing functionality neofs-adm NeoFS Adm application issues labels Aug 12, 2022
@carpawell carpawell self-assigned this Aug 12, 2022
@codecov
Copy link

codecov bot commented Aug 12, 2022

Codecov Report

Merging #1683 (fa289b3) into master (89cba2c) will decrease coverage by 0.66%.
The diff coverage is 0.00%.

@@            Coverage Diff             @@
##           master    #1683      +/-   ##
==========================================
- Coverage   33.21%   32.55%   -0.67%     
==========================================
  Files         332      337       +5     
  Lines       22752    22667      -85     
==========================================
- Hits         7558     7380     -178     
- Misses      14574    14674     +100     
+ Partials      620      613       -7     
Impacted Files Coverage Δ
cmd/neofs-adm/internal/modules/morph/deploy.go 9.57% <ø> (+0.29%) ⬆️
cmd/neofs-adm/internal/modules/morph/initialize.go 0.00% <0.00%> (ø)
...neofs-adm/internal/modules/morph/initialize_nns.go 0.00% <0.00%> (ø)
pkg/local_object_storage/blobstor/control.go 63.33% <0.00%> (-21.29%) ⬇️
pkg/local_object_storage/blobstor/iterate.go 61.11% <0.00%> (-18.26%) ⬇️
pkg/local_object_storage/blobstor/exists.go 73.33% <0.00%> (-17.15%) ⬇️
pkg/local_object_storage/blobstor/fstree/fstree.go 57.59% <0.00%> (-9.67%) ⬇️
pkg/local_object_storage/shard/put.go 73.33% <0.00%> (-4.45%) ⬇️
pkg/local_object_storage/blobstor/blobstor.go 79.16% <0.00%> (-3.38%) ⬇️
pkg/local_object_storage/shard/range.go 90.24% <0.00%> (-2.35%) ⬇️
... and 39 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@fyrchik
Copy link
Contributor

fyrchik commented Aug 15, 2022

NNS has SetPrice method, can we do SetPrice the same trick as in #1608 ?

@carpawell
Copy link
Member Author

carpawell commented Aug 15, 2022

NNS has SetPrice method, can we do SetPrice the same trick as in #1608 ?

I did it like it was done for NeoFS contracts (deploying in one stage, setting NNS in another).

Also, if Im not mistaken, @realloc was against changing the price for that purpose.

@realloc
Copy link

realloc commented Aug 15, 2022

I didn't like the idea of changing NNS pricing in general for all.

I have nothing against temporary NNS price change, contract deploy and setting price back in the same Tx. This doesn't mean we don't have to check deploy actions sanity first =)

@fyrchik
Copy link
Contributor

fyrchik commented Aug 15, 2022

Yes, the whole purpose of the optimisation is to do it temporarily, so that there are no visible side-effects for other transactions.

@carpawell
Copy link
Member Author

@fyrchik, added hack with changing price but kept separate deploying and registering. Also, added --force that allows deploying contract without group/with a group that differs from group.neofs.

}

// add record to NNS
w = io.NewBufBinWriter()
Copy link
Member

Choose a reason for hiding this comment

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

BufBinWriter can be reused after previous transaction. Use w.Reset() to reset it.

Copy link
Member Author

Choose a reason for hiding this comment

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

fixed

Comment on lines 117 to 118
"`%s` does not equal NNS's `%s`; use `--%s` flag to deploy with that key anyway",
contractWalletFilename, morphclient.NNSGroupKeyName, forceFlag,
Copy link
Member

@AnnaShaleva AnnaShaleva Aug 16, 2022

Choose a reason for hiding this comment

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

Maybe some %s doesn't contain NNS's group key... will be better? The first argument is wallet filename, this message looks strange a bit.

Copy link
Member Author

Choose a reason for hiding this comment

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

decided not to deploy custom contracts with group.neofs group, removed that code

if err != nil {
return fmt.Errorf("can't sign manifest group: %v", err)
}

Copy link
Member

Choose a reason for hiding this comment

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

Linter is unhappy.

Copy link
Member Author

@carpawell carpawell Aug 16, 2022

Choose a reason for hiding this comment

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

forgot that the linter already works and requires attention

@carpawell
Copy link
Member Author

Removed --force flag and do deploy contract with the neofs group.

@fyrchik
Copy link
Contributor

fyrchik commented Aug 23, 2022

@carpawell why did you separate deploy and register? setPrice should be enough.

@carpawell
Copy link
Member Author

why did you separate deploy and register?

@fyrchik that was the original idea of the PR. Yes, now SetPrice fixes the problem. Do you want to keep registration and deploying in the same TX?

@fyrchik
Copy link
Contributor

fyrchik commented Aug 23, 2022

Yes, the less transactions we have, the fewer places where something could go wrong.

Register NNS domain in one TX:
1. Set minimal (`1`) registration price;
2. Register domain;
3. Return registration price back.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
@carpawell
Copy link
Member Author

@fyrchik, ok, dropped that commit.

@fyrchik fyrchik merged commit b54f34d into nspcc-dev:master Aug 24, 2022
@carpawell carpawell deleted the fix/adm-contract-deployment branch August 24, 2022 11:09
@carpawell carpawell mentioned this pull request Sep 14, 2022
aprasolova pushed a commit to aprasolova/neofs-node that referenced this pull request Oct 19, 2022
Register NNS domain in one TX:
1. Set minimal (`1`) registration price;
2. Register domain;
3. Return registration price back.

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
aprasolova pushed a commit to aprasolova/neofs-node that referenced this pull request Oct 19, 2022
Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improving existing functionality neofs-adm NeoFS Adm application issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Tuning default MaxGasInvoke RPC server setting of neofs devenv node
4 participants