Skip to content

Commit

Permalink
Kathy keys using correct env/context helloworld chains, small fixes (#…
Browse files Browse the repository at this point in the history
…3035)

### Description

- Noticed an issue with #3023 where mainnet3 helloworld addresses were
always used. This uses the correct environment and context
- Also noticed errors with key funder infra because the neutron rpc url
wasn't present - fixed the previous hack to accommodate this
- Filter out non evm or blessed chains from key funder as well

### Drive-by changes

n/a

### Related issues

related to #3024 

### Backward compatibility

yes

### Testing

ran locally
  • Loading branch information
tkporter authored Dec 7, 2023
1 parent 980ef1f commit 313a2ab
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
2 changes: 1 addition & 1 deletion typescript/infra/config/environments/mainnet3/funding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { environment } from './chains';
export const keyFunderConfig: KeyFunderConfig = {
docker: {
repo: 'gcr.io/abacus-labs-dev/hyperlane-monorepo',
tag: 'e152268-20231205-122327',
tag: 'b86ebc1-20231207-123951',
},
// We're currently using the same deployer key as mainnet.
// To minimize nonce clobbering we offset the key funder cron
Expand Down
2 changes: 1 addition & 1 deletion typescript/infra/config/environments/testnet4/funding.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { environment } from './chains';
export const keyFunderConfig: KeyFunderConfig = {
docker: {
repo: 'gcr.io/abacus-labs-dev/hyperlane-monorepo',
tag: 'e152268-20231205-122327',
tag: 'b86ebc1-20231207-123951',
},
// We're currently using the same deployer key as testnet2.
// To minimize nonce clobbering we offset the key funder cron
Expand Down
18 changes: 18 additions & 0 deletions typescript/infra/scripts/funding/fund-keys-from-deployer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
Address,
error,
log,
objFilter,
objMap,
promiseObjAll,
warn,
Expand All @@ -35,6 +36,7 @@ import { submitMetrics } from '../../src/utils/metrics';
import {
assertContext,
assertRole,
isEthereumProtocolChain,
readJSONAtPath,
} from '../../src/utils/utils';
import { getAgentConfig, getArgs, getEnvironmentConfig } from '../utils';
Expand Down Expand Up @@ -309,6 +311,22 @@ class ContextFunder {
public readonly rolesToFund: Role[],
public readonly skipIgpClaim: boolean,
) {
// At the moment, only blessed EVM chains are supported
roleKeysPerChain = objFilter(
roleKeysPerChain,
(chain, _roleKeys): _roleKeys is Record<Role, BaseCloudAgentKey[]> => {
const valid =
isEthereumProtocolChain(chain) &&
multiProvider.tryGetChainName(chain) !== null;
if (!valid) {
warn('Skipping funding for non-blessed or non-Ethereum chain', {
chain,
});
}
return valid;
},
);

this.igp = HyperlaneIgp.fromEnvironment(
deployEnvToSdkEnv[this.environment],
multiProvider,
Expand Down
12 changes: 8 additions & 4 deletions typescript/infra/src/agents/key-utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { ChainMap, ChainName } from '@hyperlane-xyz/sdk';
import { objMap } from '@hyperlane-xyz/utils';

import { Contexts } from '../../config/contexts';
import { helloWorld } from '../../config/environments/mainnet3/helloworld';
import { getHelloWorldConfig } from '../../scripts/helloworld/utils';
import { getEnvironmentConfig } from '../../scripts/utils';
import {
AgentContextConfig,
DeployEnvironment,
Expand Down Expand Up @@ -99,10 +100,13 @@ function getRoleKeyMapPerChain(
};

const setKathyKeys = () => {
const envConfig = getEnvironmentConfig(agentConfig.runEnv);
const helloWorldConfig = getHelloWorldConfig(
envConfig,
agentConfig.context,
);
// Kathy is only needed on chains where the hello world contracts are deployed.
for (const chainName of Object.keys(
helloWorld[agentConfig.context]?.addresses || {},
)) {
for (const chainName of Object.keys(helloWorldConfig.addresses)) {
const kathyKey = getKathyKeyForChain(agentConfig, chainName);
keysPerChain[chainName] = {
...keysPerChain[chainName],
Expand Down
2 changes: 1 addition & 1 deletion typescript/infra/src/funding/key-funder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ function getKeyFunderHelmValues(
hyperlane: {
runEnv: agentConfig.runEnv,
// Only used for fetching RPC urls as env vars
chains: agentConfig.contextChainNames.relayer, // temporary hack
chains: agentConfig.environmentChainNames,
contextFundingFrom: keyFunderConfig.contextFundingFrom,
contextsAndRolesToFund: keyFunderConfig.contextsAndRolesToFund,
connectionType: keyFunderConfig.connectionType,
Expand Down

0 comments on commit 313a2ab

Please sign in to comment.