Commit Graph

165 Commits

Author SHA1 Message Date
derpy-duck b803184a8d forge fmt 2023-02-14 14:08:21 -05:00
derpy-duck 46d276e37e Rebase completed! 2023-02-14 14:08:21 -05:00
derpy-duck f0c610c237 multifoward test 2023-02-14 14:08:21 -05:00
derpy-duck f5c1fe3a7b Multidelivery, forwarding tests work + Relayer engine fix! 2023-02-14 14:08:21 -05:00
derpy-duck 249145af86 Forwarding test passes! 2023-02-14 14:08:21 -05:00
derpy-duck 1401c88038 forge fmt 2023-02-14 14:08:21 -05:00
derpy-duck ae5e23cd67 Fix typescript types pt 2 2023-02-14 14:08:21 -05:00
derpy-duck 7d9012660e Remove overload in MockRelayerIntegration 2023-02-14 14:08:21 -05:00
derpy-duck 69b476646d fix typescript errors pt 1 2023-02-14 14:08:21 -05:00
derpy-duck d157e1fe0f New MockRelayerIntegration contract, and modified forge tests to still pass! (literal hours of debugging :'( ) 2023-02-14 14:08:21 -05:00
scnale 0f7c0a0c69 Negative test for a reentrant attack on the core relayer forward mechanism (#83)
* Modifies the relayer simulation to be easier to use in negative tests.

* Adds negative test for a reentrancy attack on the forward mechanism.

* `forge fmt` run.
2023-02-14 14:08:21 -05:00
Sebastián Claudio Nale ca71dcbfee Filter EVM logs in unit tests to just wormhole publish message logs. 2023-02-14 14:08:21 -05:00
Sebastián Claudio Nale 302a0e07fe 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.
2023-02-14 14:08:21 -05:00
derpy-duck 991e88eac2 Bugfixes 2023-02-14 14:08:21 -05:00
derpy-duck 0998f557da Remove duplicate test 2023-02-14 14:08:21 -05:00
derpy-duck 4e05c4a007 work in progress for editing mockrelayintegration 2023-02-14 14:08:21 -05:00
derpy-duck 59f1f4439f Real integration test :) 2023-02-14 14:08:21 -05:00
Joe Howarth dee6ba7081 improve message test 2023-02-14 14:08:21 -05:00
Joe Howarth 09ba7ea340 undo fmt 2023-02-14 14:08:21 -05:00
Joe Howarth 9bfee08792 update ts-test 2023-02-14 14:08:21 -05:00
derpy-duck 0e9a3ad98e Fix some bugs in 2_core_relayer 2023-02-14 14:08:21 -05:00
derpy-duck df7a065d7f Use sendMessage of mockRelayerIntegration 2023-02-14 14:08:21 -05:00
derpy-duck 7ec66047b3 typescript test 2023-02-14 14:08:21 -05:00
derpy-duck 58f34e0805 First relayprovider typescript test 2023-02-14 14:08:21 -05:00
derpy-duck d434221240
Install with forge not npm (#84)
* forge install: openzeppelin-contracts

v4.8.1

* Using openzeppelin from forge, not npm

* Keep original import

* Remove undesired changes

* add back a @

* makefile changes

* makefile changes

* Remove .gitmodules

* Remove submodule

* remove defaultSettings

* removed submodule openzeppelin

* original package-lock

* uninstall @openzeppelin

* remove truffle-config + two outdated READMEs

* Trying to remove solc

* Revert "Trying to remove solc"

This reverts commit 4debc9d127.

* Trying to remove solc
2023-02-14 10:42:04 -05:00
derpy-duck ba8a09d6f7
save target address in state and use it to verify forwarding request (#75)
* save target address in state and use it to verify forwarding request

* Fix to Multideliveries/Multiforwards

* complete merge
2023-02-14 10:33:55 -05:00
derpy-duck fa2018cd0e Fix type in redeliveryTest.ts 2023-02-13 17:13:42 -05:00
derpy-duck 4b420f66ed Run typechain 2023-02-13 17:13:42 -05:00
derpy-duck e8637b2b01 Remove unused error messages 2023-02-13 17:13:42 -05:00
derpy-duck e22c98d028 forge fmt 2023-02-13 17:13:42 -05:00
derpy-duck b8db370dde Forge tests pass! 2023-02-13 17:13:42 -05:00
derpy-duck 346df2e017 Most forge tests pass 2023-02-13 17:13:42 -05:00
derpy-duck 1f69c238d7 forge builds! 2023-02-13 17:13:42 -05:00
chase-45 67ff0b3baa interface refinement 2023-02-13 17:13:42 -05:00
Joe Howarth 3c2f114801 remove contracts.json 2023-02-09 15:48:57 -07:00
Joe Howarth ecae2090dc update package-lock.json 2023-02-09 15:48:57 -07:00
derpy-duck e3c4ea0088
Add error messages to interface (#80)
* Add error messages to interface

* Make getDefaultRelayProvider view
2023-02-07 16:43:32 -05:00
derpy-duck d59bd6d82a
Remove provider from requestMultiforward interface (#78) 2023-02-06 12:27:05 -05:00
Sebastián Claudio Nale e1b57fb4df Avoids double read on the same storage slot. 2023-02-02 17:26:23 -07:00
Joe Howarth 813c2181ad save 2023-02-01 12:18:56 -07:00
Joe Howarth 935a6732c1 Test redelivery 2023-02-01 12:18:56 -07:00
derpy-duck fc06699266
subtract by the overhead from running gasleft() (#74)
* subtract by the overhead from running gasleft()

* Rename variable

* forge fmt

* Clamp to the upper gas limit

* Forge fmt

* Update ethereum/contracts/coreRelayer/CoreRelayer.sol

Co-authored-by: scnale <sebinale@gmail.com>

---------

Co-authored-by: scnale <sebinale@gmail.com>
2023-02-01 13:20:39 -05:00
derpy-duck 20bb4c7f8e
Think about upper limits (#68)
* Change arbitrary contraints

* higher limit asset conversion buffer

* Remove unnecessary constraints on tests, and impose lighter constraints

* Forge fmt

* change to power of 2, and remove fuzz=25 limit

* set deliver gas overhead nonzero (#71)

* Fix previous redelivery tests to test emitting of InvalidRedelivery r… (#69)

* Fix previous redelivery tests to test emitting of InvalidRedelivery rather than the old reverting

* remove extraneous comment

* forge fmt

* Actually fix contracts to work for 2^256
2023-01-31 16:23:58 -05:00
Sebastián Claudio Nale 89c83235c5 Removes `truffle compile` and npm clean install for wormhole dependency.
This speeds up the CI pipeline considerably.
2023-01-31 12:07:30 -07:00
derpy-duck f96902d430
No forwards are allowed from addresses that aren't the targetAddress (#70) 2023-01-30 17:30:22 -05:00
Joe Howarth 48defa84a0 fix up ICoreRelayer 2023-01-29 14:46:35 -05:00
chase-45 312df2d862 redelivery draft 2023-01-29 14:46:35 -05:00
Sebastián Claudio Nale c5a4a6c89d Adds some debugging symbols and metadata for contracts in foundry.toml 2023-01-27 18:51:26 -07:00
Joe Howarth b0644fa083 improve message test again 2023-01-27 15:01:50 -07:00
Joe Howarth 68f23a373e set buffer and denom in configureRelayProvider 2023-01-27 15:01:50 -07:00
Joe Howarth 0095681f02 save 2023-01-27 15:01:50 -07:00
Joe Howarth 0682d34d47 Deployment 2/26 2023-01-27 15:01:50 -07:00
chase-45 6cf8f489c2 contract status scripts 2023-01-27 15:01:50 -07:00
derpy-duck 8b0a776946
Remove wormhole fee from delivery/redelivery quote (#63)
* merge

* Forge fmt
2023-01-26 17:08:42 -05:00
derpy-duck 673542854d
Redelivery fixes (#61)
* smart contract changes for redelivery

* Tests pass for new Redelivery interface

* remove console logs

* forge fmt

* forwarding interface fix

* Remove the rolloverChain parameter from requestForward

Co-authored-by: chase-45 <chasemoran45@gmail.com>
2023-01-26 15:10:44 -05:00
derpy-duck 5a3ff82c43
Application Budget Bugfixes (#60)
* Application Budget Fixes and Tests

* Adding application budget to redelivery test

* Application Budget Test with Redelivery Works

* remove console log import

* Remove console logs from tests

* Remove console logs from mockrelayerintegration

* Use uint32.max and fix outOfFund error in tests

* Removed unnecessary require
2023-01-26 14:27:57 -05:00
Sebastián Nale 7cd5b5871b Fixes typo in comment. 2023-01-24 21:30:21 -03:00
Sebastián Nale 03f8928c0d Documents RelayProviderState. 2023-01-24 21:30:21 -03:00
derpy-duck 546fc1969e
Save Gas: Remove Relay Protection on deliverSingle and redeliverSingle (#45)
* Remove replay protection on deliverSingle and redeliverSingle

* forge fmt

* redelivery fixes, events & relayer refund address

* Got tests passing again (still have to alter a few redelivery tests to validate the new emitted error)

* forge fmt

* Attempt at fixing typescript error

* Forge fmt

* Add indexed

* Fix tests to correctly obtain deliveryVaaHash due to new event structure

* forge fmt

Co-authored-by: chase-45 <chasemoran45@gmail.com>
2023-01-19 14:38:52 -05:00
derpy-duck 1e14fe901f
Change CI Forge Testing Check to run 25 times instead of 256 (#54) 2023-01-19 14:27:39 -05:00
agodnic 87cfc41bf5
Replace strings with typed errors (#37)
* Replace strings with typed errors

Replace strings with typed errors in `ethereum/contracts/relayProvider/*.sol`.

* Rename misleading identifier

* Update forge assertions to use typed errors

Update RelayProvider unit tests to use typed errors.

* Replace strings with typed errors

Replace strings with typed errors in `ethereum/contracts/coreRelayer/*.sol`.

* Update forge assertions to use typed errors

Update CoreRelayer unit tests to use typed errors.

* `forge fmt`
2023-01-19 09:59:35 -05:00
derpy-duck 9d51fd54ae
Fix bug related to refunding of application budget if delivery fails (#42)
* Fix bug related to refunding of application budget if delivery doesn't succeed

* forge fmt

* Fix some yul error

* forge fmt
2023-01-18 21:35:52 -05:00
derpy-duck 177862cd78
Allow governance to update asset conversion buffer, and also remove t… (#44)
* Allow governance to update asset conversion buffer, and also remove the dependency on source chain for asset conversion buffer

* forge fmt
2023-01-18 18:51:06 -05:00
Joe Howarth d49fcb128e fix configure relay provider 2023-01-18 13:28:53 -07:00
Joe Howarth 4cdeca0d34 improve deployment 2023-01-18 13:28:53 -07:00
derpy-duck 9e3453709f forge fmt 2023-01-18 13:05:33 -07:00
derpy-duck 04999b89eb fix typecheck errors 2023-01-18 13:05:33 -07:00
Joe Howarth da21f00fbb update script 2023-01-17 15:19:08 -07:00
Joe Howarth 4443138296 improve contract deployment infra for bsc and polygon t
estnet deploys
2023-01-17 15:19:08 -07:00
Sebastián Claudio Nale a7fb5b46e9 Adds `skipLibCheck: true` to ethereum tsconfig. 2023-01-17 15:11:41 -07:00
Sebastián Claudio Nale 740a77d26c Adds some more granularity to `make build` rule in `ethereum`.
This allows using the checkout action in the CI workflow.
2023-01-17 15:11:41 -07:00
Sebastián Claudio Nale ef844a465f Ensures test build and common build are the same.
This avoids unnecessary recompilation in CI pipeline.
2023-01-17 15:11:41 -07:00
Sebastián Claudio Nale 75f3a1a7a3 Github actions workflow that tests and typechecks. 2023-01-17 15:11:41 -07:00
Agustin Godnic 0df6c6fbf0 Fix typo in `ethereum/Makefile`
Ran into this while compiling the project from scratch.
2023-01-17 15:11:41 -07:00
Joe Howarth ee829d12bf First k8s deployment 2023-01-17 11:02:12 -07:00
scnale 4a57a6c371
Replaces "bare" with named parameters in struct constructor calls. (#35) 2023-01-13 15:27:59 -05:00
derpy-duck f8a75595b8
Forward should be payable right? (#38)
* Forward should be payable right?

* fix spacing
2023-01-13 15:26:20 -05:00
derpy-duck 53d67259f8
Remove wormhole message fee from calculateTargetGasDeliveryAmount (#41) 2023-01-13 15:26:04 -05:00
derpy-duck 034a7dd831
Deliver single and request delivery forge tests (#36)
* Tests for 7 errors messages in deliverSingle and 3 error meessages n requestDelivery

* Update forge tests to use new CoreRelayer governance

* Remove console.sol import

* Remove console logs

* Changing limit from 2^62-1 to 2^63-1

* Testing changing wormhole fees for all current tests

* Run forge fmt, remove [fuzz] params

* remove whitespace
2023-01-11 14:11:43 -05:00
Joe Howarth 121ad6d84b test against testnet 2023-01-11 11:38:45 -07:00
Joe Howarth 0e2e6dc7f2 commit testnet contract addresses 2023-01-09 14:50:44 -07:00
Joe Howarth cef9610d8c Fix deployment scripts to work against testnet 2023-01-09 14:50:44 -07:00
Joe Howarth cd1f2fce37 testnet config entries 2023-01-09 14:50:44 -07:00
chase-45 12a09d8b24 upgrade script by VAA for core relayer 2023-01-09 14:50:44 -07:00
chase-45 5bd7ba46ab CoreRelayerLibrary for governance + ts scripts for vaa registrations 2023-01-09 14:50:44 -07:00
chase-45 cd26ace599 core relayer contracts upgrade via governance 2023-01-09 14:50:44 -07:00
chase-45 2b511f97c0 Upgrade script for RelayProvider 2023-01-09 14:50:44 -07:00
chase-45 e2dbc6f5f5 README file for ts tooling 2023-01-09 14:50:44 -07:00
chase-45 7005533a23 refactoring & cleanup in ts tooling 2023-01-09 14:50:44 -07:00
chase-45 2dc8d45b95 typescript tooling major refactor 2023-01-09 14:50:44 -07:00
chase-45 d49fec47cc relay provider proxies through itself 2023-01-09 14:50:44 -07:00
scnale c4df1ecbab
Removes redundant abicoder pragmas. (#33)
See https://docs.soliditylang.org/en/latest/080-breaking-changes.html#silent-changes-of-the-semantics
2023-01-09 15:14:40 -05:00
derpy-duck db159946bb Redelivery Error Testing - Errors 1, 9-17 2023-01-06 22:27:03 +00:00
Joe Howarth d9f9dfb173 run forge fmt 2023-01-05 17:46:58 -07:00
derpy-duck a8bccd6753 Start of revert tests 2023-01-05 17:46:25 -07:00
dependabot[bot] c95e4db5ff
build(deps): bump json5 from 1.0.1 to 1.0.2 in /ethereum (#28)
Bumps [json5](https://github.com/json5/json5) from 1.0.1 to 1.0.2.
- [Release notes](https://github.com/json5/json5/releases)
- [Changelog](https://github.com/json5/json5/blob/main/CHANGELOG.md)
- [Commits](https://github.com/json5/json5/compare/v1.0.1...v1.0.2)

---
updated-dependencies:
- dependency-name: json5
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-01-05 18:17:47 -05:00
Joe Howarth ab833b38cf
Move development branch to main (#23)
* refactoring for multidelivery

* partial ts-test fixes

* use typechain in integration tests, update prettier, fix remaining integration tests

* run formatter on solidity files

* gas refunding

* gas forwarding logic

* msg.send -> refundAmount

* minor test refactor & additions

* created relayer engine directory

* more testing & tilt environment config for relayer engine

* starting work on the xMint example contracts

* additions for relayer engine

* minor modifications & todos

* fixed some errors

* refactoring + cleaned up some TODOs

* updated ICoreRelayer interface

* adjusted tests for new interface

* Working testSend

* Merged refactoring + cleaned up some TODOs

* updated ICoreRelayer interface

* adjusted tests for new interface

* Working testSend with new interface'

* refactoring interfaces & files for single VAA design

* GasOracle implementation of new interface

* GasOracle compiles

* Gas oracle upgradable

* Fix compile errors in GasOracleGovernance

* minor core relayer cleanup

* Changes to getters, setters, state

* implement quoteEvmDeliveryPrice, quoteTargetEvmGas, assetConversionAmount for corerelayer

* Correcting interface inconsistencies between CoreRelayerStructs and ICoreRelayer

* Fix encodeDeliveryRequestsContainer

* added single vaa delivery entrypoint logic

* Encode and Decode delivery instructions

* Fixed many compile errors

* First attempt at removing stacktoodeep error

* Commenting out chunks of code to identify stack too deep error

* Continue stack too deep quest

* Revert "Commenting out chunks of code to identify stack too deep error"

This reverts commit 8cd55d26ce.

* Revert "Continue stack too deep quest"

This reverts commit f0cde6871e.

* Fix stack too deep error in CoreRelayerMessages

* tests compile, run, pass

* fixing up fee collection assertions

* GasOracle tests altering

* Rename encodeDeliveryIntructions to convertToEncodedDeliveryInstructions because we are going from delivery request to delivery instruction

* adding evm events to delivery execution

* forwarding refactor for single vaa

* relay provider name refactor

* Test file slight refactor to allow for multiple chains

* first impl of hub and spoke example

* Forward test progress

* Forwarding test passes!

* More general parameters for test

* Testing file more modular, calls 'generic relayer'

* redelivery implementation

* removing todos

* Tests can use arbitrary amount of chains

* Address various TODOs

* refactored RelayProvider to be upgradeable via proxy

* Add overhead inteface to RelayProvider & adjusted necessary fee calculations

* added TODOs related to rewardAddress payout

* provider price quoting changes

* provider payments made at source

* Fixed all compile errors

* testForward and testSend pass again!

* Switched quoteAssetConversion to quoteApplicationBudgetFee in CoreRelayer interface

* First round of changes to support individual vaas in offchain relayer

- Use new custom plugin event source api in relayer engine
- Supports mulit delivery
- Config for celo and fuji

* contracts deploy successfully to tilt

* bug fixes, contracts deploy to tilt

* Starting the redelivery test

* Tests pass again, with exception of the RelayProvider tests that tested reverts, and the new testRedelivery which isn't finished

* small plugin changes

* MockRelayerIntegration is used for sending

* prepare offchain relayer to run in both tilt and testnet

* update readme and npm scripts for offchain relayer

* nit: remove console.log(argv)

* solc version bump

* Tests changed to pass (commented out the tests with differing require statements and kept redelivery incomplete

* chain registration typescript scripts

* Redeliver works!

* Redelivery test works!

* testnet deploy + relayer engine test

* Testing two sends

* Friday changes to round trip on testnet

* Shortening current tests

* Funds are correct! Relayer gets paid!

* Remove extraneous comments

* ts scripts for deployment and config

* Wormhole Fee Test

Co-authored-by: chase-45 <chasemoran45@gmail.com>
Co-authored-by: derpy-duck <115193320+derpy-duck@users.noreply.github.com>
2023-01-05 17:26:27 -05:00
Reptile ddc421bb90
Update comments and interface (#9)
* Update comments and interface

* Remove casting to uint8 in struct definitions

Co-authored-by: gator-boi <gator-boi@users.noreply.github.com>
2022-10-31 14:57:07 -05:00
A5 Pickle 0b9e81ffc5
Clean up send (#2)
* Update README.md with trustlessness

* ethereum: rename AllowedEmitterSequence; remove arbitrary payloads

* ethereum: refactor integrator contract; add verifying payload

* ethereum: update IWormhole

* ethereum: add message verifying in mock integration

* Remove deliveryList from DeliveryInstructions and fix stack too deep

* Remove maximum batch size from relay parameters

* ethereum: fix observation loop; formatting

* sdk: fix eth-integration test

* offchain-relayer: add regenerate-abi.sh

* fix Makefile

* offchain-relayer: add relayer.tilt.yaml

Co-authored-by: Evan Gray <56235822+evan-gray@users.noreply.github.com>
Co-authored-by: A5 Pickle <a5-pickle@users.noreply.github.com>
Co-authored-by: gator-boi <gator-boi@users.noreply.github.com>
2022-10-06 12:16:57 -05:00
Justin Schuldt 86c5f26b54
rm "npm run abigen" from eth/Mathfile (#11) 2022-09-30 13:29:17 -05:00