Skip to content

Commit

Permalink
fix: increased maxDataSize for multicall test
Browse files Browse the repository at this point in the history
Signed-off-by: Logan Nguyen <[email protected]>
  • Loading branch information
quiet-node committed Jun 11, 2024
1 parent 4bf0a5d commit 3ffb8fd
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 42 deletions.
70 changes: 32 additions & 38 deletions test/hts-precompile/token-managment/tokenManagmentContract.js
Original file line number Diff line number Diff line change
Expand Up @@ -704,11 +704,11 @@ describe('TokenManagmentContract Test Suite', function () {

it('should not be able to pause the token with different PAUSE key', async function () {
const pauseTokenTx = await tokenManagmentContract
.connect(signers[1])
.pauseTokenPublic(tokenAddress);
.connect(signers[1])
.pauseTokenPublic(tokenAddress);
const unpauseTokenTx = await tokenManagmentContract
.connect(signers[1])
.unpauseTokenPublic(tokenAddress);
.connect(signers[1])
.unpauseTokenPublic(tokenAddress);

await utils.expectToFail(pauseTokenTx, Constants.CALL_EXCEPTION);
await utils.expectToFail(unpauseTokenTx, Constants.CALL_EXCEPTION);
Expand Down Expand Up @@ -816,26 +816,22 @@ describe('TokenManagmentContract Test Suite', function () {
it('should not be able to wipe the token with different WIPE key', async function () {
const wipeAmount = 3;
await tokenTransferContract.transferTokensPublic(
tokenAddress,
[signers[0].address, signers[1].address],
[-wipeAmount, wipeAmount]
tokenAddress,
[signers[0].address, signers[1].address],
[-wipeAmount, wipeAmount]
);

// await until the new balance is settled for signers[1]
await pollForNewERC20Balance(
erc20Contract,
tokenAddress,
signers[1].address,
0n
erc20Contract,
tokenAddress,
signers[1].address,
0n
);

const wipeTokenTx = await tokenManagmentContract
.connect(signers[1])
.wipeTokenAccountPublic(
tokenAddress,
signers[1].address,
wipeAmount
);
.connect(signers[1])
.wipeTokenAccountPublic(tokenAddress, signers[1].address, wipeAmount);
await utils.expectToFail(wipeTokenTx, Constants.CALL_EXCEPTION);
});

Expand Down Expand Up @@ -950,17 +946,17 @@ describe('TokenManagmentContract Test Suite', function () {

it('should not be able to freeze the token with different FREEZE key', async function () {
const freezeTokenTx = await tokenManagmentContract
.connect(signers[1])
.freezeTokenPublic(
tokenAddress,
await tokenCreateContract.getAddress()
);
.connect(signers[1])
.freezeTokenPublic(
tokenAddress,
await tokenCreateContract.getAddress()
);
const unfreezeTokenTx = await tokenManagmentContract
.connect(signers[1])
.unfreezeTokenPublic(
tokenAddress,
await tokenCreateContract.getAddress()
);
.connect(signers[1])
.unfreezeTokenPublic(
tokenAddress,
await tokenCreateContract.getAddress()
);

await utils.expectToFail(freezeTokenTx, Constants.CALL_EXCEPTION);
await utils.expectToFail(unfreezeTokenTx, Constants.CALL_EXCEPTION);
Expand Down Expand Up @@ -1035,22 +1031,20 @@ describe('TokenManagmentContract Test Suite', function () {
});

it('should be able to perform admin action with TokenManagementContract as ADMIN key', async function () {
console.log(tokenAddress);

const updatedKey = updateTokenInfoValues(
utils.KeyValueType.CONTRACT_ID,
await tokenTransferContract.getAddress()
utils.KeyValueType.CONTRACT_ID,
await tokenTransferContract.getAddress()
);
const updateTokenKeyTx = await tokenManagmentContract
.connect(signers[1])
.updateTokenKeysPublic(tokenAddress, [
[utils.KeyType.SUPPLY, updatedKey],
]);
.connect(signers[1])
.updateTokenKeysPublic(tokenAddress, [
[utils.KeyType.SUPPLY, updatedKey],
]);

expect(
(await updateTokenKeyTx.wait()).logs.filter(
(e) => e.fragment.name === Constants.Events.ResponseCode
)[0].args.responseCode
(await updateTokenKeyTx.wait()).logs.filter(
(e) => e.fragment.name === Constants.Events.ResponseCode
)[0].args.responseCode
).to.eq(TX_SUCCESS_CODE);
});
});
Expand Down
10 changes: 6 additions & 4 deletions test/multicall/Multicall.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,11 @@ describe('Multicall Test Suite', function () {
expect(bytes).to.gte(42624);
});

it('should NOT be able to aggregate 115 calls to processLongOutput', async function () {
const n = 115;
const maxDataSize = 25 * 1024 * 2; // 25 kb
it('should NOT be able to aggregate 585 calls to processLongOutput', async function () {
// @note: since [email protected], the maximum data size was increased to 128 KiB.
const maxDataSize = 128 * 1024 * 2; // 262144 characters - 128 KiB
const n = 585; // 262218 characters ~ 128.03 KiB

let hasError = false;
try {
await multicallProcessLongOutput(n);
Expand All @@ -275,7 +277,7 @@ describe('Multicall Test Suite', function () {
expect(e.message).to.exist;

// Output is too large and the call is reverted.
// The call exceeded the call size limit of 25KB
// The call exceeded the call size limit of 128 KiB
const EXPECTED_ERROR_MESSAGE = `exceeds ${maxDataSize} characters`;
expect(e.message).to.contain(EXPECTED_ERROR_MESSAGE);
}
Expand Down

0 comments on commit 3ffb8fd

Please sign in to comment.