-
Notifications
You must be signed in to change notification settings - Fork 5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stress Tests 2 - QA Tests #6583
Merged
+229
−186
Merged
Changes from 12 commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
4060610
add data stress test
avkos b9188d6
fix unit tests
avkos a9a1138
fix
avkos 7217b8c
try to fix validator test
avkos 071effb
fix ipc tests
avkos a59ee25
fix load test
avkos 7ac76be
fix
avkos df948c0
move to tests folder
avkos 21114eb
moved
avkos ba56d6a
fix
avkos 0c3afb9
Merge branch '4.x' into ok/5563-Stress-Tests-2---QA-Tests
avkos 3ddf0dd
move validator test to web3 package
avkos 3f35de2
move to TS. remove time logs
avkos 11dd804
fix start.sh
avkos d38f993
Merge branch '4.x' into ok/5563-Stress-Tests-2---QA-Tests
avkos af66127
fix validation test run script
avkos cca9311
fix name
avkos File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
This file is part of web3.js. | ||
|
||
web3.js is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Lesser General Public License as published by | ||
the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
|
||
web3.js is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
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 <http://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
/* eslint-disable */ | ||
const { Web3 } = require('../../lib/commonjs'); | ||
const { IpcProvider } = require('../../../web3-providers-ipc/lib/commonjs'); | ||
const accounts = require('../../../../scripts/accounts.json'); | ||
const contractData = require('../../../../fixtures/build/Basic.json'); | ||
|
||
const DATA_AMOUNT = 50 * 1024; // 50 kB | ||
|
||
const sendAndGetData = async (web3, i) => { | ||
const sendOptions = { from: accounts[i].address }; | ||
const deployOptions = { | ||
data: contractData.evm.bytecode.object, | ||
arguments: [123, ''], | ||
gasPrice: await web3.eth.getGasPrice(), | ||
gas: BigInt(9000000000000), | ||
gasLimit: BigInt(9000000000000), | ||
type: BigInt(0), | ||
}; | ||
const c = new web3.eth.Contract(contractData.abi); | ||
const contract = await c.deploy(deployOptions).send(sendOptions); | ||
|
||
console.time(`Send huge data [${i}]`); | ||
const receipt = await contract.methods | ||
.setValues(1, 'A'.repeat(DATA_AMOUNT), true) | ||
.send({ from: accounts[i].address }); | ||
console.timeLog(`Send huge data [${i}]`, receipt.transactionHash); | ||
|
||
console.time(`Get huge data [${i}]`); | ||
await contract.methods.getStringValue().call(); | ||
console.timeLog(`Get huge data [${i}]`); | ||
}; | ||
|
||
const test = async () => { | ||
const providerString = process.env.WEB3_SYSTEM_TEST_PROVIDER; | ||
console.log(`Start test with provider: ${providerString}`); | ||
const provider = providerString.includes('ipc') | ||
? new IpcProvider(providerString) | ||
: new Web3.providers.WebsocketProvider(providerString); | ||
const web3 = new Web3(provider); | ||
|
||
for (const a of accounts) { | ||
const acc = web3.eth.accounts.privateKeyToAccount(a.privateKey); | ||
web3.eth.accounts.wallet.add(acc); | ||
} | ||
|
||
const prs = []; | ||
for (let i = 0; i < 15; i++) { | ||
prs.push(sendAndGetData(web3, i)); | ||
} | ||
await Promise.all(prs); | ||
web3.provider.disconnect(); | ||
}; | ||
|
||
test().catch(console.error); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/usr/bin/env bash | ||
. scripts/env.sh | ||
|
||
export WEB3_SYSTEM_TEST_BACKEND="geth" | ||
|
||
./scripts/geth_binary.sh stressStart | ||
|
||
yarn generate:accounts | ||
|
||
export WEB3_SYSTEM_TEST_PROVIDER=$IPC_PATH | ||
node ./packages/web3/test/stress/index.js | ||
|
||
export WEB3_SYSTEM_TEST_PROVIDER=ws://127.0.0.1:8545 | ||
node ./packages/web3/test/stress/index.js | ||
|
||
./scripts/geth_binary.sh stop |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here as shared in #6595 (comment)