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

[eth] Use PythErrors everywhere #404

Merged
merged 5 commits into from Nov 29, 2022
Merged

Conversation

ali-bahjati
Copy link
Contributor

@ali-bahjati ali-bahjati commented Nov 29, 2022

This PR uses PythErrors structs instead of error strings everywhere and updates the tests (both truffle and foundry). This change reduces contract size from 23.69KB to 20.94KB.

Notes:

  • Error structs are only possible with revert. So I changed all require statements to revert.
  • Truffle does not support error structs and I adopted a solution from here and created expectRevertCustomError.

@ali-bahjati ali-bahjati changed the title Use PythErrors everywhere [eth] Use PythErrors everywhere Nov 29, 2022
Mutation might cause some BytesLib error too.
ethereum/contracts/pyth/Pyth.sol Show resolved Hide resolved
ethereum/test/pyth.js Outdated Show resolved Hide resolved
ethereum/test/pyth.js Outdated Show resolved Hide resolved
@ali-bahjati ali-bahjati merged commit c3461e5 into main Nov 29, 2022
@ali-bahjati ali-bahjati deleted the abehjati/eth-use-error-struct branch November 29, 2022 17:30
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.

None yet

3 participants