Skip to content

feat: update size checks and smart collation for hip-1300 transactions - #2608

Merged
svienot merged 8 commits into
mainfrom
2551-update-size-checks
Apr 9, 2026
Merged

feat: update size checks and smart collation for hip-1300 transactions#2608
svienot merged 8 commits into
mainfrom
2551-update-size-checks

Conversation

@Kolpic

@Kolpic Kolpic commented Apr 7, 2026

Copy link
Copy Markdown
Collaborator

Fixes #2551

Description:

Implements HIP-1300, which raises the transaction size limit from 6 KB to 128 KB when the fee payer is one of the privileged governance accounts: 0.0.2 (Treasury) or any account in 0.0.42 through 0.0.799. All other transactions continue to use the standard 6 KB limit.

What changed:

  • New helper (privileged-payer.ts on both backend and frontend) — single source of truth for isPrivilegedFeePayer() and getMaxTransactionSize(feePayer).
  • Backend size checks (isTransactionOverMaxSize, isTransactionBodyOverMaxSize, smartCollate) now derive the limit from the transaction's fee payer instead of using a flat constant. Smart collation no longer prunes signatures from a 50 KB transaction paid by 0.0.2.
  • Frontend split decision (ValidateRequestHandler, BigFileOrganizationRequestHandler, BigFilePersonalRequestHandler) is fee-payer aware, so an 8 KB File Update paid by treasury goes through as a single transaction instead of being split.
  • Big-file chunk size is now also payer-aware: ~5,500 B for normal payers, ~130 KB for privileged payers — dramatically reducing the number of internal SDK chunks for large governance file updates and fixing a partial-upload failure mode for normal payers.
  • Form input (FileAppendFormData) chunk-size max attribute is a computed driven by the currently selected fee payer.

How it works:

Every size check calls getMaxTransactionSize(feePayer), which inspects the account's shard.realm.num and returns 131,072 bytes for 0.0.2 and 0.0.42–0.0.799, or 6,144 bytes for everything else. The fee payer is extracted from the SDK transaction's transactionId.accountId, so no API signatures had to change — every existing call site automatically picks up the new behavior. Tests cover all boundary conditions (0.0.1, 0.0.2, 0.0.41, 0.0.42, 0.0.799, 0.0.800) plus the 128 KB upper bound, with 100% coverage on the new helpers.

Signed-off-by: Kolpic <galincho112@gmail.com>
@Kolpic Kolpic added this to the v0.28.0 milestone Apr 7, 2026
@Kolpic Kolpic self-assigned this Apr 7, 2026
@Kolpic Kolpic added Feature Enhancement Enhancing an existing feature driven by business requirements. Typically backwards compatible. Frontend Frontend development work Backend labels Apr 7, 2026
@codecov

codecov Bot commented Apr 7, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.95%. Comparing base (c1e68d6) to head (7bb4e12).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main    #2608   +/-   ##
=======================================
  Coverage   99.95%   99.95%           
=======================================
  Files         184      184           
  Lines        7446     7446           
  Branches     1489     1493    +4     
=======================================
  Hits         7443     7443           
  Misses          3        3           

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Kolpic
Kolpic marked this pull request as ready for review April 7, 2026 12:52
@Kolpic
Kolpic requested a review from a team as a code owner April 7, 2026 12:52
@Kolpic
Kolpic requested a review from steven-sheehy April 7, 2026 12:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Implements HIP-1300 fee-payer-aware transaction sizing (6 KB standard vs 128 KB for treasury/governance payers) across frontend validation/splitting logic and backend size checks/smart collation.

Changes:

  • Add privileged fee payer helpers (frontend/backend) to compute payer-based max transaction size.
  • Update frontend big-file decision/chunking to use payer-aware max size and larger chunks for privileged payers.
  • Update backend isTransactionOverMaxSize / isTransactionBodyOverMaxSize / smartCollate to use payer-aware size limits, plus add tests and privileged-size constants.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
front-end/src/tests/renderer/utils/sdk/privilegedPayer.spec.ts Adds frontend tests for privileged payer detection and max-size helpers
front-end/src/shared/constants/index.ts Adds privileged (128 KB) transaction size constant
front-end/src/renderer/utils/sdk/privilegedPayer.ts New frontend helper for HIP-1300 privileged payer detection / max-size
front-end/src/renderer/utils/sdk/index.ts Re-exports privileged payer helper
front-end/src/renderer/components/Transaction/TransactionProcessor/components/ValidateRequestHandler.vue Makes size validation payer-aware
front-end/src/renderer/components/Transaction/TransactionProcessor/components/BigFilePersonalRequestHandler.vue Makes big-file splitting/chunk sizing payer-aware (personal flow)
front-end/src/renderer/components/Transaction/TransactionProcessor/components/BigFileOrganizationRequestHandler.vue Makes big-file splitting/chunk sizing payer-aware (org flow)
front-end/src/renderer/components/Transaction/Create/FileAppend/FileAppendFormData.vue Makes chunk-size input cap payer-aware
front-end/src/renderer/components/Transaction/Create/FileAppend/FileAppend.vue Passes current payer ID down to the form
back-end/libs/common/src/utils/sdk/transaction.ts Updates smart collation and size checks to use payer-aware limits
back-end/libs/common/src/utils/sdk/privileged-payer.ts New backend helper for HIP-1300 privileged payer detection / max-size
back-end/libs/common/src/utils/sdk/privileged-payer.spec.ts Adds backend tests for payer-aware sizing and smart collation
back-end/libs/common/src/database/entities/transaction.entity.ts Adds privileged (128 KB) max transaction size constant

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread front-end/src/renderer/utils/sdk/privilegedPayer.ts Outdated
Comment thread front-end/src/tests/renderer/utils/sdk/privilegedPayer.spec.ts Outdated
Comment thread back-end/libs/common/src/utils/sdk/privileged-payer.ts Outdated
Comment thread back-end/libs/common/src/utils/sdk/privileged-payer.spec.ts Outdated
Comment thread back-end/libs/common/src/utils/sdk/privileged-payer.spec.ts Outdated
Kolpic added 4 commits April 9, 2026 14:27
Signed-off-by: Kolpic <galincho112@gmail.com>
Signed-off-by: Kolpic <galincho112@gmail.com>
Signed-off-by: Kolpic <galincho112@gmail.com>
Signed-off-by: Kolpic <galincho112@gmail.com>
Comment thread front-end/src/renderer/utils/sdk/privilegedPayer.ts

@svienot svienot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@svienot
svienot merged commit fcdedbe into main Apr 9, 2026
24 of 25 checks passed
@svienot
svienot deleted the 2551-update-size-checks branch April 9, 2026 20:29
Kolpic added a commit that referenced this pull request Apr 15, 2026
#2608)

* feat: update size checks and smart collation for hip-1300 transactions

Signed-off-by: Kolpic <galincho112@gmail.com>

* fix: updated imports from @hashgraph/sdk to @hiero-ledger/sdk

Signed-off-by: Kolpic <galincho112@gmail.com>

* fix: renamed test name

Signed-off-by: Kolpic <galincho112@gmail.com>

* chore: added new helper and reused across files

Signed-off-by: Kolpic <galincho112@gmail.com>

* chore: comments for explaining the bytes and for the be and fe files

Signed-off-by: Kolpic <galincho112@gmail.com>

---------

Signed-off-by: Kolpic <galincho112@gmail.com>
Co-authored-by: John Bair <117694970+jbair06@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Backend Feature Enhancement Enhancing an existing feature driven by business requirements. Typically backwards compatible. Frontend Frontend development work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update size checks and smart collation for HIP-1300 transactions

4 participants