Commit Graph

33 Commits

Author SHA1 Message Date
bruce-riley af8138d4fb
CCQ/EVM: eth_call_by_timestamp and eth_call_with_finality support (#3468)
* CCQ/EVM: ethCallByTimestamp & ethCallWithFinality

* Code rework

* Code review rework
2023-10-31 17:05:19 -04:00
Jeff Schroeder 50f6ca9fc7 ethereum: more QueryResponse tests 2023-10-26 12:59:24 -04:00
Jeff Schroeder e219e2fd8c ethereum: QueryResponse test tyop fix 2023-10-26 12:59:24 -04:00
Jeff Schroeder 841f041c7e ethereum: update QueryResponse tests
Instead of the test contract inheriting directly from the QueryResponse
contract, it instantiates an instance of it and uses that for the
testing. This seems to work much nicer with the forge coverage tools.

With this commit, the coverage for QueryResponse shows 85.1% line
coverage, 100% function coverage, and 50% branch coverage.
2023-10-26 12:59:24 -04:00
Jeff Schroeder b4a27f4aed ethereum: Query.t.sol --> QueryResponse.t.sol
To follow standard forge testing practice, you use the same filename
for a test contract as for the file it is testing, but make the
extension .t.sol.
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
Jeff Schroeder a9437e8dc2 ethereum: add arrayElementLocation() test helper
Review feedback from @kcsongor in #3363
2023-09-11 14:03:51 -04:00
Jeff Schroeder d9aacf1485 ethereum: fix some intermittently failing tests
Fix the assumptions to match the storage layout correctly.
2023-09-11 14:03:51 -04:00
Jeff Schroeder 049ca971df ethereum: tighten up some test funcs to pure/view
Fallout from #2956
2023-09-11 14:03:51 -04:00
lucasmt 406a43d03e
ethereum: Add property tests and instructions for running them with KEVM (#2956)
* ethereum: Add Foundry tests written by RV

* ethereum: Add scripts and instructions to run proofs using KEVM

* ethereum: Fix typo on testSetup_after_setup_revert_KEVM

* ethereum: Edit Makefile to skip KEVM tests when running forge test

* ethereum: Fix commented-out lines in Foundry tests

* ethereum: Refactor GovernanceStructs invalid-size tests

* ethereum: Replace assume with bound in Foundry tests

Co-authored-by: Jeff Schroeder <jeffschroeder@computer.org>

* ethereum: Apply review suggestions to run-kevm script

Co-authored-by: Jeff Schroeder <jeffschroeder@computer.org>

* ethereum: explicit cast to uint8 for some vars

The bound() calls need to be explicitly cast to uint8 from the uint256
that forge-std's bound() returns.

* ethereum: updating some of the RV tests

The definitions don't compile with newer forge/solc.

* ethereum: Add assumption to test that guardian count > 0

Prevents an arithmetic over/underflow error in testCannotVerifySignaturesWithOutOfBoundsSignature, in the expression bound(outOfBoundsGuardian, 0, params.guardianCount - 1)

---------

Co-authored-by: Lucas MT <lucas.tabajara@runtimeverification.com>
Co-authored-by: Jeff Schroeder <jeffschroeder@computer.org>
2023-09-06 11:24:00 -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
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
Csongor Kiss 7f7330ddab Revert "ethereum: fix view error with newer version of forge"
This reverts commit 05cec3d729 (#3059)

The commit was erroneously included in anticipation of a forge version
update, but it actually only generates an error with an outdated
forge-stdlib version.

The old version's `vm.addr` function
(see
ddb69063e4/src/Vm.sol (L15))
has no `pure` modifier, thus any function using it can not be `pure` (or `view`).
The new version (see
66bf4e2c92/src/Vm.sol (L55))
on the other hand does. In fact, with the new version, removing the
modifier produces a warning.
2023-06-13 17:29:04 -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
Jonathan Claudius 05cec3d729 ethereum: fix view error with newer version of forge 2023-06-13 14:43:12 -04:00
Jeff Schroeder 8605ef0e5f ethereum: kill warning in TokenImplementation.t
Newer versions of forge show this warning:

    [⠊] Compiling...
    [⠢] Compiling 93 files with 0.8.4
    [⠘] Solc 0.8.4 finished in 20.09s
    Compiler run successful (with warnings)
    warning[2018]: Warning: Function state mutability can be restricted to view
    --> forge-test/TokenImplementation.t.sol:76:5:
    |
    |     function simulatePermitSignature(
    |     ^ (Relevant source part starts here and spans across multiple lines).

This change cleans it up.
2023-05-17 12:51:26 -05:00
Jeff Schroeder 128352a91d ethereum: change inheritance for TestMessages
Do not inherit from Getters and Messages directly.
2023-05-17 12:51:26 -05:00
Jeff Schroeder ca2f8ce283 ethereum: change inheritance for BridgeTest
The BridgeTest contract inherited from both Bridge and forge-std's
Test contracts. This was fine with the ancient version of
forge-std it was using, but newer forge-std has an isFork() from
foundry-rs/forge-std#236. This makes upgrading forge-std to take
advantage of new features like improved invariant testing or smart
fuzzing impossibru.

This makes it a bit cleaner and also fixes some of the logic in the
testTruncate to not be undefined.

Thanks @scnale for the assist on this one!
2023-05-17 12:51:26 -05: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
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
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 ae04a305f3 ethereum: fixed tests 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
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
Csongor Kiss 7889eb08ee ethereum: Fix test name so forge runs it 2022-08-23 15:06:04 +02:00
Csongor Kiss 2e890f02b3 ethereum: be more explicit about invalid guardian + test 2022-08-09 20:02:47 +01:00
Csongor Kiss 3e051e97b6 ethereum: Init foundry project and add installer for native solc 2022-08-09 20:02:47 +01:00