pull/334/head
Trevor Porter 3 years ago
parent 3673557082
commit 6a171803ef
  1. 5
      solidity/core/contracts/validator-manager/MultisigValidatorManager.sol
  2. 4
      solidity/core/test/validator-manager/multisigValidatorManager.test.ts
  3. 61
      typescript/hardhat/src/TestAbacusDeploy.ts
  4. 7
      typescript/sdk/src/core/contracts.ts

@ -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);
}

@ -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 () => {

@ -28,8 +28,11 @@ export type TestAbacusInstance = {
upgradeBeaconController: UpgradeBeaconController;
inboxes: Record<types.Domain, TestInbox>;
interchainGasPaymaster: InterchainGasPaymaster;
outboxMultisigValidatorManager: OutboxMultisigValidatorManager,
inboxMultisigValidatorManagers: Record<types.Domain, InboxMultisigValidatorManager>,
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<types.Domain, InboxMultisigValidatorManager> = {};
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];
}

@ -38,8 +38,11 @@ export class CoreContracts extends AbacusAppContracts<CoreContractAddresses> {
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}`);
}

Loading…
Cancel
Save