diff --git a/.github/workflows/black_box_tests.yml b/.github/workflows/black_box_tests.yml
index 19c84cee6dd..8d26e163264 100644
--- a/.github/workflows/black_box_tests.yml
+++ b/.github/workflows/black_box_tests.yml
@@ -29,9 +29,9 @@ jobs:
needs: build
runs-on: ubuntu-latest
env:
- INFURA_HTTP: ${{ secrets.INFURA_HTTP }}
- INFURA_WSS: ${{ secrets.INFURA_WSS }}
- INFURA_GOERLI_WS: ${{ secrets.INFURA_GOERLI_WS }}
+ INFURA_MAINNET_HTTP: ${{ secrets.INFURA_MAINNET_HTTP }}
+ INFURA_MAINNET_WS: ${{ secrets.INFURA_MAINNET_WS }}
+ INFURA_SEPOLIA_WS: ${{ secrets.INFURA_SEPOLIA_WS }}
MODE: ${{ matrix.mode }}
strategy:
fail-fast: false
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index f05eac79fd8..dd1279159b7 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -206,8 +206,8 @@ jobs:
needs: build
runs-on: ubuntu-latest
env:
- INFURA_GOERLI_HTTP: ${{ secrets.INFURA_GOERLI_HTTP }}
- INFURA_GOERLI_WS: ${{ secrets.INFURA_GOERLI_WS }}
+ INFURA_SEPOLIA_HTTP: ${{ secrets.INFURA_SEPOLIA_HTTP }}
+ INFURA_SEPOLIA_WS: ${{ secrets.INFURA_SEPOLIA_WS }}
strategy:
fail-fast: false
matrix:
diff --git a/.github/workflows/e2e_network_tests.yml b/.github/workflows/e2e_network_tests.yml
index 508c45caee9..8f26d6c5281 100644
--- a/.github/workflows/e2e_network_tests.yml
+++ b/.github/workflows/e2e_network_tests.yml
@@ -5,7 +5,6 @@ on:
- release/**
tags:
- v4.*
-
jobs:
build:
name: Build Packages
diff --git a/packages/web3-net/test/fixtures/rpc_method_wrappers.ts b/packages/web3-net/test/fixtures/rpc_method_wrappers.ts
index 0e76bcdd39b..701a966e67e 100644
--- a/packages/web3-net/test/fixtures/rpc_method_wrappers.ts
+++ b/packages/web3-net/test/fixtures/rpc_method_wrappers.ts
@@ -29,4 +29,4 @@ export const getPeerCountValidData: [DataFormat, any, any][] = [
[{ number: FMT_NUMBER.STR, bytes: FMT_BYTES.HEX }, '0x2', '2'],
[{ number: FMT_NUMBER.NUMBER, bytes: FMT_BYTES.HEX }, '0x2', 2],
[{ number: FMT_NUMBER.BIGINT, bytes: FMT_BYTES.HEX }, '0x2', BigInt('2')],
-];
+];
\ No newline at end of file
diff --git a/packages/web3-net/test/unit/rpc_method_wrappers.test.ts b/packages/web3-net/test/unit/rpc_method_wrappers.test.ts
index 47d014e2b3e..e3f5bb9ad2a 100644
--- a/packages/web3-net/test/unit/rpc_method_wrappers.test.ts
+++ b/packages/web3-net/test/unit/rpc_method_wrappers.test.ts
@@ -56,6 +56,7 @@ describe('rpc_method_wrappers', () => {
},
);
});
+
it('isListening', async () => {
await isListening(web3Net);
diff --git a/packages/web3/package.json b/packages/web3/package.json
index 2b680517e80..5740fcc04f4 100644
--- a/packages/web3/package.json
+++ b/packages/web3/package.json
@@ -46,8 +46,8 @@
"test": "jest --config=./test/unit/jest.config.js",
"test:coverage:unit": "jest --config=./test/unit/jest.config.js --coverage=true --coverage-reporters=text",
"test:coverage:integration": "jest --config=./test/integration/jest.config.js --forceExit --coverage=true --coverage-reporters=text",
- "test:e2e:mainnet": "jest --config=./test/e2e/jest.config.js --forceExit",
- "test:e2e:sepolia": "jest --config=./test/e2e/jest.config.js --forceExit",
+ "test:e2e:mainnet": "jest --config=./test/e2e/jest.config.js --forceExit --runInBand",
+ "test:e2e:sepolia": "jest --config=./test/e2e/jest.config.js --forceExit --runInBand",
"test:sync:integration": "jest --config=./test/integration/jest.config.js ./test/integration/sync.test.ts",
"test:ci": "jest --coverage=true --coverage-reporters=json --verbose",
"test:watch": "npm test -- --watch",
diff --git a/packages/web3/scripts/black_box_test.sh b/packages/web3/scripts/black_box_test.sh
index 508f2bd76de..8f942aa3b9a 100755
--- a/packages/web3/scripts/black_box_test.sh
+++ b/packages/web3/scripts/black_box_test.sh
@@ -36,15 +36,15 @@ yarn
if [[ ${BACKEND} == "infura" ]]
then
- if [ ! $INFURA_HTTP ] || [ ! $INFURA_WSS ]
+ if [ ! $INFURA_MAINNET_HTTP ] || [ ! $INFURA_MAINNET_WS ]
then
echo "No Infura provider URL specified"
exit 1
elif [ $MODE == "http" ]
then
- WEB3_SYSTEM_TEST_PROVIDER=$INFURA_HTTP
+ WEB3_SYSTEM_TEST_PROVIDER=$INFURA_MAINNET_HTTP
else
- WEB3_SYSTEM_TEST_PROVIDER=$INFURA_WSS
+ WEB3_SYSTEM_TEST_PROVIDER=$INFURA_MAINNET_WS
fi
fi
yarn "test:$BACKEND:$MODE"
@@ -55,15 +55,15 @@ yarn
if [[ ${BACKEND} == "infura" ]]
then
- if [ ! $INFURA_HTTP ] || [ ! $INFURA_WSS ]
+ if [ ! $INFURA_MAINNET_HTTP ] || [ ! $INFURA_MAINNET_WS ]
then
echo "No Infura provider URL specified"
exit 1
elif [ $MODE == "http" ]
then
- WEB3_SYSTEM_TEST_PROVIDER=$INFURA_HTTP
+ WEB3_SYSTEM_TEST_PROVIDER=$INFURA_MAINNET_HTTP
else
- WEB3_SYSTEM_TEST_PROVIDER=$INFURA_WSS
+ WEB3_SYSTEM_TEST_PROVIDER=$INFURA_MAINNET_WS
fi
fi
yarn "test:$BACKEND:$MODE"
diff --git a/packages/web3/test/e2e/e2e_utils.ts b/packages/web3/test/e2e/e2e_utils.ts
index 91165ddd899..23d170cb243 100644
--- a/packages/web3/test/e2e/e2e_utils.ts
+++ b/packages/web3/test/e2e/e2e_utils.ts
@@ -22,7 +22,6 @@ along with web3.js. If not, see .
* copied over to each package's test directory. Because web3 package is the only package
* running these E2E tests that use Sepolia and Mainnet, this util exists here for now.
*/
-
import { getSystemTestBackend, BACKEND } from '../shared_fixtures/system_tests_utils';
// eslint-disable-next-line import/no-relative-packages
import secrets from '../../../../.secrets.json';
@@ -42,7 +41,10 @@ export const getE2ETestAccountAddress = (): string => {
if (process.env.TEST_ACCOUNT_ADDRESS !== undefined) {
return process.env.TEST_ACCOUNT_ADDRESS;
// eslint-disable-next-line no-else-return
- } else if (getSystemTestBackend() === BACKEND.SEPOLIA || getSystemTestBackend() === BACKEND.MAINNET) {
+ } else if (
+ getSystemTestBackend() === BACKEND.SEPOLIA ||
+ getSystemTestBackend() === BACKEND.MAINNET
+ ) {
return secrets[getSystemTestBackend().toUpperCase() as 'SEPOLIA' | 'MAINNET'].ACCOUNT
.address;
}
@@ -64,7 +66,10 @@ export const getAllowedSendTransaction = (): boolean => {
return Boolean(process.env.ALLOWED_SEND_TRANSACTION);
// eslint-disable-next-line no-else-return
- } else if (getSystemTestBackend() === BACKEND.SEPOLIA || getSystemTestBackend() === BACKEND.MAINNET) {
+ } else if (
+ getSystemTestBackend() === BACKEND.SEPOLIA ||
+ getSystemTestBackend() === BACKEND.MAINNET
+ ) {
return secrets[getSystemTestBackend().toUpperCase() as 'SEPOLIA' | 'MAINNET']
.ALLOWED_SEND_TRANSACTION;
}
@@ -76,7 +81,10 @@ export const getE2ETestAccountPrivateKey = (): string => {
if (process.env.TEST_ACCOUNT_PRIVATE_KEY !== undefined) {
return process.env.TEST_ACCOUNT_PRIVATE_KEY;
// eslint-disable-next-line no-else-return
- } else if (getSystemTestBackend() === BACKEND.SEPOLIA || getSystemTestBackend() === BACKEND.MAINNET) {
+ } else if (
+ getSystemTestBackend() === BACKEND.SEPOLIA ||
+ getSystemTestBackend() === BACKEND.MAINNET
+ ) {
return secrets[getSystemTestBackend().toUpperCase() as 'SEPOLIA' | 'MAINNET'].ACCOUNT
.privateKey;
}
diff --git a/packages/web3/test/e2e/estimate_gas.test.ts b/packages/web3/test/e2e/estimate_gas.test.ts
index 06a587027fd..bf04a1971f0 100644
--- a/packages/web3/test/e2e/estimate_gas.test.ts
+++ b/packages/web3/test/e2e/estimate_gas.test.ts
@@ -18,14 +18,19 @@ import { toHex } from 'web3-utils';
import Web3, { FMT_BYTES, FMT_NUMBER, Transaction } from '../../src';
import { getSystemE2ETestProvider } from './e2e_utils';
-import { closeOpenConnection, getSystemTestBackend, BACKEND } from '../shared_fixtures/system_tests_utils';
+import {
+ closeOpenConnection,
+ getSystemTestBackend,
+ BACKEND,
+} from '../shared_fixtures/system_tests_utils';
import { toAllVariants } from '../shared_fixtures/utils';
import { mainnetBlockData } from './fixtures/mainnet';
import { sepoliaBlockData } from './fixtures/sepolia';
describe(`${getSystemTestBackend()} tests - estimateGas`, () => {
const provider = getSystemE2ETestProvider();
- const blockData = getSystemTestBackend() === BACKEND.SEPOLIA ? sepoliaBlockData : mainnetBlockData;
+ const blockData =
+ getSystemTestBackend() === BACKEND.SEPOLIA ? sepoliaBlockData : mainnetBlockData;
const simpleEthTransaction: Transaction = {
from: '0x0000000000000000000000000000000000000000',
to: '0x0000000000000000000000000000000000000000',
@@ -37,7 +42,7 @@ describe(`${getSystemTestBackend()} tests - estimateGas`, () => {
data: '0x60806040523480156200001157600080fd5b5060405162000a6a38038062000a6a8339818101604052810190620000379190620002a4565b80600090805190602001906200004f92919062000057565b505062000359565b828054620000659062000324565b90600052602060002090601f016020900481019282620000895760008555620000d5565b82601f10620000a457805160ff1916838001178555620000d5565b82800160010185558215620000d5579182015b82811115620000d4578251825591602001919060010190620000b7565b5b509050620000e49190620000e8565b5090565b5b8082111562000103576000816000905550600101620000e9565b5090565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b620001708262000125565b810181811067ffffffffffffffff8211171562000192576200019162000136565b5b80604052505050565b6000620001a762000107565b9050620001b5828262000165565b919050565b600067ffffffffffffffff821115620001d857620001d762000136565b5b620001e38262000125565b9050602081019050919050565b60005b8381101562000210578082015181840152602081019050620001f3565b8381111562000220576000848401525b50505050565b60006200023d6200023784620001ba565b6200019b565b9050828152602081018484840111156200025c576200025b62000120565b5b62000269848285620001f0565b509392505050565b600082601f8301126200028957620002886200011b565b5b81516200029b84826020860162000226565b91505092915050565b600060208284031215620002bd57620002bc62000111565b5b600082015167ffffffffffffffff811115620002de57620002dd62000116565b5b620002ec8482850162000271565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806200033d57607f821691505b602082108103620003535762000352620002f5565b5b50919050565b61070180620003696000396000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c8063a41368621461003b578063cfae32171461006c575b600080fd5b6100556004803603810190610050919061043f565b61008a565b60405161006392919061052b565b60405180910390f35b6100746101b0565b604051610081919061055b565b60405180910390f35b600060607f0d363f2fba46ab11b6db8da0125b0d5484787c44e265b48810735998bab12b756000846040516100c0929190610672565b60405180910390a182600090805190602001906100de929190610242565b507f7d7846723bda52976e0286c6efffee937ee9f76817a867ec70531ad29fb1fc0e600060405161010f91906106a9565b60405180910390a160016000808054610127906105ac565b80601f0160208091040260200160405190810160405280929190818152602001828054610153906105ac565b80156101a05780601f10610175576101008083540402835291602001916101a0565b820191906000526020600020905b81548152906001019060200180831161018357829003601f168201915b5050505050905091509150915091565b6060600080546101bf906105ac565b80601f01602080910402602001604051908101604052809291908181526020018280546101eb906105ac565b80156102385780601f1061020d57610100808354040283529160200191610238565b820191906000526020600020905b81548152906001019060200180831161021b57829003601f168201915b5050505050905090565b82805461024e906105ac565b90600052602060002090601f01602090048101928261027057600085556102b7565b82601f1061028957805160ff19168380011785556102b7565b828001600101855582156102b7579182015b828111156102b657825182559160200191906001019061029b565b5b5090506102c491906102c8565b5090565b5b808211156102e15760008160009055506001016102c9565b5090565b6000604051905090565b600080fd5b600080fd5b600080fd5b600080fd5b6000601f19601f8301169050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b61034c82610303565b810181811067ffffffffffffffff8211171561036b5761036a610314565b5b80604052505050565b600061037e6102e5565b905061038a8282610343565b919050565b600067ffffffffffffffff8211156103aa576103a9610314565b5b6103b382610303565b9050602081019050919050565b82818337600083830152505050565b60006103e26103dd8461038f565b610374565b9050828152602081018484840111156103fe576103fd6102fe565b5b6104098482856103c0565b509392505050565b600082601f830112610426576104256102f9565b5b81356104368482602086016103cf565b91505092915050565b600060208284031215610455576104546102ef565b5b600082013567ffffffffffffffff811115610473576104726102f4565b5b61047f84828501610411565b91505092915050565b60008115159050919050565b61049d81610488565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b838110156104dd5780820151818401526020810190506104c2565b838111156104ec576000848401525b50505050565b60006104fd826104a3565b61050781856104ae565b93506105178185602086016104bf565b61052081610303565b840191505092915050565b60006040820190506105406000830185610494565b818103602083015261055281846104f2565b90509392505050565b6000602082019050818103600083015261057581846104f2565b905092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806105c457607f821691505b6020821081036105d7576105d661057d565b5b50919050565b60008190508160005260206000209050919050565b600081546105ff816105ac565b61060981866104ae565b94506001821660008114610624576001811461063657610669565b60ff1983168652602086019350610669565b61063f856105dd565b60005b8381101561066157815481890152600182019150602081019050610642565b808801955050505b50505092915050565b6000604082019050818103600083015261068c81856105f2565b905081810360208301526106a081846104f2565b90509392505050565b600060208201905081810360008301526106c381846105f2565b90509291505056fea2646970667358221220fe0f28c9f8ef0a13a95934b974e7bc2ca6762b40a5b93ccd6ca2038f454bf52764736f6c634300080e003300000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000017736f6c79656e7420677265656e2069732070656f706c65000000000000000000',
};
const expectedContractDeploymentTransactionGas =
- getSystemTestBackend() === BACKEND.SEPOLIA ? 475494 : 475494;
+ getSystemTestBackend() === BACKEND.SEPOLIA ? 480435 : 480435;
let web3: Web3;
@@ -61,10 +66,7 @@ describe(`${getSystemTestBackend()} tests - estimateGas`, () => {
}),
)('estimateGas', async ({ transaction, block, format }) => {
let _blockData = blockData[block];
- if (
- getSystemTestBackend() === BACKEND.MAINNET &&
- (block === 'blockHash' || block === 'blockNumber')
- ) {
+ if (block === 'blockHash' || block === 'blockNumber') {
/**
* @NOTE Getting a block too far back in history
* results in a missing trie node error, so
diff --git a/packages/web3/test/e2e/fixtures/sepolia.ts b/packages/web3/test/e2e/fixtures/sepolia.ts
index 9ab06b665db..6f79a26024c 100644
--- a/packages/web3/test/e2e/fixtures/sepolia.ts
+++ b/packages/web3/test/e2e/fixtures/sepolia.ts
@@ -636,8 +636,108 @@ export const sepoliaBlockHydrated = {
value: '0x143c70de9f84c8',
},
],
+
transactionsRoot: '0xbd2f86bc39fbe1ac6e24ce390d268404c199da060116437803875d2c0bfe7970',
uncles: [],
+ withdrawals: [
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x3112f',
+ index: '0x3a477e',
+ validatorIndex: '0x38b',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a477f',
+ validatorIndex: '0x38c',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a4780',
+ validatorIndex: '0x38d',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x23743',
+ index: '0x3a4781',
+ validatorIndex: '0x38e',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a4782',
+ validatorIndex: '0x38f',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a4783',
+ validatorIndex: '0x390',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a4784',
+ validatorIndex: '0x391',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a4785',
+ validatorIndex: '0x392',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a4786',
+ validatorIndex: '0x393',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x25915',
+ index: '0x3a4787',
+ validatorIndex: '0x394',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a4788',
+ validatorIndex: '0x395',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a4789',
+ validatorIndex: '0x396',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a478a',
+ validatorIndex: '0x397',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a478b',
+ validatorIndex: '0x398',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a478c',
+ validatorIndex: '0x399',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x3112f',
+ index: '0x3a478d',
+ validatorIndex: '0x39a',
+ },
+ ],
+ withdrawalsRoot: '0xb99e42eaca3fc1000aa8be987cf107e08030c0e9ca93dc6ea6b7df69e377f953',
};
export const sepoliaBlock = {
@@ -694,6 +794,105 @@ export const sepoliaBlock = {
],
transactionsRoot: '0xbd2f86bc39fbe1ac6e24ce390d268404c199da060116437803875d2c0bfe7970',
uncles: [],
+ withdrawals: [
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x3112f',
+ index: '0x3a477e',
+ validatorIndex: '0x38b',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a477f',
+ validatorIndex: '0x38c',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a4780',
+ validatorIndex: '0x38d',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x23743',
+ index: '0x3a4781',
+ validatorIndex: '0x38e',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a4782',
+ validatorIndex: '0x38f',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a4783',
+ validatorIndex: '0x390',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a4784',
+ validatorIndex: '0x391',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a4785',
+ validatorIndex: '0x392',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a4786',
+ validatorIndex: '0x393',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x25915',
+ index: '0x3a4787',
+ validatorIndex: '0x394',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a4788',
+ validatorIndex: '0x395',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a4789',
+ validatorIndex: '0x396',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a478a',
+ validatorIndex: '0x397',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a478b',
+ validatorIndex: '0x398',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x2ef5d',
+ index: '0x3a478c',
+ validatorIndex: '0x399',
+ },
+ {
+ address: '0xe276bc378a527a8792b353cdca5b5e53263dfb9e',
+ amount: '0x3112f',
+ index: '0x3a478d',
+ validatorIndex: '0x39a',
+ },
+ ],
+ withdrawalsRoot: '0xb99e42eaca3fc1000aa8be987cf107e08030c0e9ca93dc6ea6b7df69e377f953',
};
export const sepoliaBlockData: {
diff --git a/packages/web3/test/e2e/get_balance.test.ts b/packages/web3/test/e2e/get_balance.test.ts
index daba0c6397f..e07f79b83fe 100644
--- a/packages/web3/test/e2e/get_balance.test.ts
+++ b/packages/web3/test/e2e/get_balance.test.ts
@@ -19,14 +19,19 @@ import { toHex } from 'web3-utils';
import Web3, { FMT_BYTES, FMT_NUMBER } from '../../src';
import { getSystemE2ETestProvider, getE2ETestAccountAddress } from './e2e_utils';
-import { closeOpenConnection, getSystemTestBackend, BACKEND } from '../shared_fixtures/system_tests_utils';
+import {
+ closeOpenConnection,
+ getSystemTestBackend,
+ BACKEND,
+} from '../shared_fixtures/system_tests_utils';
import { toAllVariants } from '../shared_fixtures/utils';
import { sepoliaBlockData } from './fixtures/sepolia';
import { mainnetBlockData } from './fixtures/mainnet';
describe(`${getSystemTestBackend()} tests - getBalance`, () => {
const provider = getSystemE2ETestProvider();
- const blockData = getSystemTestBackend() === BACKEND.SEPOLIA ? sepoliaBlockData : mainnetBlockData;
+ const blockData =
+ getSystemTestBackend() === BACKEND.SEPOLIA ? sepoliaBlockData : mainnetBlockData;
const expectedBalance =
getSystemTestBackend() === BACKEND.SEPOLIA ? '172530374997217200' : '2099795781954790368';
diff --git a/packages/web3/test/e2e/get_block.test.ts b/packages/web3/test/e2e/get_block.test.ts
index bd9753992b6..33d78291b36 100644
--- a/packages/web3/test/e2e/get_block.test.ts
+++ b/packages/web3/test/e2e/get_block.test.ts
@@ -21,7 +21,11 @@ import { format as formatter } from 'web3-utils';
import Web3, { FMT_BYTES, FMT_NUMBER } from '../../src';
import { getSystemE2ETestProvider } from './e2e_utils';
-import { closeOpenConnection, getSystemTestBackend, BACKEND } from '../shared_fixtures/system_tests_utils';
+import {
+ closeOpenConnection,
+ getSystemTestBackend,
+ BACKEND,
+} from '../shared_fixtures/system_tests_utils';
import { toAllVariants } from '../shared_fixtures/utils';
import { sepoliaBlock, sepoliaBlockData, sepoliaBlockHydrated } from './fixtures/sepolia';
import { mainnetBlockHydrated } from './fixtures/mainnet_block_hydrated';
@@ -29,7 +33,8 @@ import { mainnetBlock, mainnetBlockData } from './fixtures/mainnet';
describe(`${getSystemTestBackend()} tests - getBlock`, () => {
const provider = getSystemE2ETestProvider();
- const blockData = getSystemTestBackend() === BACKEND.SEPOLIA ? sepoliaBlockData : mainnetBlockData;
+ const blockData =
+ getSystemTestBackend() === BACKEND.SEPOLIA ? sepoliaBlockData : mainnetBlockData;
let web3: Web3;
diff --git a/packages/web3/test/e2e/get_block_transaction_count.test.ts b/packages/web3/test/e2e/get_block_transaction_count.test.ts
index ef65b08a2bb..0dea0eb16f7 100644
--- a/packages/web3/test/e2e/get_block_transaction_count.test.ts
+++ b/packages/web3/test/e2e/get_block_transaction_count.test.ts
@@ -15,19 +15,22 @@ You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
import { isBigInt, isHexStrict, isNumber, isString } from 'web3-validator';
-import { toHex } from 'web3-utils';
import Web3, { FMT_BYTES, FMT_NUMBER } from '../../src';
import { getSystemE2ETestProvider } from './e2e_utils';
-import { closeOpenConnection, getSystemTestBackend, BACKEND } from '../shared_fixtures/system_tests_utils';
+import {
+ closeOpenConnection,
+ getSystemTestBackend,
+ BACKEND,
+} from '../shared_fixtures/system_tests_utils';
import { toAllVariants } from '../shared_fixtures/utils';
import { sepoliaBlockData } from './fixtures/sepolia';
import { mainnetBlockData } from './fixtures/mainnet';
describe(`${getSystemTestBackend()} tests - getBlockTransactionCount`, () => {
const provider = getSystemE2ETestProvider();
- const blockData = getSystemTestBackend() === BACKEND.SEPOLIA ? sepoliaBlockData : mainnetBlockData;
- const expectedTransactionCount = getSystemTestBackend() === BACKEND.SEPOLIA ? 30 : 196;
+ const blockData =
+ getSystemTestBackend() === BACKEND.SEPOLIA ? sepoliaBlockData : mainnetBlockData;
let web3: Web3;
@@ -63,53 +66,35 @@ describe(`${getSystemTestBackend()} tests - getBlockTransactionCount`, () => {
format: Object.values(FMT_NUMBER),
}),
)('getBlockTransactionCount', async ({ block, format }) => {
- const result = await web3.eth.getBlockTransactionCount(blockData[block], {
+ let _blockData = blockData[block];
+ if (block === 'blockHash' || block === 'blockNumber') {
+ const latestBlock = await web3.eth.getBlock('finalized');
+ _blockData =
+ block === 'blockHash' ? (latestBlock.hash as string) : Number(latestBlock.number);
+ }
+ const result = await web3.eth.getBlockTransactionCount(_blockData, {
number: format as FMT_NUMBER,
bytes: FMT_BYTES.HEX,
});
-
- if (block === 'blockHash' || block === 'blockNumber') {
- switch (format) {
- case 'NUMBER_NUMBER':
- // eslint-disable-next-line jest/no-conditional-expect
- expect(result).toBe(expectedTransactionCount);
- break;
- case 'NUMBER_HEX':
- // eslint-disable-next-line jest/no-conditional-expect
- expect(result).toBe(toHex(expectedTransactionCount));
- break;
- case 'NUMBER_STR':
- // eslint-disable-next-line jest/no-conditional-expect
- expect(result).toBe(`${expectedTransactionCount}`);
- break;
- case 'NUMBER_BIGINT':
- // eslint-disable-next-line jest/no-conditional-expect
- expect(result).toBe(BigInt(expectedTransactionCount));
- break;
- default:
- throw new Error('Unhandled format');
- }
- } else {
- switch (format) {
- case 'NUMBER_NUMBER':
- // eslint-disable-next-line jest/no-conditional-expect
- expect(isNumber(result)).toBeTruthy();
- break;
- case 'NUMBER_HEX':
- // eslint-disable-next-line jest/no-conditional-expect
- expect(isHexStrict(result)).toBeTruthy();
- break;
- case 'NUMBER_STR':
- // eslint-disable-next-line jest/no-conditional-expect
- expect(isString(result)).toBeTruthy();
- break;
- case 'NUMBER_BIGINT':
- // eslint-disable-next-line jest/no-conditional-expect
- expect(isBigInt(result)).toBeTruthy();
- break;
- default:
- throw new Error('Unhandled format');
- }
+ switch (format) {
+ case 'NUMBER_NUMBER':
+ // eslint-disable-next-line jest/no-conditional-expect
+ expect(isNumber(result)).toBeTruthy();
+ break;
+ case 'NUMBER_HEX':
+ // eslint-disable-next-line jest/no-conditional-expect
+ expect(isHexStrict(result)).toBeTruthy();
+ break;
+ case 'NUMBER_STR':
+ // eslint-disable-next-line jest/no-conditional-expect
+ expect(isString(result)).toBeTruthy();
+ break;
+ case 'NUMBER_BIGINT':
+ // eslint-disable-next-line jest/no-conditional-expect
+ expect(isBigInt(result)).toBeTruthy();
+ break;
+ default:
+ throw new Error('Unhandled format');
}
});
});
diff --git a/packages/web3/test/e2e/get_block_uncle_count.test.ts b/packages/web3/test/e2e/get_block_uncle_count.test.ts
index eb13f823585..c06f57aec85 100644
--- a/packages/web3/test/e2e/get_block_uncle_count.test.ts
+++ b/packages/web3/test/e2e/get_block_uncle_count.test.ts
@@ -16,49 +16,66 @@ along with web3.js. If not, see .
*/
import Web3 from '../../src';
import { getSystemE2ETestProvider } from './e2e_utils';
-import { closeOpenConnection, getSystemTestBackend, describeIf, BACKEND} from '../shared_fixtures/system_tests_utils';
+import {
+ closeOpenConnection,
+ getSystemTestBackend,
+ describeIf,
+ BACKEND,
+} from '../shared_fixtures/system_tests_utils';
import { toAllVariants } from '../shared_fixtures/utils';
import { sepoliaBlockData } from './fixtures/sepolia';
import { mainnetBlockData } from './fixtures/mainnet';
-describeIf(getSystemTestBackend() !== 'hardhat')(`${getSystemTestBackend()} tests - getBlockUncleCount`, () => {
- const provider = getSystemE2ETestProvider();
- const blockData = getSystemTestBackend() === BACKEND.SEPOLIA ? sepoliaBlockData : mainnetBlockData;
+describeIf(getSystemTestBackend() !== 'hardhat')(
+ `${getSystemTestBackend()} tests - getBlockUncleCount`,
+ () => {
+ const provider = getSystemE2ETestProvider();
+ const blockData =
+ getSystemTestBackend() === BACKEND.SEPOLIA ? sepoliaBlockData : mainnetBlockData;
- let web3: Web3;
+ let web3: Web3;
- beforeAll(() => {
- web3 = new Web3(provider);
- });
+ beforeAll(() => {
+ web3 = new Web3(provider);
+ });
- afterAll(async () => {
- await closeOpenConnection(web3);
- });
- // eslint-disable-next-line jest/consistent-test-it
- it.each(
- toAllVariants<{
- block:
- | 'earliest'
- | 'latest'
- | 'pending'
- | 'finalized'
- | 'safe'
- | 'blockHash'
- | 'blockNumber';
- }>({
- block: [
- 'earliest',
- 'latest',
- 'pending',
- 'safe',
- 'finalized',
- 'blockHash',
- 'blockNumber',
- ],
- }),
- )('getBlockUncleCount', async ({ block }) => {
- const result = await web3.eth.getBlockUncleCount(blockData[block]);
+ afterAll(async () => {
+ await closeOpenConnection(web3);
+ });
+ // eslint-disable-next-line jest/consistent-test-it
+ it.each(
+ toAllVariants<{
+ block:
+ | 'earliest'
+ | 'latest'
+ | 'pending'
+ | 'finalized'
+ | 'safe'
+ | 'blockHash'
+ | 'blockNumber';
+ }>({
+ block: [
+ 'earliest',
+ 'latest',
+ 'pending',
+ 'safe',
+ 'finalized',
+ 'blockHash',
+ 'blockNumber',
+ ],
+ }),
+ )('getBlockUncleCount', async ({ block }) => {
+ let _blockData = blockData[block];
+ if (block === 'blockHash' || block === 'blockNumber') {
+ const latestBlock = await web3.eth.getBlock('finalized');
+ _blockData =
+ block === 'blockHash'
+ ? (latestBlock.hash as string)
+ : Number(latestBlock.number);
+ }
+ const result = await web3.eth.getBlockUncleCount(_blockData);
- expect(result).toBe(BigInt(0));
- });
-});
+ expect(result).toBe(BigInt(0));
+ });
+ },
+);
diff --git a/packages/web3/test/e2e/get_chain_id.test.ts b/packages/web3/test/e2e/get_chain_id.test.ts
index c58fe360c1b..be29c9928c7 100644
--- a/packages/web3/test/e2e/get_chain_id.test.ts
+++ b/packages/web3/test/e2e/get_chain_id.test.ts
@@ -18,7 +18,11 @@ import { toHex } from 'web3-utils';
import Web3, { FMT_BYTES, FMT_NUMBER } from '../../src';
import { getSystemE2ETestProvider } from './e2e_utils';
-import { closeOpenConnection, getSystemTestBackend, BACKEND } from '../shared_fixtures/system_tests_utils';
+import {
+ closeOpenConnection,
+ getSystemTestBackend,
+ BACKEND,
+} from '../shared_fixtures/system_tests_utils';
import { toAllVariants } from '../shared_fixtures/utils';
describe(`${getSystemTestBackend()} tests - getChainId`, () => {
diff --git a/packages/web3/test/e2e/get_id.test.ts b/packages/web3/test/e2e/get_id.test.ts
index 191c355340b..21ff5a7e4f7 100644
--- a/packages/web3/test/e2e/get_id.test.ts
+++ b/packages/web3/test/e2e/get_id.test.ts
@@ -16,11 +16,16 @@ along with web3.js. If not, see .
*/
import Web3 from '../../src';
import { getSystemE2ETestProvider } from './e2e_utils';
-import { closeOpenConnection, getSystemTestBackend, BACKEND } from '../shared_fixtures/system_tests_utils';
+import {
+ closeOpenConnection,
+ getSystemTestBackend,
+ BACKEND,
+} from '../shared_fixtures/system_tests_utils';
describe(`${getSystemTestBackend()} tests - getId`, () => {
const provider = getSystemE2ETestProvider();
- const expectedChainId = getSystemTestBackend() === BACKEND.SEPOLIA ? BigInt(11155111) : BigInt(1);
+ const expectedChainId =
+ getSystemTestBackend() === BACKEND.SEPOLIA ? BigInt(11155111) : BigInt(1);
let web3: Web3;
diff --git a/packages/web3/test/e2e/get_proof.test.ts b/packages/web3/test/e2e/get_proof.test.ts
index 711abf0fac3..a8c17c6558a 100644
--- a/packages/web3/test/e2e/get_proof.test.ts
+++ b/packages/web3/test/e2e/get_proof.test.ts
@@ -18,14 +18,19 @@ along with web3.js. If not, see .
import Web3, { AccountObject } from '../../src';
import { getSystemE2ETestProvider } from './e2e_utils';
-import { closeOpenConnection, getSystemTestBackend, BACKEND } from '../shared_fixtures/system_tests_utils';
+import {
+ closeOpenConnection,
+ getSystemTestBackend,
+ BACKEND,
+} from '../shared_fixtures/system_tests_utils';
import { toAllVariants } from '../shared_fixtures/utils';
import { mainnetBlockData, mainnetProof } from './fixtures/mainnet';
import { sepoliaBlockData, sepoliaProof } from './fixtures/sepolia';
describe(`${getSystemTestBackend()} tests - getProof`, () => {
const provider = getSystemE2ETestProvider();
- const blockData = getSystemTestBackend() === BACKEND.SEPOLIA ? sepoliaBlockData : mainnetBlockData;
+ const blockData =
+ getSystemTestBackend() === BACKEND.SEPOLIA ? sepoliaBlockData : mainnetBlockData;
const expectedProof = getSystemTestBackend() === BACKEND.SEPOLIA ? sepoliaProof : mainnetProof;
let web3: Web3;
@@ -68,8 +73,7 @@ describe(`${getSystemTestBackend()} tests - getProof`, () => {
if (block === 'blockHash' || block === 'blockNumber') {
expect(result).toEqual(expectedProof);
- }
- else if(block === 'pending') {
+ } else if (block === 'pending') {
expect(result).toMatchObject({
balance: expect.any(BigInt),
codeHash: expect.any(String),
@@ -77,8 +81,7 @@ describe(`${getSystemTestBackend()} tests - getProof`, () => {
storageHash: expect.any(String),
storageProof: expect.any(Array),
});
- }
- else {
+ } else {
expect(result).toMatchObject({
accountProof: expect.any(Array),
balance: expect.any(BigInt),
diff --git a/packages/web3/test/e2e/get_transaction_count.test.ts b/packages/web3/test/e2e/get_transaction_count.test.ts
index 7f679ca32c4..89017756181 100644
--- a/packages/web3/test/e2e/get_transaction_count.test.ts
+++ b/packages/web3/test/e2e/get_transaction_count.test.ts
@@ -16,14 +16,19 @@ along with web3.js. If not, see .
*/
import Web3 from '../../src';
import { getSystemE2ETestProvider, getE2ETestAccountAddress } from './e2e_utils';
-import { closeOpenConnection, getSystemTestBackend, BACKEND } from '../shared_fixtures/system_tests_utils';
+import {
+ closeOpenConnection,
+ getSystemTestBackend,
+ BACKEND,
+} from '../shared_fixtures/system_tests_utils';
import { toAllVariants } from '../shared_fixtures/utils';
import { sepoliaBlockData } from './fixtures/sepolia';
import { mainnetBlockData } from './fixtures/mainnet';
describe(`${getSystemTestBackend()} tests - getTransactionCount`, () => {
const provider = getSystemE2ETestProvider();
- const blockData = getSystemTestBackend() === BACKEND.SEPOLIA ? sepoliaBlockData : mainnetBlockData;
+ const blockData =
+ getSystemTestBackend() === BACKEND.SEPOLIA ? sepoliaBlockData : mainnetBlockData;
let web3: Web3;
@@ -63,7 +68,8 @@ describe(`${getSystemTestBackend()} tests - getTransactionCount`, () => {
);
if (block === 'blockHash' || block === 'blockNumber') {
- const expectedTxCount = getSystemTestBackend() === BACKEND.SEPOLIA ? BigInt(1) : BigInt(11);
+ const expectedTxCount =
+ getSystemTestBackend() === BACKEND.SEPOLIA ? BigInt(1) : BigInt(11);
// eslint-disable-next-line jest/no-conditional-expect
expect(result).toBe(expectedTxCount);
} else {
diff --git a/packages/web3/test/e2e/get_transaction_from_block.test.ts b/packages/web3/test/e2e/get_transaction_from_block.test.ts
index 20fd48b5f4e..7d5c434429c 100644
--- a/packages/web3/test/e2e/get_transaction_from_block.test.ts
+++ b/packages/web3/test/e2e/get_transaction_from_block.test.ts
@@ -20,15 +20,19 @@ import { Numbers, TransactionInfo } from 'web3-types';
import Web3 from '../../src';
import { getSystemE2ETestProvider } from './e2e_utils';
-import { closeOpenConnection, getSystemTestBackend, BACKEND } from '../shared_fixtures/system_tests_utils';
+import {
+ closeOpenConnection,
+ getSystemTestBackend,
+ BACKEND,
+} from '../shared_fixtures/system_tests_utils';
import { toAllVariants } from '../shared_fixtures/utils';
import { sepoliaBlockData, sepoliaTransactionFromBlock } from './fixtures/sepolia';
import { mainnetBlockData, mainnetTransactionFromBlock } from './fixtures/mainnet';
describe(`${getSystemTestBackend()} tests - getTransactionFromBlock`, () => {
const provider = getSystemE2ETestProvider();
- const blockData = getSystemTestBackend() === BACKEND.SEPOLIA ? sepoliaBlockData : mainnetBlockData;
-
+ const blockData =
+ getSystemTestBackend() === BACKEND.SEPOLIA ? sepoliaBlockData : mainnetBlockData;
let web3: Web3;
beforeAll(() => {
diff --git a/packages/web3/test/e2e/get_uncle.test.ts b/packages/web3/test/e2e/get_uncle.test.ts
index 586026b82a7..0481706c4a5 100644
--- a/packages/web3/test/e2e/get_uncle.test.ts
+++ b/packages/web3/test/e2e/get_uncle.test.ts
@@ -18,14 +18,19 @@ import { Numbers } from 'web3-types';
import Web3 from '../../src';
import { getSystemE2ETestProvider } from './e2e_utils';
-import { closeOpenConnection, getSystemTestBackend, BACKEND } from '../shared_fixtures/system_tests_utils';
+import {
+ closeOpenConnection,
+ getSystemTestBackend,
+ BACKEND,
+} from '../shared_fixtures/system_tests_utils';
import { toAllVariants } from '../shared_fixtures/utils';
import { mainnetBlockData } from './fixtures/mainnet';
import { sepoliaBlockData } from './fixtures/sepolia';
describe(`${getSystemTestBackend()} tests - getUncle`, () => {
const provider = getSystemE2ETestProvider();
- const blockData = getSystemTestBackend() === BACKEND.SEPOLIA ? sepoliaBlockData : mainnetBlockData;
+ const blockData =
+ getSystemTestBackend() === BACKEND.SEPOLIA ? sepoliaBlockData : mainnetBlockData;
let web3: Web3;
@@ -39,25 +44,10 @@ describe(`${getSystemTestBackend()} tests - getUncle`, () => {
it.each(
toAllVariants<{
- block:
- | 'earliest'
- | 'latest'
- | 'pending'
- | 'finalized'
- | 'safe'
- | 'blockHash'
- | 'blockNumber';
+ block: 'earliest' | 'latest' | 'pending' | 'finalized' | 'safe';
uncleIndex: Numbers;
}>({
- block: [
- 'earliest',
- 'latest',
- 'pending',
- 'safe',
- 'finalized',
- 'blockHash',
- 'blockNumber',
- ],
+ block: ['earliest', 'latest', 'pending', 'safe', 'finalized'],
uncleIndex: ['0x1', '1', 1, BigInt(1)],
}),
)('getUncle', async ({ block, uncleIndex }) => {
diff --git a/packages/web3/test/e2e/mainnet/get_code.test.ts b/packages/web3/test/e2e/mainnet/get_code.test.ts
index 0bcb6026510..df2ae77d046 100644
--- a/packages/web3/test/e2e/mainnet/get_code.test.ts
+++ b/packages/web3/test/e2e/mainnet/get_code.test.ts
@@ -14,7 +14,7 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { hexToBytes } from 'web3-utils';
+import { hexToBytes, toHex } from 'web3-utils';
import Web3, { FMT_BYTES, FMT_NUMBER } from '../../../src';
import {
@@ -62,7 +62,13 @@ describe(`${getSystemTestBackend()} tests - getCode`, () => {
format: Object.values(FMT_BYTES),
}),
)('should getCode for deployed contract', async ({ block, format }) => {
- const result = await web3.eth.getCode(getE2ETestContractAddress(), blockData[block], {
+ let _blockData = blockData[block];
+ if (block === 'blockHash' || block === 'blockNumber') {
+ const latestBlock = await web3.eth.getBlock('finalized');
+ _blockData =
+ block === 'blockHash' ? (latestBlock.hash as string) : toHex(latestBlock.number);
+ }
+ const result = await web3.eth.getCode(getE2ETestContractAddress(), _blockData, {
number: FMT_NUMBER.HEX,
bytes: format as FMT_BYTES,
});
diff --git a/packages/web3/test/e2e/mainnet/get_storage_at.test.ts b/packages/web3/test/e2e/mainnet/get_storage_at.test.ts
index 05512d99ec4..7db7017fb1d 100644
--- a/packages/web3/test/e2e/mainnet/get_storage_at.test.ts
+++ b/packages/web3/test/e2e/mainnet/get_storage_at.test.ts
@@ -60,10 +60,18 @@ describe(`${getSystemTestBackend()} tests - getStorageAt`, () => {
],
}),
)('getStorageAt', async ({ storageSlot, block }) => {
+ let blockData = mainnetBlockData[block];
+ if (block === 'blockHash' || block === 'blockNumber') {
+ const blockNumber = await web3.eth.getBlockNumber();
+ blockData = Number(blockNumber);
+ if (block === 'blockHash') {
+ blockData = (await web3.eth.getBlock(blockNumber)).hash as string;
+ }
+ }
const result = await web3.eth.getStorageAt(
getE2ETestContractAddress(),
storageSlot,
- mainnetBlockData[block],
+ blockData,
);
if (mainnetBlockData[block] === 'earliest') {
@@ -72,7 +80,7 @@ describe(`${getSystemTestBackend()} tests - getStorageAt`, () => {
} else if (block === 'blockHash' || block === 'blockNumber') {
// eslint-disable-next-line jest/no-conditional-expect
expect(result).toBe(
- '0x000000000000000000000000000000000000000000000000007d5a864f06b2d5',
+ '0x00000000000000000000000000000000000000000000000000b8b61e3be91403',
);
} else {
// eslint-disable-next-line jest/no-conditional-expect
diff --git a/packages/web3/test/e2e/sepolia/get_code.test.ts b/packages/web3/test/e2e/sepolia/get_code.test.ts
index 43373feb180..c42bd183502 100644
--- a/packages/web3/test/e2e/sepolia/get_code.test.ts
+++ b/packages/web3/test/e2e/sepolia/get_code.test.ts
@@ -14,8 +14,8 @@ GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with web3.js. If not, see .
*/
-import { hexToBytes } from 'web3-utils';
-
+import { hexToBytes, toHex } from 'web3-utils';
+import { BlockNumberOrTag } from 'web3-types';
import Web3, { FMT_BYTES, FMT_NUMBER } from '../../../src';
import {
closeOpenConnection,
@@ -49,14 +49,16 @@ describe(`${getSystemTestBackend()} tests - getCode`, () => {
format: Object.values(FMT_BYTES),
}),
)('should getCode for deployed contract', async ({ block, format }) => {
- const result = await web3.eth.getCode(
- getE2ETestContractAddress(),
- sepoliaBlockData[block],
- {
- number: FMT_NUMBER.HEX,
- bytes: format as FMT_BYTES,
- },
- );
+ let blockData = sepoliaBlockData[block] as BlockNumberOrTag;
+ if (block === 'blockHash' || block === 'blockNumber') {
+ const latestBlock = await web3.eth.getBlock('finalized');
+ blockData =
+ block === 'blockHash' ? (latestBlock.hash as string) : toHex(latestBlock.number);
+ }
+ const result = await web3.eth.getCode(getE2ETestContractAddress(), blockData, {
+ number: FMT_NUMBER.HEX,
+ bytes: format as FMT_BYTES,
+ });
switch (format) {
case 'BYTES_HEX':
diff --git a/packages/web3/test/e2e/sepolia/get_storage_at.test.ts b/packages/web3/test/e2e/sepolia/get_storage_at.test.ts
index 7702da89ffb..a9f8e0ddf68 100644
--- a/packages/web3/test/e2e/sepolia/get_storage_at.test.ts
+++ b/packages/web3/test/e2e/sepolia/get_storage_at.test.ts
@@ -64,12 +64,20 @@ describe(`${getSystemTestBackend()} tests - getStorageAt`, () => {
],
}),
)('getStorageAt', async ({ storageSlot, block }) => {
+ let blockData = sepoliaBlockData[block];
+ if (block === 'blockHash' || block === 'blockNumber') {
+ const blockNumber = await web3.eth.getBlockNumber();
+ blockData = Number(blockNumber);
+ if (block === 'blockHash') {
+ blockData = (await web3.eth.getBlock(blockNumber)).hash as string;
+ }
+ }
+
const result = await web3.eth.getStorageAt(
getE2ETestContractAddress(),
storageSlot,
- sepoliaBlockData[block],
+ blockData,
);
-
if (sepoliaBlockData[block] === 'earliest') {
// Nethermind returns 0x while Geth returns 0x0000000000000000000000000000000000000000000000000000000000000000
// eslint-disable-next-line jest/no-conditional-expect