Skip to content

Commit

Permalink
feat: add stride to relayed chains (hyperlane-xyz#4716)
Browse files Browse the repository at this point in the history
### Description

- feat: add stride to relayer
- feat: add stride to scraper

### Drive-by changes

- fix filtering non-evm addresses in appFromAddressesMapHelper
- fallback to manual `yarn install` in `yarn-build-with-cache` action
- fix bug in app governor to make inevm env-test pass

### Related issues

na

### Backward compatibility

yes

### Testing

manual

---------

Signed-off-by: pbio <10051819+paulbalaji@users.noreply.github.com>
  • Loading branch information
paulbalaji authored and tiendn committed Oct 25, 2024
1 parent 4d7cb0d commit 7079ca1
Show file tree
Hide file tree
Showing 12 changed files with 204 additions and 106 deletions.
5 changes: 5 additions & 0 deletions .changeset/tough-bats-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@hyperlane-xyz/sdk': patch
---

Fix filtering non-evm addresses in appFromAddressesMapHelper
16 changes: 15 additions & 1 deletion .github/actions/yarn-build-with-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,26 @@ runs:
steps:
- name: Cache
uses: buildjet/cache@v4
id: cache
with:
path: |
**/node_modules
.yarn
key: ${{ runner.os }}-yarn-cache-${{ hashFiles('./yarn.lock') }}
fail-on-cache-miss: true

# Typically, the cache will be hit, but if there's a network error when
# restoring the cache, let's run the install step ourselves.
- name: Install dependencies
if: steps.cache.outputs.cache-hit != 'true'
shell: bash
run: |
yarn install
CHANGES=$(git status -s --ignore-submodules)
if [[ ! -z $CHANGES ]]; then
echo "Changes found: $CHANGES"
git diff
exit 1
fi
- name: Build
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .registryrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8583d0841615313c8c880e765eba760378e061cd
dee58183e51f4eb43e84dbac0e595a4b389dbe80
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,14 @@ const DOMAINS: &[RawDomain] = &[
is_test_net: false,
is_deprecated: false,
},
RawDomain {
name: "stride",
token: "STRD",
domain: 745,
chain_id: 745,
is_test_net: false,
is_deprecated: false,
},
RawDomain {
name: "cosmostest99990",
token: "OSMO",
Expand Down
206 changes: 138 additions & 68 deletions rust/main/config/mainnet_config.json

Large diffs are not rendered by default.

9 changes: 6 additions & 3 deletions typescript/infra/config/environments/mainnet3/agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ export const hyperlaneContextAgentChainConfig: AgentChainConfig<
sei: true,
shibarium: true,
solanamainnet: true,
stride: false,
superposition: true,
taiko: true,
tangle: true,
Expand Down Expand Up @@ -189,6 +190,7 @@ export const hyperlaneContextAgentChainConfig: AgentChainConfig<
sei: true,
shibarium: true,
solanamainnet: true,
stride: true,
superposition: true,
taiko: true,
tangle: true,
Expand Down Expand Up @@ -264,6 +266,7 @@ export const hyperlaneContextAgentChainConfig: AgentChainConfig<
shibarium: true,
// Cannot scrape Sealevel chains
solanamainnet: false,
stride: true,
superposition: true,
taiko: true,
tangle: true,
Expand Down Expand Up @@ -418,7 +421,7 @@ const hyperlane: RootAgentConfig = {
rpcConsensusType: RpcConsensusType.Fallback,
docker: {
repo,
tag: 'b1ff48b-20241016-183301',
tag: '42d6b50-20241021-155906',
},
gasPaymentEnforcement: gasPaymentEnforcement,
metricAppContexts,
Expand All @@ -437,7 +440,7 @@ const hyperlane: RootAgentConfig = {
rpcConsensusType: RpcConsensusType.Fallback,
docker: {
repo,
tag: '9c0c4bb-20241018-113820',
tag: '42d6b50-20241021-155906',
},
resources: scraperResources,
},
Expand All @@ -452,7 +455,7 @@ const releaseCandidate: RootAgentConfig = {
rpcConsensusType: RpcConsensusType.Fallback,
docker: {
repo,
tag: 'b1ff48b-20241016-183301',
tag: '42d6b50-20241021-155906',
},
// We're temporarily (ab)using the RC relayer as a way to increase
// message throughput.
Expand Down
2 changes: 2 additions & 0 deletions typescript/infra/config/environments/mainnet3/funding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ export const keyFunderConfig: KeyFunderConfig<
scroll: '0.5',
sei: '50',
shibarium: '50',
// ignore non-evm chains
stride: '0',
superposition: '0.05',
taiko: '0.2',
tangle: '2',
Expand Down
4 changes: 4 additions & 0 deletions typescript/infra/config/environments/mainnet3/gasPrices.json
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@
"amount": "0.5",
"decimals": 1
},
"stride": {
"amount": "0.005",
"decimals": 1
},
"superposition": {
"amount": "0.01",
"decimals": 9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ export const mainnet3SupportedChainNames = [
'sei',
'shibarium',
'solanamainnet',
'stride',
'superposition',
'taiko',
'tangle',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"sei": "0.447635",
"shibarium": "0.410927",
"solanamainnet": "155.35",
"stride": "0.840153",
"superposition": "2629.74",
"taiko": "2629.74",
"tangle": "1",
Expand Down
24 changes: 15 additions & 9 deletions typescript/infra/src/govern/HyperlaneAppGovernor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,23 @@ export abstract class HyperlaneAppGovernor<

// If calls are being submitted via a safe, we need to check for any safe owner changes first
if (submissionType === SubmissionType.SAFE) {
const { safeSdk } = await getSafeAndService(
chain,
this.checker.multiProvider,
(multiSend as SafeMultiSend).safeAddress,
);
const updateOwnerCalls = await updateSafeOwner(safeSdk);
callsForSubmissionType.push(...updateOwnerCalls, ...filteredCalls);
} else {
callsForSubmissionType.push(...filteredCalls);
try {
const { safeSdk } = await getSafeAndService(
chain,
this.checker.multiProvider,
(multiSend as SafeMultiSend).safeAddress,
);
const updateOwnerCalls = await updateSafeOwner(safeSdk);
callsForSubmissionType.push(...updateOwnerCalls);
} catch (error) {
// Catch but don't throw because we want to try submitting any remaining calls
console.error(`Error updating safe owner: ${error}`);
}
}

// Add the filtered calls to the calls for submission type
callsForSubmissionType.push(...filteredCalls);

if (callsForSubmissionType.length > 0) {
this.printSeparator();
const confirmed = await summarizeCalls(
Expand Down
32 changes: 8 additions & 24 deletions typescript/sdk/src/contracts/contracts.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Contract, ethers } from 'ethers';
import { Contract } from 'ethers';

import { Ownable } from '@hyperlane-xyz/core';
import {
Expand Down Expand Up @@ -235,31 +235,15 @@ export function appFromAddressesMapHelper<F extends HyperlaneFactories>(
contractsMap: HyperlaneContractsMap<F>;
multiProvider: MultiProvider;
} {
// Hack to accommodate non-Ethereum artifacts, while still retaining their
// presence in the addressesMap so that they are included in the list of chains
// on the MultiProvider (needed for getting metadata). A non-Ethereum-style address
// from another execution environment will cause Ethers to throw if we try to attach
// it, so we just replace it with the zero address.
const addressesMapWithEthereumizedAddresses = objMap(
// Filter out non-Ethereum chains from the addressesMap
const ethereumAddressesMap = objFilter(
addressesMap,
(chain, addresses) => {
const metadata = multiProvider.getChainMetadata(chain);
if (metadata.protocol === ProtocolType.Ethereum) {
return addresses;
}
return objMap(
addresses,
(_key, _address) => ethers.constants.AddressZero,
);
},
(chain, _): _ is HyperlaneAddresses<F> =>
multiProvider.getProtocol(chain) === ProtocolType.Ethereum,
);

// Attaches contracts for each chain for which we have a complete set of
// addresses
const contractsMap = attachContractsMap(
addressesMapWithEthereumizedAddresses,
factories,
);
// Attaches contracts for each Ethereum chain for which we have a complete set of addresses
const contractsMap = attachContractsMap(ethereumAddressesMap, factories);

// Filters out providers for chains for which we don't have a complete set
// of addresses
Expand All @@ -270,6 +254,6 @@ export function appFromAddressesMapHelper<F extends HyperlaneFactories>(

return {
contractsMap: filteredContractsMap,
multiProvider: multiProvider,
multiProvider,
};
}

0 comments on commit 7079ca1

Please sign in to comment.