Task3/richer slash with invalid block hash#35
Open
aprilyab wants to merge 5 commits intoiCog-Labs-Dev:devfrom
Open
Task3/richer slash with invalid block hash#35aprilyab wants to merge 5 commits intoiCog-Labs-Dev:devfrom
aprilyab wants to merge 5 commits intoiCog-Labs-Dev:devfrom
Conversation
f1r3node's SlashDeploy requires both validator public key and the hash of the equivocating block being slashed. Our SystemDeployRequest::Slash only carried the validator NodeId, forcing the adapter to use validator bytes as a placeholder for invalid_block_hash, which is semantically wrong. Added invalid_block_hash: Vec<u8> field to the enum and updated MockRuntime pattern matching to handle the new field. MockRuntime preserves the field through execution but doesn't use it for logic (deterministic hashing based on processed results, not inputs).
The adapter was using validator.0 as placeholder for invalid_block_hash when converting SystemDeployRequest::Slash to f1r3node's SystemDeployEnum. This meant f1r3node received the wrong hash for equivocation detection. Updated system_deploy_to_f1r3node() to pass the actual invalid_block_hash field instead of validator bytes placeholder. Documentation updated to reflect the breaking change and correct semantics.
Updated all documentation to reflect that SystemDeployRequest::Slash now carries both validator and invalid_block_hash fields, fixing the API limitation where only validator ID was available. Changes: - implementation.md: Updated API table and caveats section - INTEGRATION_NEXT_STEPS.md: Marked Task 3 as COMPLETED - cordial-miners-vs-cbc-casper.md: Updated Phase 3 status table Breaking change properly documented across all relevant documentation.
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.
Fixes #34
Summary
Extended
SystemDeployRequest::Slashto includeinvalid_block_hashfield and updated the f1r3node adapter to pass the real invalid block hash instead of using validator bytes as placeholder.Why this change is needed
f1r3node's
SlashDeployrequires both the validator's public key AND the hash of the equivocating block being slashed. OurSystemDeployRequest::Slashonly carried the validator NodeId, forcing the adapter to use validator bytes as a placeholder forinvalid_block_hash. This was semantically wrong - f1r3node would receive the wrong hash for equivocation detection, potentially leading to incorrect slashing behavior.What changed
invalid_block_hash: Vec<u8>field toSystemDeployRequest::Slashenumsystem_deploy_to_f1r3node()to pass realinvalid_block_hashinstead of validator placeholderTest plan
cargo +nightly-2025-06-15 test -p cordial-miners-core(17/17 runtime tests pass)cargo +nightly-2025-06-15 test -p cordial-f1r3space-adapter(13/13 translation tests pass)Integration crates modified
cordial-miners-core: Extended public API (SystemDeployRequest::Slash) - this is the breaking changecordial-f1r3space-adapter: Updated translation logic to use new fieldcordial-f1r3node- layering rules preservedBreaking change impact
SystemDeployRequest::Slashnow requiresinvalid_block_hashparameterMockRuntimeandF1r3RspaceRuntime(both updated)invalid_block_hashwhen constructing slash requestsDocumentation updates
docs/implementation.md: Updated API table and removed caveat about placeholderdocs/INTEGRATION_NEXT_STEPS.md: Marked Task 3 as COMPLETED ✅docs/cordial-miners-vs-cbc-casper.md: Updated Phase 3 status tableThis fixes the core integration issue where f1r3node would receive incorrect block hashes for slashing operations, ensuring proper equivocation detection in the consensus layer.