Skip to content

Conversation

@shargon
Copy link
Member

@shargon shargon commented Jan 24, 2025

Description

Close #3628
Alternative to #3633

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?

  • Crypto tests

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

@shargon shargon mentioned this pull request Jan 24, 2025
15 tasks
@shargon shargon marked this pull request as ready for review January 24, 2025 09:12
@shargon
Copy link
Member Author

shargon commented Jan 24, 2025

@neo-project/core Please take special look into HashAlgorithm.None I think that is well implemented and it can't produce a state difference in other places

@shargon shargon requested a review from Jim8y January 26, 2025 10:11
@shargon shargon added the Help Wanted We suggest a careful read at https://docs.neo.org/. However, fell free to further discuss the topic. label Feb 11, 2025
@shargon shargon requested a review from Jim8y February 11, 2025 11:50
@Jim8y Jim8y self-assigned this Feb 13, 2025
@Jim8y
Copy link
Contributor

Jim8y commented Feb 14, 2025

@Jim8y thanks for fix it!

my pleasure

Jim8y
Jim8y previously approved these changes Feb 14, 2025
Jim8y
Jim8y previously approved these changes Feb 15, 2025
cschuchardt88
cschuchardt88 previously approved these changes Feb 15, 2025
nan01ab
nan01ab previously approved these changes Feb 15, 2025
@shargon shargon dismissed stale reviews from cschuchardt88, nan01ab, and Jim8y via aedbc82 February 15, 2025 14:35
@NGDAdmin NGDAdmin merged commit f8f2cdb into master Feb 17, 2025
7 checks passed
@NGDAdmin NGDAdmin deleted the ec-recover-v2 branch February 17, 2025 02:24
AnnaShaleva pushed a commit to AnnaShaleva/neo that referenced this pull request Feb 19, 2025
* EC Recover

* Clean code

* Fix ut

* Fix ut

* Unify hashing

* Allow HashAlgorithm.None

* Clean comment

* Update src/Neo/Cryptography/Crypto.cs

* Fix merge

* Add None check

* Fix GetHash

* fix unit testing issues

* Clean code

* Update src/Neo/SmartContract/Native/CryptoLib.cs

---------

Co-authored-by: Jimmy <[email protected]>
NGDAdmin added a commit that referenced this pull request Mar 4, 2025
* Implement NotaryAssisted transaction attribute

Close #2896. Use a stub for native Notary contract hash since this
contract is not implemented yet. Thus, technically, NotaryAssisted
attribute verification will always fail on real network until native
Notary is implemented.

Signed-off-by: Anna Shaleva <[email protected]>

* Payloads: add doc to CalculateNetworkFee method of NotaryAssisted attribute

Signed-off-by: Anna Shaleva <[email protected]>

* Native: add NotaryAssisted attributes handler to Gas OnPersist

Transactions network fee should be split between Primary node and Notary
nodes.

Signed-off-by: Anna Shaleva <[email protected]>

* Payloads: adjust comment to NotaryAssisted attribute

Signed-off-by: Anna Shaleva <[email protected]>

* Payloads: temporary use hard-coded Notary contract hash

Once Notary contract is implemented, this hash will be replaced by a
proper Notary contract hash. The exact value won't be changed since
Notary contract has constant hash as any other native contract.

Signed-off-by: Anna Shaleva <[email protected]>

* Payloads: replace hard-coded Notary hash value with calculated one

No functional changes, just a refactoring for better code readability.

Signed-off-by: Anna Shaleva <[email protected]>

* NeoModules: integrate NotaryAssisted attribute

Port the neo-project/neo-modules#884.

Signed-off-by: Anna Shaleva <[email protected]>

* Payloads: fix XML comment formatting

Signed-off-by: Anna Shaleva <[email protected]>

* P2P: move NotaryAssisted transaction attribute under D hardfork

Signed-off-by: Anna Shaleva <[email protected]>

* P2P: move NotaryAssisted transaction attribute under E hardfork

D hardfork was occupied by 3.7.5, thus use the next available one.

Signed-off-by: Anna Shaleva <[email protected]>

* tests: fix build errors

No functional changes, just build fixes required by updated master
branch.

Signed-off-by: Anna Shaleva <[email protected]>

* NotaryAssisted: update copyright date

Signed-off-by: Anna Shaleva <[email protected]>

* SmartContract: refactor obsolete code

Signed-off-by: Anna Shaleva <[email protected]>

* Persistance: fix UT

Related to additional storage entries added by the previous changes.

Signed-off-by: Anna Shaleva <[email protected]>

* Clean comments

* Native: improve exception message for Policy's getFee/setFee

Signed-off-by: Anna Shaleva <[email protected]>

