Commit Graph

165 Commits

Author SHA1 Message Date
scnale 2ed875bef7
Updates prices in `RelayProvider` in batch. (#122) 2023-03-24 14:04:02 -04:00
derpy-duck 9e282508f7
Improve forge test coverage + Seperate tests into individual tests (#119)
* fast tests

* forge fmt

* Remove parameter from forge test generic relayer

* WIP

* WIP

* Move Forge Mock Generic Relayer to seperate file

* Split revert redelivery tests into first few seperate tests

* redelivery test changes

* WIP

* tests pass

* Redelivery tests less D.R.Y and seperated into individual tests

* Delivery tests less D.R.Y and seperated into individual tests

* Resend checks in seperate tests

* Forward test coverage!

* 100% test coverage in CoreRelayer and CoreRelayerDelivery!

* remove test coverage files

* Governance tests

* governance stack

* forge fmt

* removed console.sol
2023-03-23 14:14:48 -05:00
chase-45 2ea98eaa8d
Typescript SDK (#79)
* sdk additions, query delivery status functions

* import fixes

* imports

* Fixes for getDeliveryStatusBySourceTx

* Fix typo in invalidRedeliveryTopics

* Use negative number feature of queryFilter

* 2047 -> 2040

* WIP

* Typescript test for statusByTx

* small changes

* revert reason WIP

* continued WIP for getting revert reason

* Remove reason parsing

* WIP adding default RPCs

* compiles

* SDK nicely prints delivery information!

* SDK nicely prints delivery information!

* Change error msg

* Tests pass, including test for resending a failed forward!

* Enum

* update SDK in relayer engine

* remove testgovernance file

* Nice error logging around not finding a delivery

* Update relayer engine sdk

* Respond to PR comments

* Fix test

* fixed new lines

* helper

---------

Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
2023-03-15 15:32:33 -07:00
Joe Howarth eff19d28aa
Continuously send messages to create load (#118)
* save

* Continuously send messages to create load

* add metrics
2023-03-14 10:45:03 -07:00
derpy-duck 92dbc20c8b
Forge tests faster (#117)
* fast tests

* forge fmt

* add --via-ir to build

* remove forge test-fast; just run forge test for the same effect

* remove outdated and unused folder
2023-03-10 10:41:12 -05:00
derpy-duck db355a2f1d
Revert if delivery address is 0, and add forge tests testing this (#115)
* Revert if delivery address is 0, and add forge tests testing this

* Test passes
2023-03-02 13:37:12 -05:00
derpy-duck 11874c5c76 event fix 2023-03-02 10:02:46 -05:00
derpy-duck 27cbbc7804 forge fmt' 2023-03-02 10:02:46 -05:00
derpy-duck 81cb32981a Nice CoreRelayerDelivery comments 2023-03-02 10:02:46 -05:00
derpy-duck dab942c980 WIP 2023-03-02 10:02:46 -05:00
derpy-duck c2117b6ef1 deliverSingle is nice 2023-03-02 10:02:46 -05:00
Joe Howarth a0484dead1
Contract deploys (#112)
* Contract deploys

* save
2023-02-28 16:42:53 -05:00
derpy-duck 6fee6ba1e4
Nice comments in the code (#111)
* resend doesn't take nonce as parameter

* Replace 'delivery failure' with 'receiver failure' in specs

* helper send method

* Fix interface to match not having nonce for resend

* Fix forge tests to not have nonce as a parameter

* fix redeliveryTest

* Split CoreRelayer into CoreRelayer and CoreRelayerDelivery

* fix build error

* forge fmt

* fix interface of getdefaultrelayprovider

* Nice comments for main functions in CoreRelayer.sol

* Nice comments for CoreRelayerMessages

* forge fmt

* merge

* Removes wormholeMessageFee from storage to avoid excessive gas costs.

---------

Co-authored-by: Sebastián Claudio Nale <sebinale@gmail.com>
2023-02-28 10:09:01 -05:00
Sebastián Nale a292dc253d Adds `AssetConversion` struct to avoid multiple reads or stores. 2023-02-27 21:20:51 -03:00
derpy-duck 7b384caadc
Remove TODO comment, correct 10^-6 (#108) 2023-02-27 18:49:58 -05:00
derpy-duck 7416880825
Miscellaneous fixes (#104)
* resend doesn't take nonce as parameter

* Replace 'delivery failure' with 'receiver failure' in specs

* helper send method

* Fix interface to match not having nonce for resend

* Fix forge tests to not have nonce as a parameter

* fix redeliveryTest

* fix build error

* forge fmt

* fix interface of getdefaultrelayprovider
2023-02-27 18:49:38 -05:00
scnale 24d682bca4
Mark assembly as `memory safe` (#107)
* Adds `memory-safe` tag to assembly sections in `BytesLib`.

This improves codegen in the compiler and reduces the chance of
untraceable internal codegen errors when dealing with stack variables
that can't be referenced with an instruction.

Also, it removes unused functions in `BytesLib` to reduce code surface.

* Renames functions and contracts in reentrancy negative test.

* Adds `unchecked` block for overflow check.
2023-02-27 15:59:00 -07:00
derpy-duck f7de3d649d
Code cleanup (#109)
* DRY: Remove duplicate structs

* Move encode/decode/convert-request-to-instruction related files to CoreRelayerMessages

* remove rolloverchain; now it is just the chain of the first request

* forge test fix to accomdoate for removing two getters

* DRY: Remove repeated error messages

* Remove miscellaneous comments

* DRY send and forward

* replace relayprovider interface with address to match the IWormholeRelayer interface

* forge fmt

* Remove byteslib from CoreRelayer

* Remove the encoding and decoding of the delivery request -> just store the struct itself!

* forge fmt

* Rewriting of checks in send/resend/forward

* test passes

* DRY - Emit only one event

* DRY

* forge fmt

* Fix typescript error

* using IWormholeRelayer

* Consistent naming

* call wormhole.messageFee() once

* Remove unnecessary line

* Compute the length once, not every iteration

* forge tests pass
2023-02-27 14:32:57 -05:00
scnale a1df44b3ee
Eliminates redundant `await`s. (#98)
* Eliminates redundant `await`s.

* Adds a couple of missing `await`s.
2023-02-21 16:17:39 -05:00
Sebastián Claudio Nale 40e5c70430 Further adjustments to `vm.deal` in forge tests. 2023-02-21 12:56:07 -03:00
Sebastián Claudio Nale 004e1b3059 `forge fmt` run. 2023-02-21 12:56:07 -03:00
Sebastián Claudio Nale 4b8dfd5379 Avoid EVM payment overflow exceptions by avoiding the max balance. 2023-02-21 12:56:07 -03:00
Sebastián Claudio Nale 01bd5540a1 Reuse `wormhole()` and `wormhole.messageFee()` expressions. 2023-02-21 12:56:07 -03:00
Sebastián Claudio Nale 315f0909c7 Comment a couple of optimization opportunities. 2023-02-21 12:56:07 -03:00
Sebastián Claudio Nale a2bdeaffea Optimize `convertToEncodedRedeliveryByTxHashInstruction`.
This reduces code size and gas used.
2023-02-21 12:56:07 -03:00
Sebastián Claudio Nale a2bca1782c Optimize `appendDeliveryInstruction`.
This simplification allows the compiler to emit less code.
2023-02-21 12:56:07 -03:00
Sebastián Claudio Nale 44cd7ee49b Set `viaIR` flag in foundry.toml 2023-02-21 12:56:07 -03:00
Sebastián Claudio Nale 958d964ad5 Avoid call if the value sent is zero. 2023-02-21 12:56:07 -03:00
Sebastián Claudio Nale a5427bb177 Make refund and reward addresses `payable`. 2023-02-21 12:56:07 -03:00
Sebastián Claudio Nale 9acc9fcbd6 Cleans up `validateRedeliverySingle`. 2023-02-21 12:56:07 -03:00
derpy-duck d814cd99a3 Remove files in ethereum/ 2023-02-21 10:44:16 -05:00
Sebastián Claudio Nale 01da291299 Fix forge test build. 2023-02-21 12:43:33 -03:00
derpy-duck 585626c1fc Make the '600000' hardcode safer 2023-02-21 12:43:33 -03:00
derpy-duck 447db2cd00 forge test fix 2023-02-21 12:43:33 -03:00
Sebastián Claudio Nale 1003717cdb Adds `receive()` function in `MockRelayerIntegration`. 2023-02-21 12:43:33 -03:00
derpy-duck b0e1378957 Forge tests pass; Fixed the 'string' for the InvalidRedeliveryVM error, which changed in the replacement of wormhole with MockWormhole 2023-02-21 12:43:33 -03:00
Sebastián Claudio Nale 3f713d7efc Adds `MockWormhole` contract for unit tests.
Also adds a `WormholeSimulator` interface for signing and non-signing
mocks. The signing mock can be useful when writing a test for a
specific testnet fork with a real wormhole deployment. In the unit tests,
only the non signing mock is used.
2023-02-21 12:43:33 -03:00
derpy-duck 45021b4691 forge fmt 2023-02-21 10:43:13 -05:00
derpy-duck a7bda1a057 Nice specs for IWormholeRelayer 2023-02-21 10:43:13 -05:00
Sebastián Claudio Nale 1cae1ba324 Fixes relayer reward to take into account forward publish fee. 2023-02-17 19:57:28 -03:00
Sebastián Claudio Nale 0b10f9e2a5 Puts enum type in the `Delivery` event. 2023-02-17 19:54:26 -03:00
Sebastián Claudio Nale f7174f2084 Adds named parameters to `Delivery` events. 2023-02-17 19:54:26 -03:00
Sebastián Claudio Nale eced885877 `forge fmt` run. 2023-02-17 19:54:26 -03:00
Sebastián Claudio Nale a41490cc38 Uses `abi.encodeCall` to typecheck some encoded calls. 2023-02-17 19:54:26 -03:00
Sebastián Claudio Nale f9662f12c8 Uses named parameters in the creation of several structs in unit tests. 2023-02-17 19:54:26 -03:00
derpy-duck 047fdb1abc
Dont relay not sufficiently funded (#95)
* Add fix to relayer engine not relaying not sufficiently funded messages. But Incomplete test; how to eventually relay these!

* comment out part of test that doesn't work

* Log info that the delivery instruction is not sufficiently funded
2023-02-17 15:05:42 -05:00
derpy-duck d335a35abd redelivery test passing 2023-02-14 14:08:21 -05:00
derpy-duck 01350a5da1 Fix multiforward test 2023-02-14 14:08:21 -05:00
derpy-duck 30c8d162e3 changes to get typescript test to work 2023-02-14 14:08:21 -05:00
derpy-duck 785ba82080 Revert "Adds `memory-safe` tag to assembly sections in `BytesLib`."
This reverts commit 2cbbf25d74.
2023-02-14 14:08:21 -05:00