Skip to content

Commit 46b82d7

Browse files
authored
feat: removes logging from test clients (#4204)
Signed-off-by: Simeon Nakov <[email protected]>
1 parent 2fdd5cc commit 46b82d7

32 files changed

+1367
-2305
lines changed

packages/server/tests/acceptance/debug.spec.ts

Lines changed: 69 additions & 126 deletions
Large diffs are not rendered by default.

packages/server/tests/acceptance/equivalence.spec.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { hexToBytes } from '@ethereumjs/util';
44
import { hexToASCII } from '@hashgraph/json-rpc-relay/dist/formatters';
55
import { MirrorNodeClient } from '@hashgraph/json-rpc-relay/dist/lib/clients';
66
import { Precheck } from '@hashgraph/json-rpc-relay/dist/lib/precheck';
7-
import { RequestDetails } from '@hashgraph/json-rpc-relay/dist/lib/types';
87
import { ContractFunctionParameters } from '@hashgraph/sdk';
98
import { assert, expect } from 'chai';
109
import { ethers, toUtf8Bytes } from 'ethers';
@@ -62,7 +61,6 @@ describe('Equivalence tests', async function () {
6261
const { servicesNode, mirrorNode, relay }: any = global;
6362
const servicesClient = servicesNode as ServicesClient;
6463
const mirrorNodeClient = mirrorNode as MirrorNodeClient;
65-
const requestDetails = new RequestDetails({ requestId: 'rpc_batch1Test', ipAddress: '0.0.0.0' });
6664
let precheck: Precheck;
6765

6866
const SUCCESS = 'SUCCESS';
@@ -110,7 +108,6 @@ describe('Equivalence tests', async function () {
110108
let equivalenceContractReceipt;
111109
let equivalenceContractId;
112110
let estimateContract;
113-
let requestId;
114111

115112
const validateContractCall = (
116113
record,
@@ -171,18 +168,9 @@ describe('Equivalence tests', async function () {
171168
);
172169
equivalenceContractId = equivalenceContractReceipt.contractId.toString();
173170

174-
requestId = Utils.generateRequestId();
175-
const contractMirror = await mirrorNodeClient.get(
176-
`/contracts/${estimatePrecompileSolidityAddress}`,
177-
requestDetails,
178-
);
171+
const contractMirror = await mirrorNodeClient.get(`/contracts/${estimatePrecompileSolidityAddress}`);
179172

180-
accounts[0] = await servicesClient.createAccountWithContractIdKey(
181-
contractMirror.contract_id,
182-
200,
183-
relay.provider,
184-
requestId,
185-
);
173+
accounts[0] = await servicesClient.createAccountWithContractIdKey(contractMirror.contract_id, 200, relay.provider);
186174

187175
tokenAddress = await createFungibleToken();
188176
precheck = new Precheck(mirrorNodeClient, logger, '0x12a');
@@ -345,7 +333,7 @@ describe('Equivalence tests', async function () {
345333
};
346334

347335
async function getResultByEntityIdAndTxTimestamp(entityId, txTimestamp) {
348-
return await mirrorNode.get(`/contracts/${entityId}/results/${txTimestamp}`, requestDetails);
336+
return await mirrorNode.get(`/contracts/${entityId}/results/${txTimestamp}`);
349337
}
350338

351339
/**
@@ -354,7 +342,7 @@ describe('Equivalence tests', async function () {
354342
* @returns list of ContractActions
355343
*/
356344
async function getContractActions(transactionIdOrHash: string) {
357-
return await mirrorNode.get(`/contracts/results/${transactionIdOrHash}/actions`, requestDetails);
345+
return await mirrorNode.get(`/contracts/results/${transactionIdOrHash}/actions`);
358346
}
359347

360348
async function createFungibleToken() {

packages/server/tests/acceptance/erc20.spec.ts

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ describe('@erc20 Acceptance Tests', async function () {
3131
const accounts: AliasAccount[] = [];
3232
let initialHolder;
3333
let anotherAccount;
34-
let requestId;
3534
let recipient;
3635

3736
const contracts: [any] = [];
@@ -46,11 +45,9 @@ describe('@erc20 Acceptance Tests', async function () {
4645
];
4746

4847
this.beforeAll(async () => {
49-
requestId = Utils.generateRequestId();
50-
51-
accounts[0] = await servicesNode.createAliasAccount(60, relay.provider, requestId);
52-
accounts[1] = await servicesNode.createAliasAccount(30, relay.provider, requestId);
53-
accounts[2] = await servicesNode.createAliasAccount(30, relay.provider, requestId);
48+
accounts[0] = await servicesNode.createAliasAccount(60, relay.provider);
49+
accounts[1] = await servicesNode.createAliasAccount(30, relay.provider);
50+
accounts[2] = await servicesNode.createAliasAccount(30, relay.provider);
5451

5552
initialHolder = accounts[0].address;
5653
recipient = accounts[1].address;
@@ -77,15 +74,10 @@ describe('@erc20 Acceptance Tests', async function () {
7774
[accounts[1], accounts[2]],
7875
accounts[0],
7976
servicesNode,
80-
requestId,
8177
),
8278
);
8379
});
8480

85-
this.beforeEach(async () => {
86-
requestId = Utils.generateRequestId();
87-
});
88-
8981
for (const i in testTitles) {
9082
describe(testTitles[i].testName, async function () {
9183
let contract;
@@ -107,7 +99,7 @@ describe('@erc20 Acceptance Tests', async function () {
10799
});
108100

109101
it('Relay can execute "eth_getCode" for ERC20 contract with evmAddress', async function () {
110-
const res = await relay.call('eth_getCode', [contract.target, 'latest'], requestId);
102+
const res = await relay.call('eth_getCode', [contract.target, 'latest']);
111103
expect(res).to.be.equal(
112104
testTitles[i].expectedBytecode ?? CommonService.redirectBytecodeAddressReplace(contract.target),
113105
);
@@ -201,7 +193,7 @@ describe('@erc20 Acceptance Tests', async function () {
201193
before(async function () {
202194
tx = await contract
203195
.connect(tokenOwnerWallet)
204-
.approve(spender, initialSupply, await Utils.gasOptions(requestId));
196+
.approve(spender, initialSupply, await Utils.gasOptions());
205197
receipt = await tx.wait();
206198
// 5 seconds sleep to propagate the changes to mirror node
207199
await new Promise((r) => setTimeout(r, 5000));
@@ -230,7 +222,7 @@ describe('@erc20 Acceptance Tests', async function () {
230222
it('transfers the requested amount', async function () {
231223
tx = await contract
232224
.connect(spenderWallet)
233-
.transferFrom(tokenOwner, to, initialSupply, await Utils.gasOptions(requestId));
225+
.transferFrom(tokenOwner, to, initialSupply, await Utils.gasOptions());
234226
const receipt = await tx.wait();
235227
// 5 seconds sleep to propagate the changes to mirror node
236228
await new Promise((r) => setTimeout(r, 5000));
@@ -260,10 +252,8 @@ describe('@erc20 Acceptance Tests', async function () {
260252

261253
beforeEach('reducing balance', async function () {
262254
amount = initialSupply;
263-
await contract
264-
.connect(tokenOwnerWallet)
265-
.approve(spender, initialSupply, await Utils.gasOptions(requestId));
266-
await contract.transfer(to, 1, await Utils.gasOptions(requestId));
255+
await contract.connect(tokenOwnerWallet).approve(spender, initialSupply, await Utils.gasOptions());
256+
await contract.transfer(to, 1, await Utils.gasOptions());
267257
// 5 seconds sleep to propagate the changes to mirror node
268258
await new Promise((r) => setTimeout(r, 5000));
269259
});
@@ -292,15 +282,15 @@ describe('@erc20 Acceptance Tests', async function () {
292282
});
293283

294284
beforeEach(async function () {
295-
await contract.approve(spender, allowance, await Utils.gasOptions(requestId));
285+
await contract.approve(spender, allowance, await Utils.gasOptions());
296286
});
297287

298288
describe('when the token owner has enough balance', function () {
299289
let amount;
300290
before(async function () {
301291
allowance = initialSupply - BigInt(1);
302292
amount = initialSupply;
303-
await contract.approve(spender, allowance, await Utils.gasOptions(requestId));
293+
await contract.approve(spender, allowance, await Utils.gasOptions());
304294
});
305295

306296
it('reverts', async function () {
@@ -325,7 +315,7 @@ describe('@erc20 Acceptance Tests', async function () {
325315
});
326316

327317
beforeEach('reducing balance', async function () {
328-
await contract.transfer(to, 2, await Utils.gasOptions(requestId));
318+
await contract.transfer(to, 2, await Utils.gasOptions());
329319
});
330320

331321
it('reverts', async function () {
@@ -352,7 +342,7 @@ describe('@erc20 Acceptance Tests', async function () {
352342
amount = initialSupply;
353343
to = ethers.ZeroAddress;
354344
tokenOwnerWallet = accounts[2].wallet;
355-
await contract.connect(tokenOwnerWallet).approve(spender, amount, await Utils.gasOptions(requestId));
345+
await contract.connect(tokenOwnerWallet).approve(spender, amount, await Utils.gasOptions());
356346
});
357347

358348
it('reverts', async function () {

packages/server/tests/acceptance/estimateGasContract.spec.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
// SPDX-License-Identifier: Apache-2.0
22
// External resources
3-
import { ethers } from 'ethers';
3+
// Constants from local resources
4+
import constants from '@hashgraph/json-rpc-relay/dist/lib/constants';
45
import { expect } from 'chai';
6+
import { ethers } from 'ethers';
57

8+
import EstimateGasContractJson from '../contracts/EstimateGasContract.json';
9+
import RelayCalls from '../helpers/constants';
610
// Local resources
711
import { Utils } from '../helpers/utils';
812
import { AliasAccount } from '../types/AliasAccount';
9-
import EstimateGasContractJson from '../contracts/EstimateGasContract.json';
10-
11-
// Constants from local resources
12-
import constants from '@hashgraph/json-rpc-relay/dist/lib/constants';
13-
import RelayCalls from '../helpers/constants';
1413

1514
describe('EstimateGasContract tests', function () {
1615
const signers: AliasAccount[] = [];
@@ -19,7 +18,7 @@ describe('EstimateGasContract tests', function () {
1918
const { servicesNode, relay }: any = global;
2019

2120
before(async function () {
22-
signers[0] = await servicesNode.createAliasAccount(15, relay.provider, Utils.generateRequestId());
21+
signers[0] = await servicesNode.createAliasAccount(15, relay.provider);
2322

2423
const contractReceipt = await servicesNode.deployContract(EstimateGasContractJson, 500_000);
2524
contract = new ethers.Contract(

0 commit comments

Comments
 (0)