-
Notifications
You must be signed in to change notification settings - Fork 79
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
[WIP] Implementation of EIP-1153: Transient Storage using Disk Persistence and Lifecycle Management #1588
base: master
Are you sure you want to change the base?
Conversation
…around comparing the liveliness of the transient data and validating that functionality in a test
pub transient_state: Cid, | ||
/// The nonce and actor id that represents the lifespan of the transient storage data | ||
pub transient_data_lifespan: Option<TransientDataLifespan>, |
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.
Can we combine these? That'll let us store a single "null" if there is no transient data.
@@ -314,6 +335,10 @@ impl<'r, RT: Runtime> System<'r, RT> { | |||
self.slots | |||
.set_root(&state.contract_state) | |||
.context_code(ExitCode::USR_ILLEGAL_STATE, "state not in blockstore")?; | |||
self.transient_slots |
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.
It would be nice if we could load this lazily on first-use, or even just if non-empty.
…bine transient_slots with transient_data_lifespan anyway.
…DO reinitialize does not properly clear state KAMT due to clone/reference issues that are being debugged
// Reinitialize the transient_slots with a fresh KAMT | ||
//let transient_store = self.rt.store().clone(); | ||
//self.transient_slots = StateKamt::new_with_config(transient_store, KAMT_CONFIG.clone()); | ||
// TODO XXX reinitialize does not currently work due to blockstore reference issues |
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'd be interested to know what these errors are and how you end up diagnosing the problem, for my own educational purposes because your commented code looks like it should work.
Description
This WIP PR introduces transient storage support in the Filecoin EVM, conceptually aligning with Ethereum's EIP-1153. Transient storage functionality is implemented with a tombstone mechanism for lifecycle tracking keyed by transaction identifiers (
origin
andnonce
). While the core implementation is in place, work remains on validating the transient data's lifecycle and completing associated tests.Current Progress
State Modifications:
Persistent Transient Data:
Cid
variable has been added to represent transient storage.Lifecycle Tracking:
TransientDataLifespan
to track lifecycle with originActorID
andnonce
.New Operations:
TLOAD
: Retrieves transient data while ensuring lifecycle validity.TSTORE
: Updates transient data and lifecycle.TODO
): Compare transaction metadata with stored tombstone.Remaining TODOs
Liveliness Check for Transient Data:
Code Location:
get_transient_storage
andset_transient_storage
inactors/evm/src/interpreter/system.rs
.// TODO check tombstone for liveliness of data
Test Coverage:
TLOAD
,TSTORE
) are partially tested.Code Location:
actors/evm/src/interpreter/instructions/storage.rs
(Test module)// TODO test transient storage lifecycle
Edge Case Handling:
Testing
Implemented Tests:
test_tload
: ValidatesTLOAD
operation when data exists.test_tload_oob
: Ensures out-of-boundsTLOAD
returns zero.test_tstore
: ConfirmsTSTORE
updates transient data correctly.Pending Tests:
TODO
in the test module).Tradeoffs and Considerations
Increased Storage Overhead:
transient_state
andtransient_data_lifespan
toState
.Gas Inefficiency:
Checklist
TLOAD
andTSTORE
.State
andSystem
.TLOAD
andTSTORE
.Next Steps
System
.References
Review Feedback
Incorporates feedback from @Stebalien:
State
clean unless other updates occur.Note: This PR is marked as WIP until lifecycle validation and associated tests are complete. Feedback on the current implementation and suggestions for completing TODOs are welcome!