Repository navigation
feat: governedAsDeclared by name reads the book's adminRole - #11
Merged
Merged
Conversation
anupsv
approved these changes
Oct 13, 2026
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.
Motivation
governedAsDeclared(target)requires the authority to hold_ROLE_0on the target, which the Router does not grant: the book declares it owner-governed only, so a correct post-upgrade check of the Router fails on a role it was never meant to hold.The book already says which contracts the authority holds the admin role on (
contracts.<name>.adminRole); the helper should read it rather than demand the role everywhere.Modifications
src/LatticeTest.sol:governedAsDeclared(string name)reads the target, the timelock, the declared admin role and the authority offbookPath()-> owned by the timelock always,_ROLE_0only where the book declaresadminRole. The address form is unchanged.LatticeTestVmgainsparseJsonAddress,parseJsonBool,keyExistsJson.test/Governed.t.sol: the name form on a harness with a book of its own, per test file (forge runs tests in parallel): owner-governed only passes on its owner, a declared role is required, another owner fails either way.docs/testing.md: the check's row and the example use the name form.Result
A release's post-upgrade suite can assert
governedAsDeclared("router")and get the book's answer; a target the book declares admin-governed is still held to the role.Note
Low Risk
Scope is release test helpers and docs; strict address-based checks are unchanged, and new tests cover the book-driven behavior.
Overview
Fixes post-upgrade governance checks for contracts the book marks as owner-governed only (e.g. Router), where
governedAsDeclared(address)incorrectly required the authority to hold_ROLE_0.Adds
governedAsDeclared(string name), which loads the contract, timelock, and authority frombookPath()and only enforces admin role whencontracts.<name>.adminRoleis present and true; missing or falseadminRolepasses on timelock ownership alone. The address overload is unchanged for callers that always want the role check.LatticeTestVmgainsparseJsonAddress,parseJsonBool, andkeyExistsJsonfor book parsing.test/Governed.t.solexercises owner-only vs admin-governed paths with per-test book files.docs/testing.mdupdates the checklist row and example to usegovernedAsDeclared("exchange").Reviewed by Cursor Bugbot for commit 510f2c2. Bugbot is set up for automated code reviews on this repo. Configure here.