-
Notifications
You must be signed in to change notification settings - Fork 0
Fix UTs and known issue on Neo #3
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
Conversation
Signed-off-by: superboyiii <[email protected]>
|
|
||
| // Handle unclaimed gas distribution when transferring zero amount | ||
| // This allows claiming unclaimed gas by transferring 0 NEO | ||
| if (amount.IsZero && from is not null) |
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.
maybe move this piece of code to a function, @superboyiii
vncoelho
left a 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.
excellent, @superboyiii
|
|
||
| // Register the candidate | ||
| if (!RegisterInternal(engine, pubkey)) | ||
| throw new InvalidOperationException("Failed to register candidate. The witness does not match the public key."); |
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.
how about if it is already registered?
should we abort?
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.
Maybe it is good to return false as well
| /// <param name="amount">The amount of tokens sent.</param> | ||
| /// <param name="data">Optional data containing the public key for registration.</param> | ||
| [ContractMethod(CpuFee = 1 << 15, RequiredCallFlags = CallFlags.States | CallFlags.AllowNotify)] | ||
| private async ContractTask _OnPayment(ApplicationEngine engine, UInt160 assetId, UInt160 from, BigInteger amount, StackItem data) |
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.
Do we have to keep this? RegisterCandidate doesn't work?
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.
Both can work. Just keep it compatible. Not bad but more convenient.
src/Neo/Wallets/AssetDescriptor.cs
Outdated
| public AssetDescriptor(DataCache snapshot, ProtocolSettings settings, UInt160 assetId) | ||
| { | ||
| // GasToken is managed by TokenManagement, not a contract itself | ||
| // GasToken and NeoToken are managed by TokenManagement, not contracts themselves |
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.
We don't need to support NEP-17 in N4 I think.
Description
_OnPaymentmethod in Governance contract to handle NEP-27 payments for validator registration, accepting only GAS tokens and burning the registration fee. (I think it's missing and should be desgined, because existed UT has this scenario)_OnTransfermethod to handle zero-amount NEO transfers, allowing users to claim unclaimed GAS by transferring 0 NEO. (This makes Neo behavior compatible with the previous)Wallet.csandAssetDescriptor.cssupport Neo token.How Has This Been Tested?
Checklist: