test(history): add pending PCT withdrawal gas coverage - #81
Open
BeratOz01 wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds gas and boundary coverage for pending encrypted-balance history and converter withdrawals.
Changes:
- Adds test-only history-seeding harnesses.
- Tests the 300-entry cap, pruning, and end-to-end withdrawal gas.
- Extends test timeouts and adds
ts-node.
Reviewed changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
test/EncryptedUserBalances.ts |
Tests history limits and pruning gas. |
test/EncryptedERC-HistoryGas.ts |
Benchmarks withdrawal with 300 entries. |
test/EncryptedERC-Converter.ts |
Extends a crypto-heavy test timeout. |
contracts/mocks/EncryptedUserBalancesHarness.sol |
Adds history seeding/pruning helpers. |
contracts/mocks/EncryptedERCHarness.sol |
Adds pending-history seeding. |
package.json |
Adds ts-node. |
package-lock.json |
Updates dependency resolution. |
Suppressed comments (1)
test/EncryptedERC-HistoryGas.ts:154
receipt.gasUsedis calculated after storage-clear refunds, but a transaction must have enough gas to complete before those refunds are applied. Because Hardhat's default block limit is higher than 15M, this test can pass the assertion even when the withdrawal requires a transaction gas limit that C-Chain would reject. Submit the withdrawal with a 15MgasLimitso successful execution proves the advertised bound.
expect(receipt!.gasUsed).to.be.lessThan(C_CHAIN_BLOCK_GAS_LIMIT);
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
What
Why
How
EncryptedUserBalancesHarnessseeds fully nonzero entries and measures bounded pruning.EncryptedERCHarnessseeds a valid 300-entry history, then exercises the real deposit, proof generation, withdrawal, ERC-20 payout, and cleanup path.Verification
REPORT_GAS=true npx hardhat test test/EncryptedERC-HistoryGas.tsnpx tsc --noEmitRisk & rollout
Alternatives / follow-ups
Notes for reviewers
contracts/mocksand are never deployed by release scripts.