-
Notifications
You must be signed in to change notification settings - Fork 244
feat(target_chains/ethereum): add tx fee to evm contract #2526
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
Conversation
…ulations and state management in pyth contract
… transaction fee management
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 6 Skipped Deployments
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces transaction-level fee support for Ethereum contracts in the Pyth price feed updates through new governance actions and contract state changes.
Key changes include:
- Implementation of a new governance action "SetTransactionFee" with corresponding payload structure and encoding/decoding logic.
- Contract modifications to manage the transaction fee state and update fee calculations.
- Updates to governance payload tests to cover serialization and deserialization of the new action.
Reviewed Changes
Copilot reviewed 5 out of 11 changed files in this pull request and generated no comments.
File | Description |
---|---|
governance_payload/index.ts | Added import, case handling, and export for SetTransactionFee in the governance API. |
governance_payload/SetTransactionFee.ts | Implemented the SetTransactionFee class with encode/decode functionality. |
governance_payload/PythGovernanceAction.ts | Defined the new action type (value 8) for SetTransactionFee. |
tests/GovernancePayload.test.ts | Added tests for serializing/deserializing the new SetTransactionFee action. |
Files not reviewed (6)
- target_chains/ethereum/contracts/contracts/pyth/Pyth.sol: Language not supported
- target_chains/ethereum/contracts/contracts/pyth/PythGetters.sol: Language not supported
- target_chains/ethereum/contracts/contracts/pyth/PythGovernance.sol: Language not supported
- target_chains/ethereum/contracts/contracts/pyth/PythGovernanceInstructions.sol: Language not supported
- target_chains/ethereum/contracts/contracts/pyth/PythSetters.sol: Language not supported
- target_chains/ethereum/contracts/contracts/pyth/PythState.sol: Language not supported
Comments suppressed due to low confidence (1)
governance/xc_admin/packages/xc_admin_common/src/tests/GovernancePayload.test.ts:429
- [nitpick] Consider renaming record keys 'v' and 'e' to 'newFeeValue' and 'newFeeExpo' for improved clarity in the tests.
return fc.record({ v: fc.bigUintN(64), e: fc.bigUintN(64) })
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! and thanks for moving the tests to foundry. Please address my comments. Also can you update contract version so we don't miss it? (you can use a alpha next version because we are going to have more changes there)
governance/xc_admin/packages/xc_admin_common/src/governance_payload/index.ts
Outdated
Show resolved
Hide resolved
target_chains/ethereum/contracts/forge-test/PythGovernance.t.sol
Outdated
Show resolved
Hide resolved
…luding Wormhole-specific tests
Summary
Added support for transaction-level fees in Pyth price feed updates by:
SetTransactionFee
(action type 8)Rationale
These changes enable charging a base transaction fee in addition to per-update fees for price feed updates. This helps:
Technical Changes
Contract Changes:
transactionFeeInWei
state variable toPythStorage
getTotalFee()
to include transaction fee componentSetTransactionFee
Governance Support:
SetTransactionFee
action type and payload structureTypeScript Changes:
SetTransactionFee
governance action implementationHow has this been tested?
Current tests cover my changes
Added new tests
Manually tested the code