perf(cketh): reuse the delegation authorization a deposit address signed - #11337
Closed
gregorydemay wants to merge 2 commits into
Closed
perf(cketh): reuse the delegation authorization a deposit address signed#11337gregorydemay wants to merge 2 commits into
gregorydemay wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Caches EIP-7702 deposit-address authorizations to reduce threshold-ECDSA signing costs during repeated ckERC20 sweeps.
Changes:
- Stores and reuses configuration-compatible authorizations in heap state.
- Adds validation and reuse tests.
- Exposes cache size as a metric.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
sweep/tests.rs |
Tests stored-authorization selection. |
sweep/mod.rs |
Reuses cached authorizations during sweep preparation. |
state/tests.rs |
Tests authorization configuration validation. |
state/automatic_deposits/mod.rs |
Adds the heap-only authorization cache. |
state.rs |
Provides cache access and validation. |
main.rs |
Exposes cache size as a gauge. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+647
to
+651
| /// The authorizations the minter already holds for these addresses, keyed by account. | ||
| /// | ||
| /// Only the ones still usable: [`State::authorization`] checks a stored tuple against the chain and | ||
| /// the delegate the minter runs against, so an address delegated by a retired sweeper contract falls | ||
| /// through to a fresh signature rather than being swept through the wrong delegate. |
| /// every upgrade, to save a cost that is bounded by the addresses in flight. Nothing prunes it | ||
| /// within a canister version — [`Self::authorizations_len`] is exported as a metric so its | ||
| /// growth is visible before it needs bounding. | ||
| authorizations: BTreeMap<DepositAddress, SignedAuthorization>, |
gregorydemay
force-pushed
the
greg/DEFI-2926-reuse-signed-authorizations
branch
from
August 26, 2026 17:38
b808126 to
135e448
Compare
The tuple never expires — nonce 0, one chain, one delegate — so it is kept on the heap, checked against the configuration before reuse, and only addresses without a usable one cost a threshold-ECDSA signature.
gregorydemay
force-pushed
the
greg/DEFI-2926-reuse-signed-authorizations
branch
from
August 27, 2026 07:56
135e448 to
d2cba5a
Compare
gregorydemay
force-pushed
the
greg/DEFI-2926-enqueue-batched-sweep
branch
from
August 27, 2026 07:56
e6e7cf3 to
8311a24
Compare
…26-reuse-signed-authorizations
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
Suppressed comments (1)
rs/ethereum/cketh/minter/src/state/automatic_deposits/mod.rs:85
- This heap-only cache is still included in
AutomaticDeposits' derivedPartialEq, whileState::is_equivalent_tocompares the entireautomatic_depositsvalue. After the first authorization is cached,check_audit_logreplays an empty cache and then traps because the states are considered different. Excludeauthorizationsfrom upgrade-equivalence checks while retaining normal equality coverage for the persistent fields.
authorizations: BTreeMap<DepositAddress, SignedAuthorization>,
Contributor
Author
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.
Why
What