Skip to content

Add verifier to pyth evm contract #2784

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

Conversation

danimhr
Copy link
Contributor

@danimhr danimhr commented Jun 14, 2025

Summary

This PR introduces support for a backup verifier in the Pyth EVM contract to enhance reliability when verifying VAAs.

Rationale

Pyth currently verifies VAAs exclusively using Wormhole. This creates a single point of failure: if Wormhole becomes unavailable or its guardians are unable to sign messages, Pyth will be unable to verify updates, potentially causing disruptions.

To address this, we’ve integrated a backup verifier into the contract. If Wormhole fails, the new verifier—with its own guardian set—can independently approve and verify VAAs. As a result, Pyth can continue to function even if Wormhole is down. Only if both the Wormhole and backup verifier guardian sets are unavailable will VAA verification become impossible.

This change improves the resilience and fault tolerance of the system without affecting current functionality.

How has this been tested?

  • Current tests cover my changes
  • Added new tests
  • Manually tested the code

Copy link

vercel bot commented Jun 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
api-reference ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 17, 2025 8:02pm
7 Skipped Deployments
Name Status Preview Comments Updated (UTC)
component-library ⬜️ Skipped (Inspect) Jun 17, 2025 8:02pm
developer-hub ⬜️ Skipped (Inspect) Jun 17, 2025 8:02pm
entropy-debugger ⬜️ Skipped (Inspect) Jun 17, 2025 8:02pm
entropy-explorer ⬜️ Skipped (Inspect) Jun 17, 2025 8:02pm
insights ⬜️ Skipped (Inspect) Jun 17, 2025 8:02pm
proposals ⬜️ Skipped (Inspect) Jun 17, 2025 8:02pm
staking ⬜️ Skipped (Inspect) Jun 17, 2025 8:02pm

@danimhr danimhr marked this pull request as draft June 14, 2025 12:36
@vercel vercel bot temporarily deployed to Preview – developer-hub June 16, 2025 06:46 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-debugger June 16, 2025 06:46 Inactive
@vercel vercel bot temporarily deployed to Preview – component-library June 16, 2025 06:46 Inactive
@vercel vercel bot temporarily deployed to Preview – api-reference June 16, 2025 06:46 Inactive
@vercel vercel bot temporarily deployed to Preview – proposals June 16, 2025 06:46 Inactive
@vercel vercel bot temporarily deployed to Preview – staking June 16, 2025 06:46 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-explorer June 16, 2025 06:46 Inactive
@vercel vercel bot temporarily deployed to Preview – insights June 16, 2025 06:46 Inactive
@vercel vercel bot temporarily deployed to Preview – api-reference June 16, 2025 14:08 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-debugger June 16, 2025 14:08 Inactive
@vercel vercel bot temporarily deployed to Preview – staking June 16, 2025 14:08 Inactive
@vercel vercel bot temporarily deployed to Preview – proposals June 16, 2025 14:08 Inactive
@vercel vercel bot temporarily deployed to Preview – insights June 16, 2025 14:08 Inactive
@vercel vercel bot temporarily deployed to Preview – developer-hub June 16, 2025 14:08 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-explorer June 16, 2025 14:08 Inactive
@vercel vercel bot temporarily deployed to Preview – component-library June 16, 2025 14:08 Inactive
@vercel vercel bot temporarily deployed to Preview – developer-hub June 16, 2025 14:20 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-explorer June 16, 2025 14:20 Inactive
@vercel vercel bot temporarily deployed to Preview – insights June 16, 2025 14:20 Inactive
@vercel vercel bot temporarily deployed to Preview – proposals June 16, 2025 14:20 Inactive
@vercel vercel bot temporarily deployed to Preview – api-reference June 16, 2025 14:20 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-debugger June 16, 2025 14:20 Inactive
@vercel vercel bot temporarily deployed to Preview – component-library June 16, 2025 14:20 Inactive
@vercel vercel bot temporarily deployed to Preview – staking June 16, 2025 14:20 Inactive
@vercel vercel bot temporarily deployed to Preview – api-reference June 16, 2025 14:28 Inactive
@vercel vercel bot temporarily deployed to Preview – proposals June 17, 2025 19:01 Inactive
@vercel vercel bot temporarily deployed to Preview – component-library June 17, 2025 19:01 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-explorer June 17, 2025 19:01 Inactive
@vercel vercel bot temporarily deployed to Preview – developer-hub June 17, 2025 19:01 Inactive
@vercel vercel bot temporarily deployed to Preview – api-reference June 17, 2025 19:01 Inactive
@vercel vercel bot temporarily deployed to Preview – insights June 17, 2025 19:01 Inactive
@danimhr danimhr marked this pull request as ready for review June 17, 2025 19:39
@danimhr danimhr requested review from keyvankhademi, Riateche and a team as code owners June 17, 2025 19:54
@danimhr danimhr force-pushed the feat/evm-wormhole-backup branch from 20858ee to 0bc888b Compare June 17, 2025 19:56
@vercel vercel bot temporarily deployed to Preview – component-library June 17, 2025 19:57 Inactive
@vercel vercel bot temporarily deployed to Preview – staking June 17, 2025 19:57 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-explorer June 17, 2025 19:57 Inactive
@vercel vercel bot temporarily deployed to Preview – developer-hub June 17, 2025 19:57 Inactive
@vercel vercel bot temporarily deployed to Preview – entropy-debugger June 17, 2025 19:57 Inactive
@vercel vercel bot temporarily deployed to Preview – insights June 17, 2025 19:57 Inactive
@vercel vercel bot temporarily deployed to Preview – proposals June 17, 2025 19:57 Inactive
// uint trailingHeaderOffset = offset
// uint x = UnsafeBytesLib.ToUint8(accumulatorUpdate, trailingHeaderOffset)
// trailingHeaderOffset += 1
uint trailingHeaderOffset = offset;
Copy link
Collaborator

