Skip to content

Conversation

@shargon
Copy link
Member

@shargon shargon commented Nov 26, 2025

Description

Port #4201 to N4

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?

  • Unit Testing
  • Run Application
  • Local Computer Tests
  • No Testing

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

@github-actions github-actions bot added the N4 label Nov 26, 2025
@shargon shargon changed the title [N4] Whitelist of Free Contracts< [N4] Whitelist of Free Contracts Nov 26, 2025
@Wi1l-B0t
Copy link
Contributor

Wi1l-B0t commented Dec 1, 2025

Coflicts

@shargon
Copy link
Member Author

shargon commented Dec 1, 2025

I will change the StorageKey Logic


var keyData = key.ToArray().AsSpan();
// TODO: Require a unwrap
(var method, var argCount) = StorageKey.ReadMethodAndArgCount(key.ToArray().AsSpan());
Copy link
Member Author

Choose a reason for hiding this comment

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

@erikzhang We need a method for unwrap a StorageKey

Copy link
Member

Choose a reason for hiding this comment

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

I have an idea. Instead of storing the methodName and argCount directly, we can read the contract's ABI and find the method's offset.

public class ContractMethodDescriptor : ContractEventDescriptor, IEquatable<ContractMethodDescriptor>
{
/// <summary>
/// Indicates the return type of the method. It can be any value of <see cref="ContractParameterType"/>.
/// </summary>
public ContractParameterType ReturnType { get; set; }
/// <summary>
/// The position of the method in the contract script.
/// </summary>
public int Offset { get; set; }

Once the contract is updated, all of its whitelists will become invalid. Therefore, storing only the Offset is safe.

Copy link
Member Author

Choose a reason for hiding this comment

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

It will safe storage, it's a good idea

@shargon shargon mentioned this pull request Dec 2, 2025
18 tasks
@Wi1l-B0t
Copy link
Contributor

Wi1l-B0t commented Dec 3, 2025

UT Failed.

erikzhang
erikzhang previously approved these changes Dec 4, 2025
ajara87
ajara87 previously approved these changes Dec 4, 2025
@shargon shargon dismissed stale reviews from ajara87 and erikzhang via 1e5908f December 4, 2025 10:05
@shargon shargon merged commit 4ac8cfc into neo-project:master Dec 4, 2025
7 checks passed
@shargon shargon deleted the whitelist-n4 branch December 4, 2025 10:09
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.

4 participants