erigon-pulse/cmd/devnet/commands/all.go
Leonard Chinonso 599fc24aed
Devnet Test for EIP1559 (#6938)
**Current Problem**

When X transactions are created, with M transactions out of them having
`gasFeeCap` greater than the current `baseFeePerGas` for the block, and
N transactions having `gasFeeCap` lower, all X transactions get added to
the yellow pool (baseFee) in the txpool and they never get mined.
However when X transactions all having `gasFeeCap` higher than the
`baseFeePerGas` are created, they all get added to the green pool
(pending) in the txpool and thus get mined.

This phenomenon can be inspected in the
`signEIP1559TxsLowerAndHigherThanBaseFee2` function where the number of
transactions that should have `gasFeeCap` higher than and lower than the
current `baseFeePerGas` is specified in its parameter - `func
signEIP1559TxsLowerAndHigherThanBaseFee2(amountLower, amountHigher
int...`.
When `amountLower` is set as `0`, all transactions created from
`amountHigher` will be mined because they have `gasFeeCap` >
`baseFeePerGas`. When `amountLower` has a value > `0`, all the
transactions created (including transactions created with
`amountHigher`) will go to the yellow pool (baseFee) and thus do not get
mined.
2023-03-02 10:25:11 +00:00

63 lines
1.6 KiB
Go

package commands
import (
"fmt"
"github.com/ledgerwatch/erigon/cmd/devnet/models"
"github.com/ledgerwatch/erigon/cmd/devnet/services"
)
// ExecuteAllMethods runs all the simulation tests for erigon devnet
func ExecuteAllMethods() {
// test connection to JSON RPC
fmt.Printf("\nPINGING JSON RPC...\n")
if err := pingErigonRpc(); err != nil {
return
}
fmt.Println()
// get balance of the receiver's account
callGetBalance(addr, models.Latest, 0)
fmt.Println()
// confirm that the txpool is empty
fmt.Println("CONFIRMING TXPOOL IS EMPTY BEFORE SENDING TRANSACTION...")
services.CheckTxPoolContent(0, 0)
fmt.Println()
/*
* Cannot run contract tx after running regular tx because contract tx simulates a new backend
* and it expects the nonce to be 0.
* So it is best to run them separately by commenting and uncommenting the different code blocks.
*/
// send a token from the dev address to the recipient address
//_, err := callSendTx(sendValue, recipientAddress, models.DevAddress)
//if err != nil {
// fmt.Printf("callSendTx error: %v\n", err)
// return
//}
//fmt.Println()
// USING DYNAMIC FEE
// send a token from the dev address to the recipient address
_, err := callSendTxWithDynamicFee(recipientAddress, models.DevAddress)
if err != nil {
fmt.Printf("callSendTxWithDynamicFee error: %v\n", err)
return
}
fmt.Println()
// initiate a contract transaction
//fmt.Println("INITIATING A CONTRACT TRANSACTION...")
//_, err := callContractTx()
//if err != nil {
// fmt.Printf("callContractTx error: %v\n", err)
// return
//}
//fmt.Println()
fmt.Print("SEND SIGNAL TO QUIT ALL RUNNING NODES")
models.QuitNodeChan <- true
}