Skip to content

Work#157

Merged
JaCoderX merged 2 commits into
devfrom
work
Apr 12, 2026
Merged

Work#157
JaCoderX merged 2 commits into
devfrom
work

Conversation

@JaCoderX
Copy link
Copy Markdown
Member

@JaCoderX JaCoderX commented Apr 12, 2026

Summary by CodeRabbit

Release Notes

  • New Features

    • Expanded SDK security exports with additional constants and type definitions.
    • Added test helpers for transaction cancellation and whitelist management.
  • Documentation

    • Clarified atomic initialization requirements for proxy-based contracts.
    • Enhanced meta-transaction handler contract/selector validation guidance.
    • Updated TxRecord documentation to clarify result preview truncation behavior.
    • Refined TransactionEvent field naming and filtering guidance.
  • Tests

    • Improved test coverage for guard configuration and whitelist delist scenarios.

…guidance

This commit updates the TypeScript SDK documentation to include the new `FUNCTION_SELECTORS` export and clarifies the initialization process for account-style contracts using OpenZeppelin's **Initializable** semantics. It emphasizes the importance of treating initialization as part of deployment to avoid uninitialized proxies and outlines best practices for atomic proxy creation and initialization. Additionally, it enhances the documentation for the `RuntimeRBAC` integration, detailing the handling of function permissions and the implications of protected schemas. These changes aim to improve clarity and usability for developers working with the SDK and related contracts.
This commit updates the GuardControllerDefinitions to rename the constant `CONTROLLER_CONFIG_OPERATION` to `CONTROLLER_CONFIG_BATCH` for improved clarity and consistency. The change is reflected across the ABI files, Solidity definitions, and TypeScript SDK, ensuring that all references are updated accordingly. Additionally, documentation has been modified to reflect this new naming convention, enhancing the understanding of operation types within the GuardController context. These changes aim to streamline the codebase and improve developer experience.
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 12, 2026

📝 Walkthrough

Walkthrough

The PR renames the guard controller operation type constant from CONTROLLER_CONFIG_OPERATION to CONTROLLER_CONFIG_BATCH across smart contracts, ABI definitions, SDK types, and test files. Concurrently, documentation is updated for atomic initialization requirements, meta-transaction handler binding, and test helpers are expanded with new cancellation and whitelist removal utilities.

Changes

Cohort / File(s) Summary
Guard Controller Operation Type Rename — ABI Definitions
abi/GuardControllerDefinitions.abi.json, sdk/typescript/abi/GuardControllerDefinitions.abi.json
Renamed zero-input view function from CONTROLLER_CONFIG_OPERATION to CONTROLLER_CONFIG_BATCH while preserving output type (bytes32) and mutability.
Guard Controller Operation Type Rename — Smart Contracts
contracts/core/execution/lib/definitions/GuardControllerDefinitions.sol
Replaced config operation constant and updated function schema metadata for guardConfigBatchRequestAndApprove and executeGuardConfigBatch to use CONTROLLER_CONFIG_BATCH instead of CONTROLLER_CONFIG_OPERATION.
Guard Controller Operation Type Rename — SDK Types
sdk/typescript/types/core.execution.index.tsx, sdk/typescript/index.tsx
Updated GUARD_CONTROLLER_OPERATION_TYPES constant to replace CONTROLLER_CONFIG_OPERATION with CONTROLLER_CONFIG_BATCH; expanded index.tsx exports to include FUNCTION_SELECTORS and FunctionSelector type.
Guard Controller Operation Type Rename — Test Scripts
scripts/sanity-sdk/guard-controller/base-test.ts, scripts/sanity/guard-controller/base-test.cjs
Renamed class field from CONTROLLER_CONFIG_OPERATION_TYPE to CONTROLLER_CONFIG_BATCH_OPERATION_TYPE and updated all meta-transaction construction call sites to use the new operation type identifier.
Guard Controller Operation Type Rename — Fuzz Tests
test/foundry/fuzz/AuditDerivedAttackVectorsFuzz.t.sol, test/foundry/fuzz/ComprehensiveCompositeFuzz.t.sol, test/foundry/fuzz/ComprehensiveGasExhaustionFuzz.t.sol, test/foundry/fuzz/ComprehensiveStateMachineFuzz.t.sol
Updated meta-transaction construction calls to replace CONTROLLER_CONFIG_OPERATION with CONTROLLER_CONFIG_BATCH; enhanced AuditDerivedAttackVectorsFuzz with refined test scenarios for handler mismatch tampering, selector validation, and whitelist delist re-validation.
Documentation Updates
docs/core/execution/lib/definitions/GuardControllerDefinitions.md, sdk/typescript/docs/getting-started.md, sdk/typescript/docs/guard-controller.md, sdk/typescript/docs/runtime-rbac.md, sdk/typescript/docs/secure-ownable.md, sdk/typescript/docs/state-machine-engine.md
Updated guard config operation type reference; emphasized atomic initialization for proxy-based contracts via constructor _data or factory patterns; clarified meta-tx handler binding requirements (handlerContract/handlerSelector validation); refined TransactionEvent documentation for truncated result preview and event topic semantics.
Test Helper Expansion
test/foundry/helpers/PaymentTestHelper.sol
Expanded cancelTransaction action bitmap permissions; added new external entrypoint cancelTransaction(uint256) and owner-only helper removeTargetFromWhitelistForTesting(address, bytes4) for whitelist removal testing.
Error Message Update
sdk/typescript/utils/contract-errors.ts
Updated MetaTxHandlerContractMismatch error message to clarify "entry" contract instead of "verifying" contract terminology.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~22 minutes

