trevor/read-txs-nov-8
Trevor Porter 3 weeks ago
parent 9eaa1559cc
commit 085aaee2a4
  1. 4
      typescript/infra/scripts/safes/ethereum-safe-tx-oct-30.json
  2. 4
      typescript/infra/scripts/safes/example-data.json
  3. 15
      typescript/infra/scripts/safes/parse-multicall.ts
  4. 72
      typescript/infra/src/tx/transaction-reader.ts
  5. 133
      typescript/sdk/src/consts/multisigIsm.ts
  6. 2
      typescript/sdk/src/utils/ism.ts

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -1,12 +1,10 @@
import { normalizeConfig } from '@hyperlane-xyz/sdk'; import { stringifyObject } from '@hyperlane-xyz/utils';
import { stringifyObject, strip0x } from '@hyperlane-xyz/utils';
import { TransactionReader } from '../../src/tx/transaction-reader.js'; import { TransactionReader } from '../../src/tx/transaction-reader.js';
import { readYaml } from '../../src/utils/utils.js';
import { getArgs } from '../agent-utils.js'; import { getArgs } from '../agent-utils.js';
import { getEnvironmentConfig, getHyperlaneCore } from '../core-utils.js'; import { getEnvironmentConfig, getHyperlaneCore } from '../core-utils.js';
import tx from './example-data.json'; import tx from './ethereum-safe-tx-oct-30.json';
async function main() { async function main() {
const { environment } = await getArgs().argv; const { environment } = await getArgs().argv;
@ -14,15 +12,6 @@ async function main() {
const multiProvider = await config.getMultiProvider(); const multiProvider = await config.getMultiProvider();
const { chainAddresses } = await getHyperlaneCore(environment, multiProvider); const { chainAddresses } = await getHyperlaneCore(environment, multiProvider);
// const yaml: any = readYaml('/Users/trevor/example-mismatch.yaml');
// const mismatch = yaml[0];
// const normalizedDerived = normalizeConfig(mismatch.derivedConfig);
// const normalizedExpected = normalizeConfig(mismatch.expectedIsmConfig);
// console.log('\n\n\n\n\n\nDerived:', stringifyObject(normalizedDerived, 'yaml', 2));
// console.log('\n\n\n\n\n\nExpected:', stringifyObject(normalizedExpected, 'yaml', 2));
// return;
const reader = new TransactionReader( const reader = new TransactionReader(
environment, environment,
multiProvider, multiProvider,

@ -4,7 +4,6 @@ import {
MetaTransactionData, MetaTransactionData,
OperationType, OperationType,
} from '@safe-global/safe-core-sdk-types'; } from '@safe-global/safe-core-sdk-types';
import { deepEqual } from 'assert';
import { BigNumber, ethers } from 'ethers'; import { BigNumber, ethers } from 'ethers';
import { import {
@ -37,27 +36,6 @@ import {
import { DeployEnvironment } from '../config/environment.js'; import { DeployEnvironment } from '../config/environment.js';
import { getSafeAndService } from '../utils/safe.js'; import { getSafeAndService } from '../utils/safe.js';
// export abstract class TransactionReader {
// async read(chain: ChainName, tx: any): Promise<any> {
// throw new Error('Not implemented');
// }
// }
// export class GnosisMultisendReader extends TransactionReader {
// constructor(multiProvider: MultiProvider) {
// super();
// }
// async read(chain: ChainName, tx: AnnotatedEV5Transaction): Promise<any> {
// if (!tx.data) {
// return undefined;
// }
// const multisends = decodeMultiSendData(tx.data);
// return multisends;
// }
// }
export class TransactionReader extends HyperlaneReader { export class TransactionReader extends HyperlaneReader {
errors: any[] = []; errors: any[] = [];
@ -235,12 +213,9 @@ export class TransactionReader extends HyperlaneReader {
const expectedIsmConfig = this.coreConfig[chain].defaultIsm; const expectedIsmConfig = this.coreConfig[chain].defaultIsm;
let insight = '✅ matches expected ISM config'; let insight = '✅ matches expected ISM config';
if ( const normalizedDerived = normalizeConfig(derivedConfig);
!deepEquals( const normalizedExpected = normalizeConfig(expectedIsmConfig);
normalizeConfig(derivedConfig), if (!deepEquals(normalizedDerived, normalizedExpected)) {
normalizeConfig(expectedIsmConfig),
)
) {
this.errors.push({ this.errors.push({
chain: chain, chain: chain,
module, module,
@ -249,6 +224,12 @@ export class TransactionReader extends HyperlaneReader {
info: 'Incorrect default ISM being set', info: 'Incorrect default ISM being set',
}); });
insight = `❌ fatal mismatch of ISM config`; insight = `❌ fatal mismatch of ISM config`;
console.log(
'Mismatch of ISM config',
chain,
JSON.stringify(normalizedDerived),
JSON.stringify(normalizedExpected),
);
} }
return { return {
@ -333,7 +314,6 @@ export class TransactionReader extends HyperlaneReader {
value: BigNumber.from(call[1]), value: BigNumber.from(call[1]),
data: call[2], data: call[2],
}; };
console.log('call', call, 'icaCallAsTx', icaCallAsTx);
return this.read(remoteChainName, icaCallAsTx); return this.read(remoteChainName, icaCallAsTx);
}), }),
); );
@ -357,37 +337,6 @@ export class TransactionReader extends HyperlaneReader {
}, },
calls: decodedCalls, calls: decodedCalls,
}; };
// if (!tx.data) {
// console.log('No data in ICA transaction');
// return undefined;
// }
// const { symbol } = await this.multiProvider.getNativeToken(chain);
// const decoded =
// interchainAccountFactories.interchainAccountRouter.interface.parseTransaction(
// {
// data: tx.data,
// value: tx.value,
// },
// );
// const args = formatFunctionFragmentArgs(
// decoded.args,
// decoded.functionFragment,
// );
// let prettyArgs = args;
// if (decoded.functionFragment.name === 'enrollRemoteRouters') {
// prettyArgs = await this.formatRouterEnrollments(
// chain,
// 'interchainAccountRouter',
// args,
// );
// } else if (decoded.functionFragment.name === 'callRemoteWithOverrides') {
// const remoteChainName = this.multiProvider.getChainName(args._domain);
// const remoteRouter = this.chainAddresses[remoteChainName].interchainAccountRouter;
// const matchesExpectedRouter =
// eqAddress(remoteRouter, bytes32ToAddress(args._router)) &&
// // Poor
} }
private async readMultisendTransaction( private async readMultisendTransaction(
@ -402,9 +351,6 @@ export class TransactionReader extends HyperlaneReader {
const { symbol } = await this.multiProvider.getNativeToken(chain); const { symbol } = await this.multiProvider.getNativeToken(chain);
// TODO rm
// const truncated = multisends.slice(0, 5);
return Promise.all( return Promise.all(
multisends.map(async (multisend, index) => { multisends.map(async (multisend, index) => {
const decoded = await this.read( const decoded = await this.read(

@ -31,8 +31,12 @@ export const defaultMultisigConfigs: ChainMap<MultisigConfig> = {
}, },
apechain: { apechain: {
threshold: 1, threshold: 2,
validators: ['0x773d7fe6ffb1ba4de814c28044ff9a2d83a48221'], validators: [
'0x773d7fe6ffb1ba4de814c28044ff9a2d83a48221',
'0xcf0211fafbb91fd9d06d7e306b30032dc3a1934f', // merkly
'0x4f977a59fdc2d9e39f6d780a84d5b4add1495a36', // mitosis
],
}, },
arbitrum: { arbitrum: {
@ -47,8 +51,12 @@ export const defaultMultisigConfigs: ChainMap<MultisigConfig> = {
}, },
arbitrumnova: { arbitrumnova: {
threshold: 1, threshold: 2,
validators: ['0xd2a5e9123308d187383c87053811a2c21bd8af1f'], validators: [
'0xd2a5e9123308d187383c87053811a2c21bd8af1f',
'0xcf0211fafbb91fd9d06d7e306b30032dc3a1934f', // merkly
'0x4f977a59fdc2d9e39f6d780a84d5b4add1495a36', // mitosis
],
}, },
arbitrumsepolia: { arbitrumsepolia: {
@ -89,8 +97,12 @@ export const defaultMultisigConfigs: ChainMap<MultisigConfig> = {
}, },
b3: { b3: {
threshold: 1, threshold: 2,
validators: ['0xd77b516730a836fc41934e7d5864e72c165b934e'], validators: [
'0xd77b516730a836fc41934e7d5864e72c165b934e',
'0xcf0211fafbb91fd9d06d7e306b30032dc3a1934f', // merkly
'0x4f977a59fdc2d9e39f6d780a84d5b4add1495a36', // mitosis
],
}, },
base: { base: {
@ -181,6 +193,7 @@ export const defaultMultisigConfigs: ChainMap<MultisigConfig> = {
validators: [ validators: [
'0x478fb53c6860ae8fc35235ba0d38d49b13128226', '0x478fb53c6860ae8fc35235ba0d38d49b13128226',
'0xcf0211fafbb91fd9d06d7e306b30032dc3a1934f', // merkly '0xcf0211fafbb91fd9d06d7e306b30032dc3a1934f', // merkly
'0x101cE77261245140A0871f9407d6233C8230Ec47', // blockhunters
], ],
}, },
@ -300,8 +313,12 @@ export const defaultMultisigConfigs: ChainMap<MultisigConfig> = {
}, },
fantom: { fantom: {
threshold: 1, threshold: 2,
validators: ['0xa779572028e634e16f26af5dfd4fa685f619457d'], validators: [
'0xa779572028e634e16f26af5dfd4fa685f619457d',
'0xcf0211fafbb91fd9d06d7e306b30032dc3a1934f', // merkly
'0x4f977a59fdc2d9e39f6d780a84d5b4add1495a36', // mitosis
],
}, },
flare: { flare: {
@ -365,13 +382,21 @@ export const defaultMultisigConfigs: ChainMap<MultisigConfig> = {
}, },
gravity: { gravity: {
threshold: 1, threshold: 2,
validators: ['0x23d549bf757a02a6f6068e9363196ecd958c974e'], validators: [
'0x23d549bf757a02a6f6068e9363196ecd958c974e',
'0xcf0211fafbb91fd9d06d7e306b30032dc3a1934f', // merkly
'0x4f977a59fdc2d9e39f6d780a84d5b4add1495a36', // mitosis
],
}, },
harmony: { harmony: {
threshold: 1, threshold: 2,
validators: ['0xd677803a67651974b1c264171b5d7ca8838db8d5'], validators: [
'0xd677803a67651974b1c264171b5d7ca8838db8d5',
'0xcf0211fafbb91fd9d06d7e306b30032dc3a1934f', // merkly
'0x4f977a59fdc2d9e39f6d780a84d5b4add1495a36', // mitosis
],
}, },
holesky: { holesky: {
@ -412,8 +437,12 @@ export const defaultMultisigConfigs: ChainMap<MultisigConfig> = {
}, },
kaia: { kaia: {
threshold: 1, threshold: 2,
validators: ['0x9de0b3abb221d19719882fa4d61f769fdc2be9a4'], validators: [
'0x9de0b3abb221d19719882fa4d61f769fdc2be9a4',
'0xcf0211fafbb91fd9d06d7e306b30032dc3a1934f', // merkly
'0x4f977a59fdc2d9e39f6d780a84d5b4add1495a36', // mitosis
],
}, },
kroma: { kroma: {
@ -435,11 +464,14 @@ export const defaultMultisigConfigs: ChainMap<MultisigConfig> = {
}, },
lisk: { lisk: {
threshold: 2, threshold: 4,
validators: [ validators: [
'0xc0b282aa5bac43fee83cf71dc3dd1797c1090ea5', '0xc0b282aa5bac43fee83cf71dc3dd1797c1090ea5',
'0xcf0211fafbb91fd9d06d7e306b30032dc3a1934f', // merkly '0x0d4c1394a255568ec0ecd11795b28d1bda183ca4', // tessellated (superlane)
'0x4f977a59fdc2d9e39f6d780a84d5b4add1495a36', // mitosis '0x3DA4ee2801Ec6CC5faD73DBb94B10A203ADb3d9e', // enigma (superlane)
'0x4df6e8878992c300e7bfe98cac6bf7d3408b9cbf', // imperator (superlane)
'0x14d0B24d3a8F3aAD17DB4b62cBcEC12821c98Cb3', // bware (superlane)
'0xf0da628f3fb71652d48260bad4691054045832ce', // luganodes (superlane)
], ],
}, },
@ -520,12 +552,14 @@ export const defaultMultisigConfigs: ChainMap<MultisigConfig> = {
}, },
mode: { mode: {
threshold: 3, threshold: 4,
validators: [ validators: [
'0x7eb2e1920a4166c19d6884c1cec3d2cf356fc9b7', '0x7eb2e1920a4166c19d6884c1cec3d2cf356fc9b7',
'0x4f977a59fdc2d9e39f6d780a84d5b4add1495a36', // mitosis '0x0d4c1394a255568ec0ecd11795b28d1bda183ca4', // tessellated (superlane)
'0x7e29608c6e5792bbf9128599ca309be0728af7b4', // renzo '0x65C140e3a05F33192384AffEF985696Fe3cDDE42', // enigma (superlane)
'0x101cE77261245140A0871f9407d6233C8230Ec47', // blockhunters '0x20eade18ea2af6dfd54d72b3b5366b40fcb47f4b', // imperator (superlane)
'0x14d0B24d3a8F3aAD17DB4b62cBcEC12821c98Cb3', // bware (superlane)
'0x485a4f0009d9afbbf44521016f9b8cdd718e36ea', // luganodes (superlane)
], ],
}, },
@ -549,8 +583,12 @@ export const defaultMultisigConfigs: ChainMap<MultisigConfig> = {
}, },
morph: { morph: {
threshold: 1, threshold: 2,
validators: ['0x4884535f393151ec419add872100d352f71af380'], validators: [
'0x4884535f393151ec419add872100d352f71af380',
'0xcf0211fafbb91fd9d06d7e306b30032dc3a1934f', // merkly
'0x4f977a59fdc2d9e39f6d780a84d5b4add1495a36', // mitosis
],
}, },
neutron: { neutron: {
@ -581,13 +619,14 @@ export const defaultMultisigConfigs: ChainMap<MultisigConfig> = {
}, },
optimism: { optimism: {
threshold: 3, threshold: 4,
validators: [ validators: [
'0x20349eadc6c72e94ce38268b96692b1a5c20de4f', '0x20349eadc6c72e94ce38268b96692b1a5c20de4f',
'0x5b7d47b76c69740462432f6a5a0ca5005e014157', // dsrv '0x0d4c1394a255568ec0ecd11795b28d1bda183ca4', // tessellated (superlane)
'0x38c7a4ca1273ead2e867d096adbcdd0e2acb21d8', // everstake '0xd8c1cCbfF28413CE6c6ebe11A3e29B0D8384eDbB', // enigma (superlane)
'0xb3ac35d3988bca8c2ffd195b1c6bee18536b317b', // staked '0x1b9e5f36c4bfdb0e3f0df525ef5c888a4459ef99', // imperator (superlane)
'0x5450447aee7b544c462c9352bef7cad049b0c2dc', // zeeprime '0x14d0B24d3a8F3aAD17DB4b62cBcEC12821c98Cb3', // bware (superlane)
'0xf9dfaa5c20ae1d84da4b2696b8dc80c919e48b12', // luganodes (superlane)
], ],
}, },
@ -597,8 +636,12 @@ export const defaultMultisigConfigs: ChainMap<MultisigConfig> = {
}, },
orderly: { orderly: {
threshold: 1, threshold: 2,
validators: ['0xec3dc91f9fa2ad35edf5842aa764d5573b778bb6'], validators: [
'0xec3dc91f9fa2ad35edf5842aa764d5573b778bb6',
'0xcf0211fafbb91fd9d06d7e306b30032dc3a1934f', // merkly
'0x4f977a59fdc2d9e39f6d780a84d5b4add1495a36', // mitosis
],
}, },
osmosis: { osmosis: {
@ -672,11 +715,12 @@ export const defaultMultisigConfigs: ChainMap<MultisigConfig> = {
}, },
redstone: { redstone: {
threshold: 2, threshold: 3,
validators: [ validators: [
'0x1400b9737007f7978d8b4bbafb4a69c83f0641a7', '0x1400b9737007f7978d8b4bbafb4a69c83f0641a7',
'0xcf0211fafbb91fd9d06d7e306b30032dc3a1934f', // merkly '0xcf0211fafbb91fd9d06d7e306b30032dc3a1934f', // merkly
'0x4f977a59fdc2d9e39f6d780a84d5b4add1495a36', // mitosis '0x4f977a59fdc2d9e39f6d780a84d5b4add1495a36', // mitosis
'0x101cE77261245140A0871f9407d6233C8230Ec47', // blockhunters
], ],
}, },
@ -746,8 +790,12 @@ export const defaultMultisigConfigs: ChainMap<MultisigConfig> = {
}, },
snaxchain: { snaxchain: {
threshold: 1, threshold: 2,
validators: ['0x2c25829ae32a772d2a49f6c4b34f8b01fd03ef9e'], validators: [
'0x2c25829ae32a772d2a49f6c4b34f8b01fd03ef9e',
'0xcf0211fafbb91fd9d06d7e306b30032dc3a1934f', // merkly
'0x4f977a59fdc2d9e39f6d780a84d5b4add1495a36', // mitosis
],
}, },
solanadevnet: { solanadevnet: {
@ -797,7 +845,7 @@ export const defaultMultisigConfigs: ChainMap<MultisigConfig> = {
'0x87460dcEd16a75AECdBffD4189111d30B099f5b0', // enigma '0x87460dcEd16a75AECdBffD4189111d30B099f5b0', // enigma
'0xf54982134e52Eb7253236943FBffE0886C5bde0C', // L5 '0xf54982134e52Eb7253236943FBffE0886C5bde0C', // L5
'0x5937b7cE1029C3Ec4bD8e1AaCc0C0f9422654D7d', // stakecito '0x5937b7cE1029C3Ec4bD8e1AaCc0C0f9422654D7d', // stakecito
'0x3a446ed2923c08445af06e53f0acb558c0e0413c', // staked '0xb3ac35d3988bca8c2ffd195b1c6bee18536b317b', // staked
], ],
}, },
@ -881,8 +929,12 @@ export const defaultMultisigConfigs: ChainMap<MultisigConfig> = {
}, },
zeronetwork: { zeronetwork: {
threshold: 1, threshold: 2,
validators: ['0x1bd9e3f8a90ea1a13b0f2838a1858046368aad87'], validators: [
'0x1bd9e3f8a90ea1a13b0f2838a1858046368aad87',
'0xcf0211fafbb91fd9d06d7e306b30032dc3a1934f', // merkly
'0x4f977a59fdc2d9e39f6d780a84d5b4add1495a36', // mitosis
],
}, },
zetachain: { zetachain: {
@ -906,8 +958,13 @@ export const defaultMultisigConfigs: ChainMap<MultisigConfig> = {
}, },
zksync: { zksync: {
threshold: 1, threshold: 3,
validators: ['0xadd1d39ce7a687e32255ac457cf99a6d8c5b5d1a'], validators: [
'0xadd1d39ce7a687e32255ac457cf99a6d8c5b5d1a',
'0xcf0211fafbb91fd9d06d7e306b30032dc3a1934f', // merkly
'0x4f977a59fdc2d9e39f6d780a84d5b4add1495a36', // mitosis
'0x75237d42ce8ea27349a0254ada265db94157e0c1', // imperator
],
}, },
zoramainnet: { zoramainnet: {

@ -25,7 +25,7 @@ function lowerCaseConfig(obj: any): any {
} else if (obj !== null && typeof obj === 'object') { } else if (obj !== null && typeof obj === 'object') {
const newObj: any = {}; const newObj: any = {};
for (const key in obj) { for (const key in obj) {
if (key !== 'address') { if (key !== 'address' && key !== 'ownerOverrides') {
newObj[key] = key === 'type' ? obj[key] : normalizeConfig(obj[key]); newObj[key] = key === 'type' ? obj[key] : normalizeConfig(obj[key]);
} }
} }

Loading…
Cancel
Save