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