feat(wallet): add reentrancy guard & input validation; docs: add gas usage snapshot; test: add gas benches#5
Merged
Conversation
…usage snapshot; test: add gas benches
- PQCWallet.sol
- Add lightweight nonReentrant guard and apply to `execute` / `executeBatch`.
- Validate inputs: reject zero `owner` at construction and zero `target` in calls.
- Add `slither` suppression comments around controlled assembly/low-level calls.
- Gas documentation & snapshots
- New `docs/dev/gas.md` summarizing current gas costs (sourced from snapshot).
- Add `smart-contracts/.gas-snapshot` with measured gas for core flows.
- Add `smart-contracts/.gitignore` for `lib/`, `out/`, `cache/`.
- Foundry config
- Add `smart-contracts/foundry.lock`.
- Update `smart-contracts/foundry.toml` (`src = "contracts"`, optimizer settings unchanged).
- Tests
- Extend `PQCWallet.t.sol` with gas-focused tests:
- `test_gas_validateUserOp`
- `test_gas_execute`
- `test_gas_executeBatch`
Rationale:
Improves runtime safety (reentrancy & input checks) and establishes a reproducible gas baseline for ongoing optimization.
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
execute/executeBatch.ownerat construction and zerotargetin calls.slithersuppression comments around controlled assembly/low-level calls.docs/dev/gas.mdsummarizing current gas costs (sourced from snapshot).smart-contracts/.gas-snapshotwith measured gas for core flows.smart-contracts/.gitignoreforlib/,out/,cache/.smart-contracts/foundry.lock.smart-contracts/foundry.toml(src = "contracts", optimizer settings unchanged).PQCWallet.t.solwith gas-focused tests:test_gas_validateUserOptest_gas_executetest_gas_executeBatch