Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v2' into trevor/jito-tx-submission
Browse files Browse the repository at this point in the history
  • Loading branch information
tkporter committed Mar 18, 2024
2 parents 2d23926 + f0551b6 commit a0b0f10
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:16-alpine
FROM node:18-alpine

WORKDIR /hyperlane-monorepo

Expand Down
2 changes: 1 addition & 1 deletion typescript/infra/config/environments/mainnet2/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: '98658d0-20231207-121541',
tag: '4798278-20240318-115942',
},
// We're currently using the same deployer key as mainnet.
// To minimize nonce clobbering we offset the key funder cron
Expand Down
58 changes: 58 additions & 0 deletions typescript/infra/scripts/funding/fund-keys-from-deployer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { EthBridger, getL2Network } from '@arbitrum/sdk';
import { Connection, PublicKey } from '@solana/web3.js';
import { BigNumber, ethers } from 'ethers';
import { Gauge, Registry } from 'prom-client';
import { format } from 'util';
Expand All @@ -21,6 +22,7 @@ import {
} from '@hyperlane-xyz/utils';

import { Contexts } from '../../config/contexts';
import { getSecretRpcEndpoint } from '../../src/agents';
import { KeyAsAddress, getRoleKeysPerChain } from '../../src/agents/key-utils';
import {
BaseCloudAgentKey,
Expand Down Expand Up @@ -431,6 +433,14 @@ class ContextFunder {
const failure = await this.attemptToFundKey(key, chain);
failureOccurred ||= failure;
}

if (
this.environment === 'mainnet2' &&
this.context === Contexts.Hyperlane
) {
this.updateSolanaWalletBalanceGauge();
}

return failureOccurred;
});

Expand Down Expand Up @@ -709,6 +719,54 @@ class ContextFunder {
),
);
}

private async updateSolanaWalletBalanceGauge() {
const chain = 'solana';

const solanaRpcUrls = await getSecretRpcEndpoint(
this.environment,
chain,
false,
);
const solanaProvider = new Connection(solanaRpcUrls[0], 'confirmed');
const accounts = [
{
// The Solana relayer
pubkey: new PublicKey('CLT7m1JBCqJx6FM3obi9ohTnML1zmdzFcX2SgWj1D8qV'),
walletName: 'relayer',
},
{
// The account used to pay for state rent used by new ZBC balances
pubkey: new PublicKey('DRoxXLkV2sAsZb7bPbCJQnucTxvQCcfzfmThC3ZVNorv'),
walletName: 'nautilus-zbc-rent',
},
];

for (const { pubkey, walletName } of accounts) {
log('Fetching Solana wallet balance', {
chain,
pubkey: pubkey.toString(),
walletName,
});
const balance = await solanaProvider.getBalance(pubkey);
log('Got Solana wallet balance', {
balance,
chain,
pubkey: pubkey.toString(),
walletName,
});
walletBalanceGauge
.labels({
chain,
wallet_address: pubkey.toString(),
wallet_name: walletName,
token_symbol: 'Native',
token_name: 'Native',
...constMetricLabels,
})
.set(balance / 1e9);
}
}
}

async function getAddressInfo(
Expand Down

0 comments on commit a0b0f10

Please sign in to comment.