-
Notifications
You must be signed in to change notification settings - Fork 27
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
Allow up-to 6 decimals for transfer values #1211
Conversation
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.
LGTM with some questions! Thanks!
path: ['rules', 'transfer', '$from', '$to', '$key', 'value' ], | ||
value: { | ||
'.rule': { | ||
"write": "(auth.addr === $from || auth.fid === '_stake' || auth.fid === '_unstake' || auth.fid === '_pay' || auth.fid === '_claim' || auth.fid === '_hold' || auth.fid === '_release' || auth.fid === '_collectFee' || auth.fid === '_claimReward' || auth.fid === '_openCheckout' || auth.fid === '_closeCheckout' || auth.fid === '_closeCheckin') && !getValue('transfer/' + $from + '/' + $to + '/' + $key) && (util.isServAcntName($from, blockNumber) || util.isCksumAddr($from)) && (util.isServAcntName($to, blockNumber) || util.isCksumAddr($to)) && $from !== $to && util.isNumber(newData) && newData > 0 && util.countDecimals(newData) <= 6 && util.getBalance($from, getValue) >= newData" |
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'm not entirely sure, but shouldn't the write rule be auth.addr === $from && (auth.fid === '_stake' || ... )
? I ㅣlook forward to your comment.
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.
When a native function is triggered, it runs with only its auth.fid set clearing the original user's auth.addr. This distinguishes state writes by native functions from those by users.
// From allow_non_negative_transfer_value_only.js bandage file. | ||
prevValue: { | ||
".rule": { | ||
"write": "(auth.addr === $from || auth.fid === '_stake' || auth.fid === '_unstake' || auth.fid === '_pay' || auth.fid === '_claim' || auth.fid === '_hold' || auth.fid === '_release' || auth.fid === '_collectFee' || auth.fid === '_claimReward' || auth.fid === '_openCheckout' || auth.fid === '_closeCheckout' || auth.fid === '_closeCheckin') && !getValue('transfer/' + $from + '/' + $to + '/' + $key) && (util.isServAcntName($from, blockNumber) || util.isCksumAddr($from)) && (util.isServAcntName($to, blockNumber) || util.isCksumAddr($to)) && $from !== $to && util.isNumber(newData) && newData > 0 && util.getBalance($from, getValue) >= newData" |
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.
What is a service account name, and how does it differ from a checksum address?
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.
Service accounts are accounts that can hold tokens for service constructions. For example, the accounts under /service_accounts/staking/consensus are service accounts for staking to participate in the blockchain consensus (block producing).
https://testnet-insight.ainetwork.ai/database/values/service_accounts/staking/consensus
@@ -55,5 +55,9 @@ | |||
"tweak_transfer_gc_rule": { | |||
"enabled_block": 2, | |||
"has_bandage": true | |||
}, | |||
"allow_up_to_6_decimal_transfer_value_only": { |
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.
What is timer_flag
?
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.
Timer flags are a flag with its enabled and disabled block numbers. For backward compatibility, any new features that affects the consensus (including state root hash) need to be enabled after specific block number.
Thanks for the review! @jiyoung-an Now merging.. |
Change summary:
Related issues: