Commit Graph

115 Commits

Author SHA1 Message Date
Jeff Schroeder c40323828b ethereum: limit deps in the QueryDemo contract
- Context is generally a worthless import
- Ownable is totally unused and a worthless import
2023-10-26 12:59:24 -04:00
Bruce Riley faea3bab8d CCQ: EVM Library and Demo Contract 2023-10-26 12:59:24 -04:00
derpy-duck bebcf281e6
relayer: allow override target chain refund (#3430)
* refund address handling improvement

* fix compilation error

* Remove unnecessary line

* restrict to view

* fix comment

* Improve handling of gas limits

* get test to pass - check that the return data is appropriately long before decoding

* modification to checking inequality

* modification to checking inequality - use unchecked

* clean functions around - add untrustedBaseDeliveryPrice

* make quote_length_bytes a constant

* seperate pay into two overloads

* change inequality to equality for checking return data length

* renaming functions

* allow override of refund per gas unused

* test modification

* note
2023-10-13 17:19:56 -04:00
derpy-duck 6c3ff43d6a
Auto relayer refund address handling improvement (#3428) 2023-10-13 00:10:50 -04:00
derpy-duck faa397ca4f
AutoRelayer: v1.1 Release (#3313)
* AutoRelayer: remove forwards

* AutoRelayer: reentrancy guard

* AutoRelayer: remove forwards from sdk

* AutoRelayer: VaaKey -> MessageKey internals

* AutoRelayer: check delivery provider supports keyType

* AutoRelayer: VaaKey backcompat wire format

* AutoRelayer: sdk fix

* AutoRelayer: Add supported keys to delivery provider

* AutoRelayer: reintroduce reentrancy guard, revert when replay protection triggered

* AutoRelayer: fix manual delivery test

* AutoRelayer: review flups

* AutoRelayer: move libraries within relayer folder

* AutoRelayer: fix delivery provider config script

Also fix delivery provider revert bug

* AutoRelayer: Andreas code review flups

* AutoRelayer: js sdk includes MessageKey serde

* AutoRelayer: update sdk to use message key

* AutoRelayer: Simplify executeInstruction to internal call (#3352)

* refund instead of revert for replay protection (#3371)

* refund instead of revert for replay protection

* Remove mention of forward from IWormholeReceiver

* AutoRelayer: 1.1 reintroduce forwards (#3385)

* forward fallback WIP

* forward fallback no tmp storage

* Re-introduce testing of 'forward'

* Reintroduce forwards with original or default behavior for refund info + delivery provider info

* Reintroduce reentrant, only store refund information

---------

Co-authored-by: Joe Howarth <josephehowarth@gmail.com>
Co-authored-by: Joe Howarth <jhowarth@jumptrading.com>
2023-09-22 15:07:59 -04:00
Csongor Kiss 4d51f8e57e ethereum/relayer: fix storage constant comments
The hash preimages for storage calculations were wrong for two storage
slots. The updated preimages can be verified to be correct with e.g. the
`chisel` command line tool from the foundry suite.
2023-09-18 10:02:52 -04:00
Joe Howarth 88b092e648
AutoRelayer: replay protection (#3272)
* AutoRelayer: replay protection

* AutoRelayer: store block number on failure and success, use for replay protection and indexing

* AutoRelayer: add 'deliveryAttempted' view fn; clear failure mapping on success
2023-08-09 13:51:44 -07:00
gator-boi d5f809df8b evm: add TransferRedeemed event to Bridge.sol 2023-07-07 09:29:15 -05:00
derpy-duck 12b18d4ccc
Relayer new delivery provider implementation (#3088)
* WIP

* Pricing Wallet test

* Give owner same permissions as price oracle
2023-06-14 17:01:14 -04:00
derpy-duck 7885acb9bd
Relayer: Ethereum folder Changes for Merging into Main (#3038)
* gRelayer: surrounding files

* modification to get compilation

* restore devnet

* remove generic relayer docker

* remove wait for relayer engine

* keep build time 20

* sh -> bash

* sh -> bash

* Remove comment

* bash -> sh

* Revert "bash -> sh"

This reverts commit 5c37e92fa1.

* bash->sh

* gRelayer: ethereum folder changes for generic-relayer-merge

* add eth-devnet

* Adds .github because workflow needs to install forge

* sdk-ci-tests need to install forge

* don't wait for nonexistent relayer engine

* update package.json and package-lock.json

* Remove unnecessary types from package.json

* ts-node

* gRelayer: ethereum folder changes for generic-relayer-merge

* sdk-ci-tests need to install forge

* don't wait for nonexistent relayer engine

* update package.json and package-lock.json

* remove these changes

* Relayer: Natspec documentation in IWormholeRelayer (#3032)

* WIP

* Fixes

* Updated interfaces

* remove bash

* Forward uses same refund chain id and refund address (#3034)

* WIP

* Fixes

* Forward uses same refund chain id and refund address

* Updated interfaces

* Remove forge build warnings

* Add note to interface for resend

* via-ir on unless in Tilt

* Correct IWormholeReceiver interface

* Wormhole message fee now part of quoteDeliveryPrice (#3043)

* Fix to PR 3043

* Remove compiler warning

* Relayer/address drew review (#3060)

* Fix typo in Create2Factory

* Add event for contract upgrades

* Prevent registering contract if it is already registered

* Prevent allowing unset chainId for default delivery provider governance VAA

* memory to calldata for external functions in WormholeRelayerSend

* continue memory to calldata for external functions

* Fix pricing in delivery provider

* Sanity check new default delivery provider isn't 0 address

* Don't save vaaKey as local variable

* cache the length of array rather than iterate every time for vaaKeys

* Replacing memory with calldata in few locations

* Remove stale file DeliveryProviderMessages

* Remove batch VAA sender script

* Remove batch VAA from WormholeSimulator

* Wait for a confirmation in deploy scripts

* remove unnecessary comments

* Fix Delivery Provider Pricing and add a test

* remove console logs

* Revert "continue memory to calldata for external functions"

This reverts commit f322afb6c0.

* Revert "memory to calldata for external functions in WormholeRelayerSend"

This reverts commit 42fcaad884.

* Revert "Don't save vaaKey as local variable"

This reverts commit a9172379c5.

* Revert "cache the length of array rather than iterate every time for vaaKeys"

This reverts commit d61380a9b0.

* Revert "Replacing memory with calldata in few locations"

This reverts commit 94e47b6e72.

* Revert "Fix typo in Create2Factory"

This reverts commit a9f7bdf461.

* Update contract addresses for via-ir

* Slight improvements to delivery provider implementation

* typed errors for delivery provider

* enable VIA-IR in CI and not in Tilt

* correct contract address for via ir

* WormholeRelayerSend and WormholeRelayerDelivery (#3082)
2023-06-13 17:01:43 -04:00
njkumr 6825d5ca3a
ethereum: adding hash check in verifyVM (#1851)
* adding a check to verify the vm.hash against the hash of the body and tests for the same
2023-01-24 16:10:52 +00:00
Hendrik Hofstadt 9b50158a3f
add: safety check against signatory being address(0) (#2021)
* add: safety check against signatory being address(0)

Change-Id: I0e0b32c9d9b8501cfe57b8c672441314774c009f

* evm: add revert message and fix tests

Co-authored-by: Rasul <rasul.yunusov282750@gmail.com>
Co-authored-by: A5 Pickle <a5-pickle@users.noreply.github.com>
2023-01-11 18:32:48 +01:00
kev1n-peters fd1ed1564e
evm: Added Core and NFT Bridge EVM chain ID migrations (#2067) 2022-12-12 20:37:30 -06:00
Csongor Kiss effde7f756 ethereum: Implement shutdown for all 3 contracts (fixes #1937)
These are stripped down versions of the original contracts that can be
dropped in place via an upgrade to disable core functionality.
Governance features are still enabled, which means it's possible to
upgrade back to a working implementation.
2022-11-23 15:22:52 +00:00
Csongor Kiss 648b361623 ethereum: Set impl initialised during setup (fixes #1930) 2022-11-23 14:51:29 +00:00
Csongor Kiss 2f0cb19a0a ethereum: Remove initialisation code
These migrations have been performed, so the migration code can
now safely be removed.
2022-11-17 11:46:21 +00:00
Csongor Kiss f96f8083b3 ethereum: set optimism and arbitrum token contracts 2022-11-16 17:09:51 +00:00
Csongor Kiss dc67b40be5 ethereum: ensure that token implementation is non-0 2022-11-16 17:09:51 +00:00
Reptile bac99e912f
evm: add token and nft bridge interface (#1710)
* Add token and nft bridge interface

* Add wormhole method to nft and bridge interface

* ethereum: add test to ensure interface match

* Add all public methods to interfaces

Co-authored-by: gator-boi <gator-boi@users.noreply.github.com>
Co-authored-by: Evan Gray <battledingo@gmail.com>
2022-10-28 12:28:40 -04:00
Evan Gray cb161db5e0 ethereum: migration for ERC20Permit 2022-09-19 15:31:44 -04:00
Karl Kempe 9df96ac666 Fix domain separator and add more tests 2022-09-19 13:42:38 -04:00
Karl Kempe d8adb6a700 Add ERC20 permit 2022-09-19 13:42:38 -04:00
Drew 6c6b25ab2a add check for the zero address in storeGuardianSet
Change-Id: Ic3c5fce71f687d98380d39dc62923d9c6423e194
2022-09-15 10:39:39 -04:00
Kevin Peters cec5bc7528 ethereum: Added fork protection tests 2022-09-09 13:16:27 -05:00
Kevin Peters 099756fe68 ethereum: Use chainId() getter in initialize 2022-09-09 13:16:27 -05:00
Kevin Peters e21d701443 ethereum: Changed invalid fork error message 2022-09-09 13:16:27 -05:00
Kevin Peters b7535a8e5b ethereum: Added isFork() method 2022-09-09 13:16:27 -05:00
Kevin Peters b1081d7d93 ethereum: Simplified forked chain check
No longer need to return uint16 max in chainId() for forked chains
2022-09-09 13:16:27 -05:00
Kevin Peters 3f9c80a554 ethereum: Fixed comment typo 2022-09-09 13:16:27 -05:00
Kevin Peters cacf054f0b ethereum: Added RecoverChainId Governance Message
Used to set the `chainId` and `evmChainId` for "bad-fork" chains
2022-09-09 13:16:27 -05:00
Kevin Peters 9d477e0585 ethereum: EVM fork protection
Added a `uint256 evmChainId` state variable to the Core, Token and NFT Bridge
contracts. `evmChainId` is compared to `block.chainid` in the `chainId`
function. When they don't match, a "bad fork" Chain ID is returned,
otherwise the Wormhole Chain ID is returned.
2022-09-09 13:16:27 -05:00
tbjump 09548300a0
comment danger of potential future VM.version increases (#1401)
comment danger of potential future VM.version increases
2022-09-07 12:33:35 -07:00
Evan Gray a58c5ae950 ethereum: remove wormhole from token name 2022-08-31 17:21:52 -04:00
Csongor Kiss fd540c91b4
ethereum: Check that bytes32 fits into 20 bytes before truncating (#1457) 2022-08-23 14:41:03 -04:00
Csongor Kiss 9510bb47d9 ethereum: Add property test on quorum
It should always be possible to reach quorum
2022-08-23 15:06:04 +02:00
justinschuldt d7b102df70 add EVM contract for batched VAA development 2022-08-15 08:41:40 -05:00
Csongor Kiss 2e890f02b3 ethereum: be more explicit about invalid guardian + test 2022-08-09 20:02:47 +01:00
Jonathan Claudius 73307397bc
Comment Eth Governance contracts (#1325)
* Comment Eth Governance contracts

* Tweak comments per peer review

* Add replay to the list
2022-07-12 09:02:26 -04:00
Csongor Kiss c453f4cf6d evm: Make finality a state variable 2022-06-28 21:31:23 +01:00
Csongor Kiss 2c9f7c239e ethereum: fix core contract upgradeability
Missed initializer
2022-06-27 19:19:16 +01:00
Csongor Kiss b6ea70fde0 evm: Add fromAddress to TransferWithPayload and remove fee 2022-06-21 22:35:49 -04:00
Csongor Kiss 5a4ce6ab51 ethereum: whitespace + docs 2022-06-21 22:35:49 -04:00
Jonathan Claudius 8875735581
Move quorum out of verifyVM (#1162)
* Move quorum out of verifyVM

* Add stub out to demonstrate sol-based tests

* Remove unnecessary import

* Neaten up the quorum conditional

* Another iteration on figuring out the test logic

* Fix indentation

* Refactor quorum and setup unit-test cases

* fix return naming

* More variable name clean up

* Move length check inside loop structure

* Fix condition by wrapping

* Fix syntax error

* fix type definition for testCases

* Drop inline struct usage for simple 2d array

* Fix logic in quorum check

* Make test public and fully qualify quorum

* Make wormhole.sol fail

* Specify where to store testCases

* Define array directly

* Fix syntax error on array definition

* Fix variable name

* Move back to memory-based variable

* Add remove qualified quorum call

* Get really direct on quorum tests

* Simplify quorum logic

* Add test for 19 guardians
2022-06-07 09:45:47 -04:00
Evan Gray 73e15db866 eth: token bridge transfer with payload 2022-05-11 21:24:36 -04:00
Jonathan Claudius 5a987a8d2b
Comment ethereum messages (#1025)
* Add comments to Ethereum Messages.sol contract

* Remove current language, as it's a bit misleading

* Change comment formatting

* Switch to NatSpec comments

* Clean up comments for expired GuardianSet checks

* Clean up comments for expired GuardianSet checks, again
2022-04-19 21:07:08 -04:00
Csongor Kiss f22dfcece3 ethereum/nft-bridge: Transfer before burn
This is consistent with the token bridge
2022-03-18 13:14:32 +00:00
Evan Gray a3272dce4a remove pyth2wormhole 2022-03-07 10:23:34 -05:00
Stanisław Drozd 2ea41b8176
[WIP] Pr/drozdziak1/p2w batching/5e704f8b (#877)
* ethereum: p2w contract -> p2w emitter, fill in essential envs

Change-Id: I6fa9364a96738d2cc02ec829a31fedba0586d8e8

commit-id:0a56f1f8

* Add p2w-relay, a p2w-sdk integration test

commit-id:6bfab639

* p2w-sdk: Expand README

Change-Id: I17cb547d6aaddc240588923561c26d11a787df2e

commit-id:6ebd6a22

* p2w-sdk: don't build ETH contracts, only the types

Change-Id: I7cbd18328227700635d7688aa24a9671e8919fcd

commit-id:adf079f7

* p2w: configurability and sane envs

commit-id:f10fd90e

* Solitaire: Implement Option<T> support in structs

commit-id:31aa12d6

* bridge/governance.rs: Stop pestering about EMITTER_ADDRESS

commit-id:d5bd7234

* p2w-attest: price batching

This commit introduces support for multiple Pyth product/price pairs
per call. The initial maximum batch size is 5 and is enforced using a
`P2W_MAX_BATCH_SIZE` constant.

solana/pyth2wormhole/program:
* On-chain batching logic
* Batch message parsing logic

solana/pyth2wormhole/client:
* Off-chain batching logic - divides any number of symbols into
largest possible batches
* Use a multi-symbol config file instead of CLI arguments

third_party/pyth/p2w-sdk:
* Expose batch parsing logic

third_party/pyth/p2w-relay:
* Comment out target chain calls until ETH contract supports batching
* Test the batch parsing function

third_party/pyth/p2w_autoattest.py:
* Generate and use the symbol config file  with pyth2wormhole-client

third_party/pyth/pyth_publisher.py:
* Add a configurable number of mock Pyth symbols
* Adjust HTTP endpoint for multiple symbols

commit-id:73787a61

* p2w-attest: mention attestation size in batch

This commit ensures that no matter the attestation format, a batch
will never contain attestations of different sizes. This guarantee
enables forward compatibility by adding new constant-size fields at
the end of a batch at all times. An older implementation will simply
not consume the remaining newer values while respecting the stated
batch member alignment.

commit-id:210da230

* pyth2wormhole-client: use fresh blockhashes, harden batch errors

This commit makes sure we don't have to deal with expired transactions
due to stale blockhashes. The problem existed with larger symbol
configs as well as on Solana mainnet. Additionally, the attestation logic
now treats transaction errors as non-critical - a failure for a batch
does not prevent attestation attempts for batches farther in the queue

commit-id:5e704f8b
2022-02-23 19:12:16 +01:00
Evan Gray 608c724a76 evm/token_bridge: reentrancy protection 2022-01-28 10:44:10 +00:00
Evan Gray 7ecce0d302 eth: nft bridge impl initialize 2022-01-07 13:28:11 -05:00