* EC Recover (#3696)

* EC Recover

* Clean code

* Fix ut

* Fix ut

* Unify hashing

* Allow HashAlgorithm.None

* Clean comment

* Update src/Neo/Cryptography/Crypto.cs

* Fix merge

* Add None check

* Fix GetHash

* fix unit testing issues

* Clean code

* Update src/Neo/SmartContract/Native/CryptoLib.cs

---------

Co-authored-by: Jimmy <[email protected]>

* Improve MaxNestingDepth of WitnessCondition (#3761)

* tests: add UT for nested WitnessCondition

This just works as the code works.

Signed-off-by: Roman Khimov <[email protected]>

* WitnessCondition: unify nesting checks, fix MaxNestingDepth

1. We have some duplication around "maxNestDepth <= 0" checks.
2. If we're to fix them by moving to DeserializeFrom() and thereby affecting
   all types of conditions we can discover a simple truth about conditions
   that was hidden previously: our real supported MaxNestingDepth is 3, not 2.
3. Test_WitnessCondition_Nesting works as before, check it there, we have
   And->And->Boolean and other nesting cases, 3-4 elements in the chain,
   not 2.

Signed-off-by: Roman Khimov <[email protected]>

* WitnessCondition: unify JSON parsing as well

Signed-off-by: Roman Khimov <[email protected]>

* tests: s/WitnessContition/WitnessCondition/

Fix typo.

Signed-off-by: Roman Khimov <[email protected]>

* Format header

* Format arrays in UT_WitnessCondition.cs

---------

Signed-off-by: Roman Khimov <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: Christopher Schuchardt <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* Add Support for Plugin Loading by Assembly (#3755)

* Add Support for plugin loading

* Added @shargon request of changes

---------

Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* Optimize `StorageKey` creation (#3756)

* Optimize key builder

* Optimize with GetSpan

* Use Span

* Clean

* Rename

* Update src/Neo/SmartContract/KeyBuilder.cs

Co-authored-by: nan01ab <[email protected]>

* Update KeyBuilder.cs

* @cschuchardt88 feedback

* Avoid ToArray in StorageKey constructor

* Use sizeof

* Optimize ECPoint

* Optimize ECPoint

* Add ISerializableSpan

* Move to StorageKey

* Use ReadOnlySpan

---------

Co-authored-by: nan01ab <[email protected]>
Co-authored-by: Christopher Schuchardt <[email protected]>

* [`Fix`] Linux File Access (#3769)

* Add some stuff to hope once and for all fix the linux workflows

* update workflow

* update nuget.yml

* Change dig to detailed, log too big

* Fix targets

* revert main.yml

* Update .github/workflows/main.yml

* disable BuildInParallel

---------

Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>

* Update src/Neo/SmartContract/Native/PolicyContract.cs

* UnitTests: migrate NotaryAssisted test from MSTestV1 to MSTestV2

Signed-off-by: Anna Shaleva <[email protected]>

---------

Signed-off-by: Anna Shaleva <[email protected]>
Signed-off-by: Roman Khimov <[email protected]>
Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: Christopher Schuchardt <[email protected]>
Co-authored-by: Roman Khimov <[email protected]>
Co-authored-by: NGD Admin <[email protected]>
Co-authored-by: nan01ab <[email protected]>
AnnaShaleva added a commit to nspcc-dev/neo-go that referenced this pull request Apr 9, 2025
AnnaShaleva added a commit to nspcc-dev/neo-go that referenced this pull request Apr 9, 2025
AnnaShaleva added a commit to nspcc-dev/neo-go that referenced this pull request Apr 9, 2025
cschuchardt88 pushed a commit to cschuchardt88/neo that referenced this pull request Jun 8, 2025
* EC Recover

* Clean code

* Fix ut

* Fix ut

* Unify hashing

* Allow HashAlgorithm.None

* Clean comment

* Update src/Neo/Cryptography/Crypto.cs

* Fix merge

* Add None check

* Fix GetHash

* fix unit testing issues

* Clean code

* Update src/Neo/SmartContract/Native/CryptoLib.cs

---------

Co-authored-by: Jimmy <[email protected]>
cschuchardt88 added a commit to cschuchardt88/neo that referenced this pull request Jun 8, 2025
* Implement NotaryAssisted transaction attribute

Close neo-project#2896. Use a stub for native Notary contract hash since this
contract is not implemented yet. Thus, technically, NotaryAssisted
attribute verification will always fail on real network until native
Notary is implemented.

Signed-off-by: Anna Shaleva <[email protected]>

* Payloads: add doc to CalculateNetworkFee method of NotaryAssisted attribute

Signed-off-by: Anna Shaleva <[email protected]>

* Native: add NotaryAssisted attributes handler to Gas OnPersist

Transactions network fee should be split between Primary node and Notary
nodes.

Signed-off-by: Anna Shaleva <[email protected]>

* Payloads: adjust comment to NotaryAssisted attribute

Signed-off-by: Anna Shaleva <[email protected]>

* Payloads: temporary use hard-coded Notary contract hash

Once Notary contract is implemented, this hash will be replaced by a
proper Notary contract hash. The exact value won't be changed since
Notary contract has constant hash as any other native contract.

Signed-off-by: Anna Shaleva <[email protected]>

* Payloads: replace hard-coded Notary hash value with calculated one

No functional changes, just a refactoring for better code readability.

Signed-off-by: Anna Shaleva <[email protected]>

* NeoModules: integrate NotaryAssisted attribute

Port the neo-project/neo-modules#884.

Signed-off-by: Anna Shaleva <[email protected]>

* Payloads: fix XML comment formatting

Signed-off-by: Anna Shaleva <[email protected]>

* P2P: move NotaryAssisted transaction attribute under D hardfork

Signed-off-by: Anna Shaleva <[email protected]>

* P2P: move NotaryAssisted transaction attribute under E hardfork

D hardfork was occupied by 3.7.5, thus use the next available one.

Signed-off-by: Anna Shaleva <[email protected]>

* tests: fix build errors

No functional changes, just build fixes required by updated master
branch.

Signed-off-by: Anna Shaleva <[email protected]>

* NotaryAssisted: update copyright date

Signed-off-by: Anna Shaleva <[email protected]>

* SmartContract: refactor obsolete code

Signed-off-by: Anna Shaleva <[email protected]>

* Persistance: fix UT

Related to additional storage entries added by the previous changes.

Signed-off-by: Anna Shaleva <[email protected]>

* Clean comments

* Native: improve exception message for Policy's getFee/setFee

Signed-off-by: Anna Shaleva <[email protected]>

* EC Recover (neo-project#3696)

* EC Recover

* Clean code

* Fix ut

* Fix ut

* Unify hashing

* Allow HashAlgorithm.None

* Clean comment

* Update src/Neo/Cryptography/Crypto.cs

* Fix merge

* Add None check

* Fix GetHash

* fix unit testing issues

* Clean code

* Update src/Neo/SmartContract/Native/CryptoLib.cs

---------

Co-authored-by: Jimmy <[email protected]>

* Improve MaxNestingDepth of WitnessCondition (neo-project#3761)

* tests: add UT for nested WitnessCondition

This just works as the code works.

Signed-off-by: Roman Khimov <[email protected]>

* WitnessCondition: unify nesting checks, fix MaxNestingDepth

1. We have some duplication around "maxNestDepth <= 0" checks.
2. If we're to fix them by moving to DeserializeFrom() and thereby affecting
   all types of conditions we can discover a simple truth about conditions
   that was hidden previously: our real supported MaxNestingDepth is 3, not 2.
3. Test_WitnessCondition_Nesting works as before, check it there, we have
   And->And->Boolean and other nesting cases, 3-4 elements in the chain,
   not 2.

Signed-off-by: Roman Khimov <[email protected]>

* WitnessCondition: unify JSON parsing as well

Signed-off-by: Roman Khimov <[email protected]>

* tests: s/WitnessContition/WitnessCondition/

Fix typo.

Signed-off-by: Roman Khimov <[email protected]>

* Format header

* Format arrays in UT_WitnessCondition.cs

---------

Signed-off-by: Roman Khimov <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: Christopher Schuchardt <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* Add Support for Plugin Loading by Assembly (neo-project#3755)

* Add Support for plugin loading

* Added @shargon request of changes

---------

Co-authored-by: Shargon <[email protected]>
Co-authored-by: NGD Admin <[email protected]>

* Optimize `StorageKey` creation (neo-project#3756)

* Optimize key builder

* Optimize with GetSpan

* Use Span

* Clean

* Rename

* Update src/Neo/SmartContract/KeyBuilder.cs

Co-authored-by: nan01ab <[email protected]>

* Update KeyBuilder.cs

* @cschuchardt88 feedback

* Avoid ToArray in StorageKey constructor

* Use sizeof

* Optimize ECPoint

* Optimize ECPoint

* Add ISerializableSpan

* Move to StorageKey

* Use ReadOnlySpan

---------

Co-authored-by: nan01ab <[email protected]>
Co-authored-by: Christopher Schuchardt <[email protected]>

* [`Fix`] Linux File Access (neo-project#3769)

* Add some stuff to hope once and for all fix the linux workflows

* update workflow

* update nuget.yml

* Change dig to detailed, log too big

* Fix targets

* revert main.yml

* Update .github/workflows/main.yml

* disable BuildInParallel

---------

Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>

* Update src/Neo/SmartContract/Native/PolicyContract.cs

* UnitTests: migrate NotaryAssisted test from MSTestV1 to MSTestV2

Signed-off-by: Anna Shaleva <[email protected]>

---------

Signed-off-by: Anna Shaleva <[email protected]>
Signed-off-by: Roman Khimov <[email protected]>
Co-authored-by: Jimmy <[email protected]>
Co-authored-by: Shargon <[email protected]>
Co-authored-by: Christopher Schuchardt <[email protected]>
Co-authored-by: Roman Khimov <[email protected]>
Co-authored-by: NGD Admin <[email protected]>
Co-authored-by: nan01ab <[email protected]>
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.

Recover Public Key from Signature for Secp256k1

9 participants