-
Notifications
You must be signed in to change notification settings - Fork 390
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9a861e0
commit d9376ac
Showing
17 changed files
with
1,035 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,182 @@ | ||
import { | ||
AgentConnectionType, | ||
chainMetadata, | ||
getDomainId, | ||
hyperlaneEnvironments, | ||
objMap, | ||
} from '@hyperlane-xyz/sdk'; | ||
|
||
import { | ||
GasPaymentEnforcementPolicyType, | ||
RootAgentConfig, | ||
routerMatchingList, | ||
} from '../../../src/config'; | ||
import { GasPaymentEnforcementConfig } from '../../../src/config/agent/relayer'; | ||
import { ALL_KEY_ROLES, Role } from '../../../src/roles'; | ||
import { Contexts } from '../../contexts'; | ||
|
||
import { agentChainNames, environment } from './chains'; | ||
import { helloWorld } from './helloworld'; | ||
import { validatorChainConfig } from './validators'; | ||
|
||
const releaseCandidateHelloworldMatchingList = routerMatchingList( | ||
helloWorld[Contexts.ReleaseCandidate].addresses, | ||
); | ||
|
||
const interchainQueryRouters = objMap( | ||
hyperlaneEnvironments.testnet, | ||
(_, addresses) => { | ||
return { | ||
// @ts-ignore moonbasealpha has no interchain query router | ||
router: addresses.interchainQueryRouter, | ||
}; | ||
}, | ||
); | ||
|
||
const interchainQueriesMatchingList = routerMatchingList( | ||
interchainQueryRouters, | ||
); | ||
|
||
const repo = 'gcr.io/abacus-labs-dev/hyperlane-agent'; | ||
|
||
const contextBase = { | ||
namespace: environment, | ||
runEnv: environment, | ||
contextChainNames: agentChainNames, | ||
environmentChainNames: agentChainNames, | ||
aws: { | ||
region: 'us-east-1', | ||
}, | ||
} as const; | ||
|
||
const gasPaymentEnforcement: GasPaymentEnforcementConfig[] = [ | ||
{ | ||
type: GasPaymentEnforcementPolicyType.None, | ||
// To continue relaying interchain query callbacks, we whitelist | ||
// all messages between interchain query routers. | ||
// This whitelist will become more strict with | ||
// https://github.com/hyperlane-xyz/hyperlane-monorepo/issues/1605 | ||
matchingList: interchainQueriesMatchingList, | ||
}, | ||
// Default policy is OnChainFeeQuoting | ||
{ | ||
type: GasPaymentEnforcementPolicyType.OnChainFeeQuoting, | ||
}, | ||
]; | ||
|
||
const hyperlane: RootAgentConfig = { | ||
...contextBase, | ||
context: Contexts.Hyperlane, | ||
rolesWithKeys: ALL_KEY_ROLES, | ||
relayer: { | ||
connectionType: AgentConnectionType.HttpFallback, | ||
docker: { | ||
repo, | ||
tag: 'f03257a-20230714-154845', | ||
}, | ||
blacklist: [ | ||
...releaseCandidateHelloworldMatchingList, | ||
{ | ||
// In an effort to reduce some giant retry queues that resulted | ||
// from spam txs to the old TestRecipient before we were charging for | ||
// gas, we blacklist the old TestRecipient address. | ||
recipientAddress: '0xBC3cFeca7Df5A45d61BC60E7898E63670e1654aE', | ||
}, | ||
], | ||
gasPaymentEnforcement, | ||
}, | ||
validators: { | ||
connectionType: AgentConnectionType.HttpFallback, | ||
docker: { | ||
repo, | ||
tag: '497db63-20230614-174455', | ||
}, | ||
chainDockerOverrides: { | ||
[chainMetadata.solanadevnet.name]: { | ||
tag: '79bad9d-20230706-190752', | ||
}, | ||
[chainMetadata.zbctestnet.name]: { | ||
tag: '79bad9d-20230706-190752', | ||
}, | ||
}, | ||
chains: validatorChainConfig(Contexts.Hyperlane), | ||
}, | ||
scraper: { | ||
connectionType: AgentConnectionType.HttpFallback, | ||
docker: { | ||
repo, | ||
tag: 'aaddba7-20230620-154941', | ||
}, | ||
}, | ||
}; | ||
|
||
const releaseCandidate: RootAgentConfig = { | ||
...contextBase, | ||
context: Contexts.ReleaseCandidate, | ||
rolesWithKeys: [Role.Relayer, Role.Kathy, Role.Validator], | ||
relayer: { | ||
connectionType: AgentConnectionType.HttpFallback, | ||
docker: { | ||
repo, | ||
tag: 'f03257a-20230714-154845', | ||
}, | ||
whitelist: [ | ||
...releaseCandidateHelloworldMatchingList, | ||
// Whitelist all traffic to solanadevnet and zbctestnet | ||
{ | ||
originDomain: '*', | ||
senderAddress: '*', | ||
destinationDomain: [ | ||
getDomainId(chainMetadata.solanadevnet), | ||
getDomainId(chainMetadata.zbctestnet), | ||
], | ||
recipientAddress: '*', | ||
}, | ||
// Whitelist all traffic from solanadevnet and zbctestnet to fuji | ||
{ | ||
originDomain: [ | ||
getDomainId(chainMetadata.solanadevnet), | ||
getDomainId(chainMetadata.zbctestnet), | ||
], | ||
senderAddress: '*', | ||
destinationDomain: [getDomainId(chainMetadata.fuji)], | ||
recipientAddress: '*', | ||
}, | ||
], | ||
gasPaymentEnforcement: [ | ||
// Don't require gas payments from solanadevnet or zbctestnet | ||
{ | ||
type: GasPaymentEnforcementPolicyType.None, | ||
matchingList: [ | ||
{ | ||
originDomain: [ | ||
getDomainId(chainMetadata.solanadevnet), | ||
getDomainId(chainMetadata.zbctestnet), | ||
], | ||
senderAddress: '*', | ||
destinationDomain: [getDomainId(chainMetadata.fuji)], | ||
recipientAddress: '*', | ||
}, | ||
], | ||
}, | ||
...gasPaymentEnforcement, | ||
], | ||
transactionGasLimit: 750000, | ||
// Skipping arbitrum because the gas price estimates are inclusive of L1 | ||
// fees which leads to wildly off predictions. | ||
skipTransactionGasLimitFor: [chainMetadata.arbitrumgoerli.chainId], | ||
}, | ||
validators: { | ||
connectionType: AgentConnectionType.HttpFallback, | ||
docker: { | ||
repo, | ||
tag: '497db63-20230614-174455', | ||
}, | ||
chains: validatorChainConfig(Contexts.ReleaseCandidate), | ||
}, | ||
}; | ||
|
||
export const agents = { | ||
[Contexts.Hyperlane]: hyperlane, | ||
[Contexts.ReleaseCandidate]: releaseCandidate, | ||
}; |
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,27 @@ | ||
import { ChainMap, ChainMetadata, chainMetadata } from '@hyperlane-xyz/sdk'; | ||
|
||
export const testnetConfigs: ChainMap<ChainMetadata> = { | ||
alfajores: chainMetadata.alfajores, | ||
fuji: chainMetadata.fuji, | ||
mumbai: { | ||
...chainMetadata.mumbai, | ||
transactionOverrides: { | ||
maxFeePerGas: 70 * 10 ** 9, // 70 gwei | ||
maxPriorityFeePerGas: 40 * 10 ** 9, // 40 gwei | ||
}, | ||
}, | ||
bsctestnet: chainMetadata.bsctestnet, | ||
goerli: chainMetadata.goerli, | ||
sepolia: chainMetadata.sepolia, | ||
moonbasealpha: chainMetadata.moonbasealpha, | ||
optimismgoerli: chainMetadata.optimismgoerli, | ||
arbitrumgoerli: chainMetadata.arbitrumgoerli, | ||
}; | ||
|
||
// "Blessed" chains that we want core contracts for. | ||
export type TestnetChains = keyof typeof testnetConfigs; | ||
export const chainNames = Object.keys(testnetConfigs) as TestnetChains[]; | ||
export const environment = 'testnet4'; | ||
|
||
// Chains that we want to run agents for. | ||
export const agentChainNames = [...chainNames, 'solanadevnet', 'zbctestnet']; |
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,25 @@ | ||
import { | ||
AggregationIsmConfig, | ||
ChainMap, | ||
CoreConfig, | ||
objMap, | ||
} from '@hyperlane-xyz/sdk'; | ||
|
||
import { aggregationIsm } from '../../aggregationIsm'; | ||
import { Contexts } from '../../contexts'; | ||
|
||
import { igp } from './igp'; | ||
import { owners } from './owners'; | ||
|
||
export const core: ChainMap<CoreConfig> = objMap(owners, (local, owner) => { | ||
const defaultIsm: AggregationIsmConfig = aggregationIsm( | ||
'testnet4', | ||
local, | ||
Contexts.Hyperlane, | ||
); | ||
return { | ||
...igp[local], | ||
owner, | ||
defaultIsm, | ||
}; | ||
}); |
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,27 @@ | ||
import { AgentConnectionType } from '@hyperlane-xyz/sdk'; | ||
|
||
import { KeyFunderConfig } from '../../../src/config/funding'; | ||
import { Role } from '../../../src/roles'; | ||
import { Contexts } from '../../contexts'; | ||
|
||
import { environment } from './chains'; | ||
|
||
export const keyFunderConfig: KeyFunderConfig = { | ||
docker: { | ||
repo: 'gcr.io/abacus-labs-dev/hyperlane-monorepo', | ||
tag: '8b752d0-20230606-195641', | ||
}, | ||
// We're currently using the same deployer key as testnet2. | ||
// To minimize nonce clobbering we offset the key funder cron | ||
// schedule by 30 minutes. | ||
cronSchedule: '15 * * * *', // Every hour at the 15-minute mark | ||
namespace: environment, | ||
prometheusPushGateway: | ||
'http://prometheus-pushgateway.monitoring.svc.cluster.local:9091', | ||
contextFundingFrom: Contexts.Hyperlane, | ||
contextsAndRolesToFund: { | ||
[Contexts.Hyperlane]: [Role.Relayer, Role.Kathy], | ||
[Contexts.ReleaseCandidate]: [Role.Relayer, Role.Kathy], | ||
}, | ||
connectionType: AgentConnectionType.HttpQuorum, | ||
}; |
76 changes: 76 additions & 0 deletions
76
typescript/infra/config/environments/testnet4/gas-oracle.ts
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,76 @@ | ||
import { BigNumber, ethers } from 'ethers'; | ||
|
||
import { ChainMap, ChainName } from '@hyperlane-xyz/sdk'; | ||
|
||
import { | ||
AllStorageGasOracleConfigs, | ||
getAllStorageGasOracleConfigs, | ||
} from '../../../src/config'; | ||
import { TOKEN_EXCHANGE_RATE_DECIMALS } from '../../../src/config/gas-oracle'; | ||
|
||
import { TestnetChains, chainNames } from './chains'; | ||
|
||
// Overcharge by 30% to account for market making risk | ||
const TOKEN_EXCHANGE_RATE_MULTIPLIER = ethers.utils.parseUnits( | ||
'1.30', | ||
TOKEN_EXCHANGE_RATE_DECIMALS, | ||
); | ||
|
||
// Taken by looking at each testnet and overestimating gas prices | ||
const gasPrices: ChainMap<BigNumber> = { | ||
alfajores: ethers.utils.parseUnits('10', 'gwei'), | ||
fuji: ethers.utils.parseUnits('30', 'gwei'), | ||
mumbai: ethers.utils.parseUnits('45', 'gwei'), | ||
bsctestnet: ethers.utils.parseUnits('15', 'gwei'), | ||
goerli: ethers.utils.parseUnits('5', 'gwei'), | ||
sepolia: ethers.utils.parseUnits('5', 'gwei'), | ||
moonbasealpha: ethers.utils.parseUnits('5', 'gwei'), | ||
optimismgoerli: ethers.utils.parseUnits('0.5', 'gwei'), | ||
arbitrumgoerli: ethers.utils.parseUnits('0.5', 'gwei'), | ||
}; | ||
|
||
// Used to categorize rarity of testnet tokens & approximate exchange rates. | ||
// Unashamedly borrowed from Fortnite | ||
enum Rarity { | ||
Common, | ||
Rare, | ||
Mythic, | ||
} | ||
|
||
// "Value" of the testnet tokens with 10 decimals of precision. | ||
// Imagine these as quoted in USD | ||
const RARITY_APPROXIMATE_VALUE: Record<Rarity, BigNumber> = { | ||
[Rarity.Common]: ethers.utils.parseUnits('0.5', TOKEN_EXCHANGE_RATE_DECIMALS), | ||
[Rarity.Rare]: ethers.utils.parseUnits('1', TOKEN_EXCHANGE_RATE_DECIMALS), | ||
[Rarity.Mythic]: ethers.utils.parseUnits('5', TOKEN_EXCHANGE_RATE_DECIMALS), | ||
}; | ||
|
||
const chainTokenRarity: ChainMap<Rarity> = { | ||
alfajores: Rarity.Common, | ||
fuji: Rarity.Rare, | ||
mumbai: Rarity.Rare, | ||
bsctestnet: Rarity.Rare, | ||
goerli: Rarity.Mythic, | ||
sepolia: Rarity.Mythic, | ||
moonbasealpha: Rarity.Common, | ||
optimismgoerli: Rarity.Mythic, | ||
arbitrumgoerli: Rarity.Mythic, | ||
}; | ||
|
||
// Gets the "value" of a testnet chain | ||
function getApproximateValue(chain: TestnetChains): BigNumber { | ||
const rarity = chainTokenRarity[chain]; | ||
return RARITY_APPROXIMATE_VALUE[rarity]; | ||
} | ||
|
||
// Gets the exchange rate of the remote quoted in local tokens | ||
function getTokenExchangeRate(local: ChainName, remote: ChainName): BigNumber { | ||
const localValue = getApproximateValue(local); | ||
const remoteValue = getApproximateValue(remote); | ||
|
||
// Apply multiplier to overcharge | ||
return remoteValue.mul(TOKEN_EXCHANGE_RATE_MULTIPLIER).div(localValue); | ||
} | ||
|
||
export const storageGasOracleConfig: AllStorageGasOracleConfigs = | ||
getAllStorageGasOracleConfigs(chainNames, gasPrices, getTokenExchangeRate); |
Oops, something went wrong.