Skip to content

Adding padding to ShankType and allowing multiple padding fields#83

Merged
blockiosaurus merged 1 commit into
masterfrom
feat/moar-padding
Feb 6, 2026
Merged

Adding padding to ShankType and allowing multiple padding fields#83
blockiosaurus merged 1 commit into
masterfrom
feat/moar-padding

Conversation

@blockiosaurus
Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Feb 6, 2026

Summary by CodeRabbit

  • New Features

    • Added padding attribute support for struct field definitions, enabling explicit padding specification in type definitions.
    • Removed constraint limiting structs to a single padded field, allowing multiple padding fields per struct.
  • Tests

    • Added test fixtures and test cases validating padding behavior in struct types.

Walkthrough

Introduces #[padding] attribute support to the Shank IDL system. Adds test fixtures for a struct with padding fields, includes a test case to verify parsing correctness, updates the ShankType derive macro to recognize the padding attribute, and removes single-padding-field constraints from account extraction logic.

Changes

Cohort / File(s) Summary
Padding Test Fixtures
shank-idl/tests/fixtures/types/padding.json, shank-idl/tests/fixtures/types/padding.rs
New test fixtures defining a StructTypeWithPadding struct with a count field (u8) and a 3-byte padding array annotated with #[padding] attribute in both JSON and Rust formats.
Padding Type Test
shank-idl/tests/types.rs
Added type_padding() test function that parses the padding fixture and validates it matches the expected IDL output, following the established test pattern.
ShankType Derive Macro Update
shank-macro/src/lib.rs
Updated ShankType derive macro attribute list to include padding alongside existing attributes (idl_name, idl_type, skip, pod_sentinel).
Account Extraction Logic
shank-macro-impl/src/account/extract_accounts.rs
Removed HashSet-based padding field count validation and the single-padding-field constraint from verify_account_struct. Simplified imports and adjusted test assertions to reflect that multiple padded fields are now permissible.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

Suggested reviewers

  • danenbm
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Description check ❓ Inconclusive No description was provided by the author, making it impossible to assess whether it relates to the changeset. Add a pull request description explaining the changes, their rationale, and any testing performed to help reviewers understand the intent.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main changes: adding padding support to ShankType and removing the single-padding-field constraint.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/moar-padding

Comment @coderabbitai help to get the list of available commands and usage tips.

@blockiosaurus blockiosaurus merged commit 3522474 into master Feb 6, 2026
6 checks passed
@blockiosaurus blockiosaurus deleted the feat/moar-padding branch February 6, 2026 18:42
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