-
Notifications
You must be signed in to change notification settings - Fork 461
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
EIP-1153: Transient storage opcodes #4126
Conversation
WOW massive! We need a thorough review of this. With merge going on as highest priority it might take us a bit of time. But awesome! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One major issue - I don't like the break down of StorageProvider into more classes, we probably want the contrary to have State and Storage unified in the future (Verkle tries) and this will make the code harder to refactor. It is also unnecessary as transient storage is way simpler than persistent one and doesn't need all its bells and whistles. If I am wrong and don't see something that is needed and comes from EIP spec, please do tell me, I might have missed something.
Other comments are minor omissions or nitpicks that would be good to address but I am open to discussion if you don't agree with them.
Also we are trying to add some more comments to the code to having documenting comments in most important places would help a bit.
Other than that still great PR!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not too familiar with the codebase but this is very cool. Thanks for putting this together.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you accidently updated submodules.
Pushed my refactorings to: https://github.com/NethermindEth/nethermind/tree/1153 and commit: d0e8d0d |
Thanks! Just reviewed your changes and they look great. |
Can you merge it to your PR? |
Just merged! I'll go through and add more comments to the files that I touched. |
Changes:
Note that the old
StorageProvider.cs
code is now split acrossPartialStorageProviderBase.cs
andPersistentStorageProvider.cs
(no new code in these two files).Types of changes
What types of changes does your code introduce?
Put an
x
in the boxes that applyTesting
Requires testing
In case you checked yes, did you write tests??
Eip1153 Tests 🆕
TLOAD(x)
is0
TSTORE(x, y)
,TLOAD(x)
returnsy
TSTORE(x, y)
,TLOAD(x + n)
wheren > 0
returns0
TSTORE(x, y)
,CALL(z, ...)
,TLOAD(x)
returns0
TSTORE(x, y)
,CALL(self, ...)
,TLOAD(x)
returnsy
TSTORE(x, y)
,CALL(self, ...)
,TSTORE(x, z)
,TLOAD(x)
returnsz
TSTORE(x, y)
,CALL(self, ...)
,TSTORE(x, z)
,RETURN
,TLOAD(x)
returnsz
TSTORE(x, y)
,CALL(self, ...)
,TSTORE(x, z)
,REVERT
,TLOAD(x)
returnsy
TSTORE(x, y)
,CALL(self, ...)
,TSTORE(x, z)
,TSTORE(x, z + 1)
REVERT
,TLOAD(x)
returnsy
TSTORE(x, y)
,CALL(self, ...)
,CALL(self, ...)
,TSTORE(x, y + 1)
,RETURN
,REVERT
,TLOAD(x)
returnsy
TSTORE(x, y)
,DELEGATECALL(a, ...)
,TSTORE(x, z)
,RETURN
,TLOAD(x)
returnsz
TSTORE(x, y)
,DELEGATECALL(a, ...)
,TLOAD(x)
returnsy
TSTORE(x, y)
,STATICCALL(a, ...)
,TSTORE(x, z)
revertsTSTORE(x, y)
,STATICCALL(self, ...)
,TSTORE(x, z)
revertsTSTORE(x, y)
,STATICCALL(self, ...)
,CALL(self, ...)
,TSTORE(x, z)
revertsTSTORE(x, y)
,STATICCALL(self, ...)
,CALL(self, ...)
,TLOAD(x)
returnsy
VirtualMachine Tests
TLOAD(x)
costs 100 gasSLOAD
TSTORE(x, y)
costs 100 gasSSTORE
StorageProvider Tests
Invalid Opcode Tests
Further comments (optional)
I evaluated various designs implementing TransientStorageProvider and optimized for code reuse and limiting impact across code-base. StorageProvider maintains the same interface, thus keeping the caller logic mostly unchanged.