Possibly related PRs

  • feat: introduce CONTROLLER_CONFIG_OPERATION and enhance GuardControll… #141: Directly related—both modify GuardControllerDefinitions operation-type constants and ABI entries, with #141 introducing the original CONTROLLER_CONFIG_OPERATION that this PR renames.
  • Dev #142: Directly related—both update the same GuardControllerDefinitions operation identifiers and ABI function entries.
  • Work #112: Related—both modify PaymentTestHelper.sol to expand handler/permission setup and test coverage for guard-related operations.

Poem

🐰 Batch operations now shine clear,
No more "config" causing confusion here,
Constants renamed with careful care,
Tests and docs updated everywhere,
Guard controllers batch away! 🎉

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title 'Work' is vague and non-descriptive, failing to convey any meaningful information about the changeset. It does not indicate what actual changes were made. Replace with a descriptive title that summarizes the main change, such as 'Rename CONTROLLER_CONFIG_OPERATION to CONTROLLER_CONFIG_BATCH' or 'Update guard controller operation type naming and references'.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch work

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
test/foundry/helpers/PaymentTestHelper.sol (1)

414-419: Use the repo-standard custom errors/helpers in this new test helper.

The new helper reintroduces string-based require reverts. Reusing the existing SharedValidation / custom-error path here would keep revert decoding and test expectations consistent with the rest of the state machine.

As per coding guidelines, "Prefer custom errors over string-based errors in Solidity; use existing custom errors from SharedValidation and related libraries"

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@test/foundry/helpers/PaymentTestHelper.sol` around lines 414 - 419, Replace
the string-based require checks in removeTargetFromWhitelistForTesting with the
repo-standard SharedValidation/custom-error helpers: remove the
require(msg.sender == owner(), ...) and instead call the SharedValidation
owner-check helper (e.g., SharedValidation.validateOwner or equivalent helper
that verifies msg.sender is owner()), replace require(selector != bytes4(0),
...) with the SharedValidation helper that validates non-zero selectors (e.g.,
SharedValidation.validateNotZeroSelector(selector)), and keep
SharedValidation.validateNotZeroAddress(target) and the
EngineBlox.removeTargetFromWhitelist call unchanged so the function uses custom
errors consistent with the rest of the codebase.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@sdk/typescript/types/core.execution.index.tsx`:
- Around line 7-11: GUARD_CONTROLLER_OPERATION_TYPES has renamed the key
CONTROLLER_CONFIG_OPERATION to CONTROLLER_CONFIG_BATCH which breaks existing
TypeScript users; add back the old key as a deprecated alias that points to the
same keccak256 value (i.e., set CONTROLLER_CONFIG_OPERATION:
GUARD_CONTROLLER_OPERATION_TYPES.CONTROLLER_CONFIG_BATCH or the same keccak256
call) so existing code still works, and annotate the alias with a JSDoc
`@deprecated` comment so consumers see the migration notice; update references in
the module to use CONTROLLER_CONFIG_BATCH going forward.

---

Nitpick comments:
In `@test/foundry/helpers/PaymentTestHelper.sol`:
- Around line 414-419: Replace the string-based require checks in
removeTargetFromWhitelistForTesting with the repo-standard
SharedValidation/custom-error helpers: remove the require(msg.sender == owner(),
...) and instead call the SharedValidation owner-check helper (e.g.,
SharedValidation.validateOwner or equivalent helper that verifies msg.sender is
owner()), replace require(selector != bytes4(0), ...) with the SharedValidation
helper that validates non-zero selectors (e.g.,
SharedValidation.validateNotZeroSelector(selector)), and keep
SharedValidation.validateNotZeroAddress(target) and the
EngineBlox.removeTargetFromWhitelist call unchanged so the function uses custom
errors consistent with the rest of the codebase.
🪄 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: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 7c120162-d8b1-4515-8a37-01f72804550d

📥 Commits

Reviewing files that changed from the base of the PR and between 3b52dca and 2af72c9.

