Skip to content

Commit 2180bd0

Browse files
ebadierequiet-nodevictor-yanevnatanasowswirlds-automation
authored
2755 operator vs txn fees (#2781)
* test: added E2E test for preemtive rate limit (#2753) * test: added E2E test fir preemtive rate limit Signed-off-by: Logan Nguyen <[email protected]> * Update hbarLimiter.spec.ts Signed-off-by: Logan Nguyen <[email protected]> --------- Signed-off-by: Logan Nguyen <[email protected]> Signed-off-by: ebadiere <[email protected]> * test: expand integration tests for SDK client (#2756) * test: expand integration tests for SDK client Signed-off-by: Victor Yanev <[email protected]> * chore: minor improvements to sdkClient.ts Signed-off-by: Victor Yanev <[email protected]> * fix: typescript error Signed-off-by: Victor Yanev <[email protected]> * fix: simplify test data Signed-off-by: Victor Yanev <[email protected]> * chore: formatting Signed-off-by: Victor Yanev <[email protected]> * chore: fix typescript errors and warnings Signed-off-by: Victor Yanev <[email protected]> * chore: optimize imports Signed-off-by: Victor Yanev <[email protected]> * chore: address comments Signed-off-by: Victor Yanev <[email protected]> * chore: improve readability of tests Signed-off-by: Victor Yanev <[email protected]> * test: fix wrong MIRROR_NODE_LIMIT_PARAM in relay tests Signed-off-by: Victor Yanev <[email protected]> * fix: wrong env file loaded Signed-off-by: Victor Yanev <[email protected]> * test: remove hardcoded usages of MIRROR_NODE_LIMIT_PARAM in relay tests Signed-off-by: Victor Yanev <[email protected]> * test: revert changes to rpc_batch1.spec.ts Signed-off-by: Victor Yanev <[email protected]> * chore: remove unused import Signed-off-by: Victor Yanev <[email protected]> * chore: fix test after merge Signed-off-by: Victor Yanev <[email protected]> * chore: fix test after merge Signed-off-by: Victor Yanev <[email protected]> * chore: revert changes to usages of MIRROR_NODE_LIMIT_PARAM Signed-off-by: Victor Yanev <[email protected]> * chore: revert changes to usages of MIRROR_NODE_LIMIT_PARAM Signed-off-by: Victor Yanev <[email protected]> --------- Signed-off-by: Victor Yanev <[email protected]> Signed-off-by: ebadiere <[email protected]> * feat: search contract logs only by transaction hash (#2762) * chore: refactor eth.ts Signed-off-by: nikolay <[email protected]> * chore: bump hedera-local version Signed-off-by: nikolay <[email protected]> --------- Signed-off-by: nikolay <[email protected]> Signed-off-by: ebadiere <[email protected]> * chore: Implement memory leak detection in tests (#2695) * chore: Implement memory leak detection in tests Signed-off-by: Victor Yanev <[email protected]> * chore: Implement memory leak detection in tests Signed-off-by: Victor Yanev <[email protected]> * chore: Implement memory leak detection in tests Signed-off-by: Victor Yanev <[email protected]> * chore: Implement memory leak detection in tests Signed-off-by: Victor Yanev <[email protected]> * chore: Implement memory leak detection in tests Signed-off-by: Victor Yanev <[email protected]> * chore: add docs Signed-off-by: Victor Yanev <[email protected]> * chore: fix sonar issues Signed-off-by: Victor Yanev <[email protected]> * chore: formatting Signed-off-by: Victor Yanev <[email protected]> * chore: small fix Signed-off-by: Victor Yanev <[email protected]> * chore: trace GC and write snapshot if memory leak > 0.5 MB Signed-off-by: Victor Yanev <[email protected]> * chore: revert false changes to eth.ts Signed-off-by: Victor Yanev <[email protected]> * chore: optimize code Signed-off-by: Victor Yanev <[email protected]> * Merge branch 'main' into 2260-Implement-a-Memory-Leak-detection-Test Signed-off-by: Victor Yanev <[email protected]> # Conflicts: # package-lock.json # package.json # packages/server/tsconfig.json * fix: Do not write heap snapshots for acceptance tests Signed-off-by: Victor Yanev <[email protected]> * fix: add TODO for removing --trace_gc flag Signed-off-by: Victor Yanev <[email protected]> * test: add github comment in cases a test is having memory leaks Signed-off-by: Victor Yanev <[email protected]> * test: add github context env variables Signed-off-by: Victor Yanev <[email protected]> * test: extract common logic for github api calls Signed-off-by: Victor Yanev <[email protected]> * test: console.debug -> console.log for successful PR comments Signed-off-by: Victor Yanev <[email protected]> * test: fix request to github API Signed-off-by: Victor Yanev <[email protected]> * Merge branch 'main' into 2260-Implement-a-Memory-Leak-detection-Test Signed-off-by: Victor Yanev <[email protected]> # Conflicts: # packages/server/tests/acceptance/index.spec.ts * Merge branch 'main' into 2260-Implement-a-Memory-Leak-detection-Test Signed-off-by: Victor Yanev <[email protected]> # Conflicts: # packages/server/tests/acceptance/index.spec.ts * fix: request to github API Signed-off-by: Victor Yanev <[email protected]> * chore: add upload heap snapshots step in github workflow for acceptance and integration tests Signed-off-by: Victor Yanev <[email protected]> * fix: add `subject_type: file` to github request for adding comment on PR Signed-off-by: Victor Yanev <[email protected]> * fix: fix path in request to github API Signed-off-by: Victor Yanev <[email protected]> * chore: extract github request logic in new file - githubClient.ts Signed-off-by: Victor Yanev <[email protected]> * fix: path of upload-artifact action for uploading heap snapshots Signed-off-by: Victor Yanev <[email protected]> * fix: requests in githubClient.ts Signed-off-by: Victor Yanev <[email protected]> * fix: requests in githubClient.ts Signed-off-by: Victor Yanev <[email protected]> * fix: format message of github-actions[bot] Signed-off-by: Victor Yanev <[email protected]> * fix: format message of github-actions[bot] Signed-off-by: Victor Yanev <[email protected]> * chore: remove unused github context env variable Signed-off-by: Victor Yanev <[email protected]> * chore: formatting Signed-off-by: Victor Yanev <[email protected]> * chore: formatting Signed-off-by: Victor Yanev <[email protected]> * chore: formatting Signed-off-by: Victor Yanev <[email protected]> * fix: `formatBytes` returns `NaN undefined` when `0` is passed to it Signed-off-by: Victor Yanev <[email protected]> * fix: `formatBytes` returns `NaN undefined` when negative number is passed to it Signed-off-by: Victor Yanev <[email protected]> * fix: predicate for updating existing comment Signed-off-by: Victor Yanev <[email protected]> * fix: remove unused constant + temporary console logs Signed-off-by: Victor Yanev <[email protected]> * fix: make memory leak report more descriptive Signed-off-by: Victor Yanev <[email protected]> * chore: remove unnecessary console logs Signed-off-by: Victor Yanev <[email protected]> * chore: reduce MEMORY_LEAK_SNAPSHOT_THRESHOLD to 500 KB Signed-off-by: Victor Yanev <[email protected]> * fix: update logic for detecting memory leak based on heap size threshold Signed-off-by: Victor Yanev <[email protected]> * fix: add separate threshold for taking heap snapshots Signed-off-by: Victor Yanev <[email protected]> * fix: set `WRITE_SNAPSHOT_ON_MEMORY_LEAK` to be `false` by default Signed-off-by: Victor Yanev <[email protected]> * test: add warm-up phase to memory leak detection Signed-off-by: Victor Yanev <[email protected]> * chore: revert changes to rpc_batch1.spec.ts Signed-off-by: Victor Yanev <[email protected]> --------- Signed-off-by: Victor Yanev <[email protected]> Signed-off-by: Eric Badiere <[email protected]> Co-authored-by: Eric Badiere <[email protected]> Signed-off-by: ebadiere <[email protected]> * feat: deprecate `ETH_POPULATE_SYNTHETIC_CONTRACT_RESULTS` env (#2768) * chore: remove env Signed-off-by: nikolay <[email protected]> * chore: modify test Signed-off-by: nikolay <[email protected]> --------- Signed-off-by: nikolay <[email protected]> Signed-off-by: ebadiere <[email protected]> * Bump versions for v0.53.0-rc1 Signed-off-by: Swirlds Automation <[email protected]> Signed-off-by: ebadiere <[email protected]> * feat: reused executetransaction for methods in sdkclient and improved… (#2776) feat: reused executetransaction for methods in sdkclient and improved logging (#2749) * fix: reused executeTransaction() in deleteFile() method * fix: reworked executeTransaction() to accept executeAll * feat: fix: reused executeTransaction() in fileCreate() method * fix: removed check rate limit in executeGetTransactionRecord * fix: fixed SDK HBAR limiter tests * fix: reverted rework executeTransaction() * fix: reworked formatRequestIdMessage * feat: added executeAllTransaction() method * fix: made shouldLimit optional in executeTransaction() * Update packages/relay/src/lib/clients/sdkClient.ts * fix: addressed comments * fix: extracted handleExecuteAllError() * fix: renamed handleExecuteAllError to getTransactionMetrics and reuse it in executeTransaction --------- Signed-off-by: Logan Nguyen <[email protected]> Signed-off-by: Logan Nguyen <[email protected]> Co-authored-by: Logan Nguyen <[email protected]> Co-authored-by: Victor Yanev <[email protected]> Signed-off-by: ebadiere <[email protected]> * Bump versions for v0.53.0-rc2 Signed-off-by: Swirlds Automation <[email protected]> Signed-off-by: ebadiere <[email protected]> * fix: reduce hbar limit only by operator fees (#2755) * fix: reduce hbar limit only by operator fees Signed-off-by: Ivo Yankov <[email protected]> * chore: update expected values Signed-off-by: Ivo Yankov <[email protected]> * chore: fix code smells Signed-off-by: Ivo Yankov <[email protected]> * nit: re-trigger ci Signed-off-by: Ivo Yankov <[email protected]> * chore: addressing comments Signed-off-by: Ivo Yankov <[email protected]> * fix: hbar limit error handle Signed-off-by: Ivo Yankov <[email protected]> * fix: reduce test flakiness Signed-off-by: Ivo Yankov <[email protected]> * fix: reduce test flakiness Signed-off-by: Ivo Yankov <[email protected]> * nit: update comment Signed-off-by: Ivo Yankov <[email protected]> * fix: unit test mocks Signed-off-by: Ivo Yankov <[email protected]> * fix: update assertions and mocks Signed-off-by: Ivo Yankov <[email protected]> --------- Signed-off-by: Ivo Yankov <[email protected]> Signed-off-by: Eric Badiere <[email protected]> Co-authored-by: Eric Badiere <[email protected]> Signed-off-by: ebadiere <[email protected]> --------- Signed-off-by: Logan Nguyen <[email protected]> Signed-off-by: ebadiere <[email protected]> Signed-off-by: Victor Yanev <[email protected]> Signed-off-by: nikolay <[email protected]> Signed-off-by: Eric Badiere <[email protected]> Signed-off-by: Swirlds Automation <[email protected]> Signed-off-by: Logan Nguyen <[email protected]> Signed-off-by: Ivo Yankov <[email protected]> Co-authored-by: Logan Nguyen <[email protected]> Co-authored-by: Victor Yanev <[email protected]> Co-authored-by: Nikolay Atanasow <[email protected]> Co-authored-by: Swirlds Automation <[email protected]> Co-authored-by: Ivo Yankov <[email protected]>
1 parent 842fad1 commit 2180bd0

File tree

8 files changed

+235
-18
lines changed

8 files changed

+235
-18
lines changed

packages/relay/src/formatters.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,16 @@ const isHex = (value: string): boolean => {
291291
return hexRegex.test(value);
292292
};
293293

294+
// Returns the sum of all transfer amounts for the specified account. The amount is negative if the account is charged,
295+
// it is positive if the account is receiving it, thus the amount is first negated and then added to the sum.
296+
const getTransferAmountSumForAccount = (transactionRecord, accountId: string): number => {
297+
return transactionRecord.transfers
298+
.filter((transfer) => transfer.accountId.toString() === accountId)
299+
.reduce((acc, transfer) => {
300+
return BN.sum(acc, transfer.amount.toTinybars().negate()).toNumber();
301+
}, 0);
302+
};
303+
294304
export {
295305
hashNumber,
296306
formatRequestIdMessage,
@@ -317,4 +327,5 @@ export {
317327
isValidEthereumAddress,
318328
isHex,
319329
ASCIIToHex,
330+
getTransferAmountSumForAccount,
320331
};

packages/relay/src/lib/clients/sdkClient.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ import {
5353
} from '@hashgraph/sdk';
5454
import { BigNumber } from '@hashgraph/sdk/lib/Transfer';
5555
import { Logger } from 'pino';
56-
import { formatRequestIdMessage } from '../../formatters';
56+
import { formatRequestIdMessage, getTransferAmountSumForAccount } from '../../formatters';
5757
import HbarLimit from '../hbarlimiter';
5858
import constants from './../constants';
5959
import { SDKClientError } from './../errors/SDKClientError';
@@ -562,6 +562,8 @@ export class SDKClient {
562562
// Throw WRONG_NONCE error as more error handling logic for WRONG_NONCE is awaited in eth.sendRawTransactionErrorHandler(). Otherwise, move on and return transactionResponse eventually.
563563
if (e.status && e.status.toString() === constants.TRANSACTION_RESULT_STATUS.WRONG_NONCE) {
564564
throw sdkClientError;
565+
} else if (e instanceof JsonRpcError) {
566+
throw e;
565567
} else {
566568
if (!transactionResponse) {
567569
throw predefined.INTERNAL_ERROR(
@@ -700,7 +702,7 @@ export class SDKClient {
700702
const transactionRecord: TransactionRecord = await transactionResponse.getRecord(this.clientMain);
701703

702704
// get transactionFee and gasUsed for metrics
703-
transactionFee = transactionRecord.transactionFee.toTinybars().toNumber();
705+
transactionFee = getTransferAmountSumForAccount(transactionRecord, this.clientMain.operatorAccountId!.toString());
704706
gasUsed = transactionRecord.contractFunctionResult
705707
? transactionRecord.contractFunctionResult.gasUsed.toNumber()
706708
: 0;

packages/relay/tests/helpers.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,7 @@ export const contractId1 = '0.0.5001';
386386
export const contractId2 = '0.0.5002';
387387
export const signedTransactionHash =
388388
'0x02f87482012a0485a7a358200085a7a3582000832dc6c09400000000000000000000000000000000000003f78502540be40080c001a006f4cd8e6f84b76a05a5c1542a08682c928108ef7163d9c1bf1f3b636b1cd1fba032097cbf2dda17a2dcc40f62c97964d9d930cdce2e8a9df9a8ba023cda28e4ad';
389+
export const LONG_ZERO_ADDRESS = '0x0000000000000000000000000000000000000557';
389390

390391
export const defaultBlock = {
391392
count: blockTransactionCount,
@@ -435,7 +436,7 @@ export const defaultContractResults = {
435436
contract_id: '0.0.1375',
436437
created_contract_ids: ['0.0.1375'],
437438
error_message: null,
438-
from: '0x0000000000000000000000000000000000000557',
439+
from: LONG_ZERO_ADDRESS,
439440
function_parameters: '0x',
440441
gas_limit: maxGasLimit,
441442
gas_used: gasUsed1,
@@ -467,7 +468,7 @@ export const defaultContractResults = {
467468
contract_id: '0.0.1374',
468469
created_contract_ids: [],
469470
error_message: null,
470-
from: '0x0000000000000000000000000000000000000557',
471+
from: LONG_ZERO_ADDRESS,
471472
function_parameters:
472473
'0x2b6adf430000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000084865792c204d6121000000000000000000000000000000000000000000000000',
473474
gas_limit: maxGasLimit - 1000,

packages/relay/tests/lib/eth/eth-config.ts

Lines changed: 44 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,15 @@
1717
* limitations under the License.
1818
*
1919
*/
20-
import { defaultEvmAddress, defaultLogs1, defaultLogs2, defaultLogs3, mockData, toHex } from '../../helpers';
20+
import {
21+
defaultEvmAddress,
22+
defaultLogs1,
23+
defaultLogs2,
24+
defaultLogs3,
25+
mockData,
26+
toHex,
27+
LONG_ZERO_ADDRESS,
28+
} from '../../helpers';
2129
import { numberTo0x } from '../../../dist/formatters';
2230
import constants from '../../../src/lib/constants';
2331

@@ -436,7 +444,7 @@ export const DEFAULT_CONTRACT_RES_REVERT = {
436444
created_contract_ids: [],
437445
error_message:
438446
'0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000002645524332303a207472616e7366657220616d6f756e7420657863656564732062616c616e63650000000000000000000000000000000000000000000000000000',
439-
from: '0x0000000000000000000000000000000000000557',
447+
from: LONG_ZERO_ADDRESS,
440448
function_parameters: '0x',
441449
gas_limit: MAX_GAS_LIMIT,
442450
gas_used: GAS_USED_1,
@@ -682,6 +690,40 @@ export const CONTRACTS_LOGS_WITH_FILTER = `contracts/${CONTRACT_ADDRESS_1}/resul
682690
export const CONTRACT_RESULTS_LOGS_WITH_FILTER_URL = `contracts/results/logs?timestamp=gte:${DEFAULT_BLOCK.timestamp.from}&timestamp=lte:${DEFAULT_BLOCK.timestamp.to}&limit=100&order=asc`;
683691
export const BLOCKS_LIMIT_ORDER_URL = 'blocks?limit=1&order=desc';
684692
export const CONTRACTS_RESULTS_NEXT_URL = `contracts/results?timestamp=lte:${DEFAULT_BLOCK.timestamp.to}&timestamp=gte:${DEFAULT_BLOCK.timestamp.from}&limit=100&order=asc`; // just flip the timestamp parameters for simplicity
693+
export const ACCOUNT_WITHOUT_TRANSACTIONS = `accounts/${LONG_ZERO_ADDRESS}?transactions=false`;
694+
export const contractByEvmAddress = (evmAddress: string) => `contracts/${evmAddress}`;
695+
696+
export const MOCK_ACCOUNT_WITHOUT_TRANSACTIONS = {
697+
account: '0.0.1367',
698+
alias: null,
699+
auto_renew_period: 105825166,
700+
balance: {
701+
balance: 350074689935,
702+
timestamp: '1722499895.340270625',
703+
tokens: [],
704+
},
705+
created_timestamp: '1706812520.644859499',
706+
decline_reward: false,
707+
deleted: false,
708+
ethereum_nonce: 0,
709+
evm_address: LONG_ZERO_ADDRESS,
710+
expiry_timestamp: '1812637686.644859499',
711+
key: {
712+
_type: 'ED25519',
713+
key: 'e06b22e0966108fa5d63fc6ae53f9824319b891cd4d6050dbf2b242be7e13344',
714+
},
715+
max_automatic_token_associations: 0,
716+
memo: '',
717+
pending_reward: 0,
718+
receiver_sig_required: false,
719+
staked_account_id: null,
720+
staked_node_id: null,
721+
stake_period_start: null,
722+
transactions: [],
723+
links: {
724+
next: null,
725+
},
726+
};
685727

686728
//responce objects
687729
export const MOCK_BLOCK_NUMBER_1000_RES = {

packages/relay/tests/lib/eth/eth_getBlockByHash.spec.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { SDKClient } from '../../../src/lib/clients';
3030
import RelayAssertions from '../../assertions';
3131
import { numberTo0x } from '../../../dist/formatters';
3232
import {
33+
ACCOUNT_WITHOUT_TRANSACTIONS,
3334
BLOCK_HASH,
3435
BLOCK_HASH_PREV_TRIMMED,
3536
BLOCK_HASH_TRIMMED,
@@ -45,10 +46,13 @@ import {
4546
CONTRACT_TIMESTAMP_1,
4647
CONTRACT_TIMESTAMP_2,
4748
DEFAULT_BLOCK,
49+
DEFAULT_CONTRACT,
4850
DEFAULT_ETH_GET_BLOCK_BY_LOGS,
4951
DEFAULT_NETWORK_FEES,
5052
LINKS_NEXT_RES,
53+
MOCK_ACCOUNT_WITHOUT_TRANSACTIONS,
5154
NO_SUCH_BLOCK_EXISTS_RES,
55+
contractByEvmAddress,
5256
} from './eth-config';
5357
import { generateEthTestEnv } from './eth-helpers';
5458

@@ -75,6 +79,13 @@ describe('@ethGetBlockByHash using MirrorNode', async function () {
7579
sdkClientStub = sinon.createStubInstance(SDKClient);
7680
getSdkClientStub = sinon.stub(hapiServiceInstance, 'getSDKClient').returns(sdkClientStub);
7781
restMock.onGet('network/fees').reply(200, DEFAULT_NETWORK_FEES);
82+
restMock.onGet(ACCOUNT_WITHOUT_TRANSACTIONS).reply(200, MOCK_ACCOUNT_WITHOUT_TRANSACTIONS);
83+
restMock
84+
.onGet(contractByEvmAddress(CONTRACT_ADDRESS_1))
85+
.reply(200, { ...DEFAULT_CONTRACT, evmAddress: CONTRACT_ADDRESS_1 });
86+
restMock
87+
.onGet(contractByEvmAddress(CONTRACT_ADDRESS_2))
88+
.reply(200, { ...DEFAULT_CONTRACT, evmAddress: CONTRACT_ADDRESS_2 });
7889

7990
currentMaxBlockRange = Number(process.env.ETH_GET_TRANSACTION_COUNT_MAX_BLOCK_RANGE);
8091
process.env.ETH_GET_TRANSACTION_COUNT_MAX_BLOCK_RANGE = '1';
@@ -265,7 +276,7 @@ describe('@ethGetBlockByHash using MirrorNode', async function () {
265276
.onGet(
266277
`contracts/results?timestamp=gte:${randomBlock.timestamp.from}&timestamp=lte:${randomBlock.timestamp.to}&limit=100&order=asc`,
267278
)
268-
.abortRequestOnce();
279+
.abortRequest();
269280
await RelayAssertions.assertRejection(predefined.INTERNAL_ERROR(), ethImpl.getBlockByHash, false, ethImpl, [
270281
BLOCK_HASH,
271282
false,

packages/relay/tests/lib/sdkClient.spec.ts

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2087,18 +2087,57 @@ describe('SdkClient', async function () {
20872087
getReceipt: (_client: NodeClient) => Promise.resolve(transactionReceipt),
20882088
getRecord: (_client: NodeClient) => {
20892089
let transactionFee: number;
2090+
let transfers: any = [];
20902091
switch (transactionType) {
20912092
case 'FileCreateTransaction':
20922093
transactionFee = fileCreateFee;
2094+
transfers = [
2095+
{
2096+
accountId: process.env.OPERATOR_ID_MAIN,
2097+
amount: Hbar.fromTinybars(-1 * fileCreateFee),
2098+
is_approval: false,
2099+
},
2100+
];
20932101
break;
20942102
case 'FileAppendTransaction':
20952103
transactionFee = fileAppendFee;
2104+
transfers = [
2105+
{
2106+
accountId: process.env.OPERATOR_ID_MAIN,
2107+
amount: Hbar.fromTinybars(-1 * fileAppendFee),
2108+
is_approval: false,
2109+
},
2110+
];
20962111
break;
20972112
case 'FileDeleteTransaction':
20982113
transactionFee = fileDeleteFee;
2114+
transfers = [
2115+
{
2116+
accountId: process.env.OPERATOR_ID_MAIN,
2117+
amount: Hbar.fromTinybars(-1 * fileDeleteFee),
2118+
is_approval: false,
2119+
},
2120+
];
20992121
break;
21002122
default:
21012123
transactionFee = defaultTransactionFee;
2124+
transfers = [
2125+
{
2126+
accountId: '0.0.800',
2127+
amount: Hbar.fromTinybars(defaultTransactionFee),
2128+
is_approval: false,
2129+
},
2130+
{
2131+
accountId: process.env.OPERATOR_ID_MAIN,
2132+
amount: Hbar.fromTinybars(-1 * defaultTransactionFee),
2133+
is_approval: false,
2134+
},
2135+
{
2136+
accountId: accountId.toString(),
2137+
amount: Hbar.fromTinybars(-1 * defaultTransactionFee),
2138+
is_approval: false,
2139+
},
2140+
];
21022141
break;
21032142
}
21042143
return Promise.resolve({
@@ -2107,6 +2146,7 @@ describe('SdkClient', async function () {
21072146
contractFunctionResult: {
21082147
gasUsed: Long.fromNumber(10000),
21092148
},
2149+
transfers,
21102150
});
21112151
},
21122152
}) as unknown as TransactionResponse;
@@ -2155,7 +2195,8 @@ describe('SdkClient', async function () {
21552195
it('should rate limit before creating file and add expenses to limiter for large transaction data', async () => {
21562196
const fileAppendChunks = Math.min(MAX_CHUNKS, Math.ceil(transactionBuffer.length / FILE_APPEND_CHUNK_SIZE));
21572197

2158-
const queryStub = sinon.stub(Query.prototype, 'execute').resolves(fileInfo);
2198+
const queryStub = sinon.stub(FileInfoQuery.prototype, 'execute').resolves(fileInfo);
2199+
21592200
const transactionStub = sinon
21602201
.stub(EthereumTransaction.prototype, 'execute')
21612202
.resolves(getTransactionResponse('EthereumTransaction'));

0 commit comments

Comments
 (0)