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

Nullable in Storage classes #3670

Merged
merged 23 commits into from
Jan 19, 2025
Merged

Nullable in Storage classes #3670

merged 23 commits into from
Jan 19, 2025

Conversation

shargon
Copy link
Member

@shargon shargon commented Jan 13, 2025

Description

Required for #3669

These changes are required for #3669, was found some errors with nullables, and it require to be solved first

Fixes # (issue)

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?

  • Current 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 added the Blocker Issues that are blocking other issues. Check issues details to see what it is blocking. label Jan 13, 2025
}

protected override void UpdateInternal(StorageKey key, StorageItem value)
{
innerCache.GetAndChange(key).FromReplica(value);
_innerCache.GetAndChange(key)?.FromReplica(value);
Copy link
Member Author

Choose a reason for hiding this comment

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

This fail before, is this expected?

Copy link
Contributor

Choose a reason for hiding this comment

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

This fail before, is this expected?

I think it should be a bug.

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't understand why SnapshotCache read from store, but write if the snapshot exists...

Copy link
Member Author

Choose a reason for hiding this comment

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

Because I want to avoid logic changes in this PR, I will throw a different exception, taking a look to the code it seems that it should always exists or it's a failure

src/Neo/Persistence/DataCache.cs Outdated Show resolved Hide resolved
src/Neo/Persistence/DataCache.cs Outdated Show resolved Hide resolved
src/Neo/Persistence/MemorySnapshot.cs Outdated Show resolved Hide resolved
src/Neo/Persistence/MemoryStore.cs Outdated Show resolved Hide resolved
Co-authored-by: Christopher Schuchardt <[email protected]>
@shargon
Copy link
Member Author

shargon commented Jan 17, 2025

@neo-project/core could you take a look to this one please

@@ -239,18 +233,18 @@ public void Delete(StorageKey key)
}
if (seek_prefix == null)
{
throw new ArgumentException();
throw new ArgumentException($"{nameof(key_prefix)} with all bytes being 0xff is not supported now");
Copy link
Member

@cschuchardt88 cschuchardt88 Jan 19, 2025

Choose a reason for hiding this comment

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

Why is all 0xff not support? Then SeekDirection should be only Forward and removed from the parameters of this function.

You need 0xff to go Backward for SeekDirection. ApplicationLogs uses this method. However I used IStore interface to do what this can't do. If you can explain whats the problem. I can fix it.

Copy link
Contributor

Choose a reason for hiding this comment

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

Why is all 0xff not support? Then SeekDirection should be only Forward and removed from the parameters of this function.

You need 0xff to go Backward for SeekDirection. ApplicationLogs uses this method. However I used IStore interface to do what this can't do. If you can explain whats the problem. I can fix it.

I have a fix, waiting for this PR to merge.

@shargon shargon merged commit 3d00a60 into master Jan 19, 2025
7 checks passed
@shargon shargon deleted the storage-nullable branch January 19, 2025 18:35
@cschuchardt88
Copy link
Member

@nan01ab PR has been merge please add your PR for the 0xff fix. Please don't forget.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Blocker Issues that are blocking other issues. Check issues details to see what it is blocking. Waiting for Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants