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

Rounding error for initial NEO transfer calculations #2681

Closed
roman-khimov opened this issue Dec 15, 2023 · 0 comments
Closed

Rounding error for initial NEO transfer calculations #2681

roman-khimov opened this issue Dec 15, 2023 · 0 comments
Assignees
Labels
bug Something isn't working neofs-ir Inner Ring node application issues
Milestone

Comments

@roman-khimov
Copy link
Member

Expected Behavior

IR starting for an already running network and dealing with NEO transfers in a normal way.

Current Behavior

For a 7-node network it's

neofs-ir[820]: 2023-12-15T19:47:37.738Z info deploy/funds.go:414 have available NEO on the committee multi-sig account, going to transfer to the Alphabet contracts {"balance": "2"}
neofs-ir[820]: 2023-12-15T19:48:37.848Z info deploy/funds.go:422 going to transfer NEO from the committee multi-sig account to the Alphabet contract {"contract": "022cbb26f105f5023b72a2b5e7b07fea14619361", "": "0"}
neofs-ir[820]: 2023-12-15T19:48:37.850Z info deploy/funds.go:422 going to transfer NEO from the committee multi-sig account to the Alphabet contract {"contract": "d6bb47140feaf45206b5413cef9581e6b734f11b", "": "0"}
neofs-ir[820]: 2023-12-15T19:48:37.852Z info deploy/funds.go:422 going to transfer NEO from the committee multi-sig account to the Alphabet contract {"contract": "37277e24c32b85fd960867f7a3427894251ef33c", "": "0"}
neofs-ir[820]: 2023-12-15T19:48:37.854Z info deploy/funds.go:422 going to transfer NEO from the committee multi-sig account to the Alphabet contract {"contract": "bfabc554a728980d21faeaa4a487c738890593d7", "": "0"}
neofs-ir[820]: 2023-12-15T19:48:37.854Z info deploy/funds.go:422 going to transfer NEO from the committee multi-sig account to the Alphabet contract {"contract": "4ce9e4d290c9d7e828e46568f78c0e30f612628a", "": "0"}
neofs-ir[820]: 2023-12-15T19:48:37.861Z info deploy/funds.go:422 going to transfer NEO from the committee multi-sig account to the Alphabet contract {"contract": "d36ee8028b44eabf0d35a380d990fd7798b25634", "": "0"}
neofs-ir[820]: 2023-12-15T19:48:37.862Z info deploy/funds.go:422 going to transfer NEO from the committee multi-sig account to the Alphabet contract {"contract": "7ac6e2da0d33600aa019b8036ca6101205d4fa08", "": "0"}
neofs-ir[820]: 2023-12-15T19:47:37.752Z info deploy/funds.go:445 Notary request transferring Neo from committee multi-sig account to the Alphabet contracts has been successfully sent, will wait for the outcome {"main tx": "377e72d034fc2fa6c44e0e3c434126a2be6d36e0ef9a6630c2e0d9a854761a31", "fallback tx": "597c9f8c817d2812da3ee814df20e8f7a50f170c9cccf7dfc6201b8f04295dc3", "vub": 2745636}

that never ends because we transfer zero NEO and there are always two left.

Possible Solution

For an already set up network this logic can be either omitted (notice that committee can differ from the standby one also), or we can ignore <ValidatorsCount amount of NEO or we can transfer them to random alphabet contract.

Steps to Reproduce (for bugs)

Upgrade a network with seven nodes.

Your Environment

  • Version used: 0.39.0
@roman-khimov roman-khimov added bug Something isn't working neofs-ir Inner Ring node application issues labels Dec 15, 2023
@roman-khimov roman-khimov added this to the v0.40.0 milestone Dec 15, 2023
@roman-khimov roman-khimov modified the milestones: v0.40.0, v0.39.1 Dec 15, 2023
cthulhu-rider added a commit that referenced this issue Dec 18, 2023
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>
cthulhu-rider added a commit that referenced this issue Dec 18, 2023
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>
cthulhu-rider added a commit that referenced this issue Dec 18, 2023
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>
cthulhu-rider added a commit that referenced this issue Dec 18, 2023
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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working neofs-ir Inner Ring node application issues
Projects
None yet
Development

No branches or pull requests

2 participants