Skip to content
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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

roman-khimov
Copy link
Member

Copy link

codecov bot commented Nov 24, 2024

Codecov Report

Attention: Patch coverage is 82.05128% with 7 lines in your changes missing coverage. Please review.

Project coverage is 83.02%. Comparing base (9928907) to head (e80e08d).

Files with missing lines Patch % Lines
pkg/core/native/native_neo.go 82.05% 4 Missing and 3 partials ⚠️
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.
📢 Have feedback on the report? Share it here.

@roman-khimov roman-khimov added the blocked Can't be done because of something label Nov 24, 2024
pkg/core/interop/context.go Outdated Show resolved Hide resolved
pkg/core/interop/context.go Outdated Show resolved Hide resolved
pkg/core/native/native_neo.go Outdated Show resolved Hide resolved
pkg/core/native/native_neo.go Outdated Show resolved Hide resolved
pkg/core/native/native_neo.go Outdated Show resolved Hide resolved
pkg/core/native/native_neo.go Outdated Show resolved Hide resolved
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]>
@roman-khimov roman-khimov force-pushed the nep-27-candidate-registration branch from d4d1ff2 to e80e08d Compare December 22, 2024 16:33
Copy link
Member

@AnnaShaleva AnnaShaleva left a 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) {
Copy link
Member

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?

Copy link
Member

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.
Copy link
Member

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.

Copy link
Member

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.

Copy link
Member Author

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,
Copy link
Member

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.

@AnnaShaleva
Copy link
Member

don't we want to upgrade neo-go wallet candidate vote command as far?

Ref. #3775, this PR is only about contract-related changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants