diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 336b2fea56..a85cb300d2 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,7 +8,7 @@ on: pull_request: branches: - "**" - types: [opened, synchronize, edited] + types: [opened, synchronize] concurrency: group: build-${{ github.event.pull_request.number || github.ref }} @@ -29,7 +29,7 @@ jobs: - uses: actions/setup-go@v3 with: - go-version: 1.18.x + go-version: 1.19.x - name: Install dependencies on Linux if: runner.os == 'Linux' diff --git a/.golangci.yml b/.golangci.yml index 89a9e328b8..89eebfe9fe 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -50,6 +50,7 @@ linters: - unconvert - unparam - wsl + - asasalint #- errorlint causes stack overflow. TODO: recheck after each golangci update linters-settings: diff --git a/.goreleaser.yml b/.goreleaser.yml index d09cc43206..acafc4abc0 100644 --- a/.goreleaser.yml +++ b/.goreleaser.yml @@ -75,12 +75,18 @@ nfpms: description: Polygon Blockchain license: GPLv3 LGPLv3 + bindir: /usr/local/bin + formats: - apk - deb - rpm contents: + - dst: /var/lib/bor + type: dir + file_info: + mode: 0777 - src: builder/files/bor.service dst: /lib/systemd/system/bor.service type: config @@ -90,6 +96,12 @@ nfpms: - src: builder/files/genesis-testnet-v4.json dst: /etc/bor/genesis-testnet-v4.json type: config + - src: builder/files/config.toml + dst: /var/lib/bor/config.toml + type: config + + scripts: + postinstall: builder/files/bor-post-install.sh overrides: rpm: diff --git a/Makefile b/Makefile index a39be25aa7..6e1e472a03 100644 --- a/Makefile +++ b/Makefile @@ -28,13 +28,16 @@ GOTEST = GODEBUG=cgocheck=0 go test $(GO_FLAGS) -p 1 bor: mkdir -p $(GOPATH)/bin/ go build -o $(GOBIN)/bor ./cmd/cli/main.go + cp $(GOBIN)/bor $(GOPATH)/bin/ + @echo "Done building." protoc: protoc --go_out=. --go-grpc_out=. ./internal/cli/server/proto/*.proto generate-mocks: go generate mockgen -destination=./tests/bor/mocks/IHeimdallClient.go -package=mocks ./consensus/bor IHeimdallClient - + go generate mockgen -destination=./eth/filters/IBackend.go -package=filters ./eth/filters Backend + geth: $(GORUN) build/ci.go install ./cmd/geth @echo "Done building." @@ -72,7 +75,7 @@ lint: lintci-deps: rm -f ./build/bin/golangci-lint - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.46.0 + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.48.0 goimports: goimports -local "$(PACKAGE)" -w . diff --git a/README.md b/README.md index 4e33a551d0..9f2c7e6732 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Bor Overview -Bor is the Official Golang implementation of the Matic protocol. It is a fork of Go Ethereum - https://github.com/ethereum/go-ethereum and EVM compabile. +Bor is the Official Golang implementation of the Matic protocol. It is a fork of Go Ethereum - https://github.com/ethereum/go-ethereum and EVM compatible. ![Forks](https://img.shields.io/github/forks/maticnetwork/bor?style=social) ![Stars](https://img.shields.io/github/stars/maticnetwork/bor?style=social) diff --git a/accounts/abi/bind/auth.go b/accounts/abi/bind/auth.go index a4307a9529..63e6f62451 100644 --- a/accounts/abi/bind/auth.go +++ b/accounts/abi/bind/auth.go @@ -21,7 +21,6 @@ import ( "crypto/ecdsa" "errors" "io" - "io/ioutil" "math/big" "github.com/ethereum/go-ethereum/accounts" @@ -45,14 +44,17 @@ var ErrNotAuthorized = errors.New("not authorized to sign this account") // Deprecated: Use NewTransactorWithChainID instead. func NewTransactor(keyin io.Reader, passphrase string) (*TransactOpts, error) { log.Warn("WARNING: NewTransactor has been deprecated in favour of NewTransactorWithChainID") - json, err := ioutil.ReadAll(keyin) + + json, err := io.ReadAll(keyin) if err != nil { return nil, err } + key, err := keystore.DecryptKey(json, passphrase) if err != nil { return nil, err } + return NewKeyedTransactor(key.PrivateKey), nil } @@ -106,7 +108,7 @@ func NewKeyedTransactor(key *ecdsa.PrivateKey) *TransactOpts { // NewTransactorWithChainID is a utility method to easily create a transaction signer from // an encrypted json key stream and the associated passphrase. func NewTransactorWithChainID(keyin io.Reader, passphrase string, chainID *big.Int) (*TransactOpts, error) { - json, err := ioutil.ReadAll(keyin) + json, err := io.ReadAll(keyin) if err != nil { return nil, err } diff --git a/accounts/abi/bind/bind_test.go b/accounts/abi/bind/bind_test.go index 992497993a..644c111f08 100644 --- a/accounts/abi/bind/bind_test.go +++ b/accounts/abi/bind/bind_test.go @@ -18,7 +18,6 @@ package bind import ( "fmt" - "io/ioutil" "os" "os/exec" "path/filepath" @@ -1966,7 +1965,7 @@ func TestGolangBindings(t *testing.T) { t.Skip("go sdk not found for testing") } // Create a temporary workspace for the test suite - ws, err := ioutil.TempDir("", "binding-test") + ws, err := os.MkdirTemp("", "binding-test") if err != nil { t.Fatalf("failed to create temporary workspace: %v", err) } @@ -1990,7 +1989,7 @@ func TestGolangBindings(t *testing.T) { if err != nil { t.Fatalf("test %d: failed to generate binding: %v", i, err) } - if err = ioutil.WriteFile(filepath.Join(pkg, strings.ToLower(tt.name)+".go"), []byte(bind), 0600); err != nil { + if err = os.WriteFile(filepath.Join(pkg, strings.ToLower(tt.name)+".go"), []byte(bind), 0600); err != nil { t.Fatalf("test %d: failed to write binding: %v", i, err) } // Generate the test file with the injected test code @@ -2006,7 +2005,7 @@ func TestGolangBindings(t *testing.T) { %s } `, tt.imports, tt.name, tt.tester) - if err := ioutil.WriteFile(filepath.Join(pkg, strings.ToLower(tt.name)+"_test.go"), []byte(code), 0600); err != nil { + if err := os.WriteFile(filepath.Join(pkg, strings.ToLower(tt.name)+"_test.go"), []byte(code), 0600); err != nil { t.Fatalf("test %d: failed to write tests: %v", i, err) } }) diff --git a/builder/files/bor-post-install.sh b/builder/files/bor-post-install.sh new file mode 100644 index 0000000000..1419479983 --- /dev/null +++ b/builder/files/bor-post-install.sh @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +PKG="bor" + +if ! getent passwd $PKG >/dev/null ; then + adduser --disabled-password --disabled-login --shell /usr/sbin/nologin --quiet --system --no-create-home --home /nonexistent $PKG + echo "Created system user $PKG" +fi diff --git a/builder/files/bor.service b/builder/files/bor.service index da0338368c..2deff3dbc9 100644 --- a/builder/files/bor.service +++ b/builder/files/bor.service @@ -6,36 +6,9 @@ [Service] Restart=on-failure RestartSec=5s - ExecStart=/usr/local/bin/bor server \ - --chain=mumbai \ - # --chain=mainnet \ - --datadir /var/lib/bor/data \ - --metrics \ - --metrics.prometheus-addr="127.0.0.1:7071" \ - --syncmode 'full' \ - --miner.gasprice '30000000000' \ - --miner.gaslimit '20000000' \ - --miner.gastarget '20000000' \ - --txpool.nolocals \ - --txpool.accountslots 16 \ - --txpool.globalslots 32768 \ - --txpool.accountqueue 16 \ - --txpool.globalqueue 32768 \ - --txpool.pricelimit '30000000000' \ - --txpool.lifetime '1h30m0s' \ - --bootnodes "enode://0cb82b395094ee4a2915e9714894627de9ed8498fb881cec6db7c65e8b9a5bd7f2f25cc84e71e89d0947e51c76e85d0847de848c7782b13c0255247a6758178c@44.232.55.71:30303,enode://88116f4295f5a31538ae409e4d44ad40d22e44ee9342869e7d68bdec55b0f83c1530355ce8b41fbec0928a7d75a5745d528450d30aec92066ab6ba1ee351d710@159.203.9.164:30303" - # Validator params - # Uncomment and configure the following lines in case you run a validator. Don't forget to add backslash (\) - # to previous command line. - # --keystore /var/lib/bor/keystore \ - # --unlock [VALIDATOR ADDRESS] \ - # --password /var/lib/bor/password.txt \ - # --allow-insecure-unlock \ - # --nodiscover --maxpeers 1 \ - # --miner.etherbase [VALIDATOR ADDRESS] \ - # --mine + ExecStart=/usr/local/bin/bor server -config="/var/lib/bor/config.toml" Type=simple - User=ubuntu + User=bor KillSignal=SIGINT TimeoutStopSec=120 diff --git a/builder/files/config.toml b/builder/files/config.toml new file mode 100644 index 0000000000..d8503e4351 --- /dev/null +++ b/builder/files/config.toml @@ -0,0 +1,137 @@ +# NOTE: Uncomment and configure the following 8 fields in case you run a validator: +# `mine`, `etherbase`, `nodiscover`, `maxpeers`, `keystore`, `allow-insecure-unlock`, `password`, `unlock` + +chain = "mainnet" +# chain = "mumbai" +# identity = "Pratiks-MacBook-Pro.local" +# log-level = "INFO" +datadir = "/var/lib/bor/data" +# keystore = "/var/lib/bor/keystore" +syncmode = "full" +# gcmode = "full" +# snapshot = true +# ethstats = "" + +# [requiredblocks] + +[p2p] + # maxpeers = 1 + # nodiscover = true + # maxpendpeers = 50 + # bind = "0.0.0.0" + # port = 30303 + # nat = "any" + [p2p.discovery] + # v5disc = false + bootnodes = ["enode://0cb82b395094ee4a2915e9714894627de9ed8498fb881cec6db7c65e8b9a5bd7f2f25cc84e71e89d0947e51c76e85d0847de848c7782b13c0255247a6758178c@44.232.55.71:30303", "enode://88116f4295f5a31538ae409e4d44ad40d22e44ee9342869e7d68bdec55b0f83c1530355ce8b41fbec0928a7d75a5745d528450d30aec92066ab6ba1ee351d710@159.203.9.164:30303"] + # Uncomment below `bootnodes` field for Mumbai bootnode + # bootnodes = ["enode://095c4465fe509bd7107bbf421aea0d3ad4d4bfc3ff8f9fdc86f4f950892ae3bbc3e5c715343c4cf60c1c06e088e621d6f1b43ab9130ae56c2cacfd356a284ee4@18.213.200.99:30303"] + # bootnodesv4 = [] + # bootnodesv5 = [] + # static-nodes = [] + # trusted-nodes = [] + # dns = [] + +# [heimdall] + # url = "http://localhost:1317" + # "bor.without" = false + # grpc-address = "" + +[txpool] + nolocals = true + pricelimit = 30000000000 + accountslots = 16 + globalslots = 32768 + accountqueue = 16 + globalqueue = 32768 + lifetime = "1h30m0s" + # locals = [] + # journal = "" + # rejournal = "1h0m0s" + # pricebump = 10 + +[miner] + gaslimit = 20000000 + gasprice = "30000000000" + # mine = true + # etherbase = "VALIDATOR ADDRESS" + # extradata = "" + + +# [jsonrpc] + # ipcdisable = false + # ipcpath = "" + # gascap = 50000000 + # txfeecap = 5.0 + # [jsonrpc.http] + # enabled = false + # port = 8545 + # prefix = "" + # host = "localhost" + # api = ["eth", "net", "web3", "txpool", "bor"] + # vhosts = ["*"] + # corsdomain = ["*"] + # [jsonrpc.ws] + # enabled = false + # port = 8546 + # prefix = "" + # host = "localhost" + # api = ["web3", "net"] + # vhosts = ["*"] + # corsdomain = ["*"] + # [jsonrpc.graphql] + # enabled = false + # port = 0 + # prefix = "" + # host = "" + # vhosts = ["*"] + # corsdomain = ["*"] + +# [gpo] + # blocks = 20 + # percentile = 60 + # maxprice = "5000000000000" + # ignoreprice = "2" + +[telemetry] + metrics = true + # expensive = false + prometheus-addr = "127.0.0.1:7071" + # opencollector-endpoint = "" + # [telemetry.influx] + # influxdb = false + # endpoint = "" + # database = "" + # username = "" + # password = "" + # influxdbv2 = false + # token = "" + # bucket = "" + # organization = "" + # [telemetry.influx.tags] + +# [cache] + # cache = 1024 + # gc = 25 + # snapshot = 10 + # database = 50 + # trie = 15 + # journal = "triecache" + # rejournal = "1h0m0s" + # noprefetch = false + # preimages = false + # txlookuplimit = 2350000 + +[accounts] + # allow-insecure-unlock = true + # password = "/var/lib/bor/password.txt" + # unlock = ["VALIDATOR ADDRESS"] + # lightkdf = false + # disable-bor-wallet = false + +# [grpc] + # addr = ":3131" + +# [developer] + # dev = false + # period = 0 \ No newline at end of file diff --git a/cmd/geth/chaincmd.go b/cmd/geth/chaincmd.go index a178f6c751..fc2309d2db 100644 --- a/cmd/geth/chaincmd.go +++ b/cmd/geth/chaincmd.go @@ -108,6 +108,7 @@ The dumpgenesis command dumps the genesis block configuration in JSON format to // bor related flags utils.HeimdallURLFlag, utils.WithoutHeimdallFlag, + utils.HeimdallgRPCAddressFlag, }, Category: "BLOCKCHAIN COMMANDS", Description: ` diff --git a/cmd/geth/config.go b/cmd/geth/config.go index d8ba5366fe..e6cb36b121 100644 --- a/cmd/geth/config.go +++ b/cmd/geth/config.go @@ -17,15 +17,12 @@ package main import ( - "bufio" - "errors" "fmt" "math/big" "os" - "reflect" "time" - "unicode" + "github.com/BurntSushi/toml" "gopkg.in/urfave/cli.v1" "github.com/ethereum/go-ethereum/accounts/external" @@ -41,7 +38,6 @@ import ( "github.com/ethereum/go-ethereum/metrics" "github.com/ethereum/go-ethereum/node" "github.com/ethereum/go-ethereum/params" - "github.com/naoina/toml" ) var ( @@ -61,28 +57,6 @@ var ( } ) -// These settings ensure that TOML keys use the same names as Go struct fields. -var tomlSettings = toml.Config{ - NormFieldName: func(rt reflect.Type, key string) string { - return key - }, - FieldToKey: func(rt reflect.Type, field string) string { - return field - }, - MissingField: func(rt reflect.Type, field string) error { - id := fmt.Sprintf("%s.%s", rt.String(), field) - if deprecated(id) { - log.Warn("Config field is deprecated and won't have an effect", "name", id) - return nil - } - var link string - if unicode.IsUpper(rune(rt.Name()[0])) && rt.PkgPath() != "main" { - link = fmt.Sprintf(", see https://godoc.org/%s#%s for available fields", rt.PkgPath(), rt.Name()) - } - return fmt.Errorf("field '%s' is not defined in %s%s", field, rt.String(), link) - }, -} - type ethstatsConfig struct { URL string `toml:",omitempty"` } @@ -95,18 +69,17 @@ type gethConfig struct { } func loadConfig(file string, cfg *gethConfig) error { - f, err := os.Open(file) + data, err := os.ReadFile(file) if err != nil { return err } - defer f.Close() - err = tomlSettings.NewDecoder(bufio.NewReader(f)).Decode(cfg) - // Add file name to errors that have a line number. - if _, ok := err.(*toml.LineError); ok { - err = errors.New(file + ", " + err.Error()) + tomlData := string(data) + if _, err = toml.Decode(tomlData, &cfg); err != nil { + return err } - return err + + return nil } func defaultNodeConfig() node.Config { @@ -214,22 +187,10 @@ func dumpConfig(ctx *cli.Context) error { comment += "# Note: this config doesn't contain the genesis block.\n\n" } - out, err := tomlSettings.Marshal(&cfg) - if err != nil { + if err := toml.NewEncoder(os.Stdout).Encode(&cfg); err != nil { return err } - dump := os.Stdout - if ctx.NArg() > 0 { - dump, err = os.OpenFile(ctx.Args().Get(0), os.O_RDWR|os.O_CREATE|os.O_TRUNC, 0644) - if err != nil { - return err - } - defer dump.Close() - } - dump.WriteString(comment) - dump.Write(out) - return nil } diff --git a/cmd/utils/bor_flags.go b/cmd/utils/bor_flags.go index 34355532e1..256df31e97 100644 --- a/cmd/utils/bor_flags.go +++ b/cmd/utils/bor_flags.go @@ -31,10 +31,18 @@ var ( Usage: "Run without Heimdall service (for testing purpose)", } + // HeimdallgRPCAddressFlag flag for heimdall gRPC address + HeimdallgRPCAddressFlag = cli.StringFlag{ + Name: "bor.heimdallgRPC", + Usage: "Address of Heimdall gRPC service", + Value: "", + } + // BorFlags all bor related flags BorFlags = []cli.Flag{ HeimdallURLFlag, WithoutHeimdallFlag, + HeimdallgRPCAddressFlag, } ) @@ -57,6 +65,7 @@ func getGenesis(genesisPath string) (*core.Genesis, error) { func SetBorConfig(ctx *cli.Context, cfg *eth.Config) { cfg.HeimdallURL = ctx.GlobalString(HeimdallURLFlag.Name) cfg.WithoutHeimdall = ctx.GlobalBool(WithoutHeimdallFlag.Name) + cfg.HeimdallgRPCAddress = ctx.GlobalString(HeimdallgRPCAddressFlag.Name) } // CreateBorEthereum Creates bor ethereum object from eth.Config diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index 1a593888d6..5c733e2a23 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -1621,6 +1621,13 @@ func SetEthConfig(ctx *cli.Context, stack *node.Node, cfg *ethconfig.Config) { if ctx.GlobalIsSet(SyncModeFlag.Name) { cfg.SyncMode = *GlobalTextMarshaler(ctx, SyncModeFlag.Name).(*downloader.SyncMode) + + // To be extra preventive, we won't allow the node to start + // in snap sync mode until we have it working + // TODO(snap): Comment when we have snap sync working + if cfg.SyncMode == downloader.SnapSync { + cfg.SyncMode = downloader.FullSync + } } if ctx.GlobalIsSet(NetworkIdFlag.Name) { cfg.NetworkId = ctx.GlobalUint64(NetworkIdFlag.Name) @@ -2024,9 +2031,10 @@ func MakeChain(ctx *cli.Context, stack *node.Node) (chain *core.BlockChain, chai engine = clique.New(config.Clique, chainDb) } else if config.Bor != nil { ethereum = CreateBorEthereum(ð.Config{ - Genesis: genesis, - HeimdallURL: ctx.GlobalString(HeimdallURLFlag.Name), - WithoutHeimdall: ctx.GlobalBool(WithoutHeimdallFlag.Name), + Genesis: genesis, + HeimdallURL: ctx.GlobalString(HeimdallURLFlag.Name), + WithoutHeimdall: ctx.GlobalBool(WithoutHeimdallFlag.Name), + HeimdallgRPCAddress: ctx.GlobalString(HeimdallgRPCAddressFlag.Name), }) engine = ethereum.Engine() } else { diff --git a/common/network/port.go b/common/network/port.go new file mode 100644 index 0000000000..f92b59ac11 --- /dev/null +++ b/common/network/port.go @@ -0,0 +1,36 @@ +package network + +import ( + "errors" + "fmt" + "net" +) + +const ( + maxPortCheck = 100 + + emptyPort = "127.0.0.1:0" +) + +var ( + ErrCantFindAPort = errors.New("no available port found") +) + +// FindAvailablePort returns the an available port +func FindAvailablePort() (int, net.Listener, error) { + var ( + listener net.Listener + err error + ) + + for i := uint(0); i < maxPortCheck; i++ { + listener, err = net.Listen("tcp", emptyPort) + if err != nil { + continue + } + + return listener.Addr().(*net.TCPAddr).Port, listener, nil + } + + return 0, nil, fmt.Errorf("%w: %s", ErrCantFindAPort, err) +} diff --git a/consensus/bor/bor.go b/consensus/bor/bor.go index 60a6413f2f..25f043f200 100644 --- a/consensus/bor/bor.go +++ b/consensus/bor/bor.go @@ -12,6 +12,7 @@ import ( "sort" "strconv" "sync" + "sync/atomic" "time" lru "github.com/hashicorp/golang-lru" @@ -99,6 +100,9 @@ var ( // errOutOfRangeChain is returned if an authorization list is attempted to // be modified via out-of-range or non-contiguous headers. errOutOfRangeChain = errors.New("out of range or non-contiguous chain") + + errUncleDetected = errors.New("uncles not allowed") + errUnknownValidators = errors.New("unknown validators") ) // SignerFn is a signer callback function to request a header to be signed by a @@ -212,9 +216,7 @@ type Bor struct { recents *lru.ARCCache // Snapshots for recent block to speed up reorgs signatures *lru.ARCCache // Signatures of recent blocks to speed up mining - signer common.Address // Ethereum address of the signing key - signFn SignerFn // Signer function to authorize hashes with - lock sync.RWMutex // Protects the signer fields + authorizedSigner atomic.Pointer[signer] // Ethereum address and sign function of the signing key ethAPI api.Caller spanner Spanner @@ -227,6 +229,11 @@ type Bor struct { closeOnce sync.Once } +type signer struct { + signer common.Address // Ethereum address of the signing key + signFn SignerFn // Signer function to authorize hashes with +} + // New creates a Matic Bor consensus engine. func New( chainConfig *params.ChainConfig, @@ -259,6 +266,14 @@ func New( HeimdallClient: heimdallClient, } + c.authorizedSigner.Store(&signer{ + common.Address{}, + func(_ accounts.Account, _ string, i []byte) ([]byte, error) { + // return an error to prevent panics + return nil, &UnauthorizedSignerError{0, common.Address{}.Bytes()} + }, + }) + // make sure we can decode all the GenesisAlloc in the BorConfig. for key, genesisAlloc := range c.config.BlockAlloc { if _, err := decodeGenesisAlloc(genesisAlloc); err != nil { @@ -539,8 +554,6 @@ func (c *Bor) snapshot(chain consensus.ChainHeaderReader, number uint64, hash co number, hash = number-1, header.ParentHash } - log.Info("Snapshot has been found in", "headers depth", len(headers)) - // check if snapshot is nil if snap == nil { return nil, fmt.Errorf("unknown error while retrieving snapshot at block number %v", number) @@ -574,7 +587,7 @@ func (c *Bor) snapshot(chain consensus.ChainHeaderReader, number uint64, hash co // uncles as this consensus mechanism doesn't permit uncles. func (c *Bor) VerifyUncles(_ consensus.ChainReader, block *types.Block) error { if len(block.Uncles()) > 0 { - return errors.New("uncles not allowed") + return errUncleDetected } return nil @@ -658,8 +671,10 @@ func (c *Bor) Prepare(chain consensus.ChainHeaderReader, header *types.Header) e return err } + currentSigner := *c.authorizedSigner.Load() + // Set the correct difficulty - header.Difficulty = new(big.Int).SetUint64(Difficulty(snap.ValidatorSet, c.signer)) + header.Difficulty = new(big.Int).SetUint64(Difficulty(snap.ValidatorSet, currentSigner.signer)) // Ensure the extra data has all it's components if len(header.Extra) < extraVanity { @@ -672,7 +687,7 @@ func (c *Bor) Prepare(chain consensus.ChainHeaderReader, header *types.Header) e if IsSprintStart(number+1, c.config.CalculateSprint(number)) { newValidators, err := c.spanner.GetCurrentValidators(context.Background(), header.ParentHash, number+1) if err != nil { - return errors.New("unknown validators") + return errUnknownValidators } // sort validator by address @@ -697,8 +712,8 @@ func (c *Bor) Prepare(chain consensus.ChainHeaderReader, header *types.Header) e var succession int // if signer is not empty - if c.signer != (common.Address{}) { - succession, err = snap.GetSignerSuccessionNumber(c.signer) + if currentSigner.signer != (common.Address{}) { + succession, err = snap.GetSignerSuccessionNumber(currentSigner.signer) if err != nil { return err } @@ -776,7 +791,7 @@ func (c *Bor) changeContractCodeIfNeeded(headerNumber uint64, state *state.State if blockNumber == strconv.FormatUint(headerNumber, 10) { allocs, err := decodeGenesisAlloc(genesisAlloc) if err != nil { - return fmt.Errorf("failed to decode genesis alloc: %v", err) + return fmt.Errorf("failed to decode genesis alloc: %w", err) } for addr, account := range allocs { @@ -840,12 +855,11 @@ func (c *Bor) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *typ // Authorize injects a private key into the consensus engine to mint new blocks // with. -func (c *Bor) Authorize(signer common.Address, signFn SignerFn) { - c.lock.Lock() - defer c.lock.Unlock() - - c.signer = signer - c.signFn = signFn +func (c *Bor) Authorize(currentSigner common.Address, signFn SignerFn) { + c.authorizedSigner.Store(&signer{ + signer: currentSigner, + signFn: signFn, + }) } // Seal implements consensus.Engine, attempting to create a sealed block using @@ -862,10 +876,9 @@ func (c *Bor) Seal(chain consensus.ChainHeaderReader, block *types.Block, result log.Info("Sealing paused, waiting for transactions") return nil } + // Don't hold the signer fields for the entire sealing procedure - c.lock.RLock() - signer, signFn := c.signer, c.signFn - c.lock.RUnlock() + currentSigner := *c.authorizedSigner.Load() snap, err := c.snapshot(chain, number-1, header.ParentHash, nil) if err != nil { @@ -873,12 +886,12 @@ func (c *Bor) Seal(chain consensus.ChainHeaderReader, block *types.Block, result } // Bail out if we're unauthorized to sign a block - if !snap.ValidatorSet.HasAddress(signer) { + if !snap.ValidatorSet.HasAddress(currentSigner.signer) { // Check the UnauthorizedSignerError.Error() msg to see why we pass number-1 - return &UnauthorizedSignerError{number - 1, signer.Bytes()} + return &UnauthorizedSignerError{number - 1, currentSigner.signer.Bytes()} } - successionNumber, err := snap.GetSignerSuccessionNumber(signer) + successionNumber, err := snap.GetSignerSuccessionNumber(currentSigner.signer) if err != nil { return err } @@ -889,7 +902,7 @@ func (c *Bor) Seal(chain consensus.ChainHeaderReader, block *types.Block, result wiggle := time.Duration(successionNumber) * time.Duration(c.config.CalculateBackupMultiplier(number)) * time.Second // Sign all the things! - err = Sign(signFn, signer, header, c.config) + err = Sign(currentSigner.signFn, currentSigner.signer, header, c.config) if err != nil { return err } @@ -951,7 +964,7 @@ func (c *Bor) CalcDifficulty(chain consensus.ChainHeaderReader, _ uint64, parent return nil } - return new(big.Int).SetUint64(Difficulty(snap.ValidatorSet, c.signer)) + return new(big.Int).SetUint64(Difficulty(snap.ValidatorSet, c.authorizedSigner.Load().signer)) } // SealHash returns the hash of a block prior to it being sealed. diff --git a/consensus/bor/heimdall/client.go b/consensus/bor/heimdall/client.go index 0f17cbc4d4..b6daa7e8d8 100644 --- a/consensus/bor/heimdall/client.go +++ b/consensus/bor/heimdall/client.go @@ -15,6 +15,7 @@ import ( "github.com/ethereum/go-ethereum/consensus/bor/heimdall/checkpoint" "github.com/ethereum/go-ethereum/consensus/bor/heimdall/span" "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/metrics" ) var ( @@ -46,6 +47,12 @@ type HeimdallClient struct { closeCh chan struct{} } +type Request struct { + client http.Client + url *url.URL + start time.Time +} + func NewHeimdallClient(urlString string) *HeimdallClient { return &HeimdallClient{ urlString: urlString, @@ -76,6 +83,8 @@ func (h *HeimdallClient) StateSyncEvents(ctx context.Context, fromID uint64, to log.Info("Fetching state sync events", "queryParams", url.RawQuery) + ctx = withRequestType(ctx, stateSyncRequest) + response, err := FetchWithRetry[StateSyncEventsResponse](ctx, h.client, url, h.closeCh) if err != nil { return nil, err @@ -108,6 +117,8 @@ func (h *HeimdallClient) Span(ctx context.Context, spanID uint64) (*span.Heimdal return nil, err } + ctx = withRequestType(ctx, spanRequest) + response, err := FetchWithRetry[SpanResponse](ctx, h.client, url, h.closeCh) if err != nil { return nil, err @@ -123,6 +134,8 @@ func (h *HeimdallClient) FetchCheckpoint(ctx context.Context, number int64) (*ch return nil, err } + ctx = withRequestType(ctx, checkpointRequest) + response, err := FetchWithRetry[checkpoint.CheckpointResponse](ctx, h.client, url, h.closeCh) if err != nil { return nil, err @@ -138,6 +151,8 @@ func (h *HeimdallClient) FetchCheckpointCount(ctx context.Context) (int64, error return 0, err } + ctx = withRequestType(ctx, checkpointCountRequest) + response, err := FetchWithRetry[checkpoint.CheckpointCountResponse](ctx, h.client, url, h.closeCh) if err != nil { return 0, err @@ -149,7 +164,9 @@ func (h *HeimdallClient) FetchCheckpointCount(ctx context.Context) (int64, error // FetchWithRetry returns data from heimdall with retry func FetchWithRetry[T any](ctx context.Context, client http.Client, url *url.URL, closeCh chan struct{}) (*T, error) { // request data once - result, err := Fetch[T](ctx, client, url) + request := &Request{client: client, url: url, start: time.Now()} + result, err := Fetch[T](ctx, request) + if err == nil { return result, nil } @@ -181,7 +198,9 @@ retryLoop: return nil, ErrShutdownDetected case <-ticker.C: - result, err = Fetch[T](ctx, client, url) + request = &Request{client: client, url: url, start: time.Now()} + result, err = Fetch[T](ctx, request) + if err != nil { if attempt%logEach == 0 { log.Warn("an error while trying fetching from Heimdall", "attempt", attempt, "error", err) @@ -196,10 +215,18 @@ retryLoop: } // Fetch returns data from heimdall -func Fetch[T any](ctx context.Context, client http.Client, url *url.URL) (*T, error) { +func Fetch[T any](ctx context.Context, request *Request) (*T, error) { + isSuccessful := false + + defer func() { + if metrics.EnabledExpensive { + sendMetrics(ctx, request.start, isSuccessful) + } + }() + result := new(T) - body, err := internalFetchWithTimeout(ctx, client, url) + body, err := internalFetchWithTimeout(ctx, request.client, request.url) if err != nil { return nil, err } @@ -213,6 +240,8 @@ func Fetch[T any](ctx context.Context, client http.Client, url *url.URL) (*T, er return nil, err } + isSuccessful = true + return result, nil } diff --git a/consensus/bor/heimdall/client_test.go b/consensus/bor/heimdall/client_test.go index f9ed0028b1..22265c1975 100644 --- a/consensus/bor/heimdall/client_test.go +++ b/consensus/bor/heimdall/client_test.go @@ -9,18 +9,16 @@ import ( "net" "net/http" "sync" - "sync/atomic" "testing" "time" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/network" "github.com/ethereum/go-ethereum/consensus/bor/heimdall/checkpoint" "github.com/stretchr/testify/require" ) -var maxPortCheck int32 = 100 - // HttpHandlerFake defines the handler functions required to serve // requests to the mock heimdal server for specific functions. Add more handlers // according to requirements. @@ -34,7 +32,7 @@ func (h *HttpHandlerFake) GetCheckpointHandler() http.HandlerFunc { } } -func CreateMockHeimdallServer(wg *sync.WaitGroup, port int32, handler *HttpHandlerFake) (*http.Server, error) { +func CreateMockHeimdallServer(wg *sync.WaitGroup, port int, listener net.Listener, handler *HttpHandlerFake) (*http.Server, error) { // Create a new server mux mux := http.NewServeMux() @@ -51,6 +49,12 @@ func CreateMockHeimdallServer(wg *sync.WaitGroup, port int32, handler *HttpHandl Handler: mux, } + // Close the listener using the port and immediately consume it below + err := listener.Close() + if err != nil { + return nil, err + } + go func() { defer wg.Done() @@ -93,12 +97,12 @@ func TestFetchCheckpointFromMockHeimdall(t *testing.T) { } } - // Fetch available port starting from 50000 - port, err := findAvailablePort(50000, 0) + // Fetch available port + port, listener, err := network.FindAvailablePort() require.NoError(t, err, "expect no error in finding available port") // Create mock heimdall server and pass handler instance for setting up the routes - srv, err := CreateMockHeimdallServer(wg, port, handler) + srv, err := CreateMockHeimdallServer(wg, port, listener, handler) require.NoError(t, err, "expect no error in starting mock heimdall server") // Create a new heimdall client and use same port for connection @@ -150,12 +154,12 @@ func TestFetchShutdown(t *testing.T) { } } - // Fetch available port starting from 50000 - port, err := findAvailablePort(50000, 0) + // Fetch available port + port, listener, err := network.FindAvailablePort() require.NoError(t, err, "expect no error in finding available port") // Create mock heimdall server and pass handler instance for setting up the routes - srv, err := CreateMockHeimdallServer(wg, port, handler) + srv, err := CreateMockHeimdallServer(wg, port, listener, handler) require.NoError(t, err, "expect no error in starting mock heimdall server") // Create a new heimdall client and use same port for connection @@ -216,26 +220,6 @@ func TestFetchShutdown(t *testing.T) { wg.Wait() } -// findAvailablePort returns the next available port starting from `from` -func findAvailablePort(from int32, count int32) (int32, error) { - if count == maxPortCheck { - return 0, fmt.Errorf("no available port found") - } - - port := atomic.AddInt32(&from, 1) - addr := fmt.Sprintf("localhost:%d", port) - - count++ - - lis, err := net.Listen("tcp", addr) - if err == nil { - lis.Close() - return port, nil - } else { - return findAvailablePort(from, count) - } -} - // TestContext includes bunch of simple tests to verify the working of timeout // based context and cancellation. func TestContext(t *testing.T) { diff --git a/consensus/bor/heimdall/metrics.go b/consensus/bor/heimdall/metrics.go new file mode 100644 index 0000000000..99d7ca65ac --- /dev/null +++ b/consensus/bor/heimdall/metrics.go @@ -0,0 +1,82 @@ +package heimdall + +import ( + "context" + "time" + + "github.com/ethereum/go-ethereum/metrics" +) + +type ( + requestTypeKey struct{} + requestType string + + meter struct { + request map[bool]metrics.Meter // map[isSuccessful]metrics.Meter + timer metrics.Timer + } +) + +const ( + stateSyncRequest requestType = "state-sync" + spanRequest requestType = "span" + checkpointRequest requestType = "checkpoint" + checkpointCountRequest requestType = "checkpoint-count" +) + +func withRequestType(ctx context.Context, reqType requestType) context.Context { + return context.WithValue(ctx, requestTypeKey{}, reqType) +} + +func getRequestType(ctx context.Context) (requestType, bool) { + reqType, ok := ctx.Value(requestTypeKey{}).(requestType) + return reqType, ok +} + +var ( + requestMeters = map[requestType]meter{ + stateSyncRequest: { + request: map[bool]metrics.Meter{ + true: metrics.NewRegisteredMeter("client/requests/statesync/valid", nil), + false: metrics.NewRegisteredMeter("client/requests/statesync/invalid", nil), + }, + timer: metrics.NewRegisteredTimer("client/requests/statesync/duration", nil), + }, + spanRequest: { + request: map[bool]metrics.Meter{ + true: metrics.NewRegisteredMeter("client/requests/span/valid", nil), + false: metrics.NewRegisteredMeter("client/requests/span/invalid", nil), + }, + timer: metrics.NewRegisteredTimer("client/requests/span/duration", nil), + }, + checkpointRequest: { + request: map[bool]metrics.Meter{ + true: metrics.NewRegisteredMeter("client/requests/checkpoint/valid", nil), + false: metrics.NewRegisteredMeter("client/requests/checkpoint/invalid", nil), + }, + timer: metrics.NewRegisteredTimer("client/requests/checkpoint/duration", nil), + }, + checkpointCountRequest: { + request: map[bool]metrics.Meter{ + true: metrics.NewRegisteredMeter("client/requests/checkpointcount/valid", nil), + false: metrics.NewRegisteredMeter("client/requests/checkpointcount/invalid", nil), + }, + timer: metrics.NewRegisteredTimer("client/requests/checkpointcount/duration", nil), + }, + } +) + +func sendMetrics(ctx context.Context, start time.Time, isSuccessful bool) { + reqType, ok := getRequestType(ctx) + if !ok { + return + } + + meters, ok := requestMeters[reqType] + if !ok { + return + } + + meters.request[isSuccessful].Mark(1) + meters.timer.Update(time.Since(start)) +} diff --git a/consensus/bor/heimdallgrpc/checkpoint.go b/consensus/bor/heimdallgrpc/checkpoint.go new file mode 100644 index 0000000000..2c51efe736 --- /dev/null +++ b/consensus/bor/heimdallgrpc/checkpoint.go @@ -0,0 +1,51 @@ +package heimdallgrpc + +import ( + "context" + "math/big" + + "github.com/ethereum/go-ethereum/consensus/bor/heimdall/checkpoint" + "github.com/ethereum/go-ethereum/log" + + proto "github.com/maticnetwork/polyproto/heimdall" + protoutils "github.com/maticnetwork/polyproto/utils" +) + +func (h *HeimdallGRPCClient) FetchCheckpointCount(ctx context.Context) (int64, error) { + log.Info("Fetching checkpoint count") + + res, err := h.client.FetchCheckpointCount(ctx, nil) + if err != nil { + return 0, err + } + + log.Info("Fetched checkpoint count") + + return res.Result.Result, nil +} + +func (h *HeimdallGRPCClient) FetchCheckpoint(ctx context.Context, number int64) (*checkpoint.Checkpoint, error) { + req := &proto.FetchCheckpointRequest{ + ID: number, + } + + log.Info("Fetching checkpoint", "number", number) + + res, err := h.client.FetchCheckpoint(ctx, req) + if err != nil { + return nil, err + } + + log.Info("Fetched checkpoint", "number", number) + + checkpoint := &checkpoint.Checkpoint{ + StartBlock: new(big.Int).SetUint64(res.Result.StartBlock), + EndBlock: new(big.Int).SetUint64(res.Result.EndBlock), + RootHash: protoutils.ConvertH256ToHash(res.Result.RootHash), + Proposer: protoutils.ConvertH160toAddress(res.Result.Proposer), + BorChainID: res.Result.BorChainID, + Timestamp: uint64(res.Result.Timestamp.GetSeconds()), + } + + return checkpoint, nil +} diff --git a/consensus/bor/heimdallgrpc/client.go b/consensus/bor/heimdallgrpc/client.go new file mode 100644 index 0000000000..7687b7f1c7 --- /dev/null +++ b/consensus/bor/heimdallgrpc/client.go @@ -0,0 +1,52 @@ +package heimdallgrpc + +import ( + "time" + + "github.com/ethereum/go-ethereum/log" + + grpc_retry "github.com/grpc-ecosystem/go-grpc-middleware/retry" + proto "github.com/maticnetwork/polyproto/heimdall" + + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/credentials/insecure" +) + +const ( + stateFetchLimit = 50 +) + +type HeimdallGRPCClient struct { + conn *grpc.ClientConn + client proto.HeimdallClient +} + +func NewHeimdallGRPCClient(address string) *HeimdallGRPCClient { + opts := []grpc_retry.CallOption{ + grpc_retry.WithMax(10000), + grpc_retry.WithBackoff(grpc_retry.BackoffLinear(5 * time.Second)), + grpc_retry.WithCodes(codes.Internal, codes.Unavailable, codes.Aborted, codes.NotFound), + } + + conn, err := grpc.Dial(address, + grpc.WithStreamInterceptor(grpc_retry.StreamClientInterceptor(opts...)), + grpc.WithUnaryInterceptor(grpc_retry.UnaryClientInterceptor(opts...)), + grpc.WithTransportCredentials(insecure.NewCredentials()), + ) + if err != nil { + log.Crit("Failed to connect to Heimdall gRPC", "error", err) + } + + log.Info("Connected to Heimdall gRPC server", "address", address) + + return &HeimdallGRPCClient{ + conn: conn, + client: proto.NewHeimdallClient(conn), + } +} + +func (h *HeimdallGRPCClient) Close() { + log.Debug("Shutdown detected, Closing Heimdall gRPC client") + h.conn.Close() +} diff --git a/consensus/bor/heimdallgrpc/span.go b/consensus/bor/heimdallgrpc/span.go new file mode 100644 index 0000000000..b5c9ddf695 --- /dev/null +++ b/consensus/bor/heimdallgrpc/span.go @@ -0,0 +1,63 @@ +package heimdallgrpc + +import ( + "context" + + "github.com/ethereum/go-ethereum/consensus/bor/heimdall/span" + "github.com/ethereum/go-ethereum/consensus/bor/valset" + "github.com/ethereum/go-ethereum/log" + + proto "github.com/maticnetwork/polyproto/heimdall" + protoutils "github.com/maticnetwork/polyproto/utils" +) + +func (h *HeimdallGRPCClient) Span(ctx context.Context, spanID uint64) (*span.HeimdallSpan, error) { + req := &proto.SpanRequest{ + ID: spanID, + } + + log.Info("Fetching span", "spanID", spanID) + + res, err := h.client.Span(ctx, req) + if err != nil { + return nil, err + } + + log.Info("Fetched span", "spanID", spanID) + + return parseSpan(res.Result), nil +} + +func parseSpan(protoSpan *proto.Span) *span.HeimdallSpan { + resp := &span.HeimdallSpan{ + Span: span.Span{ + ID: protoSpan.ID, + StartBlock: protoSpan.StartBlock, + EndBlock: protoSpan.EndBlock, + }, + ValidatorSet: valset.ValidatorSet{}, + SelectedProducers: []valset.Validator{}, + ChainID: protoSpan.ChainID, + } + + for _, validator := range protoSpan.ValidatorSet.Validators { + resp.ValidatorSet.Validators = append(resp.ValidatorSet.Validators, parseValidator(validator)) + } + + resp.ValidatorSet.Proposer = parseValidator(protoSpan.ValidatorSet.Proposer) + + for _, validator := range protoSpan.SelectedProducers { + resp.SelectedProducers = append(resp.SelectedProducers, *parseValidator(validator)) + } + + return resp +} + +func parseValidator(validator *proto.Validator) *valset.Validator { + return &valset.Validator{ + ID: validator.ID, + Address: protoutils.ConvertH160toAddress(validator.Address), + VotingPower: validator.VotingPower, + ProposerPriority: validator.ProposerPriority, + } +} diff --git a/consensus/bor/heimdallgrpc/state_sync.go b/consensus/bor/heimdallgrpc/state_sync.go new file mode 100644 index 0000000000..a3bbb80aae --- /dev/null +++ b/consensus/bor/heimdallgrpc/state_sync.go @@ -0,0 +1,59 @@ +package heimdallgrpc + +import ( + "context" + "errors" + "io" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/consensus/bor/clerk" + + proto "github.com/maticnetwork/polyproto/heimdall" +) + +func (h *HeimdallGRPCClient) StateSyncEvents(ctx context.Context, fromID uint64, to int64) ([]*clerk.EventRecordWithTime, error) { + eventRecords := make([]*clerk.EventRecordWithTime, 0) + + req := &proto.StateSyncEventsRequest{ + FromID: fromID, + ToTime: uint64(to), + Limit: uint64(stateFetchLimit), + } + + var ( + res proto.Heimdall_StateSyncEventsClient + events *proto.StateSyncEventsResponse + err error + ) + + res, err = h.client.StateSyncEvents(ctx, req) + if err != nil { + return nil, err + } + + for { + events, err = res.Recv() + if errors.Is(err, io.EOF) { + return eventRecords, nil + } + + if err != nil { + return nil, err + } + + for _, event := range events.Result { + eventRecord := &clerk.EventRecordWithTime{ + EventRecord: clerk.EventRecord{ + ID: event.ID, + Contract: common.HexToAddress(event.Contract), + Data: common.Hex2Bytes(event.Data[2:]), + TxHash: common.HexToHash(event.TxHash), + LogIndex: event.LogIndex, + ChainID: event.ChainID, + }, + Time: event.Time.AsTime(), + } + eventRecords = append(eventRecords, eventRecord) + } + } +} diff --git a/consensus/bor/snapshot.go b/consensus/bor/snapshot.go index 403ec59b7d..b61851262e 100644 --- a/consensus/bor/snapshot.go +++ b/consensus/bor/snapshot.go @@ -59,6 +59,8 @@ func loadSnapshot(config *params.BorConfig, sigcache *lru.ARCCache, db ethdb.Dat return nil, err } + snap.ValidatorSet.UpdateValidatorMap() + snap.config = config snap.sigcache = sigcache diff --git a/consensus/bor/valset/validator_set.go b/consensus/bor/valset/validator_set.go index 772d2c5ef8..0a6f7c4487 100644 --- a/consensus/bor/valset/validator_set.go +++ b/consensus/bor/valset/validator_set.go @@ -628,6 +628,10 @@ func (vals *ValidatorSet) updateValidators(updates []*Validator, deletes []*Vali vals.applyUpdates(updates) vals.applyRemovals(deletes) + vals.UpdateValidatorMap() +} + +func (vals *ValidatorSet) UpdateValidatorMap() { vals.validatorsMap = make(map[common.Address]int, len(vals.Validators)) for i, val := range vals.Validators { diff --git a/consensus/ethash/sealer_test.go b/consensus/ethash/sealer_test.go index a9e96af866..9ddfcd840a 100644 --- a/consensus/ethash/sealer_test.go +++ b/consensus/ethash/sealer_test.go @@ -167,6 +167,10 @@ func TestRemoteMultiNotify(t *testing.T) { // Tests that pushing work packages fast to the miner doesn't cause any data race // issues in the notifications. Full pending block body / --miner.notify.full) func TestRemoteMultiNotifyFull(t *testing.T) { + // TODO: Understand the test case and Identify the reason for failing tests. + // Also, make it more deterministic. + t.Skip("skipping - non-deterministic test, no dependency on this test for now and not directly relevant to bor") + // Start a simple web server to capture notifications. sink := make(chan map[string]interface{}, 64) server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { diff --git a/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823151330-26278.fail b/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823151330-26278.fail new file mode 100644 index 0000000000..94ce1546f8 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823151330-26278.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_0 2022/08/23 15:13:30 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_0 2022/08/23 15:13:30 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000492108), (*core.testTx)(0x14000492138)}, totalTxs:2} +# TestSmallTxPool/thread_0 2022/08/23 15:13:30 current_total2in_batch0removed681emptyBlocks0blockGasLeft40767pending0locals1locals+pending49.792µs +# TestSmallTxPool/thread_0 2022/08/23 15:13:30 block0pending2queued0elapsed49.792µs +# TestSmallTxPool/thread_0 2022/08/23 15:13:31 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending2.292µs +# TestSmallTxPool/thread_0 2022/08/23 15:13:31 block1pending0queued1elapsed2.292µs +# TestSmallTxPool/thread_0 2022/08/23 15:13:33 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_0 2022/08/23 15:13:33 Case params: totalAccs = 1; totalTxs = 2; mean 32505, stdev 16246, 21017-43993); queued mean 21017, stdev 0, 21017-21017); +# +# +v0.4.8#11029736394225352711 +0x0 +0x0 +0x0 +0x0 +0x0 +0x1 +0x1f2636f2f4272a +0x1eb19696411e3a +0x0 +0x1a9a08d47dda23 +0x34b +0x17862cfa81ddf3 +0x59d1 +0x6c6149a0e3fea +0x354f9d0ccc85 +0x0 +0x13a7039f9f51e8 +0x55 +0xd533863398551 +0x11 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823151928-26429.fail b/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823151928-26429.fail new file mode 100644 index 0000000000..9a63d1ae84 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823151928-26429.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_0 2022/08/23 15:19:28 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_0 2022/08/23 15:19:28 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400030c330), (*core.testTx)(0x1400030c360)}, totalTxs:2} +# TestSmallTxPool/thread_0 2022/08/23 15:19:28 current_total2in_batch0removed1419emptyBlocks0blockGasLeft13692pending0locals1locals+pending58.958µs +# TestSmallTxPool/thread_0 2022/08/23 15:19:28 block0pending2queued0elapsed58.958µs +# TestSmallTxPool/thread_0 2022/08/23 15:19:29 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending1.709µs +# TestSmallTxPool/thread_0 2022/08/23 15:19:29 block1pending0queued1elapsed1.709µs +# TestSmallTxPool/thread_0 2022/08/23 15:19:32 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_0 2022/08/23 15:19:32 Case params: totalAccs = 1; totalTxs = 2; mean 21120, stdev 16, 21109-21132); queued mean 21109, stdev 0, 21109-21109); +# +# +v0.4.8#9786661773728808964 +0x0 +0x0 +0x0 +0x67dc9cec78e13 +0x1bf4422bb39e5f +0x1 +0x1ea85a9a31648c +0x15a464694e57a5 +0x0 +0x1e9abc9f2d4c22 +0x197 +0x13b4908913f2be +0x84 +0x698224e1fdf58 +0x17a1aa232e63bc +0x0 +0x198c53867741ca +0xa1 +0xe5eb9d729f520 +0x6d \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823152444-26736.fail b/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823152444-26736.fail new file mode 100644 index 0000000000..e7d4e37a32 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823152444-26736.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_0 2022/08/23 15:24:44 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_0 2022/08/23 15:24:44 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140000e20d8), (*core.testTx)(0x140000e2108)}, totalTxs:2} +# TestSmallTxPool/thread_0 2022/08/23 15:24:44 current_total2in_batch0removed1372emptyBlocks0blockGasLeft12196pending0locals1locals+pending137.209µs +# TestSmallTxPool/thread_0 2022/08/23 15:24:44 block0pending2queued0elapsed137.209µs +# TestSmallTxPool/thread_0 2022/08/23 15:24:45 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending2.75µs +# TestSmallTxPool/thread_0 2022/08/23 15:24:45 block1pending0queued1elapsed2.75µs +# TestSmallTxPool/thread_0 2022/08/23 15:24:48 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_0 2022/08/23 15:24:48 Case params: totalAccs = 1; totalTxs = 2; mean 28968, stdev 10057, 21857-36080); queued mean 36080, stdev 0, 36080-36080); +# +# +v0.4.8#3215567110285557761 +0x0 +0x0 +0x0 +0x0 +0x0 +0x1 +0x1b2c25eff2c22f +0x1feb1e4a05c9d4 +0xffffffffffffffff +0x1414771bc67fb3 +0x52 +0x127640f42d5fc0 +0x359 +0x6ea0a16444b3e +0x1c44165efb736b +0x0 +0x10c19b853a39f +0x1 +0x16ece298caa22e +0x3ae8 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823153150-26804.fail b/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823153150-26804.fail new file mode 100644 index 0000000000..0a832ab9b6 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823153150-26804.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_0 2022/08/23 15:31:50 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_0 2022/08/23 15:31:50 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000284d98), (*core.testTx)(0x14000284dc8)}, totalTxs:2} +# TestSmallTxPool/thread_0 2022/08/23 15:31:50 current_total2in_batch0removed2emptyBlocks0blockGasLeft4212242pending0locals1locals+pending24.083µs +# TestSmallTxPool/thread_0 2022/08/23 15:31:50 block0pending2queued0elapsed24.083µs +# TestSmallTxPool/thread_0 2022/08/23 15:31:51 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending19.541µs +# TestSmallTxPool/thread_0 2022/08/23 15:31:51 block1pending0queued1elapsed19.541µs +# TestSmallTxPool/thread_0 2022/08/23 15:31:54 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_0 2022/08/23 15:31:54 Case params: totalAccs = 1; totalTxs = 2; mean 6458035, stdev 9101657, 22192-12893879); queued mean 22192, stdev 0, 22192-22192); +# +# +v0.4.8#10709562971903754262 +0x0 +0x0 +0x0 +0x17e0c3279c99ab +0xb6f41a4a6b3a4 +0x1 +0x87842817eb8ff +0x1451c92f7668a0 +0x0 +0x121043590cea35 +0x9c +0x1c71051dfee8ac +0xc46caf +0xa55ff6fb6a68c +0x1501d124bb34bf +0x0 +0x16344309605962 +0x1dc +0x143f19bff3d120 +0x4a8 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823153538-26949.fail b/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823153538-26949.fail new file mode 100644 index 0000000000..3645ca10ce --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823153538-26949.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_0 2022/08/23 15:35:38 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_0 2022/08/23 15:35:38 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400000ecf0), (*core.testTx)(0x1400000ed20)}, totalTxs:2} +# TestSmallTxPool/thread_0 2022/08/23 15:35:38 current_total2in_batch0removed1428emptyBlocks0blockGasLeft10572pending0locals1locals+pending80.083µs +# TestSmallTxPool/thread_0 2022/08/23 15:35:38 block0pending2queued0elapsed80.083µs +# TestSmallTxPool/thread_0 2022/08/23 15:35:39 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending792ns +# TestSmallTxPool/thread_0 2022/08/23 15:35:39 block1pending0queued1elapsed792ns +# TestSmallTxPool/thread_0 2022/08/23 15:35:50 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_0 2022/08/23 15:35:50 Case params: totalAccs = 2; totalTxs = 2; mean 21005, stdev 5, 21001-21009); queued mean 21009, stdev 0, 21009-21009); +# +# +v0.4.8#13590275224699404290 +0x0 +0xd2a17242499b0 +0x1 +0xbc8a024b6343f +0x18dd5253af2dc3 +0x1 +0x169f385833d74a +0x12a688b34980e3 +0x0 +0x167b53470152c +0x0 +0x559e528dfab8d +0x1 +0x18e2016ee66460 +0x338f1089da1b4 +0x0 +0x115e9e024d79b2 +0x29 +0x8088bc72eaa59 +0x9 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823154120-27072.fail b/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823154120-27072.fail new file mode 100644 index 0000000000..e5b9a7989c --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823154120-27072.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_0 2022/08/23 15:41:20 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_0 2022/08/23 15:41:20 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400000e228), (*core.testTx)(0x1400000e258)}, totalTxs:2} +# TestSmallTxPool/thread_0 2022/08/23 15:41:20 current_total2in_batch0removed2emptyBlocks0blockGasLeft4280620pending0locals1locals+pending10.917µs +# TestSmallTxPool/thread_0 2022/08/23 15:41:20 block0pending2queued0elapsed10.917µs +# TestSmallTxPool/thread_0 2022/08/23 15:41:21 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending7.125µs +# TestSmallTxPool/thread_0 2022/08/23 15:41:21 block1pending0queued1elapsed7.125µs +# TestSmallTxPool/thread_0 2022/08/23 15:41:32 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_0 2022/08/23 15:41:32 Case params: totalAccs = 2; totalTxs = 2; mean 6440512, stdev 9078088, 21334-12859690); queued mean 21334, stdev 0, 21334-21334); +# +# +v0.4.8#13827906007021387778 +0x0 +0x13c161ea2c5f10 +0x1 +0x5c321f259b270 +0x8a4dc328bbd30 +0x1 +0x171dea27d41efa +0x2ea0352069717 +0x0 +0x1226a321f64da4 +0xd1 +0x1d3ec3221a46c4 +0xc3e722 +0x11b2bdae727c2d +0x66a7913ad4c48 +0x0 +0x684971f31e928 +0x1 +0x13ae283311efe6 +0x14e \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823154450-27147.fail b/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823154450-27147.fail new file mode 100644 index 0000000000..4c12403ebe --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823154450-27147.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_0 2022/08/23 15:44:50 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_0 2022/08/23 15:44:50 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400077eb28), (*core.testTx)(0x1400077eb58)}, totalTxs:2} +# TestSmallTxPool/thread_0 2022/08/23 15:44:50 current_total2in_batch0removed1428emptyBlocks0blockGasLeft7716pending0locals1locals+pending215.625µs +# TestSmallTxPool/thread_0 2022/08/23 15:44:50 block0pending2queued0elapsed215.625µs +# TestSmallTxPool/thread_0 2022/08/23 15:44:51 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending21.625µs +# TestSmallTxPool/thread_0 2022/08/23 15:44:51 block1pending0queued1elapsed21.625µs +# TestSmallTxPool/thread_0 2022/08/23 15:45:02 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_0 2022/08/23 15:45:02 Case params: totalAccs = 1; totalTxs = 2; mean 21005, stdev 2, 21003-21007); queued mean 21007, stdev 0, 21007-21007); +# +# +v0.4.8#7017342383972941826 +0x0 +0xbbbccdb397a57 +0x0 +0xf01dd5f7ae508 +0x12268ab42e6b8e +0x1 +0xbd975f5492e8c +0x113d0f132ef348 +0x0 +0x5fed4787ef891 +0x3 +0x33575339aaeb2 +0x3 +0xad43c78a9ecf2 +0x16baafceb1d6b +0x0 +0x15488c8367666b +0x282 +0x9980fb2895ffb +0x7 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823191059-29281.fail b/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823191059-29281.fail new file mode 100644 index 0000000000..74802b0efe --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220823191059-29281.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_0 2022/08/23 19:10:59 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_0 2022/08/23 19:10:59 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400000e1c8), (*core.testTx)(0x1400000e1f8)}, totalTxs:2} +# TestSmallTxPool/thread_0 2022/08/23 19:10:59 current_total2in_batch0removed16emptyBlocks0blockGasLeft429312pending0locals1locals+pending26.75µs +# TestSmallTxPool/thread_0 2022/08/23 19:10:59 block0pending2queued0elapsed26.75µs +# TestSmallTxPool/thread_0 2022/08/23 19:10:59 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending1.625µs +# TestSmallTxPool/thread_0 2022/08/23 19:10:59 block1pending0queued1elapsed1.625µs +# TestSmallTxPool/thread_0 2022/08/23 19:11:19 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_0 2022/08/23 19:11:19 Case params: totalAccs = 1; totalTxs = 2; gasValues mean 934592, stdev 1291991, 21016-1848168); queued mean 21016, stdev 0, 21016-21016); +# +# +v0.4.8#14400060453315149826 +0x1da97f11b17d22 +0xe049e271c42d4 +0x0 +0x191727a4e4c060 +0xe169141bcbc4a +0x1 +0xf5c4ae03fbf73 +0x1cfbdf4ce9a2cb +0x0 +0x3d888f9cea9a5 +0x3 +0x1ba7fc195e78db +0x1be160 +0x11bd23add00391 +0x156cb42ad682b9 +0x0 +0x6eaa2424cc342 +0x4 +0xcfa77da5c5c8f +0x10 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220824135022-34401.fail b/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220824135022-34401.fail new file mode 100644 index 0000000000..4ac3495ee5 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_0/TestSmallTxPool_thread_0-20220824135022-34401.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_0 2022/08/24 13:50:22 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_0 2022/08/24 13:50:22 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000292108), (*core.testTx)(0x14000292138)}, totalTxs:2} +# TestSmallTxPool/thread_0 2022/08/24 13:50:22 current_total2in_batch0removed1427emptyBlocks0blockGasLeft13022pending0locals1locals+pending132.417µs +# TestSmallTxPool/thread_0 2022/08/24 13:50:22 block0pending2queued0elapsed132.417µs +# TestSmallTxPool/thread_0 2022/08/24 13:50:22 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending1.875µs +# TestSmallTxPool/thread_0 2022/08/24 13:50:22 block1pending0queued1elapsed1.875µs +# TestSmallTxPool/thread_0 2022/08/24 13:50:42 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_0 2022/08/24 13:50:42 Case params: totalAccs = 1; totalTxs = 2; gasValues mean 21007, stdev 9, 21001-21014); queued mean 21001, stdev 0, 21001-21001); +# +# +v0.4.8#974752723431850006 +0x14b2a7d7e2408a +0x1364be1a25bf21 +0x0 +0x1b620383c208d7 +0x9461cde08694e +0x1 +0x2aa7eebef7fcb +0x49d3ee5298f3c +0x0 +0x1cff585444d134 +0x245 +0x8ce24f34a5308 +0xe +0x41dd341771c08 +0x547b5f47dc931 +0x0 +0x6040582af4d8c +0x0 +0x7d25b0875a075 +0x1 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823151323-26278.fail b/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823151323-26278.fail new file mode 100644 index 0000000000..f19d25288c --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823151323-26278.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_1 2022/08/23 15:13:23 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_1 2022/08/23 15:13:23 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400080a2d0), (*core.testTx)(0x1400080a300)}, totalTxs:2} +# TestSmallTxPool/thread_1 2022/08/23 15:13:23 current_total2in_batch0removed1427emptyBlocks0blockGasLeft7314pending0locals1locals+pending90.292µs +# TestSmallTxPool/thread_1 2022/08/23 15:13:23 block0pending2queued0elapsed90.292µs +# TestSmallTxPool/thread_1 2022/08/23 15:13:24 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending1.125µs +# TestSmallTxPool/thread_1 2022/08/23 15:13:24 block1pending0queued1elapsed1.125µs +# TestSmallTxPool/thread_1 2022/08/23 15:13:26 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_1 2022/08/23 15:13:26 Case params: totalAccs = 1; totalTxs = 2; mean 21020, stdev 2, 21018-21022); queued mean 21022, stdev 0, 21022-21022); +# +# +v0.4.8#11031974072186568713 +0x0 +0x0 +0x0 +0x0 +0x0 +0x1 +0x340ea5bc881c +0xede9d2ccbcc0e +0x0 +0x8c4bfb32cd2e1 +0x6 +0x10e704368e14ac +0x12 +0x1de5cc63f09ac0 +0x106977c8fdd59d +0x0 +0xa5a15c0a7551f +0x1 +0x9f5fc1605085d +0x16 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823151922-26429.fail b/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823151922-26429.fail new file mode 100644 index 0000000000..2271dd3476 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823151922-26429.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_1 2022/08/23 15:19:22 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_1 2022/08/23 15:19:22 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140003d20f0), (*core.testTx)(0x140003d2120)}, totalTxs:2} +# TestSmallTxPool/thread_1 2022/08/23 15:19:22 current_total2in_batch0removed305emptyBlocks0blockGasLeft23075pending0locals1locals+pending14.459µs +# TestSmallTxPool/thread_1 2022/08/23 15:19:22 block0pending2queued0elapsed14.459µs +# TestSmallTxPool/thread_1 2022/08/23 15:19:23 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending583ns +# TestSmallTxPool/thread_1 2022/08/23 15:19:23 block1pending0queued1elapsed583ns +# TestSmallTxPool/thread_1 2022/08/23 15:19:26 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_1 2022/08/23 15:19:26 Case params: totalAccs = 1; totalTxs = 2; mean 1897853, stdev 2544973, 98285-3697421); queued mean 3697421, stdev 0, 3697421-3697421); +# +# +v0.4.8#9790973920893992969 +0x0 +0x0 +0x0 +0x0 +0x2dd249d3645dd +0x1 +0x10a1d46be478ff +0x123cb694eaae5d +0x0 +0x1857c4c20b6cf2 +0x40 +0x19bb74c954d6d0 +0x12de5 +0x2e6ad310e94e0 +0x4eaa8ac28ac89 +0x0 +0x869c6ef25c94c +0x3 +0x1b74fc7efc27c0 +0x381905 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823152442-26736.fail b/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823152442-26736.fail new file mode 100644 index 0000000000..904f87911d --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823152442-26736.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_1 2022/08/23 15:24:42 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_1 2022/08/23 15:24:42 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000ab82a0), (*core.testTx)(0x14000ab82d0)}, totalTxs:2} +# TestSmallTxPool/thread_1 2022/08/23 15:24:42 current_total2in_batch0removed121emptyBlocks0blockGasLeft136958pending0locals1locals+pending33.208µs +# TestSmallTxPool/thread_1 2022/08/23 15:24:42 block0pending2queued0elapsed33.208µs +# TestSmallTxPool/thread_1 2022/08/23 15:24:43 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending23.542µs +# TestSmallTxPool/thread_1 2022/08/23 15:24:43 block1pending0queued1elapsed23.542µs +# TestSmallTxPool/thread_1 2022/08/23 15:24:46 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_1 2022/08/23 15:24:46 Case params: totalAccs = 1; totalTxs = 2; mean 133911, stdev 159651, 21020-246802); queued mean 21020, stdev 0, 21020-21020); +# +# +v0.4.8#3220562157250805769 +0x0 +0x0 +0x0 +0x0 +0xec204142183b8 +0x1 +0x520290d37649c +0x1c52fe050f7cda +0x0 +0x9eedba0ba0a1b +0x3 +0x1ae703ec9578a3 +0x3720a +0x18a5c8f65198c3 +0x287c0826f41fd +0x0 +0x5d906606d80e +0x0 +0x9fe0b2ed36580 +0x14 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823153132-26804.fail b/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823153132-26804.fail new file mode 100644 index 0000000000..6ca24737eb --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823153132-26804.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_1 2022/08/23 15:31:32 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_1 2022/08/23 15:31:32 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000322f90), (*core.testTx)(0x14000322fc0)}, totalTxs:2} +# TestSmallTxPool/thread_1 2022/08/23 15:31:32 current_total2in_batch0removed7emptyBlocks0blockGasLeft861688pending0locals1locals+pending97.292µs +# TestSmallTxPool/thread_1 2022/08/23 15:31:32 block0pending2queued0elapsed97.292µs +# TestSmallTxPool/thread_1 2022/08/23 15:31:33 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending2.709µs +# TestSmallTxPool/thread_1 2022/08/23 15:31:33 block1pending0queued1elapsed2.709µs +# TestSmallTxPool/thread_1 2022/08/23 15:31:36 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_1 2022/08/23 15:31:36 Case params: totalAccs = 1; totalTxs = 2; mean 2092309, stdev 2927855, 22003-4162616); queued mean 22003, stdev 0, 22003-22003); +# +# +v0.4.8#10710653893596938249 +0x0 +0x0 +0x0 +0x0 +0x66311e3789fc1 +0x1 +0xecff5ea5adabc +0x1d6c0a39f1f128 +0x0 +0xfb51d55187e73 +0x30 +0x1bb6ee7a61a496 +0x3f3230 +0x4511a67bb0d16 +0x1ea4f443ba00c3 +0x0 +0x976de73fcc564 +0xd +0x13252e46b26a94 +0x3eb \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823153538-26949.fail b/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823153538-26949.fail new file mode 100644 index 0000000000..20c06789f9 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823153538-26949.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_1 2022/08/23 15:35:38 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_1 2022/08/23 15:35:38 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000434450), (*core.testTx)(0x14000434480)}, totalTxs:2} +# TestSmallTxPool/thread_1 2022/08/23 15:35:38 current_total2in_batch0removed1397emptyBlocks0blockGasLeft3616pending0locals1locals+pending73.333µs +# TestSmallTxPool/thread_1 2022/08/23 15:35:38 block0pending2queued0elapsed73.333µs +# TestSmallTxPool/thread_1 2022/08/23 15:35:39 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending791ns +# TestSmallTxPool/thread_1 2022/08/23 15:35:39 block1pending0queued1elapsed791ns +# TestSmallTxPool/thread_1 2022/08/23 15:35:50 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_1 2022/08/23 15:35:50 Case params: totalAccs = 1; totalTxs = 2; mean 24538, stdev 4335, 21472-27604); queued mean 27604, stdev 0, 27604-27604); +# +# +v0.4.8#13594484292649484294 +0x0 +0x33d81b4e61ccb +0x0 +0x13d94ec34a6a0 +0xc3f0d3a884b9c +0x1 +0x1cd4e0fe57b78a +0x27ccab598995d +0x0 +0x17dc4a6feed56f +0x61 +0x12f659ced99051 +0x1d8 +0x38997e5c06bf2 +0x83e6e47cda8ad +0x0 +0x18f4121555d2b0 +0x2f3 +0x1723e9d78b0a02 +0x19cc \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823154142-27072.fail b/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823154142-27072.fail new file mode 100644 index 0000000000..2eb492f0d7 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823154142-27072.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_1 2022/08/23 15:41:42 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_1 2022/08/23 15:41:42 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140001bef30), (*core.testTx)(0x140001bef60)}, totalTxs:2} +# TestSmallTxPool/thread_1 2022/08/23 15:41:42 current_total2in_batch0removed1406emptyBlocks0blockGasLeft178pending0locals1locals+pending242.875µs +# TestSmallTxPool/thread_1 2022/08/23 15:41:42 block0pending2queued0elapsed242.875µs +# TestSmallTxPool/thread_1 2022/08/23 15:41:43 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending2.791µs +# TestSmallTxPool/thread_1 2022/08/23 15:41:43 block1pending0queued1elapsed2.791µs +# TestSmallTxPool/thread_1 2022/08/23 15:41:54 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_1 2022/08/23 15:41:54 Case params: totalAccs = 2; totalTxs = 2; mean 21169, stdev 236, 21002-21337); queued mean 21002, stdev 0, 21002-21002); +# +# +v0.4.8#13829336231130955785 +0x0 +0x1ab0d5a355c4fa +0x1 +0x3d3ac91081d48 +0x14ebd755ac043a +0x1 +0x1fa70360c5584a +0xd869ae2b68e87 +0x0 +0x10918ae633d4c5 +0x7 +0x14c7652b59695d +0x151 +0x1bc28156c12803 +0x12998fb4886bcc +0x0 +0x1837075a1c52f7 +0x1a9 +0x61a84b35b83bf +0x2 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823154451-27147.fail b/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823154451-27147.fail new file mode 100644 index 0000000000..0d6cc64496 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823154451-27147.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_1 2022/08/23 15:44:51 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_1 2022/08/23 15:44:51 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400077eea0), (*core.testTx)(0x1400077eed0)}, totalTxs:2} +# TestSmallTxPool/thread_1 2022/08/23 15:44:51 current_total2in_batch0removed1426emptyBlocks0blockGasLeft16924pending0locals1locals+pending119.167µs +# TestSmallTxPool/thread_1 2022/08/23 15:44:51 block0pending2queued0elapsed119.167µs +# TestSmallTxPool/thread_1 2022/08/23 15:44:52 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending18.709µs +# TestSmallTxPool/thread_1 2022/08/23 15:44:52 block1pending0queued1elapsed18.709µs +# TestSmallTxPool/thread_1 2022/08/23 15:45:03 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_1 2022/08/23 15:45:03 Case params: totalAccs = 1; totalTxs = 2; mean 21032, stdev 9, 21026-21039); queued mean 21039, stdev 0, 21039-21039); +# +# +v0.4.8#7018287276778061830 +0x0 +0x4c50b4d357c71 +0x0 +0x1d4243a82bdaf +0x1b8163df9fd828 +0x1 +0x2183a843d557d +0x19fc89d7b09642 +0x0 +0x15b3f41126497d +0x181 +0xb6020211ce8fd +0x1a +0x97669f5b06dd0 +0x10a6f0c1e990aa +0x0 +0x15c956ea01fae5 +0x96 +0xc06bb0d5fde11 +0x27 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823191039-29281.fail b/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823191039-29281.fail new file mode 100644 index 0000000000..534a3fcd52 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220823191039-29281.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_1 2022/08/23 19:10:39 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_1 2022/08/23 19:10:39 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400043c930), (*core.testTx)(0x1400043c960)}, totalTxs:2} +# TestSmallTxPool/thread_1 2022/08/23 19:10:39 current_total2in_batch0removed1427emptyBlocks0blockGasLeft14449pending0locals1locals+pending138.666µs +# TestSmallTxPool/thread_1 2022/08/23 19:10:39 block0pending2queued0elapsed138.666µs +# TestSmallTxPool/thread_1 2022/08/23 19:10:39 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending1.041µs +# TestSmallTxPool/thread_1 2022/08/23 19:10:39 block1pending0queued1elapsed1.041µs +# TestSmallTxPool/thread_1 2022/08/23 19:10:59 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_1 2022/08/23 19:10:59 Case params: totalAccs = 2; totalTxs = 2; gasValues mean 21007, stdev 8, 21001-21013); queued mean 21001, stdev 0, 21001-21001); +# +# +v0.4.8#14403251614016077834 +0x12a97ee40d6ba4 +0xb9c1016a0871e +0x1 +0x895cbbe249c79 +0x95fe619d4a080 +0x1 +0x1c6eb6bc691ce +0x98168078caa0e +0x0 +0x407b2c97ec5fc +0x1 +0x9580bdcf02f46 +0xd +0x1fd9db6f7fdfd +0xdea1a13d4818d +0x0 +0x1b9dc8f25305a7 +0x25e +0x13cb98d916a1 +0x1 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220824134822-34401.fail b/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220824134822-34401.fail new file mode 100644 index 0000000000..d70cd62d0b --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_1/TestSmallTxPool_thread_1-20220824134822-34401.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_1 2022/08/24 13:48:22 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_1 2022/08/24 13:48:22 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400071c390), (*core.testTx)(0x1400071c3c0)}, totalTxs:2} +# TestSmallTxPool/thread_1 2022/08/24 13:48:22 current_total2in_batch0removed1428emptyBlocks0blockGasLeft10572pending0locals1locals+pending180.083µs +# TestSmallTxPool/thread_1 2022/08/24 13:48:22 block0pending2queued0elapsed180.083µs +# TestSmallTxPool/thread_1 2022/08/24 13:48:22 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending1.292µs +# TestSmallTxPool/thread_1 2022/08/24 13:48:22 block1pending0queued1elapsed1.292µs +# TestSmallTxPool/thread_1 2022/08/24 13:48:42 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_1 2022/08/24 13:48:42 Case params: totalAccs = 2; totalTxs = 2; gasValues mean 308879, stdev 407120, 21001-596757); queued mean 596757, stdev 0, 596757-596757); +# +# +v0.4.8#980598173921705994 +0x18ea98f3bfb1cb +0x1ceed6f3f248db +0x1 +0x1aebd413a3959d +0x16d9c62d659b64 +0x1 +0x1972791517ec06 +0x1d9f72a515fdb6 +0x0 +0x22e91e021d3bd +0x0 +0x56f90e9b60f7e +0x1 +0x10301c2bda1e56 +0x164b36f2c6915a +0x0 +0x8eec91fb0fc78 +0x7 +0x1bb17c8ff3bb6b +0x8c90d \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823151331-26278.fail b/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823151331-26278.fail new file mode 100644 index 0000000000..095a07c2d7 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823151331-26278.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_2 2022/08/23 15:13:31 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_2 2022/08/23 15:13:31 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000916108), (*core.testTx)(0x14000916138)}, totalTxs:2} +# TestSmallTxPool/thread_2 2022/08/23 15:13:31 current_total2in_batch0removed2emptyBlocks0blockGasLeft1860730pending0locals1locals+pending15.958µs +# TestSmallTxPool/thread_2 2022/08/23 15:13:31 block0pending2queued0elapsed15.958µs +# TestSmallTxPool/thread_2 2022/08/23 15:13:32 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending7.75µs +# TestSmallTxPool/thread_2 2022/08/23 15:13:32 block1pending0queued1elapsed7.75µs +# TestSmallTxPool/thread_2 2022/08/23 15:13:34 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_2 2022/08/23 15:13:34 Case params: totalAccs = 1; totalTxs = 2; mean 7045320, stdev 9933880, 21006-14069635); queued mean 21006, stdev 0, 21006-21006); +# +# +v0.4.8#11031115078727368725 +0x0 +0x0 +0x0 +0x0 +0x0 +0x1 +0x1654b1adcb6148 +0xdf7913ad682c0 +0x0 +0x1afa0a4a686226 +0x212 +0x1e794d7d9110d4 +0xd65d7b +0x188af114bc763a +0x138af91635004f +0x0 +0x137a1e63b55cc6 +0x83 +0x92dd858d02d22 +0x6 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823151945-26429.fail b/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823151945-26429.fail new file mode 100644 index 0000000000..13de71b372 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823151945-26429.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_2 2022/08/23 15:19:45 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_2 2022/08/23 15:19:45 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400030c540), (*core.testTx)(0x1400030c570)}, totalTxs:2} +# TestSmallTxPool/thread_2 2022/08/23 15:19:45 current_total2in_batch0removed20emptyBlocks0blockGasLeft849240pending0locals1locals+pending6.834µs +# TestSmallTxPool/thread_2 2022/08/23 15:19:45 block0pending2queued0elapsed6.834µs +# TestSmallTxPool/thread_2 2022/08/23 15:19:46 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending10.125µs +# TestSmallTxPool/thread_2 2022/08/23 15:19:46 block1pending0queued1elapsed10.125µs +# TestSmallTxPool/thread_2 2022/08/23 15:19:49 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_2 2022/08/23 15:19:49 Case params: totalAccs = 1; totalTxs = 2; mean 739269, stdev 1015785, 21000-1457538); queued mean 21000, stdev 0, 21000-21000); +# +# +v0.4.8#9791059820239912998 +0x0 +0x0 +0x0 +0x0 +0x9891e9d09e8e +0x1 +0x176a8e3aef0257 +0xc820b88f35a3b +0x0 +0x1bb7d024a4bd7 +0x1 +0x1b22b625a9884c +0x15eb7a +0xdf88b2ba18f3f +0x1dea4b012e0db4 +0x0 +0xedd0f7a0ad2c2 +0x28 +0xb2cd1ce809ef +0x0 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823152442-26736.fail b/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823152442-26736.fail new file mode 100644 index 0000000000..fad31fd2dd --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823152442-26736.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_2 2022/08/23 15:24:42 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_2 2022/08/23 15:24:42 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000ab8600), (*core.testTx)(0x14000ab8630)}, totalTxs:2} +# TestSmallTxPool/thread_2 2022/08/23 15:24:42 current_total2in_batch0removed1426emptyBlocks0blockGasLeft19776pending0locals1locals+pending256.333µs +# TestSmallTxPool/thread_2 2022/08/23 15:24:42 block0pending2queued0elapsed256.333µs +# TestSmallTxPool/thread_2 2022/08/23 15:24:43 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending5.917µs +# TestSmallTxPool/thread_2 2022/08/23 15:24:43 block1pending0queued1elapsed5.917µs +# TestSmallTxPool/thread_2 2022/08/23 15:24:46 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_2 2022/08/23 15:24:46 Case params: totalAccs = 1; totalTxs = 2; mean 258083, stdev 335252, 21024-495143); queued mean 495143, stdev 0, 495143-495143); +# +# +v0.4.8#3220235739736309768 +0x0 +0x0 +0x0 +0x0 +0x578ef9ca2f7fd +0x1 +0x17d40dde5d864f +0x5341422cf03e7 +0x0 +0x14d31987ad7269 +0x1d9 +0xab5e18a4b628b +0x18 +0xcacb7e3233242 +0x1f1632f7b0d7e +0x0 +0x1934319689aef6 +0x27c +0x1aad69da6467b7 +0x73c1f \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823153142-26804.fail b/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823153142-26804.fail new file mode 100644 index 0000000000..5e21a448bf --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823153142-26804.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_2 2022/08/23 15:31:42 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_2 2022/08/23 15:31:42 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000284570), (*core.testTx)(0x140002845a0)}, totalTxs:2} +# TestSmallTxPool/thread_2 2022/08/23 15:31:42 current_total2in_batch0removed1428emptyBlocks0blockGasLeft576pending0locals1locals+pending356.458µs +# TestSmallTxPool/thread_2 2022/08/23 15:31:42 block0pending2queued0elapsed356.458µs +# TestSmallTxPool/thread_2 2022/08/23 15:31:43 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending4.75µs +# TestSmallTxPool/thread_2 2022/08/23 15:31:43 block1pending0queued1elapsed4.75µs +# TestSmallTxPool/thread_2 2022/08/23 15:31:46 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_2 2022/08/23 15:31:46 Case params: totalAccs = 1; totalTxs = 2; mean 21008, stdev 0, 21008-21008); queued mean 21008, stdev 0, 21008-21008); +# +# +v0.4.8#10709906569287434252 +0x0 +0x0 +0x0 +0x0 +0x6afb37ff8cd0a +0x1 +0x191c00de3da27d +0x197d1f616e641c +0x0 +0x14379cc83b4afa +0x4f +0xa38dd063d6cda +0x8 +0x12e4687da004ee +0x19959e0de31a09 +0x0 +0x189ea53ea8418b +0xe2 +0xd3c2357fe3d98 +0x8 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823153527-26949.fail b/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823153527-26949.fail new file mode 100644 index 0000000000..c7a3c41f38 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823153527-26949.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_2 2022/08/23 15:35:27 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_2 2022/08/23 15:35:27 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400000e678), (*core.testTx)(0x1400000e6a8)}, totalTxs:2} +# TestSmallTxPool/thread_2 2022/08/23 15:35:27 current_total2in_batch0removed1276emptyBlocks0blockGasLeft3792pending0locals1locals+pending40.958µs +# TestSmallTxPool/thread_2 2022/08/23 15:35:27 block0pending2queued0elapsed40.958µs +# TestSmallTxPool/thread_2 2022/08/23 15:35:28 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending6.209µs +# TestSmallTxPool/thread_2 2022/08/23 15:35:28 block1pending0queued1elapsed6.209µs +# TestSmallTxPool/thread_2 2022/08/23 15:35:39 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_2 2022/08/23 15:35:39 Case params: totalAccs = 1; totalTxs = 2; mean 22279, stdev 1738, 21050-23508); queued mean 21050, stdev 0, 21050-21050); +# +# +v0.4.8#13593994666377740292 +0x0 +0xad3abfd0488cb +0x0 +0x18a540bca8ae75 +0x2bad5cfedec60 +0x1 +0xe7e919206fe3e +0x309ffdd2a6f8f +0x0 +0x13f50c0d1475bb +0x1e5 +0x14c1697ffc3006 +0x9cc +0x89445cf7b30c0 +0x14036b5ab852fa +0x0 +0x1f5e58cb65c954 +0xffffffffffffffff +0x117d1908ee73e3 +0x32 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823153947-27019.fail b/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823153947-27019.fail new file mode 100644 index 0000000000..2c10d7e17f --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823153947-27019.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_2 2022/08/23 15:39:47 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_2 2022/08/23 15:39:47 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140000a61c8), (*core.testTx)(0x140000a61f8)}, totalTxs:2} +# TestSmallTxPool/thread_2 2022/08/23 15:39:47 current_total2in_batch0removed1428emptyBlocks0blockGasLeft10572pending0locals1locals+pending80.792µs +# TestSmallTxPool/thread_2 2022/08/23 15:39:47 block0pending2queued0elapsed80.792µs +# TestSmallTxPool/thread_2 2022/08/23 15:39:48 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending917ns +# TestSmallTxPool/thread_2 2022/08/23 15:39:48 block1pending0queued1elapsed917ns +# TestSmallTxPool/thread_2 2022/08/23 15:39:59 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_2 2022/08/23 15:39:59 Case params: totalAccs = 2; totalTxs = 2; mean 21000, stdev 0, 21000-21001); queued mean 21000, stdev 0, 21000-21000); +# +# +v0.4.8#4217277659807219721 +0x0 +0x105ef490e35b8e +0x1 +0xc33ade00e9874 +0xd4ad3b40ffcda +0x1 +0x18b77fe8a754ff +0x18ac9abaf2ca9c +0x0 +0x1fb1183885214a +0xffffffffffffffff +0x270aabd5c356c +0x1 +0x8e021f090beac +0x3e2a92f7702db +0x0 +0x11256749c75edc +0x2a +0x702f0326217b5 +0x0 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823154141-27072.fail b/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823154141-27072.fail new file mode 100644 index 0000000000..31eed60bb9 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823154141-27072.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_2 2022/08/23 15:41:41 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_2 2022/08/23 15:41:41 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400000e378), (*core.testTx)(0x1400000e3a8)}, totalTxs:2} +# TestSmallTxPool/thread_2 2022/08/23 15:41:41 current_total2in_batch0removed1428emptyBlocks0blockGasLeft10572pending0locals1locals+pending318.375µs +# TestSmallTxPool/thread_2 2022/08/23 15:41:41 block0pending2queued0elapsed318.375µs +# TestSmallTxPool/thread_2 2022/08/23 15:41:42 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending3.792µs +# TestSmallTxPool/thread_2 2022/08/23 15:41:42 block1pending0queued1elapsed3.792µs +# TestSmallTxPool/thread_2 2022/08/23 15:41:53 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_2 2022/08/23 15:41:53 Case params: totalAccs = 2; totalTxs = 2; mean 21003, stdev 2, 21001-21005); queued mean 21005, stdev 0, 21005-21005); +# +# +v0.4.8#13828829424990027782 +0x0 +0x17706ac5cb4ae1 +0x1 +0x3d74c6ae803f +0xb9ccc97fa1daf +0x1 +0x30803d5f62b7 +0x10a22f39e8734c +0x0 +0x5471df2de48b9 +0x3 +0x839977049f916 +0x1 +0x1b140c118b3814 +0x16835704d31871 +0x0 +0x117ea4fc6f7ad +0x0 +0x5fe5c78bda99e +0x5 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823154451-27147.fail b/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823154451-27147.fail new file mode 100644 index 0000000000..740d0d38f8 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823154451-27147.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_2 2022/08/23 15:44:51 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_2 2022/08/23 15:44:51 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000090900), (*core.testTx)(0x14000090930)}, totalTxs:2} +# TestSmallTxPool/thread_2 2022/08/23 15:44:51 current_total2in_batch0removed156emptyBlocks0blockGasLeft67812pending0locals1locals+pending36.625µs +# TestSmallTxPool/thread_2 2022/08/23 15:44:51 block0pending2queued0elapsed36.625µs +# TestSmallTxPool/thread_2 2022/08/23 15:44:52 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending21.25µs +# TestSmallTxPool/thread_2 2022/08/23 15:44:52 block1pending0queued1elapsed21.25µs +# TestSmallTxPool/thread_2 2022/08/23 15:45:03 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_2 2022/08/23 15:45:03 Case params: totalAccs = 1; totalTxs = 2; mean 106437, stdev 120824, 21002-191873); queued mean 21002, stdev 0, 21002-21002); +# +# +v0.4.8#7018227147235917829 +0x0 +0x1324b3ba0e1027 +0x0 +0x7fa30b5be2896 +0x83eaa965adc0e +0x1 +0x70b401e48f04c +0x11c2160b240508 +0x0 +0x1b68ee1501abde +0xc +0x1989f24e100818 +0x29b79 +0x1db771fdca8fed +0x10009b30a4d9cd +0x0 +0x20f9f0351d617 +0x0 +0x36c6b82923e8f +0x2 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823191039-29281.fail b/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823191039-29281.fail new file mode 100644 index 0000000000..dc6b37c10c --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220823191039-29281.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_2 2022/08/23 19:10:39 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_2 2022/08/23 19:10:39 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000598480), (*core.testTx)(0x140005984b0)}, totalTxs:2} +# TestSmallTxPool/thread_2 2022/08/23 19:10:39 current_total2in_batch0removed1417emptyBlocks0blockGasLeft7778pending0locals1locals+pending113.5µs +# TestSmallTxPool/thread_2 2022/08/23 19:10:39 block0pending2queued0elapsed113.5µs +# TestSmallTxPool/thread_2 2022/08/23 19:10:39 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending834ns +# TestSmallTxPool/thread_2 2022/08/23 19:10:39 block1pending0queued1elapsed834ns +# TestSmallTxPool/thread_2 2022/08/23 19:10:59 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_2 2022/08/23 19:10:59 Case params: totalAccs = 1; totalTxs = 2; gasValues mean 21083, stdev 116, 21001-21166); queued mean 21001, stdev 0, 21001-21001); +# +# +v0.4.8#14403062635455053833 +0x4b99d67c7c02e +0x1d8b8aeab38be3 +0x0 +0x10d35a6e86e4d +0x1ae10a0baca0a3 +0x1 +0x15af9604b30279 +0x6319258f77350 +0x0 +0x193ba0e133e36a +0x2d +0x13258a7049f31b +0xa6 +0x6dc2ccc2c7702 +0x1b26173c42d219 +0x0 +0x70ce1a926153f +0x3 +0x1752d3156aed9 +0x1 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220824134922-34401.fail b/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220824134922-34401.fail new file mode 100644 index 0000000000..5eb9a1df8c --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_2/TestSmallTxPool_thread_2-20220824134922-34401.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_2 2022/08/24 13:49:22 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_2 2022/08/24 13:49:22 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140000c0708), (*core.testTx)(0x140000c0738)}, totalTxs:2} +# TestSmallTxPool/thread_2 2022/08/24 13:49:22 current_total2in_batch0removed1427emptyBlocks0blockGasLeft17303pending0locals1locals+pending135.75µs +# TestSmallTxPool/thread_2 2022/08/24 13:49:22 block0pending2queued0elapsed135.75µs +# TestSmallTxPool/thread_2 2022/08/24 13:49:22 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending1µs +# TestSmallTxPool/thread_2 2022/08/24 13:49:22 block1pending0queued1elapsed1µs +# TestSmallTxPool/thread_2 2022/08/24 13:49:42 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_2 2022/08/24 13:49:42 Case params: totalAccs = 1; totalTxs = 2; gasValues mean 21032, stdev 29, 21011-21053); queued mean 21053, stdev 0, 21053-21053); +# +# +v0.4.8#977102070542761998 +0x1bab9d1f9957e3 +0x17febbe4547f12 +0x0 +0x11bedabac69ef0 +0xddaed005d9265 +0x1 +0x1bb50a9d9c79de +0x5e9ee9fc283c +0x0 +0x1ceac372cda52a +0x2b7 +0x8078135e846d4 +0xb +0x13989181607345 +0x10a36ffb4220e6 +0x0 +0x11741b0a1f62dd +0x4d +0xd0a0af71645ff +0x35 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823151323-26278.fail b/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823151323-26278.fail new file mode 100644 index 0000000000..80a700b110 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823151323-26278.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_3 2022/08/23 15:13:23 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_3 2022/08/23 15:13:23 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000492000), (*core.testTx)(0x14000492030)}, totalTxs:2} +# TestSmallTxPool/thread_3 2022/08/23 15:13:23 current_total2in_batch0removed1428emptyBlocks0blockGasLeft12000pending0locals1locals+pending83.834µs +# TestSmallTxPool/thread_3 2022/08/23 15:13:23 block0pending2queued0elapsed83.834µs +# TestSmallTxPool/thread_3 2022/08/23 15:13:24 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending1.208µs +# TestSmallTxPool/thread_3 2022/08/23 15:13:24 block1pending0queued1elapsed1.208µs +# TestSmallTxPool/thread_3 2022/08/23 15:13:26 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_3 2022/08/23 15:13:26 Case params: totalAccs = 1; totalTxs = 2; mean 34053, stdev 18460, 21000-47107); queued mean 47107, stdev 0, 47107-47107); +# +# +v0.4.8#11031162323367624714 +0x0 +0x0 +0x0 +0x0 +0x0 +0x1 +0xd7083502a8247 +0x1df963b84357c0 +0x0 +0x1a677f69a4abb8 +0x34 +0x4344f87a449b9 +0x0 +0x9ae961d233025 +0xebb2b26494f2b +0x0 +0x1a670ecbe4adf0 +0x3b1 +0x1809c5bd78df0b +0x65fb \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823151922-26429.fail b/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823151922-26429.fail new file mode 100644 index 0000000000..c84958108a --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823151922-26429.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_3 2022/08/23 15:19:22 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_3 2022/08/23 15:19:22 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140000901b0), (*core.testTx)(0x140000901f8)}, totalTxs:2} +# TestSmallTxPool/thread_3 2022/08/23 15:19:22 current_total2in_batch0removed1389emptyBlocks0blockGasLeft14268pending0locals1locals+pending44.416µs +# TestSmallTxPool/thread_3 2022/08/23 15:19:22 block0pending2queued0elapsed44.416µs +# TestSmallTxPool/thread_3 2022/08/23 15:19:23 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending1.625µs +# TestSmallTxPool/thread_3 2022/08/23 15:19:23 block1pending0queued1elapsed1.625µs +# TestSmallTxPool/thread_3 2022/08/23 15:19:26 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_3 2022/08/23 15:19:26 Case params: totalAccs = 1; totalTxs = 2; mean 4480604, stdev 6306000, 21588-8939620); queued mean 8939620, stdev 0, 8939620-8939620); +# +# +v0.4.8#9788482839862312965 +0x0 +0x0 +0x0 +0x0 +0x117115a0cbf14 +0x1 +0xa1d7d3019b09c +0x1b366a2f95582c +0x0 +0x12dee785d43e7e +0x4a +0x12d5cf86c4347c +0x24c +0x161b7d5757c6e9 +0xc37009db048d1 +0x0 +0xa6e16ef6367c1 +0xc +0x1ee7e52179bcd9 +0x88165c \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823152449-26736.fail b/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823152449-26736.fail new file mode 100644 index 0000000000..185abcd87e --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823152449-26736.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_3 2022/08/23 15:24:49 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_3 2022/08/23 15:24:49 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400009e138), (*core.testTx)(0x1400009e180)}, totalTxs:2} +# TestSmallTxPool/thread_3 2022/08/23 15:24:49 current_total2in_batch0removed2emptyBlocks0blockGasLeft0pending0locals1locals+pending26.5µs +# TestSmallTxPool/thread_3 2022/08/23 15:24:49 block0pending2queued0elapsed26.5µs +# TestSmallTxPool/thread_3 2022/08/23 15:24:50 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending16.208µs +# TestSmallTxPool/thread_3 2022/08/23 15:24:50 block1pending0queued1elapsed16.208µs +# TestSmallTxPool/thread_3 2022/08/23 15:24:53 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_3 2022/08/23 15:24:53 Case params: totalAccs = 1; totalTxs = 2; mean 13261564, stdev 2458519, 11523128-15000000); queued mean 11523128, stdev 0, 11523128-11523128); +# +# +v0.4.8#3219449760721141770 +0x0 +0x0 +0x0 +0x0 +0x1e32d1c47af00f +0x1 +0xe9816f09271ff +0x15e81cc03028e9 +0x0 +0x91dba23abc996 +0x2 +0x1fddea1af24780 +0xffffffffffffffff +0x5e6ff71937c46 +0x96f1d5d4cdb87 +0x0 +0x185e6a0483811f +0x153 +0x1e09749244ea84 +0xaf8230 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823153134-26804.fail b/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823153134-26804.fail new file mode 100644 index 0000000000..9753d5e600 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823153134-26804.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_3 2022/08/23 15:31:34 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_3 2022/08/23 15:31:34 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140006a20f0), (*core.testTx)(0x140006a2120)}, totalTxs:2} +# TestSmallTxPool/thread_3 2022/08/23 15:31:34 current_total2in_batch0removed2emptyBlocks0blockGasLeft0pending0locals1locals+pending12.583µs +# TestSmallTxPool/thread_3 2022/08/23 15:31:34 block0pending2queued0elapsed12.583µs +# TestSmallTxPool/thread_3 2022/08/23 15:31:35 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending34.125µs +# TestSmallTxPool/thread_3 2022/08/23 15:31:35 block1pending0queued1elapsed34.125µs +# TestSmallTxPool/thread_3 2022/08/23 15:31:38 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_3 2022/08/23 15:31:38 Case params: totalAccs = 1; totalTxs = 2; mean 7510920, stdev 10591158, 21840-15000000); queued mean 21840, stdev 0, 21840-21840); +# +# +v0.4.8#10709773425301258245 +0x0 +0x0 +0x0 +0x0 +0x1742106751b018 +0x1 +0x1f4e486736dd58 +0x564aed5658142 +0x0 +0x178f72949d12ed +0xf8 +0x1fb8da494df540 +0xffffffffffffffff +0x15f13425d7e7e8 +0x613607c708b0e +0x0 +0x17725d1c3fd6cc +0x1e +0x14729a6b9144d0 +0x348 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823153541-26949.fail b/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823153541-26949.fail new file mode 100644 index 0000000000..fedb2157cd --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823153541-26949.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_3 2022/08/23 15:35:41 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_3 2022/08/23 15:35:41 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400074c108), (*core.testTx)(0x1400074c138)}, totalTxs:2} +# TestSmallTxPool/thread_3 2022/08/23 15:35:41 current_total2in_batch0removed1419emptyBlocks0blockGasLeft2340pending1locals0locals+pending152.584µs +# TestSmallTxPool/thread_3 2022/08/23 15:35:41 block0pending2queued0elapsed152.584µs +# TestSmallTxPool/thread_3 2022/08/23 15:35:42 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals0locals+pending5.958µs +# TestSmallTxPool/thread_3 2022/08/23 15:35:42 block1pending0queued1elapsed5.958µs +# TestSmallTxPool/thread_3 2022/08/23 15:35:53 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_3 2022/08/23 15:35:53 Case params: totalAccs = 2; totalTxs = 2; mean 21071, stdev 96, 21003-21140); queued mean 21003, stdev 0, 21003-21003); +# +# +v0.4.8#13595291746501132296 +0x0 +0x0 +0x1 +0x15a2a109430425 +0xb6ee685f730b7 +0x1 +0x3d35aed08d247 +0x1f6ba1453abad2 +0xffffffffffffffff +0x1f67692db83f31 +0xffffffffffffffff +0x1373f0cf54ddc1 +0x8c +0xc9bb3d8e0f9ef +0x16d2223345adae +0x1 +0xd6167ee6dba36 +0xd +0x2f313217ae549 +0x3 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823154141-27072.fail b/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823154141-27072.fail new file mode 100644 index 0000000000..bdd14cd5c6 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823154141-27072.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_3 2022/08/23 15:41:41 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_3 2022/08/23 15:41:41 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400071c450), (*core.testTx)(0x1400071c480)}, totalTxs:2} +# TestSmallTxPool/thread_3 2022/08/23 15:41:41 current_total2in_batch0removed1414emptyBlocks0blockGasLeft20372pending0locals1locals+pending284.375µs +# TestSmallTxPool/thread_3 2022/08/23 15:41:41 block0pending2queued0elapsed284.375µs +# TestSmallTxPool/thread_3 2022/08/23 15:41:42 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending5.375µs +# TestSmallTxPool/thread_3 2022/08/23 15:41:42 block1pending0queued1elapsed5.375µs +# TestSmallTxPool/thread_3 2022/08/23 15:41:53 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_3 2022/08/23 15:41:53 Case params: totalAccs = 1; totalTxs = 2; mean 21101, stdev 142, 21000-21202); queued mean 21000, stdev 0, 21000-21000); +# +# +v0.4.8#13828855194793803783 +0x0 +0x572dcc001cc11 +0x0 +0x1f1c642ae2b5c9 +0x182eb5cb48752b +0x1 +0x19cb5b4b0f3808 +0x17da393328d02d +0x0 +0x1fc035715c2605 +0xffffffffffffffff +0x11e36a17660778 +0xca +0x1a40c3d03ba22a +0x61e50300e793c +0x0 +0x1159db5b5a4654 +0x42 +0x28bed52aa7e90 +0x0 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823154630-27147.fail b/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823154630-27147.fail new file mode 100644 index 0000000000..72fb51adf7 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823154630-27147.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_3 2022/08/23 15:46:30 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_3 2022/08/23 15:46:30 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140006ac0f0), (*core.testTx)(0x140006ac120)}, totalTxs:2} +# TestSmallTxPool/thread_3 2022/08/23 15:46:30 current_total2in_batch0removed1420emptyBlocks0blockGasLeft13860pending0locals1locals+pending216.166µs +# TestSmallTxPool/thread_3 2022/08/23 15:46:30 block0pending2queued0elapsed216.166µs +# TestSmallTxPool/thread_3 2022/08/23 15:46:31 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending26.375µs +# TestSmallTxPool/thread_3 2022/08/23 15:46:31 block1pending0queued1elapsed26.375µs +# TestSmallTxPool/thread_3 2022/08/23 15:46:42 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_3 2022/08/23 15:46:42 Case params: totalAccs = 1; totalTxs = 2; mean 21940, stdev 1163, 21117-22763); queued mean 22763, stdev 0, 22763-22763); +# +# +v0.4.8#7018076823380557882 +0x0 +0x14ff0301d2ab30 +0x0 +0x1fb7fffb5261d3 +0x1e3e6d00eccae9 +0x1 +0x16ccca9c2e6dca +0x1ea101d0566723 +0x0 +0x19cc76e791c00a +0x91 +0x10402f1962d216 +0x75 +0x1d8a713414b8a0 +0xdbe457adc6c4e +0x0 +0xdf2bd2a63bad4 +0x2f +0x158a01f4f8c867 +0x6e3 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823191059-29281.fail b/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823191059-29281.fail new file mode 100644 index 0000000000..e564693ebc --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220823191059-29281.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_3 2022/08/23 19:10:59 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_3 2022/08/23 19:10:59 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400043c018), (*core.testTx)(0x1400043c060)}, totalTxs:2} +# TestSmallTxPool/thread_3 2022/08/23 19:10:59 current_total2in_batch0removed1428emptyBlocks0blockGasLeft10572pending1locals0locals+pending279.208µs +# TestSmallTxPool/thread_3 2022/08/23 19:10:59 block0pending2queued0elapsed279.208µs +# TestSmallTxPool/thread_3 2022/08/23 19:10:59 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals0locals+pending3.875µs +# TestSmallTxPool/thread_3 2022/08/23 19:10:59 block1pending0queued1elapsed3.875µs +# TestSmallTxPool/thread_3 2022/08/23 19:11:19 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_3 2022/08/23 19:11:19 Case params: totalAccs = 2; totalTxs = 2; gasValues mean 21001, stdev 0, 21001-21002); queued mean 21002, stdev 0, 21002-21002); +# +# +v0.4.8#14401134195139149828 +0x0 +0x1b31b8a9fec93a +0x1 +0xb5eda6f8ac7e5 +0x1918d68e71cf8a +0x1 +0x9e70543c193b2 +0x14c776c6d0b0e5 +0x1 +0x157126f2506c3d +0x12a +0x177ffbd3259f9 +0x1 +0x1c4318b17c13fa +0x1db9c0c9110179 +0x1 +0x8d11e31fe07c6 +0x7 +0x4caf0180c774e +0x2 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220824134842-34401.fail b/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220824134842-34401.fail new file mode 100644 index 0000000000..6d1c24dd69 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_3/TestSmallTxPool_thread_3-20220824134842-34401.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_3 2022/08/24 13:48:42 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_3 2022/08/24 13:48:42 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400015c0f0), (*core.testTx)(0x1400015c120)}, totalTxs:2} +# TestSmallTxPool/thread_3 2022/08/24 13:48:42 current_total2in_batch0removed1428emptyBlocks0blockGasLeft12000pending0locals1locals+pending117.917µs +# TestSmallTxPool/thread_3 2022/08/24 13:48:42 block0pending2queued0elapsed117.917µs +# TestSmallTxPool/thread_3 2022/08/24 13:48:42 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending1.834µs +# TestSmallTxPool/thread_3 2022/08/24 13:48:42 block1pending0queued1elapsed1.834µs +# TestSmallTxPool/thread_3 2022/08/24 13:49:02 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_3 2022/08/24 13:49:02 Case params: totalAccs = 2; totalTxs = 2; gasValues mean 21002, stdev 3, 21000-21005); queued mean 21005, stdev 0, 21005-21005); +# +# +v0.4.8#976943156752809991 +0x81928db18fdaf +0x1989fd056815b4 +0x1 +0x9dee2c4b9ec +0xeac18dad53be4 +0x1 +0x1d2c8c7b5f21d4 +0xfdd0966b13ba1 +0x0 +0x1003f5b9463200 +0x75 +0x4f9672a84547c +0x0 +0x12cde91532d06c +0xe0d17ec83c149 +0x0 +0x375bc4eadf7d2 +0x1 +0x89c8536710d98 +0x5 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823151321-26278.fail b/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823151321-26278.fail new file mode 100644 index 0000000000..2ee4b70122 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823151321-26278.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_4 2022/08/23 15:13:21 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_4 2022/08/23 15:13:21 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140001be618), (*core.testTx)(0x140001be648)}, totalTxs:2} +# TestSmallTxPool/thread_4 2022/08/23 15:13:21 current_total2in_batch0removed1428emptyBlocks0blockGasLeft10572pending0locals1locals+pending153.167µs +# TestSmallTxPool/thread_4 2022/08/23 15:13:21 block0pending2queued0elapsed153.167µs +# TestSmallTxPool/thread_4 2022/08/23 15:13:22 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending3.834µs +# TestSmallTxPool/thread_4 2022/08/23 15:13:22 block1pending0queued1elapsed3.834µs +# TestSmallTxPool/thread_4 2022/08/23 15:13:24 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_4 2022/08/23 15:13:24 Case params: totalAccs = 1; totalTxs = 2; mean 6229664, stdev 8780375, 21001-12438327); queued mean 12438327, stdev 0, 12438327-12438327); +# +# +v0.4.8#11030634042390216709 +0x0 +0x0 +0x0 +0x0 +0x0 +0x1 +0x1d06b66f316e1c +0x164c18ac1ea1a2 +0x0 +0x14d3bf5a8e3077 +0x317 +0x4feed91528ba6 +0x1 +0xbe39c102d0634 +0x63fdb2c67025d +0x0 +0x8090966120c6a +0x4 +0x1ce906d6a0c542 +0xbd792f \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823151922-26429.fail b/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823151922-26429.fail new file mode 100644 index 0000000000..3799cefdf7 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823151922-26429.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_4 2022/08/23 15:19:22 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_4 2022/08/23 15:19:22 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400035e1b0), (*core.testTx)(0x1400035e258)}, totalTxs:2} +# TestSmallTxPool/thread_4 2022/08/23 15:19:22 current_total2in_batch0removed1426emptyBlocks0blockGasLeft18350pending0locals1locals+pending47.209µs +# TestSmallTxPool/thread_4 2022/08/23 15:19:22 block0pending2queued0elapsed47.209µs +# TestSmallTxPool/thread_4 2022/08/23 15:19:23 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending250ns +# TestSmallTxPool/thread_4 2022/08/23 15:19:23 block1pending0queued1elapsed250ns +# TestSmallTxPool/thread_4 2022/08/23 15:19:26 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_4 2022/08/23 15:19:26 Case params: totalAccs = 1; totalTxs = 2; mean 972250, stdev 1345235, 21025-1923475); queued mean 1923475, stdev 0, 1923475-1923475); +# +# +v0.4.8#9789492157176872966 +0x0 +0x0 +0x0 +0x0 +0xc1cd9e45c9797 +0x1 +0x112d5b2dbe9862 +0x1e895f894d65c5 +0x0 +0x934d794391b50 +0x2 +0xe35c14a2d6517 +0x19 +0x1a7808c64395b9 +0x87f75d274e2f7 +0x0 +0x17720e70971762 +0x1d8 +0x1b46b3005127eb +0x1d078b \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823152444-26736.fail b/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823152444-26736.fail new file mode 100644 index 0000000000..2ff144c07c --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823152444-26736.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_4 2022/08/23 15:24:44 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_4 2022/08/23 15:24:44 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400009f110), (*core.testTx)(0x1400009e018)}, totalTxs:2} +# TestSmallTxPool/thread_4 2022/08/23 15:24:44 current_total2in_batch0removed7emptyBlocks0blockGasLeft2918288pending0locals1locals+pending16.875µs +# TestSmallTxPool/thread_4 2022/08/23 15:24:44 block0pending2queued0elapsed16.875µs +# TestSmallTxPool/thread_4 2022/08/23 15:24:45 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending8.458µs +# TestSmallTxPool/thread_4 2022/08/23 15:24:45 block1pending0queued1elapsed8.458µs +# TestSmallTxPool/thread_4 2022/08/23 15:24:48 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_4 2022/08/23 15:24:48 Case params: totalAccs = 1; totalTxs = 2; mean 1944920, stdev 2720799, 21025-3868816); queued mean 21025, stdev 0, 21025-21025); +# +# +v0.4.8#3219063213664501766 +0x0 +0x0 +0x0 +0x0 +0x1f4a7f7e15970a +0xffffffffffffffff +0x16f1c10f6e04a +0x1fb262ace3006a +0xffffffffffffffff +0x8a27bd4afd7a2 +0x4 +0x1c32e76fe122a5 +0x3ab688 +0xc84b680175c91 +0xb5d64e965f808 +0x0 +0x14a69a979cc2ea +0x13d +0x13124fe8655432 +0x19 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823153154-26804.fail b/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823153154-26804.fail new file mode 100644 index 0000000000..54df560eff --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823153154-26804.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_4 2022/08/23 15:31:54 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_4 2022/08/23 15:31:54 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400000f968), (*core.testTx)(0x1400000f998)}, totalTxs:2} +# TestSmallTxPool/thread_4 2022/08/23 15:31:54 current_total2in_batch0removed1426emptyBlocks0blockGasLeft4090pending0locals1locals+pending134.125µs +# TestSmallTxPool/thread_4 2022/08/23 15:31:54 block0pending2queued0elapsed134.125µs +# TestSmallTxPool/thread_4 2022/08/23 15:31:55 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending17.084µs +# TestSmallTxPool/thread_4 2022/08/23 15:31:55 block1pending0queued1elapsed17.084µs +# TestSmallTxPool/thread_4 2022/08/23 15:31:58 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_4 2022/08/23 15:31:58 Case params: totalAccs = 1; totalTxs = 2; mean 681618, stdev 934205, 21035-1342201); queued mean 1342201, stdev 0, 1342201-1342201); +# +# +v0.4.8#10710159972357898275 +0x0 +0x0 +0x0 +0x0 +0x18382d74c57930 +0x1 +0x891e4327220d8 +0x148f5e50ab597b +0x0 +0x144ebabb1a89bd +0xc3 +0xe76c747ec74c9 +0x23 +0x15972a7b70009e +0x24c0d59454bcb +0x0 +0x1446b4e8a17335 +0x156 +0x1da16475883143 +0x1428f1 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823153540-26949.fail b/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823153540-26949.fail new file mode 100644 index 0000000000..87a59d80f9 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823153540-26949.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_4 2022/08/23 15:35:40 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_4 2022/08/23 15:35:40 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000b1a2e8), (*core.testTx)(0x14000b1a318)}, totalTxs:2} +# TestSmallTxPool/thread_4 2022/08/23 15:35:40 current_total2in_batch0removed1416emptyBlocks0blockGasLeft4872pending1locals0locals+pending59.25µs +# TestSmallTxPool/thread_4 2022/08/23 15:35:40 block0pending2queued0elapsed59.25µs +# TestSmallTxPool/thread_4 2022/08/23 15:35:41 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals0locals+pending18.958µs +# TestSmallTxPool/thread_4 2022/08/23 15:35:41 block1pending0queued1elapsed18.958µs +# TestSmallTxPool/thread_4 2022/08/23 15:35:52 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_4 2022/08/23 15:35:52 Case params: totalAccs = 2; totalTxs = 2; mean 21097, stdev 121, 21011-21183); queued mean 21011, stdev 0, 21011-21011); +# +# +v0.4.8#13592762010763788292 +0x0 +0x0 +0x1 +0xbaf4efb368619 +0xd31d8dc73d96d +0x1 +0x105ce41301703b +0x1307d46b9d5034 +0x1 +0x148f2a0f027467 +0x399 +0x11375ecd1fee7c +0xb7 +0x133b75276968de +0x312eb69ceeec3 +0x1 +0xf5e5a080588c1 +0xd +0x7e63c773dc9a3 +0xb \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823154130-27072.fail b/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823154130-27072.fail new file mode 100644 index 0000000000..dd23a92f60 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823154130-27072.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_4 2022/08/23 15:41:30 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_4 2022/08/23 15:41:30 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140002a2390), (*core.testTx)(0x140002a23d8)}, totalTxs:2} +# TestSmallTxPool/thread_4 2022/08/23 15:41:30 current_total2in_batch0removed2emptyBlocks0blockGasLeft0pending0locals1locals+pending6.209µs +# TestSmallTxPool/thread_4 2022/08/23 15:41:30 block0pending2queued0elapsed6.209µs +# TestSmallTxPool/thread_4 2022/08/23 15:41:31 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending3.625µs +# TestSmallTxPool/thread_4 2022/08/23 15:41:31 block1pending0queued1elapsed3.625µs +# TestSmallTxPool/thread_4 2022/08/23 15:41:42 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_4 2022/08/23 15:41:42 Case params: totalAccs = 1; totalTxs = 2; mean 7510500, stdev 10591751, 21001-15000000); queued mean 21001, stdev 0, 21001-21001); +# +# +v0.4.8#13829009813616459782 +0x0 +0x731778e2aaab9 +0x0 +0x54c3beef22c4c +0x1787c2c84e122f +0x1 +0x5776b67f36708 +0x19fe918f1ff6dc +0x0 +0x34610a9dedce2 +0x1 +0x1fd954956237b8 +0xffffffffffffffff +0x10580638e6eb83 +0x14776e6d9ce1c7 +0x0 +0x2c2d7299b867d +0x0 +0xd218c00b1559 +0x1 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823154525-27147.fail b/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823154525-27147.fail new file mode 100644 index 0000000000..49d82e9a81 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823154525-27147.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_4 2022/08/23 15:45:25 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_4 2022/08/23 15:45:25 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140006acb58), (*core.testTx)(0x140006acb88)}, totalTxs:2} +# TestSmallTxPool/thread_4 2022/08/23 15:45:25 current_total2in_batch0removed1031emptyBlocks0blockGasLeft7179pending1locals0locals+pending126.75µs +# TestSmallTxPool/thread_4 2022/08/23 15:45:25 block0pending2queued0elapsed126.75µs +# TestSmallTxPool/thread_4 2022/08/23 15:45:26 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals0locals+pending7.25µs +# TestSmallTxPool/thread_4 2022/08/23 15:45:26 block1pending0queued1elapsed7.25µs +# TestSmallTxPool/thread_4 2022/08/23 15:45:37 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_4 2022/08/23 15:45:37 Case params: totalAccs = 2; totalTxs = 2; mean 25054, stdev 5709, 21017-29091); queued mean 21017, stdev 0, 21017-21017); +# +# +v0.4.8#7019068960825933841 +0x0 +0x0 +0x1 +0x190c6ed994ccb5 +0x1eccdbb07ddd4a +0x1 +0x798c55bd5faf3 +0xe8c111cda3d2f +0x1 +0x1282dd6ba05fd8 +0xba +0x15b082cb2367c5 +0x1f9b +0x1f97e93f76db9a +0xa07d44aa22ed4 +0x1 +0x166c35ece81ca4 +0x28e +0xb6813b03cbbbd +0x11 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823191119-29281.fail b/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823191119-29281.fail new file mode 100644 index 0000000000..eb93bdba5f --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220823191119-29281.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_4 2022/08/23 19:11:19 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_4 2022/08/23 19:11:19 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400000e738), (*core.testTx)(0x1400000e768)}, totalTxs:2} +# TestSmallTxPool/thread_4 2022/08/23 19:11:19 current_total2in_batch0removed1427emptyBlocks0blockGasLeft20157pending0locals1locals+pending128.166µs +# TestSmallTxPool/thread_4 2022/08/23 19:11:19 block0pending2queued0elapsed128.166µs +# TestSmallTxPool/thread_4 2022/08/23 19:11:19 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending1.291µs +# TestSmallTxPool/thread_4 2022/08/23 19:11:19 block1pending0queued1elapsed1.291µs +# TestSmallTxPool/thread_4 2022/08/23 19:11:39 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_4 2022/08/23 19:11:39 Case params: totalAccs = 2; totalTxs = 2; gasValues mean 21045, stdev 50, 21009-21081); queued mean 21081, stdev 0, 21081-21081); +# +# +v0.4.8#14401263044158029832 +0x7639c95a32e96 +0x2ddda92b7e854 +0x1 +0x2feec666eb61d +0x8a076036bdc92 +0x1 +0xf5711b0f593cb +0x1b5cbdfc67d90b +0x0 +0xc3698ea09a5a2 +0x3 +0x9dd661d7b0acb +0x9 +0x1581a2724b71a3 +0xd3efd4871067c +0x0 +0x15ab047a194ca3 +0x3 +0xe2005991c6763 +0x51 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220824135022-34401.fail b/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220824135022-34401.fail new file mode 100644 index 0000000000..a0c27f44ef --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_4/TestSmallTxPool_thread_4-20220824135022-34401.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_4 2022/08/24 13:50:22 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_4 2022/08/24 13:50:22 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140005ce1f8), (*core.testTx)(0x140005ce228)}, totalTxs:2} +# TestSmallTxPool/thread_4 2022/08/24 13:50:22 current_total2in_batch0removed1391emptyBlocks0blockGasLeft15604pending1locals0locals+pending51.125µs +# TestSmallTxPool/thread_4 2022/08/24 13:50:22 block0pending2queued0elapsed51.125µs +# TestSmallTxPool/thread_4 2022/08/24 13:50:22 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals0locals+pending292ns +# TestSmallTxPool/thread_4 2022/08/24 13:50:22 block1pending0queued1elapsed292ns +# TestSmallTxPool/thread_4 2022/08/24 13:50:42 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_4 2022/08/24 13:50:42 Case params: totalAccs = 2; totalTxs = 2; gasValues mean 1095004, stdev 1518084, 21556-2168452); queued mean 2168452, stdev 0, 2168452-2168452); +# +# +v0.4.8#976977516491178012 +0x0 +0xe2a3099f2557d +0x1 +0x1605092d366d31 +0x1d3de7520be918 +0x1 +0x7082e0ee5e26c +0x13170db138e38 +0x1 +0x19b0468d3b8b7e +0x1a2 +0x127fa336152396 +0x22c +0xe2896f56210f8 +0xa8a8629ad16a7 +0x1 +0x1b3355a6fb3c17 +0x184 +0x1ba084f241acbf +0x20c47c \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823151319-26278.fail b/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823151319-26278.fail new file mode 100644 index 0000000000..b4c6c82753 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823151319-26278.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_5 2022/08/23 15:13:19 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_5 2022/08/23 15:13:19 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400045a270), (*core.testTx)(0x1400045a2a0)}, totalTxs:2} +# TestSmallTxPool/thread_5 2022/08/23 15:13:19 current_total2in_batch0removed1427emptyBlocks0blockGasLeft15876pending0locals1locals+pending92.875µs +# TestSmallTxPool/thread_5 2022/08/23 15:13:19 block0pending2queued0elapsed92.875µs +# TestSmallTxPool/thread_5 2022/08/23 15:13:20 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending5.917µs +# TestSmallTxPool/thread_5 2022/08/23 15:13:20 block1pending0queued1elapsed5.917µs +# TestSmallTxPool/thread_5 2022/08/23 15:13:22 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_5 2022/08/23 15:13:22 Case params: totalAccs = 1; totalTxs = 2; mean 21307, stdev 417, 21012-21602); queued mean 21602, stdev 0, 21602-21602); +# +# +v0.4.8#11030625452455624707 +0x0 +0x0 +0x0 +0x0 +0x0 +0x1 +0x1526ee59916032 +0xa3422c2178a78 +0x0 +0xe67482fc05d7c +0x3d +0xa5f07d2d821d4 +0xc +0x15eea695572682 +0x1217ab82c3ce13 +0x0 +0xfb0171991b22b +0x1 +0x133eb169b9a4bf +0x25a \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823151950-26429.fail b/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823151950-26429.fail new file mode 100644 index 0000000000..a52f168962 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823151950-26429.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_5 2022/08/23 15:19:50 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_5 2022/08/23 15:19:50 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000090618), (*core.testTx)(0x14000090648)}, totalTxs:2} +# TestSmallTxPool/thread_5 2022/08/23 15:19:50 current_total2in_batch0removed1356emptyBlocks0blockGasLeft20196pending0locals1locals+pending127.459µs +# TestSmallTxPool/thread_5 2022/08/23 15:19:50 block0pending2queued0elapsed127.459µs +# TestSmallTxPool/thread_5 2022/08/23 15:19:51 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending3.125µs +# TestSmallTxPool/thread_5 2022/08/23 15:19:51 block1pending0queued1elapsed3.125µs +# TestSmallTxPool/thread_5 2022/08/23 15:19:54 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_5 2022/08/23 15:19:54 Case params: totalAccs = 1; totalTxs = 2; mean 22813, stdev 996, 22109-23518); queued mean 23518, stdev 0, 23518-23518); +# +# +v0.4.8#9786816392551465007 +0x0 +0x0 +0x0 +0x0 +0x1a87caf8e4478c +0x1 +0x1565b282855075 +0xe53d2e1c17601 +0x0 +0x1145734df5c495 +0x53 +0x1535a0dc1ded24 +0x455 +0xcd4139baed77d +0x1cd2cb5a2b5872 +0x0 +0x93e4c7381d1c0 +0x7 +0x1605a82f7cc117 +0x9d6 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823152452-26736.fail b/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823152452-26736.fail new file mode 100644 index 0000000000..618b36011b --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823152452-26736.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_5 2022/08/23 15:24:52 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_5 2022/08/23 15:24:52 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140004fc6c0), (*core.testTx)(0x140004fc6f0)}, totalTxs:2} +# TestSmallTxPool/thread_5 2022/08/23 15:24:52 current_total2in_batch0removed1428emptyBlocks0blockGasLeft10572pending0locals1locals+pending132.75µs +# TestSmallTxPool/thread_5 2022/08/23 15:24:52 block0pending2queued0elapsed132.75µs +# TestSmallTxPool/thread_5 2022/08/23 15:24:53 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending2.375µs +# TestSmallTxPool/thread_5 2022/08/23 15:24:53 block1pending0queued1elapsed2.375µs +# TestSmallTxPool/thread_5 2022/08/23 15:24:56 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_5 2022/08/23 15:24:56 Case params: totalAccs = 1; totalTxs = 2; mean 217563, stdev 277980, 21001-414125); queued mean 414125, stdev 0, 414125-414125); +# +# +v0.4.8#3215678779435253768 +0x0 +0x0 +0x0 +0x0 +0x4ab445c8952dd +0x1 +0x1c9cb48dd732ea +0x18643b8063ce56 +0x0 +0x1dea69519594eb +0x276 +0x1df2a725281cf +0x1 +0x3f54fdc16882e +0x4d45042318b4c +0x0 +0x1d34e66caa4a4f +0x23b +0x1b8878766e6fab +0x5ffa5 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823153135-26804.fail b/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823153135-26804.fail new file mode 100644 index 0000000000..5de0ce0114 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823153135-26804.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_5 2022/08/23 15:31:35 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_5 2022/08/23 15:31:35 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140002a24b0), (*core.testTx)(0x140002a24e0)}, totalTxs:2} +# TestSmallTxPool/thread_5 2022/08/23 15:31:35 current_total2in_batch0removed1428emptyBlocks0blockGasLeft9144pending0locals1locals+pending127.459µs +# TestSmallTxPool/thread_5 2022/08/23 15:31:35 block0pending2queued0elapsed127.459µs +# TestSmallTxPool/thread_5 2022/08/23 15:31:36 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending2.667µs +# TestSmallTxPool/thread_5 2022/08/23 15:31:36 block1pending0queued1elapsed2.667µs +# TestSmallTxPool/thread_5 2022/08/23 15:31:39 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_5 2022/08/23 15:31:39 Case params: totalAccs = 1; totalTxs = 2; mean 22882, stdev 2658, 21002-24762); queued mean 24762, stdev 0, 24762-24762); +# +# +v0.4.8#10709623101445898243 +0x0 +0x0 +0x0 +0x0 +0x18856cda8393b2 +0x1 +0xe68d9e09cae50 +0x15d32a92847dd +0x0 +0x1e77e07c659c4 +0x1 +0x4fd4f9918872f +0x2 +0xcfa1dd7a9cc02 +0x835794f203d69 +0x0 +0xb81012beffea8 +0x6 +0x1506d0f451864b +0xeb2 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823153613-26949.fail b/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823153613-26949.fail new file mode 100644 index 0000000000..4820c3dc0d --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823153613-26949.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_5 2022/08/23 15:36:13 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_5 2022/08/23 15:36:13 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400074c6c0), (*core.testTx)(0x1400074c6f0)}, totalTxs:2} +# TestSmallTxPool/thread_5 2022/08/23 15:36:13 current_total2in_batch0removed257emptyBlocks0blockGasLeft109872pending0locals1locals+pending28.875µs +# TestSmallTxPool/thread_5 2022/08/23 15:36:13 block0pending2queued0elapsed28.875µs +# TestSmallTxPool/thread_5 2022/08/23 15:36:14 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending8µs +# TestSmallTxPool/thread_5 2022/08/23 15:36:14 block1pending0queued1elapsed8µs +# TestSmallTxPool/thread_5 2022/08/23 15:36:25 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_5 2022/08/23 15:36:25 Case params: totalAccs = 1; totalTxs = 2; mean 202327, stdev 121654, 116304-288350); queued mean 288350, stdev 0, 288350-288350); +# +# +v0.4.8#13591903017304588300 +0x0 +0x10c52092b328d3 +0x0 +0x18d112784f0d77 +0x97a6dabb2abda +0x1 +0x140be23286f1b4 +0x128d978701af37 +0x0 +0x110e31b0aba338 +0x32 +0x18cfae3e0296b5 +0x17448 +0x18e1e3424a5df4 +0xf0a5d738fbf63 +0x0 +0x1edeb03accedbd +0x3c4 +0x1a61a26315c2bb +0x41456 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823153947-27019.fail b/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823153947-27019.fail new file mode 100644 index 0000000000..6d94eabd9f --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823153947-27019.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_5 2022/08/23 15:39:47 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_5 2022/08/23 15:39:47 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140001fe4b0), (*core.testTx)(0x140001fe4e0)}, totalTxs:2} +# TestSmallTxPool/thread_5 2022/08/23 15:39:47 current_total2in_batch0removed2emptyBlocks0blockGasLeft313772pending0locals1locals+pending7.917µs +# TestSmallTxPool/thread_5 2022/08/23 15:39:47 block0pending2queued0elapsed7.917µs +# TestSmallTxPool/thread_5 2022/08/23 15:39:48 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending1.333µs +# TestSmallTxPool/thread_5 2022/08/23 15:39:48 block1pending0queued1elapsed1.333µs +# TestSmallTxPool/thread_5 2022/08/23 15:39:59 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_5 2022/08/23 15:39:59 Case params: totalAccs = 1; totalTxs = 2; mean 13084932, stdev 2486444, 11326751-14843114); queued mean 11326751, stdev 0, 11326751-11326751); +# +# +v0.4.8#4213025642184179714 +0x0 +0x886ded9ddc3d3 +0x0 +0xb090687acddbe +0x15ddeaa77b47b2 +0x1 +0xe59f4d16f36ac +0x15c83731da8822 +0x0 +0x96869a15c64e3 +0x7 +0x1e3bd9acd056e0 +0xe22ae2 +0x14f771c7f4aeb4 +0x370b8c6f230a1 +0x0 +0x1a0afb8990daa0 +0x53 +0x1d1291819c4c33 +0xac8317 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823154228-27072.fail b/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823154228-27072.fail new file mode 100644 index 0000000000..f2a0f6f095 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823154228-27072.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_5 2022/08/23 15:42:28 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_5 2022/08/23 15:42:28 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140002a2a98), (*core.testTx)(0x140002a2ac8)}, totalTxs:2} +# TestSmallTxPool/thread_5 2022/08/23 15:42:28 current_total2in_batch0removed14emptyBlocks0blockGasLeft1202812pending0locals1locals+pending31.417µs +# TestSmallTxPool/thread_5 2022/08/23 15:42:28 block0pending2queued0elapsed31.417µs +# TestSmallTxPool/thread_5 2022/08/23 15:42:29 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending8.958µs +# TestSmallTxPool/thread_5 2022/08/23 15:42:29 block1pending0queued1elapsed8.958µs +# TestSmallTxPool/thread_5 2022/08/23 15:42:40 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_5 2022/08/23 15:42:40 Case params: totalAccs = 2; totalTxs = 2; mean 1039912, stdev 1438296, 22883-2056942); queued mean 22883, stdev 0, 22883-22883); +# +# +v0.4.8#13827966136563531806 +0x0 +0x18ebc61699540b +0x1 +0x3515fdfcfb65f +0x25a50539918aa +0x1 +0x730d8876cc5b +0x1b3583a276c8b4 +0x0 +0x10713742c9f5d8 +0x7a +0x1ba16623654525 +0x1f10e6 +0xe7fe69f9d4105 +0x23766b0e6ef50 +0x0 +0xc75308e453b9e +0x11 +0x13d0c7e491064b +0x75b \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823154450-27147.fail b/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823154450-27147.fail new file mode 100644 index 0000000000..475c429185 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823154450-27147.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_5 2022/08/23 15:44:50 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_5 2022/08/23 15:44:50 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140006ac660), (*core.testTx)(0x140006ac690)}, totalTxs:2} +# TestSmallTxPool/thread_5 2022/08/23 15:44:50 current_total2in_batch0removed952emptyBlocks0blockGasLeft22472pending0locals1locals+pending78.333µs +# TestSmallTxPool/thread_5 2022/08/23 15:44:50 block0pending2queued0elapsed78.333µs +# TestSmallTxPool/thread_5 2022/08/23 15:44:51 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending4.041µs +# TestSmallTxPool/thread_5 2022/08/23 15:44:51 block1pending0queued1elapsed4.041µs +# TestSmallTxPool/thread_5 2022/08/23 15:45:02 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_5 2022/08/23 15:45:02 Case params: totalAccs = 1; totalTxs = 2; mean 34693, stdev 4531, 31489-37898); queued mean 37898, stdev 0, 37898-37898); +# +# +v0.4.8#7017393923580493827 +0x0 +0x18a10e05463b9e +0x0 +0x5c2a53194d766 +0x1f60bafd023e1e +0xffffffffffffffff +0x84c50ea0684a9 +0x32563fc6544a5 +0x0 +0xaadb0d9aae81 +0x0 +0x1726c3520a1a4f +0x28f9 +0xcdba9dcba8304 +0x12f0f5a9b5d21 +0x0 +0x1ac8f20a9fedd2 +0x346 +0x1ea7cb7facaa18 +0x4202 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823191059-29281.fail b/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823191059-29281.fail new file mode 100644 index 0000000000..05a1435934 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220823191059-29281.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_5 2022/08/23 19:10:59 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_5 2022/08/23 19:10:59 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000598d98), (*core.testTx)(0x14000598dc8)}, totalTxs:2} +# TestSmallTxPool/thread_5 2022/08/23 19:10:59 current_total2in_batch0removed1428emptyBlocks0blockGasLeft576pending0locals1locals+pending146.75µs +# TestSmallTxPool/thread_5 2022/08/23 19:10:59 block0pending2queued0elapsed146.75µs +# TestSmallTxPool/thread_5 2022/08/23 19:10:59 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending1.208µs +# TestSmallTxPool/thread_5 2022/08/23 19:10:59 block1pending0queued1elapsed1.208µs +# TestSmallTxPool/thread_5 2022/08/23 19:11:19 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_5 2022/08/23 19:11:19 Case params: totalAccs = 1; totalTxs = 2; gasValues mean 21006, stdev 2, 21005-21008); queued mean 21005, stdev 0, 21005-21005); +# +# +v0.4.8#14400150647628365827 +0x41e06e2eff03 +0x101ec1bb9ad73f +0x0 +0x3fa750c7e2b81 +0x7bcc5b95d951f +0x1 +0xa8198da22acc9 +0x13eed06d067c7b +0x0 +0x1688314b1b7b9c +0xa0 +0x80150c493767d +0x8 +0x17494926911bb4 +0x2b32d10763d08 +0x0 +0xb143406fba05c +0x1 +0x84ce9ff98bfd7 +0x5 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220824134842-34401.fail b/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220824134842-34401.fail new file mode 100644 index 0000000000..089769b35e --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_5/TestSmallTxPool_thread_5-20220824134842-34401.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_5 2022/08/24 13:48:42 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_5 2022/08/24 13:48:42 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400071c000), (*core.testTx)(0x1400071c030)}, totalTxs:2} +# TestSmallTxPool/thread_5 2022/08/24 13:48:42 current_total2in_batch0removed1428emptyBlocks0blockGasLeft12000pending1locals0locals+pending250.667µs +# TestSmallTxPool/thread_5 2022/08/24 13:48:42 block0pending2queued0elapsed250.667µs +# TestSmallTxPool/thread_5 2022/08/24 13:48:42 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals0locals+pending2.208µs +# TestSmallTxPool/thread_5 2022/08/24 13:48:42 block1pending0queued1elapsed2.208µs +# TestSmallTxPool/thread_5 2022/08/24 13:49:02 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_5 2022/08/24 13:49:02 Case params: totalAccs = 2; totalTxs = 2; gasValues mean 21009, stdev 12, 21000-21018); queued mean 21018, stdev 0, 21018-21018); +# +# +v0.4.8#974890162385321987 +0x0 +0xc791365e28aaa +0x1 +0x123cc263eba605 +0x161ad2377b422d +0x1 +0x106e8658abc238 +0x1f8377ef593cb5 +0xffffffffffffffff +0xf3caa6ecc1abf +0x26 +0xaafaa2be24a4 +0x0 +0x7397e7f193571 +0x1ddb7391916b1 +0x1 +0x1af767710b8b4d +0x293 +0xa8fd8e62367e5 +0x12 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823151319-26278.fail b/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823151319-26278.fail new file mode 100644 index 0000000000..eb3dcba6a2 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823151319-26278.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_6 2022/08/23 15:13:19 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_6 2022/08/23 15:13:19 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000492c30), (*core.testTx)(0x14000492c60)}, totalTxs:2} +# TestSmallTxPool/thread_6 2022/08/23 15:13:19 current_total2in_batch0removed1423emptyBlocks0blockGasLeft18813pending0locals1locals+pending101.042µs +# TestSmallTxPool/thread_6 2022/08/23 15:13:19 block0pending2queued0elapsed101.042µs +# TestSmallTxPool/thread_6 2022/08/23 15:13:20 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending792ns +# TestSmallTxPool/thread_6 2022/08/23 15:13:20 block1pending0queued1elapsed792ns +# TestSmallTxPool/thread_6 2022/08/23 15:13:22 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_6 2022/08/23 15:13:22 Case params: totalAccs = 1; totalTxs = 2; mean 21036, stdev 46, 21003-21069); queued mean 21003, stdev 0, 21003-21003); +# +# +v0.4.8#11031772208723656712 +0x0 +0x0 +0x0 +0x0 +0x0 +0x1 +0xa665b8ce9ee7a +0x48b0261ddad48 +0x0 +0x18614bfa6b5e23 +0x2b5 +0xdedad9b0c1b4e +0x45 +0x11ed04cc74b99a +0x4ae457ff37e53 +0x0 +0x12298dcc5e05bd +0x4f +0x655e79b9fdc45 +0x3 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823151922-26429.fail b/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823151922-26429.fail new file mode 100644 index 0000000000..a2073e69ff --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823151922-26429.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_6 2022/08/23 15:19:22 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_6 2022/08/23 15:19:22 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140004a2168), (*core.testTx)(0x140004a2198)}, totalTxs:2} +# TestSmallTxPool/thread_6 2022/08/23 15:19:22 current_total2in_batch0removed20emptyBlocks0blockGasLeft800540pending0locals1locals+pending6.375µs +# TestSmallTxPool/thread_6 2022/08/23 15:19:22 block0pending2queued0elapsed6.375µs +# TestSmallTxPool/thread_6 2022/08/23 15:19:23 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending375ns +# TestSmallTxPool/thread_6 2022/08/23 15:19:23 block1pending0queued1elapsed375ns +# TestSmallTxPool/thread_6 2022/08/23 15:19:26 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_6 2022/08/23 15:19:26 Case params: totalAccs = 1; totalTxs = 2; mean 6707774, stdev 7421511, 1459973-11955575); queued mean 11955575, stdev 0, 11955575-11955575); +# +# +v0.4.8#9790467114753064968 +0x0 +0x0 +0x0 +0x0 +0x9d77731750978 +0x1 +0x49d11a9279512 +0x18cf4638816e07 +0x0 +0x952ae186dfdb +0x1 +0x1c5378ff68da43 +0x15f4fd +0x138b2c96ff1201 +0xdc5039ee78a54 +0x0 +0x79984ef15688a +0x0 +0x1c84f041fecb0e +0xb61b6f \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823152445-26736.fail b/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823152445-26736.fail new file mode 100644 index 0000000000..5e699fa210 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823152445-26736.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_6 2022/08/23 15:24:45 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_6 2022/08/23 15:24:45 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140004a0318), (*core.testTx)(0x140004a0348)}, totalTxs:2} +# TestSmallTxPool/thread_6 2022/08/23 15:24:45 current_total2in_batch0removed858emptyBlocks0blockGasLeft1746pending0locals1locals+pending86.375µs +# TestSmallTxPool/thread_6 2022/08/23 15:24:45 block0pending2queued0elapsed86.375µs +# TestSmallTxPool/thread_6 2022/08/23 15:24:46 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending6.167µs +# TestSmallTxPool/thread_6 2022/08/23 15:24:46 block1pending0queued1elapsed6.167µs +# TestSmallTxPool/thread_6 2022/08/23 15:24:49 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_6 2022/08/23 15:24:49 Case params: totalAccs = 1; totalTxs = 2; mean 27985, stdev 9868, 21007-34963); queued mean 21007, stdev 0, 21007-21007); +# +# +v0.4.8#3221876417243381771 +0x0 +0x0 +0x0 +0x0 +0x72ba92881feaf +0x1 +0x6d36251a10a8 +0x8b3f8873eb2d1 +0x0 +0xa757e295aa98d +0x3 +0x184fcc52ee8f8b +0x368b +0x1ecc59cfa7d2d5 +0x13fac3a09d77c4 +0x0 +0x19cb020b70dc60 +0x2f6 +0x5a00cefe27ec7 +0x7 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823153135-26804.fail b/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823153135-26804.fail new file mode 100644 index 0000000000..55fce4f7af --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823153135-26804.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_6 2022/08/23 15:31:35 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_6 2022/08/23 15:31:35 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140006a2588), (*core.testTx)(0x140006a25b8)}, totalTxs:2} +# TestSmallTxPool/thread_6 2022/08/23 15:31:35 current_total2in_batch0removed1425emptyBlocks0blockGasLeft16575pending0locals1locals+pending132.333µs +# TestSmallTxPool/thread_6 2022/08/23 15:31:35 block0pending2queued0elapsed132.333µs +# TestSmallTxPool/thread_6 2022/08/23 15:31:36 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending5.708µs +# TestSmallTxPool/thread_6 2022/08/23 15:31:36 block1pending0queued1elapsed5.708µs +# TestSmallTxPool/thread_6 2022/08/23 15:31:39 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_6 2022/08/23 15:31:39 Case params: totalAccs = 1; totalTxs = 2; mean 1099186, stdev 1524727, 21041-2177332); queued mean 2177332, stdev 0, 2177332-2177332); +# +# +v0.4.8#10712762722539274251 +0x0 +0x0 +0x0 +0x0 +0xd8dc93b6fee50 +0x1 +0x17158f721802db +0xbe370f54cb685 +0x0 +0x1ba844c50bd50a +0x228 +0xc67af9d2696f0 +0x29 +0x1a9347cfda4e00 +0x5bfc3b6608c09 +0x0 +0xa33bbb9af7c4c +0x8 +0x1c00e6e197dfb1 +0x20e72c \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823153527-26949.fail b/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823153527-26949.fail new file mode 100644 index 0000000000..64d0f1c5c8 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823153527-26949.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_6 2022/08/23 15:35:27 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_6 2022/08/23 15:35:27 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400074c078), (*core.testTx)(0x1400074c0a8)}, totalTxs:2} +# TestSmallTxPool/thread_6 2022/08/23 15:35:27 current_total2in_batch0removed1426emptyBlocks0blockGasLeft9794pending0locals1locals+pending47.042µs +# TestSmallTxPool/thread_6 2022/08/23 15:35:27 block0pending2queued0elapsed47.042µs +# TestSmallTxPool/thread_6 2022/08/23 15:35:28 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending6.042µs +# TestSmallTxPool/thread_6 2022/08/23 15:35:28 block1pending0queued1elapsed6.042µs +# TestSmallTxPool/thread_6 2022/08/23 15:35:39 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_6 2022/08/23 15:35:39 Case params: totalAccs = 1; totalTxs = 2; mean 21028, stdev 4, 21025-21031); queued mean 21025, stdev 0, 21025-21025); +# +# +v0.4.8#13596717675643404298 +0x0 +0x10f9ba5935c0f3 +0x0 +0x1d8080a56291f0 +0xe8aecc686552 +0x1 +0xc9b4a1b1b2453 +0xbd01817778a17 +0x0 +0x165953f5b0522b +0x344 +0xe6cf1e79a2767 +0x1f +0x3c7bacce9e988 +0x346cb90a1cb8f +0x0 +0x458c3f4212555 +0x2 +0xbe02443654594 +0x19 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823153947-27019.fail b/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823153947-27019.fail new file mode 100644 index 0000000000..eee6ff02d3 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823153947-27019.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_6 2022/08/23 15:39:47 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_6 2022/08/23 15:39:47 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400054a210), (*core.testTx)(0x1400054a240)}, totalTxs:2} +# TestSmallTxPool/thread_6 2022/08/23 15:39:47 current_total2in_batch0removed1428emptyBlocks0blockGasLeft7716pending0locals1locals+pending84.292µs +# TestSmallTxPool/thread_6 2022/08/23 15:39:47 block0pending2queued0elapsed84.292µs +# TestSmallTxPool/thread_6 2022/08/23 15:39:48 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending1.084µs +# TestSmallTxPool/thread_6 2022/08/23 15:39:48 block1pending0queued1elapsed1.084µs +# TestSmallTxPool/thread_6 2022/08/23 15:39:59 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_6 2022/08/23 15:39:59 Case params: totalAccs = 1; totalTxs = 2; mean 22125, stdev 1587, 21003-23248); queued mean 23248, stdev 0, 23248-23248); +# +# +v0.4.8#4215430823869939720 +0x0 +0xc7f1bbb044e09 +0x0 +0x921c9b6d9f6a5 +0x131a3ad8ae80bf +0x1 +0x65130329290f0 +0x1714e0e4c1864f +0x0 +0xe621efe42c9a +0x1 +0x65788d7742427 +0x3 +0x805be6221990e +0xc67b9b0191dce +0x0 +0x7fd821163f02b +0x3 +0x152508e1625b50 +0x8c8 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823154119-27072.fail b/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823154119-27072.fail new file mode 100644 index 0000000000..71e14f5e99 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823154119-27072.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_6 2022/08/23 15:41:19 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_6 2022/08/23 15:41:19 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400000eb40), (*core.testTx)(0x1400044a570)}, totalTxs:2} +# TestSmallTxPool/thread_6 2022/08/23 15:41:19 current_total2in_batch0removed1400emptyBlocks0blockGasLeft19000pending0locals1locals+pending251.125µs +# TestSmallTxPool/thread_6 2022/08/23 15:41:19 block0pending2queued0elapsed251.125µs +# TestSmallTxPool/thread_6 2022/08/23 15:41:20 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending4.125µs +# TestSmallTxPool/thread_6 2022/08/23 15:41:20 block1pending0queued1elapsed4.125µs +# TestSmallTxPool/thread_6 2022/08/23 15:41:31 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_6 2022/08/23 15:41:31 Case params: totalAccs = 1; totalTxs = 2; mean 21211, stdev 288, 21007-21415); queued mean 21007, stdev 0, 21007-21007); +# +# +v0.4.8#13830057785636683785 +0x0 +0xc4ac769c6cc6b +0x0 +0x2f4d801a61576 +0x1cf5bd69509277 +0x1 +0x1dadc2bc86ce50 +0x6a06e318fcacf +0x0 +0xa96a69d6ef392 +0x0 +0x1283093cae8e40 +0x19f +0x67dfaa5c45841 +0x53837dda5c9d3 +0x0 +0x1735501b3b4b04 +0x319 +0xa2450867b183c +0x7 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823154439-27147.fail b/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823154439-27147.fail new file mode 100644 index 0000000000..fe5549a3f4 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823154439-27147.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_6 2022/08/23 15:44:39 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_6 2022/08/23 15:44:39 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400077e1c8), (*core.testTx)(0x1400077e1f8)}, totalTxs:2} +# TestSmallTxPool/thread_6 2022/08/23 15:44:39 current_total2in_batch0removed1428emptyBlocks0blockGasLeft6288pending0locals1locals+pending170µs +# TestSmallTxPool/thread_6 2022/08/23 15:44:39 block0pending2queued0elapsed170µs +# TestSmallTxPool/thread_6 2022/08/23 15:44:40 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending2.5µs +# TestSmallTxPool/thread_6 2022/08/23 15:44:40 block1pending0queued1elapsed2.5µs +# TestSmallTxPool/thread_6 2022/08/23 15:44:51 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_6 2022/08/23 15:44:51 Case params: totalAccs = 2; totalTxs = 2; mean 21053, stdev 70, 21004-21103); queued mean 21103, stdev 0, 21103-21103); +# +# +v0.4.8#7023806309753421834 +0x0 +0x9e4f326d9764e +0x1 +0x14a64a84433af9 +0x176e74d4f16433 +0x1 +0x8fb67607f013c +0x16f382278b92ba +0x0 +0x16f47192cf271 +0x0 +0xbe0140ac97400 +0x4 +0x149ad43abcb6e4 +0x1d7a6333eb7fc +0x0 +0x1047f0aa1ca1d4 +0x3d +0x12530c5d1971be +0x67 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823191039-29281.fail b/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823191039-29281.fail new file mode 100644 index 0000000000..5dc2d480b1 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220823191039-29281.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_6 2022/08/23 19:10:39 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_6 2022/08/23 19:10:39 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000694270), (*core.testTx)(0x140006942a0)}, totalTxs:2} +# TestSmallTxPool/thread_6 2022/08/23 19:10:39 current_total2in_batch0removed1428emptyBlocks0blockGasLeft12000pending1locals0locals+pending93.5µs +# TestSmallTxPool/thread_6 2022/08/23 19:10:39 block0pending2queued0elapsed93.5µs +# TestSmallTxPool/thread_6 2022/08/23 19:10:39 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals0locals+pending1.041µs +# TestSmallTxPool/thread_6 2022/08/23 19:10:39 block1pending0queued1elapsed1.041µs +# TestSmallTxPool/thread_6 2022/08/23 19:10:59 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_6 2022/08/23 19:10:59 Case params: totalAccs = 2; totalTxs = 2; gasValues mean 7510500, stdev 10591752, 21000-15000000); queued mean 15000000, stdev 0, 15000000-15000000); +# +# +v0.4.8#14401245864288845828 +0x0 +0x982317390d86c +0x1 +0xa6dd8cab73e91 +0x24bf66dd8d752 +0x1 +0x1f586786eee054 +0x1f9b20da876313 +0xffffffffffffffff +0x65d36221e54d2 +0x2 +0x2216e7114148a +0x0 +0x991387d7f03aa +0x1b5adbd5fcd502 +0x1 +0x3bfb55892bbeb +0x1 +0x1fcfc5c3ffdac8 +0xffffffffffffffff \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220824134822-34401.fail b/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220824134822-34401.fail new file mode 100644 index 0000000000..c4c8b42923 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_6/TestSmallTxPool_thread_6-20220824134822-34401.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_6 2022/08/24 13:48:22 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_6 2022/08/24 13:48:22 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000292f48), (*core.testTx)(0x14000292f78)}, totalTxs:2} +# TestSmallTxPool/thread_6 2022/08/24 13:48:22 current_total2in_batch0removed487emptyBlocks0blockGasLeft4209pending0locals1locals+pending41.791µs +# TestSmallTxPool/thread_6 2022/08/24 13:48:22 block0pending2queued0elapsed41.791µs +# TestSmallTxPool/thread_6 2022/08/24 13:48:22 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending958ns +# TestSmallTxPool/thread_6 2022/08/24 13:48:22 block1pending0queued1elapsed958ns +# TestSmallTxPool/thread_6 2022/08/24 13:48:42 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_6 2022/08/24 13:48:42 Case params: totalAccs = 1; totalTxs = 2; gasValues mean 41297, stdev 28702, 21002-61593); queued mean 21002, stdev 0, 21002-21002); +# +# +v0.4.8#976913091981737989 +0x7467e504bb020 +0x1bbefdc2f4de1a +0x0 +0x1a60eec7505ba5 +0xfaf48441b1019 +0x1 +0x1b2f7c9c3f36d1 +0xda4f43199f629 +0x0 +0x1e65f8fe5220bb +0x8c +0x1846e35a55981d +0x9e91 +0xfd21b3b77ccb7 +0x8558bdb36a7b8 +0x0 +0x4da45d29eb8f7 +0x3 +0xafc9539d67e44 +0x2 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823151326-26278.fail b/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823151326-26278.fail new file mode 100644 index 0000000000..1c12350b50 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823151326-26278.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_7 2022/08/23 15:13:26 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_7 2022/08/23 15:13:26 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000492228), (*core.testTx)(0x14000492258)}, totalTxs:2} +# TestSmallTxPool/thread_7 2022/08/23 15:13:26 current_total2in_batch0removed1377emptyBlocks0blockGasLeft13071pending0locals1locals+pending83.791µs +# TestSmallTxPool/thread_7 2022/08/23 15:13:26 block0pending2queued0elapsed83.791µs +# TestSmallTxPool/thread_7 2022/08/23 15:13:27 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending916ns +# TestSmallTxPool/thread_7 2022/08/23 15:13:27 block1pending0queued1elapsed916ns +# TestSmallTxPool/thread_7 2022/08/23 15:13:29 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_7 2022/08/23 15:13:29 Case params: totalAccs = 1; totalTxs = 2; mean 21407, stdev 523, 21037-21777); queued mean 21037, stdev 0, 21037-21037); +# +# +v0.4.8#11030676992063176715 +0x0 +0x0 +0x0 +0x0 +0x0 +0x1 +0x6d61c4b233fd7 +0x1ee09d12b6d7ea +0x0 +0x1fb2706cea1d06 +0xffffffffffffffff +0x12e4b3d2d9e5a0 +0x309 +0x1da5e4cb2ddff1 +0xd3f84374a1281 +0x0 +0x8975e64dc3af +0x1 +0xfade341836a2f +0x25 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823151922-26429.fail b/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823151922-26429.fail new file mode 100644 index 0000000000..84f5621a76 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823151922-26429.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_7 2022/08/23 15:19:22 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_7 2022/08/23 15:19:22 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400030c1e0), (*core.testTx)(0x1400030c210)}, totalTxs:2} +# TestSmallTxPool/thread_7 2022/08/23 15:19:22 current_total2in_batch0removed1426emptyBlocks0blockGasLeft16924pending0locals1locals+pending47.333µs +# TestSmallTxPool/thread_7 2022/08/23 15:19:22 block0pending2queued0elapsed47.333µs +# TestSmallTxPool/thread_7 2022/08/23 15:19:23 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending2.625µs +# TestSmallTxPool/thread_7 2022/08/23 15:19:23 block1pending0queued1elapsed2.625µs +# TestSmallTxPool/thread_7 2022/08/23 15:19:26 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_7 2022/08/23 15:19:26 Case params: totalAccs = 1; totalTxs = 2; mean 21019, stdev 9, 21012-21026); queued mean 21012, stdev 0, 21012-21012); +# +# +v0.4.8#9789706905541672967 +0x0 +0x0 +0x0 +0x0 +0x1181c27e592eb7 +0x1 +0xf8ed910a75ad0 +0x17733ae9f06aaa +0x0 +0x9950476f619a2 +0x0 +0xb48b178d7bd6d +0x1a +0x48cd4b6405315 +0x120f8211813dab +0x0 +0xe5e3279da958c +0x13 +0x9b58fc394ec66 +0xc \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823152442-26736.fail b/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823152442-26736.fail new file mode 100644 index 0000000000..4a2c568d10 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823152442-26736.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_7 2022/08/23 15:24:42 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_7 2022/08/23 15:24:42 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400029ef90), (*core.testTx)(0x1400029efc0)}, totalTxs:2} +# TestSmallTxPool/thread_7 2022/08/23 15:24:42 current_total2in_batch0removed14emptyBlocks0blockGasLeft500684pending0locals1locals+pending10.709µs +# TestSmallTxPool/thread_7 2022/08/23 15:24:42 block0pending2queued0elapsed10.709µs +# TestSmallTxPool/thread_7 2022/08/23 15:24:43 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending8.333µs +# TestSmallTxPool/thread_7 2022/08/23 15:24:43 block1pending0queued1elapsed8.333µs +# TestSmallTxPool/thread_7 2022/08/23 15:24:46 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_7 2022/08/23 15:24:46 Case params: totalAccs = 1; totalTxs = 2; mean 1065151, stdev 1473529, 23209-2107094); queued mean 23209, stdev 0, 23209-23209); +# +# +v0.4.8#3217912162429173764 +0x0 +0x0 +0x0 +0x0 +0x165dbd1d2573d8 +0x1 +0x11fe93eea8a3cc +0x3c5ccc5301338 +0x0 +0x1bf15f05e5cbbd +0x266 +0x1c1bb6814596c5 +0x1fd4ce +0xd4d8ef6876b52 +0xcbe18e8bedf70 +0x0 +0xe23a85732e216 +0x2e +0x15e6ee62cb5b65 +0x8a1 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823153132-26804.fail b/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823153132-26804.fail new file mode 100644 index 0000000000..f1578d2f87 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823153132-26804.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_7 2022/08/23 15:31:32 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_7 2022/08/23 15:31:32 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140006224b0), (*core.testTx)(0x140006224e0)}, totalTxs:2} +# TestSmallTxPool/thread_7 2022/08/23 15:31:32 current_total2in_batch0removed695emptyBlocks0blockGasLeft1715pending0locals1locals+pending76.833µs +# TestSmallTxPool/thread_7 2022/08/23 15:31:32 block0pending2queued0elapsed76.833µs +# TestSmallTxPool/thread_7 2022/08/23 15:31:33 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending2.459µs +# TestSmallTxPool/thread_7 2022/08/23 15:31:33 block1pending0queued1elapsed2.459µs +# TestSmallTxPool/thread_7 2022/08/23 15:31:36 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_7 2022/08/23 15:31:36 Case params: totalAccs = 1; totalTxs = 2; mean 221663, stdev 252437, 43163-400163); queued mean 400163, stdev 0, 400163-400163); +# +# +v0.4.8#10710181447194378248 +0x0 +0x0 +0x0 +0xab652d62e2f2f +0x3b78fb921afae +0x1 +0x12ea9776fc2c90 +0xcff26ef4ad02b +0x0 +0x170f7b16443a90 +0x1a2 +0x17d9ce69f1fc0c +0x5693 +0x1c53f3ec424aab +0x172492bab35aa4 +0x0 +0x1287f2c400e3d3 +0x70 +0x1a9ab8ad140142 +0x5c91b \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823153527-26949.fail b/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823153527-26949.fail new file mode 100644 index 0000000000..2f67aa39fc --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823153527-26949.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_7 2022/08/23 15:35:27 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_7 2022/08/23 15:35:27 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140005beb28), (*core.testTx)(0x140005beb58)}, totalTxs:2} +# TestSmallTxPool/thread_7 2022/08/23 15:35:27 current_total2in_batch0removed1428emptyBlocks0blockGasLeft12000pending0locals1locals+pending72.75µs +# TestSmallTxPool/thread_7 2022/08/23 15:35:27 block0pending2queued0elapsed72.75µs +# TestSmallTxPool/thread_7 2022/08/23 15:35:28 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending7.875µs +# TestSmallTxPool/thread_7 2022/08/23 15:35:28 block1pending0queued1elapsed7.875µs +# TestSmallTxPool/thread_7 2022/08/23 15:35:39 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_7 2022/08/23 15:35:39 Case params: totalAccs = 2; totalTxs = 2; mean 21293, stdev 415, 21000-21587); queued mean 21587, stdev 0, 21587-21587); +# +# +v0.4.8#13594647501406732294 +0x0 +0x17013be5bd4638 +0x1 +0x1b916a8918989e +0x19ef6bb9b962cd +0x1 +0x1ecceb3ff99031 +0x1442f177f60f7d +0x0 +0x115af00b572496 +0x66 +0x2b00d4f690d99 +0x0 +0x1e53dd8a0a9a31 +0x9e64e0fcf9b87 +0x0 +0x34d31b139c9aa +0x1 +0x14d2bd76fb8736 +0x24b \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823154120-27072.fail b/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823154120-27072.fail new file mode 100644 index 0000000000..57a1a9eb6f --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823154120-27072.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_7 2022/08/23 15:41:20 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_7 2022/08/23 15:41:20 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400071cee8), (*core.testTx)(0x1400071cf18)}, totalTxs:2} +# TestSmallTxPool/thread_7 2022/08/23 15:41:20 current_total2in_batch0removed82emptyBlocks0blockGasLeft199068pending0locals1locals+pending13.541µs +# TestSmallTxPool/thread_7 2022/08/23 15:41:20 block0pending2queued0elapsed13.541µs +# TestSmallTxPool/thread_7 2022/08/23 15:41:21 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending2.833µs +# TestSmallTxPool/thread_7 2022/08/23 15:41:21 block1pending0queued1elapsed2.833µs +# TestSmallTxPool/thread_7 2022/08/23 15:41:32 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_7 2022/08/23 15:41:32 Case params: totalAccs = 2; totalTxs = 2; mean 208233, stdev 219476, 53040-363426); queued mean 53040, stdev 0, 53040-53040); +# +# +v0.4.8#13829885986944843785 +0x0 +0x3cd5efc5beb20 +0x1 +0x126e846bbeb792 +0x3f568f35d295 +0x1 +0x99f8746072d2e +0xa7b753df7faed +0x0 +0x17db06622bba06 +0x1e2 +0x1a1f455df64966 +0x5399a +0x9198d3efc08e8 +0xaf8ec654dc886 +0x0 +0x19e19a05d6a282 +0x22 +0x18677e4257f2be +0x7d28 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823154439-27147.fail b/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823154439-27147.fail new file mode 100644 index 0000000000..bacdb06026 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823154439-27147.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_7 2022/08/23 15:44:39 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_7 2022/08/23 15:44:39 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000090540), (*core.testTx)(0x14000090588)}, totalTxs:2} +# TestSmallTxPool/thread_7 2022/08/23 15:44:39 current_total2in_batch0removed1428emptyBlocks0blockGasLeft4860pending0locals1locals+pending176.833µs +# TestSmallTxPool/thread_7 2022/08/23 15:44:39 block0pending2queued0elapsed176.833µs +# TestSmallTxPool/thread_7 2022/08/23 15:44:40 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending4.5µs +# TestSmallTxPool/thread_7 2022/08/23 15:44:40 block1pending0queued1elapsed4.5µs +# TestSmallTxPool/thread_7 2022/08/23 15:44:51 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_7 2022/08/23 15:44:51 Case params: totalAccs = 1; totalTxs = 2; mean 21004, stdev 1, 21003-21005); queued mean 21003, stdev 0, 21003-21003); +# +# +v0.4.8#7018871392330317830 +0x0 +0xbf453a2a51f32 +0x0 +0x288e857a421fd +0xae4ef8520bb43 +0x1 +0x1387bd670dbc3e +0x1c267e18a1e634 +0x0 +0x4d0fe7b60e0a8 +0x0 +0xb09bbf71a26cc +0x5 +0x6554ebc424ed2 +0xd95d67e65da27 +0x0 +0x169ed9f04eeff7 +0x283 +0x3842b825fe59e +0x3 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823191039-29281.fail b/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823191039-29281.fail new file mode 100644 index 0000000000..1c973a617b --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220823191039-29281.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_7 2022/08/23 19:10:39 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_7 2022/08/23 19:10:39 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400061cc78), (*core.testTx)(0x1400061cca8)}, totalTxs:2} +# TestSmallTxPool/thread_7 2022/08/23 19:10:39 current_total2in_batch0removed3emptyBlocks0blockGasLeft860145pending0locals1locals+pending9.125µs +# TestSmallTxPool/thread_7 2022/08/23 19:10:39 block0pending2queued0elapsed9.125µs +# TestSmallTxPool/thread_7 2022/08/23 19:10:39 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending708ns +# TestSmallTxPool/thread_7 2022/08/23 19:10:39 block1pending0queued1elapsed708ns +# TestSmallTxPool/thread_7 2022/08/23 19:10:59 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_7 2022/08/23 19:10:59 Case params: totalAccs = 1; totalTxs = 2; gasValues mean 4901984, stdev 6804207, 90683-9713285); queued mean 90683, stdev 0, 90683-90683); +# +# +v0.4.8#14402869361926733832 +0xd38dbba1b30f8 +0x1117ffde8353b7 +0x0 +0x6f3639ba590a3 +0xda1a403685b4c +0x1 +0x103986318c46d2 +0x92e7dacea3ff3 +0x0 +0xc4374bd3ba544 +0x11 +0x1d40c26a26b460 +0x93e47d +0xa544fadc65888 +0xd2f70d1ce6424 +0x0 +0xc56cb071eee0 +0x0 +0x19388ca8e3722a +0x11033 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220824134902-34401.fail b/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220824134902-34401.fail new file mode 100644 index 0000000000..7671261f2a --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_7/TestSmallTxPool_thread_7-20220824134902-34401.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_7 2022/08/24 13:49:02 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_7 2022/08/24 13:49:02 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400032a210), (*core.testTx)(0x1400032a258)}, totalTxs:2} +# TestSmallTxPool/thread_7 2022/08/24 13:49:02 current_total2in_batch0removed1428emptyBlocks0blockGasLeft12000pending0locals1locals+pending51.292µs +# TestSmallTxPool/thread_7 2022/08/24 13:49:02 block0pending2queued0elapsed51.292µs +# TestSmallTxPool/thread_7 2022/08/24 13:49:02 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending375ns +# TestSmallTxPool/thread_7 2022/08/24 13:49:02 block1pending0queued1elapsed375ns +# TestSmallTxPool/thread_7 2022/08/24 13:49:22 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_7 2022/08/24 13:49:22 Case params: totalAccs = 1; totalTxs = 2; gasValues mean 21000, stdev 0, 21000-21000); queued mean 21000, stdev 0, 21000-21000); +# +# +v0.4.8#976852962439593991 +0x802e04596a284 +0x879b25720f5f6 +0x0 +0xbd824f2fddba7 +0x1f302fdcfb828c +0xffffffffffffffff +0x1c17cd60144e38 +0x6bc153badc396 +0x0 +0x1efa9791b90ed9 +0xb2 +0x109e30055c5d0 +0x0 +0x53a2afd336217 +0x153fdd2b772ce6 +0x0 +0xf94a56a5dc25d +0xe +0x339321ec41aea +0x0 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823151321-26278.fail b/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823151321-26278.fail new file mode 100644 index 0000000000..3f1c4710ef --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823151321-26278.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_8 2022/08/23 15:13:21 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_8 2022/08/23 15:13:21 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400080a0d8), (*core.testTx)(0x1400080a108)}, totalTxs:2} +# TestSmallTxPool/thread_8 2022/08/23 15:13:21 current_total2in_batch0removed1428emptyBlocks0blockGasLeft12000pending0locals1locals+pending140.5µs +# TestSmallTxPool/thread_8 2022/08/23 15:13:21 block0pending2queued0elapsed140.5µs +# TestSmallTxPool/thread_8 2022/08/23 15:13:22 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending1.083µs +# TestSmallTxPool/thread_8 2022/08/23 15:13:22 block1pending0queued1elapsed1.083µs +# TestSmallTxPool/thread_8 2022/08/23 15:13:24 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_8 2022/08/23 15:13:24 Case params: totalAccs = 1; totalTxs = 2; mean 22689, stdev 2389, 21000-24379); queued mean 24379, stdev 0, 24379-24379); +# +# +v0.4.8#11032777231070920715 +0x0 +0x0 +0x0 +0x0 +0x0 +0x1 +0x345dcf2914dbf +0x1b7e5ab75db7e +0x0 +0x182f922a08f0ec +0x2ef +0x271589911586b +0x0 +0xf45a99032a4a6 +0x59e979e595906 +0x0 +0x1f6d8c96f2064b +0xffffffffffffffff +0x1812eac6f3e9f2 +0xd33 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823151934-26429.fail b/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823151934-26429.fail new file mode 100644 index 0000000000..4d3f92b7f3 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823151934-26429.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_8 2022/08/23 15:19:34 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_8 2022/08/23 15:19:34 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400035e900), (*core.testTx)(0x1400035e930)}, totalTxs:2} +# TestSmallTxPool/thread_8 2022/08/23 15:19:34 current_total2in_batch0removed24emptyBlocks0blockGasLeft981216pending0locals1locals+pending7.667µs +# TestSmallTxPool/thread_8 2022/08/23 15:19:34 block0pending2queued0elapsed7.667µs +# TestSmallTxPool/thread_8 2022/08/23 15:19:35 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending3.875µs +# TestSmallTxPool/thread_8 2022/08/23 15:19:35 block1pending0queued1elapsed3.875µs +# TestSmallTxPool/thread_8 2022/08/23 15:19:38 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_8 2022/08/23 15:19:38 Case params: totalAccs = 1; totalTxs = 2; mean 615491, stdev 839511, 21867-1209116); queued mean 21867, stdev 0, 21867-21867); +# +# +v0.4.8#9788036163263528973 +0x0 +0x0 +0x0 +0xeb2a11c14ef0 +0xa02661e61f5ff +0x1 +0x11f3e4cb4d9b1 +0x1353756f7688a0 +0x0 +0x295411e8beea +0x0 +0x1b52ea4e101960 +0x122114 +0x3b9b5916b3cd2 +0x26ae504059417 +0x0 +0xde02829e5fbf1 +0x2 +0x155b17f4dfa5bd +0x363 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823152442-26736.fail b/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823152442-26736.fail new file mode 100644 index 0000000000..3c6c2b3bca --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823152442-26736.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_8 2022/08/23 15:24:42 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_8 2022/08/23 15:24:42 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400009ed98), (*core.testTx)(0x1400009edc8)}, totalTxs:2} +# TestSmallTxPool/thread_8 2022/08/23 15:24:42 current_total2in_batch0removed1428emptyBlocks0blockGasLeft9144pending0locals1locals+pending113.834µs +# TestSmallTxPool/thread_8 2022/08/23 15:24:42 block0pending2queued0elapsed113.834µs +# TestSmallTxPool/thread_8 2022/08/23 15:24:43 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending3.375µs +# TestSmallTxPool/thread_8 2022/08/23 15:24:43 block1pending0queued1elapsed3.375µs +# TestSmallTxPool/thread_8 2022/08/23 15:24:46 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_8 2022/08/23 15:24:46 Case params: totalAccs = 1; totalTxs = 2; mean 21001, stdev 1, 21000-21002); queued mean 21000, stdev 0, 21000-21000); +# +# +v0.4.8#3217821968115957763 +0x0 +0x0 +0x0 +0x0 +0x155c7ee09aac69 +0x1 +0xd3e60531884df +0xfbb7315aa8d5f +0x0 +0x6b6061beac13a +0x1 +0x55e99f9f61d9e +0x2 +0x103ec8ecf9c7a4 +0x10485af952d748 +0x0 +0xfdf0899295bf1 +0x4a +0x13d975340e3d2 +0x0 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823153132-26804.fail b/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823153132-26804.fail new file mode 100644 index 0000000000..17f475e4ca --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823153132-26804.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_8 2022/08/23 15:31:32 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_8 2022/08/23 15:31:32 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400000ecd8), (*core.testTx)(0x1400000ed08)}, totalTxs:2} +# TestSmallTxPool/thread_8 2022/08/23 15:31:32 current_total2in_batch0removed1427emptyBlocks0blockGasLeft18730pending0locals1locals+pending194µs +# TestSmallTxPool/thread_8 2022/08/23 15:31:32 block0pending2queued0elapsed194µs +# TestSmallTxPool/thread_8 2022/08/23 15:31:33 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending1.958µs +# TestSmallTxPool/thread_8 2022/08/23 15:31:33 block1pending0queued1elapsed1.958µs +# TestSmallTxPool/thread_8 2022/08/23 15:31:36 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_8 2022/08/23 15:31:36 Case params: totalAccs = 1; totalTxs = 2; mean 21008, stdev 2, 21006-21010); queued mean 21006, stdev 0, 21006-21006); +# +# +v0.4.8#10709653166216970243 +0x0 +0x0 +0x0 +0x171dd573a00568 +0x14a625302ba3ac +0x1 +0x1da0e0f7d450c7 +0x1ee709239566ed +0x0 +0x1d709d2f8d4afd +0x3b9 +0xb009a04573662 +0xa +0xf233264233d7e +0x4f7bdb9559a0 +0x0 +0x3e31356540400 +0x1 +0x637311d3efdd4 +0x6 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823153538-26949.fail b/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823153538-26949.fail new file mode 100644 index 0000000000..3a6d99a93c --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823153538-26949.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_8 2022/08/23 15:35:38 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_8 2022/08/23 15:35:38 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400074ca68), (*core.testTx)(0x1400074ca98)}, totalTxs:2} +# TestSmallTxPool/thread_8 2022/08/23 15:35:38 current_total2in_batch0removed1428emptyBlocks0blockGasLeft12000pending0locals1locals+pending79.292µs +# TestSmallTxPool/thread_8 2022/08/23 15:35:38 block0pending2queued0elapsed79.292µs +# TestSmallTxPool/thread_8 2022/08/23 15:35:39 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending1.875µs +# TestSmallTxPool/thread_8 2022/08/23 15:35:39 block1pending0queued1elapsed1.875µs +# TestSmallTxPool/thread_8 2022/08/23 15:35:50 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_8 2022/08/23 15:35:50 Case params: totalAccs = 1; totalTxs = 2; mean 21004, stdev 6, 21000-21009); queued mean 21009, stdev 0, 21009-21009); +# +# +v0.4.8#13595605279113740298 +0x0 +0xc7cb6bcbb5898 +0x0 +0xa9281d9febfc4 +0x32df124504cdb +0x1 +0x90f75146d837b +0x569c884b93924 +0x0 +0x62aa9ebc22037 +0x0 +0xefd12e56feec +0x0 +0x4109492e3df78 +0x17c95ca5659a2d +0x0 +0x17165ffdbb5b2b +0x1e8 +0x921bc31d61f6e +0x9 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823153949-27019.fail b/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823153949-27019.fail new file mode 100644 index 0000000000..567c43f069 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823153949-27019.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_8 2022/08/23 15:39:49 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_8 2022/08/23 15:39:49 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140000a6870), (*core.testTx)(0x140000a68a0)}, totalTxs:2} +# TestSmallTxPool/thread_8 2022/08/23 15:39:49 current_total2in_batch0removed1416emptyBlocks0blockGasLeft19032pending1locals0locals+pending120.583µs +# TestSmallTxPool/thread_8 2022/08/23 15:39:49 block0pending2queued0elapsed120.583µs +# TestSmallTxPool/thread_8 2022/08/23 15:39:50 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals0locals+pending9.417µs +# TestSmallTxPool/thread_8 2022/08/23 15:39:50 block1pending0queued1elapsed9.417µs +# TestSmallTxPool/thread_8 2022/08/23 15:40:01 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_8 2022/08/23 15:40:01 Case params: totalAccs = 2; totalTxs = 2; mean 369641, stdev 492808, 21173-718109); queued mean 718109, stdev 0, 718109-718109); +# +# +v0.4.8#4214833823415795717 +0x0 +0x0 +0x1 +0x3b2fbcdb31af2 +0x1195295c8f1a5b +0x1 +0x2fe48eaec309 +0x1c5bf98e7b5b39 +0x1 +0x1a88d0727ea6e8 +0x7e +0x1010e8fe68c875 +0xad +0x6cee600f6e704 +0x3a6915119e048 +0x1 +0x160e3984feb1f1 +0x6b +0x1ad0f98bc41d43 +0xaa315 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823154144-27072.fail b/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823154144-27072.fail new file mode 100644 index 0000000000..40d6c7421b --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823154144-27072.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_8 2022/08/23 15:41:44 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_8 2022/08/23 15:41:44 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400000eb88), (*core.testTx)(0x1400000ebb8)}, totalTxs:2} +# TestSmallTxPool/thread_8 2022/08/23 15:41:44 current_total2in_batch0removed270emptyBlocks0blockGasLeft8400pending1locals0locals+pending311.875µs +# TestSmallTxPool/thread_8 2022/08/23 15:41:44 block0pending2queued0elapsed311.875µs +# TestSmallTxPool/thread_8 2022/08/23 15:41:45 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals0locals+pending19.458µs +# TestSmallTxPool/thread_8 2022/08/23 15:41:45 block1pending0queued1elapsed19.458µs +# TestSmallTxPool/thread_8 2022/08/23 15:41:56 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_8 2022/08/23 15:41:56 Case params: totalAccs = 2; totalTxs = 2; mean 69884, stdev 58259, 28689-111080); queued mean 28689, stdev 0, 28689-28689); +# +# +v0.4.8#13830057785636683789 +0x0 +0x0 +0x1 +0x81c22fe5af806 +0x1a4aa24c06b5c7 +0x1 +0x1681e5de302cbe +0x1dc53b29e06e49 +0x1 +0xd39481c3d1b0f +0x8 +0x1a6d31fffbdc70 +0x15fe0 +0x1de8b8d9033596 +0xab66236225865 +0x1 +0x1ea1258485892e +0x4e +0x1613f4e18de883 +0x1e09 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823154452-27147.fail b/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823154452-27147.fail new file mode 100644 index 0000000000..5aff53070b --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823154452-27147.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_8 2022/08/23 15:44:52 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_8 2022/08/23 15:44:52 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000091038), (*core.testTx)(0x14000091068)}, totalTxs:2} +# TestSmallTxPool/thread_8 2022/08/23 15:44:52 current_total2in_batch0removed1422emptyBlocks0blockGasLeft1488pending1locals0locals+pending116.292µs +# TestSmallTxPool/thread_8 2022/08/23 15:44:52 block0pending2queued0elapsed116.292µs +# TestSmallTxPool/thread_8 2022/08/23 15:44:53 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals0locals+pending22.417µs +# TestSmallTxPool/thread_8 2022/08/23 15:44:53 block1pending0queued1elapsed22.417µs +# TestSmallTxPool/thread_8 2022/08/23 15:45:04 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_8 2022/08/23 15:45:04 Case params: totalAccs = 2; totalTxs = 2; mean 4961071, stdev 6986180, 21096-9901047); queued mean 9901047, stdev 0, 9901047-9901047); +# +# +v0.4.8#7019623011607117833 +0x0 +0x0 +0x1 +0x5640ce5bd403b +0x717dad7212753 +0x1 +0xf7ab1f6f9d83d +0x18c8165aeea6a2 +0x1 +0xc4f091bd71a31 +0x2 +0xf4fb81595bdf6 +0x60 +0x86b478024a75c +0x319a0c4562464 +0x1 +0x1f69edbce3e341 +0xffffffffffffffff +0x1efa9c0926979b +0x96c1ef \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823191039-29281.fail b/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823191039-29281.fail new file mode 100644 index 0000000000..d6b441534e --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220823191039-29281.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_8 2022/08/23 19:10:39 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_8 2022/08/23 19:10:39 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400043c168), (*core.testTx)(0x1400043c198)}, totalTxs:2} +# TestSmallTxPool/thread_8 2022/08/23 19:10:39 current_total2in_batch0removed1428emptyBlocks0blockGasLeft9144pending0locals1locals+pending106.917µs +# TestSmallTxPool/thread_8 2022/08/23 19:10:39 block0pending2queued0elapsed106.917µs +# TestSmallTxPool/thread_8 2022/08/23 19:10:39 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending750ns +# TestSmallTxPool/thread_8 2022/08/23 19:10:39 block1pending0queued1elapsed750ns +# TestSmallTxPool/thread_8 2022/08/23 19:10:59 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_8 2022/08/23 19:10:59 Case params: totalAccs = 1; totalTxs = 2; gasValues mean 25890, stdev 6912, 21002-30778); queued mean 30778, stdev 0, 30778-30778); +# +# +v0.4.8#14401756965397069830 +0x1a60522acea424 +0x1ee84a80ecf238 +0x0 +0x10e07d5033e99c +0x1563b7e701c002 +0x1 +0x7705c83677388 +0x1e9fe5248e890f +0x0 +0x159a95d2f3db5d +0x140 +0x5676cea41eaa5 +0x2 +0x2c4937976036e +0x2b01932ecca9a +0x0 +0xdb0d508f1645e +0x14 +0x16bf5edfa9a367 +0x2632 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220824134822-34401.fail b/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220824134822-34401.fail new file mode 100644 index 0000000000..7644a1ac16 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_8/TestSmallTxPool_thread_8-20220824134822-34401.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_8 2022/08/24 13:48:22 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_8 2022/08/24 13:48:22 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400071c6f0), (*core.testTx)(0x1400071c720)}, totalTxs:2} +# TestSmallTxPool/thread_8 2022/08/24 13:48:22 current_total2in_batch0removed1426emptyBlocks0blockGasLeft19776pending0locals1locals+pending117.75µs +# TestSmallTxPool/thread_8 2022/08/24 13:48:22 block0pending2queued0elapsed117.75µs +# TestSmallTxPool/thread_8 2022/08/24 13:48:22 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending792ns +# TestSmallTxPool/thread_8 2022/08/24 13:48:22 block1pending0queued1elapsed792ns +# TestSmallTxPool/thread_8 2022/08/24 13:48:42 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_8 2022/08/24 13:48:42 Case params: totalAccs = 1; totalTxs = 2; gasValues mean 21075, stdev 72, 21024-21127); queued mean 21127, stdev 0, 21127-21127); +# +# +v0.4.8#976560904663465987 +0x1265400b645eed +0x1d5dfc2ec6e6dc +0x0 +0x1921bc567ca956 +0x14f2e61cf301db +0x1 +0xbac1802d9b04e +0x1886d7317bff96 +0x0 +0x8595a57a51773 +0x5 +0xa048ff9a1c125 +0x18 +0x1dc7407254e04f +0xc7a3308e8e14d +0x0 +0x59da6901d35b5 +0x2 +0xf2ef1d157f9a2 +0x7f \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823151323-26278.fail b/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823151323-26278.fail new file mode 100644 index 0000000000..dcd7d989d9 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823151323-26278.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_9 2022/08/23 15:13:23 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_9 2022/08/23 15:13:23 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140001beb88), (*core.testTx)(0x140009ce000)}, totalTxs:2} +# TestSmallTxPool/thread_9 2022/08/23 15:13:23 current_total2in_batch0removed1426emptyBlocks0blockGasLeft15498pending0locals1locals+pending84.583µs +# TestSmallTxPool/thread_9 2022/08/23 15:13:23 block0pending2queued0elapsed84.583µs +# TestSmallTxPool/thread_9 2022/08/23 15:13:24 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending6µs +# TestSmallTxPool/thread_9 2022/08/23 15:13:24 block1pending0queued1elapsed6µs +# TestSmallTxPool/thread_9 2022/08/23 15:13:26 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_9 2022/08/23 15:13:26 Case params: totalAccs = 1; totalTxs = 2; mean 21014, stdev 17, 21002-21027); queued mean 21002, stdev 0, 21002-21002); +# +# +v0.4.8#11030350574548680709 +0x0 +0x0 +0x0 +0x0 +0x0 +0x1 +0x683c5cf501d28 +0x1d65028e9506eb +0x0 +0x6288365a58a73 +0x2 +0xb135d910a2175 +0x1b +0x42b6b1a7b8fa8 +0xe505e4078f38b +0x0 +0x194b700daddacb +0x2a8 +0x38db165f85938 +0x2 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823151931-26429.fail b/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823151931-26429.fail new file mode 100644 index 0000000000..b58dd88776 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823151931-26429.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_9 2022/08/23 15:19:31 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_9 2022/08/23 15:19:31 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400035e618), (*core.testTx)(0x1400035e648)}, totalTxs:2} +# TestSmallTxPool/thread_9 2022/08/23 15:19:31 current_total2in_batch0removed1428emptyBlocks0blockGasLeft12000pending0locals1locals+pending145.209µs +# TestSmallTxPool/thread_9 2022/08/23 15:19:31 block0pending2queued0elapsed145.209µs +# TestSmallTxPool/thread_9 2022/08/23 15:19:32 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending1.291µs +# TestSmallTxPool/thread_9 2022/08/23 15:19:32 block1pending0queued1elapsed1.291µs +# TestSmallTxPool/thread_9 2022/08/23 15:19:35 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_9 2022/08/23 15:19:35 Case params: totalAccs = 1; totalTxs = 2; mean 151141, stdev 184047, 21000-281282); queued mean 281282, stdev 0, 281282-281282); +# +# +v0.4.8#9788461365025832967 +0x0 +0x0 +0x0 +0x0 +0x1a29b2e97cda8a +0x1 +0x1e68b506bb4dc5 +0x27c6f0363ab21 +0x0 +0x3f0ef15dd2bc1 +0x0 +0x2f37f975c5086 +0x0 +0x1225dddc423c41 +0x1e61028c020c3b +0x0 +0x1bec890e6c856a +0x38d +0x19ebef0a0ef8da +0x3f8ba \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823152442-26736.fail b/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823152442-26736.fail new file mode 100644 index 0000000000..d1c21cc1d4 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823152442-26736.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_9 2022/08/23 15:24:42 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_9 2022/08/23 15:24:42 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400029ec30), (*core.testTx)(0x1400029ec60)}, totalTxs:2} +# TestSmallTxPool/thread_9 2022/08/23 15:24:42 current_total2in_batch0removed1427emptyBlocks0blockGasLeft179pending0locals1locals+pending113.792µs +# TestSmallTxPool/thread_9 2022/08/23 15:24:42 block0pending2queued0elapsed113.792µs +# TestSmallTxPool/thread_9 2022/08/23 15:24:43 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending13.25µs +# TestSmallTxPool/thread_9 2022/08/23 15:24:43 block1pending0queued1elapsed13.25µs +# TestSmallTxPool/thread_9 2022/08/23 15:24:46 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_9 2022/08/23 15:24:46 Case params: totalAccs = 1; totalTxs = 2; mean 21127, stdev 147, 21023-21232); queued mean 21232, stdev 0, 21232-21232); +# +# +v0.4.8#3217967997004021765 +0x0 +0x0 +0x0 +0x0 +0x15feb004f9652d +0x1 +0x648dea38b11d1 +0xab5232a16d730 +0x0 +0x1c58a16a564491 +0x376 +0xd69ba5e4330ed +0x17 +0xb5da7b09af201 +0x1d19f3bdad59af +0x0 +0x17a145a5517a07 +0x6d +0x12f091db0ae022 +0xe8 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823153133-26804.fail b/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823153133-26804.fail new file mode 100644 index 0000000000..af982d58d3 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823153133-26804.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_9 2022/08/23 15:31:33 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_9 2022/08/23 15:31:33 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000622cc0), (*core.testTx)(0x14000622cf0)}, totalTxs:2} +# TestSmallTxPool/thread_9 2022/08/23 15:31:33 current_total2in_batch0removed1427emptyBlocks0blockGasLeft13022pending0locals1locals+pending142.375µs +# TestSmallTxPool/thread_9 2022/08/23 15:31:33 block0pending2queued0elapsed142.375µs +# TestSmallTxPool/thread_9 2022/08/23 15:31:34 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending144.542µs +# TestSmallTxPool/thread_9 2022/08/23 15:31:34 block1pending0queued1elapsed144.542µs +# TestSmallTxPool/thread_9 2022/08/23 15:31:37 got 2 block timeout in a row(expected less then 1s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_9 2022/08/23 15:31:37 Case params: totalAccs = 1; totalTxs = 2; mean 7510507, stdev 10591742, 21014-15000000); queued mean 15000000, stdev 0, 15000000-15000000); +# +# +v0.4.8#10709721885693706245 +0x0 +0x0 +0x0 +0x0 +0x1b7675c9a60821 +0x1 +0x1226c2ba7050c4 +0x169f12586704e6 +0x0 +0x1b33e57dd946c +0x0 +0x985d7b15fe098 +0xe +0x1f476c94cb87fd +0x1e042b5cbeb8ef +0x0 +0x8d065ac6dff5 +0x1 +0x1fcafd9897890d +0xffffffffffffffff \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823153551-26949.fail b/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823153551-26949.fail new file mode 100644 index 0000000000..39400b782a --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823153551-26949.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_9 2022/08/23 15:35:51 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_9 2022/08/23 15:35:51 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400000e648), (*core.testTx)(0x1400000e678)}, totalTxs:2} +# TestSmallTxPool/thread_9 2022/08/23 15:35:51 current_total2in_batch0removed1427emptyBlocks0blockGasLeft14449pending1locals0locals+pending98.916µs +# TestSmallTxPool/thread_9 2022/08/23 15:35:51 block0pending2queued0elapsed98.916µs +# TestSmallTxPool/thread_9 2022/08/23 15:35:52 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals0locals+pending19.416µs +# TestSmallTxPool/thread_9 2022/08/23 15:35:52 block1pending0queued1elapsed19.416µs +# TestSmallTxPool/thread_9 2022/08/23 15:36:03 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_9 2022/08/23 15:36:03 Case params: totalAccs = 2; totalTxs = 2; mean 21038, stdev 35, 21013-21063); queued mean 21063, stdev 0, 21063-21063); +# +# +v0.4.8#13595588099244556299 +0x0 +0x0 +0x1 +0x244913d528549 +0x156ca17ccae39d +0x1 +0x15f33767d2761a +0x19658f39c1c58a +0x1 +0x1c41e04416dd2b +0x3c9 +0x87af1a23cc04e +0xd +0x6065a80668ff7 +0x2ab9e5397f3a9 +0x1 +0xfb4cd936dd133 +0x36 +0xf933ed958a569 +0x3f \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823154143-27072.fail b/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823154143-27072.fail new file mode 100644 index 0000000000..c746489775 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823154143-27072.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_9 2022/08/23 15:41:43 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_9 2022/08/23 15:41:43 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x140001bf2a8), (*core.testTx)(0x140001bf2d8)}, totalTxs:2} +# TestSmallTxPool/thread_9 2022/08/23 15:41:43 current_total2in_batch0removed1428emptyBlocks0blockGasLeft10572pending0locals1locals+pending258.583µs +# TestSmallTxPool/thread_9 2022/08/23 15:41:43 block0pending2queued0elapsed258.583µs +# TestSmallTxPool/thread_9 2022/08/23 15:41:44 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending6.833µs +# TestSmallTxPool/thread_9 2022/08/23 15:41:44 block1pending0queued1elapsed6.833µs +# TestSmallTxPool/thread_9 2022/08/23 15:41:55 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_9 2022/08/23 15:41:55 Case params: totalAccs = 1; totalTxs = 2; mean 21000, stdev 0, 21000-21001); queued mean 21000, stdev 0, 21000-21000); +# +# +v0.4.8#13829439310346059786 +0x0 +0x222ac2c8446a8 +0x0 +0x12af8cf8488479 +0x14a623563bd011 +0x1 +0x5808a6d2b5e52 +0x11430c70835dfa +0x0 +0x9520a3a94e82 +0x1 +0x4be41569af9dd +0x1 +0xa8204e5ad2979 +0xd8cbd6950a289 +0x0 +0x1f205a61b15f3c +0xffffffffffffffff +0x2ac2034c002e5 +0x0 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823154450-27147.fail b/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823154450-27147.fail new file mode 100644 index 0000000000..9934014cb8 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823154450-27147.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_9 2022/08/23 15:44:50 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_9 2022/08/23 15:44:50 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x14000090528), (*core.testTx)(0x140000905b8)}, totalTxs:2} +# TestSmallTxPool/thread_9 2022/08/23 15:44:50 current_total2in_batch0removed1428emptyBlocks0blockGasLeft2004pending0locals1locals+pending115.625µs +# TestSmallTxPool/thread_9 2022/08/23 15:44:50 block0pending2queued0elapsed115.625µs +# TestSmallTxPool/thread_9 2022/08/23 15:44:51 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending8.542µs +# TestSmallTxPool/thread_9 2022/08/23 15:44:51 block1pending0queued1elapsed8.542µs +# TestSmallTxPool/thread_9 2022/08/23 15:45:02 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_9 2022/08/23 15:45:02 Case params: totalAccs = 1; totalTxs = 2; mean 22431, stdev 2014, 21007-23856); queued mean 23856, stdev 0, 23856-23856); +# +# +v0.4.8#7020451940295245834 +0x0 +0x317fb31b760a7 +0x0 +0x8c55dd75138b2 +0x7f4e36068662b +0x1 +0x161dc3c77b0d4 +0x134bdea007a992 +0x0 +0x1b24d0a8be5c5b +0x2af +0x6295c526f8140 +0x7 +0x16d6df3bf51d29 +0x58fb9fed48232 +0x0 +0xe3f2c66cd7162 +0x38 +0x16d60fa2ab35ec +0xb28 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823191039-29281.fail b/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823191039-29281.fail new file mode 100644 index 0000000000..98889be7f9 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220823191039-29281.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_9 2022/08/23 19:10:39 [rapid] draw totalAccs: 2 +# TestSmallTxPool/thread_9 2022/08/23 19:10:39 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400061c6c0), (*core.testTx)(0x1400061c6f0)}, totalTxs:2} +# TestSmallTxPool/thread_9 2022/08/23 19:10:39 current_total2in_batch0removed1428emptyBlocks0blockGasLeft10572pending0locals1locals+pending119.542µs +# TestSmallTxPool/thread_9 2022/08/23 19:10:39 block0pending2queued0elapsed119.542µs +# TestSmallTxPool/thread_9 2022/08/23 19:10:39 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending792ns +# TestSmallTxPool/thread_9 2022/08/23 19:10:39 block1pending0queued1elapsed792ns +# TestSmallTxPool/thread_9 2022/08/23 19:10:59 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_9 2022/08/23 19:10:59 Case params: totalAccs = 2; totalTxs = 2; gasValues mean 1966329, stdev 2751109, 21001-3911657); queued mean 3911657, stdev 0, 3911657-3911657); +# +# +v0.4.8#14402856477024845831 +0x14fde8c62e6123 +0xbaa4a32094e99 +0x1 +0x9ed094d515ea5 +0x18fe1ff4c6a722 +0x1 +0xa78e62d441889 +0xddaab9f074c64 +0x0 +0x7ea9b7a103a41 +0x6 +0x4766e4fcd126 +0x1 +0x26d2c380a0e37 +0x1c6e33a7f359fb +0x0 +0x1ec9a20c01562f +0x3c7 +0x1e35777188d3f4 +0x3b5de1 \ No newline at end of file diff --git a/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220824134902-34401.fail b/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220824134902-34401.fail new file mode 100644 index 0000000000..300e889e62 --- /dev/null +++ b/core/testdata/rapid/TestSmallTxPool_thread_9/TestSmallTxPool_thread_9-20220824134902-34401.fail @@ -0,0 +1,31 @@ +# TestSmallTxPool/thread_9 2022/08/24 13:49:02 [rapid] draw totalAccs: 1 +# TestSmallTxPool/thread_9 2022/08/24 13:49:02 [rapid] draw batches: &core.transactionBatches{txs:[]*core.testTx{(*core.testTx)(0x1400000f098), (*core.testTx)(0x1400000f0c8)}, totalTxs:2} +# TestSmallTxPool/thread_9 2022/08/24 13:49:02 current_total2in_batch0removed1427emptyBlocks0blockGasLeft13022pending0locals1locals+pending51.875µs +# TestSmallTxPool/thread_9 2022/08/24 13:49:02 block0pending2queued0elapsed51.875µs +# TestSmallTxPool/thread_9 2022/08/24 13:49:02 current_total2in_batch0removed0emptyBlocks1blockGasLeft30000000pending0locals1locals+pending416ns +# TestSmallTxPool/thread_9 2022/08/24 13:49:02 block1pending0queued1elapsed416ns +# TestSmallTxPool/thread_9 2022/08/24 13:49:22 got 2s block timeout (expected less then 10s): total accounts 2. Pending 0, queued 1) +# TestSmallTxPool/thread_9 2022/08/24 13:49:22 Case params: totalAccs = 1; totalTxs = 2; gasValues mean 21007, stdev 9, 21001-21014); queued mean 21001, stdev 0, 21001-21001); +# +# +v0.4.8#977742020669865996 +0x1b5268bdef1acf +0x1986d21a571fe3 +0x0 +0xac5ef98e4c565 +0x17b79b269a9114 +0x1 +0x1132c7d7237c99 +0x177c4d6014ed36 +0x0 +0xe48ac52517 +0x0 +0xac3ba96ab7bcf +0xe +0x8596b171710bc +0x13bb17823da650 +0x0 +0x194d36a022c22f +0x25f +0x2752775646daa +0x1 \ No newline at end of file diff --git a/core/tx_pool.go b/core/tx_pool.go index 91d221ded0..474d3b68e2 100644 --- a/core/tx_pool.go +++ b/core/tx_pool.go @@ -18,6 +18,7 @@ package core import ( "errors" + "fmt" "math" "math/big" "sort" @@ -268,6 +269,8 @@ type TxPool struct { initDoneCh chan struct{} // is closed once the pool is initialized (for tests) changesSinceReorg int // A counter for how many drops we've performed in-between reorg. + + promoteTxCh chan struct{} // should be used only for tests } type txpoolResetRequest struct { @@ -276,7 +279,7 @@ type txpoolResetRequest struct { // NewTxPool creates a new transaction pool to gather, sort and filter inbound // transactions from the network. -func NewTxPool(config TxPoolConfig, chainconfig *params.ChainConfig, chain blockChain) *TxPool { +func NewTxPool(config TxPoolConfig, chainconfig *params.ChainConfig, chain blockChain, options ...func(pool *TxPool)) *TxPool { // Sanitize the input to ensure no vulnerable gas prices are set config = (&config).sanitize() @@ -299,6 +302,7 @@ func NewTxPool(config TxPoolConfig, chainconfig *params.ChainConfig, chain block initDoneCh: make(chan struct{}), gasPrice: new(big.Int).SetUint64(config.PriceLimit), } + pool.locals = newAccountSet(pool.signer) for _, addr := range config.Locals { log.Info("Setting new local account", "address", addr) @@ -307,6 +311,11 @@ func NewTxPool(config TxPoolConfig, chainconfig *params.ChainConfig, chain block pool.priced = newTxPricedList(pool.all) pool.reset(nil, chain.CurrentBlock().Header()) + // apply options + for _, fn := range options { + fn(pool) + } + // Start the reorg loop early so it can handle requests generated during journal loading. pool.wg.Add(1) go pool.scheduleReorgLoop() @@ -809,6 +818,17 @@ func (pool *TxPool) journalTx(from common.Address, tx *types.Transaction) { // // Note, this method assumes the pool lock is held! func (pool *TxPool) promoteTx(addr common.Address, hash common.Hash, tx *types.Transaction) bool { + defer func() { + if pool.promoteTxCh == nil { + return + } + + select { + case pool.promoteTxCh <- struct{}{}: + default: + } + }() + // Try to insert the transaction into the pending queue if pool.pending[addr] == nil { pool.pending[addr] = newTxList(true) @@ -1080,9 +1100,15 @@ func (pool *TxPool) scheduleReorgLoop() { dirtyAccounts *accountSet queuedEvents = make(map[common.Address]*txSortedMap) ) + + n := 0 + now := time.Now() for { // Launch next background reorg if needed if curDone == nil && launchNextRun { + fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!", n, time.Since(now)) + n++ + now = time.Now() // Run the background reorg and announcements go pool.runReorg(nextDone, reset, dirtyAccounts, queuedEvents) @@ -1096,6 +1122,8 @@ func (pool *TxPool) scheduleReorgLoop() { select { case req := <-pool.reqResetCh: + fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-reset", n) + // Reset request: update head if request is already pending. if reset == nil { reset = req @@ -1106,6 +1134,7 @@ func (pool *TxPool) scheduleReorgLoop() { pool.reorgDoneCh <- nextDone case req := <-pool.reqPromoteCh: + fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-promote", n, len(req.accounts)) // Promote request: update address set if request is already pending. if dirtyAccounts == nil { dirtyAccounts = req @@ -1116,6 +1145,7 @@ func (pool *TxPool) scheduleReorgLoop() { pool.reorgDoneCh <- nextDone case tx := <-pool.queueTxEventCh: + fmt.Println("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!-queue", n) // Queue up the event, but don't schedule a reorg. It's up to the caller to // request one later if they want the events sent. addr, _ := types.Sender(pool.signer, tx) diff --git a/core/tx_pool_test.go b/core/tx_pool_test.go index a7af275835..4ffbd7f780 100644 --- a/core/tx_pool_test.go +++ b/core/tx_pool_test.go @@ -17,6 +17,7 @@ package core import ( + "context" "crypto/ecdsa" "errors" "fmt" @@ -24,10 +25,17 @@ import ( "math/big" "math/rand" "os" + "runtime" + "strings" + "sync" "sync/atomic" "testing" "time" + "gonum.org/v1/gonum/floats" + "gonum.org/v1/gonum/stat" + "pgregory.net/rapid" + "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/state" @@ -47,6 +55,10 @@ var ( eip1559Config *params.ChainConfig ) +const ( + txPoolGasLimit = 10_000_000 +) + func init() { testTxPoolConfig = DefaultTxPoolConfig testTxPoolConfig.Journal = "" @@ -114,15 +126,17 @@ func dynamicFeeTx(nonce uint64, gaslimit uint64, gasFee *big.Int, tip *big.Int, } func setupTxPool() (*TxPool, *ecdsa.PrivateKey) { - return setupTxPoolWithConfig(params.TestChainConfig) + return setupTxPoolWithConfig(params.TestChainConfig, testTxPoolConfig, txPoolGasLimit) } -func setupTxPoolWithConfig(config *params.ChainConfig) (*TxPool, *ecdsa.PrivateKey) { +func setupTxPoolWithConfig(config *params.ChainConfig, txPoolConfig TxPoolConfig, gasLimit uint64, options ...func(pool *TxPool)) (*TxPool, *ecdsa.PrivateKey) { statedb, _ := state.New(common.Hash{}, state.NewDatabase(rawdb.NewMemoryDatabase()), nil) - blockchain := &testBlockChain{10000000, statedb, new(event.Feed)} + + blockchain := &testBlockChain{gasLimit, statedb, new(event.Feed)} key, _ := crypto.GenerateKey() - pool := NewTxPool(testTxPoolConfig, config, blockchain) + + pool := NewTxPool(txPoolConfig, config, blockchain, options...) // wait for the pool to initialize <-pool.initDoneCh @@ -273,6 +287,16 @@ func testSetNonce(pool *TxPool, addr common.Address, nonce uint64) { pool.mu.Unlock() } +func getBalance(pool *TxPool, addr common.Address) *big.Int { + bal := big.NewInt(0) + + pool.mu.Lock() + bal.Set(pool.currentState.GetBalance(addr)) + pool.mu.Unlock() + + return bal +} + func TestInvalidTransactions(t *testing.T) { t.Parallel() @@ -384,7 +408,7 @@ func TestTransactionNegativeValue(t *testing.T) { func TestTransactionTipAboveFeeCap(t *testing.T) { t.Parallel() - pool, key := setupTxPoolWithConfig(eip1559Config) + pool, key := setupTxPoolWithConfig(eip1559Config, testTxPoolConfig, txPoolGasLimit) defer pool.Stop() tx := dynamicFeeTx(0, 100, big.NewInt(1), big.NewInt(2), key) @@ -397,7 +421,7 @@ func TestTransactionTipAboveFeeCap(t *testing.T) { func TestTransactionVeryHighValues(t *testing.T) { t.Parallel() - pool, key := setupTxPoolWithConfig(eip1559Config) + pool, key := setupTxPoolWithConfig(eip1559Config, testTxPoolConfig, txPoolGasLimit) defer pool.Stop() veryBigNumber := big.NewInt(1) @@ -1449,7 +1473,7 @@ func TestTransactionPoolRepricingDynamicFee(t *testing.T) { t.Parallel() // Create the pool to test the pricing enforcement with - pool, _ := setupTxPoolWithConfig(eip1559Config) + pool, _ := setupTxPoolWithConfig(eip1559Config, testTxPoolConfig, txPoolGasLimit) defer pool.Stop() // Keep track of transaction events to ensure all executables get announced @@ -1820,7 +1844,7 @@ func TestTransactionPoolStableUnderpricing(t *testing.T) { func TestTransactionPoolUnderpricingDynamicFee(t *testing.T) { t.Parallel() - pool, _ := setupTxPoolWithConfig(eip1559Config) + pool, _ := setupTxPoolWithConfig(eip1559Config, testTxPoolConfig, txPoolGasLimit) defer pool.Stop() pool.config.GlobalSlots = 2 @@ -1927,7 +1951,7 @@ func TestTransactionPoolUnderpricingDynamicFee(t *testing.T) { func TestDualHeapEviction(t *testing.T) { t.Parallel() - pool, _ := setupTxPoolWithConfig(eip1559Config) + pool, _ := setupTxPoolWithConfig(eip1559Config, testTxPoolConfig, txPoolGasLimit) defer pool.Stop() pool.config.GlobalSlots = 10 @@ -2130,7 +2154,7 @@ func TestTransactionReplacementDynamicFee(t *testing.T) { t.Parallel() // Create the pool to test the pricing enforcement with - pool, key := setupTxPoolWithConfig(eip1559Config) + pool, key := setupTxPoolWithConfig(eip1559Config, testTxPoolConfig, txPoolGasLimit) defer pool.Stop() testAddBalance(pool, crypto.PubkeyToAddress(key.PublicKey), big.NewInt(1000000000)) @@ -2561,3 +2585,506 @@ func BenchmarkPoolMultiAccountBatchInsert(b *testing.B) { pool.AddRemotesSync([]*types.Transaction{tx}) } } + +type acc struct { + nonce uint64 + key *ecdsa.PrivateKey + account common.Address +} + +type testTx struct { + tx *types.Transaction + idx int + isLocal bool +} + +const localIdx = 0 + +func getTransactionGen(t *rapid.T, keys []*acc, nonces []uint64, localKey *acc, gasPriceMin, gasPriceMax, gasLimitMin, gasLimitMax uint64) *testTx { + idx := rapid.IntRange(0, len(keys)-1).Draw(t, "accIdx").(int) + + var ( + isLocal bool + key *ecdsa.PrivateKey + ) + + if idx == localIdx { + isLocal = true + key = localKey.key + } else { + key = keys[idx].key + } + + nonces[idx]++ + + gasPriceUint := rapid.Uint64Range(gasPriceMin, gasPriceMax).Draw(t, "gasPrice").(uint64) + gasPrice := big.NewInt(0).SetUint64(gasPriceUint) + gasLimit := rapid.Uint64Range(gasLimitMin, gasLimitMax).Draw(t, "gasLimit").(uint64) + + return &testTx{ + tx: pricedTransaction(nonces[idx]-1, gasLimit, gasPrice, key), + idx: idx, + isLocal: isLocal, + } +} + +type transactionBatches struct { + txs []*testTx + totalTxs int +} + +func transactionsGen(keys []*acc, nonces []uint64, localKey *acc, minTxs int, maxTxs int, gasPriceMin, gasPriceMax, gasLimitMin, gasLimitMax uint64, caseParams *strings.Builder) func(t *rapid.T) *transactionBatches { + return func(t *rapid.T) *transactionBatches { + totalTxs := rapid.IntRange(minTxs, maxTxs).Draw(t, "totalTxs").(int) + txs := make([]*testTx, totalTxs) + + gasValues := make([]float64, totalTxs) + + fmt.Fprintf(caseParams, " totalTxs = %d;", totalTxs) + + keys = keys[:len(nonces)] + + for i := 0; i < totalTxs; i++ { + txs[i] = getTransactionGen(t, keys, nonces, localKey, gasPriceMin, gasPriceMax, gasLimitMin, gasLimitMax) + + gasValues[i] = float64(txs[i].tx.Gas()) + } + + mean, stddev := stat.MeanStdDev(gasValues, nil) + fmt.Fprintf(caseParams, " gasValues mean %d, stdev %d, %d-%d);", int64(mean), int64(stddev), int64(floats.Min(gasValues)), int64(floats.Max(gasValues))) + + return &transactionBatches{txs, totalTxs} + } +} + +type txPoolRapidConfig struct { + gasLimit uint64 + avgBlockTxs uint64 + + minTxs int + maxTxs int + + minAccs int + maxAccs int + + // less tweakable, more like constants + gasPriceMin uint64 + gasPriceMax uint64 + + gasLimitMin uint64 + gasLimitMax uint64 + + balance int64 + + blockTime time.Duration + maxEmptyBlocks int + maxStuckBlocks int +} + +func defaultTxPoolRapidConfig() txPoolRapidConfig { + gasLimit := uint64(30_000_000) + avgBlockTxs := gasLimit/params.TxGas + 1 + maxTxs := int(25 * avgBlockTxs) + + return txPoolRapidConfig{ + gasLimit: gasLimit, + + avgBlockTxs: avgBlockTxs, + + minTxs: 1, + maxTxs: maxTxs, + + minAccs: 1, + maxAccs: maxTxs, + + // less tweakable, more like constants + gasPriceMin: 1, + gasPriceMax: 1_000, + + gasLimitMin: params.TxGas, + gasLimitMax: gasLimit / 2, + + balance: 0xffffffffffffff, + + blockTime: 2 * time.Second, + maxEmptyBlocks: 10, + maxStuckBlocks: 10, + } +} + +func TestSmallTxPool(t *testing.T) { + t.Skip("a red test to be fixed") + + cfg := defaultTxPoolRapidConfig() + + cfg.maxEmptyBlocks = 10 + cfg.maxStuckBlocks = 10 + + cfg.minTxs = 1 + cfg.maxTxs = 2 + + cfg.minAccs = 1 + cfg.maxAccs = 2 + + testPoolBatchInsert(t, cfg) +} + +func TestBigTxPool(t *testing.T) { + t.Skip("a red test to be fixed") + + cfg := defaultTxPoolRapidConfig() + + testPoolBatchInsert(t, cfg) +} + +//nolint:gocognit +func testPoolBatchInsert(t *testing.T, cfg txPoolRapidConfig) { + t.Parallel() + + const debug = false + + initialBalance := big.NewInt(cfg.balance) + + keys := make([]*acc, cfg.maxAccs) + + var key *ecdsa.PrivateKey + + // prealloc keys + for idx := 0; idx < cfg.maxAccs; idx++ { + key, _ = crypto.GenerateKey() + + keys[idx] = &acc{ + key: key, + nonce: 0, + account: crypto.PubkeyToAddress(key.PublicKey), + } + } + + var threads = runtime.NumCPU() + + if debug { + // 1 is set only for debug + threads = 1 + } + + testsDone := new(uint64) + + for i := 0; i < threads; i++ { + t.Run(fmt.Sprintf("thread %d", i), func(t *testing.T) { + t.Parallel() + + rapid.Check(t, func(rt *rapid.T) { + caseParams := new(strings.Builder) + + defer func() { + res := atomic.AddUint64(testsDone, 1) + + if res%100 == 0 { + fmt.Println("case-done", res) + } + }() + + // Generate a batch of transactions to enqueue into the pool + testTxPoolConfig := testTxPoolConfig + + // from sentry config + testTxPoolConfig.AccountQueue = 16 + testTxPoolConfig.AccountSlots = 16 + testTxPoolConfig.GlobalQueue = 32768 + testTxPoolConfig.GlobalSlots = 32768 + testTxPoolConfig.Lifetime = time.Hour + 30*time.Minute //"1h30m0s" + testTxPoolConfig.PriceLimit = 1 + + now := time.Now() + pendingAddedCh := make(chan struct{}, 1024) + pool, key := setupTxPoolWithConfig(params.TestChainConfig, testTxPoolConfig, cfg.gasLimit, MakeWithPromoteTxCh(pendingAddedCh)) + defer pool.Stop() + + totalAccs := rapid.IntRange(cfg.minAccs, cfg.maxAccs).Draw(rt, "totalAccs").(int) + + fmt.Fprintf(caseParams, "Case params: totalAccs = %d;", totalAccs) + + defer func() { + pending, queued := pool.Content() + + if len(pending) != 0 { + pendingGas := make([]float64, 0, len(pending)) + + for _, txs := range pending { + for _, tx := range txs { + pendingGas = append(pendingGas, float64(tx.Gas())) + } + } + + mean, stddev := stat.MeanStdDev(pendingGas, nil) + fmt.Fprintf(caseParams, "\tpending mean %d, stdev %d, %d-%d;\n", int64(mean), int64(stddev), int64(floats.Min(pendingGas)), int64(floats.Max(pendingGas))) + } + + if len(queued) != 0 { + queuedGas := make([]float64, 0, len(queued)) + + for _, txs := range queued { + for _, tx := range txs { + queuedGas = append(queuedGas, float64(tx.Gas())) + } + } + + mean, stddev := stat.MeanStdDev(queuedGas, nil) + fmt.Fprintf(caseParams, "\tqueued mean %d, stdev %d, %d-%d);\n\n", int64(mean), int64(stddev), int64(floats.Min(queuedGas)), int64(floats.Max(queuedGas))) + } + + rt.Log(caseParams) + }() + + // regenerate only local key + localKey := &acc{ + key: key, + account: crypto.PubkeyToAddress(key.PublicKey), + } + + if err := validateTxPoolInternals(pool); err != nil { + rt.Fatalf("pool internal state corrupted: %v", err) + } + + var wg sync.WaitGroup + wg.Add(1) + + go func() { + defer wg.Done() + now = time.Now() + + testAddBalance(pool, localKey.account, initialBalance) + + for idx := 0; idx < totalAccs; idx++ { + testAddBalance(pool, keys[idx].account, initialBalance) + } + }() + + nonces := make([]uint64, totalAccs) + gen := rapid.Custom(transactionsGen(keys, nonces, localKey, cfg.minTxs, cfg.maxTxs, cfg.gasPriceMin, cfg.gasPriceMax, cfg.gasLimitMin, cfg.gasLimitMax, caseParams)) + + txs := gen.Draw(rt, "batches").(*transactionBatches) + + wg.Wait() + + var ( + addIntoTxPool func(tx []*types.Transaction) []error + totalInBatch int + ) + + for _, tx := range txs.txs { + addIntoTxPool = pool.AddRemotesSync + + if tx.isLocal { + addIntoTxPool = pool.AddLocals + } + + err := addIntoTxPool([]*types.Transaction{tx.tx}) + if len(err) != 0 && err[0] != nil { + rt.Log("on adding a transaction to the tx pool", err[0], tx.tx.Gas(), tx.tx.GasPrice(), pool.GasPrice(), getBalance(pool, keys[tx.idx].account)) + } + } + + var ( + block int + emptyBlocks int + stuckBlocks int + lastTxPoolStats int + currentTxPoolStats int + ) + + for { + // we'd expect fulfilling block take comparable, but less than blockTime + ctx, cancel := context.WithTimeout(context.Background(), time.Duration(cfg.maxStuckBlocks)*cfg.blockTime) + + select { + case <-pendingAddedCh: + case <-ctx.Done(): + pendingStat, queuedStat := pool.Stats() + if pendingStat+queuedStat == 0 { + cancel() + + break + } + + rt.Fatalf("got %ds block timeout (expected less then %s): total accounts %d. Pending %d, queued %d)", + block, 5*cfg.blockTime, txs.totalTxs, pendingStat, queuedStat) + } + + pendingStat, queuedStat := pool.Stats() + currentTxPoolStats = pendingStat + queuedStat + if currentTxPoolStats == 0 { + cancel() + break + } + + // check if txPool got stuck + if currentTxPoolStats == lastTxPoolStats { + stuckBlocks++ //todo: переписать + } else { + stuckBlocks = 0 + lastTxPoolStats = currentTxPoolStats + } + + // copy-paste + start := time.Now() + pending := pool.Pending(true) + locals := pool.Locals() + + // from fillTransactions + removedFromPool, blockGasLeft, err := fillTransactions(ctx, pool, locals, pending, cfg.gasLimit) + + done := time.Since(start) + + if removedFromPool > 0 { + emptyBlocks = 0 + } else { + emptyBlocks++ + } + + if emptyBlocks >= cfg.maxEmptyBlocks || stuckBlocks >= cfg.maxStuckBlocks { + // check for nonce gaps + var lastNonce, currentNonce int + + pending = pool.Pending(true) + + for txAcc, pendingTxs := range pending { + lastNonce = int(pool.Nonce(txAcc)) - len(pendingTxs) - 1 + + isFirst := true + + for _, tx := range pendingTxs { + currentNonce = int(tx.Nonce()) + if currentNonce-lastNonce != 1 { + rt.Fatalf("got a nonce gap for account %q. Current pending nonce %d, previous %d %v; emptyBlocks - %v; stuckBlocks - %v", + txAcc, currentNonce, lastNonce, isFirst, emptyBlocks >= cfg.maxEmptyBlocks, stuckBlocks >= cfg.maxStuckBlocks) + } + + lastNonce = currentNonce + } + } + } + + if emptyBlocks >= cfg.maxEmptyBlocks { + rt.Fatalf("got %d empty blocks in a row(expected less then %d): total time %s, total accounts %d. Pending %d, locals %d)", + emptyBlocks, cfg.maxEmptyBlocks, done, txs.totalTxs, len(pending), len(locals)) + } + + if stuckBlocks >= cfg.maxStuckBlocks { + rt.Fatalf("got %d empty blocks in a row(expected less then %d): total time %s, total accounts %d. Pending %d, locals %d)", + emptyBlocks, cfg.maxEmptyBlocks, done, txs.totalTxs, len(pending), len(locals)) + } + + if err != nil { + rt.Fatalf("took too long: total time %s(expected %s), total accounts %d. Pending %d, locals %d)", + done, cfg.blockTime, txs.totalTxs, len(pending), len(locals)) + } + + rt.Log("current_total", txs.totalTxs, "in_batch", totalInBatch, "removed", removedFromPool, "emptyBlocks", emptyBlocks, "blockGasLeft", blockGasLeft, "pending", len(pending), "locals", len(locals), + "locals+pending", done) + + rt.Log("block", block, "pending", pendingStat, "queued", queuedStat, "elapsed", done) + + block++ + + cancel() + + //time.Sleep(time.Second) + } + + rt.Logf("case completed totalTxs %d %v\n\n", txs.totalTxs, time.Since(now)) + }) + }) + } + + t.Log("done test cases", atomic.LoadUint64(testsDone)) +} + +func fillTransactions(ctx context.Context, pool *TxPool, locals []common.Address, pending map[common.Address]types.Transactions, gasLimit uint64) (int, uint64, error) { + localTxs := make(map[common.Address]types.Transactions) + remoteTxs := pending + + for _, txAcc := range locals { + if txs := remoteTxs[txAcc]; len(txs) > 0 { + delete(remoteTxs, txAcc) + + localTxs[txAcc] = txs + } + } + + // fake signer + signer := types.NewLondonSigner(big.NewInt(1)) + + // fake baseFee + baseFee := big.NewInt(1) + + blockGasLimit := gasLimit + + var ( + txLocalCount int + txRemoteCount int + ) + + if len(localTxs) > 0 { + txs := types.NewTransactionsByPriceAndNonce(signer, localTxs, baseFee) + + select { + case <-ctx.Done(): + return txLocalCount + txRemoteCount, blockGasLimit, ctx.Err() + default: + } + + blockGasLimit, txLocalCount = commitTransactions(pool, txs, blockGasLimit) + } + + select { + case <-ctx.Done(): + return txLocalCount + txRemoteCount, blockGasLimit, ctx.Err() + default: + } + + if len(remoteTxs) > 0 { + txs := types.NewTransactionsByPriceAndNonce(signer, remoteTxs, baseFee) + + select { + case <-ctx.Done(): + return txLocalCount + txRemoteCount, blockGasLimit, ctx.Err() + default: + } + + blockGasLimit, txRemoteCount = commitTransactions(pool, txs, blockGasLimit) + } + + return txLocalCount + txRemoteCount, blockGasLimit, nil +} + +func commitTransactions(pool *TxPool, txs *types.TransactionsByPriceAndNonce, blockGasLimit uint64) (uint64, int) { + var ( + tx *types.Transaction + txCount int + ) + + for { + tx = txs.Peek() + + if tx == nil { + return blockGasLimit, txCount + } + + if tx.Gas() <= blockGasLimit { + blockGasLimit -= tx.Gas() + pool.removeTx(tx.Hash(), false) + + txCount++ + } else { + // we don't maximize fulfilment of the block. just fill somehow + return blockGasLimit, txCount + } + } +} + +func MakeWithPromoteTxCh(ch chan struct{}) func(*TxPool) { + return func(pool *TxPool) { + pool.promoteTxCh = ch + } +} diff --git a/docs/cli/README.md b/docs/cli/README.md index d92a7b5a05..bf37d6ef56 100644 --- a/docs/cli/README.md +++ b/docs/cli/README.md @@ -26,6 +26,8 @@ - [```debug pprof```](./debug_pprof.md) +- [```dumpconfig```](./dumpconfig.md) + - [```fingerprint```](./fingerprint.md) - [```peers```](./peers.md) @@ -38,6 +40,8 @@ - [```peers status```](./peers_status.md) +- [```removedb```](./removedb.md) + - [```server```](./server.md) - [```status```](./status.md) diff --git a/docs/cli/dumpconfig.md b/docs/cli/dumpconfig.md new file mode 100644 index 0000000000..0383c47310 --- /dev/null +++ b/docs/cli/dumpconfig.md @@ -0,0 +1,3 @@ +# Dumpconfig + +The ```bor dumpconfig ``` command will export the user provided flags into a configuration file \ No newline at end of file diff --git a/docs/cli/removedb.md b/docs/cli/removedb.md new file mode 100644 index 0000000000..3c6e84f1d6 --- /dev/null +++ b/docs/cli/removedb.md @@ -0,0 +1,7 @@ +# RemoveDB + +The ```bor removedb``` command will remove the blockchain and state databases at the given datadir location + +## Options + +- ```datadir```: Path of the data directory to store information diff --git a/docs/config.md b/docs/config.md index 4f4dec157b..196a0bf388 100644 --- a/docs/config.md +++ b/docs/config.md @@ -1,133 +1,144 @@ # Config -Toml files format used in geth are being deprecated. - -Bor uses uses JSON and [HCL](https://github.com/hashicorp/hcl) formats to create configuration files. This is the format in HCL alongside the default values: - +- The `bor dumpconfig` command prints the default configurations, in the TOML format, on the terminal. + - One can `pipe (>)` this to a file (say `config.toml`) and use it to start bor. + - Command to provide a config file: `bor server -config config.toml` +- Bor uses TOML, HCL, and JSON format config files. +- This is the format of the config file in TOML: + - **NOTE: The values of these following flags are just for reference** + - `config.toml` file: ``` chain = "mainnet" -log-level = "info" -data-dir = "" -sync-mode = "fast" -gc-mode = "full" +identity = "myIdentity" +log-level = "INFO" +datadir = "/var/lib/bor/data" +keystore = "path/to/keystore" +syncmode = "full" +gcmode = "full" snapshot = true ethstats = "" -whitelist = {} -p2p { - max-peers = 30 - max-pend-peers = 50 - bind = "0.0.0.0" - port = 30303 - no-discover = false - nat = "any" - discovery { - v5-enabled = false - bootnodes = [] - bootnodesv4 = [] - bootnodesv5 = [] - staticNodes = [] - trustedNodes = [] - dns = [] - } -} +[p2p] +maxpeers = 30 +maxpendpeers = 50 +bind = "0.0.0.0" +port = 30303 +nodiscover = false +nat = "any" -heimdall { - url = "http://localhost:1317" - without = false -} +[p2p.discovery] +v5disc = false +bootnodes = ["enode://d860a01f9722d78051619d1e2351aba3f43f943f6f00718d1b9baa4101932a1f5011f16bb2b1bb35db20d6fe28fa0bf09636d26a87d31de9ec6203eeedb1f666@18.138.108.67:30303", "enode://22a8232c3abc76a16ae9d6c3b164f98775fe226f0917b0ca871128a74a8e9630b458460865bab457221f1d448dd9791d24c4e5d88786180ac185df813a68d4de@3.209.45.79:30303"] +bootnodesv4 = [] +bootnodesv5 = ["enr:-KG4QOtcP9X1FbIMOe17QNMKqDxCpm14jcX5tiOE4_TyMrFqbmhPZHK_ZPG2Gxb1GE2xdtodOfx9-cgvNtxnRyHEmC0ghGV0aDKQ9aX9QgAAAAD__________4JpZIJ2NIJpcIQDE8KdiXNlY3AyNTZrMaEDhpehBDbZjM_L9ek699Y7vhUJ-eAdMyQW_Fil522Y0fODdGNwgiMog3VkcIIjKA", "enr:-KG4QDyytgmE4f7AnvW-ZaUOIi9i79qX4JwjRAiXBZCU65wOfBu-3Nb5I7b_Rmg3KCOcZM_C3y5pg7EBU5XGrcLTduQEhGV0aDKQ9aX9QgAAAAD__________4JpZIJ2NIJpcIQ2_DUbiXNlY3AyNTZrMaEDKnz_-ps3UUOfHWVYaskI5kWYO_vtYMGYCQRAR3gHDouDdGNwgiMog3VkcIIjKA"] +static-nodes = ["enode://8499da03c47d637b20eee24eec3c356c9a2e6148d6fe25ca195c7949ab8ec2c03e3556126b0d7ed644675e78c4318b08691b7b57de10e5f0d40d05b09238fa0a@52.187.207.27:30303"] +trusted-nodes = ["enode://2b252ab6a1d0f971d9722cb839a42cb81db019ba44c08754628ab4a823487071b5695317c8ccd085219c3a03af063495b2f1da8d18218da2d6a82981b45e6ffc@65.108.70.101:30303"] +dns = [] -txpool { - locals = [] - no-locals = false - journal = "" - rejournal = "1h" - price-limit = 1 - price-bump = 10 - account-slots = 16 - global-slots = 4096 - account-queue = 64 - global-queue = 1024 - lifetime = "3h" -} +[heimdall] +url = "http://localhost:1317" +"bor.without" = false -sealer { - enabled = false - etherbase = "" - gas-ceil = 8000000 - extra-data = "" -} +[txpool] +locals = ["$ADDRESS1", "$ADDRESS2"] +nolocals = false +journal = "" +rejournal = "1h0m0s" +pricelimit = 30000000000 +pricebump = 10 +accountslots = 16 +globalslots = 32768 +accountqueue = 16 +globalqueue = 32768 +lifetime = "3h0m0s" -gpo { - blocks = 20 - percentile = 60 -} +[miner] +mine = false +etherbase = "" +extradata = "" +gaslimit = 20000000 +gasprice = "30000000000" -jsonrpc { - ipc-disable = false - ipc-path = "" - modules = ["web3", "net"] - cors = ["*"] - vhost = ["*"] - - http { - enabled = false - port = 8545 - prefix = "" - host = "localhost" - } +[jsonrpc] +ipcdisable = false +ipcpath = "/var/lib/bor/bor.ipc" +gascap = 50000000 +txfeecap = 5e+00 - ws { - enabled = false - port = 8546 - prefix = "" - host = "localhost" - } +[jsonrpc.http] +enabled = false +port = 8545 +prefix = "" +host = "localhost" +api = ["eth", "net", "web3", "txpool", "bor"] +vhosts = ["*"] +corsdomain = ["*"] - graphqh { - enabled = false - } -} +[jsonrpc.ws] +enabled = false +port = 8546 +prefix = "" +host = "localhost" +api = ["web3", "net"] +vhosts = ["*"] +corsdomain = ["*"] -telemetry { - enabled = false - expensive = false +[jsonrpc.graphql] +enabled = false +port = 0 +prefix = "" +host = "" +api = [] +vhosts = ["*"] +corsdomain = ["*"] - influxdb { - v1-enabled = false - endpoint = "" - database = "" - username = "" - password = "" - v2-enabled = false - token = "" - bucket = "" - organization = "" - } -} +[gpo] +blocks = 20 +percentile = 60 +maxprice = "5000000000000" +ignoreprice = "2" -cache { - cache = 1024 - perc-database = 50 - perc-trie = 15 - perc-gc = 25 - perc-snapshot = 10 - journal = "triecache" - rejournal = "60m" - no-prefetch = false - preimages = false - tx-lookup-limit = 2350000 -} +[telemetry] +metrics = false +expensive = false +prometheus-addr = "" +opencollector-endpoint = "" -accounts { - unlock = [] - password-file = "" - allow-insecure-unlock = false - use-lightweight-kdf = false -} +[telemetry.influx] +influxdb = false +endpoint = "" +database = "" +username = "" +password = "" +influxdbv2 = false +token = "" +bucket = "" +organization = "" -grpc { - addr = ":3131" -} +[cache] +cache = 1024 +gc = 25 +snapshot = 10 +database = 50 +trie = 15 +journal = "triecache" +rejournal = "1h0m0s" +noprefetch = false +preimages = false +txlookuplimit = 2350000 + +[accounts] +unlock = ["$ADDRESS1", "$ADDRESS2"] +password = "path/to/password.txt" +allow-insecure-unlock = false +lightkdf = false +disable-bor-wallet = false + +[grpc] +addr = ":3131" + +[developer] +dev = false +period = 0 ``` diff --git a/eth/api.go b/eth/api.go index f81dfa922b..f571a57507 100644 --- a/eth/api.go +++ b/eth/api.go @@ -343,7 +343,8 @@ func (api *PrivateDebugAPI) GetBadBlocks(ctx context.Context) ([]*BadBlockArgs, } else { blockRlp = fmt.Sprintf("0x%x", rlpBytes) } - if blockJSON, err = ethapi.RPCMarshalBlock(block, true, true, api.eth.APIBackend.ChainConfig()); err != nil { + + if blockJSON, err = ethapi.RPCMarshalBlock(block, true, true, api.eth.APIBackend.ChainConfig(), api.eth.chainDb); err != nil { blockJSON = map[string]interface{}{"error": err.Error()} } results = append(results, &BadBlockArgs{ diff --git a/eth/backend.go b/eth/backend.go index 8f2ae1ea2c..cc65d9837f 100644 --- a/eth/backend.go +++ b/eth/backend.go @@ -382,6 +382,10 @@ func (s *Ethereum) ResetWithGenesisBlock(gb *types.Block) { s.blockchain.ResetWithGenesisBlock(gb) } +func (s *Ethereum) PublicBlockChainAPI() *ethapi.PublicBlockChainAPI { + return s.handler.ethAPI +} + func (s *Ethereum) Etherbase() (eb common.Address, err error) { s.lock.RLock() etherbase := s.etherbase @@ -691,7 +695,9 @@ func (s *Ethereum) handleWhitelistCheckpoint(ctx context.Context, first bool) er return ErrBorConsensusWithoutHeimdall } - blockNums, blockHashes, err := ethHandler.fetchWhitelistCheckpoints(ctx, bor, first) + // Create a new checkpoint verifier + verifier := newCheckpointVerifier(nil) + blockNums, blockHashes, err := ethHandler.fetchWhitelistCheckpoints(ctx, bor, verifier, first) // If the array is empty, we're bound to receive an error. Non-nill error and non-empty array // means that array has partial elements and it failed for some block. We'll add those partial // elements anyway. diff --git a/eth/bor_checkpoint_verifier.go b/eth/bor_checkpoint_verifier.go new file mode 100644 index 0000000000..61e8c382e1 --- /dev/null +++ b/eth/bor_checkpoint_verifier.go @@ -0,0 +1,60 @@ +package eth + +import ( + "context" + "fmt" + + "github.com/ethereum/go-ethereum/common/hexutil" + "github.com/ethereum/go-ethereum/consensus/bor/heimdall/checkpoint" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/rpc" +) + +type checkpointVerifier struct { + verify func(ctx context.Context, handler *ethHandler, checkpoint *checkpoint.Checkpoint) (string, error) +} + +func newCheckpointVerifier(verifyFn func(ctx context.Context, handler *ethHandler, checkpoint *checkpoint.Checkpoint) (string, error)) *checkpointVerifier { + if verifyFn != nil { + return &checkpointVerifier{verifyFn} + } + + verifyFn = func(ctx context.Context, handler *ethHandler, checkpoint *checkpoint.Checkpoint) (string, error) { + var ( + startBlock = checkpoint.StartBlock.Uint64() + endBlock = checkpoint.EndBlock.Uint64() + ) + + // check if we have the checkpoint blocks + head := handler.ethAPI.BlockNumber() + if head < hexutil.Uint64(endBlock) { + log.Debug("Head block behind checkpoint block", "head", head, "checkpoint end block", endBlock) + return "", errMissingCheckpoint + } + + // verify the root hash of checkpoint + roothash, err := handler.ethAPI.GetRootHash(ctx, startBlock, endBlock) + if err != nil { + log.Debug("Failed to get root hash of checkpoint while whitelisting", "err", err) + return "", errRootHash + } + + if roothash != checkpoint.RootHash.String()[2:] { + log.Warn("Checkpoint root hash mismatch while whitelisting", "expected", checkpoint.RootHash.String()[2:], "got", roothash) + return "", errCheckpointRootHashMismatch + } + + // fetch the end checkpoint block hash + block, err := handler.ethAPI.GetBlockByNumber(ctx, rpc.BlockNumber(endBlock), false) + if err != nil { + log.Debug("Failed to get end block hash of checkpoint while whitelisting", "err", err) + return "", errEndBlock + } + + hash := fmt.Sprintf("%v", block["hash"]) + + return hash, nil + } + + return &checkpointVerifier{verifyFn} +} diff --git a/eth/downloader/downloader.go b/eth/downloader/downloader.go index 34b8c95715..f92bc652a6 100644 --- a/eth/downloader/downloader.go +++ b/eth/downloader/downloader.go @@ -207,7 +207,7 @@ type BlockChain interface { } // New creates a new downloader to fetch hashes and blocks from remote peers. -//nolint: staticcheck +// nolint: staticcheck func New(checkpoint uint64, stateDb ethdb.Database, mux *event.TypeMux, chain BlockChain, lightchain LightChain, dropPeer peerDropFn, success func(), whitelistService ethereum.ChainValidator) *Downloader { if lightchain == nil { lightchain = chain @@ -729,9 +729,11 @@ func (d *Downloader) fetchHead(p *peerConnection) (head *types.Header, pivot *ty // calculateRequestSpan calculates what headers to request from a peer when trying to determine the // common ancestor. // It returns parameters to be used for peer.RequestHeadersByNumber: -// from - starting block number -// count - number of headers to request -// skip - number of headers to skip +// +// from - starting block number +// count - number of headers to request +// skip - number of headers to skip +// // and also returns 'max', the last block which is expected to be returned by the remote peers, // given the (from,count,skip) func calculateRequestSpan(remoteHeight, localHeight uint64) (int64, int, int, uint64) { diff --git a/eth/ethconfig/config.go b/eth/ethconfig/config.go index d51e293413..adb36ffadd 100644 --- a/eth/ethconfig/config.go +++ b/eth/ethconfig/config.go @@ -32,6 +32,7 @@ import ( "github.com/ethereum/go-ethereum/consensus/bor/contract" "github.com/ethereum/go-ethereum/consensus/bor/heimdall" //nolint:typecheck "github.com/ethereum/go-ethereum/consensus/bor/heimdall/span" + "github.com/ethereum/go-ethereum/consensus/bor/heimdallgrpc" "github.com/ethereum/go-ethereum/consensus/clique" "github.com/ethereum/go-ethereum/consensus/ethash" "github.com/ethereum/go-ethereum/core" @@ -216,6 +217,9 @@ type Config struct { // No heimdall service WithoutHeimdall bool + // Address to connect to Heimdall gRPC server + HeimdallgRPCAddress string + // Bor logs flag BorLogs bool @@ -246,7 +250,14 @@ func CreateConsensusEngine(stack *node.Node, chainConfig *params.ChainConfig, et if ethConfig.WithoutHeimdall { return bor.New(chainConfig, db, blockchainAPI, spanner, nil, genesisContractsClient) } else { - return bor.New(chainConfig, db, blockchainAPI, spanner, heimdall.NewHeimdallClient(ethConfig.HeimdallURL), genesisContractsClient) + var heimdallClient bor.IHeimdallClient + if ethConfig.HeimdallgRPCAddress != "" { + heimdallClient = heimdallgrpc.NewHeimdallGRPCClient(ethConfig.HeimdallgRPCAddress) + } else { + heimdallClient = heimdall.NewHeimdallClient(ethConfig.HeimdallURL) + } + + return bor.New(chainConfig, db, blockchainAPI, spanner, heimdallClient, genesisContractsClient) } } else { switch config.PowMode { diff --git a/eth/filters/IBackend.go b/eth/filters/IBackend.go new file mode 100644 index 0000000000..df844e82b9 --- /dev/null +++ b/eth/filters/IBackend.go @@ -0,0 +1,257 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/ethereum/go-ethereum/eth/filters (interfaces: Backend) + +// Package filters is a generated GoMock package. +package filters + +import ( + context "context" + reflect "reflect" + + common "github.com/ethereum/go-ethereum/common" + core "github.com/ethereum/go-ethereum/core" + bloombits "github.com/ethereum/go-ethereum/core/bloombits" + types "github.com/ethereum/go-ethereum/core/types" + ethdb "github.com/ethereum/go-ethereum/ethdb" + event "github.com/ethereum/go-ethereum/event" + rpc "github.com/ethereum/go-ethereum/rpc" + gomock "github.com/golang/mock/gomock" +) + +// MockBackend is a mock of Backend interface. +type MockBackend struct { + ctrl *gomock.Controller + recorder *MockBackendMockRecorder +} + +// MockBackendMockRecorder is the mock recorder for MockBackend. +type MockBackendMockRecorder struct { + mock *MockBackend +} + +// NewMockBackend creates a new mock instance. +func NewMockBackend(ctrl *gomock.Controller) *MockBackend { + mock := &MockBackend{ctrl: ctrl} + mock.recorder = &MockBackendMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockBackend) EXPECT() *MockBackendMockRecorder { + return m.recorder +} + +// BloomStatus mocks base method. +func (m *MockBackend) BloomStatus() (uint64, uint64) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "BloomStatus") + ret0, _ := ret[0].(uint64) + ret1, _ := ret[1].(uint64) + return ret0, ret1 +} + +// BloomStatus indicates an expected call of BloomStatus. +func (mr *MockBackendMockRecorder) BloomStatus() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "BloomStatus", reflect.TypeOf((*MockBackend)(nil).BloomStatus)) +} + +// ChainDb mocks base method. +func (m *MockBackend) ChainDb() ethdb.Database { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ChainDb") + ret0, _ := ret[0].(ethdb.Database) + return ret0 +} + +// ChainDb indicates an expected call of ChainDb. +func (mr *MockBackendMockRecorder) ChainDb() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ChainDb", reflect.TypeOf((*MockBackend)(nil).ChainDb)) +} + +// GetBorBlockLogs mocks base method. +func (m *MockBackend) GetBorBlockLogs(arg0 context.Context, arg1 common.Hash) ([]*types.Log, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetBorBlockLogs", arg0, arg1) + ret0, _ := ret[0].([]*types.Log) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetBorBlockLogs indicates an expected call of GetBorBlockLogs. +func (mr *MockBackendMockRecorder) GetBorBlockLogs(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBorBlockLogs", reflect.TypeOf((*MockBackend)(nil).GetBorBlockLogs), arg0, arg1) +} + +// GetBorBlockReceipt mocks base method. +func (m *MockBackend) GetBorBlockReceipt(arg0 context.Context, arg1 common.Hash) (*types.Receipt, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetBorBlockReceipt", arg0, arg1) + ret0, _ := ret[0].(*types.Receipt) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetBorBlockReceipt indicates an expected call of GetBorBlockReceipt. +func (mr *MockBackendMockRecorder) GetBorBlockReceipt(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetBorBlockReceipt", reflect.TypeOf((*MockBackend)(nil).GetBorBlockReceipt), arg0, arg1) +} + +// GetLogs mocks base method. +func (m *MockBackend) GetLogs(arg0 context.Context, arg1 common.Hash) ([][]*types.Log, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetLogs", arg0, arg1) + ret0, _ := ret[0].([][]*types.Log) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetLogs indicates an expected call of GetLogs. +func (mr *MockBackendMockRecorder) GetLogs(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetLogs", reflect.TypeOf((*MockBackend)(nil).GetLogs), arg0, arg1) +} + +// GetReceipts mocks base method. +func (m *MockBackend) GetReceipts(arg0 context.Context, arg1 common.Hash) (types.Receipts, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "GetReceipts", arg0, arg1) + ret0, _ := ret[0].(types.Receipts) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetReceipts indicates an expected call of GetReceipts. +func (mr *MockBackendMockRecorder) GetReceipts(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetReceipts", reflect.TypeOf((*MockBackend)(nil).GetReceipts), arg0, arg1) +} + +// HeaderByHash mocks base method. +func (m *MockBackend) HeaderByHash(arg0 context.Context, arg1 common.Hash) (*types.Header, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "HeaderByHash", arg0, arg1) + ret0, _ := ret[0].(*types.Header) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// HeaderByHash indicates an expected call of HeaderByHash. +func (mr *MockBackendMockRecorder) HeaderByHash(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HeaderByHash", reflect.TypeOf((*MockBackend)(nil).HeaderByHash), arg0, arg1) +} + +// HeaderByNumber mocks base method. +func (m *MockBackend) HeaderByNumber(arg0 context.Context, arg1 rpc.BlockNumber) (*types.Header, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "HeaderByNumber", arg0, arg1) + ret0, _ := ret[0].(*types.Header) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// HeaderByNumber indicates an expected call of HeaderByNumber. +func (mr *MockBackendMockRecorder) HeaderByNumber(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HeaderByNumber", reflect.TypeOf((*MockBackend)(nil).HeaderByNumber), arg0, arg1) +} + +// ServiceFilter mocks base method. +func (m *MockBackend) ServiceFilter(arg0 context.Context, arg1 *bloombits.MatcherSession) { + m.ctrl.T.Helper() + m.ctrl.Call(m, "ServiceFilter", arg0, arg1) +} + +// ServiceFilter indicates an expected call of ServiceFilter. +func (mr *MockBackendMockRecorder) ServiceFilter(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ServiceFilter", reflect.TypeOf((*MockBackend)(nil).ServiceFilter), arg0, arg1) +} + +// SubscribeChainEvent mocks base method. +func (m *MockBackend) SubscribeChainEvent(arg0 chan<- core.ChainEvent) event.Subscription { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SubscribeChainEvent", arg0) + ret0, _ := ret[0].(event.Subscription) + return ret0 +} + +// SubscribeChainEvent indicates an expected call of SubscribeChainEvent. +func (mr *MockBackendMockRecorder) SubscribeChainEvent(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribeChainEvent", reflect.TypeOf((*MockBackend)(nil).SubscribeChainEvent), arg0) +} + +// SubscribeLogsEvent mocks base method. +func (m *MockBackend) SubscribeLogsEvent(arg0 chan<- []*types.Log) event.Subscription { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SubscribeLogsEvent", arg0) + ret0, _ := ret[0].(event.Subscription) + return ret0 +} + +// SubscribeLogsEvent indicates an expected call of SubscribeLogsEvent. +func (mr *MockBackendMockRecorder) SubscribeLogsEvent(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribeLogsEvent", reflect.TypeOf((*MockBackend)(nil).SubscribeLogsEvent), arg0) +} + +// SubscribeNewTxsEvent mocks base method. +func (m *MockBackend) SubscribeNewTxsEvent(arg0 chan<- core.NewTxsEvent) event.Subscription { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SubscribeNewTxsEvent", arg0) + ret0, _ := ret[0].(event.Subscription) + return ret0 +} + +// SubscribeNewTxsEvent indicates an expected call of SubscribeNewTxsEvent. +func (mr *MockBackendMockRecorder) SubscribeNewTxsEvent(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribeNewTxsEvent", reflect.TypeOf((*MockBackend)(nil).SubscribeNewTxsEvent), arg0) +} + +// SubscribePendingLogsEvent mocks base method. +func (m *MockBackend) SubscribePendingLogsEvent(arg0 chan<- []*types.Log) event.Subscription { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SubscribePendingLogsEvent", arg0) + ret0, _ := ret[0].(event.Subscription) + return ret0 +} + +// SubscribePendingLogsEvent indicates an expected call of SubscribePendingLogsEvent. +func (mr *MockBackendMockRecorder) SubscribePendingLogsEvent(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribePendingLogsEvent", reflect.TypeOf((*MockBackend)(nil).SubscribePendingLogsEvent), arg0) +} + +// SubscribeRemovedLogsEvent mocks base method. +func (m *MockBackend) SubscribeRemovedLogsEvent(arg0 chan<- core.RemovedLogsEvent) event.Subscription { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SubscribeRemovedLogsEvent", arg0) + ret0, _ := ret[0].(event.Subscription) + return ret0 +} + +// SubscribeRemovedLogsEvent indicates an expected call of SubscribeRemovedLogsEvent. +func (mr *MockBackendMockRecorder) SubscribeRemovedLogsEvent(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribeRemovedLogsEvent", reflect.TypeOf((*MockBackend)(nil).SubscribeRemovedLogsEvent), arg0) +} + +// SubscribeStateSyncEvent mocks base method. +func (m *MockBackend) SubscribeStateSyncEvent(arg0 chan<- core.StateSyncEvent) event.Subscription { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "SubscribeStateSyncEvent", arg0) + ret0, _ := ret[0].(event.Subscription) + return ret0 +} + +// SubscribeStateSyncEvent indicates an expected call of SubscribeStateSyncEvent. +func (mr *MockBackendMockRecorder) SubscribeStateSyncEvent(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SubscribeStateSyncEvent", reflect.TypeOf((*MockBackend)(nil).SubscribeStateSyncEvent), arg0) +} diff --git a/eth/filters/IDatabase.go b/eth/filters/IDatabase.go new file mode 100644 index 0000000000..fd0824b60d --- /dev/null +++ b/eth/filters/IDatabase.go @@ -0,0 +1,368 @@ +// Code generated by MockGen. DO NOT EDIT. +// Source: github.com/ethereum/go-ethereum/ethdb (interfaces: Database) + +// Package filters is a generated GoMock package. +package filters + +import ( + reflect "reflect" + + ethdb "github.com/ethereum/go-ethereum/ethdb" + gomock "github.com/golang/mock/gomock" +) + +// MockDatabase is a mock of Database interface. +type MockDatabase struct { + ctrl *gomock.Controller + recorder *MockDatabaseMockRecorder +} + +// MockDatabaseMockRecorder is the mock recorder for MockDatabase. +type MockDatabaseMockRecorder struct { + mock *MockDatabase +} + +// NewMockDatabase creates a new mock instance. +func NewMockDatabase(ctrl *gomock.Controller) *MockDatabase { + mock := &MockDatabase{ctrl: ctrl} + mock.recorder = &MockDatabaseMockRecorder{mock} + return mock +} + +// EXPECT returns an object that allows the caller to indicate expected use. +func (m *MockDatabase) EXPECT() *MockDatabaseMockRecorder { + return m.recorder +} + +// Ancient mocks base method. +func (m *MockDatabase) Ancient(arg0 string, arg1 uint64) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Ancient", arg0, arg1) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Ancient indicates an expected call of Ancient. +func (mr *MockDatabaseMockRecorder) Ancient(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ancient", reflect.TypeOf((*MockDatabase)(nil).Ancient), arg0, arg1) +} + +// AncientRange mocks base method. +func (m *MockDatabase) AncientRange(arg0 string, arg1, arg2, arg3 uint64) ([][]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AncientRange", arg0, arg1, arg2, arg3) + ret0, _ := ret[0].([][]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AncientRange indicates an expected call of AncientRange. +func (mr *MockDatabaseMockRecorder) AncientRange(arg0, arg1, arg2, arg3 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AncientRange", reflect.TypeOf((*MockDatabase)(nil).AncientRange), arg0, arg1, arg2, arg3) +} + +// AncientSize mocks base method. +func (m *MockDatabase) AncientSize(arg0 string) (uint64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "AncientSize", arg0) + ret0, _ := ret[0].(uint64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// AncientSize indicates an expected call of AncientSize. +func (mr *MockDatabaseMockRecorder) AncientSize(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "AncientSize", reflect.TypeOf((*MockDatabase)(nil).AncientSize), arg0) +} + +// Ancients mocks base method. +func (m *MockDatabase) Ancients() (uint64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Ancients") + ret0, _ := ret[0].(uint64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Ancients indicates an expected call of Ancients. +func (mr *MockDatabaseMockRecorder) Ancients() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Ancients", reflect.TypeOf((*MockDatabase)(nil).Ancients)) +} + +// Close mocks base method. +func (m *MockDatabase) Close() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Close") + ret0, _ := ret[0].(error) + return ret0 +} + +// Close indicates an expected call of Close. +func (mr *MockDatabaseMockRecorder) Close() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Close", reflect.TypeOf((*MockDatabase)(nil).Close)) +} + +// Compact mocks base method. +func (m *MockDatabase) Compact(arg0, arg1 []byte) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Compact", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// Compact indicates an expected call of Compact. +func (mr *MockDatabaseMockRecorder) Compact(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Compact", reflect.TypeOf((*MockDatabase)(nil).Compact), arg0, arg1) +} + +// Delete mocks base method. +func (m *MockDatabase) Delete(arg0 []byte) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Delete", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// Delete indicates an expected call of Delete. +func (mr *MockDatabaseMockRecorder) Delete(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Delete", reflect.TypeOf((*MockDatabase)(nil).Delete), arg0) +} + +// Get mocks base method. +func (m *MockDatabase) Get(arg0 []byte) ([]byte, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Get", arg0) + ret0, _ := ret[0].([]byte) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Get indicates an expected call of Get. +func (mr *MockDatabaseMockRecorder) Get(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Get", reflect.TypeOf((*MockDatabase)(nil).Get), arg0) +} + +// Has mocks base method. +func (m *MockDatabase) Has(arg0 []byte) (bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Has", arg0) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Has indicates an expected call of Has. +func (mr *MockDatabaseMockRecorder) Has(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Has", reflect.TypeOf((*MockDatabase)(nil).Has), arg0) +} + +// HasAncient mocks base method. +func (m *MockDatabase) HasAncient(arg0 string, arg1 uint64) (bool, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "HasAncient", arg0, arg1) + ret0, _ := ret[0].(bool) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// HasAncient indicates an expected call of HasAncient. +func (mr *MockDatabaseMockRecorder) HasAncient(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "HasAncient", reflect.TypeOf((*MockDatabase)(nil).HasAncient), arg0, arg1) +} + +// MigrateTable mocks base method. +func (m *MockDatabase) MigrateTable(arg0 string, arg1 func([]byte) ([]byte, error)) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "MigrateTable", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// MigrateTable indicates an expected call of MigrateTable. +func (mr *MockDatabaseMockRecorder) MigrateTable(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MigrateTable", reflect.TypeOf((*MockDatabase)(nil).MigrateTable), arg0, arg1) +} + +// ModifyAncients mocks base method. +func (m *MockDatabase) ModifyAncients(arg0 func(ethdb.AncientWriteOp) error) (int64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ModifyAncients", arg0) + ret0, _ := ret[0].(int64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// ModifyAncients indicates an expected call of ModifyAncients. +func (mr *MockDatabaseMockRecorder) ModifyAncients(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ModifyAncients", reflect.TypeOf((*MockDatabase)(nil).ModifyAncients), arg0) +} + +// NewBatch mocks base method. +func (m *MockDatabase) NewBatch() ethdb.Batch { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewBatch") + ret0, _ := ret[0].(ethdb.Batch) + return ret0 +} + +// NewBatch indicates an expected call of NewBatch. +func (mr *MockDatabaseMockRecorder) NewBatch() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewBatch", reflect.TypeOf((*MockDatabase)(nil).NewBatch)) +} + +// NewBatchWithSize mocks base method. +func (m *MockDatabase) NewBatchWithSize(arg0 int) ethdb.Batch { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewBatchWithSize", arg0) + ret0, _ := ret[0].(ethdb.Batch) + return ret0 +} + +// NewBatchWithSize indicates an expected call of NewBatchWithSize. +func (mr *MockDatabaseMockRecorder) NewBatchWithSize(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewBatchWithSize", reflect.TypeOf((*MockDatabase)(nil).NewBatchWithSize), arg0) +} + +// NewIterator mocks base method. +func (m *MockDatabase) NewIterator(arg0, arg1 []byte) ethdb.Iterator { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewIterator", arg0, arg1) + ret0, _ := ret[0].(ethdb.Iterator) + return ret0 +} + +// NewIterator indicates an expected call of NewIterator. +func (mr *MockDatabaseMockRecorder) NewIterator(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewIterator", reflect.TypeOf((*MockDatabase)(nil).NewIterator), arg0, arg1) +} + +// NewSnapshot mocks base method. +func (m *MockDatabase) NewSnapshot() (ethdb.Snapshot, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "NewSnapshot") + ret0, _ := ret[0].(ethdb.Snapshot) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// NewSnapshot indicates an expected call of NewSnapshot. +func (mr *MockDatabaseMockRecorder) NewSnapshot() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "NewSnapshot", reflect.TypeOf((*MockDatabase)(nil).NewSnapshot)) +} + +// Put mocks base method. +func (m *MockDatabase) Put(arg0, arg1 []byte) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Put", arg0, arg1) + ret0, _ := ret[0].(error) + return ret0 +} + +// Put indicates an expected call of Put. +func (mr *MockDatabaseMockRecorder) Put(arg0, arg1 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Put", reflect.TypeOf((*MockDatabase)(nil).Put), arg0, arg1) +} + +// ReadAncients mocks base method. +func (m *MockDatabase) ReadAncients(arg0 func(ethdb.AncientReader) error) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "ReadAncients", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// ReadAncients indicates an expected call of ReadAncients. +func (mr *MockDatabaseMockRecorder) ReadAncients(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "ReadAncients", reflect.TypeOf((*MockDatabase)(nil).ReadAncients), arg0) +} + +// Stat mocks base method. +func (m *MockDatabase) Stat(arg0 string) (string, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Stat", arg0) + ret0, _ := ret[0].(string) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Stat indicates an expected call of Stat. +func (mr *MockDatabaseMockRecorder) Stat(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Stat", reflect.TypeOf((*MockDatabase)(nil).Stat), arg0) +} + +// Sync mocks base method. +func (m *MockDatabase) Sync() error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Sync") + ret0, _ := ret[0].(error) + return ret0 +} + +// Sync indicates an expected call of Sync. +func (mr *MockDatabaseMockRecorder) Sync() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Sync", reflect.TypeOf((*MockDatabase)(nil).Sync)) +} + +// Tail mocks base method. +func (m *MockDatabase) Tail() (uint64, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "Tail") + ret0, _ := ret[0].(uint64) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// Tail indicates an expected call of Tail. +func (mr *MockDatabaseMockRecorder) Tail() *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "Tail", reflect.TypeOf((*MockDatabase)(nil).Tail)) +} + +// TruncateHead mocks base method. +func (m *MockDatabase) TruncateHead(arg0 uint64) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TruncateHead", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// TruncateHead indicates an expected call of TruncateHead. +func (mr *MockDatabaseMockRecorder) TruncateHead(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TruncateHead", reflect.TypeOf((*MockDatabase)(nil).TruncateHead), arg0) +} + +// TruncateTail mocks base method. +func (m *MockDatabase) TruncateTail(arg0 uint64) error { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "TruncateTail", arg0) + ret0, _ := ret[0].(error) + return ret0 +} + +// TruncateTail indicates an expected call of TruncateTail. +func (mr *MockDatabaseMockRecorder) TruncateTail(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "TruncateTail", reflect.TypeOf((*MockDatabase)(nil).TruncateTail), arg0) +} diff --git a/eth/filters/bench_test.go b/eth/filters/bench_test.go index 9632f4195f..e0eb972a32 100644 --- a/eth/filters/bench_test.go +++ b/eth/filters/bench_test.go @@ -122,13 +122,14 @@ func benchmarkBloomBits(b *testing.B, sectionSize uint64) { b.Log("Running filter benchmarks...") start = time.Now() - var backend *testBackend + + var backend *TestBackend for i := 0; i < benchFilterCnt; i++ { if i%20 == 0 { db.Close() db, _ = rawdb.NewLevelDBDatabase(benchDataDir, 128, 1024, "", false) - backend = &testBackend{db: db, sections: cnt} + backend = &TestBackend{DB: db, sections: cnt} } var addr common.Address addr[0] = byte(i) @@ -173,7 +174,7 @@ func BenchmarkNoBloomBits(b *testing.B) { b.Log("Running filter benchmarks...") start := time.Now() - backend := &testBackend{db: db} + backend := &TestBackend{DB: db} filter := NewRangeFilter(backend, 0, int64(*headNum), []common.Address{{}}, nil) filter.Logs(context.Background()) d := time.Since(start) diff --git a/eth/filters/bor_filter.go b/eth/filters/bor_filter.go index c567719c59..3810d790aa 100644 --- a/eth/filters/bor_filter.go +++ b/eth/filters/bor_filter.go @@ -111,7 +111,7 @@ func (f *BorBlockLogsFilter) Logs(ctx context.Context) ([]*types.Log, error) { func (f *BorBlockLogsFilter) unindexedLogs(ctx context.Context, end uint64) ([]*types.Log, error) { var logs []*types.Log - for ; f.begin <= int64(end); f.begin = f.begin + 64 { + for ; f.begin <= int64(end); f.begin = f.begin + int64(f.sprint) { header, err := f.backend.HeaderByNumber(ctx, rpc.BlockNumber(f.begin)) if header == nil || err != nil { return logs, err diff --git a/eth/filters/bor_filter_system_test.go b/eth/filters/bor_filter_system_test.go deleted file mode 100644 index 05f05893d6..0000000000 --- a/eth/filters/bor_filter_system_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package filters - -import ( - "context" - - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/core/rawdb" - "github.com/ethereum/go-ethereum/core/types" -) - -func (b *testBackend) GetBorBlockReceipt(ctx context.Context, hash common.Hash) (*types.Receipt, error) { - number := rawdb.ReadHeaderNumber(b.db, hash) - if number == nil { - return nil, nil - } - - receipt := rawdb.ReadBorReceipt(b.db, hash, *number) - if receipt == nil { - return nil, nil - } - return receipt, nil -} - -func (b *testBackend) GetBorBlockLogs(ctx context.Context, hash common.Hash) ([]*types.Log, error) { - receipt, err := b.GetBorBlockReceipt(ctx, hash) - if receipt == nil || err != nil { - return nil, nil - } - return receipt.Logs, nil -} diff --git a/eth/filters/bor_filter_test.go b/eth/filters/bor_filter_test.go new file mode 100644 index 0000000000..a176ce6f5b --- /dev/null +++ b/eth/filters/bor_filter_test.go @@ -0,0 +1,158 @@ +package filters + +import ( + "context" + "math/big" + "testing" + + "github.com/ethereum/go-ethereum/common" + types "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/params" + + gomock "github.com/golang/mock/gomock" +) + +var ( + key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291") + addr = crypto.PubkeyToAddress(key1.PublicKey) +) + +func newTestHeader(blockNumber uint) *types.Header { + return &types.Header{ + Number: big.NewInt(int64(blockNumber)), + } +} + +func newTestReceipt(contractAddr common.Address, topicAddress common.Hash) *types.Receipt { + receipt := types.NewReceipt(nil, false, 0) + receipt.Logs = []*types.Log{ + { + Address: contractAddr, + Topics: []common.Hash{topicAddress}, + }, + } + + receipt.Bloom = types.CreateBloom(types.Receipts{receipt}) + + return receipt +} + +func (backend *MockBackend) expectBorReceiptsFromMock(hashes []*common.Hash) { + for _, h := range hashes { + if h == nil { + backend.EXPECT().GetBorBlockReceipt(gomock.Any(), gomock.Any()).Return(nil, nil) + continue + } + + backend.EXPECT().GetBorBlockReceipt(gomock.Any(), gomock.Any()).Return(newTestReceipt(addr, *h), nil) + } +} + +func TestBorFilters(t *testing.T) { + t.Parallel() + + ctrl := gomock.NewController(t) + defer ctrl.Finish() + + var ( + hash1 = common.BytesToHash([]byte("topic1")) + hash2 = common.BytesToHash([]byte("topic2")) + hash3 = common.BytesToHash([]byte("topic3")) + hash4 = common.BytesToHash([]byte("topic4")) + db = NewMockDatabase(ctrl) + + sprint = params.TestChainConfig.Bor.Sprint + ) + + backend := NewMockBackend(ctrl) + + // should return the following at all times + backend.EXPECT().ChainDb().Return(db).AnyTimes() + backend.EXPECT().HeaderByNumber(gomock.Any(), gomock.Any()).Return(newTestHeader(1), nil).AnyTimes() + + // Block 1 + backend.expectBorReceiptsFromMock([]*common.Hash{nil, &hash1, &hash2, &hash3, &hash4}) + + filter := NewBorBlockLogsRangeFilter(backend, sprint, 0, 18, []common.Address{addr}, [][]common.Hash{{hash1, hash2, hash3, hash4}}) + logs, err := filter.Logs(context.Background()) + + if err != nil { + t.Error(err) + } + + if len(logs) != 4 { + t.Error("expected 4 log, got", len(logs)) + } + + // Block 2 + backend.expectBorReceiptsFromMock([]*common.Hash{&hash1, &hash3}) + + filter = NewBorBlockLogsRangeFilter(backend, sprint, 990, 999, []common.Address{addr}, [][]common.Hash{{hash3}}) + logs, _ = filter.Logs(context.Background()) + + if len(logs) != 1 { + t.Error("expected 1 log, got", len(logs)) + } + + if len(logs) > 0 && logs[0].Topics[0] != hash3 { + t.Errorf("expected log[0].Topics[0] to be %x, got %x", hash3, logs[0].Topics[0]) + } + + // Block 3 + backend.expectBorReceiptsFromMock([]*common.Hash{&hash1, &hash2, &hash3}) + + filter = NewBorBlockLogsRangeFilter(backend, sprint, 992, 1000, []common.Address{addr}, [][]common.Hash{{hash3}}) + logs, _ = filter.Logs(context.Background()) + + if len(logs) != 1 { + t.Error("expected 1 log, got", len(logs)) + } + + if len(logs) > 0 && logs[0].Topics[0] != hash3 { + t.Errorf("expected log[0].Topics[0] to be %x, got %x", hash3, logs[0].Topics[0]) + } + + // Block 4 + backend.expectBorReceiptsFromMock([]*common.Hash{&hash1, &hash2, nil, &hash3}) + + filter = NewBorBlockLogsRangeFilter(backend, sprint, 1, 16, []common.Address{addr}, [][]common.Hash{{hash1, hash2}}) + + logs, _ = filter.Logs(context.Background()) + + if len(logs) != 2 { + t.Error("expected 2 log, got", len(logs)) + } + + // Block 5 + backend.expectBorReceiptsFromMock([]*common.Hash{&hash1, &hash2, nil, &hash3, &hash4, nil}) + + failHash := common.BytesToHash([]byte("fail")) + filter = NewBorBlockLogsRangeFilter(backend, sprint, 0, 20, nil, [][]common.Hash{{failHash}}) + + logs, _ = filter.Logs(context.Background()) + if len(logs) != 0 { + t.Error("expected 0 log, got", len(logs)) + } + + // Block 6 + backend.expectBorReceiptsFromMock([]*common.Hash{&hash1, &hash2, nil, &hash3, &hash4, nil}) + + failAddr := common.BytesToAddress([]byte("failmenow")) + filter = NewBorBlockLogsRangeFilter(backend, sprint, 0, 20, []common.Address{failAddr}, nil) + + logs, _ = filter.Logs(context.Background()) + if len(logs) != 0 { + t.Error("expected 0 log, got", len(logs)) + } + + // Block 7 + backend.expectBorReceiptsFromMock([]*common.Hash{&hash1, &hash2, nil, &hash3, &hash4, nil}) + + filter = NewBorBlockLogsRangeFilter(backend, sprint, 0, 20, nil, [][]common.Hash{{failHash}, {hash1}}) + + logs, _ = filter.Logs(context.Background()) + if len(logs) != 0 { + t.Error("expected 0 log, got", len(logs)) + } +} diff --git a/eth/filters/filter.go b/eth/filters/filter.go index 4af45c7ea6..a99f1e753a 100644 --- a/eth/filters/filter.go +++ b/eth/filters/filter.go @@ -30,6 +30,7 @@ import ( "github.com/ethereum/go-ethereum/rpc" ) +//go:generate mockgen -destination=../../eth/filters/IBackend.go -package=filters . Backend type Backend interface { ChainDb() ethdb.Database HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error) diff --git a/eth/filters/filter_system_test.go b/eth/filters/filter_system_test.go index a49f339f86..67d69bb628 100644 --- a/eth/filters/filter_system_test.go +++ b/eth/filters/filter_system_test.go @@ -20,7 +20,6 @@ import ( "context" "fmt" "math/big" - "math/rand" "reflect" "runtime" "testing" @@ -30,11 +29,8 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/consensus/ethash" "github.com/ethereum/go-ethereum/core" - "github.com/ethereum/go-ethereum/core/bloombits" "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/ethdb" - "github.com/ethereum/go-ethereum/event" "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" ) @@ -44,126 +40,6 @@ var ( borLogs bool = true ) -type testBackend struct { - mux *event.TypeMux - db ethdb.Database - sections uint64 - txFeed event.Feed - logsFeed event.Feed - rmLogsFeed event.Feed - pendingLogsFeed event.Feed - chainFeed event.Feed - - stateSyncFeed event.Feed -} - -func (b *testBackend) ChainDb() ethdb.Database { - return b.db -} - -func (b *testBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error) { - var ( - hash common.Hash - num uint64 - ) - if blockNr == rpc.LatestBlockNumber { - hash = rawdb.ReadHeadBlockHash(b.db) - number := rawdb.ReadHeaderNumber(b.db, hash) - if number == nil { - return nil, nil - } - num = *number - } else { - num = uint64(blockNr) - hash = rawdb.ReadCanonicalHash(b.db, num) - } - return rawdb.ReadHeader(b.db, hash, num), nil -} - -func (b *testBackend) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error) { - number := rawdb.ReadHeaderNumber(b.db, hash) - if number == nil { - return nil, nil - } - return rawdb.ReadHeader(b.db, hash, *number), nil -} - -func (b *testBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error) { - if number := rawdb.ReadHeaderNumber(b.db, hash); number != nil { - return rawdb.ReadReceipts(b.db, hash, *number, params.TestChainConfig), nil - } - return nil, nil -} - -func (b *testBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error) { - number := rawdb.ReadHeaderNumber(b.db, hash) - if number == nil { - return nil, nil - } - receipts := rawdb.ReadReceipts(b.db, hash, *number, params.TestChainConfig) - - logs := make([][]*types.Log, len(receipts)) - for i, receipt := range receipts { - logs[i] = receipt.Logs - } - return logs, nil -} - -func (b *testBackend) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.Subscription { - return b.txFeed.Subscribe(ch) -} - -func (b *testBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription { - return b.rmLogsFeed.Subscribe(ch) -} - -func (b *testBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription { - return b.logsFeed.Subscribe(ch) -} - -func (b *testBackend) SubscribePendingLogsEvent(ch chan<- []*types.Log) event.Subscription { - return b.pendingLogsFeed.Subscribe(ch) -} - -func (b *testBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription { - return b.chainFeed.Subscribe(ch) -} - -func (b *testBackend) BloomStatus() (uint64, uint64) { - return params.BloomBitsBlocks, b.sections -} - -func (b *testBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) { - requests := make(chan chan *bloombits.Retrieval) - - go session.Multiplex(16, 0, requests) - go func() { - for { - // Wait for a service request or a shutdown - select { - case <-ctx.Done(): - return - - case request := <-requests: - task := <-request - - task.Bitsets = make([][]byte, len(task.Sections)) - for i, section := range task.Sections { - if rand.Int()%4 != 0 { // Handle occasional missing deliveries - head := rawdb.ReadCanonicalHash(b.db, (section+1)*params.BloomBitsBlocks-1) - task.Bitsets[i], _ = rawdb.ReadBloomBits(b.db, task.Bit, section, head) - } - } - request <- task - } - } - }() -} - -func (b *testBackend) SubscribeStateSyncEvent(ch chan<- core.StateSyncEvent) event.Subscription { - return b.stateSyncFeed.Subscribe(ch) -} - // TestBlockSubscription tests if a block subscription returns block hashes for posted chain events. // It creates multiple subscriptions: // - one at the start and should receive all posted chain events and a second (blockHashes) @@ -174,7 +50,7 @@ func TestBlockSubscription(t *testing.T) { var ( db = rawdb.NewMemoryDatabase() - backend = &testBackend{db: db} + backend = &TestBackend{DB: db} api = NewPublicFilterAPI(backend, false, deadline, borLogs) genesis = (&core.Genesis{BaseFee: big.NewInt(params.InitialBaseFee)}).MustCommit(db) chain, _ = core.GenerateChain(params.TestChainConfig, genesis, ethash.NewFaker(), db, 10, func(i int, gen *core.BlockGen) {}) @@ -226,7 +102,7 @@ func TestPendingTxFilter(t *testing.T) { var ( db = rawdb.NewMemoryDatabase() - backend = &testBackend{db: db} + backend = &TestBackend{DB: db} api = NewPublicFilterAPI(backend, false, deadline, borLogs) transactions = []*types.Transaction{ @@ -281,7 +157,7 @@ func TestPendingTxFilter(t *testing.T) { func TestLogFilterCreation(t *testing.T) { var ( db = rawdb.NewMemoryDatabase() - backend = &testBackend{db: db} + backend = &TestBackend{DB: db} api = NewPublicFilterAPI(backend, false, deadline, borLogs) testCases = []struct { @@ -325,7 +201,7 @@ func TestInvalidLogFilterCreation(t *testing.T) { var ( db = rawdb.NewMemoryDatabase() - backend = &testBackend{db: db} + backend = &TestBackend{DB: db} api = NewPublicFilterAPI(backend, false, deadline, borLogs) ) @@ -347,7 +223,7 @@ func TestInvalidLogFilterCreation(t *testing.T) { func TestInvalidGetLogsRequest(t *testing.T) { var ( db = rawdb.NewMemoryDatabase() - backend = &testBackend{db: db} + backend = &TestBackend{DB: db} api = NewPublicFilterAPI(backend, false, deadline, borLogs) blockHash = common.HexToHash("0x1111111111111111111111111111111111111111111111111111111111111111") ) @@ -372,7 +248,7 @@ func TestLogFilter(t *testing.T) { var ( db = rawdb.NewMemoryDatabase() - backend = &testBackend{db: db} + backend = &TestBackend{DB: db} api = NewPublicFilterAPI(backend, false, deadline, borLogs) firstAddr = common.HexToAddress("0x1111111111111111111111111111111111111111") @@ -486,7 +362,7 @@ func TestPendingLogsSubscription(t *testing.T) { var ( db = rawdb.NewMemoryDatabase() - backend = &testBackend{db: db} + backend = &TestBackend{DB: db} api = NewPublicFilterAPI(backend, false, deadline, borLogs) firstAddr = common.HexToAddress("0x1111111111111111111111111111111111111111") @@ -670,7 +546,7 @@ func TestPendingTxFilterDeadlock(t *testing.T) { var ( db = rawdb.NewMemoryDatabase() - backend = &testBackend{db: db} + backend = &TestBackend{DB: db} api = NewPublicFilterAPI(backend, false, timeout, borLogs) done = make(chan struct{}) ) diff --git a/eth/filters/filter_test.go b/eth/filters/filter_test.go index 63a48f762d..6a8443b67c 100644 --- a/eth/filters/filter_test.go +++ b/eth/filters/filter_test.go @@ -50,7 +50,7 @@ func BenchmarkFilters(b *testing.B) { var ( db, _ = rawdb.NewLevelDBDatabase(dir, 0, 0, "", false) - backend = &testBackend{db: db} + backend = &TestBackend{DB: db} key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291") addr1 = crypto.PubkeyToAddress(key1.PublicKey) addr2 = common.BytesToAddress([]byte("jeff")) @@ -108,7 +108,7 @@ func TestFilters(t *testing.T) { var ( db, _ = rawdb.NewLevelDBDatabase(dir, 0, 0, "", false) - backend = &testBackend{db: db} + backend = &TestBackend{DB: db} key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291") addr = crypto.PubkeyToAddress(key1.PublicKey) diff --git a/eth/filters/test_backend.go b/eth/filters/test_backend.go new file mode 100644 index 0000000000..979ed3efb6 --- /dev/null +++ b/eth/filters/test_backend.go @@ -0,0 +1,177 @@ +package filters + +import ( + context "context" + "crypto/rand" + "math/big" + + common "github.com/ethereum/go-ethereum/common" + core "github.com/ethereum/go-ethereum/core" + bloombits "github.com/ethereum/go-ethereum/core/bloombits" + "github.com/ethereum/go-ethereum/core/rawdb" + types "github.com/ethereum/go-ethereum/core/types" + ethdb "github.com/ethereum/go-ethereum/ethdb" + event "github.com/ethereum/go-ethereum/event" + "github.com/ethereum/go-ethereum/params" + rpc "github.com/ethereum/go-ethereum/rpc" +) + +type TestBackend struct { + DB ethdb.Database + sections uint64 + txFeed event.Feed + logsFeed event.Feed + rmLogsFeed event.Feed + pendingLogsFeed event.Feed + chainFeed event.Feed + + stateSyncFeed event.Feed +} + +func (b *TestBackend) BloomStatus() (uint64, uint64) { + return params.BloomBitsBlocks, b.sections +} + +func (b *TestBackend) GetBorBlockReceipt(ctx context.Context, hash common.Hash) (*types.Receipt, error) { + number := rawdb.ReadHeaderNumber(b.DB, hash) + if number == nil { + return &types.Receipt{}, nil + } + + receipt := rawdb.ReadBorReceipt(b.DB, hash, *number) + if receipt == nil { + return &types.Receipt{}, nil + } + + return receipt, nil +} + +func (b *TestBackend) GetBorBlockLogs(ctx context.Context, hash common.Hash) ([]*types.Log, error) { + receipt, err := b.GetBorBlockReceipt(ctx, hash) + if err != nil { + return []*types.Log{}, err + } + + if receipt == nil { + return []*types.Log{}, nil + } + + return receipt.Logs, nil +} + +func (b *TestBackend) ChainDb() ethdb.Database { + return b.DB +} + +func (b *TestBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNumber) (*types.Header, error) { + var ( + hash common.Hash + num uint64 + ) + + if blockNr == rpc.LatestBlockNumber { + hash = rawdb.ReadHeadBlockHash(b.DB) + number := rawdb.ReadHeaderNumber(b.DB, hash) + + if number == nil { + return &types.Header{}, nil + } + + num = *number + } else { + num = uint64(blockNr) + hash = rawdb.ReadCanonicalHash(b.DB, num) + } + + return rawdb.ReadHeader(b.DB, hash, num), nil +} + +func (b *TestBackend) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error) { + number := rawdb.ReadHeaderNumber(b.DB, hash) + if number == nil { + return &types.Header{}, nil + } + + return rawdb.ReadHeader(b.DB, hash, *number), nil +} + +func (b *TestBackend) GetReceipts(ctx context.Context, hash common.Hash) (types.Receipts, error) { + if number := rawdb.ReadHeaderNumber(b.DB, hash); number != nil { + return rawdb.ReadReceipts(b.DB, hash, *number, params.TestChainConfig), nil + } + + return nil, nil +} + +func (b *TestBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*types.Log, error) { + number := rawdb.ReadHeaderNumber(b.DB, hash) + if number == nil { + return nil, nil + } + + receipts := rawdb.ReadReceipts(b.DB, hash, *number, params.TestChainConfig) + + logs := make([][]*types.Log, len(receipts)) + for i, receipt := range receipts { + logs[i] = receipt.Logs + } + + return logs, nil +} + +func (b *TestBackend) SubscribeNewTxsEvent(ch chan<- core.NewTxsEvent) event.Subscription { + return b.txFeed.Subscribe(ch) +} + +func (b *TestBackend) SubscribeRemovedLogsEvent(ch chan<- core.RemovedLogsEvent) event.Subscription { + return b.rmLogsFeed.Subscribe(ch) +} + +func (b *TestBackend) SubscribeLogsEvent(ch chan<- []*types.Log) event.Subscription { + return b.logsFeed.Subscribe(ch) +} + +func (b *TestBackend) SubscribePendingLogsEvent(ch chan<- []*types.Log) event.Subscription { + return b.pendingLogsFeed.Subscribe(ch) +} + +func (b *TestBackend) SubscribeChainEvent(ch chan<- core.ChainEvent) event.Subscription { + return b.chainFeed.Subscribe(ch) +} + +func (b *TestBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) { + requests := make(chan chan *bloombits.Retrieval) + + go session.Multiplex(16, 0, requests) + go func() { + for { + // Wait for a service request or a shutdown + select { + case <-ctx.Done(): + return + + case request := <-requests: + task := <-request + + task.Bitsets = make([][]byte, len(task.Sections)) + for i, section := range task.Sections { + nBig, err := rand.Int(rand.Reader, big.NewInt(100)) + + if err != nil { + panic(err) + } + + if nBig.Int64()%4 != 0 { // Handle occasional missing deliveries + head := rawdb.ReadCanonicalHash(b.DB, (section+1)*params.BloomBitsBlocks-1) + task.Bitsets[i], _ = rawdb.ReadBloomBits(b.DB, task.Bit, section, head) + } + } + request <- task + } + } + }() +} + +func (b *TestBackend) SubscribeStateSyncEvent(ch chan<- core.StateSyncEvent) event.Subscription { + return b.stateSyncFeed.Subscribe(ch) +} diff --git a/eth/handler.go b/eth/handler.go index a9c4f4eb1f..8e6d89f9ef 100644 --- a/eth/handler.go +++ b/eth/handler.go @@ -162,8 +162,15 @@ func newHandler(config *handlerConfig) (*handler, error) { // In these cases however it's safe to reenable snap sync. fullBlock, fastBlock := h.chain.CurrentBlock(), h.chain.CurrentFastBlock() if fullBlock.NumberU64() == 0 && fastBlock.NumberU64() > 0 { - h.snapSync = uint32(1) - log.Warn("Switch sync mode from full sync to snap sync") + // Note: Ideally this should never happen with bor, but to be extra + // preventive we won't allow it to roll over to snap sync until + // we have it working + + // TODO(snap): Uncomment when we have snap sync working + // h.snapSync = uint32(1) + // log.Warn("Switch sync mode from full sync to snap sync") + + log.Warn("Preventing switching sync mode from full sync to snap sync") } } else { if h.chain.CurrentBlock().NumberU64() > 0 { @@ -433,7 +440,7 @@ func (h *handler) runEthPeer(peer *eth.Peer, handler eth.Handler) error { }() } // If we have any explicit peer required block hashes, request them - for number := range h.peerRequiredBlocks { + for number, hash := range h.peerRequiredBlocks { resCh := make(chan *eth.Response) if _, err := peer.RequestHeadersByNumber(number, 1, 0, false, resCh); err != nil { return err diff --git a/eth/handler_bor.go b/eth/handler_bor.go index 35d6e00bfc..604deef282 100644 --- a/eth/handler_bor.go +++ b/eth/handler_bor.go @@ -3,13 +3,10 @@ package eth import ( "context" "errors" - "fmt" "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/consensus/bor" "github.com/ethereum/go-ethereum/log" - "github.com/ethereum/go-ethereum/rpc" ) var ( @@ -43,7 +40,7 @@ var ( // fetchWhitelistCheckpoints fetches the latest checkpoint/s from it's local heimdall // and verifies the data against bor data. -func (h *ethHandler) fetchWhitelistCheckpoints(ctx context.Context, bor *bor.Bor, first bool) ([]uint64, []common.Hash, error) { +func (h *ethHandler) fetchWhitelistCheckpoints(ctx context.Context, bor *bor.Bor, checkpointVerifier *checkpointVerifier, first bool) ([]uint64, []common.Hash, error) { // Create an array for block number and block hashes //nolint:prealloc var ( @@ -62,56 +59,44 @@ func (h *ethHandler) fetchWhitelistCheckpoints(ctx context.Context, bor *bor.Bor return blockNums, blockHashes, errNoCheckpoint } - // If we're in the first iteration, we'll fetch last 10 checkpoints, else only the latest one - iterations := 1 - if first { - iterations = 10 + var ( + start int64 + end int64 + ) + + // Prepare the checkpoint range to fetch + if count <= 10 { + start = 1 + } else { + start = count - 10 + 1 // 10 is the max number of checkpoints to fetch } - for i := 0; i < iterations; i++ { - // If we don't have any checkpoints in heimdall, break - if count == 0 { - break - } + end = count - // fetch `count` indexed checkpoint from heimdall - checkpoint, err := bor.HeimdallClient.FetchCheckpoint(ctx, count) + // If we're in not in the first iteration, only fetch the latest checkpoint + if !first { + start = count + } + + for i := start; i <= end; i++ { + // fetch `i` indexed checkpoint from heimdall + checkpoint, err := bor.HeimdallClient.FetchCheckpoint(ctx, i) if err != nil { log.Debug("Failed to fetch latest checkpoint for whitelisting", "err", err) return blockNums, blockHashes, errCheckpoint } - // check if we have the checkpoint blocks - head := h.ethAPI.BlockNumber() - if head < hexutil.Uint64(checkpoint.EndBlock.Uint64()) { - log.Debug("Head block behind checkpoint block", "head", head, "checkpoint end block", checkpoint.EndBlock) - return blockNums, blockHashes, errMissingCheckpoint - } + // Verify if the checkpoint fetched can be added to the local whitelist entry or not + // If verified, it returns the hash of the end block of the checkpoint. If not, + // it will return appropriate error. - // verify the root hash of checkpoint - roothash, err := h.ethAPI.GetRootHash(ctx, checkpoint.StartBlock.Uint64(), checkpoint.EndBlock.Uint64()) + hash, err := checkpointVerifier.verify(ctx, h, checkpoint) if err != nil { - log.Debug("Failed to get root hash of checkpoint while whitelisting", "err", err) - return blockNums, blockHashes, errRootHash + return blockNums, blockHashes, err } - if roothash != checkpoint.RootHash.String()[2:] { - log.Warn("Checkpoint root hash mismatch while whitelisting", "expected", checkpoint.RootHash.String()[2:], "got", roothash) - return blockNums, blockHashes, errCheckpointRootHashMismatch - } - - // fetch the end checkpoint block hash - block, err := h.ethAPI.GetBlockByNumber(ctx, rpc.BlockNumber(checkpoint.EndBlock.Uint64()), false) - if err != nil { - log.Debug("Failed to get end block hash of checkpoint while whitelisting", "err", err) - return blockNums, blockHashes, errEndBlock - } - - hash := fmt.Sprintf("%v", block["hash"]) - blockNums = append(blockNums, checkpoint.EndBlock.Uint64()) blockHashes = append(blockHashes, common.HexToHash(hash)) - count-- } return blockNums, blockHashes, nil diff --git a/eth/handler_bor_test.go b/eth/handler_bor_test.go new file mode 100644 index 0000000000..857db70e95 --- /dev/null +++ b/eth/handler_bor_test.go @@ -0,0 +1,134 @@ +package eth + +import ( + "context" + "math/big" + "testing" + "time" + + "github.com/stretchr/testify/require" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/consensus/bor" + "github.com/ethereum/go-ethereum/consensus/bor/clerk" + "github.com/ethereum/go-ethereum/consensus/bor/heimdall/checkpoint" + "github.com/ethereum/go-ethereum/consensus/bor/heimdall/span" +) + +type mockHeimdall struct { + fetchCheckpoint func(ctx context.Context, number int64) (*checkpoint.Checkpoint, error) + fetchCheckpointCount func(ctx context.Context) (int64, error) +} + +func (m *mockHeimdall) StateSyncEvents(ctx context.Context, fromID uint64, to int64) ([]*clerk.EventRecordWithTime, error) { + return nil, nil +} +func (m *mockHeimdall) Span(ctx context.Context, spanID uint64) (*span.HeimdallSpan, error) { + //nolint:nilnil + return nil, nil +} +func (m *mockHeimdall) FetchCheckpoint(ctx context.Context, number int64) (*checkpoint.Checkpoint, error) { + return m.fetchCheckpoint(ctx, number) +} +func (m *mockHeimdall) FetchCheckpointCount(ctx context.Context) (int64, error) { + return m.fetchCheckpointCount(ctx) +} +func (m *mockHeimdall) Close() {} + +func TestFetchWhitelistCheckpoints(t *testing.T) { + t.Parallel() + + // create an empty ethHandler + handler := ðHandler{} + + // create a mock checkpoint verification function and use it to create a verifier + verify := func(ctx context.Context, handler *ethHandler, checkpoint *checkpoint.Checkpoint) (string, error) { + return "", nil + } + + verifier := newCheckpointVerifier(verify) + + // Create a mock heimdall instance and use it for creating a bor instance + var heimdall mockHeimdall + + bor := &bor.Bor{HeimdallClient: &heimdall} + + // create 20 mock checkpoints + checkpoints := createMockCheckpoints(20) + + // create a mock fetch checkpoint function + heimdall.fetchCheckpoint = func(_ context.Context, number int64) (*checkpoint.Checkpoint, error) { + return checkpoints[number-1], nil // we're sure that number won't exceed 20 + } + + // create a background context + ctx := context.Background() + + testCases := []struct { + name string + first bool + count int64 + length int + start uint64 + end uint64 + fetchErr error + expectedErr error + }{ + {"fail to fetch checkpoint count", false, 0, 0, 0, 0, errCheckpointCount, errCheckpointCount}, + {"no checkpoints available", false, 0, 0, 0, 0, nil, errNoCheckpoint}, + {"fetch multiple checkpoints (count < 10)", true, 6, 6, 0, 6, nil, nil}, + {"fetch multiple checkpoints (count = 10)", true, 10, 10, 0, 10, nil, nil}, + {"fetch multiple checkpoints (count > 10)", true, 16, 10, 6, 16, nil, nil}, + {"fetch single checkpoint", false, 18, 1, 17, 18, nil, nil}, + } + + for _, tc := range testCases { + tc := tc + t.Run(tc.name, func(t *testing.T) { + t.Parallel() + heimdall.fetchCheckpointCount = getMockFetchCheckpointFn(tc.count, tc.fetchErr) + blockNums, blockHashes, err := handler.fetchWhitelistCheckpoints(ctx, bor, verifier, tc.first) + + // Check if we have expected result + require.Equal(t, tc.expectedErr, err) + require.Equal(t, tc.length, len(blockNums)) + require.Equal(t, tc.length, len(blockHashes)) + validateBlockNumber(t, blockNums, checkpoints[tc.start:tc.end]) + }) + } +} + +func validateBlockNumber(t *testing.T, blockNums []uint64, checkpoints []*checkpoint.Checkpoint) { + t.Helper() + + for i, blockNum := range blockNums { + require.Equal(t, blockNum, checkpoints[i].EndBlock.Uint64(), "expect block number in array to match with checkpoint") + } +} + +func getMockFetchCheckpointFn(number int64, err error) func(ctx context.Context) (int64, error) { + return func(_ context.Context) (int64, error) { + return number, err + } +} + +func createMockCheckpoints(count int) []*checkpoint.Checkpoint { + var ( + checkpoints []*checkpoint.Checkpoint = make([]*checkpoint.Checkpoint, count) + startBlock int64 = 257 // any number can be used + ) + + for i := 0; i < count; i++ { + checkpoints[i] = &checkpoint.Checkpoint{ + Proposer: common.Address{}, + StartBlock: big.NewInt(startBlock), + EndBlock: big.NewInt(startBlock + 255), + RootHash: common.Hash{}, + BorChainID: "137", + Timestamp: uint64(time.Now().Unix()), + } + startBlock += 256 + } + + return checkpoints +} diff --git a/eth/sync.go b/eth/sync.go index d67d2311d0..22c0c9054a 100644 --- a/eth/sync.go +++ b/eth/sync.go @@ -204,25 +204,36 @@ func peerToSyncOp(mode downloader.SyncMode, p *eth.Peer) *chainSyncOp { } func (cs *chainSyncer) modeAndLocalHead() (downloader.SyncMode, *big.Int) { - // If we're in snap sync mode, return that directly - if atomic.LoadUint32(&cs.handler.snapSync) == 1 { - block := cs.handler.chain.CurrentFastBlock() - td := cs.handler.chain.GetTd(block.Hash(), block.NumberU64()) - return downloader.SnapSync, td - } - // We are probably in full sync, but we might have rewound to before the - // snap sync pivot, check if we should reenable - if pivot := rawdb.ReadLastPivotNumber(cs.handler.database); pivot != nil { - if head := cs.handler.chain.CurrentBlock(); head.NumberU64() < *pivot { - block := cs.handler.chain.CurrentFastBlock() - td := cs.handler.chain.GetTd(block.Hash(), block.NumberU64()) - return downloader.SnapSync, td - } - } - // Nope, we're really full syncing + // Note: Ideally this should never happen with bor, but to be extra + // preventive we won't allow it to roll over to snap sync until + // we have it working + + // Handle full sync mode only head := cs.handler.chain.CurrentBlock() td := cs.handler.chain.GetTd(head.Hash(), head.NumberU64()) return downloader.FullSync, td + + // TODO(snap): Uncomment when we have snap sync working + + // If we're in snap sync mode, return that directly + // if atomic.LoadUint32(&cs.handler.snapSync) == 1 { + // block := cs.handler.chain.CurrentFastBlock() + // td := cs.handler.chain.GetTd(block.Hash(), block.NumberU64()) + // return downloader.SnapSync, td + // } + // // We are probably in full sync, but we might have rewound to before the + // // snap sync pivot, check if we should reenable + // if pivot := rawdb.ReadLastPivotNumber(cs.handler.database); pivot != nil { + // if head := cs.handler.chain.CurrentBlock(); head.NumberU64() < *pivot { + // block := cs.handler.chain.CurrentFastBlock() + // td := cs.handler.chain.GetTd(block.Hash(), block.NumberU64()) + // return downloader.SnapSync, td + // } + // } + // Nope, we're really full syncing + // head := cs.handler.chain.CurrentBlock() + // td := cs.handler.chain.GetTd(head.Hash(), head.NumberU64()) + // return downloader.FullSync, td } // startSync launches doSync in a new goroutine. diff --git a/eth/tracers/api_bor.go b/eth/tracers/api_bor.go index 6ab1a4290a..f42c7a27f7 100644 --- a/eth/tracers/api_bor.go +++ b/eth/tracers/api_bor.go @@ -43,7 +43,7 @@ func (api *API) traceBorBlock(ctx context.Context, block *types.Block, config *T } // block object cannot be converted to JSON since much of the fields are non-public - blockFields, err := ethapi.RPCMarshalBlock(block, true, true, api.backend.ChainConfig()) + blockFields, err := ethapi.RPCMarshalBlock(block, true, true, api.backend.ChainConfig(), api.backend.ChainDb()) if err != nil { return nil, err } diff --git a/ethdb/database.go b/ethdb/database.go index b2e7c7228a..88c8de6a16 100644 --- a/ethdb/database.go +++ b/ethdb/database.go @@ -164,6 +164,7 @@ type AncientStore interface { // Database contains all the methods required by the high level database to not // only access the key-value data store but also the chain freezer. +//go:generate mockgen -destination=../eth/filters/IDatabase.go -package=filters . Database type Database interface { Reader Writer diff --git a/go.mod b/go.mod index 8c5c18f8c7..f2b377d597 100644 --- a/go.mod +++ b/go.mod @@ -1,9 +1,10 @@ module github.com/ethereum/go-ethereum -go 1.18 +go 1.19 require ( github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0 + github.com/BurntSushi/toml v1.1.0 github.com/JekaMas/go-grpc-net-conn v0.0.0-20220708155319-6aff21f2d13d github.com/VictoriaMetrics/fastcache v1.6.0 github.com/aws/aws-sdk-go-v2 v1.2.0 @@ -31,6 +32,7 @@ require ( github.com/google/uuid v1.2.0 github.com/gorilla/websocket v1.4.2 github.com/graph-gophers/graphql-go v1.3.0 + github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 github.com/hashicorp/go-bexpr v0.1.10 github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d github.com/hashicorp/hcl/v2 v2.10.1 @@ -44,11 +46,11 @@ require ( github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e github.com/julienschmidt/httprouter v1.3.0 github.com/karalabe/usb v0.0.2 + github.com/maticnetwork/polyproto v0.0.2 github.com/mattn/go-colorable v0.1.8 github.com/mattn/go-isatty v0.0.12 github.com/mitchellh/cli v1.1.2 github.com/mitchellh/go-homedir v1.1.0 - github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416 github.com/olekukonko/tablewriter v0.0.5 github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 github.com/prometheus/tsdb v0.7.1 @@ -66,21 +68,22 @@ require ( go.opentelemetry.io/otel/sdk v1.2.0 go.uber.org/goleak v1.1.12 golang.org/x/crypto v0.0.0-20220507011949-2cf3adece122 - golang.org/x/sync v0.0.0-20210220032951-036812b2e83c - golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 + golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 + golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 golang.org/x/text v0.3.7 golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba - golang.org/x/tools v0.1.10 - google.golang.org/grpc v1.47.0 + golang.org/x/tools v0.1.12 + google.golang.org/grpc v1.48.0 google.golang.org/protobuf v1.28.0 gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6 gopkg.in/urfave/cli.v1 v1.20.0 gotest.tools v2.2.0+incompatible - pgregory.net/rapid v0.4.7 + pgregory.net/rapid v0.4.8 ) require ( + git.sr.ht/~sbinet/gg v0.3.1 // indirect github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 // indirect github.com/Masterminds/goutils v1.1.0 // indirect @@ -88,6 +91,7 @@ require ( github.com/Masterminds/sprig v2.22.0+incompatible // indirect github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect github.com/agext/levenshtein v1.2.1 // indirect + github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2 // indirect @@ -101,10 +105,13 @@ require ( github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect github.com/deepmap/oapi-codegen v1.8.2 // indirect github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91 // indirect - github.com/go-kit/kit v0.9.0 // indirect + github.com/go-fonts/liberation v0.2.0 // indirect + github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81 // indirect github.com/go-logfmt/logfmt v0.5.0 // indirect github.com/go-ole/go-ole v1.2.1 // indirect + github.com/go-pdf/fpdf v0.6.0 // indirect github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect + github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 // indirect github.com/google/go-cmp v0.5.8 // indirect github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect github.com/hashicorp/errwrap v1.0.0 // indirect @@ -118,7 +125,6 @@ require ( github.com/mitchellh/mapstructure v1.4.1 // indirect github.com/mitchellh/pointerstructure v1.2.0 // indirect github.com/mitchellh/reflectwalk v1.0.0 // indirect - github.com/naoina/go-stringutil v0.1.0 // indirect github.com/opentracing/opentracing-go v1.1.0 // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect @@ -129,11 +135,15 @@ require ( go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.2.0 // indirect go.opentelemetry.io/otel/trace v1.2.0 // indirect go.opentelemetry.io/proto/otlp v0.10.0 // indirect - golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 // indirect - golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 // indirect - golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect + golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e // indirect + golang.org/x/image v0.0.0-20220722155232-062f8c9fd539 // indirect + golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect + golang.org/x/net v0.0.0-20220728030405-41545e8bf201 // indirect + golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f // indirect - google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect + gonum.org/v1/gonum v0.11.0 // indirect + gonum.org/v1/plot v0.11.0 // indirect + google.golang.org/genproto v0.0.0-20220725144611-272f38e5d71b // indirect gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index e20575ddaa..514e6bbacd 100644 --- a/go.sum +++ b/go.sum @@ -18,6 +18,8 @@ cloud.google.com/go/storage v1.0.0/go.mod h1:IhtSnM/ZTZV8YYJWCY8RULGVqBDmpoyjwiy cloud.google.com/go/storage v1.5.0/go.mod h1:tpKbwo567HUNpVclU5sGELwQWBDZ8gh0ZeosJ0Rtdos= collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= +git.sr.ht/~sbinet/gg v0.3.1 h1:LNhjNn8DerC8f9DHLz6lS0YYul/b602DUxDgGkd/Aik= +git.sr.ht/~sbinet/gg v0.3.1/go.mod h1:KGYtlADtqsqANL9ueOFkWymvzUvLMQllU5Ixo+8v3pc= github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1 h1:qoVeMsc9/fh/yhxVaA0obYjVH/oI/ihrOoMwsLS9KSA= github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3 h1:E+m3SkZCN0Bf5q7YdTs5lSm2CYY3CK4spn5OmUIiQtk= @@ -25,6 +27,8 @@ github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSu github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0 h1:Px2UA+2RvSSvv+RvJNuUB6n7rs5Wsel4dXLe90Um2n4= github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I= +github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= github.com/JekaMas/go-grpc-net-conn v0.0.0-20220708155319-6aff21f2d13d h1:RO27lgfZF8s9lZ3pWyzc0gCE0RZC+6/PXbRjAa0CNp8= @@ -42,7 +46,11 @@ github.com/VictoriaMetrics/fastcache v1.6.0 h1:C/3Oi3EiBCqufydp1neRZkqcwmEiuRT9c github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= github.com/agext/levenshtein v1.2.1 h1:QmvMAjj2aEICytGiWzmxoE0x2KZvE0fvmqMOfy2tjT8= github.com/agext/levenshtein v1.2.1/go.mod h1:JEDfjyjHDjOF/1e4FlBE/PkbqA9OfWu2ki2W0IB5558= +github.com/ajstarks/deck v0.0.0-20200831202436-30c9fc6549a9/go.mod h1:JynElWSGnm/4RlzPXRlREEwqTHAN3T56Bv2ITsFT3gY= +github.com/ajstarks/deck/generate v0.0.0-20210309230005-c3f852c02e19/go.mod h1:T13YZdzov6OU0A1+RfKZiZN9ca6VeKdBdyDV+BY97Tk= github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= +github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b h1:slYM766cy2nI3BwyRiyQj/Ud48djTMtMebDqepE95rw= +github.com/ajstarks/svgo v0.0.0-20211024235047-1546f124cd8b/go.mod h1:1KcenG0jGWcpt8ov532z81sp/kMMUG485J2InIOyADM= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= @@ -80,6 +88,8 @@ github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= +github.com/boombuler/barcode v1.0.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= +github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= github.com/btcsuite/btcd/btcec/v2 v2.1.2 h1:YoYoC9J0jwfukodSBMzZYUVQ8PTiYg4BnOWiJVzTmLs= github.com/btcsuite/btcd/btcec/v2 v2.1.2/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0 h1:MSskdM4/xJYcFzy0altH/C/xHopifpWzHUi1JeVI34Q= @@ -152,6 +162,7 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 h1:FtmdgXiUlNeRsoNMFlKLDt+S+6hbjVMEW6RGQ7aUf7c= github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= +github.com/fogleman/gg v1.3.0/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9 h1:hsms1Qyu0jgnwNXIxa+/V/PDsU6CfLf6CNO8H7IWoS4= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= @@ -163,11 +174,18 @@ github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeME github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= +github.com/go-fonts/dejavu v0.1.0/go.mod h1:4Wt4I4OU2Nq9asgDCteaAaWZOV24E+0/Pwo0gppep4g= +github.com/go-fonts/latin-modern v0.2.0/go.mod h1:rQVLdDMK+mK1xscDwsqM5J8U2jrRa3T0ecnM9pNujks= +github.com/go-fonts/liberation v0.2.0 h1:jAkAWJP4S+OsrPLZM4/eC9iW7CtHy+HBXrEwZXWo5VM= +github.com/go-fonts/liberation v0.2.0/go.mod h1:K6qoJYypsmfVjWg8KOVDQhLc8UDgIK2HYqyqAO9z7GY= +github.com/go-fonts/stix v0.1.0/go.mod h1:w/c1f0ldAUlJmLBvlbkvVXLAD+tAMqobIIQpmnUIzUY= github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0 h1:wDJmvq38kDhkVxi50ni9ykkdUr1PKgqKOoi01fa0Mdk= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81 h1:6zl3BbBhdnMkpSj2YY30qV3gDcVBGtFgVsV3+/i+mKQ= +github.com/go-latex/latex v0.0.0-20210823091927-c0d11ff05a81/go.mod h1:SX0U8uGpxhq9o2S/CELCSUxEWWAuoCUcVCQWv7G2OCk= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= github.com/go-logfmt/logfmt v0.5.0 h1:TrB8swr/68K7m9CcGut2g3UOihhbcbiMAYiuTXdEih4= @@ -176,6 +194,9 @@ github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-pdf/fpdf v0.5.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= +github.com/go-pdf/fpdf v0.6.0 h1:MlgtGIfsdMEEQJr2le6b/HNr1ZlQwxyWr77r2aj2U/8= +github.com/go-pdf/fpdf v0.6.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M= github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU= github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= @@ -186,8 +207,10 @@ github.com/go-test/deep v1.0.3/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3a github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/golang-jwt/jwt/v4 v4.3.0 h1:kHL1vqdqWNfATmA0FNMdmZNMyZI1U6O31X4rlIPoBog= github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= +github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0 h1:DACJavvAHhabrF08vX0COfcOBJRhZ8lUbR+ZWIs0Y5g= github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= @@ -252,6 +275,8 @@ github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0U github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/graph-gophers/graphql-go v1.3.0 h1:Eb9x/q6MFpCLz7jBCiP/WTxjSDrYLR1QY41SORZyNJ0= github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= +github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA= @@ -308,11 +333,13 @@ github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfV github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0 h1:U0609e9tgbseu3rBINet9P48AI/D3oJs4dN7jwJOQ1U= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= +github.com/jung-kurt/gofpdf v1.0.0/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= github.com/karalabe/usb v0.0.2 h1:M6QQBNxF+CQ8OFvxrT90BA0qBOXymndZnk5q235mFc4= github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= @@ -337,6 +364,8 @@ github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2 github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/maticnetwork/polyproto v0.0.2 h1:cPxuxbIDItdwGnucc3lZB58U8Zfe1mH73PWTGd15554= +github.com/maticnetwork/polyproto v0.0.2/go.mod h1:e1mU2EXSwEpn5jM7GfNwu3AupsV6WAGoPFFfswXOF0o= github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= @@ -374,10 +403,6 @@ github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3Rllmb github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= -github.com/naoina/go-stringutil v0.1.0 h1:rCUeRUHjBjGTSHl0VC00jUPLz8/F9dDzYI70Hzifhks= -github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= -github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416 h1:shk/vn9oCoOTmwcouEdwIeOtOGA/ELRUw/GwvxwfT+0= -github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= @@ -399,6 +424,9 @@ github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHu github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7 h1:oYW+YCJ1pachXTQmzR3rNLYGGz4g/UgFcjb28p/viDM= github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= +github.com/phpdave11/gofpdf v1.4.2/go.mod h1:zpO6xFn9yxo3YLyMvW8HcKWVdbNqgIfOOp2dXMnm1mY= +github.com/phpdave11/gofpdi v1.0.12/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= +github.com/phpdave11/gofpdi v1.0.13/go.mod h1:vBmVV0Do6hSBHC8uKUQ71JGW+ZGQq74llk/7bXwjDoI= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= @@ -429,6 +457,8 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/ruudk/golang-pdf417 v0.0.0-20181029194003-1af4ab5afa58/go.mod h1:6lfFZQK844Gfx8o5WFuvpxWRwnSoipWe/p622j1v06w= +github.com/ruudk/golang-pdf417 v0.0.0-20201230142125-a7e3863a1245/go.mod h1:pQAZKsJ8yyVxGRWYNEm9oFB8ieLgKFnamEyDmSA0BRk= github.com/ryanuber/columnize v2.1.2+incompatible h1:C89EOx/XBWwIXl8wm8OPJBd7kPF25UfsK2X7Ph/zCAk= github.com/ryanuber/columnize v2.1.2+incompatible/go.mod h1:sm1tb6uqfes/u+d4ooFouqFdy9/2g9QGwK3SQygK0Ts= github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= @@ -439,6 +469,7 @@ github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible h1 github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= +github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= @@ -481,6 +512,7 @@ github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPyS github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/xsleonard/go-merkle v1.1.0 h1:fHe1fuhJjGH22ZzVTAH0jqHLhTGhOq3wQjJN+8P0jQg= github.com/xsleonard/go-merkle v1.1.0/go.mod h1:cW4z+UZ/4f2n9IJgIiyDCdYguchoDyDAPmpuOWGxdGg= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/zclconf/go-cty v1.2.0/go.mod h1:hOPWgoHbaTUnI5k4D2ld+GRpFJSCe6bCM7m1q/N4PQ8= @@ -504,10 +536,12 @@ go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqe go.opentelemetry.io/proto/otlp v0.10.0 h1:n7brgtEbDvXEgGyKKo8SobKT1e9FewlDtXzkVP5djoE= go.opentelemetry.io/proto/otlp v0.10.0/go.mod h1:zG20xCK0szZ1xdokeSOwEcmlXu+x9kkdRe6N1DhKcfU= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -531,9 +565,20 @@ golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm0 golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e h1:+WEEuIdZHnUeJJmEUjyYC2gfUMj69yZXw17EnHg/otA= +golang.org/x/exp v0.0.0-20220722155223-a9213eeb770e/go.mod h1:Kr81I6Kryrl9sr8s2FK3vxD90NdsKWRuOIl2O4CvYbA= golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20190910094157-69e4b8554b2a/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20200119044424-58c23975cae1/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20200430140353-33d19683fad8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20201208152932-35266b937fa6/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= +golang.org/x/image v0.0.0-20210607152325-775e3b0c77b9/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= +golang.org/x/image v0.0.0-20210628002857-a66eb6448b8d/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= +golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM= +golang.org/x/image v0.0.0-20220722155232-062f8c9fd539 h1:/eM0PCrQI2xd471rI+snWuu251/+/jpBpZqir2mPdnU= +golang.org/x/image v0.0.0-20220722155232-062f8c9fd539/go.mod h1:doUCurBvlfPMKfmIpRIywoHmhN3VyhnoFDbvIEWF4hY= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -548,10 +593,13 @@ golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCc golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o= golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 h1:6zppjxzCulZykYSLyVDYbneBfbaBIQPYMevg0bEwv2s= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180811021610-c39426892332/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -568,6 +616,7 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= @@ -580,8 +629,8 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2 h1:CIJ76btIcR3eFI5EgSo6k1qKw9KJexJuRLI9G7Hp5wE= -golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220728030405-41545e8bf201 h1:bvOltf3SADAfG05iRml8lAB3qjoEX5RCyN4K6G5v3N0= +golang.org/x/net v0.0.0-20220728030405-41545e8bf201/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -596,6 +645,8 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c h1:5KslGYwFpkhGh+Q16bwMP3cOontH8FOep7tGV86Y7SQ= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 h1:uVc8UZUe6tr40fFVnUP5Oj+veunVezqYl9z7DYw9xzw= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -605,6 +656,7 @@ golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502175342-a43fa875dd82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190507160741-ecd444e8653b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -636,11 +688,12 @@ golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423185535-09eb48e85fd7/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6 h1:nonptSpoQ4vQjyraW20DXPAglgQfVnM9ZC6MmNLMR60= -golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10 h1:WIoqL4EROvwiPdUtaip4VcDdpZ4kha7wBWZrbVKCIZg= +golang.org/x/sys v0.0.0-20220728004956-3c1f35247d10/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= -golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= @@ -681,11 +734,15 @@ golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200108203644-89082a384178/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0= golang.org/x/tools v0.1.1/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.10 h1:QjFRCZxdOhBJ/UNgnBZLbNV13DlbnK0quyivTnXJM20= golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= +golang.org/x/tools v0.1.12 h1:VveCTK38A2rkS8ZqFY25HIDFscX5X9OoEhJd3quQmXU= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -695,9 +752,13 @@ golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8T gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= +gonum.org/v1/gonum v0.11.0 h1:f1IJhK4Km5tBJmaiJXtk/PkL4cdVX6J+tGiM187uT5E= +gonum.org/v1/gonum v0.11.0/go.mod h1:fSG4YDCxxUZQJ7rKsQrj0gMOg00Il0Z96/qMA4bVQhA= gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= +gonum.org/v1/plot v0.11.0 h1:z2ZkgNqW34d0oYUzd80RRlc0L9kWtenqK4kflZG1lGc= +gonum.org/v1/plot v0.11.0/go.mod h1:fH9YnKnDKax0u5EzHVXvhN5HJwtMFWIOLNuhgUahbCQ= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= google.golang.org/api v0.8.0/go.mod h1:o4eAsZoiT+ibD93RtjEohWalFOjRDx6CVaqeizhEnKg= @@ -724,9 +785,11 @@ google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200108215221-bd8f9a0ef82f/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= +google.golang.org/genproto v0.0.0-20200423170343-7949de9c1215/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfGQM9UVYDPBsyGGes0y52j32PQ3BqQfXhyH3c= -google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 h1:+kGHl1aib/qcwaRi1CbqBZ1rk19r85MNUf8HaBghugY= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= +google.golang.org/genproto v0.0.0-20220725144611-272f38e5d71b h1:SfSkJugek6xm7lWywqth4r2iTrYLpD8lOj1nMIIhMNM= +google.golang.org/genproto v0.0.0-20220725144611-272f38e5d71b/go.mod h1:iHe1svFLAZg9VWz891+QbRMwUv9O/1Ww+/mngYeThbc= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38= google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= @@ -734,12 +797,13 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/grpc v1.29.1/go.mod h1:itym6AZVZYACWQqET3MqgPpjcuV5QH3BxFS3IjizoKk= google.golang.org/grpc v1.33.1/go.mod h1:fr5YgcSWrqhRRxogOsw7RzIpsmvOZ6IcH4kBYTpR3n0= google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAGRRjU= google.golang.org/grpc v1.41.0/go.mod h1:U3l9uK9J0sini8mHphKoXyaqDA/8VyGnDee1zzIUK6k= google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU= -google.golang.org/grpc v1.47.0 h1:9n77onPX5F3qfFCqjy9dhn8PbNQsIKeVU04J9G7umt8= -google.golang.org/grpc v1.47.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= +google.golang.org/grpc v1.48.0 h1:rQOsyJ/8+ufEDJd/Gdsz7HG220Mh9HAhFHRGnIjda0w= +google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACuMGWk= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= @@ -789,7 +853,7 @@ honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= -pgregory.net/rapid v0.4.7 h1:MTNRktPuv5FNqOO151TM9mDTa+XHcX6ypYeISDVD14g= -pgregory.net/rapid v0.4.7/go.mod h1:UYpPVyjFHzYBGHIxLFoupi8vwk6rXNzRY9OMvVxFIOU= +pgregory.net/rapid v0.4.8 h1:d+5SGZWUbJPbl3ss6tmPFqnNeQR6VDOFly+eTjwPiEw= +pgregory.net/rapid v0.4.8/go.mod h1:Z5PbWqjvWR1I3UGjvboUuan4fe4ZYEYNLNQLExzCoUs= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/internal/cli/command.go b/internal/cli/command.go index 1ff95b410f..93dca4cb3e 100644 --- a/internal/cli/command.go +++ b/internal/cli/command.go @@ -82,6 +82,11 @@ func Commands() map[string]MarkDownCommandFactory { UI: ui, }, nil }, + "dumpconfig": func() (MarkDownCommand, error) { + return &DumpconfigCommand{ + Meta2: meta2, + }, nil + }, "debug": func() (MarkDownCommand, error) { return &DebugCommand{ UI: ui, @@ -179,6 +184,11 @@ func Commands() map[string]MarkDownCommandFactory { UI: ui, }, nil }, + "removedb": func() (MarkDownCommand, error) { + return &RemoveDBCommand{ + Meta2: meta2, + }, nil + }, } } diff --git a/internal/cli/debug_test.go b/internal/cli/debug_test.go index 94765ddba7..fd896ef326 100644 --- a/internal/cli/debug_test.go +++ b/internal/cli/debug_test.go @@ -13,7 +13,7 @@ import ( "github.com/ethereum/go-ethereum/internal/cli/server" ) -var currentDir string = "" +var currentDir string func TestCommand_DebugBlock(t *testing.T) { t.Parallel() diff --git a/internal/cli/dumpconfig.go b/internal/cli/dumpconfig.go new file mode 100644 index 0000000000..dad0be923d --- /dev/null +++ b/internal/cli/dumpconfig.go @@ -0,0 +1,68 @@ +package cli + +import ( + "os" + "strings" + + "github.com/BurntSushi/toml" + + "github.com/ethereum/go-ethereum/internal/cli/server" +) + +// DumpconfigCommand is for exporting user provided flags into a config file +type DumpconfigCommand struct { + *Meta2 +} + +// MarkDown implements cli.MarkDown interface +func (p *DumpconfigCommand) MarkDown() string { + items := []string{ + "# Dumpconfig", + "The ```bor dumpconfig ``` command will export the user provided flags into a configuration file", + } + + return strings.Join(items, "\n\n") +} + +// Help implements the cli.Command interface +func (c *DumpconfigCommand) Help() string { + return `Usage: bor dumpconfig + + This command will will export the user provided flags into a configuration file` +} + +// Synopsis implements the cli.Command interface +func (c *DumpconfigCommand) Synopsis() string { + return "Export configuration file" +} + +// TODO: add flags for file location and format (toml, json, hcl) of the configuration file. + +// Run implements the cli.Command interface +func (c *DumpconfigCommand) Run(args []string) int { + // Initialize an empty command instance to get flags + command := server.Command{} + flags := command.Flags() + + if err := flags.Parse(args); err != nil { + c.UI.Error(err.Error()) + return 1 + } + + userConfig := command.GetConfig() + + // convert the big.Int and time.Duration fields to their corresponding Raw fields + userConfig.TxPool.RejournalRaw = userConfig.TxPool.Rejournal.String() + userConfig.TxPool.LifeTimeRaw = userConfig.TxPool.LifeTime.String() + userConfig.Sealer.GasPriceRaw = userConfig.Sealer.GasPrice.String() + userConfig.Gpo.MaxPriceRaw = userConfig.Gpo.MaxPrice.String() + userConfig.Gpo.IgnorePriceRaw = userConfig.Gpo.IgnorePrice.String() + userConfig.Cache.RejournalRaw = userConfig.Cache.Rejournal.String() + + if err := toml.NewEncoder(os.Stdout).Encode(userConfig); err != nil { + c.UI.Error(err.Error()) + return 1 + } + + return 0 +} diff --git a/internal/cli/flagset/flagset.go b/internal/cli/flagset/flagset.go index 0c19fa9758..d9e204f0e4 100644 --- a/internal/cli/flagset/flagset.go +++ b/internal/cli/flagset/flagset.go @@ -180,14 +180,15 @@ func (b *BigIntFlag) Set(value string) error { var ok bool if strings.HasPrefix(value, "0x") { num, ok = num.SetString(value[2:], 16) + *b.Value = *num } else { num, ok = num.SetString(value, 10) + *b.Value = *num } if !ok { return fmt.Errorf("failed to set big int") } - b.Value = num return nil } @@ -209,6 +210,19 @@ type SliceStringFlag struct { Group string } +// SplitAndTrim splits input separated by a comma +// and trims excessive white space from the substrings. +func SplitAndTrim(input string) (ret []string) { + l := strings.Split(input, ",") + for _, r := range l { + if r = strings.TrimSpace(r); r != "" { + ret = append(ret, r) + } + } + + return ret +} + func (i *SliceStringFlag) String() string { if i.Value == nil { return "" @@ -219,7 +233,7 @@ func (i *SliceStringFlag) String() string { func (i *SliceStringFlag) Set(value string) error { // overwritting insted of appending - *i.Value = strings.Split(value, ",") + *i.Value = SplitAndTrim(value) return nil } diff --git a/internal/cli/removedb.go b/internal/cli/removedb.go new file mode 100644 index 0000000000..4a604086ed --- /dev/null +++ b/internal/cli/removedb.go @@ -0,0 +1,154 @@ +package cli + +import ( + "fmt" + "os" + "path/filepath" + "strings" + "time" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/internal/cli/flagset" + "github.com/ethereum/go-ethereum/internal/cli/server" + "github.com/ethereum/go-ethereum/log" + "github.com/ethereum/go-ethereum/node" + + "github.com/mitchellh/cli" +) + +// RemoveDBCommand is for removing blockchain and state databases +type RemoveDBCommand struct { + *Meta2 + + datadir string +} + +const ( + chaindataPath string = "chaindata" + ancientPath string = "ancient" + lightchaindataPath string = "lightchaindata" +) + +// MarkDown implements cli.MarkDown interface +func (c *RemoveDBCommand) MarkDown() string { + items := []string{ + "# RemoveDB", + "The ```bor removedb``` command will remove the blockchain and state databases at the given datadir location", + c.Flags().MarkDown(), + } + + return strings.Join(items, "\n\n") +} + +// Help implements the cli.Command interface +func (c *RemoveDBCommand) Help() string { + return `Usage: bor removedb + + This command will remove the blockchain and state databases at the given datadir location` +} + +// Synopsis implements the cli.Command interface +func (c *RemoveDBCommand) Synopsis() string { + return "Remove blockchain and state databases" +} + +func (c *RemoveDBCommand) Flags() *flagset.Flagset { + flags := c.NewFlagSet("removedb") + + flags.StringFlag(&flagset.StringFlag{ + Name: "datadir", + Value: &c.datadir, + Usage: "Path of the data directory to store information", + }) + + return flags +} + +// Run implements the cli.Command interface +func (c *RemoveDBCommand) Run(args []string) int { + flags := c.Flags() + + // parse datadir + if err := flags.Parse(args); err != nil { + c.UI.Error(err.Error()) + return 1 + } + + datadir := c.datadir + if datadir == "" { + datadir = server.DefaultDataDir() + } + + // create ethereum node config with just the datadir + nodeCfg := &node.Config{DataDir: datadir} + + // Remove the full node state database + path := nodeCfg.ResolvePath(chaindataPath) + if common.FileExist(path) { + confirmAndRemoveDB(c.UI, path, "full node state database") + } else { + log.Info("Full node state database missing", "path", path) + } + + // Remove the full node ancient database + // Note: The old cli used DatabaseFreezer path from config if provided explicitly + // We don't have access to eth config and hence we assume it to be + // under the "chaindata" folder. + path = filepath.Join(nodeCfg.ResolvePath(chaindataPath), ancientPath) + if common.FileExist(path) { + confirmAndRemoveDB(c.UI, path, "full node ancient database") + } else { + log.Info("Full node ancient database missing", "path", path) + } + + // Remove the light node database + path = nodeCfg.ResolvePath(lightchaindataPath) + if common.FileExist(path) { + confirmAndRemoveDB(c.UI, path, "light node database") + } else { + log.Info("Light node database missing", "path", path) + } + + return 0 +} + +// confirmAndRemoveDB prompts the user for a last confirmation and removes the +// folder if accepted. +func confirmAndRemoveDB(ui cli.Ui, database string, kind string) { + for { + confirm, err := ui.Ask(fmt.Sprintf("Remove %s (%s)? [y/n]", kind, database)) + + switch { + case err != nil: + ui.Output(err.Error()) + return + case confirm != "": + switch strings.ToLower(confirm) { + case "y": + start := time.Now() + err = filepath.Walk(database, func(path string, info os.FileInfo, err error) error { + // If we're at the top level folder, recurse into + if path == database { + return nil + } + // Delete all the files, but not subfolders + if !info.IsDir() { + return os.Remove(path) + } + return filepath.SkipDir + }) + + if err != nil && err != filepath.SkipDir { + ui.Output(err.Error()) + } else { + log.Info("Database successfully deleted", "path", database, "elapsed", common.PrettyDuration(time.Since(start))) + } + + return + case "n": + log.Info("Database deletion skipped", "path", database) + return + } + } + } +} diff --git a/internal/cli/server/command.go b/internal/cli/server/command.go index a0b8a6d87c..aeb435a361 100644 --- a/internal/cli/server/command.go +++ b/internal/cli/server/command.go @@ -7,8 +7,9 @@ import ( "strings" "syscall" - "github.com/ethereum/go-ethereum/log" "github.com/mitchellh/cli" + + "github.com/ethereum/go-ethereum/log" ) // Command is the command to start the sever @@ -21,7 +22,7 @@ type Command struct { // final configuration config *Config - configFile []string + configFile string srv *Server } @@ -50,34 +51,57 @@ func (c *Command) Synopsis() string { return "Run the Bor server" } -// Run implements the cli.Command interface -func (c *Command) Run(args []string) int { +func (c *Command) extractFlags(args []string) error { + config := *DefaultConfig() + flags := c.Flags() if err := flags.Parse(args); err != nil { c.UI.Error(err.Error()) - return 1 + c.config = &config + + return err } - // read config file - config := DefaultConfig() - for _, configFile := range c.configFile { - cfg, err := readConfigFile(configFile) + // TODO: Check if this can be removed or not + // read cli flags + if err := config.Merge(c.cliConfig); err != nil { + c.UI.Error(err.Error()) + c.config = &config + + return err + } + // read if config file is provided, this will overwrite the cli flags, if provided + if c.configFile != "" { + log.Warn("Config File provided, this will overwrite the cli flags", "path", c.configFile) + cfg, err := readConfigFile(c.configFile) if err != nil { c.UI.Error(err.Error()) - return 1 + c.config = &config + + return err } if err := config.Merge(cfg); err != nil { c.UI.Error(err.Error()) - return 1 + c.config = &config + + return err } } - if err := config.Merge(c.cliConfig); err != nil { + + c.config = &config + + return nil +} + +// Run implements the cli.Command interface +func (c *Command) Run(args []string) int { + err := c.extractFlags(args) + if err != nil { c.UI.Error(err.Error()) return 1 } - c.config = config - srv, err := NewServer(config) + srv, err := NewServer(c.config, WithGRPCAddress()) if err != nil { c.UI.Error(err.Error()) return 1 @@ -112,3 +136,8 @@ func (c *Command) handleSignals() int { } return 1 } + +// GetConfig returns the user specified config +func (c *Command) GetConfig() *Config { + return c.cliConfig +} diff --git a/internal/cli/server/command_test.go b/internal/cli/server/command_test.go new file mode 100644 index 0000000000..9006559d0f --- /dev/null +++ b/internal/cli/server/command_test.go @@ -0,0 +1,50 @@ +package server + +import ( + "math/big" + "testing" + "time" + + "github.com/stretchr/testify/require" +) + +func TestFlags(t *testing.T) { + t.Parallel() + + var c Command + + args := []string{ + "--txpool.rejournal", "30m0s", + "--txpool.lifetime", "30m0s", + "--miner.gasprice", "20000000000", + "--gpo.maxprice", "70000000000", + "--gpo.ignoreprice", "1", + "--cache.trie.rejournal", "40m0s", + "--dev", + "--dev.period", "2", + "--datadir", "./data", + "--maxpeers", "30", + "--requiredblocks", "a=b", + "--http.api", "eth,web3,bor", + } + err := c.extractFlags(args) + + require.NoError(t, err) + + txRe, _ := time.ParseDuration("30m0s") + txLt, _ := time.ParseDuration("30m0s") + caRe, _ := time.ParseDuration("40m0s") + + require.Equal(t, c.config.DataDir, "./data") + require.Equal(t, c.config.Developer.Enabled, true) + require.Equal(t, c.config.Developer.Period, uint64(2)) + require.Equal(t, c.config.TxPool.Rejournal, txRe) + require.Equal(t, c.config.TxPool.LifeTime, txLt) + require.Equal(t, c.config.Sealer.GasPrice, big.NewInt(20000000000)) + require.Equal(t, c.config.Gpo.MaxPrice, big.NewInt(70000000000)) + require.Equal(t, c.config.Gpo.IgnorePrice, big.NewInt(1)) + require.Equal(t, c.config.Cache.Rejournal, caRe) + require.Equal(t, c.config.P2P.MaxPeers, uint64(30)) + require.Equal(t, c.config.RequiredBlocks, map[string]string{"a": "b"}) + require.Equal(t, c.config.JsonRPC.Http.API, []string{"eth", "web3", "bor"}) +} diff --git a/internal/cli/server/config.go b/internal/cli/server/config.go index fdf253a37e..c6193e6e76 100644 --- a/internal/cli/server/config.go +++ b/internal/cli/server/config.go @@ -14,6 +14,11 @@ import ( godebug "runtime/debug" + "github.com/hashicorp/hcl/v2/hclsimple" + "github.com/imdario/mergo" + "github.com/mitchellh/go-homedir" + gopsutil "github.com/shirou/gopsutil/mem" + "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/accounts/keystore" "github.com/ethereum/go-ethereum/common" @@ -28,360 +33,359 @@ import ( "github.com/ethereum/go-ethereum/p2p/enode" "github.com/ethereum/go-ethereum/p2p/nat" "github.com/ethereum/go-ethereum/params" - "github.com/hashicorp/hcl/v2/hclsimple" - "github.com/imdario/mergo" - "github.com/mitchellh/go-homedir" - gopsutil "github.com/shirou/gopsutil/mem" ) type Config struct { chain *chains.Chain // Chain is the chain to sync with - Chain string `hcl:"chain,optional"` + Chain string `hcl:"chain,optional" toml:"chain,optional"` // Identity of the node - Identity string `hcl:"identity,optional"` + Identity string `hcl:"identity,optional" toml:"identity,optional"` // RequiredBlocks is a list of required (block number, hash) pairs to accept - RequiredBlocks map[string]string `hcl:"requiredblocks,optional"` + RequiredBlocks map[string]string `hcl:"requiredblocks,optional" toml:"requiredblocks,optional"` // LogLevel is the level of the logs to put out - LogLevel string `hcl:"log-level,optional"` + LogLevel string `hcl:"log-level,optional" toml:"log-level,optional"` // DataDir is the directory to store the state in - DataDir string `hcl:"data-dir,optional"` + DataDir string `hcl:"datadir,optional" toml:"datadir,optional"` // KeyStoreDir is the directory to store keystores - KeyStoreDir string `hcl:"keystore-dir,optional"` + KeyStoreDir string `hcl:"keystore,optional" toml:"keystore,optional"` // SyncMode selects the sync protocol - SyncMode string `hcl:"sync-mode,optional"` + SyncMode string `hcl:"syncmode,optional" toml:"syncmode,optional"` // GcMode selects the garbage collection mode for the trie - GcMode string `hcl:"gc-mode,optional"` + GcMode string `hcl:"gcmode,optional" toml:"gcmode,optional"` // Snapshot disables/enables the snapshot database mode - Snapshot bool `hcl:"snapshot,optional"` + Snapshot bool `hcl:"snapshot,optional" toml:"snapshot,optional"` // Ethstats is the address of the ethstats server to send telemetry - Ethstats string `hcl:"ethstats,optional"` + Ethstats string `hcl:"ethstats,optional" toml:"ethstats,optional"` // P2P has the p2p network related settings - P2P *P2PConfig `hcl:"p2p,block"` + P2P *P2PConfig `hcl:"p2p,block" toml:"p2p,block"` // Heimdall has the heimdall connection related settings - Heimdall *HeimdallConfig `hcl:"heimdall,block"` + Heimdall *HeimdallConfig `hcl:"heimdall,block" toml:"heimdall,block"` // TxPool has the transaction pool related settings - TxPool *TxPoolConfig `hcl:"txpool,block"` + TxPool *TxPoolConfig `hcl:"txpool,block" toml:"txpool,block"` // Sealer has the validator related settings - Sealer *SealerConfig `hcl:"sealer,block"` + Sealer *SealerConfig `hcl:"miner,block" toml:"miner,block"` // JsonRPC has the json-rpc related settings - JsonRPC *JsonRPCConfig `hcl:"jsonrpc,block"` + JsonRPC *JsonRPCConfig `hcl:"jsonrpc,block" toml:"jsonrpc,block"` // Gpo has the gas price oracle related settings - Gpo *GpoConfig `hcl:"gpo,block"` + Gpo *GpoConfig `hcl:"gpo,block" toml:"gpo,block"` // Telemetry has the telemetry related settings - Telemetry *TelemetryConfig `hcl:"telemetry,block"` + Telemetry *TelemetryConfig `hcl:"telemetry,block" toml:"telemetry,block"` // Cache has the cache related settings - Cache *CacheConfig `hcl:"cache,block"` + Cache *CacheConfig `hcl:"cache,block" toml:"cache,block"` // Account has the validator account related settings - Accounts *AccountsConfig `hcl:"accounts,block"` + Accounts *AccountsConfig `hcl:"accounts,block" toml:"accounts,block"` // GRPC has the grpc server related settings - GRPC *GRPCConfig + GRPC *GRPCConfig `hcl:"grpc,block" toml:"grpc,block"` // Developer has the developer mode related settings - Developer *DeveloperConfig + Developer *DeveloperConfig `hcl:"developer,block" toml:"developer,block"` } type P2PConfig struct { // MaxPeers sets the maximum number of connected peers - MaxPeers uint64 `hcl:"max-peers,optional"` + MaxPeers uint64 `hcl:"maxpeers,optional" toml:"maxpeers,optional"` // MaxPendPeers sets the maximum number of pending connected peers - MaxPendPeers uint64 `hcl:"max-pend-peers,optional"` + MaxPendPeers uint64 `hcl:"maxpendpeers,optional" toml:"maxpendpeers,optional"` // Bind is the bind address - Bind string `hcl:"bind,optional"` + Bind string `hcl:"bind,optional" toml:"bind,optional"` // Port is the port number - Port uint64 `hcl:"port,optional"` + Port uint64 `hcl:"port,optional" toml:"port,optional"` // NoDiscover is used to disable discovery - NoDiscover bool `hcl:"no-discover,optional"` + NoDiscover bool `hcl:"nodiscover,optional" toml:"nodiscover,optional"` // NAT it used to set NAT options - NAT string `hcl:"nat,optional"` + NAT string `hcl:"nat,optional" toml:"nat,optional"` // Discovery has the p2p discovery related settings - Discovery *P2PDiscovery `hcl:"discovery,block"` + Discovery *P2PDiscovery `hcl:"discovery,block" toml:"discovery,block"` } type P2PDiscovery struct { // V5Enabled is used to enable disc v5 discovery mode - V5Enabled bool `hcl:"v5-enabled,optional"` + V5Enabled bool `hcl:"v5disc,optional" toml:"v5disc,optional"` // Bootnodes is the list of initial bootnodes - Bootnodes []string `hcl:"bootnodes,optional"` + Bootnodes []string `hcl:"bootnodes,optional" toml:"bootnodes,optional"` // BootnodesV4 is the list of initial v4 bootnodes - BootnodesV4 []string `hcl:"bootnodesv4,optional"` + BootnodesV4 []string `hcl:"bootnodesv4,optional" toml:"bootnodesv4,optional"` // BootnodesV5 is the list of initial v5 bootnodes - BootnodesV5 []string `hcl:"bootnodesv5,optional"` + BootnodesV5 []string `hcl:"bootnodesv5,optional" toml:"bootnodesv5,optional"` // StaticNodes is the list of static nodes - StaticNodes []string `hcl:"static-nodes,optional"` + StaticNodes []string `hcl:"static-nodes,optional" toml:"static-nodes,optional"` // TrustedNodes is the list of trusted nodes - TrustedNodes []string `hcl:"trusted-nodes,optional"` + TrustedNodes []string `hcl:"trusted-nodes,optional" toml:"trusted-nodes,optional"` // DNS is the list of enrtree:// URLs which will be queried for nodes to connect to - DNS []string `hcl:"dns,optional"` + DNS []string `hcl:"dns,optional" toml:"dns,optional"` } type HeimdallConfig struct { // URL is the url of the heimdall server - URL string `hcl:"url,optional"` + URL string `hcl:"url,optional" toml:"url,optional"` // Without is used to disable remote heimdall during testing - Without bool `hcl:"without,optional"` + Without bool `hcl:"bor.without,optional" toml:"bor.without,optional"` + + // GRPCAddress is the address of the heimdall grpc server + GRPCAddress string `hcl:"grpc-address,optional" toml:"grpc-address,optional"` } type TxPoolConfig struct { // Locals are the addresses that should be treated by default as local - Locals []string `hcl:"locals,optional"` + Locals []string `hcl:"locals,optional" toml:"locals,optional"` // NoLocals enables whether local transaction handling should be disabled - NoLocals bool `hcl:"no-locals,optional"` + NoLocals bool `hcl:"nolocals,optional" toml:"nolocals,optional"` // Journal is the path to store local transactions to survive node restarts - Journal string `hcl:"journal,optional"` + Journal string `hcl:"journal,optional" toml:"journal,optional"` // Rejournal is the time interval to regenerate the local transaction journal - Rejournal time.Duration - RejournalRaw string `hcl:"rejournal,optional"` + Rejournal time.Duration `hcl:"-,optional" toml:"-"` + RejournalRaw string `hcl:"rejournal,optional" toml:"rejournal,optional"` // PriceLimit is the minimum gas price to enforce for acceptance into the pool - PriceLimit uint64 `hcl:"price-limit,optional"` + PriceLimit uint64 `hcl:"pricelimit,optional" toml:"pricelimit,optional"` // PriceBump is the minimum price bump percentage to replace an already existing transaction (nonce) - PriceBump uint64 `hcl:"price-bump,optional"` + PriceBump uint64 `hcl:"pricebump,optional" toml:"pricebump,optional"` // AccountSlots is the number of executable transaction slots guaranteed per account - AccountSlots uint64 `hcl:"account-slots,optional"` + AccountSlots uint64 `hcl:"accountslots,optional" toml:"accountslots,optional"` // GlobalSlots is the maximum number of executable transaction slots for all accounts - GlobalSlots uint64 `hcl:"global-slots,optional"` + GlobalSlots uint64 `hcl:"globalslots,optional" toml:"globalslots,optional"` // AccountQueue is the maximum number of non-executable transaction slots permitted per account - AccountQueue uint64 `hcl:"account-queue,optional"` + AccountQueue uint64 `hcl:"accountqueue,optional" toml:"accountqueue,optional"` // GlobalQueueis the maximum number of non-executable transaction slots for all accounts - GlobalQueue uint64 `hcl:"global-queue,optional"` + GlobalQueue uint64 `hcl:"globalqueue,optional" toml:"globalqueue,optional"` - // Lifetime is the maximum amount of time non-executable transaction are queued - LifeTime time.Duration - LifeTimeRaw string `hcl:"lifetime,optional"` + // lifetime is the maximum amount of time non-executable transaction are queued + LifeTime time.Duration `hcl:"-,optional" toml:"-"` + LifeTimeRaw string `hcl:"lifetime,optional" toml:"lifetime,optional"` } type SealerConfig struct { // Enabled is used to enable validator mode - Enabled bool `hcl:"enabled,optional"` + Enabled bool `hcl:"mine,optional" toml:"mine,optional"` // Etherbase is the address of the validator - Etherbase string `hcl:"etherbase,optional"` + Etherbase string `hcl:"etherbase,optional" toml:"etherbase,optional"` // ExtraData is the block extra data set by the miner - ExtraData string `hcl:"extra-data,optional"` + ExtraData string `hcl:"extradata,optional" toml:"extradata,optional"` // GasCeil is the target gas ceiling for mined blocks. - GasCeil uint64 `hcl:"gas-ceil,optional"` + GasCeil uint64 `hcl:"gaslimit,optional" toml:"gaslimit,optional"` // GasPrice is the minimum gas price for mining a transaction - GasPrice *big.Int - GasPriceRaw string `hcl:"gas-price,optional"` + GasPrice *big.Int `hcl:"-,optional" toml:"-"` + GasPriceRaw string `hcl:"gasprice,optional" toml:"gasprice,optional"` } type JsonRPCConfig struct { // IPCDisable enables whether ipc is enabled or not - IPCDisable bool `hcl:"ipc-disable,optional"` + IPCDisable bool `hcl:"ipcdisable,optional" toml:"ipcdisable,optional"` // IPCPath is the path of the ipc endpoint - IPCPath string `hcl:"ipc-path,optional"` + IPCPath string `hcl:"ipcpath,optional" toml:"ipcpath,optional"` // GasCap is the global gas cap for eth-call variants. - GasCap uint64 `hcl:"gas-cap,optional"` + GasCap uint64 `hcl:"gascap,optional" toml:"gascap,optional"` // TxFeeCap is the global transaction fee cap for send-transaction variants - TxFeeCap float64 `hcl:"tx-fee-cap,optional"` + TxFeeCap float64 `hcl:"txfeecap,optional" toml:"txfeecap,optional"` // Http has the json-rpc http related settings - Http *APIConfig `hcl:"http,block"` + Http *APIConfig `hcl:"http,block" toml:"http,block"` // Ws has the json-rpc websocket related settings - Ws *APIConfig `hcl:"ws,block"` + Ws *APIConfig `hcl:"ws,block" toml:"ws,block"` // Graphql has the json-rpc graphql related settings - Graphql *APIConfig `hcl:"graphql,block"` + Graphql *APIConfig `hcl:"graphql,block" toml:"graphql,block"` } type GRPCConfig struct { // Addr is the bind address for the grpc rpc server - Addr string + Addr string `hcl:"addr,optional" toml:"addr,optional"` } type APIConfig struct { // Enabled selects whether the api is enabled - Enabled bool `hcl:"enabled,optional"` + Enabled bool `hcl:"enabled,optional" toml:"enabled,optional"` // Port is the port number for this api - Port uint64 `hcl:"port,optional"` + Port uint64 `hcl:"port,optional" toml:"port,optional"` // Prefix is the http prefix to expose this api - Prefix string `hcl:"prefix,optional"` + Prefix string `hcl:"prefix,optional" toml:"prefix,optional"` // Host is the address to bind the api - Host string `hcl:"host,optional"` + Host string `hcl:"host,optional" toml:"host,optional"` - // Modules is the list of enabled api modules - API []string `hcl:"modules,optional"` + // API is the list of enabled api modules + API []string `hcl:"api,optional" toml:"api,optional"` // VHost is the list of valid virtual hosts - VHost []string `hcl:"vhost,optional"` + VHost []string `hcl:"vhosts,optional" toml:"vhosts,optional"` // Cors is the list of Cors endpoints - Cors []string `hcl:"cors,optional"` + Cors []string `hcl:"corsdomain,optional" toml:"corsdomain,optional"` } type GpoConfig struct { // Blocks is the number of blocks to track to compute the price oracle - Blocks uint64 `hcl:"blocks,optional"` + Blocks uint64 `hcl:"blocks,optional" toml:"blocks,optional"` // Percentile sets the weights to new blocks - Percentile uint64 `hcl:"percentile,optional"` + Percentile uint64 `hcl:"percentile,optional" toml:"percentile,optional"` // MaxPrice is an upper bound gas price - MaxPrice *big.Int - MaxPriceRaw string `hcl:"max-price,optional"` + MaxPrice *big.Int `hcl:"-,optional" toml:"-"` + MaxPriceRaw string `hcl:"maxprice,optional" toml:"maxprice,optional"` // IgnorePrice is a lower bound gas price - IgnorePrice *big.Int - IgnorePriceRaw string `hcl:"ignore-price,optional"` + IgnorePrice *big.Int `hcl:"-,optional" toml:"-"` + IgnorePriceRaw string `hcl:"ignoreprice,optional" toml:"ignoreprice,optional"` } type TelemetryConfig struct { // Enabled enables metrics - Enabled bool `hcl:"enabled,optional"` + Enabled bool `hcl:"metrics,optional" toml:"metrics,optional"` // Expensive enables expensive metrics - Expensive bool `hcl:"expensive,optional"` + Expensive bool `hcl:"expensive,optional" toml:"expensive,optional"` // InfluxDB has the influxdb related settings - InfluxDB *InfluxDBConfig `hcl:"influx,block"` + InfluxDB *InfluxDBConfig `hcl:"influx,block" toml:"influx,block"` // Prometheus Address - PrometheusAddr string `hcl:"prometheus-addr,optional"` + PrometheusAddr string `hcl:"prometheus-addr,optional" toml:"prometheus-addr,optional"` // Open collector endpoint - OpenCollectorEndpoint string `hcl:"opencollector-endpoint,optional"` + OpenCollectorEndpoint string `hcl:"opencollector-endpoint,optional" toml:"opencollector-endpoint,optional"` } type InfluxDBConfig struct { // V1Enabled enables influx v1 mode - V1Enabled bool `hcl:"v1-enabled,optional"` + V1Enabled bool `hcl:"influxdb,optional" toml:"influxdb,optional"` // Endpoint is the url endpoint of the influxdb service - Endpoint string `hcl:"endpoint,optional"` + Endpoint string `hcl:"endpoint,optional" toml:"endpoint,optional"` // Database is the name of the database in Influxdb to store the metrics. - Database string `hcl:"database,optional"` + Database string `hcl:"database,optional" toml:"database,optional"` // Enabled is the username to authorize access to Influxdb - Username string `hcl:"username,optional"` + Username string `hcl:"username,optional" toml:"username,optional"` // Password is the password to authorize access to Influxdb - Password string `hcl:"password,optional"` + Password string `hcl:"password,optional" toml:"password,optional"` // Tags are tags attaches to all generated metrics - Tags map[string]string `hcl:"tags,optional"` + Tags map[string]string `hcl:"tags,optional" toml:"tags,optional"` // Enabled enables influx v2 mode - V2Enabled bool `hcl:"v2-enabled,optional"` + V2Enabled bool `hcl:"influxdbv2,optional" toml:"influxdbv2,optional"` // Token is the token to authorize access to Influxdb V2. - Token string `hcl:"token,optional"` + Token string `hcl:"token,optional" toml:"token,optional"` // Bucket is the bucket to store metrics in Influxdb V2. - Bucket string `hcl:"bucket,optional"` + Bucket string `hcl:"bucket,optional" toml:"bucket,optional"` // Organization is the name of the organization for Influxdb V2. - Organization string `hcl:"organization,optional"` + Organization string `hcl:"organization,optional" toml:"organization,optional"` } type CacheConfig struct { // Cache is the amount of cache of the node - Cache uint64 `hcl:"cache,optional"` + Cache uint64 `hcl:"cache,optional" toml:"cache,optional"` // PercGc is percentage of cache used for garbage collection - PercGc uint64 `hcl:"perc-gc,optional"` + PercGc uint64 `hcl:"gc,optional" toml:"gc,optional"` // PercSnapshot is percentage of cache used for snapshots - PercSnapshot uint64 `hcl:"perc-snapshot,optional"` + PercSnapshot uint64 `hcl:"snapshot,optional" toml:"snapshot,optional"` // PercDatabase is percentage of cache used for the database - PercDatabase uint64 `hcl:"perc-database,optional"` + PercDatabase uint64 `hcl:"database,optional" toml:"database,optional"` // PercTrie is percentage of cache used for the trie - PercTrie uint64 `hcl:"perc-trie,optional"` + PercTrie uint64 `hcl:"trie,optional" toml:"trie,optional"` // Journal is the disk journal directory for trie cache to survive node restarts - Journal string `hcl:"journal,optional"` + Journal string `hcl:"journal,optional" toml:"journal,optional"` // Rejournal is the time interval to regenerate the journal for clean cache - Rejournal time.Duration - RejournalRaw string `hcl:"rejournal,optional"` + Rejournal time.Duration `hcl:"-,optional" toml:"-"` + RejournalRaw string `hcl:"rejournal,optional" toml:"rejournal,optional"` // NoPrefetch is used to disable prefetch of tries - NoPrefetch bool `hcl:"no-prefetch,optional"` + NoPrefetch bool `hcl:"noprefetch,optional" toml:"noprefetch,optional"` // Preimages is used to enable the track of hash preimages - Preimages bool `hcl:"preimages,optional"` + Preimages bool `hcl:"preimages,optional" toml:"preimages,optional"` // TxLookupLimit sets the maximum number of blocks from head whose tx indices are reserved. - TxLookupLimit uint64 `hcl:"tx-lookup-limit,optional"` + TxLookupLimit uint64 `hcl:"txlookuplimit,optional" toml:"txlookuplimit,optional"` } type AccountsConfig struct { // Unlock is the list of addresses to unlock in the node - Unlock []string `hcl:"unlock,optional"` + Unlock []string `hcl:"unlock,optional" toml:"unlock,optional"` // PasswordFile is the file where the account passwords are stored - PasswordFile string `hcl:"password-file,optional"` + PasswordFile string `hcl:"password,optional" toml:"password,optional"` // AllowInsecureUnlock allows user to unlock accounts in unsafe http environment. - AllowInsecureUnlock bool `hcl:"allow-insecure-unlock,optional"` + AllowInsecureUnlock bool `hcl:"allow-insecure-unlock,optional" toml:"allow-insecure-unlock,optional"` // UseLightweightKDF enables a faster but less secure encryption of accounts - UseLightweightKDF bool `hcl:"use-lightweight-kdf,optional"` + UseLightweightKDF bool `hcl:"lightkdf,optional" toml:"lightkdf,optional"` // DisableBorWallet disables the personal wallet endpoints - DisableBorWallet bool `hcl:"disable-bor-wallet,optional"` + DisableBorWallet bool `hcl:"disable-bor-wallet,optional" toml:"disable-bor-wallet,optional"` } type DeveloperConfig struct { // Enabled enables the developer mode - Enabled bool `hcl:"dev,optional"` + Enabled bool `hcl:"dev,optional" toml:"dev,optional"` // Period is the block period to use in developer mode - Period uint64 `hcl:"period,optional"` + Period uint64 `hcl:"period,optional" toml:"period,optional"` } func DefaultConfig() *Config { @@ -390,7 +394,7 @@ func DefaultConfig() *Config { Identity: Hostname(), RequiredBlocks: map[string]string{}, LogLevel: "INFO", - DataDir: defaultDataDir(), + DataDir: DefaultDataDir(), P2P: &P2PConfig{ MaxPeers: 30, MaxPendPeers: 50, @@ -409,8 +413,9 @@ func DefaultConfig() *Config { }, }, Heimdall: &HeimdallConfig{ - URL: "http://localhost:1317", - Without: false, + URL: "http://localhost:1317", + Without: false, + GRPCAddress: "", }, SyncMode: "full", GcMode: "full", @@ -418,21 +423,21 @@ func DefaultConfig() *Config { TxPool: &TxPoolConfig{ Locals: []string{}, NoLocals: false, - Journal: "", - Rejournal: time.Duration(1 * time.Hour), - PriceLimit: 30000000000, + Journal: "transactions.rlp", + Rejournal: 1 * time.Hour, + PriceLimit: 1, PriceBump: 10, AccountSlots: 16, GlobalSlots: 32768, AccountQueue: 16, GlobalQueue: 32768, - LifeTime: time.Duration(3 * time.Hour), + LifeTime: 3 * time.Hour, }, Sealer: &SealerConfig{ Enabled: false, Etherbase: "", - GasCeil: 20000000, - GasPrice: big.NewInt(30 * params.GWei), + GasCeil: 30_000_000, + GasPrice: big.NewInt(1 * params.GWei), ExtraData: "", }, Gpo: &GpoConfig{ @@ -452,22 +457,22 @@ func DefaultConfig() *Config { Prefix: "", Host: "localhost", API: []string{"eth", "net", "web3", "txpool", "bor"}, - Cors: []string{"*"}, - VHost: []string{"*"}, + Cors: []string{"localhost"}, + VHost: []string{"localhost"}, }, Ws: &APIConfig{ Enabled: false, Port: 8546, Prefix: "", Host: "localhost", - API: []string{"web3", "net"}, - Cors: []string{"*"}, - VHost: []string{"*"}, + API: []string{"net", "web3"}, + Cors: []string{"localhost"}, + VHost: []string{"localhost"}, }, Graphql: &APIConfig{ Enabled: false, - Cors: []string{"*"}, - VHost: []string{"*"}, + Cors: []string{"localhost"}, + VHost: []string{"localhost"}, }, }, Ethstats: "", @@ -506,7 +511,7 @@ func DefaultConfig() *Config { PasswordFile: "", AllowInsecureUnlock: false, UseLightweightKDF: false, - DisableBorWallet: false, + DisableBorWallet: true, }, GRPC: &GRPCConfig{ Addr: ":3131", @@ -526,7 +531,7 @@ func (c *Config) fillBigInt() error { }{ {"gpo.maxprice", &c.Gpo.MaxPrice, &c.Gpo.MaxPriceRaw}, {"gpo.ignoreprice", &c.Gpo.IgnorePrice, &c.Gpo.IgnorePriceRaw}, - {"sealer.gasprice", &c.Sealer.GasPrice, &c.Sealer.GasPriceRaw}, + {"miner.gasprice", &c.Sealer.GasPrice, &c.Sealer.GasPriceRaw}, } for _, x := range tds { @@ -582,13 +587,7 @@ func (c *Config) fillTimeDurations() error { func readConfigFile(path string) (*Config, error) { ext := filepath.Ext(path) if ext == ".toml" { - // read file and apply the legacy config - data, err := ioutil.ReadFile(path) - if err != nil { - return nil, err - } - - return readLegacyConfig(data) + return readLegacyConfig(path) } config := &Config{ @@ -652,6 +651,7 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (* } n.HeimdallURL = c.Heimdall.URL n.WithoutHeimdall = c.Heimdall.Without + n.HeimdallgRPCAddress = c.Heimdall.GRPCAddress // gas price oracle { @@ -848,7 +848,10 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (* case "full": n.SyncMode = downloader.FullSync case "snap": - n.SyncMode = downloader.SnapSync + // n.SyncMode = downloader.SnapSync // TODO(snap): Uncomment when we have snap sync working + n.SyncMode = downloader.FullSync + + log.Warn("Bor doesn't support Snap Sync yet, switching to Full Sync mode") default: return nil, fmt.Errorf("sync mode '%s' not found", c.SyncMode) } @@ -1040,7 +1043,7 @@ func parseBootnodes(urls []string) ([]*enode.Node, error) { return dst, nil } -func defaultDataDir() string { +func DefaultDataDir() string { // Try to place the data folder in the user's home dir home, _ := homedir.Dir() if home == "" { @@ -1076,7 +1079,7 @@ func Hostname() string { func MakePasswordListFromFile(path string) ([]string, error) { text, err := ioutil.ReadFile(path) if err != nil { - return nil, fmt.Errorf("Failed to read password file: %v", err) + return nil, fmt.Errorf("failed to read password file: %v", err) } lines := strings.Split(string(text), "\n") diff --git a/internal/cli/server/config_legacy.go b/internal/cli/server/config_legacy.go index 0d96b2e023..ccc05eb4a7 100644 --- a/internal/cli/server/config_legacy.go +++ b/internal/cli/server/config_legacy.go @@ -1,33 +1,33 @@ package server import ( - "bytes" + "fmt" + "os" - "github.com/naoina/toml" + "github.com/BurntSushi/toml" ) -type legacyConfig struct { - Node struct { - P2P struct { - StaticNodes []string - TrustedNodes []string - } +func readLegacyConfig(path string) (*Config, error) { + data, err := os.ReadFile(path) + tomlData := string(data) + + if err != nil { + return nil, fmt.Errorf("failed to read toml config file: %v", err) } -} -func (l *legacyConfig) Config() *Config { - c := DefaultConfig() - c.P2P.Discovery.StaticNodes = l.Node.P2P.StaticNodes - c.P2P.Discovery.TrustedNodes = l.Node.P2P.TrustedNodes - return c -} + conf := *DefaultConfig() -func readLegacyConfig(data []byte) (*Config, error) { - var legacy legacyConfig + if _, err := toml.Decode(tomlData, &conf); err != nil { + return nil, fmt.Errorf("failed to decode toml config file: %v", err) + } - r := toml.NewDecoder(bytes.NewReader(data)) - if err := r.Decode(&legacy); err != nil { + if err := conf.fillBigInt(); err != nil { return nil, err } - return legacy.Config(), nil + + if err := conf.fillTimeDurations(); err != nil { + return nil, err + } + + return &conf, nil } diff --git a/internal/cli/server/config_legacy_test.go b/internal/cli/server/config_legacy_test.go index 399481fc9b..e22639fa7e 100644 --- a/internal/cli/server/config_legacy_test.go +++ b/internal/cli/server/config_legacy_test.go @@ -1,21 +1,161 @@ package server import ( + "math/big" "testing" + "time" "github.com/stretchr/testify/assert" + + "github.com/ethereum/go-ethereum/eth/ethconfig" + "github.com/ethereum/go-ethereum/params" ) func TestConfigLegacy(t *testing.T) { - toml := `[Node.P2P] -StaticNodes = ["node1"] -TrustedNodes = ["node2"]` - config, err := readLegacyConfig([]byte(toml)) - if err != nil { - t.Fatal(err) + readFile := func(path string) { + expectedConfig, err := readLegacyConfig(path) + assert.NoError(t, err) + + testConfig := &Config{ + Chain: "mainnet", + Identity: Hostname(), + RequiredBlocks: map[string]string{ + "a": "b", + }, + LogLevel: "INFO", + DataDir: "./data", + P2P: &P2PConfig{ + MaxPeers: 30, + MaxPendPeers: 50, + Bind: "0.0.0.0", + Port: 30303, + NoDiscover: false, + NAT: "any", + Discovery: &P2PDiscovery{ + V5Enabled: false, + Bootnodes: []string{}, + BootnodesV4: []string{}, + BootnodesV5: []string{}, + StaticNodes: []string{}, + TrustedNodes: []string{}, + DNS: []string{}, + }, + }, + Heimdall: &HeimdallConfig{ + URL: "http://localhost:1317", + Without: false, + }, + SyncMode: "full", + GcMode: "full", + Snapshot: true, + TxPool: &TxPoolConfig{ + Locals: []string{}, + NoLocals: false, + Journal: "transactions.rlp", + Rejournal: 1 * time.Hour, + PriceLimit: 1, + PriceBump: 10, + AccountSlots: 16, + GlobalSlots: 32768, + AccountQueue: 16, + GlobalQueue: 32768, + LifeTime: 1 * time.Second, + }, + Sealer: &SealerConfig{ + Enabled: false, + Etherbase: "", + GasCeil: 30000000, + GasPrice: big.NewInt(1 * params.GWei), + ExtraData: "", + }, + Gpo: &GpoConfig{ + Blocks: 20, + Percentile: 60, + MaxPrice: big.NewInt(5000 * params.GWei), + IgnorePrice: big.NewInt(4), + }, + JsonRPC: &JsonRPCConfig{ + IPCDisable: false, + IPCPath: "", + GasCap: ethconfig.Defaults.RPCGasCap, + TxFeeCap: ethconfig.Defaults.RPCTxFeeCap, + Http: &APIConfig{ + Enabled: false, + Port: 8545, + Prefix: "", + Host: "localhost", + API: []string{"eth", "net", "web3", "txpool", "bor"}, + Cors: []string{"localhost"}, + VHost: []string{"localhost"}, + }, + Ws: &APIConfig{ + Enabled: false, + Port: 8546, + Prefix: "", + Host: "localhost", + API: []string{"net", "web3"}, + Cors: []string{"localhost"}, + VHost: []string{"localhost"}, + }, + Graphql: &APIConfig{ + Enabled: false, + Cors: []string{"localhost"}, + VHost: []string{"localhost"}, + }, + }, + Ethstats: "", + Telemetry: &TelemetryConfig{ + Enabled: false, + Expensive: false, + PrometheusAddr: "", + OpenCollectorEndpoint: "", + InfluxDB: &InfluxDBConfig{ + V1Enabled: false, + Endpoint: "", + Database: "", + Username: "", + Password: "", + Tags: map[string]string{}, + V2Enabled: false, + Token: "", + Bucket: "", + Organization: "", + }, + }, + Cache: &CacheConfig{ + Cache: 1024, + PercDatabase: 50, + PercTrie: 15, + PercGc: 25, + PercSnapshot: 10, + Journal: "triecache", + Rejournal: 1 * time.Second, + NoPrefetch: false, + Preimages: false, + TxLookupLimit: 2350000, + }, + Accounts: &AccountsConfig{ + Unlock: []string{}, + PasswordFile: "", + AllowInsecureUnlock: false, + UseLightweightKDF: false, + DisableBorWallet: true, + }, + GRPC: &GRPCConfig{ + Addr: ":3131", + }, + Developer: &DeveloperConfig{ + Enabled: false, + Period: 0, + }, + } + + assert.Equal(t, expectedConfig, testConfig) } - assert.Equal(t, config.P2P.Discovery.StaticNodes, []string{"node1"}) - assert.Equal(t, config.P2P.Discovery.TrustedNodes, []string{"node2"}) + // read file in hcl format + t.Run("toml", func(t *testing.T) { + readFile("./testdata/test.toml") + }) } diff --git a/internal/cli/server/config_test.go b/internal/cli/server/config_test.go index c1c6c4ef4a..bf7787ac2e 100644 --- a/internal/cli/server/config_test.go +++ b/internal/cli/server/config_test.go @@ -115,7 +115,7 @@ func TestConfigLoadFile(t *testing.T) { MaxPeers: 30, }, TxPool: &TxPoolConfig{ - LifeTime: time.Duration(1 * time.Second), + LifeTime: 1 * time.Second, }, Gpo: &GpoConfig{ MaxPrice: big.NewInt(100), @@ -127,12 +127,12 @@ func TestConfigLoadFile(t *testing.T) { // read file in hcl format t.Run("hcl", func(t *testing.T) { - readFile("./testdata/simple.hcl") + readFile("./testdata/test.hcl") }) // read file in json format t.Run("json", func(t *testing.T) { - readFile("./testdata/simple.json") + readFile("./testdata/test.json") }) } diff --git a/internal/cli/server/flags.go b/internal/cli/server/flags.go index e85428b9ee..327b0df338 100644 --- a/internal/cli/server/flags.go +++ b/internal/cli/server/flags.go @@ -38,7 +38,7 @@ func (c *Command) Flags() *flagset.Flagset { Usage: "Path of the directory to store keystores", Value: &c.cliConfig.KeyStoreDir, }) - f.SliceStringFlag(&flagset.SliceStringFlag{ + f.StringFlag(&flagset.StringFlag{ Name: "config", Usage: "File for the config file", Value: &c.configFile, @@ -80,6 +80,12 @@ func (c *Command) Flags() *flagset.Flagset { Value: &c.cliConfig.Heimdall.Without, Default: c.cliConfig.Heimdall.Without, }) + f.StringFlag(&flagset.StringFlag{ + Name: "bor.heimdallgRPC", + Usage: "Address of Heimdall gRPC service", + Value: &c.cliConfig.Heimdall.GRPCAddress, + Default: c.cliConfig.Heimdall.GRPCAddress, + }) // txpool options f.SliceStringFlag(&flagset.SliceStringFlag{ diff --git a/internal/cli/server/helper.go b/internal/cli/server/helper.go index 428acceea3..97c49dcad3 100644 --- a/internal/cli/server/helper.go +++ b/internal/cli/server/helper.go @@ -2,75 +2,36 @@ package server import ( "fmt" - "math/rand" - "net" "os" - "sync/atomic" - "time" + + "github.com/ethereum/go-ethereum/common/network" ) -var maxPortCheck int32 = 100 - -// findAvailablePort returns the next available port starting from `from` -func findAvailablePort(from int32, count int32) (int32, error) { - if count == maxPortCheck { - return 0, fmt.Errorf("no available port found") - } - - port := atomic.AddInt32(&from, 1) - addr := fmt.Sprintf("localhost:%d", port) - - count++ - - lis, err := net.Listen("tcp", addr) - if err == nil { - lis.Close() - return port, nil - } else { - return findAvailablePort(from, count) - } -} - func CreateMockServer(config *Config) (*Server, error) { if config == nil { config = DefaultConfig() } - // find available port for grpc server - rand.Seed(time.Now().UnixNano()) - - var ( - from int32 = 60000 // the min port to start checking from - to int32 = 61000 // the max port to start checking from - ) - - //nolint: gosec - port, err := findAvailablePort(rand.Int31n(to-from+1)+from, 0) + // get grpc port and listener + grpcPort, gRPCListener, err := network.FindAvailablePort() if err != nil { return nil, err } - // grpc port - config.GRPC.Addr = fmt.Sprintf(":%d", port) + // The test uses grpc port from config so setting it here. + config.GRPC.Addr = fmt.Sprintf(":%d", grpcPort) // datadir - datadir, _ := os.MkdirTemp("/tmp", "bor-cli-test") - config.DataDir = datadir - - // find available port for http server - from = 8545 - to = 9545 - - //nolint: gosec - port, err = findAvailablePort(rand.Int31n(to-from+1)+from, 0) + datadir, err := os.MkdirTemp("", "bor-cli-test") if err != nil { return nil, err } - config.JsonRPC.Http.Port = uint64(port) + config.DataDir = datadir + config.JsonRPC.Http.Port = 0 // It will choose a free/available port // start the server - return NewServer(config) + return NewServer(config, WithGRPCListener(gRPCListener)) } func CloseMockServer(server *Server) { diff --git a/internal/cli/server/proto/server.pb.go b/internal/cli/server/proto/server.pb.go index 5512d83b72..3e928ac170 100644 --- a/internal/cli/server/proto/server.pb.go +++ b/internal/cli/server/proto/server.pb.go @@ -7,11 +7,12 @@ package proto import ( + reflect "reflect" + sync "sync" + protoreflect "google.golang.org/protobuf/reflect/protoreflect" protoimpl "google.golang.org/protobuf/runtime/protoimpl" emptypb "google.golang.org/protobuf/types/known/emptypb" - reflect "reflect" - sync "sync" ) const ( diff --git a/internal/cli/server/proto/server_grpc.pb.go b/internal/cli/server/proto/server_grpc.pb.go index 63f1fa6187..bd4ecb660d 100644 --- a/internal/cli/server/proto/server_grpc.pb.go +++ b/internal/cli/server/proto/server_grpc.pb.go @@ -8,6 +8,7 @@ package proto import ( context "context" + grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" diff --git a/internal/cli/server/server.go b/internal/cli/server/server.go index 77d310061c..736b0d3bb7 100644 --- a/internal/cli/server/server.go +++ b/internal/cli/server/server.go @@ -50,7 +50,22 @@ type Server struct { tracerAPI *tracers.API } -func NewServer(config *Config) (*Server, error) { +type serverOption func(srv *Server, config *Config) error + +func WithGRPCAddress() serverOption { + return func(srv *Server, config *Config) error { + return srv.gRPCServerByAddress(config.GRPC.Addr) + } +} + +func WithGRPCListener(lis net.Listener) serverOption { + return func(srv *Server, _ *Config) error { + return srv.gRPCServerByListener(lis) + } +} + +//nolint:gocognit +func NewServer(config *Config, opts ...serverOption) (*Server, error) { srv := &Server{ config: config, } @@ -58,12 +73,17 @@ func NewServer(config *Config) (*Server, error) { // start the logger setupLogger(config.LogLevel) - if err := srv.setupGRPCServer(config.GRPC.Addr); err != nil { - return nil, err + var err error + + for _, opt := range opts { + err = opt(srv, config) + if err != nil { + return nil, err + } } // load the chain genesis - if err := config.loadChain(); err != nil { + if err = config.loadChain(); err != nil { return nil, err } @@ -151,7 +171,6 @@ func NewServer(config *Config) (*Server, error) { wallet, err := accountManager.Find(accounts.Account{Address: eb}) if wallet == nil || err != nil { log.Error("Etherbase account unavailable locally", "err", err) - return nil, fmt.Errorf("signer missing: %v", err) } @@ -217,8 +236,13 @@ func NewServer(config *Config) (*Server, error) { } func (s *Server) Stop() { - s.node.Close() - s.grpcServer.Stop() + if s.node != nil { + s.node.Close() + } + + if s.grpcServer != nil { + s.grpcServer.Stop() + } // shutdown the tracer if s.tracer != nil { @@ -327,22 +351,26 @@ func (s *Server) setupMetrics(config *TelemetryConfig, serviceName string) error return nil } -func (s *Server) setupGRPCServer(addr string) error { - s.grpcServer = grpc.NewServer(s.withLoggingUnaryInterceptor()) - proto.RegisterBorServer(s.grpcServer, s) - +func (s *Server) gRPCServerByAddress(addr string) error { lis, err := net.Listen("tcp", addr) if err != nil { return err } + return s.gRPCServerByListener(lis) +} + +func (s *Server) gRPCServerByListener(listener net.Listener) error { + s.grpcServer = grpc.NewServer(s.withLoggingUnaryInterceptor()) + proto.RegisterBorServer(s.grpcServer, s) + go func() { - if err := s.grpcServer.Serve(lis); err != nil { + if err := s.grpcServer.Serve(listener); err != nil { log.Error("failed to serve grpc server", "err", err) } }() - log.Info("GRPC Server started", "addr", addr) + log.Info("GRPC Server started", "addr", listener.Addr()) return nil } diff --git a/internal/cli/server/service_test.go b/internal/cli/server/service_test.go index 7850525686..86cf68e75e 100644 --- a/internal/cli/server/service_test.go +++ b/internal/cli/server/service_test.go @@ -4,8 +4,9 @@ import ( "math/big" "testing" - "github.com/ethereum/go-ethereum/internal/cli/server/proto" "github.com/stretchr/testify/assert" + + "github.com/ethereum/go-ethereum/internal/cli/server/proto" ) func TestGatherBlocks(t *testing.T) { diff --git a/internal/cli/server/testdata/simple.json b/internal/cli/server/testdata/simple.json deleted file mode 100644 index 6270ee6d13..0000000000 --- a/internal/cli/server/testdata/simple.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "data-dir": "./data", - "requiredblocks": { - "a": "b" - }, - "p2p": { - "max-peers": 30 - }, - "txpool": { - "lifetime": "1s" - }, - "gpo": { - "max-price": "100" - } -} \ No newline at end of file diff --git a/internal/cli/server/testdata/simple.hcl b/internal/cli/server/testdata/test.hcl similarity index 57% rename from internal/cli/server/testdata/simple.hcl rename to internal/cli/server/testdata/test.hcl index 5afc091859..208fdc51c1 100644 --- a/internal/cli/server/testdata/simple.hcl +++ b/internal/cli/server/testdata/test.hcl @@ -1,11 +1,11 @@ -data-dir = "./data" +datadir = "./data" requiredblocks = { a = "b" } p2p { - max-peers = 30 + maxpeers = 30 } txpool { @@ -13,5 +13,5 @@ txpool { } gpo { - max-price = "100" -} + maxprice = "100" +} \ No newline at end of file diff --git a/internal/cli/server/testdata/test.json b/internal/cli/server/testdata/test.json new file mode 100644 index 0000000000..467835e755 --- /dev/null +++ b/internal/cli/server/testdata/test.json @@ -0,0 +1,15 @@ +{ + "datadir": "./data", + "requiredblocks": { + "a": "b" + }, + "p2p": { + "maxpeers": 30 + }, + "txpool": { + "lifetime": "1s" + }, + "gpo": { + "maxprice": "100" + } +} \ No newline at end of file diff --git a/internal/cli/server/testdata/test.toml b/internal/cli/server/testdata/test.toml new file mode 100644 index 0000000000..2277e03664 --- /dev/null +++ b/internal/cli/server/testdata/test.toml @@ -0,0 +1,23 @@ +datadir = "./data" + +[requiredblocks] +a = "b" + +[p2p] +maxpeers = 30 + +[txpool] +locals = [] +lifetime = "1s" + +[miner] +mine = false +gaslimit = 30000000 +gasprice = "1000000000" + +[gpo] +ignoreprice = "4" + +[cache] +cache = 1024 +rejournal = "1s" diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 0d3aeb35c6..a71ec3bd87 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -44,6 +44,7 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/eth/tracers/logger" + "github.com/ethereum/go-ethereum/ethdb" "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/params" @@ -670,6 +671,7 @@ func (s *PublicBlockChainAPI) GetTransactionReceiptsByBlock(ctx context.Context, "contractAddress": nil, "logs": receipt.Logs, "logsBloom": receipt.Bloom, + "type": hexutil.Uint(tx.Type()), } // Assign receipt status or post state. @@ -681,9 +683,11 @@ func (s *PublicBlockChainAPI) GetTransactionReceiptsByBlock(ctx context.Context, if receipt.Logs == nil { fields["logs"] = [][]*types.Log{} } - if borReceipt != nil { + + if borReceipt != nil && idx == len(receipts)-1 { fields["transactionHash"] = txHash } + // If the ContractAddress is 20 0x0 bytes, assume it is not a contract creation if receipt.ContractAddress != (common.Address{}) { fields["contractAddress"] = receipt.ContractAddress @@ -1329,7 +1333,7 @@ func RPCMarshalHeader(head *types.Header) map[string]interface{} { // RPCMarshalBlock converts the given block to the RPC output which depends on fullTx. If inclTx is true transactions are // returned. When fullTx is true the returned block contains full transaction details, otherwise it will only contain // transaction hashes. -func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool, config *params.ChainConfig) (map[string]interface{}, error) { +func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool, config *params.ChainConfig, db ethdb.Database) (map[string]interface{}, error) { fields := RPCMarshalHeader(block.Header()) fields["size"] = hexutil.Uint64(block.Size()) @@ -1339,7 +1343,7 @@ func RPCMarshalBlock(block *types.Block, inclTx bool, fullTx bool, config *param } if fullTx { formatTx = func(tx *types.Transaction) (interface{}, error) { - return newRPCTransactionFromBlockHash(block, tx.Hash(), config), nil + return newRPCTransactionFromBlockHash(block, tx.Hash(), config, db), nil } } txs := block.Transactions() @@ -1373,7 +1377,7 @@ func (s *PublicBlockChainAPI) rpcMarshalHeader(ctx context.Context, header *type // rpcMarshalBlock uses the generalized output filler, then adds the total difficulty field, which requires // a `PublicBlockchainAPI`. func (s *PublicBlockChainAPI) rpcMarshalBlock(ctx context.Context, b *types.Block, inclTx bool, fullTx bool) (map[string]interface{}, error) { - fields, err := RPCMarshalBlock(b, inclTx, fullTx, s.b.ChainConfig()) + fields, err := RPCMarshalBlock(b, inclTx, fullTx, s.b.ChainConfig(), s.b.ChainDb()) if err != nil { return nil, err } @@ -1466,8 +1470,18 @@ func newRPCPendingTransaction(tx *types.Transaction, current *types.Header, conf } // newRPCTransactionFromBlockIndex returns a transaction that will serialize to the RPC representation. -func newRPCTransactionFromBlockIndex(b *types.Block, index uint64, config *params.ChainConfig) *RPCTransaction { +func newRPCTransactionFromBlockIndex(b *types.Block, index uint64, config *params.ChainConfig, db ethdb.Database) *RPCTransaction { txs := b.Transactions() + + borReceipt := rawdb.ReadBorReceipt(db, b.Hash(), b.NumberU64()) + if borReceipt != nil { + tx, _, _, _ := rawdb.ReadBorTransaction(db, borReceipt.TxHash) + + if tx != nil { + txs = append(txs, tx) + } + } + if index >= uint64(len(txs)) { return nil } @@ -1485,10 +1499,10 @@ func newRPCRawTransactionFromBlockIndex(b *types.Block, index uint64) hexutil.By } // newRPCTransactionFromBlockHash returns a transaction that will serialize to the RPC representation. -func newRPCTransactionFromBlockHash(b *types.Block, hash common.Hash, config *params.ChainConfig) *RPCTransaction { +func newRPCTransactionFromBlockHash(b *types.Block, hash common.Hash, config *params.ChainConfig, db ethdb.Database) *RPCTransaction { for idx, tx := range b.Transactions() { if tx.Hash() == hash { - return newRPCTransactionFromBlockIndex(b, uint64(idx), config) + return newRPCTransactionFromBlockIndex(b, uint64(idx), config, db) } } return nil @@ -1630,7 +1644,7 @@ func (s *PublicTransactionPoolAPI) GetBlockTransactionCountByHash(ctx context.Co // GetTransactionByBlockNumberAndIndex returns the transaction for the given block number and index. func (s *PublicTransactionPoolAPI) GetTransactionByBlockNumberAndIndex(ctx context.Context, blockNr rpc.BlockNumber, index hexutil.Uint) *RPCTransaction { if block, _ := s.b.BlockByNumber(ctx, blockNr); block != nil { - return newRPCTransactionFromBlockIndex(block, uint64(index), s.b.ChainConfig()) + return newRPCTransactionFromBlockIndex(block, uint64(index), s.b.ChainConfig(), s.b.ChainDb()) } return nil } @@ -1638,7 +1652,7 @@ func (s *PublicTransactionPoolAPI) GetTransactionByBlockNumberAndIndex(ctx conte // GetTransactionByBlockHashAndIndex returns the transaction for the given block hash and index. func (s *PublicTransactionPoolAPI) GetTransactionByBlockHashAndIndex(ctx context.Context, blockHash common.Hash, index hexutil.Uint) *RPCTransaction { if block, _ := s.b.BlockByHash(ctx, blockHash); block != nil { - return newRPCTransactionFromBlockIndex(block, uint64(index), s.b.ChainConfig()) + return newRPCTransactionFromBlockIndex(block, uint64(index), s.b.ChainConfig(), s.b.ChainDb()) } return nil } diff --git a/internal/testlog/testlog.go b/internal/testlog/testlog.go index 684339f16d..a5836b8446 100644 --- a/internal/testlog/testlog.go +++ b/internal/testlog/testlog.go @@ -26,12 +26,13 @@ import ( // Handler returns a log handler which logs to the unit test log of t. func Handler(t *testing.T, level log.Lvl) log.Handler { - return log.LvlFilterHandler(level, &handler{t, log.TerminalFormat(false)}) + return log.LvlFilterHandler(level, &handler{t, log.TerminalFormat(false), level}) } type handler struct { t *testing.T fmt log.Format + lvl log.Lvl } func (h *handler) Log(r *log.Record) error { @@ -39,6 +40,10 @@ func (h *handler) Log(r *log.Record) error { return nil } +func (h *handler) Level() log.Lvl { + return h.lvl +} + // logger implements log.Logger such that all output goes to the unit test log via // t.Logf(). All methods in between logger.Trace, logger.Debug, etc. are marked as test // helpers, so the file and line number in unit test output correspond to the call site @@ -59,6 +64,9 @@ func (h *bufHandler) Log(r *log.Record) error { h.buf = append(h.buf, r) return nil } +func (h *bufHandler) Level() log.Lvl { + return log.LvlTrace +} // Logger returns a logger which logs to the unit test log of t. func Logger(t *testing.T, level log.Lvl) log.Logger { diff --git a/log/handler.go b/log/handler.go index 4ad433334e..6e89858f4b 100644 --- a/log/handler.go +++ b/log/handler.go @@ -17,18 +17,26 @@ import ( // them to achieve the logging structure that suits your applications. type Handler interface { Log(r *Record) error + Level() Lvl } // FuncHandler returns a Handler that logs records with the given // function. -func FuncHandler(fn func(r *Record) error) Handler { - return funcHandler(fn) +func FuncHandler(fn func(r *Record) error, lvl Lvl) Handler { + return funcHandler{fn, lvl} } -type funcHandler func(r *Record) error +type funcHandler struct { + log func(r *Record) error + lvl Lvl +} func (h funcHandler) Log(r *Record) error { - return h(r) + return h.log(r) +} + +func (h funcHandler) Level() Lvl { + return h.lvl } // StreamHandler writes log records to an io.Writer @@ -42,7 +50,7 @@ func StreamHandler(wr io.Writer, fmtr Format) Handler { h := FuncHandler(func(r *Record) error { _, err := wr.Write(fmtr.Format(r)) return err - }) + }, LvlTrace) return LazyHandler(SyncHandler(h)) } @@ -55,7 +63,7 @@ func SyncHandler(h Handler) Handler { defer mu.Unlock() mu.Lock() return h.Log(r) - }) + }, h.Level()) } // FileHandler returns a handler which writes log records to the give file @@ -99,7 +107,7 @@ func CallerFileHandler(h Handler) Handler { return FuncHandler(func(r *Record) error { r.Ctx = append(r.Ctx, "caller", fmt.Sprint(r.Call)) return h.Log(r) - }) + }, h.Level()) } // CallerFuncHandler returns a Handler that adds the calling function name to @@ -108,7 +116,7 @@ func CallerFuncHandler(h Handler) Handler { return FuncHandler(func(r *Record) error { r.Ctx = append(r.Ctx, "fn", formatCall("%+n", r.Call)) return h.Log(r) - }) + }, h.Level()) } // This function is here to please go vet on Go < 1.8. @@ -128,29 +136,28 @@ func CallerStackHandler(format string, h Handler) Handler { r.Ctx = append(r.Ctx, "stack", fmt.Sprintf(format, s)) } return h.Log(r) - }) + }, h.Level()) } // FilterHandler returns a Handler that only writes records to the // wrapped Handler if the given function evaluates true. For example, // to only log records where the 'err' key is not nil: // -// logger.SetHandler(FilterHandler(func(r *Record) bool { -// for i := 0; i < len(r.Ctx); i += 2 { -// if r.Ctx[i] == "err" { -// return r.Ctx[i+1] != nil -// } -// } -// return false -// }, h)) -// +// logger.SetHandler(FilterHandler(func(r *Record) bool { +// for i := 0; i < len(r.Ctx); i += 2 { +// if r.Ctx[i] == "err" { +// return r.Ctx[i+1] != nil +// } +// } +// return false +// }, h)) func FilterHandler(fn func(r *Record) bool, h Handler) Handler { return FuncHandler(func(r *Record) error { if fn(r) { return h.Log(r) } return nil - }) + }, h.Level()) } // MatchFilterHandler returns a Handler that only writes records @@ -158,8 +165,7 @@ func FilterHandler(fn func(r *Record) bool, h Handler) Handler { // context matches the value. For example, to only log records // from your ui package: // -// log.MatchFilterHandler("pkg", "app/ui", log.StdoutHandler) -// +// log.MatchFilterHandler("pkg", "app/ui", log.StdoutHandler) func MatchFilterHandler(key string, value interface{}, h Handler) Handler { return FilterHandler(func(r *Record) (pass bool) { switch key { @@ -185,8 +191,7 @@ func MatchFilterHandler(key string, value interface{}, h Handler) Handler { // level to the wrapped Handler. For example, to only // log Error/Crit records: // -// log.LvlFilterHandler(log.LvlError, log.StdoutHandler) -// +// log.LvlFilterHandler(log.LvlError, log.StdoutHandler) func LvlFilterHandler(maxLvl Lvl, h Handler) Handler { return FilterHandler(func(r *Record) (pass bool) { return r.Lvl <= maxLvl @@ -198,10 +203,9 @@ func LvlFilterHandler(maxLvl Lvl, h Handler) Handler { // to different locations. For example, to log to a file and // standard error: // -// log.MultiHandler( -// log.Must.FileHandler("/var/log/app.log", log.LogfmtFormat()), -// log.StderrHandler) -// +// log.MultiHandler( +// log.Must.FileHandler("/var/log/app.log", log.LogfmtFormat()), +// log.StderrHandler) func MultiHandler(hs ...Handler) Handler { return FuncHandler(func(r *Record) error { for _, h := range hs { @@ -209,7 +213,7 @@ func MultiHandler(hs ...Handler) Handler { h.Log(r) } return nil - }) + }, LvlDebug) } // FailoverHandler writes all log records to the first handler @@ -219,10 +223,10 @@ func MultiHandler(hs ...Handler) Handler { // to writing to a file if the network fails, and then to // standard out if the file write fails: // -// log.FailoverHandler( -// log.Must.NetHandler("tcp", ":9090", log.JSONFormat()), -// log.Must.FileHandler("/var/log/app.log", log.LogfmtFormat()), -// log.StdoutHandler) +// log.FailoverHandler( +// log.Must.NetHandler("tcp", ":9090", log.JSONFormat()), +// log.Must.FileHandler("/var/log/app.log", log.LogfmtFormat()), +// log.StdoutHandler) // // All writes that do not go to the first handler will add context with keys of // the form "failover_err_{idx}" which explain the error encountered while @@ -239,17 +243,17 @@ func FailoverHandler(hs ...Handler) Handler { } return err - }) + }, LvlTrace) } // ChannelHandler writes all records to the given channel. // It blocks if the channel is full. Useful for async processing // of log messages, it's used by BufferedHandler. -func ChannelHandler(recs chan<- *Record) Handler { +func ChannelHandler(recs chan<- *Record, lvl Lvl) Handler { return FuncHandler(func(r *Record) error { recs <- r return nil - }) + }, lvl) } // BufferedHandler writes all records to a buffered @@ -264,7 +268,8 @@ func BufferedHandler(bufSize int, h Handler) Handler { _ = h.Log(m) } }() - return ChannelHandler(recs) + + return ChannelHandler(recs, h.Level()) } // LazyHandler writes all values to the wrapped handler after evaluating @@ -297,7 +302,7 @@ func LazyHandler(h Handler) Handler { } return h.Log(r) - }) + }, h.Level()) } func evaluateLazy(lz Lazy) (interface{}, error) { @@ -333,7 +338,7 @@ func evaluateLazy(lz Lazy) (interface{}, error) { func DiscardHandler() Handler { return FuncHandler(func(r *Record) error { return nil - }) + }, LvlDiscard) } // Must provides the following Handler creation functions diff --git a/log/handler_glog.go b/log/handler_glog.go index 9b1d4efaf4..67376d3d41 100644 --- a/log/handler_glog.go +++ b/log/handler_glog.go @@ -82,14 +82,14 @@ func (h *GlogHandler) Verbosity(level Lvl) { // // For instance: // -// pattern="gopher.go=3" -// sets the V level to 3 in all Go files named "gopher.go" +// pattern="gopher.go=3" +// sets the V level to 3 in all Go files named "gopher.go" // -// pattern="foo=3" -// sets V to 3 in all files of any packages whose import path ends in "foo" +// pattern="foo=3" +// sets V to 3 in all files of any packages whose import path ends in "foo" // -// pattern="foo/*=3" -// sets V to 3 in all files of any packages whose import path contains "foo" +// pattern="foo/*=3" +// sets V to 3 in all files of any packages whose import path contains "foo" func (h *GlogHandler) Vmodule(ruleset string) error { var filter []pattern for _, rule := range strings.Split(ruleset, ",") { @@ -230,3 +230,7 @@ func (h *GlogHandler) Log(r *Record) error { } return nil } + +func (h *GlogHandler) Level() Lvl { + return Lvl(atomic.LoadUint32(&h.level)) +} diff --git a/log/handler_go119.go b/log/handler_go119.go new file mode 100644 index 0000000000..843dfd83b0 --- /dev/null +++ b/log/handler_go119.go @@ -0,0 +1,27 @@ +//+go:build go1.19 + +package log + +import "sync/atomic" + +// swapHandler wraps another handler that may be swapped out +// dynamically at runtime in a thread-safe fashion. +type swapHandler struct { + handler atomic.Pointer[Handler] +} + +func (h *swapHandler) Log(r *Record) error { + return (*h.handler.Load()).Log(r) +} + +func (h *swapHandler) Swap(newHandler Handler) { + h.handler.Store(&newHandler) +} + +func (h *swapHandler) Get() Handler { + return *h.handler.Load() +} + +func (h *swapHandler) Level() Lvl { + return (*h.handler.Load()).Level() +} diff --git a/log/handler_go14.go b/log/handler_go14.go index d0cb14aa06..c02a9abd16 100644 --- a/log/handler_go14.go +++ b/log/handler_go14.go @@ -1,5 +1,4 @@ -//go:build go1.4 -// +build go1.4 +//go:build !go1.19 package log diff --git a/log/logger.go b/log/logger.go index 276d6969e2..2b96681a82 100644 --- a/log/logger.go +++ b/log/logger.go @@ -18,7 +18,8 @@ const skipLevel = 2 type Lvl int const ( - LvlCrit Lvl = iota + LvlDiscard Lvl = -1 + LvlCrit Lvl = iota LvlError LvlWarn LvlInfo @@ -131,6 +132,10 @@ type logger struct { } func (l *logger) write(msg string, lvl Lvl, ctx []interface{}, skip int) { + if l.h.Level() < lvl { + return + } + l.h.Log(&Record{ Time: time.Now(), Lvl: lvl, diff --git a/log/syslog.go b/log/syslog.go index 451d831b6d..cfa7c8cc1b 100644 --- a/log/syslog.go +++ b/log/syslog.go @@ -45,7 +45,7 @@ func sharedSyslog(fmtr Format, sysWr *syslog.Writer, err error) (Handler, error) s := strings.TrimSpace(string(fmtr.Format(r))) return syslogFn(s) - }) + }, LvlTrace) return LazyHandler(&closingHandler{sysWr, h}), nil } diff --git a/node/node.go b/node/node.go index 7c540306db..e12bcf6675 100644 --- a/node/node.go +++ b/node/node.go @@ -20,6 +20,7 @@ import ( crand "crypto/rand" "errors" "fmt" + "net" "net/http" "os" "path/filepath" @@ -27,6 +28,8 @@ import ( "strings" "sync" + "github.com/prometheus/tsdb/fileutil" + "github.com/ethereum/go-ethereum/accounts" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" @@ -36,7 +39,6 @@ import ( "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/p2p" "github.com/ethereum/go-ethereum/rpc" - "github.com/prometheus/tsdb/fileutil" ) // Node is a container on which services can be registered. @@ -466,6 +468,12 @@ func (n *Node) startRPC() error { if err := initHttp(n.http, open, n.config.HTTPPort); err != nil { return err } + + defer func() { + if n.http.listener != nil { + n.config.HTTPPort = n.http.listener.Addr().(*net.TCPAddr).Port + } + }() } // Configure WebSocket. if n.config.WSHost != "" { @@ -473,6 +481,12 @@ func (n *Node) startRPC() error { if err := initWS(open, n.config.WSPort); err != nil { return err } + + defer func() { + if n.ws.listener != nil { + n.config.WSPort = n.ws.listener.Addr().(*net.TCPAddr).Port + } + }() } // Configure authenticated API if len(open) != len(all) { @@ -480,16 +494,19 @@ func (n *Node) startRPC() error { if err != nil { return err } - if err := initAuth(all, n.config.AuthPort, jwtSecret); err != nil { + + if err = initAuth(all, n.config.AuthPort, jwtSecret); err != nil { return err } } + // Start the servers for _, server := range servers { if err := server.start(); err != nil { return err } } + return nil } diff --git a/node/rpcstack.go b/node/rpcstack.go index d9c41cca57..eabf1dcae7 100644 --- a/node/rpcstack.go +++ b/node/rpcstack.go @@ -29,9 +29,10 @@ import ( "sync" "sync/atomic" + "github.com/rs/cors" + "github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/rpc" - "github.com/rs/cors" ) // httpConfig is the JSON-RPC/HTTP configuration. diff --git a/p2p/discover/v4_udp_test.go b/p2p/discover/v4_udp_test.go index e36912f010..e5e81dbb99 100644 --- a/p2p/discover/v4_udp_test.go +++ b/p2p/discover/v4_udp_test.go @@ -562,7 +562,7 @@ func startLocalhostV4(t *testing.T, cfg Config) *UDPv4 { cfg.Log.SetHandler(log.FuncHandler(func(r *log.Record) error { t.Logf("%s %s", lprefix, lfmt.Format(r)) return nil - })) + }, log.LvlTrace)) // Listen. socket, err := net.ListenUDP("udp4", &net.UDPAddr{IP: net.IP{127, 0, 0, 1}}) diff --git a/p2p/discover/v5_udp_test.go b/p2p/discover/v5_udp_test.go index f061f5ab41..1cc5fc03e0 100644 --- a/p2p/discover/v5_udp_test.go +++ b/p2p/discover/v5_udp_test.go @@ -83,7 +83,7 @@ func startLocalhostV5(t *testing.T, cfg Config) *UDPv5 { cfg.Log.SetHandler(log.FuncHandler(func(r *log.Record) error { t.Logf("%s %s", lprefix, lfmt.Format(r)) return nil - })) + }, log.LvlTrace)) // Listen. socket, err := net.ListenUDP("udp4", &net.UDPAddr{IP: net.IP{127, 0, 0, 1}}) diff --git a/params/config.go b/params/config.go index c25cfa62ec..8123fe894b 100644 --- a/params/config.go +++ b/params/config.go @@ -444,7 +444,7 @@ var ( // adding flags to the config to also have to set these fields. AllCliqueProtocolChanges = &ChainConfig{big.NewInt(1337), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, nil, nil, &CliqueConfig{Period: 0, Epoch: 30000}, &BorConfig{BurntContract: map[string]string{"0": "0x000000000000000000000000000000000000dead"}}} - TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, new(EthashConfig), nil, &BorConfig{BurntContract: map[string]string{"0": "0x000000000000000000000000000000000000dead"}}} + TestChainConfig = &ChainConfig{big.NewInt(1), big.NewInt(0), nil, false, big.NewInt(0), common.Hash{}, big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), big.NewInt(0), nil, nil, new(EthashConfig), nil, &BorConfig{Sprint: 4, BurntContract: map[string]string{"0": "0x000000000000000000000000000000000000dead"}}} TestRules = TestChainConfig.Rules(new(big.Int), false) ) diff --git a/tests/bor/bor_api_test.go b/tests/bor/bor_api_test.go index fc81480902..63d2c8f3d5 100644 --- a/tests/bor/bor_api_test.go +++ b/tests/bor/bor_api_test.go @@ -7,162 +7,249 @@ import ( "math/big" "testing" - "github.com/golang/mock/gomock" - "github.com/stretchr/testify/require" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/consensus/bor" - "github.com/ethereum/go-ethereum/consensus/bor/clerk" - "github.com/ethereum/go-ethereum/consensus/bor/heimdall/checkpoint" - "github.com/ethereum/go-ethereum/consensus/bor/valset" + "github.com/ethereum/go-ethereum/consensus/ethash" + "github.com/ethereum/go-ethereum/core" "github.com/ethereum/go-ethereum/core/rawdb" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/eth" + "github.com/ethereum/go-ethereum/eth/ethconfig" "github.com/ethereum/go-ethereum/internal/ethapi" + "github.com/ethereum/go-ethereum/node" + "github.com/ethereum/go-ethereum/params" "github.com/ethereum/go-ethereum/rpc" - "github.com/ethereum/go-ethereum/tests/bor/mocks" + + "github.com/stretchr/testify/assert" ) -func TestGetTransactionReceiptsByBlock(t *testing.T) { - init := buildEthereumInstance(t, rawdb.NewMemoryDatabase()) - chain := init.ethereum.BlockChain() - engine := init.ethereum.Engine() +var ( + key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291") + addrr = crypto.PubkeyToAddress(key1.PublicKey) + stack, _ = node.New(&node.DefaultConfig) + backend, _ = eth.New(stack, ðconfig.Defaults) + db = backend.ChainDb() + hash1 = common.BytesToHash([]byte("topic1")) + hash2 = common.BytesToHash([]byte("topic2")) + hash3 = common.BytesToHash([]byte("topic3")) + hash4 = common.BytesToHash([]byte("topic4")) + hash5 = common.BytesToHash([]byte("topic5")) +) - ctrl := gomock.NewController(t) - defer ctrl.Finish() - - _bor := engine.(*bor.Bor) - defer _bor.Close() - - // Mock /bor/span/1 - res, _ := loadSpanFromFile(t) - - h := mocks.NewMockIHeimdallClient(ctrl) - - h.EXPECT().Span(gomock.Any(), uint64(1)).Return(&res.Result, nil).MinTimes(1) - h.EXPECT().Close().MinTimes(1) - h.EXPECT().FetchCheckpoint(gomock.Any(), int64(-1)).Return(&checkpoint.Checkpoint{ - Proposer: res.Result.SelectedProducers[0].Address, - StartBlock: big.NewInt(0), - EndBlock: big.NewInt(int64(spanSize)), - }, nil).AnyTimes() - - // Mock State Sync events - // at # sprintSize, events are fetched for [fromID, (block-sprint).Time) - fromID := uint64(1) - to := int64(chain.GetHeaderByNumber(0).Time) - sample := getSampleEventRecord(t) - - // First query will be from [id=1, (block-sprint).Time] - eventRecords := []*clerk.EventRecordWithTime{ - buildStateEvent(sample, 1, 1), - buildStateEvent(sample, 2, 2), - buildStateEvent(sample, 3, 3), +func duplicateInArray(arr []common.Hash) bool { + visited := make(map[common.Hash]bool, 0) + for i := 0; i < len(arr); i++ { + if visited[arr[i]] == true { + return true + } else { + visited[arr[i]] = true + } } - h.EXPECT().StateSyncEvents(gomock.Any(), fromID, to).Return(eventRecords, nil).MinTimes(1) - _bor.SetHeimdallClient(h) + return false +} - // Insert blocks for 0th sprint - db := init.ethereum.ChainDb() - block := init.genesis.ToBlock(db) - - signer := types.LatestSigner(init.genesis.Config) - toAddress := common.HexToAddress("0x000000000000000000000000000000000000aaaa") - - currentValidators := []*valset.Validator{valset.NewValidator(addr, 10)} - txHashes := map[int]common.Hash{} // blockNumber -> txHash - - var ( - err error - nonce uint64 - tx *types.Transaction - txs []*types.Transaction - ) - - for i := uint64(1); i <= sprintSize; i++ { - if IsSpanEnd(i) { - currentValidators = []*valset.Validator{valset.NewValidator(addr, 10)} +func areDifferentHashes(receipts []map[string]interface{}) bool { + addresses := []common.Hash{} + for i := 0; i < len(receipts); i++ { + addresses = append(addresses, receipts[i]["transactionHash"].(common.Hash)) + if duplicateInArray(addresses) { + return false } + } + + return true +} + +// Test for GetTransactionReceiptsByBlock +func testGetTransactionReceiptsByBlock(t *testing.T, publicBlockchainAPI *ethapi.PublicBlockChainAPI) { + // check 1 : zero transactions + receiptsOut, err := publicBlockchainAPI.GetTransactionReceiptsByBlock(context.Background(), rpc.BlockNumberOrHashWithNumber(1)) + if err != nil { + t.Error(err) + } + + assert.Equal(t, 0, len(receiptsOut)) + + // check 2 : one transactions ( normal ) + receiptsOut, err = publicBlockchainAPI.GetTransactionReceiptsByBlock(context.Background(), rpc.BlockNumberOrHashWithNumber(2)) + if err != nil { + t.Error(err) + } + + assert.Equal(t, 1, len(receiptsOut)) + assert.True(t, areDifferentHashes(receiptsOut)) + + // check 3 : two transactions ( both normal ) + receiptsOut, err = publicBlockchainAPI.GetTransactionReceiptsByBlock(context.Background(), rpc.BlockNumberOrHashWithNumber(3)) + if err != nil { + t.Error(err) + } + + assert.Equal(t, 2, len(receiptsOut)) + assert.True(t, areDifferentHashes(receiptsOut)) + + // check 4 : two transactions ( one normal + one state-sync) + receiptsOut, err = publicBlockchainAPI.GetTransactionReceiptsByBlock(context.Background(), rpc.BlockNumberOrHashWithNumber(4)) + if err != nil { + t.Error(err) + } + + assert.Equal(t, 2, len(receiptsOut)) + assert.True(t, areDifferentHashes(receiptsOut)) + +} + +// Test for GetTransactionByBlockNumberAndIndex +func testGetTransactionByBlockNumberAndIndex(t *testing.T, publicTransactionPoolAPI *ethapi.PublicTransactionPoolAPI) { + // check 1 : False ( no transaction ) + tx := publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(1), 0) + assert.Nil(t, tx) + + // check 2 : Normal Transaction + tx = publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(2), 0) + assert.Equal(t, common.HexToAddress("0x24"), *tx.To) + + // check 3 : Normal Transaction + tx = publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(3), 0) + assert.Equal(t, common.HexToAddress("0x992"), *tx.To) + + // check 4 : Normal Transaction + tx = publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(3), 1) + assert.Equal(t, common.HexToAddress("0x993"), *tx.To) + + // check 5 : Normal Transaction + tx = publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(4), 0) + assert.Equal(t, common.HexToAddress("0x1000"), *tx.To) + + // check 5 : Normal Transaction + tx = publicTransactionPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(4), 1) + assert.Equal(t, common.HexToAddress("0x0"), *tx.To) +} + +// This Testcase tests functions for RPC API calls. +// NOTE : Changes to this function might affect the child testcases. +func TestAPIs(t *testing.T) { + + defer func() { + if err := stack.Close(); err != nil { + t.Error(err) + } + }() + + genesis := core.GenesisBlockForTesting(db, addrr, big.NewInt(1000000)) + sprint := params.TestChainConfig.Bor.Sprint + + chain, receipts := core.GenerateChain(params.TestChainConfig, genesis, ethash.NewFaker(), db, 6, func(i int, gen *core.BlockGen) { + switch i { + + case 1: // 1 normal transaction on block 2 + receipt := types.NewReceipt(nil, false, 0) + receipt.Logs = []*types.Log{ + { + Address: addrr, + Topics: []common.Hash{hash1}, + }, + } + gen.AddUncheckedReceipt(receipt) + gen.AddUncheckedTx(types.NewTransaction(24, common.HexToAddress("0x24"), big.NewInt(24), 24, gen.BaseFee(), nil)) + + case 2: // 2 normal transactions on block 3 + receipt := types.NewReceipt(nil, false, 0) + receipt.Logs = []*types.Log{ + { + Address: addrr, + Topics: []common.Hash{hash2}, + }, + } + gen.AddUncheckedReceipt(receipt) + gen.AddUncheckedTx(types.NewTransaction(992, common.HexToAddress("0x992"), big.NewInt(992), 992, gen.BaseFee(), nil)) + + receipt2 := types.NewReceipt(nil, false, 0) + receipt2.Logs = []*types.Log{ + { + Address: addrr, + Topics: []common.Hash{hash3}, + }, + } + gen.AddUncheckedReceipt(receipt2) + gen.AddUncheckedTx(types.NewTransaction(993, common.HexToAddress("0x993"), big.NewInt(993), 993, gen.BaseFee(), nil)) + + case 3: // 1 normal transaction, 1 state-sync transaction on block 4 + receipt := types.NewReceipt(nil, false, 0) + receipt.Logs = []*types.Log{ + { + Address: addrr, + Topics: []common.Hash{hash4}, + }, + } + gen.AddUncheckedReceipt(receipt) + gen.AddUncheckedTx(types.NewTransaction(1000, common.HexToAddress("0x1000"), big.NewInt(1000), 1000, gen.BaseFee(), nil)) + + // state-sync transaction + receipt2 := types.NewReceipt(nil, false, 0) + receipt2.Logs = []*types.Log{ + { + Address: addrr, + Topics: []common.Hash{hash5}, + }, + } + gen.AddUncheckedReceipt(receipt2) + // not adding unchecked tx as it will be added as a state-sync tx later + + } + }) + + for i, block := range chain { + // write the block to database + rawdb.WriteBlock(db, block) + rawdb.WriteCanonicalHash(db, block.Hash(), block.NumberU64()) + rawdb.WriteHeadBlockHash(db, block.Hash()) + + blockBatch := db.NewBatch() + + if i%int(sprint-1) != 0 { + // if it is not sprint start write all the transactions as normal transactions. + rawdb.WriteReceipts(db, block.Hash(), block.NumberU64(), receipts[i]) + } else { + // check for blocks with receipts. Since in state-sync block, we have 1 normal txn and 1 state-sync txn. + if len(receipts[i]) > 0 { + // We write receipts for the normal transaction. + rawdb.WriteReceipts(db, block.Hash(), block.NumberU64(), receipts[i][:1]) + + // write the state-sync receipts to database => receipts[i][1:] => receipts[i][1] + // State sync logs don't have tx index, tx hash and other necessary fields, DeriveFieldsForBorLogs will fill those fields for websocket subscriptions + // DeriveFieldsForBorLogs argurments: + // 1. State-sync logs + // 2. Block Hash + // 3. Block Number + // 4. Transactions in the block(except state-sync) i.e. 1 in our case + // 5. AllLogs -(minus) StateSyncLogs ; since we only have state-sync tx, it will be 1 + types.DeriveFieldsForBorLogs(receipts[i][1].Logs, block.Hash(), block.NumberU64(), uint(1), uint(1)) + + rawdb.WriteBorReceipt(blockBatch, block.Hash(), block.NumberU64(), &types.ReceiptForStorage{ + Status: types.ReceiptStatusSuccessful, // make receipt status successful + Logs: receipts[i][1].Logs, + }) + + rawdb.WriteBorTxLookupEntry(blockBatch, block.Hash(), block.NumberU64()) - if i%3 == 0 { - txdata := &types.LegacyTx{ - Nonce: nonce, - To: &toAddress, - Gas: 30000, - GasPrice: newGwei(5), } - nonce++ - - tx = types.NewTx(txdata) - tx, err = types.SignTx(tx, signer, key) - require.Nil(t, err, "an incorrect transaction or signer") - - txs = []*types.Transaction{tx} - } else { - txs = nil } - block = buildNextBlock(t, _bor, chain, block, nil, init.genesis.Config.Bor, txs, currentValidators) - insertNewBlock(t, chain, block) - - if len(txs) != 0 { - txHashes[int(block.Number().Uint64())] = tx.Hash() + if err := blockBatch.Write(); err != nil { + t.Error("Failed to write block into disk", "err", err) } } - // state 6 was not written - // - fromID = uint64(4) - to = int64(chain.GetHeaderByNumber(sprintSize).Time) + // Testing GetTransactionReceiptsByBlock + publicBlockchainAPI := backend.PublicBlockChainAPI() + testGetTransactionReceiptsByBlock(t, publicBlockchainAPI) - eventRecords = []*clerk.EventRecordWithTime{ - buildStateEvent(sample, 4, 4), - buildStateEvent(sample, 5, 5), - } - h.EXPECT().StateSyncEvents(gomock.Any(), fromID, to).Return(eventRecords, nil).MinTimes(1) + // Testing GetTransactionByBlockNumberAndIndex + nonceLock := new(ethapi.AddrLocker) + publicTransactionPoolAPI := ethapi.NewPublicTransactionPoolAPI(backend.APIBackend, nonceLock) + testGetTransactionByBlockNumberAndIndex(t, publicTransactionPoolAPI) - for i := sprintSize + 1; i <= spanSize; i++ { - block = buildNextBlock(t, _bor, chain, block, nil, init.genesis.Config.Bor, nil, currentValidators) - insertNewBlock(t, chain, block) - } - - ethAPI := ethapi.NewPublicBlockChainAPI(init.ethereum.APIBackend) - txPoolAPI := ethapi.NewPublicTransactionPoolAPI(init.ethereum.APIBackend, nil) - - for n := 0; n < int(spanSize)+1; n++ { - rpcNumber := rpc.BlockNumberOrHashWithNumber(rpc.BlockNumber(n)) - - txs, err := ethAPI.GetTransactionReceiptsByBlock(context.Background(), rpcNumber) - require.Nil(t, err) - - tx := txPoolAPI.GetTransactionByBlockNumberAndIndex(context.Background(), rpc.BlockNumber(n), 0) - - blockMap, err := ethAPI.GetBlockByNumber(context.Background(), rpc.BlockNumber(n), true) - require.Nil(t, err) - - expectedTxHash, ok := txHashes[n] - // FIXME: add `IsSprintStart(uint64(n)) || IsSpanStart(uint64(n))` after adding a full state receiver contract - if ok { - require.Len(t, txs, 1) - - require.NotNil(t, tx, "not nil receipt expected") - - require.Equal(t, expectedTxHash, tx.Hash, "got different from expected receipt") - - blockTxs, ok := blockMap["transactions"].([]interface{}) - require.Len(t, blockTxs, 1) - - blockTx, ok := blockTxs[0].(*ethapi.RPCTransaction) - require.True(t, ok) - require.Equal(t, expectedTxHash, blockTx.Hash) - } else { - require.Len(t, txs, 0) - - require.Nil(t, tx, "nil receipt expected") - - blockTxs, _ := blockMap["transactions"].([]interface{}) - require.Len(t, blockTxs, 0) - } - } } diff --git a/tests/bor/bor_filter_test.go b/tests/bor/bor_filter_test.go new file mode 100644 index 0000000000..25cfa078a1 --- /dev/null +++ b/tests/bor/bor_filter_test.go @@ -0,0 +1,183 @@ +//go:build integration + +package bor + +import ( + "context" + "fmt" + "math/big" + "testing" + + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/consensus/ethash" + "github.com/ethereum/go-ethereum/core" + "github.com/ethereum/go-ethereum/core/rawdb" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" + "github.com/ethereum/go-ethereum/eth/filters" + "github.com/ethereum/go-ethereum/params" +) + +func TestBorFilters(t *testing.T) { + t.Parallel() + + var ( + db = rawdb.NewMemoryDatabase() + backend = &filters.TestBackend{DB: db} + key1, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291") + addr = crypto.PubkeyToAddress(key1.PublicKey) + + hash1 = common.BytesToHash([]byte("topic1")) + hash2 = common.BytesToHash([]byte("topic2")) + hash3 = common.BytesToHash([]byte("topic3")) + hash4 = common.BytesToHash([]byte("topic4")) + ) + + defer db.Close() + + genesis := core.GenesisBlockForTesting(db, addr, big.NewInt(1000000)) + sprint := params.TestChainConfig.Bor.Sprint + + chain, receipts := core.GenerateChain(params.TestChainConfig, genesis, ethash.NewFaker(), db, 1000, func(i int, gen *core.BlockGen) { + switch i { + case 7: //state-sync tx at block 8 + receipt := types.NewReceipt(nil, false, 0) + receipt.Logs = []*types.Log{ + { + Address: addr, + Topics: []common.Hash{hash1}, + }, + } + gen.AddUncheckedReceipt(receipt) + gen.AddUncheckedTx(types.NewTransaction(8, common.HexToAddress("0x8"), big.NewInt(8), 8, gen.BaseFee(), nil)) + + case 23: //state-sync tx at block 24 + receipt := types.NewReceipt(nil, false, 0) + receipt.Logs = []*types.Log{ + { + Address: addr, + Topics: []common.Hash{hash2}, + }, + } + gen.AddUncheckedReceipt(receipt) + gen.AddUncheckedTx(types.NewTransaction(24, common.HexToAddress("0x24"), big.NewInt(24), 24, gen.BaseFee(), nil)) + + case 991: //state-sync tx at block 992 + receipt := types.NewReceipt(nil, false, 0) + receipt.Logs = []*types.Log{ + { + Address: addr, + Topics: []common.Hash{hash3}, + }, + } + gen.AddUncheckedReceipt(receipt) + gen.AddUncheckedTx(types.NewTransaction(992, common.HexToAddress("0x992"), big.NewInt(992), 992, gen.BaseFee(), nil)) + + case 999: //state-sync tx at block 1000 + receipt := types.NewReceipt(nil, false, 0) + receipt.Logs = []*types.Log{ + { + Address: addr, + Topics: []common.Hash{hash4}, + }, + } + gen.AddUncheckedReceipt(receipt) + gen.AddUncheckedTx(types.NewTransaction(1000, common.HexToAddress("0x1000"), big.NewInt(1000), 1000, gen.BaseFee(), nil)) + } + }) + + for i, block := range chain { + // write the block to database + rawdb.WriteBlock(db, block) + rawdb.WriteCanonicalHash(db, block.Hash(), block.NumberU64()) + rawdb.WriteHeadBlockHash(db, block.Hash()) + + blockBatch := db.NewBatch() + + // since all the transactions are state-sync, we will not include them as normal receipts + rawdb.WriteReceipts(db, block.Hash(), block.NumberU64(), []*types.Receipt{}) + + // check for blocks with receipts. Since the only receipt is state-sync, we can check the length of receipts + if len(receipts[i]) > 0 { + // write the state-sync receipts to database + // State sync logs don't have tx index, tx hash and other necessary fields, DeriveFieldsForBorLogs will fill those fields for websocket subscriptions + // DeriveFieldsForBorLogs argurments: + // 1. State-sync logs + // 2. Block Hash + // 3. Block Number + // 4. Transactions in the block(except state-sync) i.e. 0 in our case + // 5. AllLogs - StateSyncLogs ; since we only have state-sync tx, it will be 0 + types.DeriveFieldsForBorLogs(receipts[i][0].Logs, block.Hash(), block.NumberU64(), uint(0), uint(0)) + + rawdb.WriteBorReceipt(blockBatch, block.Hash(), block.NumberU64(), &types.ReceiptForStorage{ + Status: types.ReceiptStatusSuccessful, // make receipt status successful + Logs: receipts[i][0].Logs, + }) + + rawdb.WriteBorTxLookupEntry(blockBatch, block.Hash(), block.NumberU64()) + } + + if err := blockBatch.Write(); err != nil { + fmt.Println("Failed to write block into disk", "err", err) + } + } + + filter := filters.NewBorBlockLogsRangeFilter(backend, sprint, 0, -1, []common.Address{addr}, [][]common.Hash{{hash1, hash2, hash3, hash4}}) + + logs, _ := filter.Logs(context.Background()) + if len(logs) != 4 { + t.Error("expected 4 log, got", len(logs)) + } + + filter = filters.NewBorBlockLogsRangeFilter(backend, sprint, 900, 999, []common.Address{addr}, [][]common.Hash{{hash3}}) + logs, _ = filter.Logs(context.Background()) + + if len(logs) != 1 { + t.Error("expected 1 log, got", len(logs)) + } + + if len(logs) > 0 && logs[0].Topics[0] != hash3 { + t.Errorf("expected log[0].Topics[0] to be %x, got %x", hash3, logs[0].Topics[0]) + } + + filter = filters.NewBorBlockLogsRangeFilter(backend, sprint, 992, -1, []common.Address{addr}, [][]common.Hash{{hash3}}) + logs, _ = filter.Logs(context.Background()) + + if len(logs) != 1 { + t.Error("expected 1 log, got", len(logs)) + } + + if len(logs) > 0 && logs[0].Topics[0] != hash3 { + t.Errorf("expected log[0].Topics[0] to be %x, got %x", hash3, logs[0].Topics[0]) + } + + filter = filters.NewBorBlockLogsRangeFilter(backend, sprint, 1, -1, []common.Address{addr}, [][]common.Hash{{hash1, hash2}}) + + logs, _ = filter.Logs(context.Background()) + if len(logs) != 2 { + t.Error("expected 2 log, got", len(logs)) + } + + failHash := common.BytesToHash([]byte("fail")) + filter = filters.NewBorBlockLogsRangeFilter(backend, sprint, 0, -1, nil, [][]common.Hash{{failHash}}) + + logs, _ = filter.Logs(context.Background()) + if len(logs) != 0 { + t.Error("expected 0 log, got", len(logs)) + } + + failAddr := common.BytesToAddress([]byte("failmenow")) + filter = filters.NewBorBlockLogsRangeFilter(backend, sprint, 0, -1, []common.Address{failAddr}, nil) + + logs, _ = filter.Logs(context.Background()) + if len(logs) != 0 { + t.Error("expected 0 log, got", len(logs)) + } + + filter = filters.NewBorBlockLogsRangeFilter(backend, sprint, 0, -1, nil, [][]common.Hash{{failHash}, {hash1}}) + + logs, _ = filter.Logs(context.Background()) + if len(logs) != 0 { + t.Error("expected 0 log, got", len(logs)) + } +}