Choose a reason for hiding this comment

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

shall we change MINIMUM_ALLOWED_MINOR_VERSION?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Why do we need to change that?

Copy link
Collaborator

Choose a reason for hiding this comment

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

it is a metadata to tell us on which version we are right now and reject messages with older minor version. if we don't check it and this gets upgraded before Hermes there might be problems.

Copy link
Collaborator

@ali-behjati ali-behjati left a comment

Choose a reason for hiding this comment

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

Nice. Can you also add the verifier to the constructor? It would be helpful to have it by default on the new deployments (we can set it to 0 for the time being)

// uint x = UnsafeBytesLib.ToUint8(accumulatorUpdate, trailingHeaderOffset)
// trailingHeaderOffset += 1
uint trailingHeaderOffset = offset;
signer = Signer(
Copy link
Collaborator

Choose a reason for hiding this comment

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

i've lost my solidity knowledge here, what would happen if this byte does not fit in Signer (which accepts only 0 and 1). let's check it if it's an undefined behaviour.

@@ -37,7 +37,8 @@ contract PythGovernanceInstructions {
SetWormholeAddress, // 6
SetFeeInToken, // 7 - No-op for EVM chains
SetTransactionFee, // 8
WithdrawFee // 9
WithdrawFee, // 9
SetVerifierAddress // 10
Copy link
Collaborator

Choose a reason for hiding this comment

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

note for the future: we need to support it in governance sdk in TS

// uint trailingHeaderOffset = offset
// uint x = UnsafeBytesLib.ToUint8(accumulatorUpdate, trailingHeaderOffset)
// trailingHeaderOffset += 1
uint trailingHeaderOffset = offset;
Copy link
Collaborator

Choose a reason for hiding this comment

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

it is a metadata to tell us on which version we are right now and reject messages with older minor version. if we don't check it and this gets upgraded before Hermes there might be problems.

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