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

Several NeoFS chain autodeploy/update fixes #2683

Merged
merged 3 commits into from
Dec 18, 2023

Conversation

cthulhu-rider
Copy link
Contributor

No description provided.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Copy link

codecov bot commented Dec 18, 2023

Codecov Report

Attention: 9 lines in your changes are missing coverage. Please review.

Comparison is base (9072222) 30.08% compared to head (6128055) 28.49%.

Files Patch % Lines
pkg/morph/deploy/funds.go 61.11% 7 Missing ⚠️
pkg/morph/deploy/contracts.go 0.00% 1 Missing ⚠️
pkg/morph/deploy/nns.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2683      +/-   ##
==========================================
- Coverage   30.08%   28.49%   -1.60%     
==========================================
  Files         406      413       +7     
  Lines       30182    31961    +1779     
==========================================
+ Hits         9081     9108      +27     
- Misses      20320    22073    +1753     
+ Partials      781      780       -1     

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

@cthulhu-rider cthulhu-rider force-pushed the bugfix/fschain-autoupdate branch 3 times, most recently from 167612c to 0a8be85 Compare December 18, 2023 10:39
@cthulhu-rider cthulhu-rider marked this pull request as ready for review December 18, 2023 10:41
}
}

func divideFundsEvenlyU64(fullAmount uint64, n int, f func(ind int, amount uint64)) {
Copy link
Member

Choose a reason for hiding this comment

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

One version is enough. We can't have more than 100M NEO.

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

Previously, auto-deploy/update procedure could stuck when committee
multi-sig account had less than N amount of NEO, where N is a number of
the NeoFS Alphabet accounts in the deployed/update NeoFS network.
This was caused by rounding integer division of fund amounts: zero funds
were transferred due to which the balance did not change and each
iteration did not change the network state.

Fix zero transfers and also distribute remainder as evenly as possible
to decrease total number of transactions.

Fixes #2681.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
Previously, NeoFS chain auto-update procedure calculated nonce and
ValidUntilBlock of the update transactions from the latest NeoFS epoch.
This could lead to a deadlock if the epochs were not ticking (and this
could have various reasons). To prevent such problems and at the same
time simplify the formation of transactions, it makes sense to base
height parameters on the current blockchain height only.

Set nonce/ValidUntilBlock to lower/upper multiple of 100 relative to
current height.

Fixes #2680.

Signed-off-by: Leonard Lyubich <leonard@morphbits.io>
@roman-khimov roman-khimov merged commit 34cdb12 into master Dec 18, 2023
9 of 11 checks passed
@roman-khimov roman-khimov deleted the bugfix/fschain-autoupdate branch December 18, 2023 13:31
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.

None yet

2 participants