Fix IGP bytecode checking (#3128)

### Description

Can't really explain it, but we had some misnamed bytecode constants
that I had to fix up. Also checked the bytecodes in the IGP checker
pull/3134/head
Nam Chu Hoai 11 months ago committed by GitHub
parent 612d4163ac
commit efc2410ed6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      typescript/sdk/src/consts/bytecode.ts
  2. 2
      typescript/sdk/src/core/HyperlaneCoreChecker.ts
  3. 28
      typescript/sdk/src/gas/HyperlaneIgpChecker.ts

@ -1,11 +1,11 @@
export enum BytecodeHash {
V3_MAILBOX_BYTECODE_HASH = '0x6e853444a6e38bb1d7ac7608b92a70cee83153c891c70ed882b2432134bb23a0', // without optimizer
OPT_V3_MAILBOX_BYTECODE_HASH = '0x7cc944e10fa5597f10265bdac4a808e705711451ee7f117ebf9a97193b796136', // with optimizer
TRANSPARENT_PROXY_BYTECODE_HASH = '0x320bda003dfa31828115be5c01b9f3e7eecaf2532afdb89d2b53559f2e7ab86d',
PROXY_ADMIN_BYTECODE_HASH = '0x13855ae57da3aadecb9259cecece16e1f434b8850fe95531f422e4e262f3f200', // without optimizer
OPT_PROXY_ADMIN_BYTECODE_HASH = '0x30aa3b1506a94c0fe2749af099851623685d9a24a65e2e8b3746c272499979d1', // with optimizer
TRANSPARENT_PROXY_BYTECODE_HASH = '0x320bda003dfa31828115be5c01b9f3e7eecaf2532afdb89d2b53559f2e7ab86d', // without optimizer
OPT_TRANSPARENT_PROXY_BYTECODE_HASH = '0x30aa3b1506a94c0fe2749af099851623685d9a24a65e2e8b3746c272499979d1', // with optimizer
PROXY_ADMIN_BYTECODE_HASH = '0x13855ae57da3aadecb9259cecece16e1f434b8850fe95531f422e4e262f3f200',
V2_PROXY_ADMIN_BYTECODE_HASH = '0x7c378e9d49408861ca754fe684b9f7d1ea525bddf095ee0463902df701453ba0', // reused from v2
INTERCHAIN_GAS_PAYMASTER_BYTECODE_HASH = '0xe995bcd732f4861606036357edb2a4d4c3e9b8d7e599fe548790ac1cf26888f8',
INTERCHAIN_GAS_PAYMASTER_BYTECODE_HASH = '0x69325ab0957fcca37e2eac622af6186380f4cddb279183a97c37511459d40f18',
OWNER_INITIALIZABLE_INTERCHAIN_GAS_PAYMASTER_BYTECODE_HASH = '0xd2c5b00ac2d058117491d581d63c3c4fcf6aeb2667c6cc0c7caed359c9eebea1',
OVERHEAD_IGP_BYTECODE_HASH = '0x3cfed1f24f1e9b28a76d5a8c61696a04f7bc474404b823a2fcc210ea52346252',
}

@ -156,7 +156,7 @@ export class HyperlaneCoreChecker extends HyperlaneAppChecker<
contracts.mailbox.address,
[
BytecodeHash.TRANSPARENT_PROXY_BYTECODE_HASH,
BytecodeHash.OPT_PROXY_ADMIN_BYTECODE_HASH,
BytecodeHash.OPT_TRANSPARENT_PROXY_BYTECODE_HASH,
],
);
await this.checkBytecode(

@ -40,12 +40,6 @@ export class HyperlaneIgpChecker extends HyperlaneAppChecker<
async checkBytecodes(chain: ChainName): Promise<void> {
const contracts = this.app.getContracts(chain);
await this.checkBytecode(
chain,
'InterchainGasPaymaster proxy',
contracts.interchainGasPaymaster.address,
[BytecodeHash.TRANSPARENT_PROXY_BYTECODE_HASH],
);
const implementation = await proxyImplementation(
this.multiProvider.getProvider(chain),
contracts.interchainGasPaymaster.address,
@ -55,24 +49,22 @@ export class HyperlaneIgpChecker extends HyperlaneAppChecker<
'InterchainGasPaymaster implementation',
implementation,
[BytecodeHash.INTERCHAIN_GAS_PAYMASTER_BYTECODE_HASH],
(bytecode) =>
bytecode // We persist the block number in the bytecode now too, so we have to strip it
.replaceAll(
/(00000000000000000000000000000000000000000000000000000000[a-f0-9]{0,22})81565/g,
(match, _offset) => (match.length % 2 === 0 ? '' : '0'),
),
);
await this.checkBytecode(
chain,
'InterchainGasPaymaster proxy',
contracts.interchainGasPaymaster.address,
[BytecodeHash.TRANSPARENT_PROXY_BYTECODE_HASH],
(bytecode) =>
bytecode
// We persist the block number in the bytecode now too, so we have to strip it
.replaceAll(
/(00000000000000000000000000000000000000000000000000000000[a-f0-9]{0,22})81565/g,
(match, _offset) => (match.length % 2 === 0 ? '' : '0'),
)
.replaceAll(
/(0000000000000000000000000000000000000000000000000000[a-f0-9]{0,22})6118123373/g,
(match, _offset) => (match.length % 2 === 0 ? '' : '0'),
),
[
BytecodeHash.TRANSPARENT_PROXY_BYTECODE_HASH,
BytecodeHash.OPT_TRANSPARENT_PROXY_BYTECODE_HASH,
],
);
}

Loading…
Cancel
Save