diff --git a/Dockerfile b/Dockerfile index 3b9b30b71a..ec3c51ce6d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:16-alpine +FROM node:18-alpine WORKDIR /hyperlane-monorepo diff --git a/typescript/infra/config/environments/mainnet2/funding.ts b/typescript/infra/config/environments/mainnet2/funding.ts index 22b7e95abc..d25145a6e2 100644 --- a/typescript/infra/config/environments/mainnet2/funding.ts +++ b/typescript/infra/config/environments/mainnet2/funding.ts @@ -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 diff --git a/typescript/infra/scripts/funding/fund-keys-from-deployer.ts b/typescript/infra/scripts/funding/fund-keys-from-deployer.ts index a319f05f63..37ec1ff8cd 100644 --- a/typescript/infra/scripts/funding/fund-keys-from-deployer.ts +++ b/typescript/infra/scripts/funding/fund-keys-from-deployer.ts @@ -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'; @@ -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, @@ -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; }); @@ -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(