Skip to content
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

Add EIP-1559 compatibility validation for transaction creation #1693

Merged
merged 6 commits into from
Sep 27, 2023

Conversation

vinistevam
Copy link
Contributor

@vinistevam vinistevam commented Sep 21, 2023

Explanation

This PR aims to include a validation existent in the Extension in the TransactionController core. The validation gets the current network and current account to check if they support EIP-1559 transactions. If the transaction is an EIP-1559 transaction, meaning it contains maxFeePerGas and maxPriorityFeePerGas values, but the network or account does not support EIP-1559, then an error is thrown.

In order to support it two callbacks are passed to the controller constructor getCurrentAccountEIP1559Compatibility and getCurrentNetworkEIP1559Compatibility.

Changelog

@metamask/transaction-controller

  • BREAKING: Add required getCurrentAccountEIP1559Compatibility and getCurrentNetworkEIP1559Compatibility callback arguments to constructor.

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've highlighted breaking changes using the "BREAKING" category above as appropriate

@vinistevam vinistevam marked this pull request as ready for review September 21, 2023 09:39
@vinistevam vinistevam requested a review from a team as a code owner September 21, 2023 09:39
OGPoyraz
OGPoyraz previously approved these changes Sep 21, 2023
matthewwalsh0
matthewwalsh0 previously approved these changes Sep 21, 2023
@vinistevam
Copy link
Contributor Author

Only merge after #1690 to use @metamask/rpc-errors

@vinistevam vinistevam merged commit db2aef2 into main Sep 27, 2023
107 checks passed
@vinistevam vinistevam deleted the refactor/978-validate-eip-1559-compatibility branch September 27, 2023 09:22
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
## Explanation

This PR aims to include a validation existent in the Extension in the `TransactionController` core. The validation gets the current network and current account to check if they support EIP-1559 transactions. If the transaction is an EIP-1559 transaction, meaning it contains `maxFeePerGas` and `maxPriorityFeePerGas` values, but the network or account does not support EIP-1559, then an error is thrown.

In order to support it two callbacks are passed to the controller constructor `getCurrentAccountEIP1559Compatibility` and
`getCurrentNetworkEIP1559Compatibility`.

## Changelog

### `@metamask/transaction-controller`

- **BREAKING**: Add required `getCurrentAccountEIP1559Compatibility` and `getCurrentNetworkEIP1559Compatibility` callback arguments to constructor.
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
## Explanation

This PR aims to include a validation existent in the Extension in the `TransactionController` core. The validation gets the current network and current account to check if they support EIP-1559 transactions. If the transaction is an EIP-1559 transaction, meaning it contains `maxFeePerGas` and `maxPriorityFeePerGas` values, but the network or account does not support EIP-1559, then an error is thrown.

In order to support it two callbacks are passed to the controller constructor `getCurrentAccountEIP1559Compatibility` and
`getCurrentNetworkEIP1559Compatibility`.

## Changelog

### `@metamask/transaction-controller`

- **BREAKING**: Add required `getCurrentAccountEIP1559Compatibility` and `getCurrentNetworkEIP1559Compatibility` callback arguments to constructor.
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.

3 participants