P10->P11 migration into Rust block state#1635
Open
allanbrondum wants to merge 1 commit into
Open
Conversation
allanbrondum
commented
Apr 23, 2026
| ProtocolLevelTokensNone :: (PltStateVersionFor pv ~ 'PLTStateNone) => ProtocolLevelTokensForStateVersion pv | ||
| ProtocolLevelTokensV0 :: (PltStateVersionFor pv ~ 'PLTStateV0) => (HashedBufferedRef' ProtocolLevelTokensHash ProtocolLevelTokens) -> ProtocolLevelTokensForStateVersion pv | ||
| ProtocolLevelTokensV1 :: (PltStateVersionFor pv ~ 'PLTStateV1) => RustBS.ForeignPLTBlockStatePtr pv -> ProtocolLevelTokensForStateVersion pv | ||
| data ProtocolLevelTokensForPV (pv :: ProtocolVersion) where |
Collaborator
Author
There was a problem hiding this comment.
Just renamed and reformatted
allanbrondum
commented
Apr 23, 2026
Comment on lines
+513
to
+523
| -- Migrate from Haskell to Rust, by reloading the PLT state from the blob store and into Rust and then | ||
| -- migrate the newly loaded state in the Rust block state implementation. | ||
| let oldBlobRefMaybe = getHBRRefIfBlobbed oldPLTsRef | ||
| let oldBlobRef = | ||
| maybe | ||
| (error "Haskell maintained PLT state to migrate from does not have blob reference set") | ||
| id | ||
| oldBlobRefMaybe | ||
| (oldState :: ForeignPLTBlockStatePtr (MPV m)) <- lift $ loadDirect (coerce oldBlobRef) | ||
| ProtocolLevelTokensV1 <$> RustBS.migrate oldState | ||
| migrateProtocolLevelTokensForPV migration (ProtocolLevelTokensV1 oldState) = |
Collaborator
Author
There was a problem hiding this comment.
The actual migration logic
td202
suggested changes
Apr 23, 2026
Comment on lines
+515
to
+520
| let oldBlobRefMaybe = getHBRRefIfBlobbed oldPLTsRef | ||
| let oldBlobRef = | ||
| maybe | ||
| (error "Haskell maintained PLT state to migrate from does not have blob reference set") | ||
| id | ||
| oldBlobRefMaybe |
Contributor
There was a problem hiding this comment.
Suggested change
| let oldBlobRefMaybe = getHBRRefIfBlobbed oldPLTsRef | |
| let oldBlobRef = | |
| maybe | |
| (error "Haskell maintained PLT state to migrate from does not have blob reference set") | |
| id | |
| oldBlobRefMaybe | |
| (_, oldBlobRef) <- lift $ refFlush oldPLTsRef |
Comment on lines
+1077
to
+1084
| -- | Get the 'BlobRef' if the value in the reference is stored in the blob store. Else | ||
| -- 'Nothing' is returned. | ||
| getBRRefIfBlobbed :: | ||
| BufferedRef a -> Maybe (BlobRef a) | ||
| getBRRefIfBlobbed (BRBlobbed ref) = Just ref | ||
| getBRRefIfBlobbed (BRMemory _ _) = Nothing | ||
| getBRRefIfBlobbed (BRBoth ref _) = Just ref | ||
|
|
Comment on lines
+1702
to
+1707
| -- | Get the 'BlobRef' if value in the reference is stored in the blob store. Else | ||
| -- 'Nothing' is returned. | ||
| getHBRRefIfBlobbed :: | ||
| HashedBufferedRef' h a -> Maybe (BlobRef a) | ||
| getHBRRefIfBlobbed (HashedBufferedRef br _) = getBRRefIfBlobbed br | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Implement migration of the Rust block state from P10 to P11 on the Haskell side.
Changes
The P10 PLT state is loaded by Rust and then migrated to P11 by Rust also.
Checklist
hard-to-understand areas.