Allow transactions to be over confirmed without resetting the confirmation time
This commit is contained in:
@@ -108,26 +108,33 @@ describe('MultiSigWalletWithTimeLock', () => {
|
||||
});
|
||||
it('should confirm transaction for caller and log a Confirmation event', async () => {
|
||||
const txReceipt = await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
|
||||
expect(txReceipt.logs.length).to.equal(2);
|
||||
const log = txReceipt.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockConfirmationEventArgs>;
|
||||
expect(log.event).to.be.equal('Confirmation');
|
||||
expect(log.args.sender).to.be.equal(owners[1]);
|
||||
expect(log.args.transactionId).to.be.bignumber.equal(txId);
|
||||
});
|
||||
it('should revert if fully confirmed', async () => {
|
||||
await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
|
||||
await expectTransactionFailedAsync(
|
||||
multiSigWrapper.confirmTransactionAsync(txId, owners[2]),
|
||||
RevertReason.TxFullyConfirmed,
|
||||
);
|
||||
});
|
||||
it('should set the confirmation time of the transaction if it becomes fully confirmed', async () => {
|
||||
const txReceipt = await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
|
||||
expect(txReceipt.logs.length).to.equal(2);
|
||||
const blockNum = await web3Wrapper.getBlockNumberAsync();
|
||||
const timestamp = new BigNumber(await web3Wrapper.getBlockTimestampAsync(blockNum));
|
||||
const log = txReceipt.logs[1] as LogWithDecodedArgs<MultiSigWalletWithTimeLockConfirmationTimeSetEventArgs>;
|
||||
expect(log.args.confirmationTime).to.be.bignumber.equal(timestamp);
|
||||
expect(log.args.transactionId).to.be.bignumber.equal(txId);
|
||||
});
|
||||
it('should confirm transaction for caller but not reset the confirmation time if tx is already fully confirmed', async () => {
|
||||
await multiSigWrapper.confirmTransactionAsync(txId, owners[1]);
|
||||
const confirmationTimeBefore = await multiSig.confirmationTimes.callAsync(txId);
|
||||
const txReceipt = await multiSigWrapper.confirmTransactionAsync(txId, owners[2]);
|
||||
const confirmationTimeAfter = await multiSig.confirmationTimes.callAsync(txId);
|
||||
expect(confirmationTimeBefore).to.bignumber.equal(confirmationTimeAfter);
|
||||
expect(txReceipt.logs.length).to.equal(1);
|
||||
const log = txReceipt.logs[0] as LogWithDecodedArgs<MultiSigWalletWithTimeLockConfirmationEventArgs>;
|
||||
expect(log.event).to.be.equal('Confirmation');
|
||||
expect(log.args.sender).to.be.equal(owners[2]);
|
||||
expect(log.args.transactionId).to.be.bignumber.equal(txId);
|
||||
});
|
||||
});
|
||||
describe('executeTransaction', () => {
|
||||
let txId: BigNumber;
|
||||
|
||||
Reference in New Issue
Block a user