-
Notifications
You must be signed in to change notification settings - Fork 1k
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
SmartContract: fix native NEP-17 manifest construction #3195
Conversation
8c8531a
to
a303603
Compare
Take into account event attributes declared onto the base class for native contracts. Close #3194. Signed-off-by: Anna Shaleva <[email protected]>
a303603
to
89f12f9
Compare
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 want to think about the case with overrides of some kind for the same event name. Hopefully, we'll never do this for natives.
Thanks for locating this bug. |
It’s not. This bug was introduced in post-3.6, in #2942, so this code was not in production yet, and the fix itself just fixes natives manifest and Management’s storage. But you’re right from the point that this fix requires node resync from genesis to work. |
Any possible UT for this fix? |
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.
Checked all native manifest. Yes, this really fixed.
Sure, will add in a couple of hours. |
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.
Isn't it possible to set up a UT to ensure that this fix is correct?
I just saw @Jim8y request now. I was checking the code. The code looks good and makes sense. It would be good to ensure a failed UT now and the fix for it. |
This reminds me that it would be also good to generate automatically manifest for NEO and GAS instead of manually. That would had make this error appear earlier perhaps. |
Totally agree. |
2bd4fe5
Two tests are added: one for particularly this bug (check In future |
With all hardforks enabled, actually. Let me fix this. |
2bd4fe5
to
8102836
Compare
Ensure that contract states generated with all hardforks enabled match the expected values. Signed-off-by: Anna Shaleva <[email protected]>
8102836
to
e8abd06
Compare
Fixed. |
wait a sec, what is the new logic? hardforks enabled or disabled? |
The code itself preserves the old logic except that NEP17 notifications are included into the NEP17 state, so #3194 is fixed for both enabled/disabled hardforks. The unit tests check the presence of these notifications and check natives state with all hardforks enabled since it's the default behaviour of |
@shargon can be merged. |
Description
Take into account event attributes declared onto the base class while constructing manifest for native contracts. Close #3194.
Type of change
How Has This Been Tested?
getcontractstate
RPC call for native NeoToken and GasToken sent to the updated node. The result is expected and correct, see the result:Updated NeoToken contract state
Updated GasToken contract state
Checklist: