Remove artifact ledger from witnesses#389
Remove artifact ledger from witnesses#389andrew-fleming wants to merge 7 commits intoOpenZeppelin:mainfrom
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
WalkthroughThis PR generalizes witness interfaces and factories across the codebase to accept a generic ledger type parameter, replacing hardcoded Ledger dependencies with a type parameter L. Changes propagate through witness definitions, simulators, and related documentation without altering control flow or functional logic. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
📝 Coding Plan
Comment Tip CodeRabbit can enforce grammar and style rules using `languagetool`.Configure the |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@CHANGELOG.md`:
- Line 12: The changelog entry "Use generic ledger type in ZOwnablePKWitnesses"
still uses a placeholder "(#)"; update that entry to reference the actual PR or
issue number or URL (e.g., replace "(#)" with the real PR number like "(`#1234`)"
or a full issue/PR link) so the release note is traceable and points to the
correct discussion.
In `@packages/simulator/README.md`:
- Around line 85-86: The comment incorrectly calls the export
MyContractWitnesses a "generic function"; change the wording to call it a
"factory function" instead. Update the surrounding comment where
MyContractWitnesses is referenced to read something like "but for the simulator,
wrap it in a factory function:" so the term matches the implementation (() =>
({})) and avoids implying type generics.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 5f32dd5c-fd91-4e7c-8671-35c037a15d3e
📒 Files selected for processing (8)
CHANGELOG.mdcontracts/src/access/test/simulators/ZOwnablePKSimulator.tscontracts/src/access/witnesses/ZOwnablePKWitnesses.tspackages/simulator/README.mdpackages/simulator/test/fixtures/sample-contracts/witnesses/SampleZOwnableWitnesses.tspackages/simulator/test/fixtures/sample-contracts/witnesses/WitnessWitnesses.tspackages/simulator/test/integration/SampleZOwnableSimulator.tspackages/simulator/test/integration/WitnessSimulator.ts
CHANGELOG.md
Outdated
|
|
||
| ### Changes | ||
|
|
||
| - Use generic ledger type in ZOwnablePKWitnesses (#) |
There was a problem hiding this comment.
Replace the placeholder reference in the changelog entry.
(#) is still a placeholder; please point this to the actual PR/issue so the release note is traceable.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@CHANGELOG.md` at line 12, The changelog entry "Use generic ledger type in
ZOwnablePKWitnesses" still uses a placeholder "(#)"; update that entry to
reference the actual PR or issue number or URL (e.g., replace "(#)" with the
real PR number like "(`#1234`)" or a full issue/PR link) so the release note is
traceable and points to the correct discussion.
| // But for the simulator, wrap it in a generic function: | ||
| export const MyContractWitnesses = () => ({}); |
There was a problem hiding this comment.
Fix wording: this is a factory function, not a generic function.
The comment says “generic function”, but () => ({}) is non-generic. Rename it to “factory function” to avoid confusion.
Suggested doc fix
-// But for the simulator, wrap it in a generic function:
+// But for the simulator, wrap it in a factory function:
export const MyContractWitnesses = () => ({});📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| // But for the simulator, wrap it in a generic function: | |
| export const MyContractWitnesses = () => ({}); | |
| // But for the simulator, wrap it in a factory function: | |
| export const MyContractWitnesses = () => ({}); |
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.
In `@packages/simulator/README.md` around lines 85 - 86, The comment incorrectly
calls the export MyContractWitnesses a "generic function"; change the wording to
call it a "factory function" instead. Update the surrounding comment where
MyContractWitnesses is referenced to read something like "but for the simulator,
wrap it in a factory function:" so the term matches the implementation (() =>
({})) and avoids implying type generics.
emnul
left a comment
There was a problem hiding this comment.
Nice way to make the witness files cleaner!
This PR proposes to use a generic ledger in the ZOwnablePK witnesses file. This removes the witness dependence on the generated artifact (which is from the mock contract). Updating the simulator is relatively straightforward bc it already has access to the ledger
This PR also updates the simulator package accordingly
Summary by CodeRabbit
Documentation
Refactor