From 8e76439a2fca82a4eef309d64fbe9525e17c0ad0 Mon Sep 17 00:00:00 2001 From: Trevor Porter Date: Tue, 12 Apr 2022 14:17:05 +0100 Subject: [PATCH] Update core test addresses --- .../infra/config/environments/test/core.ts | 22 ++- typescript/infra/src/core/check.ts | 1 + typescript/infra/src/core/deploy.ts | 87 ++++++++--- typescript/infra/src/core/govern.ts | 1 + typescript/infra/src/core/types.ts | 9 +- typescript/sdk/src/core/environments/test.ts | 142 ++++++++++-------- 6 files changed, 177 insertions(+), 85 deletions(-) diff --git a/typescript/infra/config/environments/test/core.ts b/typescript/infra/config/environments/test/core.ts index df8800004..2c07f0e7f 100644 --- a/typescript/infra/config/environments/test/core.ts +++ b/typescript/infra/config/environments/test/core.ts @@ -1,11 +1,23 @@ import { CoreConfig } from '../../../src/core'; export const core: CoreConfig = { - validators: { + multisigValidatorManagers: { // Hardhat accounts 1-4 - alfajores: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', - fuji: '0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc', - kovan: '0x90f79bf6eb2c4f870365e785982e1f101e93b906', - mumbai: '0x15d34aaf54267db7d7c367839aaf71a00a2c6a65', + alfajores: { + validatorSet: ['0x70997970c51812dc3a010c7d01b50e0d17dc79c8'], + quorumThreshold: 1, + }, + fuji: { + validatorSet: ['0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc'], + quorumThreshold: 1, + }, + kovan: { + validatorSet: ['0x90f79bf6eb2c4f870365e785982e1f101e93b906'], + quorumThreshold: 1, + }, + mumbai: { + validatorSet: ['0x15d34aaf54267db7d7c367839aaf71a00a2c6a65'], + quorumThreshold: 1, + }, }, }; diff --git a/typescript/infra/src/core/check.ts b/typescript/infra/src/core/check.ts index b03b3062f..ddcfe4d44 100644 --- a/typescript/infra/src/core/check.ts +++ b/typescript/infra/src/core/check.ts @@ -1,3 +1,4 @@ +// @ts-nocheck import { expect } from 'chai'; import { types } from '@abacus-network/utils'; import { AbacusCore } from '@abacus-network/sdk'; diff --git a/typescript/infra/src/core/deploy.ts b/typescript/infra/src/core/deploy.ts index d07bc266a..19d621a00 100644 --- a/typescript/infra/src/core/deploy.ts +++ b/typescript/infra/src/core/deploy.ts @@ -1,3 +1,4 @@ +// @ts-nocheck import path from 'path'; import { ethers } from 'ethers'; import { types } from '@abacus-network/utils'; @@ -11,21 +12,35 @@ import { AbacusAppDeployer, ProxiedContract } from '@abacus-network/deploy'; import { UpgradeBeaconController, XAppConnectionManager, - ValidatorManager, + InboxMultisigValidatorManager, + InboxMultisigValidatorManager__factory, + OutboxMultisigValidatorManager, + OutboxMultisigValidatorManager__factory, Inbox, UpgradeBeaconController__factory, XAppConnectionManager__factory, - ValidatorManager__factory, Outbox__factory, Inbox__factory, } from '@abacus-network/core'; import { DeployEnvironment, RustConfig } from '../config'; -import { CoreConfig } from './types'; +import { CoreConfig, MultisigValidatorManagerConfig } from './types'; export class AbacusCoreDeployer extends AbacusAppDeployer< CoreContractAddresses, CoreConfig > { + multisigValidatorManagerConfig( + config: CoreConfig, + domain: types.Domain, + ): MultisigValidatorManagerConfig { + const domainName = this.mustResolveDomainName(domain); + const validatorManagerConfig = config.multisigValidatorManagers[domainName]; + if (!validatorManagerConfig) { + throw new Error(`No validator manager config for ${domainName}`); + } + return validatorManagerConfig; + } + async deployContracts( domain: types.Domain, config: CoreConfig, @@ -39,21 +54,27 @@ export class AbacusCoreDeployer extends AbacusAppDeployer< new UpgradeBeaconController__factory(signer), ); - const validatorManager: ValidatorManager = await this.deployContract( - domain, - 'ValidatorManager', - new ValidatorManager__factory(signer), - ); - - for (const name of this.domainNames) { - const validator = config.validators[name]; - if (!validator) throw new Error(`No validator for ${name}`); - await validatorManager.enrollValidator( - this.resolveDomain(name), - validator, - overrides, + const outboxMultisigValidatorManagerConfig = + this.multisigValidatorManagerConfig(config, domain); + const outboxMultisigValidatorManager: OutboxMultisigValidatorManager = + await this.deployContract( + domain, + 'OutboxMultisigValidatorManager', + new OutboxMultisigValidatorManager__factory(signer), + domain, + outboxMultisigValidatorManagerConfig.validatorSet, + outboxMultisigValidatorManagerConfig.quorumThreshold, ); - } + + // for (const name of this.domainNames) { + // const validator = config.validators[name]; + // if (!validator) throw new Error(`No validator for ${name}`); + // await validatorManager.enrollValidator( + // this.resolveDomain(name), + // validator, + // overrides, + // ); + // } const outbox = await this.deployProxiedContract( domain, @@ -61,7 +82,7 @@ export class AbacusCoreDeployer extends AbacusAppDeployer< new Outbox__factory(signer), upgradeBeaconController.address, [domain], - [validatorManager.address], + [outboxMultisigValidatorManager.address], ); const xAppConnectionManager: XAppConnectionManager = @@ -72,14 +93,39 @@ export class AbacusCoreDeployer extends AbacusAppDeployer< ); await xAppConnectionManager.setOutbox(outbox.address, overrides); + const inboxMultisigValidatorManagers: Record< + types.Domain, + InboxMultisigValidatorManager + > = {}; + const inboxMultisigValidatorManagerAddresses: Partial< + Record + > = {}; + const inboxes: Record> = {}; const inboxAddresses: Partial> = {}; const remotes = this.remoteDomainNumbers(domain); for (let i = 0; i < remotes.length; i++) { const remote = remotes[i]; + const remoteName = this.mustResolveDomainName(remote); + + const inboxMultisigValidatorManagerConfig = + this.multisigValidatorManagerConfig(config, remote); + const inboxMultisigValidatorManager: InboxMultisigValidatorManager = + await this.deployContract( + domain, + 'InboxMultisigValidatorManager', + new InboxMultisigValidatorManager__factory(signer), + remote, + inboxMultisigValidatorManagerConfig.validatorSet, + inboxMultisigValidatorManagerConfig.quorumThreshold, + ); + inboxMultisigValidatorManagers[remote] = inboxMultisigValidatorManager; + inboxMultisigValidatorManagerAddresses[remoteName] = + inboxMultisigValidatorManager.address; + const initArgs = [ remote, - validatorManager.address, + inboxMultisigValidatorManager.address, ethers.constants.HashZero, 0, ]; @@ -113,7 +159,8 @@ export class AbacusCoreDeployer extends AbacusAppDeployer< const addresses = { upgradeBeaconController: upgradeBeaconController.address, xAppConnectionManager: xAppConnectionManager.address, - validatorManager: validatorManager.address, + outboxMultisigValidatorManager: outboxMultisigValidatorManager.address, + inboxMultisigValidatorManagers: inboxMultisigValidatorManagerAddresses, outbox: outbox.addresses, inboxes: inboxAddresses, }; diff --git a/typescript/infra/src/core/govern.ts b/typescript/infra/src/core/govern.ts index 765c2bce7..2a541861c 100644 --- a/typescript/infra/src/core/govern.ts +++ b/typescript/infra/src/core/govern.ts @@ -1,3 +1,4 @@ +// @ts-nocheck import { expect } from 'chai'; import { Call, AbacusCore, AbacusGovernance } from '@abacus-network/sdk'; import { diff --git a/typescript/infra/src/core/types.ts b/typescript/infra/src/core/types.ts index c03ca3db0..3636511bf 100644 --- a/typescript/infra/src/core/types.ts +++ b/typescript/infra/src/core/types.ts @@ -1,6 +1,13 @@ import { types } from '@abacus-network/utils'; import { ChainName } from '@abacus-network/sdk'; +export type MultisigValidatorManagerConfig = { + validatorSet: Array; + quorumThreshold: number; +}; + export type CoreConfig = { - validators: Partial>; + multisigValidatorManagers: Partial< + Record + >; }; diff --git a/typescript/sdk/src/core/environments/test.ts b/typescript/sdk/src/core/environments/test.ts index 6aa9e9b5b..8cf6b049c 100644 --- a/typescript/sdk/src/core/environments/test.ts +++ b/typescript/sdk/src/core/environments/test.ts @@ -1,109 +1,133 @@ export const addresses = { alfajores: { upgradeBeaconController: '0x5FbDB2315678afecb367f032d93F642f64180aa3', - xAppConnectionManager: '0x8A791620dd6260079BF849Dc5567aDC3F2FdC318', - validatorManager: '0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512', + xAppConnectionManager: '0x5FC8d32690cc91D4c39d9d3abcBD16989F875707', + outboxMultisigValidatorManager: + '0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512', + inboxMultisigValidatorManagers: { + kovan: '0xa513E6E4b8f2a923D98304ec87F64353C4D5C853', + mumbai: '0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0', + fuji: '0x0B306BF915C4d645ff596e518fAf3F9669b97016', + }, outbox: { - proxy: '0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6', - implementation: '0x0165878A594ca255338adfa4d48449f69242Eb8F', - beacon: '0xa513E6E4b8f2a923D98304ec87F64353C4D5C853', + proxy: '0xDc64a140Aa3E981100a9becA4E685f962f0cF6C9', + implementation: '0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0', + beacon: '0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9', }, inboxes: { kovan: { - proxy: '0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82', - implementation: '0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e', - beacon: '0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0', + proxy: '0x610178dA211FEF7D417bC0e6FeD39F05609AD788', + implementation: '0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6', + beacon: '0x8A791620dd6260079BF849Dc5567aDC3F2FdC318', }, mumbai: { - proxy: '0x0B306BF915C4d645ff596e518fAf3F9669b97016', - implementation: '0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e', - beacon: '0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0', + proxy: '0x0DCd1Bf9A1b36cE34237eEaFef220932846BCD82', + implementation: '0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6', + beacon: '0x8A791620dd6260079BF849Dc5567aDC3F2FdC318', }, fuji: { - proxy: '0x9A9f2CCfdE556A7E9Ff0848998Aa4a0CFD8863AE', - implementation: '0xB7f8BC63BbcaD18155201308C8f3540b07f84F5e', - beacon: '0xA51c1fc2f0D1a1b8494Ed1FE312d7C3a78Ed91C0', + proxy: '0x959922bE3CAee4b8Cd9a407cc3ac1C251C2007B1', + implementation: '0x2279B7A0a67DB372996a5FaB50D91eAA73d2eBe6', + beacon: '0x8A791620dd6260079BF849Dc5567aDC3F2FdC318', }, }, }, kovan: { - upgradeBeaconController: '0x3Aa5ebB10DC797CAC828524e59A333d0A371443c', - xAppConnectionManager: '0xc5a5C42992dECbae36851359345FE25997F5C42d', - validatorManager: '0xc6e7DF5E7b4f2A278906862b61205850344D4e7d', + upgradeBeaconController: '0x68B1D87F95878fE05B998F19b66F4baba5De1aed', + xAppConnectionManager: '0x322813Fd9A801c5507c9de605d63CEA4f2CE6c44', + outboxMultisigValidatorManager: + '0x3Aa5ebB10DC797CAC828524e59A333d0A371443c', + inboxMultisigValidatorManagers: { + alfajores: '0x4A679253410272dd5232B3Ff7cF5dbB88f295319', + mumbai: '0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E', + fuji: '0x9E545E3C0baAB3E08CdfD552C960A1050f373042', + }, outbox: { - proxy: '0x09635F643e140090A9A8Dcd712eD6285858ceBef', - implementation: '0x4A679253410272dd5232B3Ff7cF5dbB88f295319', - beacon: '0x7a2088a1bFc9d81c55368AE168C2C02570cB814F', + proxy: '0x4ed7c70F96B99c776995fB64377f0d4aB3B0e1C1', + implementation: '0xc6e7DF5E7b4f2A278906862b61205850344D4e7d', + beacon: '0x59b670e9fA9D0A427751Af201D676719a970857b', }, inboxes: { alfajores: { - proxy: '0x84eA74d481Ee0A5332c457a4d796187F6Ba67fEB', - implementation: '0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E', - beacon: '0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690', + proxy: '0xc5a5C42992dECbae36851359345FE25997F5C42d', + implementation: '0x7a2088a1bFc9d81c55368AE168C2C02570cB814F', + beacon: '0x09635F643e140090A9A8Dcd712eD6285858ceBef', }, mumbai: { - proxy: '0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9', - implementation: '0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E', - beacon: '0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690', + proxy: '0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690', + implementation: '0x7a2088a1bFc9d81c55368AE168C2C02570cB814F', + beacon: '0x09635F643e140090A9A8Dcd712eD6285858ceBef', }, fuji: { - proxy: '0x851356ae760d987E095750cCeb3bC6014560891C', - implementation: '0xE6E340D132b5f46d1e472DebcD681B2aBc16e57E', - beacon: '0xc3e53F4d16Ae77Db1c982e75a937B9f60FE63690', + proxy: '0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9', + implementation: '0x7a2088a1bFc9d81c55368AE168C2C02570cB814F', + beacon: '0x09635F643e140090A9A8Dcd712eD6285858ceBef', }, }, }, mumbai: { - upgradeBeaconController: '0x95401dc811bb5740090279Ba06cfA8fcF6113778', - xAppConnectionManager: '0x36C02dA8a0983159322a80FFE9F24b1acfF8B570', - validatorManager: '0x998abeb3E57409262aE5b751f60747921B33613E', + upgradeBeaconController: '0x851356ae760d987E095750cCeb3bC6014560891C', + xAppConnectionManager: '0x4826533B4897376654Bb4d4AD88B7faFD0C98528', + outboxMultisigValidatorManager: + '0xf5059a5D33d5853360D16C683c16e67980206f36', + inboxMultisigValidatorManagers: { + alfajores: '0x0E801D84Fa97b50751Dbf25036d067dCf18858bF', + kovan: '0x809d550fca64d94Bd9F66E60752A544199cfAC3D', + fuji: '0x5f3f1dBD7B74C6B46e8c44f98792A1dAf8d69154', + }, outbox: { - proxy: '0x5eb3Bc0a489C5A8288765d2336659EbCA68FCd00', - implementation: '0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf', - beacon: '0x9d4454B023096f34B160D6B654540c56A1F81688', + proxy: '0x70e0bA845a1A0F2DA3359C97E0285013525FFC49', + implementation: '0x95401dc811bb5740090279Ba06cfA8fcF6113778', + beacon: '0x998abeb3E57409262aE5b751f60747921B33613E', }, inboxes: { alfajores: { - proxy: '0x5f3f1dBD7B74C6B46e8c44f98792A1dAf8d69154', - implementation: '0x4c5859f0F772848b2D91F1D83E2Fe57935348029', - beacon: '0x1291Be112d480055DaFd8a610b7d1e203891C274', + proxy: '0x5eb3Bc0a489C5A8288765d2336659EbCA68FCd00', + implementation: '0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf', + beacon: '0x9d4454B023096f34B160D6B654540c56A1F81688', }, kovan: { - proxy: '0xCD8a1C3ba11CF5ECfa6267617243239504a98d90', - implementation: '0x4c5859f0F772848b2D91F1D83E2Fe57935348029', - beacon: '0x1291Be112d480055DaFd8a610b7d1e203891C274', + proxy: '0x4c5859f0F772848b2D91F1D83E2Fe57935348029', + implementation: '0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf', + beacon: '0x9d4454B023096f34B160D6B654540c56A1F81688', }, fuji: { - proxy: '0x2bdCC0de6bE1f7D2ee689a0342D76F52E8EFABa3', - implementation: '0x4c5859f0F772848b2D91F1D83E2Fe57935348029', - beacon: '0x1291Be112d480055DaFd8a610b7d1e203891C274', + proxy: '0xb7278A61aa25c888815aFC32Ad3cC52fF24fE575', + implementation: '0x8f86403A4DE0BB5791fa46B8e795C547942fE4Cf', + beacon: '0x9d4454B023096f34B160D6B654540c56A1F81688', }, }, }, fuji: { - upgradeBeaconController: '0x7bc06c482DEAd17c0e297aFbC32f6e63d3846650', - xAppConnectionManager: '0x1fA02b2d6A771842690194Cf62D91bdd92BfE28d', - validatorManager: '0xc351628EB244ec633d5f21fBD6621e1a683B1181', + upgradeBeaconController: '0x82e01223d51Eb87e16A03E24687EDF0F294da6f1', + xAppConnectionManager: '0xFD471836031dc5108809D173A067e8486B9047A3', + outboxMultisigValidatorManager: + '0x2bdCC0de6bE1f7D2ee689a0342D76F52E8EFABa3', + inboxMultisigValidatorManagers: { + alfajores: '0x1429859428C0aBc9C2C47C8Ee9FBaf82cFA0F20f', + kovan: '0x1fA02b2d6A771842690194Cf62D91bdd92BfE28d', + mumbai: '0x4C4a2f8c81640e47606d3fd77B353E87Ba015584', + }, outbox: { - proxy: '0x5081a39b8A5f0E35a8D959395a630b68B74Dd30f', - implementation: '0x162A433068F51e18b7d13932F27e66a3f99E6890', - beacon: '0x922D6956C99E12DFeB3224DEA977D0939758A1Fe', + proxy: '0xc351628EB244ec633d5f21fBD6621e1a683B1181', + implementation: '0x7969c5eD335650692Bc04293B07F5BF2e7A673C0', + beacon: '0x7bc06c482DEAd17c0e297aFbC32f6e63d3846650', }, inboxes: { alfajores: { - proxy: '0x21dF544947ba3E8b3c32561399E88B52Dc8b2823', - implementation: '0x04C89607413713Ec9775E14b954286519d836FEf', - beacon: '0x4C4a2f8c81640e47606d3fd77B353E87Ba015584', + proxy: '0x922D6956C99E12DFeB3224DEA977D0939758A1Fe', + implementation: '0xB0D4afd8879eD9F52b28595d31B441D079B2Ca07', + beacon: '0x162A433068F51e18b7d13932F27e66a3f99E6890', }, kovan: { - proxy: '0xD8a5a9b31c3C0232E196d518E89Fd8bF83AcAd43', - implementation: '0x04C89607413713Ec9775E14b954286519d836FEf', - beacon: '0x4C4a2f8c81640e47606d3fd77B353E87Ba015584', + proxy: '0xdbC43Ba45381e02825b14322cDdd15eC4B3164E6', + implementation: '0xB0D4afd8879eD9F52b28595d31B441D079B2Ca07', + beacon: '0x162A433068F51e18b7d13932F27e66a3f99E6890', }, mumbai: { - proxy: '0x51A1ceB83B83F1985a81C295d1fF28Afef186E02', - implementation: '0x04C89607413713Ec9775E14b954286519d836FEf', - beacon: '0x4C4a2f8c81640e47606d3fd77B353E87Ba015584', + proxy: '0x21dF544947ba3E8b3c32561399E88B52Dc8b2823', + implementation: '0xB0D4afd8879eD9F52b28595d31B441D079B2Ca07', + beacon: '0x162A433068F51e18b7d13932F27e66a3f99E6890', }, }, },