Add more tests
This commit is contained in:
parent
057aee8ad2
commit
6fd55b2f49
@ -155,7 +155,7 @@ contract AssetProxyOwner is
|
||||
// Ensure that function call was successful
|
||||
require(
|
||||
didSucceed,
|
||||
"EXECUTION_FAILURE"
|
||||
"FAILED_EXECUTION"
|
||||
);
|
||||
}
|
||||
emit Execution(transactionId);
|
||||
|
@ -31,12 +31,19 @@ contract ContractCallReceiver {
|
||||
uint256 value
|
||||
);
|
||||
|
||||
bytes4 constant internal ALWAYS_REVERT_SELECTOR = 0xF1F2F3F4;
|
||||
|
||||
function ()
|
||||
external
|
||||
payable
|
||||
{
|
||||
bytes4 selector = msg.data.readBytes4(0);
|
||||
if (selector == ALWAYS_REVERT_SELECTOR) {
|
||||
revert();
|
||||
}
|
||||
|
||||
emit ContractCall(
|
||||
msg.data.readBytes4(0),
|
||||
selector,
|
||||
msg.data,
|
||||
msg.value
|
||||
);
|
||||
|
@ -586,6 +586,30 @@ blockchainTests.resets('AssetProxyOwner', env => {
|
||||
const tx = assetProxyOwner.executeTransaction.awaitTransactionSuccessAsync(results.txId);
|
||||
expect(tx).to.revertWith(RevertReason.TxAlreadyExecuted);
|
||||
});
|
||||
it('should revert if the only call is unsuccessful', async () => {
|
||||
const alwaysRevertSelector = '0xF1F2F3F4';
|
||||
const data = [alwaysRevertSelector];
|
||||
const destinations = [receiver.address];
|
||||
const tx = assetProxyOwnerWrapper.submitConfirmAndExecuteTransactionAsync(
|
||||
data,
|
||||
destinations,
|
||||
signerAddresses,
|
||||
DEFAULT_TIME_LOCK,
|
||||
);
|
||||
expect(tx).to.revertWith(RevertReason.FailedExecution);
|
||||
});
|
||||
it('should revert if the any call is unsuccessful', async () => {
|
||||
const alwaysRevertSelector = '0xF1F2F3F4';
|
||||
const data = [hexRandom(), alwaysRevertSelector];
|
||||
const destinations = [receiver.address, receiver.address];
|
||||
const tx = assetProxyOwnerWrapper.submitConfirmAndExecuteTransactionAsync(
|
||||
data,
|
||||
destinations,
|
||||
signerAddresses,
|
||||
DEFAULT_TIME_LOCK,
|
||||
);
|
||||
expect(tx).to.revertWith(RevertReason.FailedExecution);
|
||||
});
|
||||
it('should be able to call registerFunctionCall after the default timelock', async () => {
|
||||
const reg = createFunctionRegistration(1, 1, 1);
|
||||
const data = [
|
||||
|
Loading…
x
Reference in New Issue
Block a user