Skip to content

History and outcome lookup#21

Open
viatrix wants to merge 5 commits into
devfrom
feat-history
Open

History and outcome lookup#21
viatrix wants to merge 5 commits into
devfrom
feat-history

Conversation

@viatrix

@viatrix viatrix commented Jul 1, 2026

Copy link
Copy Markdown
Collaborator

Implements #7 .
Left to implement: setting the history and the isCanonical flag during the fork. Will be implemented after implementing the forking process.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Implements universe fork-history encoding (MSB-first bitmap) and uses it to support ancestor-based query outcome lookup and “already resolved in ancestor” guards in Multiverse, aligning with Issue #7’s goal of efficient lineage checks.

Changes:

  • Adds LibHistory library for (history, forkDepth) encoding and O(1) ancestor prefix checks.
  • Extends Multiverse universe/query storage to track fork depth/canonical flag and per-query resolvedUniverses, enabling inherited outcome lookup via ancestry.
  • Adds unit tests for LibHistory and adjusts Foundry configuration to allow expectRevert on internal calls.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 9 comments.

File Description
src/libraries/LibHistory.sol New library to append fork bits and check ancestor relationships via prefix masking.
src/Multiverse.sol Adds fork metadata and implements ancestor-based getOutcome plus resolution-recording helpers.
test/unit/LibHistory.t.sol Adds unit + fuzz coverage for LibHistory invariants and edge cases.
foundry.toml Enables internal expectRevert support for the new internal-library revert tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Multiverse.sol
Comment thread src/Multiverse.sol
Comment thread src/Multiverse.sol Outdated
Comment thread src/Multiverse.sol
Comment thread test/unit/LibHistory.t.sol Outdated
Comment thread test/unit/LibHistory.t.sol Outdated
Comment thread test/unit/LibHistory.t.sol
Comment thread test/unit/LibHistory.t.sol
Comment thread test/unit/LibHistory.t.sol Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants