Skip to content

Conversation

@indocs
Copy link
Owner

@indocs indocs commented Sep 30, 2025

This PR implements a targeted cleanup for the gas-655 branch by refactoring the Ledger-related contracts to reduce gas usage, remove unused state and deprecated calls, and consolidate helper logic into fewer, well-audited paths. The changes aim to make the core tx path more predictable under high load and simplify future audits.

Testing coverage has been expanded to validate the refactor paths, including regression checks for the main ledger upload/execute flows and updated calldata handling. Some non-critical helpers were inlined where it reduces allocations without sacrificing readability. Administrative state changes are minimized and scoped to initialization-safe patterns.

Deployment impact is expected to be minimal for existing deployments, but there may be small gas deltas due to the refactor. A careful upgrade path remains chủ to ensure compatibility with prior state structures; please run the provided migration tests in Hardhat before production use. If you rely on exact gas measurements for budgeting, expect minor shifts and review the new gas-usage reports in test artifacts.

Testing strategy and validation are emphasized in this PR. The suite now includes targeted gas benchmarks, fuzzed input coverage for edge cases, and property-based checks for invariants across ledger operations. The tests exercise both the happy path and failure scenarios (e.g., reverts on invalid signatures or mismatched state). See the Testing section below for more details and steps to reproduce locally.

Copy link
Owner Author

@indocs indocs left a comment

Choose a reason for hiding this comment

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

Security nit: ensure re-entrancy guards are preserved in ledger update paths; consider reinforcing checks-effects-interactions in all external-call-involved steps.

Copy link
Owner Author

@indocs indocs left a comment

Choose a reason for hiding this comment

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

Testing suggestion: add property-based tests for random tx sequences and cross-path gas usage to catch edge-case regressions; run tests with gas-compare flags if available.

Copy link
Owner Author

@indocs indocs left a comment

Choose a reason for hiding this comment

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

Developer-experience remark: update contributor docs and README with new or renamed npm/scripts, plus a quick guide for running the gas-focused test suite to improve onboarding.

@indocs indocs changed the title feat: streamline gas-optimized TX ledger with cleanup/gas-655 adjustments feat: cleanup and refactor for gas-655 branch (reduce allocations, consolidate helpers, safer paths) Sep 30, 2025
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