feat: tweak keyfunder params (#3301)

resolves https://github.com/hyperlane-xyz/issues/issues/1103

- tune down eth L1 required balance
- tune down L2s required balance
- improve comment r.e. 5x L1->L2 multiplier
- update + tidy up L2Chains types

---------

Signed-off-by: Paul Balaji <paul@hyperlane.xyz>
pull/3382/head
Paul Balaji 9 months ago committed by GitHub
parent 3740256d97
commit 9abdf7c832
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 15
      typescript/infra/config/environments/mainnet3/funding.ts
  2. 9
      typescript/infra/config/environments/testnet4/funding.ts
  3. 62
      typescript/infra/scripts/funding/fund-keys-from-deployer.ts

@ -9,7 +9,7 @@ import { environment } from './chains';
export const keyFunderConfig: KeyFunderConfig = {
docker: {
repo: 'gcr.io/abacus-labs-dev/hyperlane-monorepo',
tag: 'c037206-20240220-152500',
tag: '402a7d4-20240308-134716',
},
// We're currently using the same deployer key as mainnet.
// To minimize nonce clobbering we offset the key funder cron
@ -26,20 +26,21 @@ export const keyFunderConfig: KeyFunderConfig = {
connectionType: RpcConsensusType.Single,
// desired balance config
desiredBalancePerChain: {
arbitrum: '3',
avalanche: '5',
base: '3',
bsc: '5',
celo: '3',
ethereum: '5',
ethereum: '0.5',
gnosis: '5',
inevm: '3',
moonbeam: '5',
optimism: '3',
polygon: '20',
polygonzkevm: '3',
scroll: '3',
viction: '3',
// Funder boosts itself upto 5x balance on L2 before dispersing funds
arbitrum: '0.5',
base: '0.5',
optimism: '0.5',
polygonzkevm: '0.5',
scroll: '0.5',
},
desiredKathyBalancePerChain: {
arbitrum: '0.1',

@ -9,7 +9,7 @@ import { environment } from './chains';
export const keyFunderConfig: KeyFunderConfig = {
docker: {
repo: 'gcr.io/abacus-labs-dev/hyperlane-monorepo',
tag: 'c037206-20240220-152500',
tag: '402a7d4-20240308-134716',
},
// We're currently using the same deployer key as testnet2.
// To minimize nonce clobbering we offset the key funder cron
@ -27,16 +27,17 @@ export const keyFunderConfig: KeyFunderConfig = {
// desired balance config
desiredBalancePerChain: {
alfajores: '5',
arbitrumgoerli: '0.5',
bsctestnet: '5',
fuji: '5',
goerli: '0.5',
mumbai: '5',
optimismgoerli: '0.5',
plumetestnet: '0.2',
sepolia: '5',
// Funder boosts itself upto 5x balance on L2 before dispersing funds
arbitrumgoerli: '0.5',
optimismgoerli: '0.5',
polygonzkevmtestnet: '1',
scrollsepolia: '1',
sepolia: '5',
},
desiredKathyBalancePerChain: {
plumetestnet: '0.05',

@ -65,29 +65,36 @@ const nativeBridges = {
},
};
type L2Chain =
| Chains.optimism
| Chains.optimismgoerli
| Chains.arbitrum
| Chains.arbitrumgoerli
| Chains.base;
const L2Chains: ChainName[] = [
const ArbNitroChains = [Chains.arbitrum, Chains.arbitrumgoerli] as const;
const OPStackChains = [
Chains.base,
Chains.optimism,
Chains.optimismgoerli,
Chains.arbitrum,
Chains.arbitrumgoerli,
Chains.base,
] as const;
const PolygonCDKChains = [
Chains.polygonzkevm,
Chains.polygonzkevmtestnet,
] as const;
const ScrollZkEvmChains = [Chains.scroll, Chains.scrollsepolia] as const;
type L2Chain = (typeof L2Chains)[number];
const L2Chains: string[] = [
...ArbNitroChains,
...OPStackChains,
...PolygonCDKChains,
...ScrollZkEvmChains,
];
const L2ToL1: ChainMap<ChainName> = {
optimismgoerli: 'goerli',
arbitrumgoerli: 'goerli',
optimism: 'ethereum',
arbitrum: 'ethereum',
base: 'ethereum',
polygonzkevmtestnet: 'goerli',
const L2ToL1: Record<L2Chain, Chains> = {
arbitrum: Chains.ethereum,
arbitrumgoerli: Chains.goerli,
base: Chains.ethereum,
optimism: Chains.ethereum,
optimismgoerli: Chains.goerli,
polygonzkevm: Chains.ethereum,
polygonzkevmtestnet: Chains.goerli,
scroll: Chains.ethereum,
scrollsepolia: Chains.sepolia,
};
// Missing types declaration for bufio
@ -126,6 +133,9 @@ const MIN_DELTA_DENOMINATOR = ethers.BigNumber.from(10);
const RC_FUNDING_DISCOUNT_NUMERATOR = ethers.BigNumber.from(2);
const RC_FUNDING_DISCOUNT_DENOMINATOR = ethers.BigNumber.from(10);
// Funder should have desired balance multiplied by this constant
const L2_BRIDGING_MULTIPLIER = 5;
// The balance threshold of the IGP contract that must be met for the key funder
// to call `claim()`
const igpClaimThresholdPerChain: ChainMap<string> = {
@ -545,13 +555,13 @@ class ContextFunder {
this.desiredBalancePerChain[chain],
'ether',
);
// Optionally bridge ETH to L2 before funding the desired key.
// By bridging the funder with 10x the desired balance we save
// on L1 gas.
// When bridging ETH to L2 before funding the desired key, we top up funder
// to a constant multiplier of the desired balance. This reduces our spend
// on L1 gas by reducing the frequency of L1 operations.
const bridgeAmount = await this.getFundingAmount(
chain,
funderAddress,
desiredBalanceEther.mul(5),
desiredBalanceEther.mul(L2_BRIDGING_MULTIPLIER),
);
if (bridgeAmount.gt(0)) {
await this.bridgeToL2(chain as L2Chain, funderAddress, bridgeAmount);
@ -698,13 +708,13 @@ class ContextFunder {
),
});
let tx;
if (l2Chain.includes('optimism') || l2Chain.includes('base')) {
if ((OPStackChains as readonly string[]).includes(l2Chain)) {
tx = await this.bridgeToOptimism(l2Chain, amount, to);
} else if (l2Chain.includes('arbitrum')) {
} else if ((ArbNitroChains as readonly string[]).includes(l2Chain)) {
tx = await this.bridgeToArbitrum(l2Chain, amount);
} else if (l2Chain.includes('scroll')) {
} else if ((ScrollZkEvmChains as readonly string[]).includes(l2Chain)) {
tx = await this.bridgeToScroll(l2Chain, amount, to);
} else if (l2Chain.includes('zkevm')) {
} else if ((PolygonCDKChains as readonly string[]).includes(l2Chain)) {
tx = await this.bridgeToPolygonCDK(l2Chain, amount, to);
} else {
throw new Error(`${l2Chain} is not an L2`);

Loading…
Cancel
Save