Skip to content

[Core Add] Add support to Ed25519#3507

Merged
NGDAdmin merged 2 commits intoneo-project:HF_Echidnafrom
Jim8y:ed25519
Jan 9, 2025
Merged

[Core Add] Add support to Ed25519#3507
NGDAdmin merged 2 commits intoneo-project:HF_Echidnafrom
Jim8y:ed25519

Conversation

@Jim8y
Copy link
Contributor

@Jim8y Jim8y commented Oct 2, 2024

Description

This pr adds support to Ed25519 as is suggested in #3506

Tested with test vectors from RFC 8032 (https://datatracker.ietf.org/doc/html/rfc8032)

Fixes # #3506

Type of change

  • Optimization (the change is only an optimization)
  • Style (the change is only a code style for better maintenance or standard purpose)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

How Has This Been Tested?

  • TestGenerateKeyPair
  • TestGetPublicKey
  • TestSignAndVerify
  • TestInvalidPrivateKeySize
  • TestInvalidSignatureSize
  • TestInvalidPublicKeySize
  • TestVectorCase1
  • TestVectorCase2
  • TestVectorCase3

Test Configuration:

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@Jim8y Jim8y changed the base branch from master to HF_Echidna October 2, 2024 12:51
@Jim8y Jim8y marked this pull request as draft October 2, 2024 12:59
@Jim8y Jim8y marked this pull request as ready for review October 2, 2024 13:01
@Jim8y Jim8y requested review from a team and vncoelho October 2, 2024 13:01
@Jim8y
Copy link
Contributor Author

Jim8y commented Oct 2, 2024

@edgedlt

Copy link
Member

@shargon shargon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add ut for false verification?

@Jim8y
Copy link
Contributor Author

Jim8y commented Oct 3, 2024

Add ut for false verification?

sure

verifier.BlockUpdate(message, 0, message.Length);
return verifier.VerifySignature(signature);
}
catch (Exception)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, I was talking only about ArgumentException, e.g. only about input data of invalid length and some other ArgumentException thrown by this part of code. However, catching any exception is a valid solution as far.

@roman-khimov, what do you think about cases when we should return true/false or FAULT VM?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can be both ways, but we need to know all of the exceptions that can happen in this block. Some are likely OK to be converted to false result (invalid signature), some may not (verifier constructor failure?). I'd expect some symmetry to ECDSA verification function. Like what happens if the key is wrong?

@nan01ab
Copy link
Contributor

nan01ab commented Jan 3, 2025

LGTM

@Jim8y
Copy link
Contributor Author

Jim8y commented Jan 7, 2025

LGTM

need approval

@Jim8y
Copy link
Contributor Author

Jim8y commented Jan 8, 2025

@roman-khimov @AnnaShaleva i think neogo need to impl this as well, please take a look.

@NGDAdmin NGDAdmin merged commit b1a3ea3 into neo-project:HF_Echidna Jan 9, 2025
NGDAdmin pushed a commit that referenced this pull request Jan 23, 2025
* add hardofork HF_Echidna

