-
Notifications
You must be signed in to change notification settings - Fork 80
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
NEO candidate registration via NEP-27 callback #3700
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3700 +/- ##
==========================================
- Coverage 83.06% 83.02% -0.05%
==========================================
Files 335 335
Lines 46775 46809 +34
==========================================
+ Hits 38855 38863 +8
- Misses 6324 6353 +29
+ Partials 1596 1593 -3 ☔ View full report in Codecov by Sentry. |
Solves two problems: * inability to estimate GAS needed for registerCandidate in a regular way because of its very high fee (more than what normal RPC servers allow) * inability to have MaxBlockSystemFee lower than the registration price which is very high on its own (more than practically possible to execute) See neo-project/neo#3552. Signed-off-by: Roman Khimov <[email protected]>
Connection succeeds when AIO is running, some more obscure port is less likely to cause this problem. Signed-off-by: Roman Khimov <[email protected]>
d4d1ff2
to
e80e08d
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.
Functionality itself LGTM, but don't we want to upgrade neo-go wallet candidate vote
command as far? We may add a switch to use transfer instead of a call to "vote" if Echidna is enabled on server. Although it may be a matter of a separate issue, create one?
@@ -815,17 +824,52 @@ func (n *NEO) CalculateNEOHolderReward(d *dao.Simple, value *big.Int, start, end | |||
|
|||
func (n *NEO) registerCandidate(ic *interop.Context, args []stackitem.Item) stackitem.Item { | |||
pub := toPublicKey(args[0]) | |||
if !ic.IsHardforkEnabled(config.HFEchidna) { |
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.
Can we create an issue to remove this code after Echidna transition?
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.
Ref. #3774.
@@ -900,3 +901,88 @@ func TestNEO_GetCandidates(t *testing.T) { | |||
neoCommitteeInvoker.Invoke(t, expected, "getCandidates") | |||
checkGetAllCandidates(t, expected) | |||
} | |||
|
|||
func TestNEO_RegisterViaNEP27(t *testing.T) { | |||
const echidnaHeight = 12 // Same as Domovoi in UT config. |
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'd suggest to avoid custom modifications of unittestnet configuration as much as possible. Instead, we may directly set Echidna height in the ./config/protocol.unit_testnet.yml
to some 14 and use this value from unit tests. We did #3696 specifically to reuse embedded config everywhere.
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.
But of course it's not a big deal if you'd like to keep this code. I just want unittest config related things to be unified.
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.
My initial attempts at enabling it everywhere broke unrelated tests. I'll check one more time.
@@ -200,6 +202,13 @@ func newNEO(cfg config.ProtocolConfiguration) *NEO { | |||
md = newMethodAndPrice(n.unregisterCandidate, 1<<16, callflag.States) | |||
n.AddMethod(md, desc) | |||
|
|||
desc = newDescriptor("onNEP17Payment", smartcontract.VoidType, |
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.
BTW, one important thing to me is that we forgot to update Neo's list of supported standards. It should include NEP-27, ditto for C# likely.
Ref. #3775, this PR is only about contract-related changes. |
See neo-project/neo#3552. Depends on neo-project/neo#3597.