Giter VIP home page Giter VIP logo

ganache-repro's Introduction

Ganache transaction bug reproduction

Usage

  1. Install dependencies: yarn install
  2. In one terminal, start Ganache: yarn run ts-node ganache.ts
  3. In another terminal, run the transaction submitter: yarn run ts-node send.ts

Test scenario

This repo reproduces a bug in Ganache where transactions with manually-assigned nonces become stuck in the queued TX pool state, when they are submitted by multiple processes concurrently.

send.ts generates a number of transactions with sequential nonces (TRANSACTIONS_PER_CPU). It creates a random Ethereum keypair and signs each transaction. It then shuffles the transactions randomly and splits them between N_CPUS independent worker processes. Each process submits its transactions to Ganache, and waits for a transaction receipt for each.

When N_CPUS = 1 (no concurrency), all receipts return OK.

Bug

On some runs, when N_CPUS = 32, or other high numbers, transactions will get stuck in the txpool in the queued state.

The Ganache logs will show no activity except for eth_blockNumber and eth_chainId; and send.ts will eventually exit.

Looking at the TX pool, you will see many queued transactions:

curl -X POST --data '{"jsonrpc":"2.0","method":"txpool_content","params":[], "id":1}' http://127.0.0.1:8888

The smallest nonce of the queued transactions will match the current from account nonce; i.e. the nonce of the sender has been incremented correctly but queued transactions have not been triggered and are stuck.

ganache-repro's People

Watchers

Cadel Watson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.