📒 Files selected for processing (19)
  • abi/GuardControllerDefinitions.abi.json
  • contracts/core/execution/lib/definitions/GuardControllerDefinitions.sol
  • docs/core/execution/lib/definitions/GuardControllerDefinitions.md
  • scripts/sanity-sdk/guard-controller/base-test.ts
  • scripts/sanity/guard-controller/base-test.cjs
  • sdk/typescript/abi/GuardControllerDefinitions.abi.json
  • sdk/typescript/docs/getting-started.md
  • sdk/typescript/docs/guard-controller.md
  • sdk/typescript/docs/runtime-rbac.md
  • sdk/typescript/docs/secure-ownable.md
  • sdk/typescript/docs/state-machine-engine.md
  • sdk/typescript/index.tsx
  • sdk/typescript/types/core.execution.index.tsx
  • sdk/typescript/utils/contract-errors.ts
  • test/foundry/fuzz/AuditDerivedAttackVectorsFuzz.t.sol
  • test/foundry/fuzz/ComprehensiveCompositeFuzz.t.sol
  • test/foundry/fuzz/ComprehensiveGasExhaustionFuzz.t.sol
  • test/foundry/fuzz/ComprehensiveStateMachineFuzz.t.sol
  • test/foundry/helpers/PaymentTestHelper.sol

Comment on lines 7 to 11
export const GUARD_CONTROLLER_OPERATION_TYPES = {
CONTROLLER_OPERATION: keccak256(new TextEncoder().encode("CONTROLLER_OPERATION")),
CONTROLLER_CONFIG_OPERATION: keccak256(new TextEncoder().encode("CONTROLLER_CONFIG_OPERATION")),
CONTROLLER_CONFIG_BATCH: keccak256(new TextEncoder().encode("CONTROLLER_CONFIG_BATCH")),
NATIVE_TRANSFER: keccak256(new TextEncoder().encode("NATIVE_TRANSFER"))
} as const;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Keep a deprecated alias for the old SDK constant name.

Replacing CONTROLLER_CONFIG_OPERATION with CONTROLLER_CONFIG_BATCH is a source-breaking change for existing TypeScript integrations that read the old property. Unless this is intentionally a breaking SDK release, keep the old key as a deprecated alias for at least one cycle or call out the migration explicitly.

💡 Backward-compatible option
 export const GUARD_CONTROLLER_OPERATION_TYPES = {
   CONTROLLER_OPERATION: keccak256(new TextEncoder().encode("CONTROLLER_OPERATION")),
+  /** `@deprecated` Use CONTROLLER_CONFIG_BATCH */
+  CONTROLLER_CONFIG_OPERATION: keccak256(new TextEncoder().encode("CONTROLLER_CONFIG_BATCH")),
   CONTROLLER_CONFIG_BATCH: keccak256(new TextEncoder().encode("CONTROLLER_CONFIG_BATCH")),
   NATIVE_TRANSFER: keccak256(new TextEncoder().encode("NATIVE_TRANSFER"))
 } as const;
📝 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.

Suggested change
export const GUARD_CONTROLLER_OPERATION_TYPES = {
CONTROLLER_OPERATION: keccak256(new TextEncoder().encode("CONTROLLER_OPERATION")),
CONTROLLER_CONFIG_OPERATION: keccak256(new TextEncoder().encode("CONTROLLER_CONFIG_OPERATION")),
CONTROLLER_CONFIG_BATCH: keccak256(new TextEncoder().encode("CONTROLLER_CONFIG_BATCH")),
NATIVE_TRANSFER: keccak256(new TextEncoder().encode("NATIVE_TRANSFER"))
} as const;
export const GUARD_CONTROLLER_OPERATION_TYPES = {
CONTROLLER_OPERATION: keccak256(new TextEncoder().encode("CONTROLLER_OPERATION")),
/** `@deprecated` Use CONTROLLER_CONFIG_BATCH */
CONTROLLER_CONFIG_OPERATION: keccak256(new TextEncoder().encode("CONTROLLER_CONFIG_BATCH")),
CONTROLLER_CONFIG_BATCH: keccak256(new TextEncoder().encode("CONTROLLER_CONFIG_BATCH")),
NATIVE_TRANSFER: keccak256(new TextEncoder().encode("NATIVE_TRANSFER"))
} as const;
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@sdk/typescript/types/core.execution.index.tsx` around lines 7 - 11,
GUARD_CONTROLLER_OPERATION_TYPES has renamed the key CONTROLLER_CONFIG_OPERATION
to CONTROLLER_CONFIG_BATCH which breaks existing TypeScript users; add back the
old key as a deprecated alias that points to the same keccak256 value (i.e., set
CONTROLLER_CONFIG_OPERATION:
GUARD_CONTROLLER_OPERATION_TYPES.CONTROLLER_CONFIG_BATCH or the same keccak256
call) so existing code still works, and annotate the alias with a JSDoc
`@deprecated` comment so consumers see the migration notice; update references in
the module to use CONTROLLER_CONFIG_BATCH going forward.

@JaCoderX JaCoderX merged commit 17c8caa into dev Apr 12, 2026
1 check passed
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.

1 participant