-
Couldn't load subscription status.
- Fork 179
feat: Add ingest check for non-zero node account balance #21707
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
Open
ibankov
wants to merge
16
commits into
main
Choose a base branch
from
account-balance-ingest
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 4 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
ec8a65d
initial commit
ibankov 53964cb
fix
ibankov f91404e
fixing tests
ibankov b59cd93
unit tests
ibankov c8f26e1
Merge branch 'main' into account-balance-ingest
ibankov ec1675d
addressing comments
ibankov 0ba6dd1
addressing comments
ibankov 7b0c74f
fix
ibankov d80b434
fix
ibankov 62f3d6b
update account balance verification to use AccountsConfig
ibankov 0f446ea
use authorizer
ibankov 188d0e3
Merge branch 'main' into account-balance-ingest
ibankov 161e202
fix
ibankov e7f5504
wip
ibankov 906b10d
fix tests
ibankov cd00457
Merge branch 'main' into account-balance-ingest
ibankov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like that we are hard coding the number of the system accounts like this. It should have its own dynamic property. I see that contract service is using it as 750 in ProcessorModule instead of 1000! Lets do the following:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Scratch that. There is a dynamic property already.
LedgerConfig.numSystemAccountswe should use it instead. I will file a bug against contract service.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LedgerConfig.numSystemAccountsdefault value is 100, we should probably usenumReservedSystemEntitiesin the same class which is 750There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There are a lot of accounts and other entities below numReservedSystemEntities that should not be able to bypass this check. Even in the System Accounts (at least on Hedera) there are 20-30 Node accounts that probably shouldn't have this privilege.
Checking below
numSystemAccountsis OK, but we might be better off checking if the account is a privileged account specifically (I believe those are, for Hedera,2and42-60, they'll vary for other Hiero networks, the exact value is, or perhaps should be, defined in api-permissions.properties).There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I switched it to use
AccountsConfig.isSuperUser()so only the treasury and system admin accounts are privileged for that. This should be fine as this is mostly for funding accounts after genesis which will be done by the treasury because its the only account with balance.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since we already know which accounts are privileged for each transaction type in PrivilegesVerifier, we can re-use that and call
PrivilegesVerifier.hasPrivilegeshere. If its privileged account, we can by pass that check?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Switched to using
Authorizer