-
Notifications
You must be signed in to change notification settings - Fork 343
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
No metadata relayer support for hooks (#2495)
### Description - Adding `NoMetadataRelayer` moduleType which returns an empty `vec![]` on `MetadataBuilder::build()` - Adding `HyperlaneHookDeployer` which lets you deploy the hook, ISM and a testRecipient which specifies to use the `AbtractNativeISM` ### Drive-by changes - none ### Related issues - Accompanies #2316 - Fixes hyperlane-xyz/issues#379 for Optimism - Related to adding native hooks to Mailbox V3 hyperlane-xyz/issues#486 ### Backward compatibility Backward compatible? Yes Tooling changes needed? Need to update node to ^18 ### Testing - Manual on testnet3
- Loading branch information
1 parent
f7e453a
commit d69a3f6
Showing
23 changed files
with
430 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,11 @@ | ||
mod aggregation; | ||
mod base; | ||
mod multisig; | ||
mod null_metadata; | ||
mod routing; | ||
|
||
use aggregation::AggregationIsmMetadataBuilder; | ||
pub(crate) use base::BaseMetadataBuilder; | ||
pub(crate) use base::MetadataBuilder; | ||
use null_metadata::NullMetadataBuilder; | ||
use routing::RoutingIsmMetadataBuilder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
use super::MetadataBuilder; | ||
use async_trait::async_trait; | ||
use derive_new::new; | ||
use tracing::instrument; | ||
|
||
use hyperlane_core::{HyperlaneMessage, H256}; | ||
|
||
#[derive(Clone, Debug, new)] | ||
pub struct NullMetadataBuilder {} | ||
|
||
#[async_trait] | ||
impl MetadataBuilder for NullMetadataBuilder { | ||
#[instrument(err, skip(self))] | ||
async fn build( | ||
&self, | ||
_ism_address: H256, | ||
_message: &HyperlaneMessage, | ||
) -> eyre::Result<Option<Vec<u8>>> { | ||
Ok(Some(vec![])) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { | ||
ChainMap, | ||
HookConfig, | ||
HookContractType, | ||
MessageHookConfig, | ||
NoMetadataIsmConfig, | ||
filterByChains, | ||
objMap, | ||
} from '@hyperlane-xyz/sdk'; | ||
|
||
import { owners } from './owners'; | ||
|
||
const chainNameFilter = new Set(['ethereum', 'optimism']); | ||
const filteredOwnersResult = filterByChains<string>(owners, chainNameFilter); | ||
|
||
export const hooks: ChainMap<HookConfig> = objMap( | ||
filteredOwnersResult, | ||
(chain) => { | ||
if (chain === 'ethereum') { | ||
const hookConfig: MessageHookConfig = { | ||
hookContractType: HookContractType.HOOK, | ||
nativeBridge: '0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1', | ||
remoteIsm: '0x4c5859f0f772848b2d91f1d83e2fe57935348029', // dummy, remoteISM should be deployed first | ||
destinationDomain: 10, | ||
}; | ||
return hookConfig; | ||
} else { | ||
const ismConfig: NoMetadataIsmConfig = { | ||
hookContractType: HookContractType.ISM, | ||
nativeBridge: '0x4200000000000000000000000000000000000007', | ||
}; | ||
return ismConfig; | ||
} | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { | ||
ChainMap, | ||
HookConfig, | ||
HookContractType, | ||
MessageHookConfig, | ||
NoMetadataIsmConfig, | ||
filterByChains, | ||
objMap, | ||
} from '@hyperlane-xyz/sdk'; | ||
|
||
import { owners } from './owners'; | ||
|
||
const chainNameFilter = new Set(['test1', 'test2']); | ||
const filteredOwnersResult = filterByChains<string>(owners, chainNameFilter); | ||
|
||
export const hooks: ChainMap<HookConfig> = objMap( | ||
filteredOwnersResult, | ||
(chain) => { | ||
if (chain === 'test1') { | ||
const hookConfig: MessageHookConfig = { | ||
hookContractType: HookContractType.HOOK, | ||
nativeBridge: '0x25ace71c97B33Cc4729CF772ae268934F7ab5fA1', | ||
remoteIsm: '0x4c5859f0f772848b2d91f1d83e2fe57935348029', // dummy, remoteISM should be deployed first | ||
destinationDomain: 10, | ||
}; | ||
return hookConfig; | ||
} else { | ||
const ismConfig: NoMetadataIsmConfig = { | ||
hookContractType: HookContractType.ISM, | ||
nativeBridge: '0x4200000000000000000000000000000000000007', | ||
}; | ||
return ismConfig; | ||
} | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { | ||
ChainMap, | ||
HookConfig, | ||
HookContractType, | ||
MessageHookConfig, | ||
NoMetadataIsmConfig, | ||
filterByChains, | ||
objMap, | ||
} from '@hyperlane-xyz/sdk'; | ||
|
||
import { owners } from './owners'; | ||
|
||
const chainNameFilter = new Set(['goerli', 'optimismgoerli']); | ||
const filteredOwnersResult = filterByChains<string>(owners, chainNameFilter); | ||
|
||
export const hooks: ChainMap<HookConfig> = objMap( | ||
filteredOwnersResult, | ||
(chain) => { | ||
if (chain === 'goerli') { | ||
const hookConfig: MessageHookConfig = { | ||
hookContractType: HookContractType.HOOK, | ||
nativeBridge: '0x5086d1eEF304eb5284A0f6720f79403b4e9bE294', | ||
remoteIsm: '0x4c5859f0f772848b2d91f1d83e2fe57935348029', // dummy, remoteISM should be deployed first | ||
destinationDomain: 420, | ||
}; | ||
return hookConfig; | ||
} else { | ||
const ismConfig: NoMetadataIsmConfig = { | ||
hookContractType: HookContractType.ISM, | ||
nativeBridge: '0x4200000000000000000000000000000000000007', | ||
}; | ||
return ismConfig; | ||
} | ||
}, | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.