Skip to content

fix(solana): optimize signature verification for Cosmoshub#1022

Open
vaporif wants to merge 18 commits into
mainfrom
vaporif/bump-rework
Open

fix(solana): optimize signature verification for Cosmoshub#1022
vaporif wants to merge 18 commits into
mainfrom
vaporif/bump-rework

Conversation

@vaporif
Copy link
Copy Markdown
Collaborator

@vaporif vaporif commented Apr 10, 2026

Description

  • Swap find_program_address (brute-forces up to 256 bumps) for caller-supplied bumps + create_program_address (single hash) on chunk and signature verification accounts
  • Match signature accounts by embedded sig_hash instead of PDA re-derivation — filtered by owner and discriminator first

Testing

  • Layout sentinel test validates is_valid and sig_hash offsets survive field changes
  • Unit tests cover wrong discriminator, wrong owner, wrong sig_hash all fall back correctly

e2e test via

export EXTERNAL_COSMOS_RPC_URL=https://cosmos-rpc.polkachu.com
export EXTERNAL_COSMOS_CHAIN_ID="cosmoshub-4"
just test-e2e TestExternalCosmos/Test_ExternalCosmos_UpdateClient

(might worth adding this to CI since this test never runs and was broken before)


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Linked to GitHub issue with discussion and accepted design, OR link to spec that describes this work.
  • Wrote unit and integration tests.
  • Added relevant natspec and godoc comments.
  • Provide a conventional commit message to follow the repository standards.
  • Re-reviewed Files changed in the GitHub PR explorer.
  • Review SonarCloud Report in the comment section below once CI passes.

@vaporif vaporif changed the title Vaporif/bump rework refact(solana): cu limit optimization fo tendermint light client Apr 10, 2026
@vaporif vaporif changed the title refact(solana): cu limit optimization fo tendermint light client fix(solana): cu limit optimization fo tendermint light client Apr 10, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 10, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.91%. Comparing base (d0ab571) to head (ee8d1db).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1022   +/-   ##
=======================================
  Coverage   99.91%   99.91%           
=======================================
  Files          27       27           
  Lines        1123     1123           
=======================================
  Hits         1122     1122           
  Misses          1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@vaporif vaporif changed the title fix(solana): cu limit optimization fo tendermint light client fix(solana): optimize for cosmoshub Apr 15, 2026
@vaporif vaporif marked this pull request as ready for review April 15, 2026 12:40
@vaporif vaporif requested a review from srdtrk as a code owner April 15, 2026 12:40
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Apr 15, 2026

PR author is not in the allowed authors list.

@vaporif vaporif changed the title fix(solana): optimize for cosmoshub fix(solana): optimize signature verification for Cosmoshub Apr 15, 2026
}

/// Owner check runs first so unrelated accounts skip the syscall.
fn verify_header_chunk_pda(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

add docs as to what this does. And maybe rename

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done

Copy link
Copy Markdown
Member

@srdtrk srdtrk left a comment

Choose a reason for hiding this comment

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

Lgtm. I'll leave it open for now due to the audit,

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