Skip to content

Update transaction account keys size display#1085

Open
Samisha68 wants to merge 3 commits into
solana-foundation:masterfrom
Samisha68:issue-882-update-total-account-size-in-transaction-accounts-preview
Open

Update transaction account keys size display#1085
Samisha68 wants to merge 3 commits into
solana-foundation:masterfrom
Samisha68:issue-882-update-total-account-size-in-transaction-accounts-preview

Conversation

@Samisha68

Copy link
Copy Markdown

Description

Updates the transaction Accounts preview to show the total size of account keys included directly in the transaction.

Previously, the footer summed the current on-chain data sizes of fetched accounts, which is not useful for estimating transaction account key size. The new calculation counts non-lookup-table account keys and multiplies by 32 bytes.

Type of change

  • Bug fix
  • New feature
  • Protocol integration
  • Documentation update
  • Other (please describe):

Testing

  • pnpm lint
  • pnpm vitest:test related --run app/features/transaction/ui/__tests__/AccountsCard.test.ts
  • pnpm pretty:format app/features/transaction/ui/AccountsCard.tsx app/features/transaction/ui/__tests__/AccountsCard.test.ts

Note: pnpm test currently fails locally in existing test-setup.ts with a recursive Buffer.isBuffer stack overflow. pnpm typecheck did not complete because its next build pre-step hung locally.

Related Issues

Fixes #882

Checklist

  • My code follows the project's style guidelines
  • I have added tests that prove my fix/feature works
  • All checks pass locally (pnpm test, pnpm lint, pnpm typecheck)
  • I have updated documentation as needed
  • I have run build:info script to update build information
  • CI/CD checks pass on the PR
  • Screenshots included — required for protocol screens, recommended for other UI changes
  • For security-related features, I have included links to related information

Additional Notes

This change is limited to transaction account size display logic and does not introduce new dependencies.

@vercel

vercel Bot commented Jun 13, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the Solana Foundation Team on Vercel.

A member of the Team first needs to authorize it.

@greptile-apps

greptile-apps Bot commented Jun 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes the transaction Accounts footer to display the static size of account keys included directly in the transaction (non-LUT keys × 32 bytes), replacing the previous behaviour that summed live on-chain data sizes fetched asynchronously.

  • getTransactionAccountKeysSizeBytes is extracted as a pure, exported function that filters out lookupTable-sourced entries and multiplies the remaining count by 32 bytes.
  • The !loading guard is correctly removed from the footer render path since the new calculation no longer depends on the async useAccountsInfo result.
  • A new test file covers all three source cases ('transaction', 'lookupTable', and undefined), and the CI Storybook timeout is bumped from 10 to 30 minutes as an unrelated infrastructure tweak.

Confidence Score: 5/5

Safe to merge — the change is a straightforward, well-tested replacement of async on-chain data summation with a deterministic static calculation.

The new calculation is pure and synchronous, the !loading guard removal is correct since the value no longer depends on async RPC data, and all meaningful input variants are covered by the new tests.

No files require special attention.

Important Files Changed

Filename Overview
app/features/transaction/ui/AccountsCard.tsx Replaces async on-chain size summation with static 32-byte × non-LUT key count; removes now-unnecessary !loading guard and updates footer label. Logic is correct and well-scoped.
app/features/transaction/ui/tests/AccountsCard.test.ts New test file covering all three relevant cases for getTransactionAccountKeysSizeBytes: all-transaction keys, mixed LUT/transaction, and undefined source.
.github/workflows/ci.yaml Increases Storybook Smoke Tests timeout from 10 to 30 minutes; unrelated to the accounts size logic change.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[AccountsCard renders] --> B{transactionWithMeta?}
    B -- no --> C[return null]
    B -- yes --> D{meta && message?}
    D -- no --> E[ErrorCard: metadata missing]
    D -- yes --> F[getTransactionAccountKeysSizeBytes\nmessage.accountKeys]
    F --> G[filter: source !== 'lookupTable']
    G --> H[count × 32 bytes = totalAccountKeysSize]
    H --> I{totalAccountKeysSize > 0?}
    I -- yes --> J[Render footer: Total Account Keys Size]
    I -- no --> K[Footer hidden]
Loading
%%{init: {'theme': 'base', 'themeVariables': {"darkMode": true, "background": "#0d1117", "primaryColor": "#21262d", "primaryTextColor": "#e6edf3", "primaryBorderColor": "#8b949e", "lineColor": "#8b949e", "textColor": "#e6edf3", "edgeLabelBackground": "#161b22", "actorBkg": "#21262d", "actorBorder": "#8b949e", "actorTextColor": "#e6edf3", "actorLineColor": "#8b949e", "signalColor": "#8b949e", "signalTextColor": "#e6edf3", "noteBkgColor": "#373320", "noteBorderColor": "#d4a72c", "noteTextColor": "#f0e6c0", "labelBoxBkgColor": "#21262d", "labelBoxBorderColor": "#8b949e", "labelTextColor": "#e6edf3", "loopTextColor": "#e6edf3", "activationBkgColor": "#30363d", "activationBorderColor": "#8b949e"}}}%%
flowchart TD
    A[AccountsCard renders] --> B{transactionWithMeta?}
    B -- no --> C[return null]
    B -- yes --> D{meta && message?}
    D -- no --> E[ErrorCard: metadata missing]
    D -- yes --> F[getTransactionAccountKeysSizeBytes\nmessage.accountKeys]
    F --> G[filter: source !== 'lookupTable']
    G --> H[count × 32 bytes = totalAccountKeysSize]
    H --> I{totalAccountKeysSize > 0?}
    I -- yes --> J[Render footer: Total Account Keys Size]
    I -- no --> K[Footer hidden]
Loading

Reviews (3): Last reviewed commit: "Merge remote-tracking branch 'upstream/m..." | Re-trigger Greptile

Comment on lines 151 to 159
{!loading && totalAccountKeysSize > 0 && (
<div className="e-ml-7 e-flex e-items-baseline e-gap-2 e-px-3 e-py-2 e-text-sm e-text-outer-space-300 md:e-px-4 lg:e-ml-10">
<div className="e-flex e-flex-col">
<span className="e-text-sm e-uppercase e-leading-none">Total Account Size:</span>
<span className="e-text-[10px] e-leading-none">reflects current state</span>
<span className="e-text-sm e-uppercase e-leading-none">Total Account Keys Size:</span>
<span className="e-text-[10px] e-leading-none">excludes address lookup tables</span>
</div>
<span className="e-text-white">{totalAccountSize.toLocaleString('en-US')} bytes</span>
<span className="e-text-white">{totalAccountKeysSize.toLocaleString('en-US')} bytes</span>
</div>
)}

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.

P2 !loading guard is now stale

totalAccountKeysSize is derived entirely from message.accountKeys, which is already in memory when the component renders. It no longer depends on the async useAccountsInfo call. Keeping the !loading condition means the footer is hidden until all on-chain account data finishes loading — even though the size value is ready immediately. Any transaction with slow RPC responses (or a long account list) will show a blank footer longer than necessary. Dropping the !loading check here, or replacing it with !!message, would make the footer appear as soon as the transaction message is available.

Comment on lines +1 to +26
import { describe, expect, test } from 'vitest';

import { getTransactionAccountKeysSizeBytes } from '../AccountsCard';

describe('getTransactionAccountKeysSizeBytes', () => {
test('should count transaction account keys as 32 bytes each', () => {
expect(
getTransactionAccountKeysSizeBytes([
{ source: 'transaction' },
{ source: 'transaction' },
{ source: 'transaction' },
]),
).toBe(96);
});

test('should exclude account keys loaded from address lookup tables', () => {
expect(
getTransactionAccountKeysSizeBytes([
{ source: 'transaction' },
{ source: 'lookupTable' },
{ source: 'transaction' },
{ source: 'lookupTable' },
]),
).toBe(64);
});
});

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.

P2 Missing test case for source: undefined

The function signature accepts Array<{ source?: string }>, meaning source can be undefined. The current tests only cover 'transaction' and 'lookupTable' values. An account with source: undefined is treated as non-LUT (correctly counted) by the current implementation, but this behavior isn't covered by any test. Adding a case like [{ source: 'transaction' }, {}, { source: 'lookupTable' }] would pin the intended behaviour and guard against regressions if the filter condition is ever tightened.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

@holps-7

holps-7 commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

@Samisha68 can you add the before and after screenshots showing how the changes you've made would render?

@Samisha68

Copy link
Copy Markdown
Author

@Samisha68 can you add the before and after screenshots showing how the changes you've made would render?

Before: shows the total current account data size.

Screenshot 2026-06-17 at 8 00 17 PM

After: shows the total transaction account keys size, excluding address lookup table accounts.

Screenshot 2026-06-17 at 7 57 41 PM

…total-account-size-in-transaction-accounts-preview

# Conflicts:
#	app/features/transaction/ui/AccountsCard.tsx
@Woody4618

Copy link
Copy Markdown
Collaborator

Hey why do you want this change? What is the usecase for having transaction data without the ALTs?

<span className="text-white">{totalAccountSize.toLocaleString('en-US')} bytes</span>
<span className="text-white">{totalAccountKeysSize.toLocaleString('en-US')} bytes</span>
</div>
)}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hhh

@Samisha68

Copy link
Copy Markdown
Author

Hey why do you want this change? What is the usecase for having transaction data without the ALTs?

The goal is to show the static account-key footprint in the transaction message, rather than the current on-chain data size of those accounts.
The previous “Total Account Size” value summed live account data sizes, which can be misleading because it reflects account state at fetch time and is not directly related to how much account-key data the transaction itself carries.
For transactions using ALTs, the lookup-table-loaded accounts are not included as full 32-byte keys in the transaction message, so this excludes them and only counts the non-LUT account keys as 32 bytes * key count.
So the use case is helping users understand the transaction’s account-key byte cost more accurately, especially when comparing normal account keys vs address lookup table usage.

…total-account-size-in-transaction-accounts-preview

# Conflicts:
#	app/features/transaction/ui/AccountsCard.tsx
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.

[Bug] update the the Total Account Size in Transaction Accounts Preview

5 participants