From 6a171803eff60de784711e44edb3a7eb03289f89 Mon Sep 17 00:00:00 2001 From: Trevor Porter Date: Tue, 12 Apr 2022 14:38:55 +0100 Subject: [PATCH] Prettier --- .../MultisigValidatorManager.sol | 5 +- .../multisigValidatorManager.test.ts | 4 +- typescript/hardhat/src/TestAbacusDeploy.ts | 61 +++++++++++++------ typescript/sdk/src/core/contracts.ts | 7 ++- 4 files changed, 52 insertions(+), 25 deletions(-) diff --git a/solidity/core/contracts/validator-manager/MultisigValidatorManager.sol b/solidity/core/contracts/validator-manager/MultisigValidatorManager.sol index 848299260..61830c766 100644 --- a/solidity/core/contracts/validator-manager/MultisigValidatorManager.sol +++ b/solidity/core/contracts/validator-manager/MultisigValidatorManager.sol @@ -211,7 +211,10 @@ abstract contract MultisigValidatorManager is Ownable { * @param _validator The validator to remove from the validator set. */ function _unenrollValidator(address _validator) internal { - require(validators.length() > quorumThreshold, "violates quorum threshold"); + require( + validators.length() > quorumThreshold, + "violates quorum threshold" + ); require(validators.remove(_validator), "!enrolled"); emit UnenrollValidator(_validator); } diff --git a/solidity/core/test/validator-manager/multisigValidatorManager.test.ts b/solidity/core/test/validator-manager/multisigValidatorManager.test.ts index 7db47e8c3..afb0cc215 100644 --- a/solidity/core/test/validator-manager/multisigValidatorManager.test.ts +++ b/solidity/core/test/validator-manager/multisigValidatorManager.test.ts @@ -131,8 +131,8 @@ describe('MultisigValidatorManager', async () => { await validatorManager.setQuorumThreshold(2); await expect( - validatorManager.unenrollValidator(validator1.address) - ).to.be.revertedWith("violates quorum threshold"); + validatorManager.unenrollValidator(validator1.address), + ).to.be.revertedWith('violates quorum threshold'); }); it('reverts if the validator is not already enrolled', async () => { diff --git a/typescript/hardhat/src/TestAbacusDeploy.ts b/typescript/hardhat/src/TestAbacusDeploy.ts index 54c76895a..175edb3f0 100644 --- a/typescript/hardhat/src/TestAbacusDeploy.ts +++ b/typescript/hardhat/src/TestAbacusDeploy.ts @@ -28,8 +28,11 @@ export type TestAbacusInstance = { upgradeBeaconController: UpgradeBeaconController; inboxes: Record; interchainGasPaymaster: InterchainGasPaymaster; - outboxMultisigValidatorManager: OutboxMultisigValidatorManager, - inboxMultisigValidatorManagers: Record, + outboxMultisigValidatorManager: OutboxMultisigValidatorManager; + inboxMultisigValidatorManagers: Record< + types.Domain, + InboxMultisigValidatorManager + >; }; export class TestAbacusDeploy extends TestDeploy< @@ -54,24 +57,31 @@ export class TestAbacusDeploy extends TestDeploy< const signer = this.config.signer[domain]; const signerAddress = await signer.getAddress(); - const outboxMultisigValidatorManagerFactory = new OutboxMultisigValidatorManager__factory(signer); - const outboxMultisigValidatorManager = await outboxMultisigValidatorManagerFactory.deploy( - domain, - [signerAddress], - 1, - ); + const outboxMultisigValidatorManagerFactory = + new OutboxMultisigValidatorManager__factory(signer); + const outboxMultisigValidatorManager = + await outboxMultisigValidatorManagerFactory.deploy( + domain, + [signerAddress], + 1 + ); - const inboxMultisigValidatorManagerFactory = new InboxMultisigValidatorManager__factory(signer); - const inboxMultisigValidatorManagers: Record = {}; + const inboxMultisigValidatorManagerFactory = + new InboxMultisigValidatorManager__factory(signer); + const inboxMultisigValidatorManagers: Record< + types.Domain, + InboxMultisigValidatorManager + > = {}; // this.remotes reads this.instances which has not yet been set. const remotes = Object.keys(this.config.signer).map((d) => parseInt(d)); const inboxMultisigValidatorManagerDeploys = remotes.map(async (remote) => { - const inboxMultisigValidatorManager = await inboxMultisigValidatorManagerFactory.deploy( - remote, - [signerAddress], - 1, - ); + const inboxMultisigValidatorManager = + await inboxMultisigValidatorManagerFactory.deploy( + remote, + [signerAddress], + 1 + ); inboxMultisigValidatorManagers[remote] = inboxMultisigValidatorManager; }); await Promise.all(inboxMultisigValidatorManagerDeploys); @@ -105,7 +115,8 @@ export class TestAbacusDeploy extends TestDeploy< // this.remotes reads this.instances which has not yet been set. // const remotes = Object.keys(this.config.signer).map((d) => parseInt(d)); const inboxDeploys = remotes.map(async (remote) => { - const inboxMultisigValidatorManager = inboxMultisigValidatorManagers[remote]; + const inboxMultisigValidatorManager = + inboxMultisigValidatorManagers[remote]; const inbox = await inboxFactory.deploy(domain); await inbox.initialize( remote, @@ -132,9 +143,14 @@ export class TestAbacusDeploy extends TestDeploy< await this.outbox(domain).transferOwnership(address); await this.upgradeBeaconController(domain).transferOwnership(address); await this.xAppConnectionManager(domain).transferOwnership(address); - await this.outboxMultisigValidatorManager(domain).transferOwnership(address); + await this.outboxMultisigValidatorManager(domain).transferOwnership( + address + ); for (const remote of this.remotes(domain)) { - await this.inboxMultisigValidatorManager(domain, remote).transferOwnership(address); + await this.inboxMultisigValidatorManager( + domain, + remote + ).transferOwnership(address); await this.inbox(domain, remote).transferOwnership(address); } } @@ -159,11 +175,16 @@ export class TestAbacusDeploy extends TestDeploy< return this.instances[domain].xAppConnectionManager; } - outboxMultisigValidatorManager(domain: types.Domain): OutboxMultisigValidatorManager { + outboxMultisigValidatorManager( + domain: types.Domain + ): OutboxMultisigValidatorManager { return this.instances[domain].outboxMultisigValidatorManager; } - inboxMultisigValidatorManager(local: types.Domain, remote: types.Domain): InboxMultisigValidatorManager { + inboxMultisigValidatorManager( + local: types.Domain, + remote: types.Domain + ): InboxMultisigValidatorManager { return this.instances[local].inboxMultisigValidatorManagers[remote]; } diff --git a/typescript/sdk/src/core/contracts.ts b/typescript/sdk/src/core/contracts.ts index f6f3111d7..8e290e8eb 100644 --- a/typescript/sdk/src/core/contracts.ts +++ b/typescript/sdk/src/core/contracts.ts @@ -38,8 +38,11 @@ export class CoreContracts extends AbacusAppContracts { return Inbox__factory.connect(inbox.proxy, this.connection); } - inboxMultisigValidatorManager(chain: ChainName): InboxMultisigValidatorManager { - const inboxMultisigValidatorManager = this.addresses.inboxMultisigValidatorManagers[chain]; + inboxMultisigValidatorManager( + chain: ChainName, + ): InboxMultisigValidatorManager { + const inboxMultisigValidatorManager = + this.addresses.inboxMultisigValidatorManagers[chain]; if (!inboxMultisigValidatorManager) { throw new Error(`No inboxMultisigValidatorManager for ${chain}`); }