Skip to content
This repository was archived by the owner on Mar 5, 2025. It is now read-only.

Commit 5161642

Browse files
authored
Check failing tests (estimate gas problem) (#6702)
* test * test * check simple contract * fix gas estimation tests * fix ens tests * fix numbers * fix estimate gas test * fix lint * compare bigint * fix bsd link
1 parent 882631c commit 5161642

File tree

6 files changed

+29
-26
lines changed

6 files changed

+29
-26
lines changed

packages/web3-eth-ens/test/integration/ens.events.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ import { ENS } from '../../src';
2727
import { namehash } from '../../src/utils';
2828

2929
import {
30-
getSystemTestAccounts,
3130
getSystemTestProvider,
3231
isWs,
3332
isIpc,
3433
closeOpenConnection,
3534
isSocket,
3635
describeIf,
3736
getSystemTestProviderUrl,
37+
createTempAccount,
3838
} from '../fixtures/system_tests_utils';
3939

4040
import { ENSRegistryAbi } from '../fixtures/ens/abi/ENSRegistry';
@@ -62,7 +62,6 @@ describeIf(isSocket)('ens events', () => {
6262
const node = namehash('resolver');
6363
const label = sha3('resolver') as string;
6464

65-
let accounts: string[];
6665
let ens: ENS;
6766
let defaultAccount: string;
6867
let accountOne: string;
@@ -71,9 +70,10 @@ describeIf(isSocket)('ens events', () => {
7170
const addressOne: Address = '0x0000000000000000000000000000000000000001';
7271

7372
beforeAll(async () => {
74-
accounts = await getSystemTestAccounts();
75-
76-
[defaultAccount, accountOne] = accounts;
73+
const acc1 = await createTempAccount();
74+
defaultAccount = acc1.address;
75+
const acc2 = await createTempAccount();
76+
accountOne = acc2.address;
7777

7878
sendOptions = { from: defaultAccount, gas: '10000000' };
7979

packages/web3-eth-ens/test/integration/ens.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ import { namehash } from '../../src/utils';
2727

2828
import {
2929
closeOpenConnection,
30-
getSystemTestAccounts,
30+
createTempAccount,
3131
getSystemTestProvider,
3232
getSystemTestProviderUrl,
3333
isIpc,
@@ -63,7 +63,6 @@ describe('ens', () => {
6363
const fullDomain = `${subdomain}.${domain}`;
6464
const web3jsName = 'web3js.test';
6565

66-
let accounts: string[];
6766
let ens: ENS;
6867
let defaultAccount: string;
6968
let accountOne: string;
@@ -72,9 +71,10 @@ describe('ens', () => {
7271
const addressOne: Address = '0x0000000000000000000000000000000000000001';
7372

7473
beforeAll(async () => {
75-
accounts = await getSystemTestAccounts();
76-
77-
[defaultAccount, accountOne] = accounts;
74+
const acc1 = await createTempAccount();
75+
defaultAccount = acc1.address;
76+
const acc2 = await createTempAccount();
77+
accountOne = acc2.address;
7878

7979
sendOptions = { from: defaultAccount, gas: '10000000' };
8080

packages/web3-eth-ens/test/integration/resolver.test.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ import { namehash } from '../../src/utils';
2828

2929
import {
3030
closeOpenConnection,
31-
getSystemTestAccounts,
31+
createTempAccount,
3232
getSystemTestProvider,
3333
getSystemTestProviderUrl,
3434
isIpc,
@@ -60,7 +60,6 @@ describe('ens', () => {
6060

6161
let web3Eth: Web3Eth;
6262

63-
let accounts: string[];
6463
let ens: ENS;
6564
let defaultAccount: string;
6665
let accountOne: string;
@@ -73,9 +72,10 @@ describe('ens', () => {
7372
const DEFAULT_COIN_TYPE = 60;
7473

7574
beforeAll(async () => {
76-
accounts = await getSystemTestAccounts();
77-
78-
[defaultAccount, accountOne] = accounts;
75+
const acc1 = await createTempAccount();
76+
defaultAccount = acc1.address;
77+
const acc2 = await createTempAccount();
78+
accountOne = acc2.address;
7979

8080
sendOptions = { from: defaultAccount, gas: '10000000' };
8181

@@ -223,10 +223,10 @@ describe('ens', () => {
223223
.setResolver(domainNode, resolver.options.address as string)
224224
.send(sendOptions);
225225

226-
await resolver.methods.setAddr(domainNode, accounts[1]).send(sendOptions);
226+
await resolver.methods.setAddr(domainNode, accountOne).send(sendOptions);
227227

228228
const res = await resolver.methods.addr(domainNode, DEFAULT_COIN_TYPE).call(sendOptions);
229-
expect(res).toBe(accounts[1]);
229+
expect(res).toBe(accountOne);
230230
});
231231

232232
it('fetches address', async () => {

packages/web3-eth/test/integration/web3_eth/estimate_gas.test.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ import {
2121
closeOpenConnection,
2222
createTempAccount,
2323
getSystemTestProvider,
24+
itIf,
25+
isGeth,
2426
} from '../../fixtures/system_test_utils';
2527

2628
describe('Web3Eth.estimateGas', () => {
@@ -46,16 +48,15 @@ describe('Web3Eth.estimateGas', () => {
4648
expect(response).toBe(BigInt(21000));
4749
});
4850

49-
it('should estimate a contract deployment', async () => {
51+
itIf(isGeth)('should estimate a contract deployment', async () => {
5052
const greeterContractDeploymentData =
5153
'0x60806040523480156200001157600080fd5b5060405162000a6a38038062000a6a8339818101604052810190620000379190620002a4565b80600090805190602001906200004f92919062000057565b505062000359565b828054620000659062000324565b90600052602060002090601f016020900481019282620000895760008555620000d5565b82601f10620000a457805160ff1916838001178555620000d5565b82800160010185558215620000d5579182015b82811115620000d4578251825591602001919060010190620000b7565b5b509050620000e49190620000e8565b5090565b5b8082111562000103576000816000905550600101620000e9565b5090565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620001708262000125565b810181811067ffffffffffffffff8211171562000192576200019162000136565b5b80604052505050565b6000620001a762000107565b9050620001b5828262000165565b919050565b600067ffffffffffffffff821115620001d857620001d762000136565b5b620001e38262000125565b9050602081019050919050565b60005b8381101562000210578082015181840152602081019050620001f3565b8381111562000220576000848401525b50505050565b60006200023d6200023784620001ba565b6200019b565b9050828152602081018484840111156200025c576200025b62000120565b5b62000269848285620001f0565b509392505050565b600082601f8301126200028957620002886200011b565b5b81516200029b84826020860162000226565b91505092915050565b600060208284031215620002bd57620002bc62000111565b5b600082015167ffffffffffffffff811115620002de57620002dd62000116565b5b620002ec8482850162000271565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200033d57607f821691505b602082108103620003535762000352620002f5565b5b50919050565b61070180620003696000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063a41368621461003b578063cfae32171461006c575b600080fd5b6100556004803603810190610050919061043f565b61008a565b60405161006392919061052b565b60405180910390f35b6100746101b0565b604051610081919061055b565b60405180910390f35b600060607f0d363f2fba46ab11b6db8da0125b0d5484787c44e265b48810735998bab12b756000846040516100c0929190610672565b60405180910390a182600090805190602001906100de929190610242565b507f7d7846723bda52976e0286c6efffee937ee9f76817a867ec70531ad29fb1fc0e600060405161010f91906106a9565b60405180910390a160016000808054610127906105ac565b80601f0160208091040260200160405190810160405280929190818152602001828054610153906105ac565b80156101a05780601f10610175576101008083540402835291602001916101a0565b820191906000526020600020905b81548152906001019060200180831161018357829003601f168201915b5050505050905091509150915091565b6060600080546101bf906105ac565b80601f01602080910402602001604051908101604052809291908181526020018280546101eb906105ac565b80156102385780601f1061020d57610100808354040283529160200191610238565b820191906000526020600020905b81548152906001019060200180831161021b57829003601f168201915b5050505050905090565b82805461024e906105ac565b90600052602060002090601f01602090048101928261027057600085556102b7565b82601f1061028957805160ff19168380011785556102b7565b828001600101855582156102b7579182015b828111156102b657825182559160200191906001019061029b565b5b5090506102c491906102c8565b5090565b5b808211156102e15760008160009055506001016102c9565b5090565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61034c82610303565b810181811067ffffffffffffffff8211171561036b5761036a610314565b5b80604052505050565b600061037e6102e5565b905061038a8282610343565b919050565b600067ffffffffffffffff8211156103aa576103a9610314565b5b6103b382610303565b9050602081019050919050565b82818337600083830152505050565b60006103e26103dd8461038f565b610374565b9050828152602081018484840111156103fe576103fd6102fe565b5b6104098482856103c0565b509392505050565b600082601f830112610426576104256102f9565b5b81356104368482602086016103cf565b91505092915050565b600060208284031215610455576104546102ef565b5b600082013567ffffffffffffffff811115610473576104726102f4565b5b61047f84828501610411565b91505092915050565b60008115159050919050565b61049d81610488565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b838110156104dd5780820151818401526020810190506104c2565b838111156104ec576000848401525b50505050565b60006104fd826104a3565b61050781856104ae565b93506105178185602086016104bf565b61052081610303565b840191505092915050565b60006040820190506105406000830185610494565b818103602083015261055281846104f2565b90509392505050565b6000602082019050818103600083015261057581846104f2565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806105c457607f821691505b6020821081036105d7576105d661057d565b5b50919050565b60008190508160005260206000209050919050565b600081546105ff816105ac565b61060981866104ae565b94506001821660008114610624576001811461063657610669565b60ff1983168652602086019350610669565b61063f856105dd565b60005b8381101561066157815481890152600182019150602081019050610642565b808801955050505b50505092915050565b6000604082019050818103600083015261068c81856105f2565b905081810360208301526106a081846104f2565b90509392505050565b600060208201905081810360008301526106c381846105f2565b90509291505056fea2646970667358221220fe0f28c9f8ef0a13a95934b974e7bc2ca6762b40a5b93ccd6ca2038f454bf52764736f6c634300080e003300000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000017736f6c79656e7420677265656e2069732070656f706c65000000000000000000';
5254
const transaction: Transaction = {
5355
from: tempAcc.address,
5456
data: greeterContractDeploymentData,
55-
gas: '0x742b8',
5657
};
5758
const response = await web3Eth.estimateGas(transaction);
58-
59-
expect(response).toBe(BigInt(475494));
59+
// eslint-disable-next-line jest/no-standalone-expect
60+
expect(response).toBe(BigInt(480435));
6061
});
6162
});

scripts/geth_binary.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ getOS(){
2121
getDownloadLink(){
2222
case "$OS" in
2323
SOLARIS*) LINK="-" ;;
24-
OSX*) LINK="https://gethstore.blob.core.windows.net/builds/geth-darwin-amd64-1.12.2-bed84606.tar.gz" ;;
25-
LINUX*) LINK="https://gethstore.blob.core.windows.net/builds/geth-linux-386-1.12.2-bed84606.tar.gz" ;;
26-
BSD*) LINK="https://gethstore.blob.core.windows.net/builds/geth-darwin-amd64-1.12.2-bed84606.tar.gz" ;;
27-
WINDOWS*) LINK="https://gethstore.blob.core.windows.net/builds/geth-windows-386-1.12.2-bed84606.exe" ;;
28-
"ALSO WINDOWS"*) LINK="https://gethstore.blob.core.windows.net/builds/geth-windows-386-1.12.2-bed84606.exe" ;;
24+
OSX*) LINK="https://gethstore.blob.core.windows.net/builds/geth-darwin-amd64-1.13.8-b20b4a71.tar.gz" ;;
25+
LINUX*) LINK="https://gethstore.blob.core.windows.net/builds/geth-linux-amd64-1.13.8-b20b4a71.tar.gz" ;;
26+
BSD*) LINK="https://gethstore.blob.core.windows.net/builds/geth-darwin-amd64-1.13.8-b20b4a71.tar.gz" ;;
27+
WINDOWS*) LINK="https://gethstore.blob.core.windows.net/builds/geth-windows-amd64-1.13.8-b20b4a71.exe" ;;
28+
"ALSO WINDOWS"*) LINK="https://gethstore.blob.core.windows.net/builds/geth-windows-amd64-1.13.8-b20b4a71.exe" ;;
2929
*) LINK="-" ;;
3030
esac
3131
}

scripts/system_tests_utils.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ export const getSystemTestMnemonic = (): string => getEnvVar('WEB3_SYSTEM_TEST_M
103103

104104
export const getSystemTestBackend = (): string => getEnvVar('WEB3_SYSTEM_TEST_BACKEND') ?? '';
105105

106+
export const isGeth: boolean = getSystemTestBackend() === 'geth';
107+
106108
export const createAccount = _createAccount;
107109

108110
export const itIf = (condition: (() => boolean) | boolean) =>

0 commit comments

Comments
 (0)