Skip to content

Commit

Permalink
fix: max data bound and ethamount constants
Browse files Browse the repository at this point in the history
  • Loading branch information
hopeyen committed Sep 11, 2024
1 parent b1be4c4 commit 4b42fa3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions scripts/flood.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,18 @@ async function simulateNetworkFlood(argv: any) {
}

console.log(`start sending transactions`)
argv.ethamount = "0.0001"

// throughput / threads = avg tx size < 127size
// if throughput target is set, we will not respect the maxTxDataSize setting
if (argv.targetThroughput > 0) {
const avg_tx_size = argv.targetThroughput / argv.threads;
argv.delay = 1000 // 1 second delay
// We don't care about the float throughput, just send 1 more transaction of the same average size
argv.threads = argv.targetThroughput > 125_000 ? argv.targetThroughput / 125_000 + 1 : 1
const size = argv.targetThroughput / argv.threads
for (let i = 0; i < argv.rounds; i++) {
argv.from = `user_${randomInRange(argv.user_count)}`;
argv.to = `user_${randomInRange(argv.user_count)}`; // don't care if sending to self
const size = randomInRange(avg_tx_size * 2)
argv.data = generateRandomHexData(size);

console.log(`prepared transactions`, { transaction_count: i, size: size, argv: argv })
Expand All @@ -88,7 +93,6 @@ async function simulateNetworkFlood(argv: any) {
}
}


export const floodCommand = {
command: "flood",
describe: "Simulates network activity by sending arbitrary transactions among random user_count",
Expand Down

0 comments on commit 4b42fa3

Please sign in to comment.