Skip to content

[PT1-866] Add calldata parse library - #276

Open
SteMak wants to merge 3 commits into
masterfrom
feature/calldata-parse-lib
Open

SteMak wants to merge 3 commits into
masterfrom
feature/calldata-parse-lib

Conversation

@SteMak

@SteMak SteMak commented Sep 7, 2026

Copy link
Copy Markdown

Rename Calldata lib to CalldataSlice to clarify the purpose
Implement CalldataParse lib allowing efficient packed value parse


Note

Low Risk
Changes are limited to new parsing utilities and a library rename with test-only call sites; no bounds checking in CalldataParse is intentional but callers must enforce offsets themselves.

Overview
Introduces CalldataParse, a gas-oriented library for reading left-aligned packed values from bytes calldata via at(shift)CalldataWordas* helpers (addresses, uint8uint256, bytes1bytes32, and MSB-indexed asBool). at uses inline calldataload and does not bounds-check, as documented.

Renames the existing slicing library from Calldata to CalldataSlice (same slice APIs and behavior) and updates CalldataSliceMock / CalldataSlice.test.ts accordingly.

Adds CalldataParseMock and a Hardhat suite CalldataParse.test.ts covering byte offsets, bool bit extraction, addresses, and all supported uintN / bytesN widths.

Reviewed by Cursor Bugbot for commit 7da967e. Bugbot is set up for automated code reviews on this repo. Configure here.

@codecov

codecov Bot commented Sep 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

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.

1 participant