Skip to content

use custom errors#7

Merged
hhl42 merged 1 commit into
mainfrom
errors-refactor
May 8, 2026
Merged

use custom errors#7
hhl42 merged 1 commit into
mainfrom
errors-refactor

Conversation

@hhl42

@hhl42 hhl42 commented May 8, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@hhl42 hhl42 requested a review from Copilot May 8, 2026 23:25
@hhl42 hhl42 changed the title update require errors use custom errors May 8, 2026

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

Note

Copilot was unable to run its full agentic suite in this review.

This PR replaces string-based require(...) revert reasons with a shared custom-error vocabulary (AgentPayErrors) and updates tests/gas snapshots accordingly.

Changes:

  • Introduces src/lib/AgentPayErrors.sol and updates contracts/libraries to use custom errors instead of revert strings.
  • Updates Foundry tests to assert on custom-error selectors / full error payloads.
  • Refreshes gas measurement snapshot files to match the new bytecode/error behavior.

Reviewed changes

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

Show a summary per file
File Description
test/gas_logs/fine_granularity/IntendSettle-OneState.txt Updates gas snapshot values for intendSettle fine-grained measurement
test/gas_logs/fine_granularity/DepositEthInBatch.txt Updates gas snapshot values for depositInBatch (ETH)
test/gas_logs/PayResolver.txt Updates PayResolver gas snapshot values
test/gas_logs/CelerLedger-ETH.txt Updates deploy/call gas snapshots for ETH ledger path
test/gas_logs/CelerLedger-ERC20.txt Updates call gas snapshots for ERC20 ledger path
test/VirtContractResolver.t.sol Updates revert assertions to custom errors for VirtContractResolver
test/RouterRegistry.t.sol Updates revert assertions to custom errors for RouterRegistry
test/PayResolver.t.sol Updates revert assertions to custom errors (including full-payload) for PayResolver
test/PayRegistry.t.sol Updates revert assertions to custom errors (including full-payload/partial) for PayRegistry
test/CelerWallet.t.sol Updates revert assertions to custom errors for CelerWallet
test/CelerLedger.Migrate.t.sol Updates revert assertions to custom errors for ledger migration
test/CelerLedger.ETH.t.sol Updates revert assertions to custom errors (some full-payload/partial) for ETH ledger
test/CelerLedger.ERC20.t.sol Updates revert assertions to custom errors for ERC20 ledger
src/lib/ledgerlib/LedgerStruct.sol Bumps Solidity pragma version
src/lib/ledgerlib/LedgerOperation.sol Replaces string reverts with custom errors and adjusts validations
src/lib/ledgerlib/LedgerMigrate.sol Replaces string reverts with custom errors for migration flow
src/lib/ledgerlib/LedgerChannel.sol Replaces string revert with custom error for peer lookup
src/lib/data/PbEntity.sol Bumps Solidity pragma version for generated protobuf code
src/lib/data/PbChain.sol Bumps Solidity pragma version for generated protobuf code
src/lib/data/Pb.sol Bumps Solidity pragma version for generated protobuf code
src/lib/AgentPayErrors.sol Adds shared custom-error definitions used across contracts
src/interfaces/IVirtContractResolver.sol Bumps Solidity pragma version
src/interfaces/IRouterRegistry.sol Bumps Solidity pragma version
src/interfaces/IPayResolver.sol Bumps Solidity pragma version
src/interfaces/IPayRegistry.sol Bumps Solidity pragma version
src/interfaces/INumericCond.sol Bumps Solidity pragma version
src/interfaces/INativeWrap.sol Bumps Solidity pragma version
src/interfaces/ICelerWallet.sol Bumps Solidity pragma version
src/interfaces/ICelerLedger.sol Bumps Solidity pragma version
src/interfaces/IBooleanCond.sol Bumps Solidity pragma version
src/helper/WalletTestHelper.sol Bumps Solidity pragma version
src/helper/NumericCondMock.sol Bumps Solidity pragma version
src/helper/NativeWrapMock.sol Bumps Solidity pragma version
src/helper/ERC20ExampleToken.sol Bumps Solidity pragma version
src/helper/BooleanCondMock.sol Bumps Solidity pragma version
src/VirtContractResolver.sol Replaces require strings with custom errors
src/RouterRegistry.sol Replaces require strings with custom errors
src/PayResolver.sol Replaces require strings with custom errors
src/PayRegistry.sol Replaces require strings with custom errors
src/CelerWallet.sol Replaces require strings with custom errors
src/CelerLedgerMock.sol Bumps Solidity pragma version
src/CelerLedger.sol Replaces require strings with custom errors and updates validations

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

Comment thread src/lib/ledgerlib/LedgerOperation.sol
Comment thread src/PayResolver.sol
Comment thread src/PayResolver.sol
Comment thread src/PayResolver.sol
Comment thread src/CelerLedger.sol
Comment thread src/CelerLedger.sol
Comment thread src/CelerLedger.sol
Comment thread src/lib/ledgerlib/LedgerOperation.sol
Comment thread src/lib/data/Pb.sol
@hhl42 hhl42 merged commit 6b011e9 into main May 8, 2026
5 of 6 checks passed
@hhl42 hhl42 deleted the errors-refactor branch May 8, 2026 23:33
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