* Add entries to `Designation` event (#3397)

* Add entries to Designation event

* Change to HF_Echidna

* Add UT

* Add count

* [Neo Core StdLib] Add Base64url (#3453)

* add base64url

* active in

* update placehold hf height

* fix hf issue and move methods to proper place.

* fix test

* use identifymodel instead.

* add hardofork HF_Echidna

* Add entries to `Designation` event (#3397)

* Add entries to Designation event

* Change to HF_Echidna

* Add UT

* Add count

* [Neo Core StdLib] Add Base64url (#3453)

* add base64url

* active in

* update placehold hf height

* fix hf issue and move methods to proper place.

* fix test

* use identifymodel instead.

* add hardofork HF_Echidna

* Add entries to `Designation` event (#3397)

* Add entries to Designation event

* Change to HF_Echidna

* Add UT

* Add count

* [Neo Core StdLib] Add Base64url (#3453)

* add base64url

* active in

* update placehold hf height

* fix hf issue and move methods to proper place.

* fix test

* use identifymodel instead.

* format

* Fixed typo

* Added back #3397

* Fixed tests

* fixed global.json

* Update src/Neo/Neo.csproj

* Update src/Neo/Neo.csproj

* [`Fix`]: integer overflow in `JumpTable.SubStr ` (#3496)

* fix: int overflow in SubStr

* fix: int overflow in SubStr

* format

* Versioning change

* Clean

* Rename

* Show change

* Space

* remove duplicated lines in gitignroe

---------

Co-authored-by: Jimmy <jinghui@wayne.edu>
Co-authored-by: Shargon <shargon@gmail.com>

* Fix NEO callstates (#3599)

* Allow callstates to use HF

* Rename to method

* Other rename

* Change the way

* Reduce changes

* Reduce changes

* Adapt name always

* Avoid string when only is lower the first char

* UT

* Test all

* Update src/Neo/ProtocolSettings.cs

Co-authored-by: Christopher Schuchardt <cschuchardt88@gmail.com>

* Update src/Neo/ProtocolSettings.cs

Co-authored-by: Christopher Schuchardt <cschuchardt88@gmail.com>

* Reuse Load from stream

* Unify

* Fix default logic

* Change ContractMethod to allowMultiple

* Use LowerInvariant

* Move CheckingHardfork

* Remove optional arg

* Fix build

* Avoid file not found error

---------

Co-authored-by: Christopher Schuchardt <cschuchardt88@gmail.com>

* fix tests error (#3636)

* fux build error

* Update src/Neo/SmartContract/ApplicationEngine.cs

---------

Co-authored-by: Shargon <shargon@gmail.com>

* NeoToken: accept candidate registration via onNEP17Payment (#3597)

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)

Fixes #3552.

Signed-off-by: Roman Khimov <roman@nspcc.ru>

* specify the argument exception information.

* Fix Ut (#3635)

* NeoToken: add NEP-27 to supported standards list starting from Echidna (#3643)

#3597 introduces `onNEP17Payment`
handler to native NeoToke contract starting from Echidna hardfork. We
need to update the list of supported standards respectively.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>

* ut: fix HF_Echidna unit tests (#3646)

* Fix UT

* Update src/Neo/ProtocolSettings.cs

Co-authored-by: nan01ab <yjcc201374@outlook.com>

* Update src/Neo/ProtocolSettings.cs

Co-authored-by: nan01ab <yjcc201374@outlook.com>

* Update src/Neo/ProtocolSettings.cs

Co-authored-by: Christopher Schuchardt <cschuchardt88@gmail.com>

---------

Co-authored-by: Jimmy <jinghui@wayne.edu>
Co-authored-by: nan01ab <yjcc201374@outlook.com>
Co-authored-by: Christopher Schuchardt <cschuchardt88@gmail.com>

* [Core Add] Add support to Ed25519 (#3507)

* fix unnecessary change

* Clean using

---------

Co-authored-by: Fernando Diaz Toledano <shargon@gmail.com>

* Fix `HF_Echidna` comments (#3679)

* Fix obsolete

* Fix https://github.com/neo-project/neo/pull/3454/files#r1912152270

* Fix comment

* Update RoleManagement.cs

* Unset HF_Echidna

* Revert getTransaction

* Revert verifyWithECDsa

* format

---------

Signed-off-by: Roman Khimov <roman@nspcc.ru>
Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
Co-authored-by: Shargon <shargon@gmail.com>
Co-authored-by: Christopher Schuchardt <cschuchardt88@gmail.com>
Co-authored-by: nan01ab <yjcc201374@outlook.com>
Co-authored-by: Roman Khimov <roman@nspcc.ru>
Co-authored-by: Anna Shaleva <shaleva.ann@nspcc.ru>
Co-authored-by: Vitor Nazário Coelho <vncoelho@gmail.com>
AnnaShaleva added a commit that referenced this pull request Mar 28, 2025
`verifyWithEd25519` was recently added in #3507 and is a part of
Echidna, but its argument naming convention differs from the one we have
in `verifyWithECDsa`. This change is reflected in the CryptoLib's
manifest, so it's nice when we have a unified naming in native contract
manifest.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
NGDAdmin added a commit that referenced this pull request Mar 31, 2025
…3855)

`verifyWithEd25519` was recently added in #3507 and is a part of
Echidna, but its argument naming convention differs from the one we have
in `verifyWithECDsa`. This change is reflected in the CryptoLib's
manifest, so it's nice when we have a unified naming in native contract
manifest.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
Co-authored-by: NGD Admin <154295625+NGDAdmin@users.noreply.github.com>
cschuchardt88 pushed a commit to cschuchardt88/neo that referenced this pull request Jun 8, 2025
…eo-project#3855)

`verifyWithEd25519` was recently added in neo-project#3507 and is a part of
Echidna, but its argument naming convention differs from the one we have
in `verifyWithECDsa`. This change is reflected in the CryptoLib's
manifest, so it's nice when we have a unified naming in native contract
manifest.

Signed-off-by: Anna Shaleva <shaleva.ann@nspcc.ru>
Co-authored-by: NGD Admin <154295625+NGDAdmin@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants