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

feat: v0.2.0 #37

Merged
merged 341 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
341 commits
Select commit Hold shift + click to select a range
5b113c0
refactor(evm): refactors Wormhole Adapter and adds the Reporter
allemanfredi Jan 24, 2024
05102e8
refactor(evm): refactors ZetaChain Adapter and adds the Reporter
allemanfredi Jan 24, 2024
26e40a6
refactor(evm): refactors PNetwork Adapter and adds the Reporter
allemanfredi Jan 25, 2024
4cdd184
refactor(evm): refactors Sygma Adapter and adds the Reporter
allemanfredi Jan 25, 2024
7db15f0
chore(test): rm AMB, PNetwork and Sygma tests
allemanfredi Jan 25, 2024
665cd46
chore(evm): rm HeaderOracleAdapter, HeaderReporter and MessageRelay
allemanfredi Jan 25, 2024
88a5673
refactor(evm): adds InvalidThreshold instead of returning false withi…
allemanfredi Jan 25, 2024
7fbf93a
refactor(evm): adds unchecked for reducing gas cost within Hashi
allemanfredi Jan 25, 2024
d56c700
feat(evm): adds additional checks to checkHashWithThresholdFromOracles
allemanfredi Jan 25, 2024
3fd0802
refactor(evm): normalizes HeaderStorage
allemanfredi Jan 25, 2024
cd00644
feat(evm): reduce gas cost of _dispatchMessagesToAdapters
allemanfredi Jan 25, 2024
55169ed
refactor(evm): lints HeaderStorage
allemanfredi Jan 25, 2024
4e7dbb6
chore(evm): rm MessageRelay left stuff
allemanfredi Jan 25, 2024
1183fb1
chore(evm): rm IHeaderReporter
allemanfredi Jan 25, 2024
b2d2324
refactor(evm): normalizes interfaces
allemanfredi Jan 25, 2024
41dcf9f
Merge branch feat/v0.2.0 into feat/v0.2.0-adapters
allemanfredi Jan 25, 2024
eebc020
refactor(tasks): rm deploy:HashiModule
allemanfredi Jan 26, 2024
544a7ab
refactor(evm): lints
allemanfredi Jan 26, 2024
8d50124
Merge branch 'feat/v0.2.0' into feat/v0.2.0-adapters
allemanfredi Jan 26, 2024
3c55b2f
chore(evm): rn Reporter test file
allemanfredi Jan 26, 2024
6836e2b
Merge pull request #38 from gnosis/feat/v0.2.0-adapters
allemanfredi Jan 29, 2024
4d17dec
feat(evm): adds IShuSho, IShoyuBashi and IGiriGiriBashi
allemanfredi Jan 29, 2024
8061654
refactor(evm): adds missing comment within Hashi
allemanfredi Jan 29, 2024
933c065
fix(evm): fixes _getThresholdHash when the threshold = 1
allemanfredi Jan 29, 2024
583c762
refactor(evm): aligns ShoyuBashi and GiriGiriBashi tests
allemanfredi Jan 29, 2024
eae01e6
refactor(evm): adds fx description to IReporter
allemanfredi Jan 29, 2024
74fb30b
refactor(evm): lints SygmaAdapter
allemanfredi Jan 29, 2024
e5c7465
Merge branch 'feat/v0.2.0' into ref/ownable
allemanfredi Jan 30, 2024
c1266e2
refactor(evm): refactors HeaderStorage events and errors
allemanfredi Jan 30, 2024
eb65993
fix(evm): rm typo within ShuSo
allemanfredi Jan 30, 2024
8acfa29
Merge pull request #39 from gnosis/ref/ownable
allemanfredi Jan 30, 2024
23bfeb8
chore(test): rm not used test
allemanfredi Jan 30, 2024
da29552
chore(test): rm E2E test
allemanfredi Jan 30, 2024
432f870
refactor(evm): updates solidity version to 0.8.20
allemanfredi Jan 30, 2024
f15c915
fix(evm): fixes OracleAdapter test
allemanfredi Jan 30, 2024
1e4532d
Merge pull request #40 from gnosis/feat/sol-0.8.20
allemanfredi Jan 31, 2024
2303722
refactor(evm): rn OracleAdapter into Adapter
allemanfredi Jan 31, 2024
2973b6e
ref(evm): adds events comments within interfaces
allemanfredi Jan 31, 2024
f6ac538
refactor(evm): mv Domain within IShuSho
allemanfredi Jan 31, 2024
5917ee2
refactor(evm): improves ShuSho & IShuSho
allemanfredi Jan 31, 2024
bd5ed25
refactor(evm): sort alphabetically fxs within the interfaces and rm s…
allemanfredi Jan 31, 2024
ccd5be5
refactor(evm): sort alphabetically fxs within the implementations
allemanfredi Jan 31, 2024
76b69fe
refactor(evm): adds missing // solhint-disable no-empty-blocks
allemanfredi Jan 31, 2024
48fd469
refactor(evm): rn toChainId into targetChainId
allemanfredi Feb 1, 2024
f243ab9
Merge pull request #41 from gnosis/ref/oracle-adapter
allemanfredi Feb 1, 2024
bd6b374
refactor(evm): rn fromChainId into sourceChainId
allemanfredi Feb 1, 2024
0d441d8
refactor(evm): rm empty comment lint
allemanfredi Feb 1, 2024
29c7089
chore(evm): rn 02_OracleAdapter.test.ts into 02_Adapter.test.ts and r…
allemanfredi Feb 6, 2024
bff9b15
refactor(evm): rm left ref to zodiac
allemanfredi Feb 7, 2024
1b1dd89
refactor(contracts & test): rm salt and adds nonce
allemanfredi Feb 12, 2024
d6db43b
Merge pull request #43 from gnosis/ref/message-id
allemanfredi Feb 12, 2024
b1cbf25
fix(contracts & test): fixes relying the same message more than once
allemanfredi Feb 12, 2024
e74cc40
Merge pull request #44 from gnosis/fix/double-message-id-relay-messag…
allemanfredi Feb 13, 2024
d27848b
refactor(tasks): improves logs
allemanfredi Feb 13, 2024
fcaa91a
fix(contracts & test): adds missing onlyOwner and fixes a test
allemanfredi Feb 13, 2024
aec6df9
feat(contracts): improves checkHashWithThresholdFromAdapters & _getTh…
allemanfredi Feb 19, 2024
3b7d3ea
feat(contracts): adds domain to settings
allemanfredi Feb 19, 2024
aafcd2e
refactor(contracts): rn uint into uint256
allemanfredi Feb 19, 2024
3557312
refactor(contracts): changes settings mapping
allemanfredi Feb 19, 2024
5d1d3c0
fix(contracts): adds a check to prevent using the same adapters + ord…
allemanfredi Feb 19, 2024
35c53d9
refactor(evm): rn InvalidAdapters into AdaptersCannotContainChallenge…
allemanfredi Feb 19, 2024
872589d
feat(test): adds GiriGiriBashi tests
allemanfredi Feb 20, 2024
8c9b8af
feat(contracts): adds notice comment to _setThreshold within ShuSho
allemanfredi Feb 20, 2024
df77641
fix(contracts & test): adds check to prevent settings the threhold le…
allemanfredi Feb 20, 2024
dc56261
fix(contracts & test): fixes declareNoConfidence
allemanfredi Feb 20, 2024
abb2861
fix(contracts & test): adds check to prevent declareNoConfidence when…
allemanfredi Feb 20, 2024
78a27ac
Merge pull request #45 from gnosis/feat/check-hash-with-threshold-fro…
allemanfredi Feb 21, 2024
fa81aaf
Merge branch 'feat/v0.2.0' into fix/giri-giri-bashi
allemanfredi Feb 21, 2024
d140155
ref(contracts): sets solidity version to ^0.8.0 within the interfaces
allemanfredi Feb 21, 2024
d8368cb
ref(contracts & test): adds getter fxs within GiriGiriBashi and ShuSho
allemanfredi Feb 21, 2024
137db9e
Merge branch 'feat/v0.2.0' into fix/giri-giri-bashi
allemanfredi Feb 21, 2024
d1a057d
Merge pull request #46 from gnosis/fix/giri-giri-bashi
allemanfredi Feb 21, 2024
5b4f85f
feat(contracts & test): adds support for zk adapters within Yaho
allemanfredi Feb 23, 2024
0d463dd
refactor(contracts): changes comments
allemanfredi Feb 26, 2024
5fd1077
refactor(evm): rn vars
allemanfredi Feb 26, 2024
2362a45
refactor(contracts & test): rm try catch within checkHashWithThreshol…
allemanfredi Feb 27, 2024
66a5d99
fix(contracts & test): fixes declareNoConfidence for case equalHashes…
allemanfredi Feb 27, 2024
29bac58
refactor(tasks): refactors amb deploy tasks
allemanfredi Mar 8, 2024
d83fd2a
added Router adapter
Shivam78288 Mar 11, 2024
d2ab149
replaced msg.value check with balance of contract for Router Adapter
Shivam78288 Mar 26, 2024
3828575
added pure decorator to iAck function
Shivam78288 Mar 26, 2024
2d80e92
Merge pull request #49 from router-protocol/feat/v0.2.0
allemanfredi Mar 26, 2024
f1a9fdb
chore(task): rm not used task
allemanfredi Mar 26, 2024
b90c787
chore(hardhat.config.js): rm mnemonic and adds pk
allemanfredi Apr 9, 2024
5618f8f
feat(contracts): mv MockAdapter and MockReporter under adapters
allemanfredi Apr 9, 2024
ec49d9a
doc: add audit report
zengzengzenghuy Apr 22, 2024
9965392
chore: move audit report
zengzengzenghuy Apr 22, 2024
576b321
Merge pull request #52 from gnosis/doc/audit
allemanfredi Apr 22, 2024
b5b66ee
chore(audits): <- mv them into the root of the repo
allemanfredi Apr 22, 2024
e2f138c
refactor(contracts & tasks): formats
allemanfredi Apr 23, 2024
6d57268
Merge pull request #47 from gnosis/feat/yaho-zk-adapters
allemanfredi Apr 23, 2024
1424b73
feat(contracts): adds verifyAndStoreDispatchedMessage within DendrETH…
allemanfredi Apr 23, 2024
6f0cf57
refactor(contracts): adds MESSAGE_DISPATCHED_EVENT_SIG real value
allemanfredi Apr 23, 2024
6833c23
chore(hardhat.config.js): adds support to chiado for verifying contracts
allemanfredi Apr 24, 2024
e9c9ee5
Merge branch 'feat/v0.2.0' into feat/dendreth-verify-message
allemanfredi Apr 24, 2024
0dfcef5
chore(global): changes workspaces settings
allemanfredi Apr 29, 2024
7ca2c3b
Merge pull request #54 from gnosis/chore/workspaces
allemanfredi Apr 29, 2024
66708ab
feat(common): <- starts adding these
allemanfredi Apr 30, 2024
e771a37
chore(global): adds .nvmrc
allemanfredi Apr 30, 2024
b71bec4
feat(relayer): <- starts adding this
allemanfredi Apr 30, 2024
b68f306
feat(common): changes tsconfig.json conf and adds Message
allemanfredi Apr 30, 2024
36469bb
feat(relayer): adds Watcher
allemanfredi Apr 30, 2024
b6d92eb
refactor(relayer): rn ListenerConfigs into WatcherConfigs
allemanfredi Apr 30, 2024
15d5136
refactor(relayer): rn listen into watch and rn startWatching into start
allemanfredi Apr 30, 2024
648b1f5
refactor(common): makes threshold and targetChainId integers within M…
allemanfredi Apr 30, 2024
b7fc364
feat(relayer): adds timestamp within messages
allemanfredi Apr 30, 2024
c0cc299
feat(relayer): add Batcher
allemanfredi Apr 30, 2024
ec16d1c
refactor(relayer): improves logs
allemanfredi May 1, 2024
8698e35
chore(relayer): rm docker stuff
allemanfredi May 1, 2024
9837c69
refactor(common & relayer): mv Watcher and yahoAbi within common
allemanfredi May 1, 2024
abd36be
refactor(relayer): adds dispatch tx hash, rm timestamp and rn message…
allemanfredi May 1, 2024
57dd60b
refactor(common): mv Batcher within common, adds Yaru and makes servi…
allemanfredi May 1, 2024
3003a77
refactor(relayer): changes it based on new Batcher design
allemanfredi May 1, 2024
acc3cb5
refactor(relayer): formats and changes comment
allemanfredi May 1, 2024
b83e084
feat(executor): <- adds first implementation of this
allemanfredi May 1, 2024
3ebce36
refactor(executor): changes comment
allemanfredi May 1, 2024
f4ac4d4
feat(common & relayer): rm values from Batcher.onResult
allemanfredi May 2, 2024
f91388a
feat(executor): adds check to prevent to send messages that revert
allemanfredi May 2, 2024
1efb436
fix(executor): mv message filtering within onGetValues to not send ba…
allemanfredi May 2, 2024
5a5699e
feat(executor): adds BLOCKS_WINDOW
allemanfredi May 2, 2024
def3b33
refactor(relayer): rn BLOCKS_RANGE into BLOCKS_WINDOW
allemanfredi May 2, 2024
f83ea5e
refactor(executor & relayer): changes how dotenv is used to support .…
allemanfredi May 2, 2024
5895106
chore(executor & relayer): updates README files
allemanfredi May 2, 2024
15afa62
chore(executor & relayer): adds missing instruction within README
allemanfredi May 3, 2024
d08cd02
refactor(hardhat.config.js): <- refactor this
allemanfredi May 6, 2024
ead7541
refactor(tasks): refactors l0 adpter/reporter deployment tasks
allemanfredi May 6, 2024
001adf7
refactor(tasks): refactors sygma adpter/reporter deployment tasks
allemanfredi May 6, 2024
9541ec9
Merge branch 'feat/v0.2.0' into feat/relayer
allemanfredi May 6, 2024
5078066
fix(relayer): rm configDotenv
allemanfredi May 6, 2024
1e146b0
feat(contracts): adds fee within LayerZeroReporter
allemanfredi May 6, 2024
633a44e
feat(relayer): adds possibility to filter messages based on msg.sender
allemanfredi May 7, 2024
f6cf9ea
fix(executor): adds chainId within executedMessage selection
allemanfredi May 7, 2024
d3070ec
fix(relayer): adds ? to prevent crashing when whitelistedSenderAddres…
allemanfredi May 7, 2024
914a6f1
Merge pull request #55 from gnosis/feat/relayer
allemanfredi May 9, 2024
4df20f5
feat(evm): creates debridge reporter & adapter
allemanfredi May 9, 2024
ccc83d1
refactor(evm): rn _deBridgeGate into deBridgeGate_
allemanfredi May 9, 2024
2380b6b
feat(evm): adds debridge reporter & adapter deployment tasks
allemanfredi May 9, 2024
e2f46eb
feat(evm): adds fee within CCIPReporter
allemanfredi May 14, 2024
6f5bf9e
feat(common & relayer): adds check to prevent relaying messages alrea…
allemanfredi May 16, 2024
6c36609
refactor(evm): adds SOURCE_CHAIN_ID and rn vars within DendrETHAdapter
allemanfredi Jun 8, 2024
7883414
fix(evm): rn DuplicateThreashold into DuplicateThreshold
allemanfredi Jun 8, 2024
3b66a14
refactor(evm): rm duplicated code within Hashi
allemanfredi Jun 8, 2024
cb80a56
refactor(evm): rm _resetPendingMessageHashesByMessageIds within Yaho
allemanfredi Jun 8, 2024
4832974
chore(evm): rm GiriGiriBashi
allemanfredi Jun 10, 2024
b944a07
chore(evm): rn tests
allemanfredi Jun 10, 2024
ab67976
refactor(evm): rm _setDomainThreshold from ShuSho
allemanfredi Jun 10, 2024
1074307
feat(evm): adds threshold and adapters to onMessage
allemanfredi Jun 13, 2024
b35e7bb
refactor(evm): updates PingPong.onMessage
allemanfredi Jun 13, 2024
760524b
Merge pull request #62 from gnosis/feat/add-threshold-and-adapters-to…
allemanfredi Jun 18, 2024
08f762e
chore(evm): reorgs dependencies and devDependencies
allemanfredi Jun 18, 2024
382ea41
refactor(evm): marks getAdapterLink and getDomain as external
allemanfredi Jun 18, 2024
921ac41
feat(evm): adds threshold to enableAdapters to avoid multiple hashes …
allemanfredi Jun 19, 2024
f64d173
refactor(evm): rm setHashi from ShuSo
allemanfredi Jun 19, 2024
efd21e8
refactor(evm): rn a couple of comments and tests
allemanfredi Jun 19, 2024
e3fe9cf
refactor(evm): adds ccia within Made with comment
allemanfredi Jun 24, 2024
0976475
chore(README): <- rm GiriGiriBashi
allemanfredi Jun 24, 2024
6f140ec
feat(ownable): adds the emission of event ThresholdSet within _enable…
allemanfredi Jul 8, 2024
ba754ea
chore: merge from feat/v0.2.0
zengzengzenghuy Jul 10, 2024
b1a3639
WIP: fix controllers to comply with hashi v0.2.0
zengzengzenghuy Jul 10, 2024
782cf3e
WIP: update StandardReporterController
zengzengzenghuy Jul 10, 2024
22e1961
WIP: fix ElectronController type and add AMB for Sepolia and Chiado
zengzengzenghuy Jul 11, 2024
a0a9abd
feat: CCIP Reporter controller
zengzengzenghuy Jul 11, 2024
adbf1ee
chore: change AMB controller into Standard controller
zengzengzenghuy Jul 11, 2024
f5d5e83
WIP: update LayerZero adapter to LZ v2 & fix controller config
zengzengzenghuy Jul 12, 2024
f215268
fix: LayerZeroV2 Reporter & Adapter
zengzengzenghuy Jul 15, 2024
cb557de
feat: add Base config to LayerZero controller
zengzengzenghuy Jul 15, 2024
da427a4
chore: update tsconfig.json and Dockerfile
zengzengzenghuy Jul 15, 2024
b7177be
chore: add configuration logs in Controller class
zengzengzenghuy Jul 15, 2024
aac37d5
update .env.example
zengzengzenghuy Jul 15, 2024
1aeff54
fix: typo and .env.example
zengzengzenghuy Jul 18, 2024
fc6f62d
feat(reporter): update Wormhole Reporter syntax and address
zengzengzenghuy Jul 26, 2024
10a88b5
chore(evm): update Wormhole deploy task
zengzengzenghuy Jul 26, 2024
ea3bd02
misc(relayer): update .env.example
zengzengzenghuy Jul 26, 2024
77e0275
chore(reporter): update AMB reporter variable name
zengzengzenghuy Jul 26, 2024
99a6a2a
feat(reporter): add Base related addresses
zengzengzenghuy Jul 29, 2024
447abf7
feat(evm): add Arb Header Storage.sol
zengzengzenghuy Jul 31, 2024
9760272
Merge branch 'feat/v0.2.0' into feat/dendreth-verify-message
allemanfredi Aug 20, 2024
ed2e40b
feat(contracts): implement Spectre adapter push flow
mpetrun5 Aug 22, 2024
09a66b0
refactor(evm): refactors Merkle
allemanfredi Aug 22, 2024
c668622
fix(evm): fixes dendreth deployment task
allemanfredi Aug 22, 2024
129fd8b
refactor(evm): rm part of a comment
allemanfredi Aug 22, 2024
7e8179f
Merge pull request #53 from gnosis/feat/dendreth-verify-message
allemanfredi Aug 22, 2024
c6558b2
feat: dockerfile and docker compose for executor and relayer
zengzengzenghuy Aug 25, 2024
926ef27
fix: docker-compose format error
zengzengzenghuy Aug 25, 2024
b1517a2
fix: Executor messageIds type & relayer start script
zengzengzenghuy Aug 30, 2024
2797d11
add Hyperbridge adapter & reporter
seunlanlege Sep 12, 2024
fc9f2e1
remove todos
seunlanlege Sep 12, 2024
de789a1
fix setReporterByChain & comment
seunlanlege Sep 12, 2024
50cb8e2
feat(chore): add deployment task
seunlanlege Sep 13, 2024
10f1856
chore(reporter): update reporters and adapters configs
zengzengzenghuy Sep 13, 2024
60e9359
feat(chore): bump ismp-solidity sdk
seunlanlege Sep 14, 2024
943ae5f
chore: remove unused ABI files
zengzengzenghuy Sep 16, 2024
15a8f46
feat(chore): deploy hyperbridge adapters
seunlanlege Sep 16, 2024
cc5649c
feat(chore): rm new line
seunlanlege Sep 16, 2024
705b8df
Merge pull request #65 from polytope-labs/feat/v0.2.0
allemanfredi Sep 16, 2024
9b895cd
refactor(evm): sorts imported contracts within HyperbridgeReporter an…
allemanfredi Sep 16, 2024
9d0ab4a
chore(global): rm packageManager within evm and sdk and adds it withi…
allemanfredi Sep 16, 2024
12c25cb
Merge pull request #63 from zengzengzenghuy/feat/v0.2.0-ArbReporter
allemanfredi Sep 18, 2024
5d114a8
refactor(evm): adds ARB_SYS constant within ArbHeaderStorage
allemanfredi Sep 18, 2024
c9c300a
Merge pull request #59 from gnosis/feat/debridge-adapter-and-reporter
allemanfredi Sep 18, 2024
0e86e03
chore(reporter): remove redundant addresses in .env.example
zengzengzenghuy Sep 18, 2024
19b0666
chore(evm): rename LayerZeroAdapter.sol enabledReporters mapping
zengzengzenghuy Sep 18, 2024
5e9b58a
chore(reporter): remove SygmaReporterController class
zengzengzenghuy Sep 18, 2024
00e2b98
Merge branch 'feat/v0.2.0' into feat/reporter
allemanfredi Sep 18, 2024
7d03cc0
chore(reporter): delete files unrelated to Hashi v0.2.0
zengzengzenghuy Sep 19, 2024
56bb792
fix(reporter): wormhole reporter ABI file name
zengzengzenghuy Sep 19, 2024
a90cde0
chore(reporter): remove yarn.lock
zengzengzenghuy Sep 19, 2024
681a16f
refactor(reporter,relayer,executor): dockerfile and docker-compose.ym…
zengzengzenghuy Sep 20, 2024
77ff55c
chore(reporter): <- makes it to be part of the workspaces
allemanfredi Sep 20, 2024
c57a4ee
fix(reporter): adds nonce within simulateContract to avoid to generat…
allemanfredi Sep 20, 2024
e43d664
refactor(reporter): update dockerfile and tsconfig.json
zengzengzenghuy Sep 20, 2024
93f96f5
chore: rename image names in docker-compose.yml
zengzengzenghuy Sep 20, 2024
3c0f4f3
docs: update README
zengzengzenghuy Sep 23, 2024
d21c428
chore: delete docker-compose-reporter.yml and merge the code into doc…
zengzengzenghuy Sep 23, 2024
d464ceb
docs: update README
zengzengzenghuy Sep 23, 2024
550f4ba
docs: remove unrelated code in README
zengzengzenghuy Sep 23, 2024
5479b75
Merge pull request #66 from gnosis/feat/reporter
allemanfredi Sep 23, 2024
91b38e0
docs: update readme
zengzengzenghuy Sep 24, 2024
eeb5cb2
Merge pull request #64 from sygmaprotocol/feat/spectre-adapter
allemanfredi Sep 24, 2024
b4d322f
docs: update README
zengzengzenghuy Sep 24, 2024
001f5cd
Merge branch 'feat/v0.2.0' into docs/README
zengzengzenghuy Sep 24, 2024
1058abf
refactor(evm): rm some warnings within LayerZeroAdapter
allemanfredi Sep 24, 2024
4779141
chore(evm): rm not used deps and add new ones needed
allemanfredi Sep 24, 2024
76bd974
chore(global): rm patch-package
allemanfredi Sep 24, 2024
94810c9
chore(evm): bumps version to 0.2.0
allemanfredi Sep 24, 2024
b8bc96e
chore(global): bumps node version to 22
allemanfredi Sep 25, 2024
71d4a2d
fix(reporter): fixes Coordinator imports
allemanfredi Sep 25, 2024
83da4d2
Merge pull request #68 from gnosis/chore/node-22
allemanfredi Sep 25, 2024
6e13d42
feat(evm): adds HashiProver
allemanfredi Sep 25, 2024
d34e8c4
fix(common): fixes logger when service is undefined
allemanfredi Sep 25, 2024
1e3258b
feat(rpc): <- adds first implementation of this
allemanfredi Sep 25, 2024
5392ed2
feat(evm): merges AccountProof and StorageProof into Proof
allemanfredi Sep 27, 2024
438191c
feat(rpc): adds integration of ancestralBlockNumber
allemanfredi Sep 27, 2024
d88c81c
refactor(evm): adds BlockHeaderNotFound within _checkBlockHeaderAgain…
allemanfredi Sep 27, 2024
6669748
Merge branch 'feat/v0.2.0' into docs/README
allemanfredi Sep 27, 2024
392880b
chore(global): <- updates README
allemanfredi Sep 27, 2024
96a1779
Merge branch 'feat/v0.2.0' into docs/README
allemanfredi Sep 27, 2024
a4646a1
Merge pull request #67 from gnosis/docs/README
allemanfredi Sep 27, 2024
4875759
Merge branch 'feat/v0.2.0' into feat/hashi-prover
allemanfredi Sep 27, 2024
2c0a882
refactor(evm): rm check on the number of block header fields within p…
allemanfredi Sep 27, 2024
e1f62c9
refactor(evm): rn _verifyAccountAndStorageProof into verifyForeignSto…
allemanfredi Sep 30, 2024
0a2de9c
feat(rpc): adds support for more chains
allemanfredi Oct 1, 2024
75a82bd
feat(evm): adds rlp decoding within _verifyStorageProof and updates t…
allemanfredi Oct 1, 2024
c6db7b6
Merge pull request #70 from gnosis/fix/prove-ancestral-block-hashes
allemanfredi Oct 1, 2024
5671b31
Merge branch 'feat/v0.2.0' into feat/hashi-prover
allemanfredi Oct 1, 2024
ca95bfd
Merge pull request #69 from gnosis/feat/hashi-prover
allemanfredi Oct 1, 2024
16932b9
feat(rpc): adds Dockerfile
allemanfredi Oct 1, 2024
c6d296a
feat(rpc): adds README.md
allemanfredi Oct 1, 2024
e871dc2
Update README.md
bertani Oct 1, 2024
8102f2b
chore(root): updates hashi.png
allemanfredi Oct 1, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
114 changes: 75 additions & 39 deletions packages/evm/contracts/Hashi.sol
Original file line number Diff line number Diff line change
Expand Up @@ -34,61 +34,97 @@
pragma solidity ^0.8.17;
allemanfredi marked this conversation as resolved.
Show resolved Hide resolved

import { IOracleAdapter } from "./interfaces/IOracleAdapter.sol";
import { IHashi } from "./interfaces/IHashi.sol";

contract Hashi {
error NoOracleAdaptersGiven(address emitter);
error OracleDidNotReport(address emitter, IOracleAdapter oracleAdapter);
error OraclesDisagree(address emitter, IOracleAdapter oracleOne, IOracleAdapter oracleTwo);

/// @dev Returns the hash reported by a given oracle for a given ID.
/// @param oracleAdapter Address of the oracle adapter to query.
/// @param domain Id of the domain to query.
/// @param id ID for which to return a hash.
/// @return hash Hash reported by the given oracle adapter for the given ID number.
function getHashFromOracle(
IOracleAdapter oracleAdapter,
contract Hashi is IHashi {
/// @inheritdoc IHashi
function checkHashWithThresholdFromOracles(
uint256 domain,
uint256 id
) public view returns (bytes32 hash) {
hash = oracleAdapter.getHashFromOracle(domain, id);
uint256 id,
uint256 threshold,
IOracleAdapter[] calldata oracleAdapters
) external view returns (bool) {
if (oracleAdapters.length == 0) revert NoOracleAdaptersGiven();
if (threshold > oracleAdapters.length || threshold == 0)
revert InvalidThreshold(threshold, oracleAdapters.length);

bytes32[] memory hashes = new bytes32[](oracleAdapters.length);
for (uint256 i = 0; i < oracleAdapters.length; ) {
try oracleAdapters[i].getHashFromOracle(domain, id) returns (bytes32 hash) {
hashes[i] = hash;
} catch {}
unchecked {
++i;
}
}

for (uint256 i = 0; i < hashes.length; ) {
bytes32 baseHash = hashes[i];
if (baseHash == bytes32(0)) {
unchecked {
++i;
}
continue;
}

uint256 num = 0;
for (uint256 j = 0; j < hashes.length; ) {
if (baseHash == hashes[j]) {
unchecked {
++num;
}
if (num == threshold) return true;
allemanfredi marked this conversation as resolved.
Show resolved Hide resolved
}
unchecked {
++j;
}
}

unchecked {
++i;
}
}
return false;
}

/// @dev Returns the hash for a given ID reported by a given set of oracles.
/// @param oracleAdapters Array of address for the oracle adapters to query.
/// @param domain ID of the domain to query.
/// @param id ID for which to return hashs.
/// @return hashes Array of hash reported by the given oracle adapters for the given ID.
/// @inheritdoc IHashi
function getHashFromOracle(uint256 domain, uint256 id, IOracleAdapter oracleAdapter) public view returns (bytes32) {
return oracleAdapter.getHashFromOracle(domain, id);
}

/// @inheritdoc IHashi
function getHashesFromOracles(
IOracleAdapter[] memory oracleAdapters,
uint256 domain,
uint256 id
uint256 id,
IOracleAdapter[] calldata oracleAdapters
) public view returns (bytes32[] memory) {
if (oracleAdapters.length == 0) revert NoOracleAdaptersGiven(address(this));
if (oracleAdapters.length == 0) revert NoOracleAdaptersGiven();
bytes32[] memory hashes = new bytes32[](oracleAdapters.length);
for (uint256 i = 0; i < oracleAdapters.length; i++) {
hashes[i] = getHashFromOracle(oracleAdapters[i], domain, id);
for (uint256 i = 0; i < oracleAdapters.length; ) {
hashes[i] = getHashFromOracle(domain, id, oracleAdapters[i]);
unchecked {
++i;
}
}
return hashes;
}

/// @dev Returns the hash unanimously agreed upon by a given set of oracles.
/// @param domain ID of the domain to query.
/// @param id ID for which to return hash.
/// @param oracleAdapters Array of address for the oracle adapters to query.
/// @return hash Hash agreed on by the given set of oracle adapters.
/// @notice MUST revert if oracles disagree on the hash or if an oracle does not report.
/// @inheritdoc IHashi
function getHash(
uint256 domain,
uint256 id,
IOracleAdapter[] memory oracleAdapters
) public view returns (bytes32 hash) {
if (oracleAdapters.length == 0) revert NoOracleAdaptersGiven(address(this));
bytes32[] memory hashes = getHashesFromOracles(oracleAdapters, domain, id);
IOracleAdapter[] calldata oracleAdapters
) external view returns (bytes32 hash) {
if (oracleAdapters.length == 0) revert NoOracleAdaptersGiven();
bytes32[] memory hashes = getHashesFromOracles(domain, id, oracleAdapters);
hash = hashes[0];
if (hash == bytes32(0)) revert OracleDidNotReport(address(this), oracleAdapters[0]);
for (uint256 i = 1; i < hashes.length; i++) {
if (hashes[i] == bytes32(0)) revert OracleDidNotReport(address(this), oracleAdapters[i]);
if (hash != hashes[i]) revert OraclesDisagree(address(this), oracleAdapters[i - 1], oracleAdapters[i]);
if (hash == bytes32(0)) revert OracleDidNotReport(oracleAdapters[0]);
for (uint256 i = 1; i < hashes.length; ) {
if (hashes[i] == bytes32(0)) revert OracleDidNotReport(oracleAdapters[i]);
if (hash != hashes[i]) revert OraclesDisagree(oracleAdapters[i - 1], oracleAdapters[i]);
unchecked {
++i;
}
}
}
}
243 changes: 187 additions & 56 deletions packages/evm/contracts/Yaho.sol
Original file line number Diff line number Diff line change
@@ -1,72 +1,203 @@
// SPDX-License-Identifier: LGPL-3.0-only
pragma solidity ^0.8.17;

import { IMessageRelay } from "./interfaces/IMessageRelay.sol";
import { Message } from "./interfaces/IMessageDispatcher.sol";
import { IYaho } from "./interfaces/IYaho.sol";
import { MessageIdCalculator } from "./utils/MessageIdCalculator.sol";
import { MessageHashCalculator } from "./utils/MessageHashCalculator.sol";
import { IYaho } from "./interfaces/IYaho.sol";
import { IReporter } from "./interfaces/IReporter.sol";
import { Message } from "./interfaces/IMessage.sol";
import { IOracleAdapter } from "./interfaces/IOracleAdapter.sol";

contract Yaho is IYaho, MessageHashCalculator {
mapping(uint256 => bytes32) public hashes;
uint256 private count;
contract Yaho is IYaho, MessageIdCalculator, MessageHashCalculator {
mapping(uint256 => bytes32) private _pendingMessageHashes;

/// @dev Dispatches a batch of messages, putting their into storage and emitting their contents as an event.
/// @param messages An array of Messages to be dispatched.
/// @return messageIds An array of message IDs corresponding to the dispatched messages.
function dispatchMessages(Message[] memory messages) public payable returns (bytes32[] memory) {
if (messages.length == 0) revert NoMessagesGiven(address(this));
bytes32[] memory messageIds = new bytes32[](messages.length);
for (uint256 i = 0; i < messages.length; i++) {
uint256 id = count;
hashes[id] = calculateHash(block.chainid, id, address(this), msg.sender, messages[i]);
messageIds[i] = bytes32(id);
emit MessageDispatched(bytes32(id), msg.sender, messages[i].toChainId, messages[i].to, messages[i].data);
count++;
/// @inheritdoc IYaho
function dispatchMessage(
uint256 toChainId,
uint256 threshold,
address receiver,
bytes calldata data,
IReporter[] calldata reporters,
IOracleAdapter[] calldata adapters
) external returns (uint256) {
_checkReportersAndAdapters(threshold, reporters, adapters);
(uint256 messageId, ) = _dispatchMessage(toChainId, threshold, receiver, data, reporters, adapters);
return messageId;
}

/// @inheritdoc IYaho
function dispatchMessageToAdapters(
uint256 toChainId,
uint256 threshold,
address receiver,
bytes calldata data,
IReporter[] calldata reporters,
IOracleAdapter[] calldata adapters
) external payable returns (uint256, bytes32[] memory) {
_checkReportersAndAdapters(threshold, reporters, adapters);
(uint256 messageId, bytes32 messageHash) = _dispatchMessage(
toChainId,
threshold,
receiver,
data,
reporters,
adapters
);
bytes32[] memory reportersReceipts = _dispatchMessageToAdapters(
toChainId,
messageId,
messageHash,
reporters,
adapters
);
return (messageId, reportersReceipts);
}

/// @inheritdoc IYaho
function dispatchMessagesToAdapters(
uint256 toChainId,
uint256[] calldata thresholds,
address[] calldata receivers,
bytes[] calldata data,
IReporter[] calldata reporters,
IOracleAdapter[] calldata adapters
) external payable returns (uint256[] memory, bytes32[] memory) {
if (thresholds.length != receivers.length) revert UnequalArrayLengths(thresholds.length, receivers.length);
if (thresholds.length != data.length) revert UnequalArrayLengths(thresholds.length, data.length);

uint256[] memory messageIds = new uint256[](receivers.length);
bytes32[] memory messageHashes = new bytes32[](receivers.length);
for (uint256 i = 0; i < receivers.length; ) {
_checkReportersAndAdapters(thresholds[i], reporters, adapters);
(messageIds[i], messageHashes[i]) = _dispatchMessage(
toChainId,
thresholds[i],
receivers[i],
data[i],
reporters,
adapters
);
unchecked {
++i;
}
}
return messageIds;

bytes32[] memory reportersReceipts = new bytes32[](reporters.length);
reportersReceipts = _dispatchMessagesToAdapters(toChainId, messageIds, messageHashes, reporters, adapters);
return (messageIds, reportersReceipts);
}

/// @dev Relays hashes of the given messageIds to the given adapters.
/// @param messageIds Array of IDs of the message hashes to relay to the given adapters.
/// @param adapters Array of relay adapter addresses to which hashes should be relayed.
/// @param destinationAdapters Array of oracle adapter addresses to receive hashes.
/// @return adapterReciepts Reciepts from each of the relay adapters.
function relayMessagesToAdapters(
uint256[] memory messageIds,
address[] memory adapters,
address[] memory destinationAdapters
) external payable returns (bytes32[] memory) {
if (messageIds.length == 0) revert NoMessageIdsGiven(address(this));
if (adapters.length == 0) revert NoAdaptersGiven(address(this));
if (adapters.length != destinationAdapters.length) revert UnequalArrayLengths(address(this));
bytes32[] memory adapterReciepts = new bytes32[](adapters.length);
for (uint256 i = 0; i < adapters.length; i++) {
adapterReciepts[i] = IMessageRelay(adapters[i]).relayMessages(messageIds, destinationAdapters[i]);
/// @inheritdoc IYaho
function getPendingMessageHash(uint256 messageId) external view returns (bytes32) {
return _pendingMessageHashes[messageId];
}

/// @inheritdoc IYaho
function relayMessagesToAdapters(Message[] calldata messages) external payable returns (bytes32[] memory) {
if (messages.length == 0) revert NoMessagesGiven();

bytes32 expectedParams = keccak256(
abi.encode(messages[0].toChainId, messages[0].reporters, messages[0].adapters)
);

bytes32[] memory messageHashes = new bytes32[](messages.length);
uint256[] memory messageIds = new uint256[](messages.length);
for (uint256 i = 0; i < messages.length; i++) {
Message memory message = messages[i];
if (
i > 0 && expectedParams != keccak256(abi.encode(message.toChainId, message.reporters, message.adapters))
) revert InvalidMessage(message);
uint256 messageId = calculateMessageId(block.chainid, address(this), calculateMessageHash(message));
bytes32 messageHash = _pendingMessageHashes[messageId];
if (messageHash == bytes32(0)) revert MessageHashNotFound(messageId);
messageHashes[i] = messageHash;
messageIds[i] = messageId;
}
return adapterReciepts;

return
_dispatchMessagesToAdapters(
messages[0].toChainId,
messageIds,
messageHashes,
messages[0].reporters,
messages[0].adapters
);
}

/// @dev Dispatches an array of messages and relays their hashes to an array of relay adapters.
/// @param messages An array of Messages to be dispatched.
/// @param adapters Array of relay adapter addresses to which hashes should be relayed.
/// @param destinationAdapters Array of oracle adapter addresses to receive hashes.
/// @return messageIds An array of message IDs corresponding to the dispatched messages.
/// @return adapterReciepts Reciepts from each of the relay adapters.
function dispatchMessagesToAdapters(
Message[] memory messages,
address[] memory adapters,
address[] memory destinationAdapters
) external payable returns (bytes32[] memory messageIds, bytes32[] memory) {
if (adapters.length == 0) revert NoAdaptersGiven(address(this));
messageIds = dispatchMessages(messages);
uint256[] memory uintIds = new uint256[](messageIds.length);
for (uint256 i = 0; i < messageIds.length; i++) {
uintIds[i] = uint256(messageIds[i]);
function _checkReportersAndAdapters(
uint256 threshold,
IReporter[] calldata reporters,
IOracleAdapter[] calldata adapters
) internal pure {
if (reporters.length == 0) revert NoReportersGiven();
if (adapters.length == 0) revert NoAdaptersGiven();
if (reporters.length != adapters.length) revert UnequalArrayLengths(reporters.length, adapters.length);
if (threshold > reporters.length || threshold == 0) revert InvalidThreshold(threshold, reporters.length);
}

function _dispatchMessage(
uint256 toChainId,
uint256 threshold,
address receiver,
bytes calldata data,
IReporter[] calldata reporters,
IOracleAdapter[] calldata adapters
) internal returns (uint256, bytes32) {
address sender = msg.sender;
Message memory message = Message(
keccak256(abi.encode(blockhash(block.number - 1), gasleft())),
toChainId,
threshold,
sender,
receiver,
data,
reporters,
adapters
);
bytes32 messageHash = calculateMessageHash(message);
uint256 messageId = calculateMessageId(block.chainid, address(this), messageHash);
_pendingMessageHashes[messageId] = messageHash;
emit MessageDispatched(messageId, message);
return (messageId, messageHash);
}

function _dispatchMessageToAdapters(
uint256 toChainId,
uint256 messageId,
bytes32 messageHash,
IReporter[] memory reporters,
IOracleAdapter[] memory adapters
) internal returns (bytes32[] memory) {
uint256[] memory messageIds = new uint256[](1);
bytes32[] memory messageHashes = new bytes32[](1);
messageIds[0] = messageId;
messageHashes[0] = messageHash;
return _dispatchMessagesToAdapters(toChainId, messageIds, messageHashes, reporters, adapters);
}

function _dispatchMessagesToAdapters(
uint256 toChainId,
uint256[] memory messageIds,
bytes32[] memory messageHashes,
IReporter[] memory reporters,
IOracleAdapter[] memory adapters
) internal returns (bytes32[] memory) {
bytes32[] memory reportersReceipts = new bytes32[](reporters.length);

for (uint256 i = 0; i < reporters.length; ) {
reportersReceipts[i] = reporters[i].dispatchMessages(toChainId, adapters[i], messageIds, messageHashes);
unchecked {
++i;
}
}
bytes32[] memory adapterReciepts = new bytes32[](adapters.length);
for (uint256 i = 0; i < adapters.length; i++) {
adapterReciepts[i] = IMessageRelay(adapters[i]).relayMessages(uintIds, destinationAdapters[i]);

for (uint256 j = 0; j < messageIds.length; ) {
delete _pendingMessageHashes[messageIds[j]];
unchecked {
++j;
}
}
return (messageIds, adapterReciepts);

return reportersReceipts;
}
}
Loading
Loading