Conversation
…dings Use revertIfNotConfigOperatorOrOwner instead of revertIfNotApiPayerOrOwner for setConfigOperator so only the config operator or diamond owner can reassign the role. Fix "Orwner" typo in SecurityLib. Regenerate Rust ABI bindings via make generate. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Refactors AccountConfig’s “owner” concept by introducing a configOperator role in AppStorage, while switching authorization checks that previously relied on s.owner to use the canonical diamond owner (LibDiamond.contractOwner()), and updates generated ABI/bindings accordingly.
Changes:
- Add
configOperator()view andsetConfigOperator(address)setter (with a newOnlyConfigOperatorOrOwnererror). - Replace
s.ownerauthorization checks inSecurityLibwithLibDiamond.contractOwner(). - Regenerate the ABI JSON and Rust ethers bindings to include the new function/error.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| lit-api-server/src/accounts/contracts/AccountConfig.json | Adds ABI entries for configOperator, setConfigOperator, and OnlyConfigOperatorOrOwner. |
| lit-api-server/src/accounts/contracts/account_config_contract.rs | Regenerates Rust bindings to expose config_operator() / set_config_operator() and the new error decoding. |
| lit-api-server/blockchain/lit_node_express/contracts/AccountConfigFacets/ViewsFacet.sol | Exposes configOperator() view over diamond storage. |
| lit-api-server/blockchain/lit_node_express/contracts/AccountConfigFacets/SecurityLib.sol | Adds revertIfNotConfigOperatorOrOwner and switches “owner” checks to LibDiamond.contractOwner(). |
| lit-api-server/blockchain/lit_node_express/contracts/AccountConfigFacets/AppStorage.sol | Renames the storage field from owner to configOperator and adds a corresponding error. |
| lit-api-server/blockchain/lit_node_express/contracts/AccountConfigFacets/APIConfigFacet.sol | Adds setConfigOperator(address) state mutation. |
| lit-api-server/blockchain/lit_node_express/contracts/AccountConfig.sol | Initializes configOperator in the constructor instead of owner. |
Comments suppressed due to low confidence (1)
lit-api-server/blockchain/lit_node_express/contracts/AccountConfigFacets/SecurityLib.sol:148
configOperatoris introduced as a distinct role (seeAppStorage.AccountConfigStorage.configOperator), but the existing “owner” authorization paths (revertIfNotApiPayerOrOwner/checkIfApiPayerOrOwner) now only considerLibDiamond.contractOwner(). As a result, callingsetConfigOperator()will not grant the new operator permission to perform the config actions currently guarded by these helpers (e.g.,setRequestedApiPayerCount,setApiPayers,setNodeConfiguration). If the intent is that the config operator retains the olds.ownercapabilities, update these checks to includes.configOperator; otherwise, consider clarifying/renaming to avoid a role that has no effect beyondsetConfigOperatoritself.
function revertIfNotApiPayerOrOwner(address caller) internal view {
AppStorage.AccountConfigStorage storage s = AppStorage.getStorage();
if (
!s.api_payers.contains(caller) &&
caller != LibDiamond.contractOwner() &&
caller != s.adminApiPayerAccount
) {
revert AppStorage.OnlyApiPayerOrOwner(caller);
}
}
function checkIfApiPayerOrPricingOperator(address caller) internal view {
AppStorage.checkIfApiPayerOrPricingOperator(
AppStorage.getStorage(),
caller
);
}
function checkIfApiPayer(address caller) internal view {
AppStorage.AccountConfigStorage storage s = AppStorage.getStorage();
if (!s.api_payers.contains(caller)) {
revert AppStorage.OnlyApiPayer(caller);
}
}
function checkIfApiPayerOrOwner(address caller) internal view {
AppStorage.AccountConfigStorage storage s = AppStorage.getStorage();
if (
!s.api_payers.contains(caller) &&
caller != LibDiamond.contractOwner() &&
caller != s.adminApiPayerAccount
) {
revert AppStorage.OnlyApiPayerOrOwner(caller);
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…nfigFacets/SecurityLib.sol Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
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.
Summary
ownerstorage field toconfigOperatorin AppStorage, separating config management from diamond ownershipsetConfigOperatorsetter (gated byrevertIfNotConfigOperatorOrOwner) andconfigOperator()views.ownerreferences in SecurityLib withLibDiamond.contractOwner()for authorization checksTest plan
npx hardhat compilesetConfigOperatoris only callable by current config operator or diamond ownerconfigOperator()view returns correct address after initializationrevertIfNotApiPayerOrOwnerchecks now use diamond owner correctly🤖 Generated with Claude Code