Skip to content

Commit

Permalink
Allow the relayer to operate on a subset of chains (#1545)
Browse files Browse the repository at this point in the history
  • Loading branch information
asaj authored Jan 10, 2023
1 parent 1651c78 commit 562c0fe
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
10 changes: 9 additions & 1 deletion rust/agents/relayer/src/relayer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,15 @@ impl BaseAgent for Relayer {
where
Self: Sized,
{
let core = settings.try_into_hyperlane_core(metrics, None).await?;
let core = if let Some(ref remotes) = settings.destinationchainnames {
let mut v: Vec<&str> = remotes.split(',').collect();
v.push(&settings.originchainname);
settings
.try_into_hyperlane_core(metrics, Some(v.clone()))
.await?
} else {
settings.try_into_hyperlane_core(metrics, None).await?
};

let multisig_checkpoint_syncer: MultisigCheckpointSyncer = settings
.multisigcheckpointsyncer
Expand Down
3 changes: 3 additions & 0 deletions rust/agents/relayer/src/settings/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ pub enum GasPaymentEnforcementPolicy {
decl_settings!(Relayer {
// The name of the origin chain
originchainname: String,
// Optional list of destination chains. If none are provided, ALL chains in chain_setup
// will be used, excluding the origin chain.
destinationchainnames: Option<String>,
/// The multisig checkpoint syncer configuration
multisigcheckpointsyncer: hyperlane_base::MultisigCheckpointSyncerConf,
/// The gas payment enforcement policy configuration
Expand Down
2 changes: 2 additions & 0 deletions rust/chains/hyperlane-ethereum/src/multisig_ism.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use async_trait::async_trait;
use ethers::abi::Token;
use ethers::providers::Middleware;
use ethers::types::Selector;
use tracing::instrument;

use hyperlane_core::accumulator::merkle::Proof;
use hyperlane_core::{
Expand Down Expand Up @@ -90,6 +91,7 @@ impl<M> MultisigIsm for EthereumMultisigIsm<M>
where
M: Middleware + 'static,
{
#[instrument(err, ret)]
async fn validators_and_threshold(
&self,
message: &HyperlaneMessage,
Expand Down
1 change: 1 addition & 0 deletions rust/utils/run-locally/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ fn main() -> ExitCode {
"HYP_BASE_SIGNERS_TEST3_TYPE" => "hexKey",
"HYP_RELAYER_GASPAYMENTENFORCEMENTPOLICY_TYPE" => "none",
"HYP_RELAYER_ORIGINCHAINNAME" => "test1",
"HYP_RELAYER_DESTINATIONCHAINNAMES" => "test2,test3",
"HYP_RELAYER_WHITELIST" => r#"[{"sourceAddress": "*", "destinationDomain": ["13372", "13373"], "destinationAddress": "*"}]"#,
"HYP_RELAYER_MULTISIGCHECKPOINTSYNCER_CHECKPOINTSYNCERS_0x70997970c51812dc3a010c7d01b50e0d17dc79c8_TYPE" => "localStorage",
"HYP_RELAYER_MULTISIGCHECKPOINTSYNCER_CHECKPOINTSYNCERS_0x70997970c51812dc3a010c7d01b50e0d17dc79c8_PATH" => checkpoints_dir.path().to_str().unwrap(),
Expand Down

2 comments on commit 562c0fe

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forge Coverage Report

Coverage for this commit
14.19%▾ -0.41%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
../node_modules/@openzeppelin/contracts-upgradeable/access
   OwnableUpgradeable.sol80.95%50%85.71%90%56, 67, 75
../node_modules/@openzeppelin/contracts-upgradeable/proxy/utils
   Initializable.sol0%0%0%0%145, 145, 145–146, 146, 146–148, 156, 163
../node_modules/@openzeppelin/contracts-upgradeable/token/ERC20
   ERC20Upgradeable.sol66%54.55%55%74.14%100, 187–189, 207–209, 209, 209, 211, 214, 236–237, 242, 265, 291, 296, 326–327, 56, 60–61, 68, 76, 93
../node_modules/@openzeppelin/contracts-upgradeable/utils
   AddressUpgradeable.sol0%0%0%0%100, 119, 134, 134, 134–136, 146, 160–161, 176, 176, 176–177, 177, 177, 180, 180, 180, 182, 184, 199, 199, 199–200, 202, 208, 208, 208, 216, 41, 61, 61, 61, 63–64, 64, 64, 86
   ContextUpgradeable.sol33.33%100%25%50%28
../node_modules/@openzeppelin/contracts/access
   Ownable.sol0%0%0%0%44, 51, 51, 51, 62, 70, 70, 70–71, 79–81
../node_modules/@openzeppelin/contracts/proxy
   Proxy.sol0%100%0%0%59–60, 68
../node_modules/@openzeppelin/contracts/proxy/ERC1967
   ERC1967Proxy.sol0%100%0%0%30
   ERC1967Upgrade.sol0%0%0%0%117, 124, 124, 124–125, 134–135, 153, 160, 160, 160–161, 161, 161, 165, 179–181, 181, 181–182, 39, 46, 46, 46–47, 56–57, 70–71, 71, 71–72, 89, 89, 89–90, 92, 97
../node_modules/@openzeppelin/contracts/proxy/transparent
   ProxyAdmin.sol0%0%0%0%24–25, 25, 25–26, 39–40, 40, 40–41, 52, 63, 79
   TransparentUpgradeableProxy.sol0%0%0%0%107, 114, 121, 121, 121–122, 63, 76, 87, 96
../node_modules/@openzeppelin/contracts/utils
   Address.sol0%0%0%0%100, 119, 134, 134, 134–136, 146, 160–161, 171, 185–186, 201, 201, 201–202, 202, 202, 205, 205, 205, 207, 209, 224, 224, 224–225, 227, 233, 233, 233, 241, 41, 61, 61, 61, 63–64, 64, 64, 86
   Context.sol0%100%0%0%18, 22
   Create2.sol0%0%0%0%35, 35, 35–36, 36, 36, 39, 41, 41, 41, 49, 80
   StorageSlot.sol0%100%0%0%55, 65, 75, 85
   Strings.sol0%0%0%0%20–22, 25, 28, 33–34, 34, 34, 36, 45, 53–58, 60, 60, 60–61, 68
../node_modules/@openzeppelin/contracts/utils/cryptography
   ECDSA.sol0%0%0%0%106–108, 121–123, 147, 147, 147–148, 152–153, 153, 153–154, 157, 170–172, 186, 198, 211, 24, 24, 24–26, 26, 26–28, 28, 28–30, 30, 30–31, 56, 56, 56–59, 64–66, 68, 70, 89–91
../node_modules/@openzeppelin/contracts/utils/math
   Math.sol0%0%0%0%102, 105, 108, 112, 117, 121–126, 132–133, 146–147, 147, 147–148, 150, 159, 159, 159–160, 173, 180–187, 196–197, 20, 206, 208, 208, 208–210, 212, 212, 212–214, 216, 216, 216–218, 220, 220, 220–222, 224, 224, 224–226, 228, 228, 228–230, 232, 232, 232–234, 236, 236, 236–237, 240, 249–250, 259, 261, 261, 261–263, 265, 265, 265–267, 269, 269, 269, 27, 270–271, 273, 273, 273–275, 277, 277, 277–279, 281, 281, 281–283, 285, 285, 285–286, 289, 298–299, 310, 312, 312, 312–314, 316, 316, 316–318, 320, 320, 320–322, 324, 324, 324–326, 328, 328, 328–329, 332, 341–342, 36,

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hardhat Coverage Report

Coverage for this commit
57.37%▾ -0.48%
Coverage Report
FileStmtsBranchesFuncsLinesUncovered Lines
solidity/contracts
   Call.sol100%100%100%100%
   Create2Factory.sol0%0%0%0%101, 110, 110, 110, 112, 33, 58, 64–65, 65, 65, 77–78, 98, 98, 98
   HyperlaneConnectionClient.sol52.38%50%58.33%50%100–101, 131, 160, 160, 160, 164–165, 58, 76–77, 85–86, 98–99
   InterchainGasPaymaster.sol92.31%50%100%100%72
   Mailbox.sol97.06%100%92.31%97.56%232
   OwnableMulticall.sol0%0%0%0%12–14, 17, 17, 17–18, 24–26, 26, 26–27, 40, 44, 48–49, 52, 52, 52–53
   PausableReentrancyGuard.sol95.65%83.33%100%100%30
   Router.sol85.71%87.50%78.57%88.89%111, 46, 53, 64
solidity/contracts/isms
   MultisigIsm.sol97.12%86.36%100%100%102, 155, 263
solidity/contracts/libs
   EnumerableMapExtended.sol53.33%100%57.14%50%45, 61, 69–70
   Merkle.sol97.14%87.50%100%98.25%30, 44
   Message.sol90.91%100%90.91%90.91%109
   MinimalProxy.sol0%100%0%0%14
   MultisigIsmMetadata.sol100%100%100%100%
   TypeCasts.sol44.44%100%66.67%33.33%11–13, 17
solidity/contracts/middleware
   InterchainAccountRouter.sol0%0%0%0%106, 119–121, 121, 121–125, 127, 141, 154, 167, 171, 39, 41–42, 58, 75, 90–92
   InterchainQueryRouter.sol0%0%0%0%102–106, 119, 119, 119, 123, 127, 140–141, 141, 141–142, 148–149, 153–154, 154–155, 159–160, 62, 84–88
solidity/contracts/middleware/liquidity-layer
   LiquidityLayerRouter.sol0%0%0%0%111, 116, 124, 137–138, 146, 148, 148, 148, 35, 51, 56, 56, 56, 64, 72, 82, 99
solidity/contracts/middleware/liquidity-layer/adapters
   CircleBridgeAdapter.sol0%0%0%0%100, 100, 100, 107, 107, 107, 112, 119–120, 131, 135, 141–142, 142, 142, 147–148, 148, 148, 157, 157, 157, 159, 169, 176, 178, 185, 185, 185, 191–192, 192, 192, 194–195, 195, 195, 200–201, 203, 211–212, 212, 212, 214–215, 215, 215, 221–222, 224, 240, 58, 58, 58–59, 75, 77–78, 81, 90–91, 91, 91, 96, 99
solidity/contracts/middleware/liquidity-layer/interfaces
   ILiquidityLayerAdapter.sol100%100%100%100%
solidity/contracts/middleware/liquidity-layer/interfaces/circle
   ICircleBridge.sol100%100%100%100%
   ICircleMessageTransmitter.sol100%100%100%100%
solidity/contracts/mock
   MockCircleBridge.sol0%0%0%0%12, 21–23, 23, 23–25, 35–36
   MockCircleMessageTransmitter.sol0%100%0%0%12, 20, 28, 36–37, 41
   MockHyperlaneEnvironment.sol0%100%0%0%21–22, 24–25, 27–28, 30–31, 33–34, 36–37, 39–40, 42–43, 49, 56, 60, 65–66, 70, 74
   MockMailbox.sol94.74%50%100%100%41
   MockToken.sol0%100%0%0%12, 8
solidity/contracts/upgrade
   ProxyAdmin.sol100%100%100%100%
   TransparentUpgradeableProxy.sol100%100%100%100%
   Versioned.sol100%100%100%100%

Please sign in to comment.