Skip to content
This repository has been archived by the owner on Dec 22, 2024. It is now read-only.

Commit

Permalink
Set a higher default gas limit and use gas instead of gasLimit on the…
Browse files Browse the repository at this point in the history
… call params
  • Loading branch information
poplexity committed Sep 10, 2024
1 parent 19e277e commit 734a05f
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 1 deletion.
52 changes: 52 additions & 0 deletions selfBlaster.js
Original file line number Diff line number Diff line change
@@ -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()
3 changes: 3 additions & 0 deletions src/routes/evm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion src/telosevm-js/constants.ts
Original file line number Diff line number Diff line change
@@ -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
13 changes: 13 additions & 0 deletions sshTunnels.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@

# Websocket
ssh -L 7800:10.10.10.168:7301 [email protected] -p 42424

# Nodeos read
# This nodeos does not have transaction retry configured
#ssh -L 8989:10.10.10.168:8883 [email protected] -p 42424

# This node has the transaction retry settings enabled
ssh -L 8891:10.10.10.200:8891 [email protected] -p 42424

# Elasticsearch
ssh -L 9200:10.10.10.154:9200 [email protected] -p 42424

0 comments on commit 734a05f

Please sign in to comment.