Skip to content

Commit e410f42

Browse files
authored
Merge pull request #122 from paritytech/pg/fix-spammer
Fix spammer script
2 parents c2422ca + d70d089 commit e410f42

File tree

2 files changed

+7
-43
lines changed

2 files changed

+7
-43
lines changed

src/spammer.ts

100644100755
Lines changed: 5 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,7 @@
1-
import {
2-
getByteCode,
3-
getEnv,
4-
killProcessOnPort,
5-
wait,
6-
waitForHealth,
7-
} from './util.ts'
8-
import { FlipperAbi } from '../codegen/abi/Flipper.ts'
9-
10-
if (Deno.env.get('START_REVIVE_DEV_NODE')) {
11-
const nodePath = Deno.env.get('REVIVE_DEV_NODE_PATH') ??
12-
`${Deno.env.get('HOME')}/polkadot-sdk/target/debug/revive-dev-node`
13-
console.log(`🚀 Start node ${nodePath}...`)
14-
killProcessOnPort(9944)
15-
new Deno.Command(nodePath, {
16-
args: [
17-
'--dev',
18-
'-l=error,evm=debug,sc_rpc_server=info,runtime::revive=debug',
19-
],
20-
stdout: 'inherit',
21-
stderr: 'inherit',
22-
}).spawn()
23-
}
1+
#!/usr/bin/env -S deno run --env-file --allow-all
242

25-
// Run eth-rpc on 8545
26-
if (Deno.env.get('START_ETH_RPC')) {
27-
const adapterPath = Deno.env.get('ETH_RPC_PATH') ??
28-
`${Deno.env.get('HOME')}/polkadot-sdk/target/debug/eth-rpc`
29-
console.log(`🚀 Start eth-rpc ${adapterPath} ...`)
30-
killProcessOnPort(8545)
31-
new Deno.Command(adapterPath, {
32-
args: [
33-
'--dev',
34-
'--node-rpc-url=ws://localhost:9944',
35-
'-l=rpc-metrics=debug,eth-rpc=debug',
36-
],
37-
stdout: 'inherit',
38-
stderr: 'inherit',
39-
}).spawn()
40-
}
3+
import { getByteCode, getEnv, wait, waitForHealth } from './util.ts'
4+
import { FlipperAbi } from '../codegen/abi/Flipper.ts'
415

426
await waitForHealth('http://localhost:8545').catch()
437
const env = await getEnv()
@@ -49,7 +13,7 @@ const hash = await wallet.deployContract({
4913
bytecode: getByteCode('Flipper', env.evm),
5014
})
5115

52-
const deployReceipt = await wallet.waitForTransactionReceipt({ hash })
16+
const deployReceipt = await wallet.waitForTransactionReceipt(hash)
5317
if (!deployReceipt.contractAddress) {
5418
throw new Error('Contract address should be set')
5519
}
@@ -91,7 +55,7 @@ try {
9155

9256
const hash = await wallet.writeContract(request)
9357
console.time(hash)
94-
wallet.waitForTransactionReceipt({ hash }).then((receipt) => {
58+
wallet.waitForTransactionReceipt(hash).then((receipt) => {
9559
console.timeEnd(hash)
9660
console.log('-----------------------------------')
9761
console.log(`status: ${receipt.status ? '✅' : '❌'}`)

src/util.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,8 +149,8 @@ export async function getEnv() {
149149
}) => ({
150150
async waitForTransactionReceipt(
151151
hash: Hex,
152-
pollingInterval = 100,
153-
timeout = 30000,
152+
pollingInterval = 500,
153+
timeout = 6000,
154154
): Promise<TransactionReceipt> {
155155
const startTime = Date.now()
156156
while (true) {

0 commit comments

Comments
 (0)