Update StaticCallProxy tests
This commit is contained in:
parent
54f4727adc
commit
185e2342d9
@ -95,26 +95,12 @@ describe('StaticCallProxy', () => {
|
|||||||
const invalidOffsetToAssetData = ethUtil.bufferToHex(paddedTxDataEndBuffer).slice(2);
|
const invalidOffsetToAssetData = ethUtil.bufferToHex(paddedTxDataEndBuffer).slice(2);
|
||||||
const newAssetData = '0000000000000000000000000000000000000000000000000000000000000304';
|
const newAssetData = '0000000000000000000000000000000000000000000000000000000000000304';
|
||||||
const badTxData = `${txData.replace(offsetToAssetData, invalidOffsetToAssetData)}${newAssetData}`;
|
const badTxData = `${txData.replace(offsetToAssetData, invalidOffsetToAssetData)}${newAssetData}`;
|
||||||
await expectTransactionFailedAsync(
|
await expectTransactionFailedWithoutReasonAsync(
|
||||||
web3Wrapper.sendTransactionAsync({
|
web3Wrapper.sendTransactionAsync({
|
||||||
to: staticCallProxy.address,
|
to: staticCallProxy.address,
|
||||||
from: fromAddress,
|
from: fromAddress,
|
||||||
data: badTxData,
|
data: badTxData,
|
||||||
}),
|
}),
|
||||||
RevertReason.InvalidAssetDataEnd,
|
|
||||||
);
|
|
||||||
});
|
|
||||||
it('should revert if the length of assetData, excluding the proxyId, is not a multiple of 32', async () => {
|
|
||||||
const staticCallData = staticCallTarget.noInputFunction.getABIEncodedTransactionData();
|
|
||||||
const expectedResultHash = constants.KECCAK256_NULL;
|
|
||||||
const assetData = `${assetDataUtils.encodeStaticCallAssetData(
|
|
||||||
staticCallTarget.address,
|
|
||||||
staticCallData,
|
|
||||||
expectedResultHash,
|
|
||||||
)}01`;
|
|
||||||
await expectTransactionFailedAsync(
|
|
||||||
staticCallProxy.transferFrom.sendTransactionAsync(assetData, fromAddress, toAddress, amount),
|
|
||||||
RevertReason.InvalidAssetDataLength,
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('should revert if the length of assetData is less than 100 bytes', async () => {
|
it('should revert if the length of assetData is less than 100 bytes', async () => {
|
||||||
@ -125,9 +111,8 @@ describe('StaticCallProxy', () => {
|
|||||||
.slice(0, -128);
|
.slice(0, -128);
|
||||||
const assetDataByteLen = (assetData.length - 2) / 2;
|
const assetDataByteLen = (assetData.length - 2) / 2;
|
||||||
expect((assetDataByteLen - 4) % 32).to.equal(0);
|
expect((assetDataByteLen - 4) % 32).to.equal(0);
|
||||||
await expectTransactionFailedAsync(
|
await expectTransactionFailedWithoutReasonAsync(
|
||||||
staticCallProxy.transferFrom.sendTransactionAsync(assetData, fromAddress, toAddress, amount),
|
staticCallProxy.transferFrom.sendTransactionAsync(assetData, fromAddress, toAddress, amount),
|
||||||
RevertReason.InvalidAssetDataLength,
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('should revert if the offset to `staticCallData` points to outside of assetData', async () => {
|
it('should revert if the offset to `staticCallData` points to outside of assetData', async () => {
|
||||||
@ -147,9 +132,8 @@ describe('StaticCallProxy', () => {
|
|||||||
offsetToStaticCallData,
|
offsetToStaticCallData,
|
||||||
invalidOffsetToStaticCallData,
|
invalidOffsetToStaticCallData,
|
||||||
)}${newStaticCallData}`;
|
)}${newStaticCallData}`;
|
||||||
await expectTransactionFailedAsync(
|
await expectTransactionFailedWithoutReasonAsync(
|
||||||
staticCallProxy.transferFrom.sendTransactionAsync(badAssetData, fromAddress, toAddress, amount),
|
staticCallProxy.transferFrom.sendTransactionAsync(badAssetData, fromAddress, toAddress, amount),
|
||||||
RevertReason.InvalidStaticCallDataOffset,
|
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
it('should revert if the callTarget attempts to write to state', async () => {
|
it('should revert if the callTarget attempts to write to state', async () => {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user