Skip to content

Commit

Permalink
Fix IGP bytecode checking (#3128)
Browse files Browse the repository at this point in the history
### 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
  • Loading branch information
nambrot authored Jan 4, 2024
1 parent 612d416 commit efc2410
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 23 deletions.
8 changes: 4 additions & 4 deletions typescript/sdk/src/consts/bytecode.ts
Original file line number Diff line number Diff line change
@@ -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',
}
2 changes: 1 addition & 1 deletion typescript/sdk/src/core/HyperlaneCoreChecker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
28 changes: 10 additions & 18 deletions typescript/sdk/src/gas/HyperlaneIgpChecker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
],
);
}

Expand Down

0 comments on commit efc2410

Please sign in to comment.