fix: hb_maps:get arity misuse in genesis/delegated checkpoint flow + checkpoint data presence checks#702
Open
charmful0x wants to merge 4 commits intoedgefrom
Open
fix: hb_maps:get arity misuse in genesis/delegated checkpoint flow + checkpoint data presence checks#702charmful0x wants to merge 4 commits intoedgefrom
charmful0x wants to merge 4 commits intoedgefrom
Conversation
Author
|
also i added a fix for an if process was missing, this could propagate invalid state and fail later in commitment merge/update with silent errors. now it fail fast with typed throw and validate Process as map |
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.
about
following the work done on #701 i did more hb_maps:get/3 usage checks looking for default misuse.
dev_delegated_compute
hb_maps:get(<<"type">>, Snapshot, Opts) == <<"Checkpoint">>indev_delegated_computewas calling get with the incorrect arity (passing Opts as default). fixed that to use get 4 arity. the same forBody = hb_maps:get(<<"data">>, Snapshot, Opts),additionally for the Body patch, i added fail fast throw when the checkpoint data body isnt available
dev_genesis_wasm
the same incorrect hb_maps:get arity was used at
CheckpointTargetProcID = hb_maps:get(<<"process">>, CheckpointMessage, Opts)- patched that.additionally the
import_legacy_checkpoint/0test does:but
do_import/3already validates signer/process/nonce, but it didnt validate checkpoint payload presence. so i added a data presence check at ingress (not_found rejection):clarity required
~genesis-wasm@1.0restore flow goes through~delegated-compute@1.0(dev_genesis_wasm:normalize/3 -> dev_delegated_compute:normalize/3 -> load_state/2), so checkpoint payload assumptions should stay aligned both at ingress (do_import/3) and at restore execution (load_state/2)should the checkpoint point integrity policy be stricter in both dev_genesis_wasm and dev_delegated_compute to restrict 'existing but empty checkpoint' data payloads (following the import_legacy_checkpoint test)?