From 734a05fd4060ccb7294e832e87a93980a3df61b7 Mon Sep 17 00:00:00 2001 From: Jesse Schulman Date: Tue, 10 Sep 2024 14:53:57 -0700 Subject: [PATCH] Set a higher default gas limit and use gas instead of gasLimit on the call params --- selfBlaster.js | 52 ++++++++++++++++++++++++++++++++++++ src/routes/evm/index.ts | 3 +++ src/telosevm-js/constants.ts | 2 +- sshTunnels.txt | 13 +++++++++ 4 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 selfBlaster.js create mode 100644 sshTunnels.txt diff --git a/selfBlaster.js b/selfBlaster.js new file mode 100644 index 0000000..92ea26a --- /dev/null +++ b/selfBlaster.js @@ -0,0 +1,52 @@ +const { ethers } = require('ethers'); + +const ENDPOINT = 'http://127.0.0.1:3000/evm' + +// 0x9Aa4f3FaB9d1A953447E4b0613626576C87B8404 +const SENDER_KEY = '0x13612b0f60ee2f1cc911053fb10d98f2d00bd49b484a3d99a59c1a2fb4c4f92f'; + + +const provider = new ethers.getDefaultProvider(ENDPOINT); +const wallet = new ethers.Wallet(SENDER_KEY, provider); + +async function blast() { + + let nonce = await provider.getTransactionCount(wallet.address) + console.log(`Start of blast trx nonce: ${nonce}`) + const sends = [] + for (let i = 0; i < 100; i++) { + console.log(`Sending nonce: ${nonce}`) + const gasTx = await wallet.sendTransaction({ + to: wallet.address, + nonce: nonce++, + gasLimit: 21000, + gasPrice: 509760000000, + value: 1 + }) + sends.push(gasTx) + //console.log(`After trx nonce: ${await provider.getTransactionCount(wallet.address)}`) + } + + /* + console.log("Starting promise.all") + try { + await Promise.all(sends) + console.log("Promise.all complete") + } catch (e) { + console.log(e) + console.log("Promise.all exception") + } + */ + + async function sleep(seconds) { + return new Promise((resolve) => setTimeout(resolve, seconds * 1000)); + } + + let count = 0; + while (count++ < 50) { + console.log(`Watching nonce: ${await provider.getTransactionCount(wallet.address)}`) + await sleep(1) + } +} + +blast() diff --git a/src/routes/evm/index.ts b/src/routes/evm/index.ts index a744540..2415e61 100644 --- a/src/routes/evm/index.ts +++ b/src/routes/evm/index.ts @@ -30,6 +30,7 @@ import { import NonceRetryManager from "../../util/NonceRetryManager"; import {TransactionVars} from "../../telosevm-js/telos"; import {estypes} from "@elastic/elasticsearch"; +import {DEFAULT_GAS_LIMIT} from "../../telosevm-js/constants"; const BN = require('bn.js'); const GAS_PRICE_OVERESTIMATE = 1.00 @@ -973,6 +974,8 @@ export default async function (fastify: FastifyInstance, opts: TelosEvmConfig) { value: _value.toHexString().replace(/^0x/, ''), sender: txParams.from, }; + obj.gas = obj.gasLimit || obj.gas || DEFAULT_GAS_LIMIT; + delete obj.gasLimit; let tx = await fastify.evm.createEthTx(obj); let sender = txParams.from diff --git a/src/telosevm-js/constants.ts b/src/telosevm-js/constants.ts index 4a20506..5d3890d 100644 --- a/src/telosevm-js/constants.ts +++ b/src/telosevm-js/constants.ts @@ -1,5 +1,5 @@ export const ETH_CHAIN = 'mainnet' export const FORK = 'istanbul' -export const DEFAULT_GAS_LIMIT = '0x1E8480' +export const DEFAULT_GAS_LIMIT = '989680' export const DEFAULT_VALUE = '0x0' export const DEFAULT_CHAIN_ID = 1 \ No newline at end of file diff --git a/sshTunnels.txt b/sshTunnels.txt new file mode 100644 index 0000000..d72102c --- /dev/null +++ b/sshTunnels.txt @@ -0,0 +1,13 @@ + +# Websocket +ssh -L 7800:10.10.10.168:7301 jesse@bastion.telos.net -p 42424 + +# Nodeos read +# This nodeos does not have transaction retry configured +#ssh -L 8989:10.10.10.168:8883 jesse@bastion.telos.net -p 42424 + +# This node has the transaction retry settings enabled +ssh -L 8891:10.10.10.200:8891 jesse@bastion.telos.net -p 42424 + +# Elasticsearch +ssh -L 9200:10.10.10.154:9200 jesse@bastion.telos.net -p 42424