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

Implementing Storage.Add on verification mempool cache #820

Closed

Conversation

igormcoelho
Copy link
Contributor

Draft implementation for: #814

@igormcoelho
Copy link
Contributor Author

Just to explain what I'm trying to do... right now, to make it easier, I created two interops: Storage.PutCache and Storage.GetCache. These will first access mempool cache (if Trigger is Verification), and then the persisted value, if not found on cache.
On the future, these can perhaps be merged (or not) with Storage.Get and Storage.Put (or PutEx) for more transparent usage... I don't know yet.

@igormcoelho
Copy link
Contributor Author

igormcoelho commented Jun 12, 2019

As advised by @ricklock9 (#814 (comment)) perhaps a better interface is something like Storage.IncreaseBy and Storage.DecreaseBy, since it allows only basic additive/subtractive stuff. Or more simply Storage.Add. Thanks Ricardo!

@igormcoelho igormcoelho changed the title Implementing IntCache storage types (write on verification) Implementing Storage.Add (also on verification with mempool cache) Jun 12, 2019
@igormcoelho igormcoelho changed the title Implementing Storage.Add (also on verification with mempool cache) Implementing Storage.Add on verification mempool cache Jun 12, 2019
@codecov-io
Copy link

Codecov Report

Merging #820 into master will decrease coverage by 0.05%.
The diff coverage is 5%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #820      +/-   ##
==========================================
- Coverage   38.41%   38.36%   -0.06%     
==========================================
  Files         176      176              
  Lines       12459    12479      +20     
==========================================
+ Hits         4786     4787       +1     
- Misses       7673     7692      +19
Impacted Files Coverage Δ
neo/Persistence/Snapshot.cs 78.94% <ø> (ø) ⬆️
neo/SmartContract/InteropService.cs 20.39% <5%> (-0.7%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fe3ab04...d40be85. Read the comment docs.

@codecov-io
Copy link

codecov-io commented Jun 14, 2019

Codecov Report

Merging #820 into master will decrease coverage by <.01%.
The diff coverage is 41.02%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #820      +/-   ##
==========================================
- Coverage   38.41%   38.41%   -0.01%     
==========================================
  Files         176      176              
  Lines       12459    12496      +37     
==========================================
+ Hits         4786     4800      +14     
- Misses       7673     7696      +23
Impacted Files Coverage Δ
neo/SmartContract/Native/Tokens/Nep5Token.cs 96.4% <100%> (ø) ⬆️
neo/SmartContract/InteropService.cs 20.39% <5%> (-0.7%) ⬇️
neo/Persistence/Snapshot.cs 77.77% <76.47%> (-1.17%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fe3ab04...c008f74. Read the comment docs.

@igormcoelho
Copy link
Contributor Author

igormcoelho commented Jun 14, 2019

@shargon @erikzhang this is the core of the idea... not complete yet, but given an overview of the changes needed on Nep5Token class. Can you take a look please, just to evaluate the direction?
I know it's not beautiful the code hahaha please, just the direction... ;)

@igormcoelho
Copy link
Contributor Author

igormcoelho commented Jun 14, 2019

In fact, to implement this, we would first need to detach balance from TState objects: #831
Issue: #830

@igormcoelho
Copy link
Contributor Author

Not feasible anymore... however, lead to nice improvements, such as garbage collection and dettached TState objects ;)

@igormcoelho igormcoelho deleted the feat_3x_storage_intcache branch June 21, 2019 18:16
Thacryba pushed a commit to simplitech/neo that referenced this pull request Feb 17, 2020
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