|
|
@ -3,7 +3,7 @@ import { SignerWithAddress } from '@nomiclabs/hardhat-ethers/signers'; |
|
|
|
import { expect } from 'chai'; |
|
|
|
import { expect } from 'chai'; |
|
|
|
import { ethers } from 'hardhat'; |
|
|
|
import { ethers } from 'hardhat'; |
|
|
|
|
|
|
|
|
|
|
|
import { Validator, utils } from '@hyperlane-xyz/utils'; |
|
|
|
import { Validator, types, utils } from '@hyperlane-xyz/utils'; |
|
|
|
|
|
|
|
|
|
|
|
import { |
|
|
|
import { |
|
|
|
TestMailbox, |
|
|
|
TestMailbox, |
|
|
@ -13,6 +13,7 @@ import { |
|
|
|
TestRecipient__factory, |
|
|
|
TestRecipient__factory, |
|
|
|
} from '../../types'; |
|
|
|
} from '../../types'; |
|
|
|
import { |
|
|
|
import { |
|
|
|
|
|
|
|
dispatchMessage, |
|
|
|
dispatchMessageAndReturnMetadata, |
|
|
|
dispatchMessageAndReturnMetadata, |
|
|
|
getCommitment, |
|
|
|
getCommitment, |
|
|
|
signCheckpoint, |
|
|
|
signCheckpoint, |
|
|
@ -54,6 +55,14 @@ describe('MultisigIsm', async () => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe('#moduleType', () => { |
|
|
|
|
|
|
|
it('returns the correct type', async () => { |
|
|
|
|
|
|
|
expect(await multisigIsm.moduleType()).to.equal( |
|
|
|
|
|
|
|
types.InterchainSecurityModuleType.MULTISIG, |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
describe('#enrollValidators', () => { |
|
|
|
describe('#enrollValidators', () => { |
|
|
|
let validatorAddresses: string[]; |
|
|
|
let validatorAddresses: string[]; |
|
|
|
const domains = [ORIGIN_DOMAIN, DESTINATION_DOMAIN]; |
|
|
|
const domains = [ORIGIN_DOMAIN, DESTINATION_DOMAIN]; |
|
|
@ -317,6 +326,32 @@ describe('MultisigIsm', async () => { |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
describe('#validatorsAndThreshold', () => { |
|
|
|
|
|
|
|
const threshold = 7; |
|
|
|
|
|
|
|
let message: string; |
|
|
|
|
|
|
|
beforeEach(async () => { |
|
|
|
|
|
|
|
await multisigIsm.enrollValidators( |
|
|
|
|
|
|
|
[ORIGIN_DOMAIN], |
|
|
|
|
|
|
|
[validators.map((v) => v.address)], |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
await multisigIsm.setThreshold(ORIGIN_DOMAIN, threshold); |
|
|
|
|
|
|
|
const dispatch = await dispatchMessage( |
|
|
|
|
|
|
|
mailbox, |
|
|
|
|
|
|
|
DESTINATION_DOMAIN, |
|
|
|
|
|
|
|
utils.addressToBytes32(multisigIsm.address), |
|
|
|
|
|
|
|
'hello', |
|
|
|
|
|
|
|
); |
|
|
|
|
|
|
|
message = dispatch.message; |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('returns the validators and threshold', async () => { |
|
|
|
|
|
|
|
expect(await multisigIsm.validatorsAndThreshold(message)).to.deep.equal([ |
|
|
|
|
|
|
|
validators.map((v) => v.address), |
|
|
|
|
|
|
|
threshold, |
|
|
|
|
|
|
|
]); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
describe('#validatorCount', () => { |
|
|
|
describe('#validatorCount', () => { |
|
|
|
beforeEach(async () => { |
|
|
|
beforeEach(async () => { |
|
|
|
// Must be done sequentially so gas estimation is correct.
|
|
|
|
// Must be done sequentially so gas estimation is correct.
|
|
|
|