mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-27 15:16:43 +00:00
Merge remote-tracking branch 'origin/upstream_merge_v1.14.8' into lmartins/upstream_merge_v1.14.10
This commit is contained in:
commit
26ec762a11
73 changed files with 509 additions and 1540 deletions
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
|
|
@ -236,15 +236,9 @@ jobs:
|
||||||
- name: Launch devnet
|
- name: Launch devnet
|
||||||
run: |
|
run: |
|
||||||
cd matic-cli/devnet
|
cd matic-cli/devnet
|
||||||
bash docker-ganache-start.sh
|
bash ../docker_devnet.sh
|
||||||
bash docker-heimdall-start-all.sh
|
|
||||||
bash docker-bor-setup.sh
|
|
||||||
bash docker-bor-start-all.sh
|
|
||||||
cd -
|
cd -
|
||||||
timeout 2m bash bor/integration-tests/bor_health.sh
|
timeout 2m bash bor/integration-tests/bor_health.sh
|
||||||
cd -
|
|
||||||
bash ganache-deployment-bor.sh
|
|
||||||
bash ganache-deployment-sync.sh
|
|
||||||
|
|
||||||
- name: Run smoke tests
|
- name: Run smoke tests
|
||||||
run: |
|
run: |
|
||||||
|
|
|
||||||
|
|
@ -709,7 +709,7 @@ func (b *SimulatedBackend) callContract(ctx context.Context, call ethereum.CallM
|
||||||
vmEnv := vm.NewEVM(evmContext, txContext, stateDB, b.config, vm.Config{NoBaseFee: true})
|
vmEnv := vm.NewEVM(evmContext, txContext, stateDB, b.config, vm.Config{NoBaseFee: true})
|
||||||
gasPool := new(core.GasPool).AddGas(math.MaxUint64)
|
gasPool := new(core.GasPool).AddGas(math.MaxUint64)
|
||||||
|
|
||||||
return core.ApplyMessage(vmEnv, msg, gasPool)
|
return core.ApplyMessage(vmEnv, msg, gasPool, context.Background())
|
||||||
}
|
}
|
||||||
|
|
||||||
// SendTransaction updates the pending block to include the given transaction.
|
// SendTransaction updates the pending block to include the given transaction.
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,7 @@
|
||||||
# NOTE: Uncomment and configure the following 8 fields in case you run a validator:
|
# NOTE: Uncomment and configure the following 8 fields in case you run a validator:
|
||||||
# `mine`, `etherbase`, `nodiscover`, `maxpeers`, `keystore`, `allow-insecure-unlock`, `password`, `unlock`
|
# `mine`, `etherbase`, `nodiscover`, `maxpeers`, `keystore`, `allow-insecure-unlock`, `password`, `unlock`
|
||||||
|
|
||||||
chain = "mainnet"
|
chain = "mainnet" # Set it to `amoy` for testnet
|
||||||
# chain = "mumbai", "amoy"
|
|
||||||
# identity = "Annon-Identity"
|
# identity = "Annon-Identity"
|
||||||
# verbosity = 3
|
# verbosity = 3
|
||||||
# vmdebug = false
|
# vmdebug = false
|
||||||
|
|
@ -42,13 +41,16 @@ syncmode = "full"
|
||||||
# v4disc = true
|
# v4disc = true
|
||||||
# v5disc = false
|
# v5disc = false
|
||||||
bootnodes = ["enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303", "enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303"]
|
bootnodes = ["enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303", "enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303"]
|
||||||
# Uncomment below `bootnodes` field for Mumbai bootnode
|
# Uncomment below `bootnodes` field for Amoy
|
||||||
# bootnodes = ["enode://bdcd4786a616a853b8a041f53496d853c68d99d54ff305615cd91c03cd56895e0a7f6e9f35dbf89131044e2114a9a782b792b5661e3aff07faf125a98606a071@43.200.206.40:30303", "enode://209aaf7ed549cf4a5700fd833da25413f80a1248bd3aa7fe2a87203e3f7b236dd729579e5c8df61c97bf508281bae4969d6de76a7393bcbd04a0af70270333b3@54.216.248.9:30303"]
|
# bootnodes = ["enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303"]
|
||||||
# bootnodesv4 = []
|
# bootnodesv4 = []
|
||||||
# bootnodesv5 = []
|
# bootnodesv5 = []
|
||||||
# static-nodes = []
|
# static-nodes = []
|
||||||
# trusted-nodes = []
|
# trusted-nodes = []
|
||||||
# dns = []
|
dns = [ "enrtree://AKUEZKN7PSKVNR65FZDHECMKOJQSGPARGTPPBI7WS2VUL4EGR6XPC@pos.polygon-peers.io" ] # For pos mainnet
|
||||||
|
# Uncomment below `dns` field for Amoy
|
||||||
|
# dns = [ "enrtree://AKUEZKN7PSKVNR65FZDHECMKOJQSGPARGTPPBI7WS2VUL4EGR6XPC@amoy.polygon-peers.io" ]
|
||||||
|
|
||||||
|
|
||||||
# [heimdall]
|
# [heimdall]
|
||||||
# url = "http://localhost:1317"
|
# url = "http://localhost:1317"
|
||||||
|
|
@ -59,9 +61,9 @@ syncmode = "full"
|
||||||
nolocals = true
|
nolocals = true
|
||||||
pricelimit = 25000000000
|
pricelimit = 25000000000
|
||||||
accountslots = 16
|
accountslots = 16
|
||||||
globalslots = 32768
|
globalslots = 131072
|
||||||
accountqueue = 16
|
accountqueue = 64
|
||||||
globalqueue = 32768
|
globalqueue = 131072
|
||||||
lifetime = "1h30m0s"
|
lifetime = "1h30m0s"
|
||||||
# locals = []
|
# locals = []
|
||||||
# journal = ""
|
# journal = ""
|
||||||
|
|
@ -179,6 +181,7 @@ syncmode = "full"
|
||||||
# [parallelevm]
|
# [parallelevm]
|
||||||
# enable = true
|
# enable = true
|
||||||
# procs = 8
|
# procs = 8
|
||||||
|
# enforce = false
|
||||||
|
|
||||||
# [pprof]
|
# [pprof]
|
||||||
# pprof = false
|
# pprof = false
|
||||||
|
|
|
||||||
|
|
@ -262,7 +262,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
|
||||||
tracer.OnTxStart(evm.GetVMContext(), tx, msg.From)
|
tracer.OnTxStart(evm.GetVMContext(), tx, msg.From)
|
||||||
}
|
}
|
||||||
// (ret []byte, usedGas uint64, failed bool, err error)
|
// (ret []byte, usedGas uint64, failed bool, err error)
|
||||||
msgResult, err := core.ApplyMessage(evm, msg, gaspool)
|
msgResult, err := core.ApplyMessage(evm, msg, gaspool, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
statedb.RevertToSnapshot(snapshot)
|
statedb.RevertToSnapshot(snapshot)
|
||||||
log.Info("rejected tx", "index", i, "hash", tx.Hash(), "from", msg.From, "error", err)
|
log.Info("rejected tx", "index", i, "hash", tx.Hash(), "from", msg.From, "error", err)
|
||||||
|
|
|
||||||
|
|
@ -457,29 +457,6 @@ func startNode(ctx *cli.Context, stack *node.Node, isConsole bool) {
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
// POS-2798 - We don't really use cmd/geth for cli purposes
|
|
||||||
// And to maintain compatibility with the future upstream merges,
|
|
||||||
// we are removing the backend ethapi.Backend param from the function signature
|
|
||||||
|
|
||||||
// Start auxiliary services if enabled
|
|
||||||
// if ctx.Bool(utils.MiningEnabledFlag.Name) {
|
|
||||||
// // Mining only makes sense if a full Ethereum node is running
|
|
||||||
// if ctx.String(utils.SyncModeFlag.Name) == "light" {
|
|
||||||
// utils.Fatalf("Light clients do not support mining")
|
|
||||||
// }
|
|
||||||
|
|
||||||
// ethBackend, ok := backend.(*eth.EthAPIBackend)
|
|
||||||
// if !ok {
|
|
||||||
// utils.Fatalf("Ethereum service not running")
|
|
||||||
// }
|
|
||||||
// // Set the gas price to the limits from the CLI and start mining
|
|
||||||
// gasprice := flags.GlobalBig(ctx, utils.MinerGasPriceFlag.Name)
|
|
||||||
// ethBackend.TxPool().SetGasTip(gasprice)
|
|
||||||
// if err := ethBackend.StartMining(); err != nil {
|
|
||||||
// utils.Fatalf("Failed to start mining: %v", err)
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// unlockAccounts unlocks any account specifically requested.
|
// unlockAccounts unlocks any account specifically requested.
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,6 @@
|
||||||
package beacon
|
package beacon
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
@ -429,9 +428,9 @@ func (beacon *Beacon) FinalizeAndAssemble(chain consensus.ChainHeaderReader, hea
|
||||||
//
|
//
|
||||||
// Note, the method returns immediately and will send the result async. More
|
// Note, the method returns immediately and will send the result async. More
|
||||||
// than one result may also be returned depending on the consensus algorithm.
|
// than one result may also be returned depending on the consensus algorithm.
|
||||||
func (beacon *Beacon) Seal(ctx context.Context, chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error {
|
func (beacon *Beacon) Seal(chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error {
|
||||||
if !beacon.IsPoSHeader(block.Header()) {
|
if !beacon.IsPoSHeader(block.Header()) {
|
||||||
return beacon.ethone.Seal(ctx, chain, block, results, stop)
|
return beacon.ethone.Seal(chain, block, results, stop)
|
||||||
}
|
}
|
||||||
// The seal verification is done by the external consensus engine,
|
// The seal verification is done by the external consensus engine,
|
||||||
// return directly without pushing any block back. In another word
|
// return directly without pushing any block back. In another word
|
||||||
|
|
|
||||||
|
|
@ -17,13 +17,10 @@ import (
|
||||||
|
|
||||||
lru "github.com/hashicorp/golang-lru"
|
lru "github.com/hashicorp/golang-lru"
|
||||||
"github.com/holiman/uint256"
|
"github.com/holiman/uint256"
|
||||||
"go.opentelemetry.io/otel/attribute"
|
|
||||||
"go.opentelemetry.io/otel/trace"
|
|
||||||
"golang.org/x/crypto/sha3"
|
"golang.org/x/crypto/sha3"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/accounts"
|
"github.com/ethereum/go-ethereum/accounts"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/common/tracing"
|
|
||||||
balance_tracing "github.com/ethereum/go-ethereum/core/tracing"
|
balance_tracing "github.com/ethereum/go-ethereum/core/tracing"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/consensus"
|
"github.com/ethereum/go-ethereum/consensus"
|
||||||
|
|
@ -820,30 +817,28 @@ func (c *Bor) Prepare(chain consensus.ChainHeaderReader, header *types.Header) e
|
||||||
// Finalize implements consensus.Engine, ensuring no uncles are set, nor block
|
// Finalize implements consensus.Engine, ensuring no uncles are set, nor block
|
||||||
// rewards given.
|
// rewards given.
|
||||||
func (c *Bor) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body) {
|
func (c *Bor) Finalize(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body) {
|
||||||
|
headerNumber := header.Number.Uint64()
|
||||||
|
if body.Withdrawals != nil || header.WithdrawalsHash != nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
stateSyncData []*types.StateSyncData
|
stateSyncData []*types.StateSyncData
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
headerNumber := header.Number.Uint64()
|
|
||||||
|
|
||||||
if body.Withdrawals != nil || header.WithdrawalsHash != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if IsSprintStart(headerNumber, c.config.CalculateSprint(headerNumber)) {
|
if IsSprintStart(headerNumber, c.config.CalculateSprint(headerNumber)) {
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
ctx := context.Background()
|
|
||||||
cx := statefull.ChainContext{Chain: chain, Bor: c}
|
cx := statefull.ChainContext{Chain: chain, Bor: c}
|
||||||
// check and commit span
|
// check and commit span
|
||||||
if err := c.checkAndCommitSpan(ctx, state, header, cx); err != nil {
|
if err := c.checkAndCommitSpan(state, header, cx); err != nil {
|
||||||
log.Error("Error while committing span", "error", err)
|
log.Error("Error while committing span", "error", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.HeimdallClient != nil {
|
if c.HeimdallClient != nil {
|
||||||
// commit states
|
// commit states
|
||||||
stateSyncData, err = c.CommitStates(ctx, state, header, cx)
|
stateSyncData, err = c.CommitStates(state, header, cx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Error while committing states", "error", err)
|
log.Error("Error while committing states", "error", err)
|
||||||
return
|
return
|
||||||
|
|
@ -908,38 +903,28 @@ func (c *Bor) changeContractCodeIfNeeded(headerNumber uint64, state *state.State
|
||||||
// FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set,
|
// FinalizeAndAssemble implements consensus.Engine, ensuring no uncles are set,
|
||||||
// nor block rewards given, and returns the final block.
|
// nor block rewards given, and returns the final block.
|
||||||
func (c *Bor) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt) (*types.Block, error) {
|
func (c *Bor) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *types.Header, state *state.StateDB, body *types.Body, receipts []*types.Receipt) (*types.Block, error) {
|
||||||
finalizeCtx, finalizeSpan := tracing.StartSpan(context.Background(), "bor.FinalizeAndAssemble")
|
|
||||||
defer tracing.EndSpan(finalizeSpan)
|
|
||||||
|
|
||||||
headerNumber := header.Number.Uint64()
|
headerNumber := header.Number.Uint64()
|
||||||
|
|
||||||
if body.Withdrawals != nil || header.WithdrawalsHash != nil {
|
if body.Withdrawals != nil || header.WithdrawalsHash != nil {
|
||||||
return nil, consensus.ErrUnexpectedWithdrawals
|
return nil, consensus.ErrUnexpectedWithdrawals
|
||||||
}
|
}
|
||||||
|
|
||||||
stateSyncData := []*types.StateSyncData{}
|
var (
|
||||||
|
stateSyncData []*types.StateSyncData
|
||||||
var err error
|
err error
|
||||||
|
)
|
||||||
|
|
||||||
if IsSprintStart(headerNumber, c.config.CalculateSprint(headerNumber)) {
|
if IsSprintStart(headerNumber, c.config.CalculateSprint(headerNumber)) {
|
||||||
cx := statefull.ChainContext{Chain: chain, Bor: c}
|
cx := statefull.ChainContext{Chain: chain, Bor: c}
|
||||||
|
|
||||||
tracing.Exec(finalizeCtx, "", "bor.checkAndCommitSpan", func(ctx context.Context, span trace.Span) {
|
|
||||||
// check and commit span
|
// check and commit span
|
||||||
err = c.checkAndCommitSpan(finalizeCtx, state, header, cx)
|
if err = c.checkAndCommitSpan(state, header, cx); err != nil {
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
log.Error("Error while committing span", "error", err)
|
log.Error("Error while committing span", "error", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if c.HeimdallClient != nil {
|
if c.HeimdallClient != nil {
|
||||||
tracing.Exec(finalizeCtx, "", "bor.checkAndCommitSpan", func(ctx context.Context, span trace.Span) {
|
|
||||||
// commit states
|
// commit states
|
||||||
stateSyncData, err = c.CommitStates(finalizeCtx, state, header, cx)
|
stateSyncData, err = c.CommitStates(state, header, cx)
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Error while committing states", "error", err)
|
log.Error("Error while committing states", "error", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
@ -947,19 +932,13 @@ func (c *Bor) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *typ
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
tracing.Exec(finalizeCtx, "", "bor.changeContractCodeIfNeeded", func(ctx context.Context, span trace.Span) {
|
if err = c.changeContractCodeIfNeeded(headerNumber, state); err != nil {
|
||||||
err = c.changeContractCodeIfNeeded(headerNumber, state)
|
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
log.Error("Error changing contract code", "error", err)
|
log.Error("Error changing contract code", "error", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
// No block rewards in PoA, so the state remains as it is
|
// No block rewards in PoA, so the state remains as it is
|
||||||
tracing.Exec(finalizeCtx, "", "bor.IntermediateRoot", func(ctx context.Context, span trace.Span) {
|
|
||||||
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))
|
header.Root = state.IntermediateRoot(chain.Config().IsEIP158(header.Number))
|
||||||
})
|
|
||||||
|
|
||||||
// Uncles are dropped
|
// Uncles are dropped
|
||||||
header.UncleHash = types.CalcUncleHash(nil)
|
header.UncleHash = types.CalcUncleHash(nil)
|
||||||
|
|
@ -971,14 +950,6 @@ func (c *Bor) FinalizeAndAssemble(chain consensus.ChainHeaderReader, header *typ
|
||||||
bc := chain.(core.BorStateSyncer)
|
bc := chain.(core.BorStateSyncer)
|
||||||
bc.SetStateSync(stateSyncData)
|
bc.SetStateSync(stateSyncData)
|
||||||
|
|
||||||
tracing.SetAttributes(
|
|
||||||
finalizeSpan,
|
|
||||||
attribute.Int("number", int(header.Number.Int64())),
|
|
||||||
attribute.String("hash", header.Hash().String()),
|
|
||||||
attribute.Int("number of txs", len(body.Transactions)),
|
|
||||||
attribute.Int("gas used", int(block.GasUsed())),
|
|
||||||
)
|
|
||||||
|
|
||||||
// return the final block for sealing
|
// return the final block for sealing
|
||||||
return block, nil
|
return block, nil
|
||||||
}
|
}
|
||||||
|
|
@ -994,18 +965,7 @@ func (c *Bor) Authorize(currentSigner common.Address, signFn SignerFn) {
|
||||||
|
|
||||||
// Seal implements consensus.Engine, attempting to create a sealed block using
|
// Seal implements consensus.Engine, attempting to create a sealed block using
|
||||||
// the local signing credentials.
|
// the local signing credentials.
|
||||||
func (c *Bor) Seal(ctx context.Context, chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error {
|
func (c *Bor) Seal(chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error {
|
||||||
_, sealSpan := tracing.StartSpan(ctx, "bor.Seal")
|
|
||||||
|
|
||||||
var endSpan bool = true
|
|
||||||
|
|
||||||
defer func() {
|
|
||||||
// Only end span in case of early-returns/errors
|
|
||||||
if endSpan {
|
|
||||||
tracing.EndSpan(sealSpan)
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
header := block.Header()
|
header := block.Header()
|
||||||
// Sealing the genesis block is not supported
|
// Sealing the genesis block is not supported
|
||||||
number := header.Number.Uint64()
|
number := header.Number.Uint64()
|
||||||
|
|
@ -1051,7 +1011,7 @@ func (c *Bor) Seal(ctx context.Context, chain consensus.ChainHeaderReader, block
|
||||||
// Wait until sealing is terminated or delay timeout.
|
// Wait until sealing is terminated or delay timeout.
|
||||||
log.Info("Waiting for slot to sign and propagate", "number", number, "hash", header.Hash, "delay-in-sec", uint(delay), "delay", common.PrettyDuration(delay))
|
log.Info("Waiting for slot to sign and propagate", "number", number, "hash", header.Hash, "delay-in-sec", uint(delay), "delay", common.PrettyDuration(delay))
|
||||||
|
|
||||||
go func(sealSpan trace.Span) {
|
go func() {
|
||||||
select {
|
select {
|
||||||
case <-stop:
|
case <-stop:
|
||||||
log.Debug("Discarding sealing operation for block", "number", number)
|
log.Debug("Discarding sealing operation for block", "number", number)
|
||||||
|
|
@ -1074,27 +1034,13 @@ func (c *Bor) Seal(ctx context.Context, chain consensus.ChainHeaderReader, block
|
||||||
"delay", delay,
|
"delay", delay,
|
||||||
"headerDifficulty", header.Difficulty,
|
"headerDifficulty", header.Difficulty,
|
||||||
)
|
)
|
||||||
|
|
||||||
tracing.SetAttributes(
|
|
||||||
sealSpan,
|
|
||||||
attribute.Int("number", int(number)),
|
|
||||||
attribute.String("hash", header.Hash().String()),
|
|
||||||
attribute.Int("delay", int(delay.Milliseconds())),
|
|
||||||
attribute.Int("wiggle", int(wiggle.Milliseconds())),
|
|
||||||
attribute.Bool("out-of-turn", wiggle > 0),
|
|
||||||
)
|
|
||||||
|
|
||||||
tracing.EndSpan(sealSpan)
|
|
||||||
}
|
}
|
||||||
select {
|
select {
|
||||||
case results <- block.WithSeal(header):
|
case results <- block.WithSeal(header):
|
||||||
default:
|
default:
|
||||||
log.Warn("Sealing result was not read by miner", "number", number, "sealhash", SealHash(header, c.config))
|
log.Warn("Sealing result was not read by miner", "number", number, "sealhash", SealHash(header, c.config))
|
||||||
}
|
}
|
||||||
}(sealSpan)
|
}()
|
||||||
|
|
||||||
// Set the endSpan flag to false, as the go routine will handle it
|
|
||||||
endSpan = false
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
@ -1150,11 +1096,11 @@ func (c *Bor) Close() error {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *Bor) checkAndCommitSpan(
|
func (c *Bor) checkAndCommitSpan(
|
||||||
ctx context.Context,
|
|
||||||
state *state.StateDB,
|
state *state.StateDB,
|
||||||
header *types.Header,
|
header *types.Header,
|
||||||
chain core.ChainContext,
|
chain core.ChainContext,
|
||||||
) error {
|
) error {
|
||||||
|
var ctx = context.Background()
|
||||||
headerNumber := header.Number.Uint64()
|
headerNumber := header.Number.Uint64()
|
||||||
|
|
||||||
span, err := c.spanner.GetCurrentSpan(ctx, header.ParentHash)
|
span, err := c.spanner.GetCurrentSpan(ctx, header.ParentHash)
|
||||||
|
|
@ -1228,7 +1174,6 @@ func (c *Bor) FetchAndCommitSpan(
|
||||||
|
|
||||||
// CommitStates commit states
|
// CommitStates commit states
|
||||||
func (c *Bor) CommitStates(
|
func (c *Bor) CommitStates(
|
||||||
ctx context.Context,
|
|
||||||
state *state.StateDB,
|
state *state.StateDB,
|
||||||
header *types.Header,
|
header *types.Header,
|
||||||
chain statefull.ChainContext,
|
chain statefull.ChainContext,
|
||||||
|
|
@ -1269,7 +1214,7 @@ func (c *Bor) CommitStates(
|
||||||
"fromID", from,
|
"fromID", from,
|
||||||
"to", to.Format(time.RFC3339))
|
"to", to.Format(time.RFC3339))
|
||||||
|
|
||||||
eventRecords, err := c.HeimdallClient.StateSyncEvents(ctx, from, to.Unix())
|
eventRecords, err := c.HeimdallClient.StateSyncEvents(context.Background(), from, to.Unix())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Error occurred when fetching state sync events", "fromID", from, "to", to.Unix(), "err", err)
|
log.Error("Error occurred when fetching state sync events", "fromID", from, "to", to.Unix(), "err", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -87,6 +87,7 @@ func ApplyMessage(
|
||||||
msg.Data(),
|
msg.Data(),
|
||||||
msg.Gas(),
|
msg.Gas(),
|
||||||
uint256.NewInt(msg.Value().Uint64()),
|
uint256.NewInt(msg.Value().Uint64()),
|
||||||
|
nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
success := big.NewInt(5).SetBytes(ret)
|
success := big.NewInt(5).SetBytes(ret)
|
||||||
|
|
@ -124,6 +125,7 @@ func ApplyBorMessage(vmenv *vm.EVM, msg Callmsg) (*core.ExecutionResult, error)
|
||||||
msg.Data(),
|
msg.Data(),
|
||||||
msg.Gas(),
|
msg.Gas(),
|
||||||
uint256.NewInt(msg.Value().Uint64()),
|
uint256.NewInt(msg.Value().Uint64()),
|
||||||
|
nil,
|
||||||
)
|
)
|
||||||
// Update the state with pending changes
|
// Update the state with pending changes
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -19,7 +19,6 @@ package clique
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
@ -652,7 +651,7 @@ func (c *Clique) Authorize(signer common.Address, signFn SignerFn) {
|
||||||
|
|
||||||
// Seal implements consensus.Engine, attempting to create a sealed block using
|
// Seal implements consensus.Engine, attempting to create a sealed block using
|
||||||
// the local signing credentials.
|
// the local signing credentials.
|
||||||
func (c *Clique) Seal(ctx context.Context, chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error {
|
func (c *Clique) Seal(chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error {
|
||||||
header := block.Header()
|
header := block.Header()
|
||||||
|
|
||||||
// Sealing the genesis block is not supported
|
// Sealing the genesis block is not supported
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
package consensus
|
package consensus
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
|
|
@ -103,7 +102,7 @@ type Engine interface {
|
||||||
//
|
//
|
||||||
// Note, the method returns immediately and will send the result async. More
|
// Note, the method returns immediately and will send the result async. More
|
||||||
// than one result may also be returned depending on the consensus algorithm.
|
// than one result may also be returned depending on the consensus algorithm.
|
||||||
Seal(ctx context.Context, chain ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error
|
Seal(chain ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error
|
||||||
|
|
||||||
// SealHash returns the hash of a block prior to it being sealed.
|
// SealHash returns the hash of a block prior to it being sealed.
|
||||||
SealHash(header *types.Header) common.Hash
|
SealHash(header *types.Header) common.Hash
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@
|
||||||
package ethash
|
package ethash
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/consensus"
|
"github.com/ethereum/go-ethereum/consensus"
|
||||||
|
|
@ -81,6 +80,6 @@ func (ethash *Ethash) APIs(chain consensus.ChainHeaderReader) []rpc.API {
|
||||||
// Seal generates a new sealing request for the given input block and pushes
|
// Seal generates a new sealing request for the given input block and pushes
|
||||||
// the result into the given channel. For the ethash engine, this method will
|
// the result into the given channel. For the ethash engine, this method will
|
||||||
// just panic as sealing is not supported anymore.
|
// just panic as sealing is not supported anymore.
|
||||||
func (ethash *Ethash) Seal(ctx context.Context, chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error {
|
func (ethash *Ethash) Seal(chain consensus.ChainHeaderReader, block *types.Block, results chan<- *types.Block, stop <-chan struct{}) error {
|
||||||
panic("ethash (pow) sealing not supported any more")
|
panic("ethash (pow) sealing not supported any more")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
@ -285,6 +286,7 @@ type BlockChain struct {
|
||||||
processor Processor // Block transaction processor interface
|
processor Processor // Block transaction processor interface
|
||||||
parallelProcessor Processor // Parallel block transaction processor interface
|
parallelProcessor Processor // Parallel block transaction processor interface
|
||||||
parallelSpeculativeProcesses int // Number of parallel speculative processes
|
parallelSpeculativeProcesses int // Number of parallel speculative processes
|
||||||
|
enforceParallelProcessor bool
|
||||||
forker *ForkChoice
|
forker *ForkChoice
|
||||||
vmConfig vm.Config
|
vmConfig vm.Config
|
||||||
logger *tracing.Hooks
|
logger *tracing.Hooks
|
||||||
|
|
@ -554,7 +556,7 @@ func NewBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewParallelBlockChain , similar to NewBlockChain, creates a new blockchain object, but with a parallel state processor
|
// NewParallelBlockChain , similar to NewBlockChain, creates a new blockchain object, but with a parallel state processor
|
||||||
func NewParallelBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis, overrides *ChainOverrides, engine consensus.Engine, vmConfig vm.Config, shouldPreserve func(header *types.Header) bool, txLookupLimit *uint64, checker ethereum.ChainValidator, numprocs int) (*BlockChain, error) {
|
func NewParallelBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis *Genesis, overrides *ChainOverrides, engine consensus.Engine, vmConfig vm.Config, shouldPreserve func(header *types.Header) bool, txLookupLimit *uint64, checker ethereum.ChainValidator, numprocs int, enforce bool) (*BlockChain, error) {
|
||||||
bc, err := NewBlockChain(db, cacheConfig, genesis, overrides, engine, vmConfig, shouldPreserve, txLookupLimit, checker)
|
bc, err := NewBlockChain(db, cacheConfig, genesis, overrides, engine, vmConfig, shouldPreserve, txLookupLimit, checker)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -572,12 +574,15 @@ func NewParallelBlockChain(db ethdb.Database, cacheConfig *CacheConfig, genesis
|
||||||
|
|
||||||
bc.parallelProcessor = NewParallelStateProcessor(chainConfig, bc, engine)
|
bc.parallelProcessor = NewParallelStateProcessor(chainConfig, bc, engine)
|
||||||
bc.parallelSpeculativeProcesses = numprocs
|
bc.parallelSpeculativeProcesses = numprocs
|
||||||
|
bc.enforceParallelProcessor = enforce
|
||||||
|
|
||||||
return bc, nil
|
return bc, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bc *BlockChain) ProcessBlock(block *types.Block, parent *types.Header) (_ types.Receipts, _ []*types.Log, _ uint64, _ *state.StateDB, vtime time.Duration, blockEndErr error) {
|
func (bc *BlockChain) ProcessBlock(block *types.Block, parent *types.Header) (_ types.Receipts, _ []*types.Log, _ uint64, _ *state.StateDB, vtime time.Duration, blockEndErr error) {
|
||||||
// Process the block using processor and parallelProcessor at the same time, take the one which finishes first, cancel the other, and return the result
|
// Process the block using processor and parallelProcessor at the same time, take the one which finishes first, cancel the other, and return the result
|
||||||
|
ctx, cancel := context.WithCancel(context.Background())
|
||||||
|
defer cancel()
|
||||||
|
|
||||||
if bc.logger != nil && bc.logger.OnBlockStart != nil {
|
if bc.logger != nil && bc.logger.OnBlockStart != nil {
|
||||||
td := bc.GetTd(block.ParentHash(), block.NumberU64()-1)
|
td := bc.GetTd(block.ParentHash(), block.NumberU64()-1)
|
||||||
|
|
@ -605,7 +610,12 @@ func (bc *BlockChain) ProcessBlock(block *types.Block, parent *types.Header) (_
|
||||||
parallel bool
|
parallel bool
|
||||||
}
|
}
|
||||||
|
|
||||||
resultChan := make(chan Result, 2)
|
var resultChanLen int = 2
|
||||||
|
if bc.enforceParallelProcessor {
|
||||||
|
log.Debug("Processing block using Block STM only", "number", block.NumberU64())
|
||||||
|
resultChanLen = 1
|
||||||
|
}
|
||||||
|
resultChan := make(chan Result, resultChanLen)
|
||||||
|
|
||||||
processorCount := 0
|
processorCount := 0
|
||||||
|
|
||||||
|
|
@ -621,7 +631,7 @@ func (bc *BlockChain) ProcessBlock(block *types.Block, parent *types.Header) (_
|
||||||
go func() {
|
go func() {
|
||||||
parallelStatedb.StartPrefetcher("chain", nil)
|
parallelStatedb.StartPrefetcher("chain", nil)
|
||||||
pstart := time.Now()
|
pstart := time.Now()
|
||||||
res, err := bc.parallelProcessor.Process(block, parallelStatedb, bc.vmConfig)
|
res, err := bc.parallelProcessor.Process(block, parallelStatedb, bc.vmConfig, ctx)
|
||||||
blockExecutionParallelTimer.UpdateSince(pstart)
|
blockExecutionParallelTimer.UpdateSince(pstart)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
vstart := time.Now()
|
vstart := time.Now()
|
||||||
|
|
@ -635,7 +645,7 @@ func (bc *BlockChain) ProcessBlock(block *types.Block, parent *types.Header) (_
|
||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
|
|
||||||
if bc.processor != nil {
|
if bc.processor != nil && !bc.enforceParallelProcessor {
|
||||||
statedb, err := state.New(parent.Root, bc.statedb)
|
statedb, err := state.New(parent.Root, bc.statedb)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, 0, nil, 0, err
|
return nil, nil, 0, nil, 0, err
|
||||||
|
|
@ -647,7 +657,7 @@ func (bc *BlockChain) ProcessBlock(block *types.Block, parent *types.Header) (_
|
||||||
go func() {
|
go func() {
|
||||||
statedb.StartPrefetcher("chain", nil)
|
statedb.StartPrefetcher("chain", nil)
|
||||||
pstart := time.Now()
|
pstart := time.Now()
|
||||||
res, err := bc.processor.Process(block, statedb, bc.vmConfig)
|
res, err := bc.processor.Process(block, statedb, bc.vmConfig, ctx)
|
||||||
blockExecutionSerialTimer.UpdateSince(pstart)
|
blockExecutionSerialTimer.UpdateSince(pstart)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
vstart := time.Now()
|
vstart := time.Now()
|
||||||
|
|
@ -2416,7 +2426,7 @@ func (bc *BlockChain) insertChain(chain types.Blocks, setHead bool, makeWitness
|
||||||
// Before the actual db insertion happens, verify the block against the whitelisted
|
// Before the actual db insertion happens, verify the block against the whitelisted
|
||||||
// milestone and checkpoint. This is to prevent a race condition where a milestone
|
// milestone and checkpoint. This is to prevent a race condition where a milestone
|
||||||
// or checkpoint was whitelisted while the block execution happened (and wasn't
|
// or checkpoint was whitelisted while the block execution happened (and wasn't
|
||||||
// available sometime before) and the block turns out to be inavlid (i.e. not
|
// available sometime before) and the block turns out to be invalid (i.e. not
|
||||||
// honouring the milestone or checkpoint). Use the block itself as current block
|
// honouring the milestone or checkpoint). Use the block itself as current block
|
||||||
// so that it's considered as a `past` chain and the validation doesn't get bypassed.
|
// so that it's considered as a `past` chain and the validation doesn't get bypassed.
|
||||||
isValid, err = bc.forker.ValidateReorg(block.Header(), []*types.Header{block.Header()})
|
isValid, err = bc.forker.ValidateReorg(block.Header(), []*types.Header{block.Header()})
|
||||||
|
|
@ -2559,7 +2569,7 @@ func (bc *BlockChain) processBlock(block *types.Block, statedb *state.StateDB, s
|
||||||
|
|
||||||
// Process block using the parent state as reference point
|
// Process block using the parent state as reference point
|
||||||
pstart := time.Now()
|
pstart := time.Now()
|
||||||
res, err := bc.processor.Process(block, statedb, bc.vmConfig)
|
res, err := bc.processor.Process(block, statedb, bc.vmConfig, context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
bc.reportBlock(block, res, err)
|
bc.reportBlock(block, res, err)
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
@ -170,11 +171,16 @@ func testBlockChainImport(chain types.Blocks, blockchain *BlockChain) error {
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
statedb, err := state.New(blockchain.GetBlockByHash(block.ParentHash()).Root(), blockchain.statedb)
|
_, err = state.New(blockchain.GetBlockByHash(block.ParentHash()).Root(), blockchain.statedb)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
res, err := blockchain.processor.Process(block, statedb, vm.Config{})
|
receipts, logs, usedGas, statedb, _, err := blockchain.ProcessBlock(block, blockchain.GetBlockByHash(block.ParentHash()).Header())
|
||||||
|
res := &ProcessResult{
|
||||||
|
Receipts: receipts,
|
||||||
|
Logs: logs,
|
||||||
|
GasUsed: usedGas,
|
||||||
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
blockchain.reportBlock(block, res, err)
|
blockchain.reportBlock(block, res, err)
|
||||||
return err
|
return err
|
||||||
|
|
@ -198,11 +204,14 @@ func testBlockChainImport(chain types.Blocks, blockchain *BlockChain) error {
|
||||||
func TestParallelBlockChainImport(t *testing.T) {
|
func TestParallelBlockChainImport(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
testParallelBlockChainImport(t, rawdb.HashScheme)
|
testParallelBlockChainImport(t, rawdb.HashScheme, false)
|
||||||
testParallelBlockChainImport(t, rawdb.PathScheme)
|
testParallelBlockChainImport(t, rawdb.PathScheme, false)
|
||||||
|
|
||||||
|
testParallelBlockChainImport(t, rawdb.HashScheme, true)
|
||||||
|
testParallelBlockChainImport(t, rawdb.PathScheme, true)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testParallelBlockChainImport(t *testing.T, scheme string) {
|
func testParallelBlockChainImport(t *testing.T, scheme string, enforceParallelProcessor bool) {
|
||||||
db, _, blockchain, err := newCanonical(ethash.NewFaker(), 10, true, scheme)
|
db, _, blockchain, err := newCanonical(ethash.NewFaker(), 10, true, scheme)
|
||||||
blockchain.parallelProcessor = NewParallelStateProcessor(blockchain.chainConfig, blockchain, blockchain.engine)
|
blockchain.parallelProcessor = NewParallelStateProcessor(blockchain.chainConfig, blockchain, blockchain.engine)
|
||||||
|
|
||||||
|
|
@ -210,6 +219,8 @@ func testParallelBlockChainImport(t *testing.T, scheme string) {
|
||||||
t.Fatalf("failed to make new canonical chain: %v", err)
|
t.Fatalf("failed to make new canonical chain: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If required, enforce parallel block processing and skip serial processing completely
|
||||||
|
blockchain.enforceParallelProcessor = enforceParallelProcessor
|
||||||
defer blockchain.Stop()
|
defer blockchain.Stop()
|
||||||
|
|
||||||
block := blockchain.GetBlockByHash(blockchain.CurrentBlock().Hash())
|
block := blockchain.GetBlockByHash(blockchain.CurrentBlock().Hash())
|
||||||
|
|
@ -223,7 +234,7 @@ func testParallelBlockChainImport(t *testing.T, scheme string) {
|
||||||
type AlwaysFailParallelStateProcessor struct {
|
type AlwaysFailParallelStateProcessor struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *AlwaysFailParallelStateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg vm.Config) (*ProcessResult, error) {
|
func (p *AlwaysFailParallelStateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg vm.Config, interruptCtx context.Context) (*ProcessResult, error) {
|
||||||
return nil, errors.New("always fail")
|
return nil, errors.New("always fail")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -235,9 +246,9 @@ func NewSlowSerialStateProcessor(s Processor) *SlowSerialStateProcessor {
|
||||||
return &SlowSerialStateProcessor{s: s}
|
return &SlowSerialStateProcessor{s: s}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *SlowSerialStateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg vm.Config) (*ProcessResult, error) {
|
func (p *SlowSerialStateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg vm.Config, interruptCtx context.Context) (*ProcessResult, error) {
|
||||||
time.Sleep(100 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond)
|
||||||
return p.s.Process(block, statedb, cfg)
|
return p.s.Process(block, statedb, cfg, interruptCtx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestSuccessfulBlockImportParallelFailed(t *testing.T) {
|
func TestSuccessfulBlockImportParallelFailed(t *testing.T) {
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,7 @@ import (
|
||||||
type ParallelEVMConfig struct {
|
type ParallelEVMConfig struct {
|
||||||
Enable bool
|
Enable bool
|
||||||
SpeculativeProcesses int
|
SpeculativeProcesses int
|
||||||
|
Enforce bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// StateProcessor is a basic Processor, which takes care of transitioning
|
// StateProcessor is a basic Processor, which takes care of transitioning
|
||||||
|
|
@ -118,7 +119,7 @@ func (task *ExecutionTask) Execute(mvh *blockstm.MVHashMap, incarnation int) (er
|
||||||
|
|
||||||
// Apply the transaction to the current state (included in the env).
|
// Apply the transaction to the current state (included in the env).
|
||||||
if *task.shouldDelayFeeCal {
|
if *task.shouldDelayFeeCal {
|
||||||
task.result, err = ApplyMessageNoFeeBurnOrTip(evm, task.msg, new(GasPool).AddGas(task.gasLimit))
|
task.result, err = ApplyMessageNoFeeBurnOrTip(evm, task.msg, new(GasPool).AddGas(task.gasLimit), nil)
|
||||||
|
|
||||||
if task.result == nil || err != nil {
|
if task.result == nil || err != nil {
|
||||||
return blockstm.ErrExecAbortError{Dependency: task.statedb.DepTxIndex(), OriginError: err}
|
return blockstm.ErrExecAbortError{Dependency: task.statedb.DepTxIndex(), OriginError: err}
|
||||||
|
|
@ -138,7 +139,7 @@ func (task *ExecutionTask) Execute(mvh *blockstm.MVHashMap, incarnation int) (er
|
||||||
task.shouldRerunWithoutFeeDelay = true
|
task.shouldRerunWithoutFeeDelay = true
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
task.result, err = ApplyMessage(evm, &task.msg, new(GasPool).AddGas(task.gasLimit))
|
task.result, err = ApplyMessage(evm, &task.msg, new(GasPool).AddGas(task.gasLimit), nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
if task.statedb.HadInvalidRead() || err != nil {
|
if task.statedb.HadInvalidRead() || err != nil {
|
||||||
|
|
@ -264,7 +265,7 @@ var parallelizabilityTimer = metrics.NewRegisteredTimer("block/parallelizability
|
||||||
// returns the amount of gas that was used in the process. If any of the
|
// returns the amount of gas that was used in the process. If any of the
|
||||||
// transactions failed to execute due to insufficient gas it will return an error.
|
// transactions failed to execute due to insufficient gas it will return an error.
|
||||||
// nolint:gocognit
|
// nolint:gocognit
|
||||||
func (p *ParallelStateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg vm.Config) (*ProcessResult, error) {
|
func (p *ParallelStateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg vm.Config, interruptCtx context.Context) (*ProcessResult, error) {
|
||||||
var (
|
var (
|
||||||
receipts types.Receipts
|
receipts types.Receipts
|
||||||
header = block.Header()
|
header = block.Header()
|
||||||
|
|
@ -343,9 +344,8 @@ func (p *ParallelStateProcessor) Process(block *types.Block, statedb *state.Stat
|
||||||
|
|
||||||
backupStateDB := statedb.Copy()
|
backupStateDB := statedb.Copy()
|
||||||
|
|
||||||
ctx := context.Background()
|
|
||||||
profile := false
|
profile := false
|
||||||
result, err := blockstm.ExecuteParallel(tasks, profile, metadata, p.bc.parallelSpeculativeProcesses, ctx)
|
result, err := blockstm.ExecuteParallel(tasks, profile, metadata, p.bc.parallelSpeculativeProcesses, interruptCtx)
|
||||||
|
|
||||||
if err == nil && profile && result.Deps != nil {
|
if err == nil && profile && result.Deps != nil {
|
||||||
_, weight := result.Deps.LongestPath(*result.Stats)
|
_, weight := result.Deps.LongestPath(*result.Stats)
|
||||||
|
|
@ -379,7 +379,7 @@ func (p *ParallelStateProcessor) Process(block *types.Block, statedb *state.Stat
|
||||||
t.totalUsedGas = usedGas
|
t.totalUsedGas = usedGas
|
||||||
}
|
}
|
||||||
|
|
||||||
_, err = blockstm.ExecuteParallel(tasks, false, metadata, p.bc.parallelSpeculativeProcesses, ctx)
|
_, err = blockstm.ExecuteParallel(tasks, false, metadata, p.bc.parallelSpeculativeProcesses, interruptCtx)
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,7 @@ func WriteOffsetOfLastAncientFreezer(db ethdb.KeyValueWriter, offset uint64) {
|
||||||
|
|
||||||
// NewDatabaseWithOnlyFreezer create a freezer db without state
|
// NewDatabaseWithOnlyFreezer create a freezer db without state
|
||||||
func NewDatabaseWithOnlyFreezer(db ethdb.KeyValueStore, frz, namespace string, readonly bool, newOffSet uint64) (*Freezer, error) {
|
func NewDatabaseWithOnlyFreezer(db ethdb.KeyValueStore, frz, namespace string, readonly bool, newOffSet uint64) (*Freezer, error) {
|
||||||
// Create the idle freezer instance, this operation should be atomic to avoid mismatch between offset and acientDB.
|
// Create the idle freezer instance, this operation should be atomic to avoid mismatch between offset and ancientDB.
|
||||||
frdb, err := NewChainFreezer(frz, namespace, readonly, newOffSet)
|
frdb, err := NewChainFreezer(frz, namespace, readonly, newOffSet)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,7 @@ func NewFreezer(datadir string, namespace string, readonly bool, offset uint64,
|
||||||
}
|
}
|
||||||
|
|
||||||
// Some blocks in ancientDB may have already been frozen and been pruned, so adding the offset to
|
// Some blocks in ancientDB may have already been frozen and been pruned, so adding the offset to
|
||||||
// reprensent the absolute number of blocks already frozen.
|
// represent the absolute number of blocks already frozen.
|
||||||
freezer.frozen.Add(offset)
|
freezer.frozen.Add(offset)
|
||||||
|
|
||||||
// Create the write batch.
|
// Create the write batch.
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/core/state"
|
"github.com/ethereum/go-ethereum/core/state"
|
||||||
|
|
@ -89,7 +90,7 @@ func precacheTransaction(msg *Message, _ *params.ChainConfig, gaspool *GasPool,
|
||||||
// Update the evm with the new transaction context.
|
// Update the evm with the new transaction context.
|
||||||
evm.Reset(NewEVMTxContext(msg), statedb)
|
evm.Reset(NewEVMTxContext(msg), statedb)
|
||||||
// Add addresses to access list if applicable
|
// Add addresses to access list if applicable
|
||||||
_, err := ApplyMessage(evm, msg, gaspool)
|
_, err := ApplyMessage(evm, msg, gaspool, context.Background())
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ func NewStateProcessor(config *params.ChainConfig, bc *BlockChain, hc *HeaderCha
|
||||||
// Process returns the receipts and logs accumulated during the process and
|
// Process returns the receipts and logs accumulated during the process and
|
||||||
// returns the amount of gas that was used in the process. If any of the
|
// returns the amount of gas that was used in the process. If any of the
|
||||||
// transactions failed to execute due to insufficient gas it will return an error.
|
// transactions failed to execute due to insufficient gas it will return an error.
|
||||||
func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg vm.Config) (*ProcessResult, error) {
|
func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg vm.Config, interruptCtx context.Context) (*ProcessResult, error) {
|
||||||
var (
|
var (
|
||||||
receipts types.Receipts
|
receipts types.Receipts
|
||||||
usedGas = new(uint64)
|
usedGas = new(uint64)
|
||||||
|
|
@ -95,7 +95,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
|
||||||
|
|
||||||
statedb.SetTxContext(tx.Hash(), i)
|
statedb.SetTxContext(tx.Hash(), i)
|
||||||
|
|
||||||
receipt, err := ApplyTransactionWithEVM(msg, p.config, gp, statedb, blockNumber, blockHash, tx, usedGas, vmenv)
|
receipt, err := ApplyTransactionWithEVM(msg, p.config, gp, statedb, blockNumber, blockHash, tx, usedGas, vmenv, interruptCtx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("could not apply tx %d [%v]: %w", i, tx.Hash().Hex(), err)
|
return nil, fmt.Errorf("could not apply tx %d [%v]: %w", i, tx.Hash().Hex(), err)
|
||||||
}
|
}
|
||||||
|
|
@ -126,7 +126,7 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
|
||||||
// ApplyTransactionWithEVM attempts to apply a transaction to the given state database
|
// ApplyTransactionWithEVM attempts to apply a transaction to the given state database
|
||||||
// and uses the input parameters for its environment similar to ApplyTransaction. However,
|
// and uses the input parameters for its environment similar to ApplyTransaction. However,
|
||||||
// this method takes an already created EVM instance as input.
|
// this method takes an already created EVM instance as input.
|
||||||
func ApplyTransactionWithEVM(msg *Message, config *params.ChainConfig, gp *GasPool, statedb *state.StateDB, blockNumber *big.Int, blockHash common.Hash, tx *types.Transaction, usedGas *uint64, evm *vm.EVM) (receipt *types.Receipt, err error) {
|
func ApplyTransactionWithEVM(msg *Message, config *params.ChainConfig, gp *GasPool, statedb *state.StateDB, blockNumber *big.Int, blockHash common.Hash, tx *types.Transaction, usedGas *uint64, evm *vm.EVM, interruptCtx context.Context) (receipt *types.Receipt, err error) {
|
||||||
if evm.Config.Tracer != nil && evm.Config.Tracer.OnTxStart != nil {
|
if evm.Config.Tracer != nil && evm.Config.Tracer.OnTxStart != nil {
|
||||||
evm.Config.Tracer.OnTxStart(evm.GetVMContext(), tx, msg.From)
|
evm.Config.Tracer.OnTxStart(evm.GetVMContext(), tx, msg.From)
|
||||||
if evm.Config.Tracer.OnTxEnd != nil {
|
if evm.Config.Tracer.OnTxEnd != nil {
|
||||||
|
|
@ -151,7 +151,7 @@ func ApplyTransactionWithEVM(msg *Message, config *params.ChainConfig, gp *GasPo
|
||||||
// resume recording read and write
|
// resume recording read and write
|
||||||
statedb.SetMVHashmap(backupMVHashMap)
|
statedb.SetMVHashmap(backupMVHashMap)
|
||||||
|
|
||||||
result, err = ApplyMessageNoFeeBurnOrTip(evm, *msg, gp)
|
result, err = ApplyMessageNoFeeBurnOrTip(evm, *msg, gp, interruptCtx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -253,7 +253,7 @@ func ApplyTransaction(config *params.ChainConfig, bc ChainContext, author *commo
|
||||||
blockContext := NewEVMBlockContext(header, bc, author)
|
blockContext := NewEVMBlockContext(header, bc, author)
|
||||||
txContext := NewEVMTxContext(msg)
|
txContext := NewEVMTxContext(msg)
|
||||||
vmenv := vm.NewEVM(blockContext, txContext, statedb, config, cfg)
|
vmenv := vm.NewEVM(blockContext, txContext, statedb, config, cfg)
|
||||||
return ApplyTransactionWithEVM(msg, config, gp, statedb, header.Number, header.Hash(), tx, usedGas, vmenv)
|
return ApplyTransactionWithEVM(msg, config, gp, statedb, header.Number, header.Hash(), tx, usedGas, vmenv, interruptCtx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProcessBeaconBlockRoot applies the EIP-4788 system call to the beacon block root
|
// ProcessBeaconBlockRoot applies the EIP-4788 system call to the beacon block root
|
||||||
|
|
@ -281,7 +281,7 @@ func ProcessBeaconBlockRoot(beaconRoot common.Hash, vmenv *vm.EVM, statedb *stat
|
||||||
}
|
}
|
||||||
vmenv.Reset(NewEVMTxContext(msg), statedb)
|
vmenv.Reset(NewEVMTxContext(msg), statedb)
|
||||||
statedb.AddAddressToAccessList(params.BeaconRootsAddress)
|
statedb.AddAddressToAccessList(params.BeaconRootsAddress)
|
||||||
_, _, _ = vmenv.Call(vm.AccountRef(msg.From), *msg.To, msg.Data, 30_000_000, common.U2560)
|
_, _, _ = vmenv.Call(vm.AccountRef(msg.From), *msg.To, msg.Data, 30_000_000, common.U2560, nil)
|
||||||
statedb.Finalise(true)
|
statedb.Finalise(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -308,7 +308,7 @@ func ProcessParentBlockHash(prevHash common.Hash, vmenv *vm.EVM, statedb *state.
|
||||||
}
|
}
|
||||||
vmenv.Reset(NewEVMTxContext(msg), statedb)
|
vmenv.Reset(NewEVMTxContext(msg), statedb)
|
||||||
statedb.AddAddressToAccessList(params.HistoryStorageAddress)
|
statedb.AddAddressToAccessList(params.HistoryStorageAddress)
|
||||||
_, _, _ = vmenv.Call(vm.AccountRef(msg.From), *msg.To, msg.Data, 30_000_000, common.U2560)
|
_, _, _ = vmenv.Call(vm.AccountRef(msg.From), *msg.To, msg.Data, 30_000_000, common.U2560, nil)
|
||||||
statedb.Finalise(true)
|
statedb.Finalise(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math"
|
"math"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
@ -201,15 +202,15 @@ func TransactionToMessage(tx *types.Transaction, s types.Signer, baseFee *big.In
|
||||||
// the gas used (which includes gas refunds) and an error if it failed. An error always
|
// the gas used (which includes gas refunds) and an error if it failed. An error always
|
||||||
// indicates a core error meaning that the message would always fail for that particular
|
// indicates a core error meaning that the message would always fail for that particular
|
||||||
// state and would never be accepted within a block.
|
// state and would never be accepted within a block.
|
||||||
func ApplyMessage(evm *vm.EVM, msg *Message, gp *GasPool) (*ExecutionResult, error) {
|
func ApplyMessage(evm *vm.EVM, msg *Message, gp *GasPool, interruptCtx context.Context) (*ExecutionResult, error) {
|
||||||
return NewStateTransition(evm, msg, gp).TransitionDb()
|
return NewStateTransition(evm, msg, gp).TransitionDb(interruptCtx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ApplyMessageNoFeeBurnOrTip(evm *vm.EVM, msg Message, gp *GasPool) (*ExecutionResult, error) {
|
func ApplyMessageNoFeeBurnOrTip(evm *vm.EVM, msg Message, gp *GasPool, interruptCtx context.Context) (*ExecutionResult, error) {
|
||||||
st := NewStateTransition(evm, &msg, gp)
|
st := NewStateTransition(evm, &msg, gp)
|
||||||
st.noFeeBurnAndTip = true
|
st.noFeeBurnAndTip = true
|
||||||
|
|
||||||
return st.TransitionDb()
|
return st.TransitionDb(interruptCtx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// StateTransition represents a state transition.
|
// StateTransition represents a state transition.
|
||||||
|
|
@ -409,7 +410,7 @@ func (st *StateTransition) preCheck() error {
|
||||||
//
|
//
|
||||||
// However if any consensus issue encountered, return the error directly with
|
// However if any consensus issue encountered, return the error directly with
|
||||||
// nil evm execution result.
|
// nil evm execution result.
|
||||||
func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
|
func (st *StateTransition) TransitionDb(interruptCtx context.Context) (*ExecutionResult, error) {
|
||||||
input1 := st.state.GetBalance(st.msg.From)
|
input1 := st.state.GetBalance(st.msg.From)
|
||||||
|
|
||||||
var input2 *uint256.Int
|
var input2 *uint256.Int
|
||||||
|
|
@ -493,7 +494,7 @@ func (st *StateTransition) TransitionDb() (*ExecutionResult, error) {
|
||||||
} else {
|
} else {
|
||||||
st.state.SetNonce(msg.From, st.state.GetNonce(sender.Address())+1)
|
st.state.SetNonce(msg.From, st.state.GetNonce(sender.Address())+1)
|
||||||
|
|
||||||
ret, st.gasRemaining, vmerr = st.evm.Call(sender, st.to(), msg.Data, st.gasRemaining, value)
|
ret, st.gasRemaining, vmerr = st.evm.Call(sender, st.to(), msg.Data, st.gasRemaining, value, interruptCtx)
|
||||||
}
|
}
|
||||||
|
|
||||||
var gasRefund uint64
|
var gasRefund uint64
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,8 @@
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/common/lru"
|
"github.com/ethereum/go-ethereum/common/lru"
|
||||||
"github.com/ethereum/go-ethereum/consensus/beacon"
|
"github.com/ethereum/go-ethereum/consensus/beacon"
|
||||||
|
|
@ -66,7 +68,7 @@ func ExecuteStateless(config *params.ChainConfig, block *types.Block, witness *s
|
||||||
validator := NewBlockValidator(config, nil) // No chain, we only validate the state, not the block
|
validator := NewBlockValidator(config, nil) // No chain, we only validate the state, not the block
|
||||||
|
|
||||||
// Run the stateless blocks processing and self-validate certain fields
|
// Run the stateless blocks processing and self-validate certain fields
|
||||||
res, err := processor.Process(block, db, vm.Config{})
|
res, err := processor.Process(block, db, vm.Config{}, context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return common.Hash{}, common.Hash{}, err
|
return common.Hash{}, common.Hash{}, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -71,9 +71,11 @@ func TestTxIndexer(t *testing.T) {
|
||||||
}
|
}
|
||||||
verify := func(db ethdb.Database, expTail uint64, indexer *txIndexer) {
|
verify := func(db ethdb.Database, expTail uint64, indexer *txIndexer) {
|
||||||
tail := rawdb.ReadTxIndexTail(db)
|
tail := rawdb.ReadTxIndexTail(db)
|
||||||
|
//nolint: staticcheck
|
||||||
if tail == nil {
|
if tail == nil {
|
||||||
t.Fatal("Failed to write tx index tail")
|
t.Fatal("Failed to write tx index tail")
|
||||||
}
|
}
|
||||||
|
//nolint: staticcheck
|
||||||
if *tail != expTail {
|
if *tail != expTail {
|
||||||
t.Fatalf("Unexpected tx index tail, want %v, got %d", expTail, *tail)
|
t.Fatalf("Unexpected tx index tail, want %v, got %d", expTail, *tail)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -102,10 +102,6 @@ var (
|
||||||
slotsGauge = metrics.NewRegisteredGauge("txpool/slots", nil)
|
slotsGauge = metrics.NewRegisteredGauge("txpool/slots", nil)
|
||||||
|
|
||||||
resetCacheGauge = metrics.NewRegisteredGauge("txpool/resetcache", nil)
|
resetCacheGauge = metrics.NewRegisteredGauge("txpool/resetcache", nil)
|
||||||
reinitCacheGauge = metrics.NewRegisteredGauge("txpool/reinittcache", nil)
|
|
||||||
hitCacheCounter = metrics.NewRegisteredCounter("txpool/cachehit", nil)
|
|
||||||
missCacheCounter = metrics.NewRegisteredCounter("txpool/cachemiss", nil)
|
|
||||||
|
|
||||||
reheapTimer = metrics.NewRegisteredTimer("txpool/reheap", nil)
|
reheapTimer = metrics.NewRegisteredTimer("txpool/reheap", nil)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -60,10 +60,7 @@ func (h *nonceHeap) Pop() interface{} {
|
||||||
type sortedMap struct {
|
type sortedMap struct {
|
||||||
items map[uint64]*types.Transaction // Hash map storing the transaction data
|
items map[uint64]*types.Transaction // Hash map storing the transaction data
|
||||||
index *nonceHeap // Heap of nonces of all the stored transactions (non-strict mode)
|
index *nonceHeap // Heap of nonces of all the stored transactions (non-strict mode)
|
||||||
m sync.RWMutex
|
|
||||||
|
|
||||||
cache types.Transactions // Cache of the transactions already sorted
|
cache types.Transactions // Cache of the transactions already sorted
|
||||||
isEmpty bool
|
|
||||||
cacheMu sync.RWMutex
|
cacheMu sync.RWMutex
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -72,15 +69,11 @@ func newSortedMap() *sortedMap {
|
||||||
return &sortedMap{
|
return &sortedMap{
|
||||||
items: make(map[uint64]*types.Transaction),
|
items: make(map[uint64]*types.Transaction),
|
||||||
index: new(nonceHeap),
|
index: new(nonceHeap),
|
||||||
isEmpty: true,
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get retrieves the current transactions associated with the given nonce.
|
// Get retrieves the current transactions associated with the given nonce.
|
||||||
func (m *sortedMap) Get(nonce uint64) *types.Transaction {
|
func (m *sortedMap) Get(nonce uint64) *types.Transaction {
|
||||||
m.m.RLock()
|
|
||||||
defer m.m.RUnlock()
|
|
||||||
|
|
||||||
return m.items[nonce]
|
return m.items[nonce]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -89,28 +82,18 @@ func (m *sortedMap) Has(nonce uint64) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
m.m.RLock()
|
|
||||||
defer m.m.RUnlock()
|
|
||||||
|
|
||||||
return m.items[nonce] != nil
|
return m.items[nonce] != nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// Put inserts a new transaction into the map, also updating the map's nonce
|
// Put inserts a new transaction into the map, also updating the map's nonce
|
||||||
// index. If a transaction already exists with the same nonce, it's overwritten.
|
// index. If a transaction already exists with the same nonce, it's overwritten.
|
||||||
func (m *sortedMap) Put(tx *types.Transaction) {
|
func (m *sortedMap) Put(tx *types.Transaction) {
|
||||||
m.m.Lock()
|
|
||||||
defer m.m.Unlock()
|
|
||||||
|
|
||||||
nonce := tx.Nonce()
|
nonce := tx.Nonce()
|
||||||
if m.items[nonce] == nil {
|
if m.items[nonce] == nil {
|
||||||
heap.Push(m.index, nonce)
|
heap.Push(m.index, nonce)
|
||||||
}
|
}
|
||||||
|
|
||||||
m.items[nonce] = tx
|
|
||||||
|
|
||||||
m.cacheMu.Lock()
|
m.cacheMu.Lock()
|
||||||
m.isEmpty = true
|
m.items[nonce], m.cache = tx, nil
|
||||||
m.cache = nil
|
|
||||||
m.cacheMu.Unlock()
|
m.cacheMu.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -118,9 +101,6 @@ func (m *sortedMap) Put(tx *types.Transaction) {
|
||||||
// provided threshold. Every removed transaction is returned for any post-removal
|
// provided threshold. Every removed transaction is returned for any post-removal
|
||||||
// maintenance.
|
// maintenance.
|
||||||
func (m *sortedMap) Forward(threshold uint64) types.Transactions {
|
func (m *sortedMap) Forward(threshold uint64) types.Transactions {
|
||||||
m.m.Lock()
|
|
||||||
defer m.m.Unlock()
|
|
||||||
|
|
||||||
var removed types.Transactions
|
var removed types.Transactions
|
||||||
|
|
||||||
// Pop off heap items until the threshold is reached
|
// Pop off heap items until the threshold is reached
|
||||||
|
|
@ -133,8 +113,6 @@ func (m *sortedMap) Forward(threshold uint64) types.Transactions {
|
||||||
// If we had a cached order, shift the front
|
// If we had a cached order, shift the front
|
||||||
m.cacheMu.Lock()
|
m.cacheMu.Lock()
|
||||||
if m.cache != nil {
|
if m.cache != nil {
|
||||||
hitCacheCounter.Inc(1)
|
|
||||||
|
|
||||||
m.cache = m.cache[len(removed):]
|
m.cache = m.cache[len(removed):]
|
||||||
}
|
}
|
||||||
m.cacheMu.Unlock()
|
m.cacheMu.Unlock()
|
||||||
|
|
@ -147,9 +125,6 @@ func (m *sortedMap) Forward(threshold uint64) types.Transactions {
|
||||||
// If you want to do several consecutive filterings, it's therefore better to first
|
// If you want to do several consecutive filterings, it's therefore better to first
|
||||||
// do a .filter(func1) followed by .Filter(func2) or reheap()
|
// do a .filter(func1) followed by .Filter(func2) or reheap()
|
||||||
func (m *sortedMap) Filter(filter func(*types.Transaction) bool) types.Transactions {
|
func (m *sortedMap) Filter(filter func(*types.Transaction) bool) types.Transactions {
|
||||||
m.m.Lock()
|
|
||||||
defer m.m.Unlock()
|
|
||||||
|
|
||||||
removed := m.filter(filter)
|
removed := m.filter(filter)
|
||||||
// If transactions were removed, the heap and cache are ruined
|
// If transactions were removed, the heap and cache are ruined
|
||||||
if len(removed) > 0 {
|
if len(removed) > 0 {
|
||||||
|
|
@ -187,10 +162,7 @@ func (m *sortedMap) filter(filter func(*types.Transaction) bool) types.Transacti
|
||||||
if len(removed) > 0 {
|
if len(removed) > 0 {
|
||||||
m.cacheMu.Lock()
|
m.cacheMu.Lock()
|
||||||
m.cache = nil
|
m.cache = nil
|
||||||
m.isEmpty = true
|
|
||||||
m.cacheMu.Unlock()
|
m.cacheMu.Unlock()
|
||||||
|
|
||||||
resetCacheGauge.Inc(1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return removed
|
return removed
|
||||||
|
|
@ -199,9 +171,6 @@ func (m *sortedMap) filter(filter func(*types.Transaction) bool) types.Transacti
|
||||||
// Cap places a hard limit on the number of items, returning all transactions
|
// Cap places a hard limit on the number of items, returning all transactions
|
||||||
// exceeding that limit.
|
// exceeding that limit.
|
||||||
func (m *sortedMap) Cap(threshold int) types.Transactions {
|
func (m *sortedMap) Cap(threshold int) types.Transactions {
|
||||||
m.m.Lock()
|
|
||||||
defer m.m.Unlock()
|
|
||||||
|
|
||||||
// Short circuit if the number of items is under the limit
|
// Short circuit if the number of items is under the limit
|
||||||
if len(m.items) <= threshold {
|
if len(m.items) <= threshold {
|
||||||
return nil
|
return nil
|
||||||
|
|
@ -233,15 +202,11 @@ func (m *sortedMap) Cap(threshold int) types.Transactions {
|
||||||
// Remove deletes a transaction from the maintained map, returning whether the
|
// Remove deletes a transaction from the maintained map, returning whether the
|
||||||
// transaction was found.
|
// transaction was found.
|
||||||
func (m *sortedMap) Remove(nonce uint64) bool {
|
func (m *sortedMap) Remove(nonce uint64) bool {
|
||||||
m.m.Lock()
|
|
||||||
defer m.m.Unlock()
|
|
||||||
|
|
||||||
// Short circuit if no transaction is present
|
// Short circuit if no transaction is present
|
||||||
_, ok := m.items[nonce]
|
_, ok := m.items[nonce]
|
||||||
if !ok {
|
if !ok {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// Otherwise delete the transaction and fix the heap index
|
// Otherwise delete the transaction and fix the heap index
|
||||||
for i := 0; i < m.index.Len(); i++ {
|
for i := 0; i < m.index.Len(); i++ {
|
||||||
if (*m.index)[i] == nonce {
|
if (*m.index)[i] == nonce {
|
||||||
|
|
@ -250,16 +215,11 @@ func (m *sortedMap) Remove(nonce uint64) bool {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete(m.items, nonce)
|
delete(m.items, nonce)
|
||||||
|
|
||||||
m.cacheMu.Lock()
|
m.cacheMu.Lock()
|
||||||
m.cache = nil
|
m.cache = nil
|
||||||
m.isEmpty = true
|
|
||||||
m.cacheMu.Unlock()
|
m.cacheMu.Unlock()
|
||||||
|
|
||||||
resetCacheGauge.Inc(1)
|
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -271,9 +231,6 @@ func (m *sortedMap) Remove(nonce uint64) bool {
|
||||||
// prevent getting into an invalid state. This is not something that should ever
|
// prevent getting into an invalid state. This is not something that should ever
|
||||||
// happen but better to be self correcting than failing!
|
// happen but better to be self correcting than failing!
|
||||||
func (m *sortedMap) Ready(start uint64) types.Transactions {
|
func (m *sortedMap) Ready(start uint64) types.Transactions {
|
||||||
m.m.Lock()
|
|
||||||
defer m.m.Unlock()
|
|
||||||
|
|
||||||
// Short circuit if no transactions are available
|
// Short circuit if no transactions are available
|
||||||
if m.index.Len() == 0 || (*m.index)[0] > start {
|
if m.index.Len() == 0 || (*m.index)[0] > start {
|
||||||
return nil
|
return nil
|
||||||
|
|
@ -290,7 +247,6 @@ func (m *sortedMap) Ready(start uint64) types.Transactions {
|
||||||
|
|
||||||
m.cacheMu.Lock()
|
m.cacheMu.Lock()
|
||||||
m.cache = nil
|
m.cache = nil
|
||||||
m.isEmpty = true
|
|
||||||
m.cacheMu.Unlock()
|
m.cacheMu.Unlock()
|
||||||
|
|
||||||
resetCacheGauge.Inc(1)
|
resetCacheGauge.Inc(1)
|
||||||
|
|
@ -300,85 +256,25 @@ func (m *sortedMap) Ready(start uint64) types.Transactions {
|
||||||
|
|
||||||
// Len returns the length of the transaction map.
|
// Len returns the length of the transaction map.
|
||||||
func (m *sortedMap) Len() int {
|
func (m *sortedMap) Len() int {
|
||||||
m.m.RLock()
|
|
||||||
defer m.m.RUnlock()
|
|
||||||
|
|
||||||
return len(m.items)
|
return len(m.items)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *sortedMap) flatten() types.Transactions {
|
func (m *sortedMap) flatten() types.Transactions {
|
||||||
// If the sorting was not cached yet, create and cache it
|
|
||||||
m.cacheMu.Lock()
|
m.cacheMu.Lock()
|
||||||
defer m.cacheMu.Unlock()
|
defer m.cacheMu.Unlock()
|
||||||
|
// If the sorting was not cached yet, create and cache it
|
||||||
if m.isEmpty {
|
if m.cache == nil {
|
||||||
m.isEmpty = false // to simulate sync.Once
|
m.cache = make(types.Transactions, 0, len(m.items))
|
||||||
|
|
||||||
m.cacheMu.Unlock()
|
|
||||||
|
|
||||||
m.m.RLock()
|
|
||||||
|
|
||||||
cache := make(types.Transactions, 0, len(m.items))
|
|
||||||
|
|
||||||
for _, tx := range m.items {
|
for _, tx := range m.items {
|
||||||
cache = append(cache, tx)
|
m.cache = append(m.cache, tx)
|
||||||
}
|
}
|
||||||
|
sort.Sort(types.TxByNonce(m.cache))
|
||||||
m.m.RUnlock()
|
|
||||||
|
|
||||||
// exclude sorting from locks
|
|
||||||
sort.Sort(types.TxByNonce(cache))
|
|
||||||
|
|
||||||
m.cacheMu.Lock()
|
|
||||||
m.cache = cache
|
|
||||||
|
|
||||||
reinitCacheGauge.Inc(1)
|
|
||||||
missCacheCounter.Inc(1)
|
|
||||||
} else {
|
|
||||||
hitCacheCounter.Inc(1)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return m.cache
|
return m.cache
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *sortedMap) lastElement() *types.Transaction {
|
func (m *sortedMap) lastElement() *types.Transaction {
|
||||||
// If the sorting was not cached yet, create and cache it
|
cache := m.flatten()
|
||||||
m.cacheMu.Lock()
|
|
||||||
defer m.cacheMu.Unlock()
|
|
||||||
|
|
||||||
cache := m.cache
|
|
||||||
|
|
||||||
if m.isEmpty {
|
|
||||||
m.isEmpty = false // to simulate sync.Once
|
|
||||||
|
|
||||||
m.cacheMu.Unlock()
|
|
||||||
|
|
||||||
m.m.RLock()
|
|
||||||
cache = make(types.Transactions, 0, len(m.items))
|
|
||||||
|
|
||||||
for _, tx := range m.items {
|
|
||||||
cache = append(cache, tx)
|
|
||||||
}
|
|
||||||
|
|
||||||
m.m.RUnlock()
|
|
||||||
|
|
||||||
// exclude sorting from locks
|
|
||||||
sort.Sort(types.TxByNonce(cache))
|
|
||||||
|
|
||||||
m.cacheMu.Lock()
|
|
||||||
m.cache = cache
|
|
||||||
|
|
||||||
reinitCacheGauge.Inc(1)
|
|
||||||
missCacheCounter.Inc(1)
|
|
||||||
} else {
|
|
||||||
hitCacheCounter.Inc(1)
|
|
||||||
}
|
|
||||||
|
|
||||||
ln := len(cache)
|
|
||||||
if ln == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
return cache[len(cache)-1]
|
return cache[len(cache)-1]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -659,7 +555,6 @@ func (l *list) subTotalCost(txs []*types.Transaction) {
|
||||||
type priceHeap struct {
|
type priceHeap struct {
|
||||||
baseFee *big.Int // heap should always be re-sorted after baseFee is changed
|
baseFee *big.Int // heap should always be re-sorted after baseFee is changed
|
||||||
list []*types.Transaction
|
list []*types.Transaction
|
||||||
baseFeeMu sync.RWMutex
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *priceHeap) Len() int { return len(h.list) }
|
func (h *priceHeap) Len() int { return len(h.list) }
|
||||||
|
|
@ -677,19 +572,13 @@ func (h *priceHeap) Less(i, j int) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *priceHeap) cmp(a, b *types.Transaction) int {
|
func (h *priceHeap) cmp(a, b *types.Transaction) int {
|
||||||
h.baseFeeMu.RLock()
|
|
||||||
|
|
||||||
if h.baseFee != nil {
|
if h.baseFee != nil {
|
||||||
// Compare effective tips if baseFee is specified
|
// Compare effective tips if baseFee is specified
|
||||||
if c := a.EffectiveGasTipCmp(b, h.baseFee); c != 0 {
|
if c := a.EffectiveGasTipCmp(b, h.baseFee); c != 0 {
|
||||||
h.baseFeeMu.RUnlock()
|
|
||||||
|
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
h.baseFeeMu.RUnlock()
|
|
||||||
|
|
||||||
// Compare fee caps if baseFee is not specified or effective tips are equal
|
// Compare fee caps if baseFee is not specified or effective tips are equal
|
||||||
if c := a.GasFeeCapCmp(b); c != 0 {
|
if c := a.GasFeeCapCmp(b); c != 0 {
|
||||||
return c
|
return c
|
||||||
|
|
@ -882,9 +771,6 @@ func (l *pricedList) Reheap() {
|
||||||
// SetBaseFee updates the base fee and triggers a re-heap. Note that Removed is not
|
// SetBaseFee updates the base fee and triggers a re-heap. Note that Removed is not
|
||||||
// necessary to call right before SetBaseFee when processing a new block.
|
// necessary to call right before SetBaseFee when processing a new block.
|
||||||
func (l *pricedList) SetBaseFee(baseFee *big.Int) {
|
func (l *pricedList) SetBaseFee(baseFee *big.Int) {
|
||||||
l.urgent.baseFeeMu.Lock()
|
|
||||||
l.urgent.baseFee = baseFee
|
l.urgent.baseFee = baseFee
|
||||||
l.urgent.baseFeeMu.Unlock()
|
|
||||||
|
|
||||||
l.Reheap()
|
l.Reheap()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/core/state"
|
"github.com/ethereum/go-ethereum/core/state"
|
||||||
|
|
@ -48,7 +49,7 @@ type Processor interface {
|
||||||
// Process processes the state changes according to the Ethereum rules by running
|
// Process processes the state changes according to the Ethereum rules by running
|
||||||
// the transaction messages using the statedb and applying any rewards to both
|
// the transaction messages using the statedb and applying any rewards to both
|
||||||
// the processor (coinbase) and any included uncles.
|
// the processor (coinbase) and any included uncles.
|
||||||
Process(block *types.Block, statedb *state.StateDB, cfg vm.Config) (*ProcessResult, error)
|
Process(block *types.Block, statedb *state.StateDB, cfg vm.Config, interruptCtx context.Context) (*ProcessResult, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProcessResult contains the values computed by Process.
|
// ProcessResult contains the values computed by Process.
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
package vm
|
package vm
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"math/big"
|
"math/big"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
@ -170,7 +171,7 @@ func (evm *EVM) Interpreter() *EVMInterpreter {
|
||||||
// parameters. It also handles any necessary value transfer required and takes
|
// parameters. It also handles any necessary value transfer required and takes
|
||||||
// the necessary steps to create accounts and reverses the state in case of an
|
// the necessary steps to create accounts and reverses the state in case of an
|
||||||
// execution error or failed value transfer.
|
// execution error or failed value transfer.
|
||||||
func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas uint64, value *uint256.Int) (ret []byte, leftOverGas uint64, err error) {
|
func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas uint64, value *uint256.Int, interruptCtx context.Context) (ret []byte, leftOverGas uint64, err error) {
|
||||||
// Capture the tracer start/end events in debug mode
|
// Capture the tracer start/end events in debug mode
|
||||||
if evm.Config.Tracer != nil {
|
if evm.Config.Tracer != nil {
|
||||||
evm.captureBegin(evm.depth, CALL, caller.Address(), addr, input, gas, value.ToBig())
|
evm.captureBegin(evm.depth, CALL, caller.Address(), addr, input, gas, value.ToBig())
|
||||||
|
|
@ -229,7 +230,7 @@ func (evm *EVM) Call(caller ContractRef, addr common.Address, input []byte, gas
|
||||||
// The depth-check is already done, and precompiles handled above
|
// The depth-check is already done, and precompiles handled above
|
||||||
contract := NewContract(caller, AccountRef(addrCopy), value, gas)
|
contract := NewContract(caller, AccountRef(addrCopy), value, gas)
|
||||||
contract.SetCallCode(&addrCopy, evm.StateDB.GetCodeHash(addrCopy), code)
|
contract.SetCallCode(&addrCopy, evm.StateDB.GetCodeHash(addrCopy), code)
|
||||||
ret, err = evm.interpreter.Run(contract, input, false)
|
ret, err = evm.interpreter.PreRun(contract, input, false, interruptCtx)
|
||||||
gas = contract.Gas
|
gas = contract.Gas
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -295,7 +296,7 @@ func (evm *EVM) CallCode(caller ContractRef, addr common.Address, input []byte,
|
||||||
witness.AddCode(evm.StateDB.GetCode(addrCopy))
|
witness.AddCode(evm.StateDB.GetCode(addrCopy))
|
||||||
}
|
}
|
||||||
contract.SetCallCode(&addrCopy, evm.StateDB.GetCodeHash(addrCopy), evm.StateDB.GetCode(addrCopy))
|
contract.SetCallCode(&addrCopy, evm.StateDB.GetCodeHash(addrCopy), evm.StateDB.GetCode(addrCopy))
|
||||||
ret, err = evm.interpreter.PreRun(contract, input, false)
|
ret, err = evm.interpreter.PreRun(contract, input, false, nil)
|
||||||
gas = contract.Gas
|
gas = contract.Gas
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -348,7 +349,7 @@ func (evm *EVM) DelegateCall(caller ContractRef, addr common.Address, input []by
|
||||||
witness.AddCode(evm.StateDB.GetCode(addrCopy))
|
witness.AddCode(evm.StateDB.GetCode(addrCopy))
|
||||||
}
|
}
|
||||||
contract.SetCallCode(&addrCopy, evm.StateDB.GetCodeHash(addrCopy), evm.StateDB.GetCode(addrCopy))
|
contract.SetCallCode(&addrCopy, evm.StateDB.GetCodeHash(addrCopy), evm.StateDB.GetCode(addrCopy))
|
||||||
ret, err = evm.interpreter.PreRun(contract, input, false)
|
ret, err = evm.interpreter.PreRun(contract, input, false, nil)
|
||||||
gas = contract.Gas
|
gas = contract.Gas
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -412,7 +413,7 @@ func (evm *EVM) StaticCall(caller ContractRef, addr common.Address, input []byte
|
||||||
// When an error was returned by the EVM or when setting the creation code
|
// When an error was returned by the EVM or when setting the creation code
|
||||||
// above we revert to the snapshot and consume any gas remaining. Additionally
|
// above we revert to the snapshot and consume any gas remaining. Additionally
|
||||||
// when we're in Homestead this also counts for code storage gas errors.
|
// when we're in Homestead this also counts for code storage gas errors.
|
||||||
ret, err = evm.interpreter.PreRun(contract, input, true)
|
ret, err = evm.interpreter.PreRun(contract, input, true, nil)
|
||||||
gas = contract.Gas
|
gas = contract.Gas
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -550,7 +551,7 @@ func (evm *EVM) create(caller ContractRef, codeAndHash *codeAndHash, gas uint64,
|
||||||
// initNewContract runs a new contract's creation code, performs checks on the
|
// initNewContract runs a new contract's creation code, performs checks on the
|
||||||
// resulting code that is to be deployed, and consumes necessary gas.
|
// resulting code that is to be deployed, and consumes necessary gas.
|
||||||
func (evm *EVM) initNewContract(contract *Contract, address common.Address, value *uint256.Int) ([]byte, error) {
|
func (evm *EVM) initNewContract(contract *Contract, address common.Address, value *uint256.Int) ([]byte, error) {
|
||||||
ret, err := evm.interpreter.Run(contract, nil, false)
|
ret, err := evm.interpreter.Run(contract, nil, false, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return ret, err
|
return ret, err
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ func TestEIP2200(t *testing.T) {
|
||||||
}
|
}
|
||||||
vmenv := NewEVM(vmctx, TxContext{}, statedb, params.AllEthashProtocolChanges, Config{ExtraEips: []int{2200}})
|
vmenv := NewEVM(vmctx, TxContext{}, statedb, params.AllEthashProtocolChanges, Config{ExtraEips: []int{2200}})
|
||||||
|
|
||||||
_, gas, err := vmenv.Call(AccountRef(common.Address{}), address, nil, tt.gaspool, new(uint256.Int))
|
_, gas, err := vmenv.Call(AccountRef(common.Address{}), address, nil, tt.gaspool, new(uint256.Int), nil)
|
||||||
if !errors.Is(err, tt.failure) {
|
if !errors.Is(err, tt.failure) {
|
||||||
t.Errorf("test %d: failure mismatch: have %v, want %v", i, err, tt.failure)
|
t.Errorf("test %d: failure mismatch: have %v, want %v", i, err, tt.failure)
|
||||||
}
|
}
|
||||||
|
|
@ -162,7 +162,7 @@ func TestCreateGas(t *testing.T) {
|
||||||
vmenv := NewEVM(vmctx, TxContext{}, statedb, params.AllEthashProtocolChanges, config)
|
vmenv := NewEVM(vmctx, TxContext{}, statedb, params.AllEthashProtocolChanges, config)
|
||||||
|
|
||||||
var startGas = uint64(testGas)
|
var startGas = uint64(testGas)
|
||||||
ret, gas, err := vmenv.Call(AccountRef(common.Address{}), address, nil, startGas, new(uint256.Int))
|
ret, gas, err := vmenv.Call(AccountRef(common.Address{}), address, nil, startGas, new(uint256.Int), nil)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false
|
return false
|
||||||
|
|
|
||||||
|
|
@ -836,7 +836,7 @@ func opCall(pc *uint64, interpreter *EVMInterpreter, scope *ScopeContext) ([]byt
|
||||||
gas += params.CallStipend
|
gas += params.CallStipend
|
||||||
}
|
}
|
||||||
|
|
||||||
ret, returnGas, err := interpreter.evm.Call(scope.Contract, toAddr, args, gas, &value)
|
ret, returnGas, err := interpreter.evm.Call(scope.Contract, toAddr, args, gas, &value, nil)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
temp.Clear()
|
temp.Clear()
|
||||||
|
|
|
||||||
|
|
@ -41,10 +41,12 @@ var (
|
||||||
ErrNoCurrentTx = errors.New("no current tx found in interruptCtx")
|
ErrNoCurrentTx = errors.New("no current tx found in interruptCtx")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
type InterruptKeyType string
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// These are keys for the interruptCtx
|
// These are keys for the interruptCtx
|
||||||
InterruptCtxDelayKey = "delay"
|
InterruptCtxDelayKey InterruptKeyType = "delay"
|
||||||
InterruptCtxOpcodeDelayKey = "opcodeDelay"
|
InterruptCtxOpcodeDelayKey InterruptKeyType = "opcodeDelay"
|
||||||
|
|
||||||
// InterruptedTxCacheSize is size of lru cache for interrupted txs
|
// InterruptedTxCacheSize is size of lru cache for interrupted txs
|
||||||
InterruptedTxCacheSize = 90000
|
InterruptedTxCacheSize = 90000
|
||||||
|
|
@ -229,8 +231,20 @@ func NewEVMInterpreter(evm *EVM) *EVMInterpreter {
|
||||||
}
|
}
|
||||||
|
|
||||||
// PreRun is a wrapper around Run that allows for a delay to be injected before each opcode when induced by tests else it calls the lagace Run() method
|
// PreRun is a wrapper around Run that allows for a delay to be injected before each opcode when induced by tests else it calls the lagace Run() method
|
||||||
func (in *EVMInterpreter) PreRun(contract *Contract, input []byte, readOnly bool) (ret []byte, err error) {
|
func (in *EVMInterpreter) PreRun(contract *Contract, input []byte, readOnly bool, interruptCtx context.Context) (ret []byte, err error) {
|
||||||
return in.Run(contract, input, readOnly)
|
var opcodeDelay interface{}
|
||||||
|
|
||||||
|
if interruptCtx != nil {
|
||||||
|
if interruptCtx.Value(InterruptCtxOpcodeDelayKey) != nil {
|
||||||
|
opcodeDelay = interruptCtx.Value(InterruptCtxOpcodeDelayKey)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if opcodeDelay != nil {
|
||||||
|
return in.RunWithDelay(contract, input, readOnly, interruptCtx, opcodeDelay.(uint))
|
||||||
|
}
|
||||||
|
|
||||||
|
return in.Run(contract, input, readOnly, interruptCtx)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Run loops and evaluates the contract's code with the given input data and returns
|
// Run loops and evaluates the contract's code with the given input data and returns
|
||||||
|
|
@ -240,7 +254,7 @@ func (in *EVMInterpreter) PreRun(contract *Contract, input []byte, readOnly bool
|
||||||
// considered a revert-and-consume-all-gas operation except for
|
// considered a revert-and-consume-all-gas operation except for
|
||||||
// ErrExecutionReverted which means revert-and-keep-gas-left.
|
// ErrExecutionReverted which means revert-and-keep-gas-left.
|
||||||
// nolint: gocognit
|
// nolint: gocognit
|
||||||
func (in *EVMInterpreter) Run(contract *Contract, input []byte, readOnly bool) (ret []byte, err error) {
|
func (in *EVMInterpreter) Run(contract *Contract, input []byte, readOnly bool, interruptCtx context.Context) (ret []byte, err error) {
|
||||||
// Increment the call depth which is restricted to 1024
|
// Increment the call depth which is restricted to 1024
|
||||||
in.evm.depth++
|
in.evm.depth++
|
||||||
defer func() { in.evm.depth-- }()
|
defer func() { in.evm.depth-- }()
|
||||||
|
|
@ -287,7 +301,6 @@ func (in *EVMInterpreter) Run(contract *Contract, input []byte, readOnly bool) (
|
||||||
// they are returned to the pools
|
// they are returned to the pools
|
||||||
defer func() {
|
defer func() {
|
||||||
returnStack(stack)
|
returnStack(stack)
|
||||||
mem.Free()
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
contract.Input = input
|
contract.Input = input
|
||||||
|
|
@ -310,6 +323,32 @@ func (in *EVMInterpreter) Run(contract *Contract, input []byte, readOnly bool) (
|
||||||
// the execution of one of the operations or until the done flag is set by the
|
// the execution of one of the operations or until the done flag is set by the
|
||||||
// parent context.
|
// parent context.
|
||||||
for {
|
for {
|
||||||
|
if interruptCtx != nil {
|
||||||
|
// case of interrupting by timeout
|
||||||
|
select {
|
||||||
|
case <-interruptCtx.Done():
|
||||||
|
txHash, _ := GetCurrentTxFromContext(interruptCtx)
|
||||||
|
interruptedTxCache, _ := GetCache(interruptCtx)
|
||||||
|
|
||||||
|
if interruptedTxCache == nil {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
// if the tx is already in the cache, it means that it has been interrupted before and we will not interrupt it again
|
||||||
|
found, _ := interruptedTxCache.Cache.ContainsOrAdd(txHash, true)
|
||||||
|
if found {
|
||||||
|
interruptedTxCache.Cache.Remove(txHash)
|
||||||
|
} else {
|
||||||
|
// if the tx is not in the cache, it means that it has not been interrupted before and we will interrupt it
|
||||||
|
opcodeCommitInterruptCounter.Inc(1)
|
||||||
|
log.Warn("OPCODE Level interrupt")
|
||||||
|
|
||||||
|
return nil, ErrInterrupt
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if debug {
|
if debug {
|
||||||
// Capture pre-execution values for tracing.
|
// Capture pre-execution values for tracing.
|
||||||
logged, pcCopy, gasCopy = false, pc, contract.Gas
|
logged, pcCopy, gasCopy = false, pc, contract.Gas
|
||||||
|
|
|
||||||
|
|
@ -53,7 +53,7 @@ func TestLoopInterrupt(t *testing.T) {
|
||||||
timeout := make(chan bool)
|
timeout := make(chan bool)
|
||||||
|
|
||||||
go func(evm *EVM) {
|
go func(evm *EVM) {
|
||||||
_, _, err := evm.Call(AccountRef(common.Address{}), address, nil, math.MaxUint64, new(uint256.Int))
|
_, _, err := evm.Call(AccountRef(common.Address{}), address, nil, math.MaxUint64, new(uint256.Int), nil)
|
||||||
errChannel <- err
|
errChannel <- err
|
||||||
}(evm)
|
}(evm)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -156,6 +156,7 @@ func Execute(code, input []byte, cfg *Config) ([]byte, *state.StateDB, error) {
|
||||||
input,
|
input,
|
||||||
cfg.GasLimit,
|
cfg.GasLimit,
|
||||||
uint256.MustFromBig(cfg.Value),
|
uint256.MustFromBig(cfg.Value),
|
||||||
|
nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
return ret, cfg.State, err
|
return ret, cfg.State, err
|
||||||
|
|
@ -225,6 +226,7 @@ func Call(address common.Address, input []byte, cfg *Config) ([]byte, uint64, er
|
||||||
input,
|
input,
|
||||||
cfg.GasLimit,
|
cfg.GasLimit,
|
||||||
uint256.MustFromBig(cfg.Value),
|
uint256.MustFromBig(cfg.Value),
|
||||||
|
nil,
|
||||||
)
|
)
|
||||||
|
|
||||||
return ret, leftOverGas, err
|
return ret, leftOverGas, err
|
||||||
|
|
|
||||||
|
|
@ -204,6 +204,9 @@ func UnmarshalPubkey(pub []byte) (*ecdsa.PublicKey, error) {
|
||||||
if x == nil {
|
if x == nil {
|
||||||
return nil, errInvalidPubkey
|
return nil, errInvalidPubkey
|
||||||
}
|
}
|
||||||
|
if !S256().IsOnCurve(x, y) {
|
||||||
|
return nil, errInvalidPubkey
|
||||||
|
}
|
||||||
|
|
||||||
return &ecdsa.PublicKey{Curve: S256(), X: x, Y: y}, nil
|
return &ecdsa.PublicKey{Curve: S256(), X: x, Y: y}, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
# This configuration file is for reference and learning purpose only.
|
# This configuration file is for reference and learning purpose only.
|
||||||
# The default value of the flags is provided below (except a few flags which has custom defaults which are explicitly mentioned).
|
# The default value of the flags is provided below (except a few flags which has custom defaults which are explicitly mentioned).
|
||||||
# Recommended values for mainnet and/or mumbai,amoy are also provided.
|
# Recommended values for mainnet and/or amoy are also provided.
|
||||||
|
|
||||||
chain = "mainnet" # Name of the chain to sync ("amoy", "mumbai", "mainnet") or path to a genesis file
|
chain = "mainnet" # Name of the chain to sync ("mainnet" or "amoy") or path to a genesis file
|
||||||
identity = "Annon-Identity" # Name/Identity of the node (default = OS hostname)
|
identity = "Annon-Identity" # Name/Identity of the node (default = OS hostname)
|
||||||
verbosity = 3 # Logging verbosity for the server (5=trace|4=debug|3=info|2=warn|1=error|0=crit) (`log-level` was replaced by `verbosity`, and thus will be deprecated soon)
|
verbosity = 3 # Logging verbosity for the server (5=trace|4=debug|3=info|2=warn|1=error|0=crit) (`log-level` was replaced by `verbosity`, and thus will be deprecated soon)
|
||||||
vmdebug = false # Record information useful for VM and contract debugging
|
vmdebug = false # Record information useful for VM and contract debugging
|
||||||
|
|
@ -153,7 +153,7 @@ devfakeauthor = false # Run miner without validator set authorization
|
||||||
region = "us-north-1"
|
region = "us-north-1"
|
||||||
|
|
||||||
[cache]
|
[cache]
|
||||||
cache = 1024 # Megabytes of memory allocated to internal caching (recommended for mainnet = 4096, default suitable for amoy/mumbai/devnet)
|
cache = 1024 # Megabytes of memory allocated to internal caching (recommended for mainnet = 4096, default suitable for amoy/devnet)
|
||||||
gc = 25 # Percentage of cache memory allowance to use for trie pruning (default = 25% full mode, 0% archive mode)
|
gc = 25 # Percentage of cache memory allowance to use for trie pruning (default = 25% full mode, 0% archive mode)
|
||||||
snapshot = 10 # Percentage of cache memory allowance to use for snapshot caching (default = 10% full mode, 20% archive mode)
|
snapshot = 10 # Percentage of cache memory allowance to use for snapshot caching (default = 10% full mode, 20% archive mode)
|
||||||
database = 50 # Percentage of cache memory allowance to use for database io
|
database = 50 # Percentage of cache memory allowance to use for database io
|
||||||
|
|
@ -181,6 +181,11 @@ devfakeauthor = false # Run miner without validator set authorization
|
||||||
period = 0 # Block period to use in developer mode (0 = mine only if transaction pending)
|
period = 0 # Block period to use in developer mode (0 = mine only if transaction pending)
|
||||||
gaslimit = 11500000 # Initial block gas limit
|
gaslimit = 11500000 # Initial block gas limit
|
||||||
|
|
||||||
|
[parallelevm]
|
||||||
|
enable = true # Enables parallel execution using Block STM
|
||||||
|
procs = 8 # Number of speculative processes (cores) in Block STM
|
||||||
|
enforce = false # Use only Block STM for execution and skip serial execution
|
||||||
|
|
||||||
[pprof]
|
[pprof]
|
||||||
pprof = false # Enable the pprof HTTP server
|
pprof = false # Enable the pprof HTTP server
|
||||||
port = 6060 # pprof HTTP server listening port
|
port = 6060 # pprof HTTP server listening port
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ The ```bor server``` command runs the Bor client.
|
||||||
|
|
||||||
- ```eth.requiredblocks```: Comma separated block number-to-hash mappings to require for peering (<number>=<hash>)
|
- ```eth.requiredblocks```: Comma separated block number-to-hash mappings to require for peering (<number>=<hash>)
|
||||||
|
|
||||||
- ```ethstats```: Reporting URL of an ethstats service (nodename:secret@host:port)
|
- ```ethstats```: Reporting URL of a ethstats service (nodename:secret@host:port)
|
||||||
|
|
||||||
- ```gcmode```: Blockchain garbage collection mode ("full", "archive") (default: full)
|
- ```gcmode```: Blockchain garbage collection mode ("full", "archive") (default: full)
|
||||||
|
|
||||||
|
|
@ -66,6 +66,8 @@ The ```bor server``` command runs the Bor client.
|
||||||
|
|
||||||
- ```parallelevm.enable```: Enable Block STM (default: true)
|
- ```parallelevm.enable```: Enable Block STM (default: true)
|
||||||
|
|
||||||
|
- ```parallelevm.enforce```: Enforce block processing via Block STM (default: false)
|
||||||
|
|
||||||
- ```parallelevm.procs```: Number of speculative processes (cores) in Block STM (default: 8)
|
- ```parallelevm.procs```: Number of speculative processes (cores) in Block STM (default: 8)
|
||||||
|
|
||||||
- ```pprof```: Enable the pprof HTTP server (default: false)
|
- ```pprof```: Enable the pprof HTTP server (default: false)
|
||||||
|
|
@ -148,7 +150,7 @@ The ```bor server``` command runs the Bor client.
|
||||||
|
|
||||||
- ```graphql```: Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well. (default: false)
|
- ```graphql```: Enable GraphQL on the HTTP-RPC server. Note that GraphQL can only be started if an HTTP server is started as well. (default: false)
|
||||||
|
|
||||||
- ```graphql.corsdomain```: Comma separated list of domains from which to accept cross-origin requests (browser enforced) (default: localhost)
|
- ```graphql.corsdomain```: Comma separated list of domains from which to accept cross origin requests (browser enforced) (default: localhost)
|
||||||
|
|
||||||
- ```graphql.vhosts```: Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: localhost)
|
- ```graphql.vhosts```: Comma separated list of virtual hostnames from which to accept requests (server enforced). Accepts '*' wildcard. (default: localhost)
|
||||||
|
|
||||||
|
|
@ -158,7 +160,7 @@ The ```bor server``` command runs the Bor client.
|
||||||
|
|
||||||
- ```http.api```: API's offered over the HTTP-RPC interface (default: eth,net,web3,txpool,bor)
|
- ```http.api```: API's offered over the HTTP-RPC interface (default: eth,net,web3,txpool,bor)
|
||||||
|
|
||||||
- ```http.corsdomain```: Comma separated list of domains from which to accept cross-origin requests (browser enforced) (default: localhost)
|
- ```http.corsdomain```: Comma separated list of domains from which to accept cross origin requests (browser enforced) (default: localhost)
|
||||||
|
|
||||||
- ```http.ep-requesttimeout```: Request Timeout for rpc execution pool for HTTP requests (default: 0s)
|
- ```http.ep-requesttimeout```: Request Timeout for rpc execution pool for HTTP requests (default: 0s)
|
||||||
|
|
||||||
|
|
@ -290,13 +292,13 @@ The ```bor server``` command runs the Bor client.
|
||||||
|
|
||||||
### Transaction Pool Options
|
### Transaction Pool Options
|
||||||
|
|
||||||
- ```txpool.accountqueue```: Maximum number of non-executable transaction slots permitted per account (default: 16)
|
- ```txpool.accountqueue```: Maximum number of non-executable transaction slots permitted per account (default: 64)
|
||||||
|
|
||||||
- ```txpool.accountslots```: Minimum number of executable transaction slots guaranteed per account (default: 16)
|
- ```txpool.accountslots```: Minimum number of executable transaction slots guaranteed per account (default: 16)
|
||||||
|
|
||||||
- ```txpool.globalqueue```: Maximum number of non-executable transaction slots for all accounts (default: 32768)
|
- ```txpool.globalqueue```: Maximum number of non-executable transaction slots for all accounts (default: 131072)
|
||||||
|
|
||||||
- ```txpool.globalslots```: Maximum number of executable transaction slots for all accounts (default: 32768)
|
- ```txpool.globalslots```: Maximum number of executable transaction slots for all accounts (default: 131072)
|
||||||
|
|
||||||
- ```txpool.journal```: Disk journal for local transaction to survive node restarts (default: transactions.rlp)
|
- ```txpool.journal```: Disk journal for local transaction to survive node restarts (default: transactions.rlp)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -179,11 +179,6 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
||||||
|
|
||||||
gpoParams := config.GPO
|
gpoParams := config.GPO
|
||||||
|
|
||||||
// POS-2798: Default was removed from gasprice.Config
|
|
||||||
// if gpoParams.Default == nil {
|
|
||||||
// gpoParams.Default = config.Miner.GasPrice
|
|
||||||
// }
|
|
||||||
|
|
||||||
// Override the chain config with provided settings.
|
// Override the chain config with provided settings.
|
||||||
var overrides core.ChainOverrides
|
var overrides core.ChainOverrides
|
||||||
if config.OverrideCancun != nil {
|
if config.OverrideCancun != nil {
|
||||||
|
|
@ -258,12 +253,11 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
||||||
// check if Parallel EVM is enabled
|
// check if Parallel EVM is enabled
|
||||||
// if enabled, use parallel state processor
|
// if enabled, use parallel state processor
|
||||||
if config.ParallelEVM.Enable {
|
if config.ParallelEVM.Enable {
|
||||||
eth.blockchain, err = core.NewParallelBlockChain(chainDb, cacheConfig, config.Genesis, &overrides, eth.engine, vmConfig, eth.shouldPreserve, &config.TransactionHistory, checker, config.ParallelEVM.SpeculativeProcesses)
|
eth.blockchain, err = core.NewParallelBlockChain(chainDb, cacheConfig, config.Genesis, &overrides, eth.engine, vmConfig, eth.shouldPreserve, &config.TransactionHistory, checker, config.ParallelEVM.SpeculativeProcesses, config.ParallelEVM.Enforce)
|
||||||
} else {
|
} else {
|
||||||
eth.blockchain, err = core.NewBlockChain(chainDb, cacheConfig, config.Genesis, &overrides, eth.engine, vmConfig, eth.shouldPreserve, &config.TransactionHistory, checker)
|
eth.blockchain, err = core.NewBlockChain(chainDb, cacheConfig, config.Genesis, &overrides, eth.engine, vmConfig, eth.shouldPreserve, &config.TransactionHistory, checker)
|
||||||
}
|
}
|
||||||
|
|
||||||
// POS-2798: NewOracle function definition was changed to accept (startPrice *big.Int)
|
|
||||||
eth.APIBackend.gpo = gasprice.NewOracle(eth.APIBackend, gpoParams, config.Miner.GasPrice)
|
eth.APIBackend.gpo = gasprice.NewOracle(eth.APIBackend, gpoParams, config.Miner.GasPrice)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
@ -322,7 +316,6 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
||||||
if eth.APIBackend.allowUnprotectedTxs {
|
if eth.APIBackend.allowUnprotectedTxs {
|
||||||
log.Info("Unprotected transactions allowed")
|
log.Info("Unprotected transactions allowed")
|
||||||
}
|
}
|
||||||
// POS-2798: NewOracle function definition was changed to accept (startPrice *big.Int)
|
|
||||||
eth.APIBackend.gpo = gasprice.NewOracle(eth.APIBackend, config.GPO, config.Miner.GasPrice)
|
eth.APIBackend.gpo = gasprice.NewOracle(eth.APIBackend, config.GPO, config.Miner.GasPrice)
|
||||||
|
|
||||||
// Start the RPC service
|
// Start the RPC service
|
||||||
|
|
|
||||||
|
|
@ -559,7 +559,7 @@ func TestIsValidChain(t *testing.T) {
|
||||||
s.ProcessMilestone(tempChain[1].Number.Uint64(), tempChain[1].Hash())
|
s.ProcessMilestone(tempChain[1].Number.Uint64(), tempChain[1].Hash())
|
||||||
|
|
||||||
// case10: Try importing a past chain having valid checkpoint, should
|
// case10: Try importing a past chain having valid checkpoint, should
|
||||||
// consider the chain as invalid as still lastest milestone is ahead of the chain.
|
// consider the chain as invalid as still latest milestone is ahead of the chain.
|
||||||
res, err = s.IsValidChain(tempChain[1], chainA)
|
res, err = s.IsValidChain(tempChain[1], chainA)
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
require.Equal(t, res, false, "expected chain to be invalid")
|
require.Equal(t, res, false, "expected chain to be invalid")
|
||||||
|
|
|
||||||
|
|
@ -242,7 +242,7 @@ func run(ctx context.Context, call *core.Message, opts *Options) (*core.Executio
|
||||||
evm.Cancel()
|
evm.Cancel()
|
||||||
}()
|
}()
|
||||||
// Execute the call, returning a wrapped error or the result
|
// Execute the call, returning a wrapped error or the result
|
||||||
result, err := core.ApplyMessage(evm, call, new(core.GasPool).AddGas(math.MaxUint64))
|
result, err := core.ApplyMessage(evm, call, new(core.GasPool).AddGas(math.MaxUint64), nil)
|
||||||
if vmerr := dirtyState.Error(); vmerr != nil {
|
if vmerr := dirtyState.Error(); vmerr != nil {
|
||||||
return nil, vmerr
|
return nil, vmerr
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -156,7 +156,7 @@ func (eth *Ethereum) hashState(ctx context.Context, block *types.Block, reexec u
|
||||||
if current = eth.blockchain.GetBlockByNumber(next); current == nil {
|
if current = eth.blockchain.GetBlockByNumber(next); current == nil {
|
||||||
return nil, nil, fmt.Errorf("block #%d not found", next)
|
return nil, nil, fmt.Errorf("block #%d not found", next)
|
||||||
}
|
}
|
||||||
_, err := eth.blockchain.Processor().Process(current, statedb, vm.Config{})
|
_, err := eth.blockchain.Processor().Process(current, statedb, vm.Config{}, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, fmt.Errorf("processing block %d failed: %v", current.NumberU64(), err)
|
return nil, nil, fmt.Errorf("processing block %d failed: %v", current.NumberU64(), err)
|
||||||
}
|
}
|
||||||
|
|
@ -275,7 +275,7 @@ func (eth *Ethereum) stateAtTransaction(ctx context.Context, block *types.Block,
|
||||||
vmenv := vm.NewEVM(context, txContext, statedb, eth.blockchain.Config(), vm.Config{})
|
vmenv := vm.NewEVM(context, txContext, statedb, eth.blockchain.Config(), vm.Config{})
|
||||||
statedb.SetTxContext(tx.Hash(), idx)
|
statedb.SetTxContext(tx.Hash(), idx)
|
||||||
// nolint : contextcheck
|
// nolint : contextcheck
|
||||||
if _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(tx.Gas())); err != nil {
|
if _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(tx.Gas()), nil); err != nil {
|
||||||
return nil, vm.BlockContext{}, nil, nil, fmt.Errorf("transaction %#x failed: %v", tx.Hash(), err)
|
return nil, vm.BlockContext{}, nil, nil, fmt.Errorf("transaction %#x failed: %v", tx.Hash(), err)
|
||||||
}
|
}
|
||||||
// Ensure any modifications are committed to the state
|
// Ensure any modifications are committed to the state
|
||||||
|
|
|
||||||
|
|
@ -727,7 +727,7 @@ func (api *API) IntermediateRoots(ctx context.Context, hash common.Hash, config
|
||||||
} else {
|
} else {
|
||||||
statedb.SetTxContext(tx.Hash(), i)
|
statedb.SetTxContext(tx.Hash(), i)
|
||||||
// nolint : contextcheck
|
// nolint : contextcheck
|
||||||
if _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.GasLimit)); err != nil {
|
if _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.GasLimit), context.Background()); err != nil {
|
||||||
log.Warn("Tracing intermediate roots did not complete", "txindex", i, "txhash", tx.Hash(), "err", err)
|
log.Warn("Tracing intermediate roots did not complete", "txindex", i, "txhash", tx.Hash(), "err", err)
|
||||||
// We intentionally don't return the error here: if we do, then the RPC server will not
|
// We intentionally don't return the error here: if we do, then the RPC server will not
|
||||||
// return the roots. Most likely, the caller already knows that a certain transaction fails to
|
// return the roots. Most likely, the caller already knows that a certain transaction fails to
|
||||||
|
|
@ -929,7 +929,7 @@ txloop:
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// nolint : contextcheck
|
// nolint : contextcheck
|
||||||
if _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.GasLimit)); err != nil {
|
if _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.GasLimit), context.Background()); err != nil {
|
||||||
failed = err
|
failed = err
|
||||||
break txloop
|
break txloop
|
||||||
}
|
}
|
||||||
|
|
@ -940,7 +940,7 @@ txloop:
|
||||||
} else {
|
} else {
|
||||||
coinbaseBalance := big.NewInt(statedb.GetBalance(blockCtx.Coinbase).ToBig().Int64())
|
coinbaseBalance := big.NewInt(statedb.GetBalance(blockCtx.Coinbase).ToBig().Int64())
|
||||||
// nolint : contextcheck
|
// nolint : contextcheck
|
||||||
result, err := core.ApplyMessageNoFeeBurnOrTip(vmenv, *msg, new(core.GasPool).AddGas(msg.GasLimit))
|
result, err := core.ApplyMessageNoFeeBurnOrTip(vmenv, *msg, new(core.GasPool).AddGas(msg.GasLimit), context.Background())
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
failed = err
|
failed = err
|
||||||
|
|
@ -1148,7 +1148,7 @@ func (api *API) standardTraceBlockToFile(ctx context.Context, block *types.Block
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint : contextcheck
|
// nolint : contextcheck
|
||||||
vmRet, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.GasLimit))
|
vmRet, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.GasLimit), context.Background())
|
||||||
if vmConf.Tracer.OnTxEnd != nil {
|
if vmConf.Tracer.OnTxEnd != nil {
|
||||||
vmConf.Tracer.OnTxEnd(&types.Receipt{GasUsed: vmRet.UsedGas}, err)
|
vmConf.Tracer.OnTxEnd(&types.Receipt{GasUsed: vmRet.UsedGas}, err)
|
||||||
}
|
}
|
||||||
|
|
@ -1424,7 +1424,7 @@ func (api *API) traceTx(ctx context.Context, tx *types.Transaction, message *cor
|
||||||
} else {
|
} else {
|
||||||
// Call Prepare to clear out the statedb access list
|
// Call Prepare to clear out the statedb access list
|
||||||
statedb.SetTxContext(txctx.TxHash, txctx.TxIndex)
|
statedb.SetTxContext(txctx.TxHash, txctx.TxIndex)
|
||||||
_, err = core.ApplyTransactionWithEVM(message, api.backend.ChainConfig(), new(core.GasPool).AddGas(message.GasLimit), statedb, vmctx.BlockNumber, txctx.BlockHash, tx, &usedGas, vmenv)
|
_, err = core.ApplyTransactionWithEVM(message, api.backend.ChainConfig(), new(core.GasPool).AddGas(message.GasLimit), statedb, vmctx.BlockNumber, txctx.BlockHash, tx, &usedGas, vmenv, context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("tracing failed: %w", err)
|
return nil, fmt.Errorf("tracing failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -98,7 +98,7 @@ func (api *API) traceBorBlock(ctx context.Context, block *types.Block, config *T
|
||||||
callmsg := prepareCallMessage(*message)
|
callmsg := prepareCallMessage(*message)
|
||||||
execRes, err = statefull.ApplyBorMessage(vmenv, callmsg)
|
execRes, err = statefull.ApplyBorMessage(vmenv, callmsg)
|
||||||
} else {
|
} else {
|
||||||
execRes, err = core.ApplyMessage(vmenv, message, new(core.GasPool).AddGas(message.GasLimit))
|
execRes, err = core.ApplyMessage(vmenv, message, new(core.GasPool).AddGas(message.GasLimit), nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -196,7 +196,7 @@ func (b *testBackend) StateAtTransaction(ctx context.Context, block *types.Block
|
||||||
|
|
||||||
vmenv := vm.NewEVM(blockContext, txContext, statedb, b.chainConfig, vm.Config{})
|
vmenv := vm.NewEVM(blockContext, txContext, statedb, b.chainConfig, vm.Config{})
|
||||||
// nolint : contextcheck
|
// nolint : contextcheck
|
||||||
if _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(tx.Gas())); err != nil {
|
if _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(tx.Gas()), context.Background()); err != nil {
|
||||||
return nil, vm.BlockContext{}, nil, nil, fmt.Errorf("transaction %#x failed: %v", tx.Hash(), err)
|
return nil, vm.BlockContext{}, nil, nil, fmt.Errorf("transaction %#x failed: %v", tx.Hash(), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
package tracetest
|
package tracetest
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
@ -138,7 +139,7 @@ func testCallTracer(tracerName string, dirPath string, t *testing.T) {
|
||||||
}
|
}
|
||||||
evm := vm.NewEVM(blockContext, core.NewEVMTxContext(msg), state.StateDB, test.Genesis.Config, vm.Config{Tracer: tracer.Hooks})
|
evm := vm.NewEVM(blockContext, core.NewEVMTxContext(msg), state.StateDB, test.Genesis.Config, vm.Config{Tracer: tracer.Hooks})
|
||||||
tracer.OnTxStart(evm.GetVMContext(), tx, msg.From)
|
tracer.OnTxStart(evm.GetVMContext(), tx, msg.From)
|
||||||
vmRet, err := core.ApplyMessage(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
|
vmRet, err := core.ApplyMessage(evm, msg, new(core.GasPool).AddGas(tx.Gas()), context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to execute transaction: %v", err)
|
t.Fatalf("failed to execute transaction: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -256,7 +257,7 @@ func benchTracer(tracerName string, test *callTracerTest, b *testing.B) {
|
||||||
|
|
||||||
st := core.NewStateTransition(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
|
st := core.NewStateTransition(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
|
||||||
|
|
||||||
if _, err = st.TransitionDb(); err != nil {
|
if _, err = st.TransitionDb(context.Background()); err != nil {
|
||||||
b.Fatalf("failed to execute transaction: %v", err)
|
b.Fatalf("failed to execute transaction: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -406,7 +407,7 @@ func TestInternals(t *testing.T) {
|
||||||
t.Fatalf("test %v: failed to create message: %v", tc.name, err)
|
t.Fatalf("test %v: failed to create message: %v", tc.name, err)
|
||||||
}
|
}
|
||||||
tc.tracer.OnTxStart(evm.GetVMContext(), tx, msg.From)
|
tc.tracer.OnTxStart(evm.GetVMContext(), tx, msg.From)
|
||||||
vmRet, err := core.ApplyMessage(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
|
vmRet, err := core.ApplyMessage(evm, msg, new(core.GasPool).AddGas(tx.Gas()), context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("test %v: failed to execute transaction: %v", tc.name, err)
|
t.Fatalf("test %v: failed to execute transaction: %v", tc.name, err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
package tracetest
|
package tracetest
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
@ -105,7 +106,7 @@ func flatCallTracerTestRunner(tb testing.TB, tracerName string, filename string,
|
||||||
}
|
}
|
||||||
evm := vm.NewEVM(blockContext, core.NewEVMTxContext(msg), state.StateDB, test.Genesis.Config, vm.Config{Tracer: tracer.Hooks})
|
evm := vm.NewEVM(blockContext, core.NewEVMTxContext(msg), state.StateDB, test.Genesis.Config, vm.Config{Tracer: tracer.Hooks})
|
||||||
tracer.OnTxStart(evm.GetVMContext(), tx, msg.From)
|
tracer.OnTxStart(evm.GetVMContext(), tx, msg.From)
|
||||||
vmRet, err := core.ApplyMessage(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
|
vmRet, err := core.ApplyMessage(evm, msg, new(core.GasPool).AddGas(tx.Gas()), context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to execute transaction: %v", err)
|
return fmt.Errorf("failed to execute transaction: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
package tracetest
|
package tracetest
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"math/big"
|
"math/big"
|
||||||
"os"
|
"os"
|
||||||
|
|
@ -119,7 +120,7 @@ func testPrestateDiffTracer(t *testing.T, tracerName string, dirPath string) {
|
||||||
}
|
}
|
||||||
evm := vm.NewEVM(blockContext, core.NewEVMTxContext(msg), state.StateDB, test.Genesis.Config, vm.Config{Tracer: tracer.Hooks})
|
evm := vm.NewEVM(blockContext, core.NewEVMTxContext(msg), state.StateDB, test.Genesis.Config, vm.Config{Tracer: tracer.Hooks})
|
||||||
tracer.OnTxStart(evm.GetVMContext(), tx, msg.From)
|
tracer.OnTxStart(evm.GetVMContext(), tx, msg.From)
|
||||||
vmRet, err := core.ApplyMessage(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
|
vmRet, err := core.ApplyMessage(evm, msg, new(core.GasPool).AddGas(tx.Gas()), context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("failed to execute transaction: %v", err)
|
t.Fatalf("failed to execute transaction: %v", err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -79,7 +79,7 @@ func runTrace(tracer *tracers.Tracer, vmctx *vmContext, chaincfg *params.ChainCo
|
||||||
|
|
||||||
tracer.OnTxStart(env.GetVMContext(), types.NewTx(&types.LegacyTx{Gas: gasLimit}), contract.Caller())
|
tracer.OnTxStart(env.GetVMContext(), types.NewTx(&types.LegacyTx{Gas: gasLimit}), contract.Caller())
|
||||||
tracer.OnEnter(0, byte(vm.CALL), contract.Caller(), contract.Address(), []byte{}, startGas, value.ToBig())
|
tracer.OnEnter(0, byte(vm.CALL), contract.Caller(), contract.Address(), []byte{}, startGas, value.ToBig())
|
||||||
ret, err := env.Interpreter().Run(contract, []byte{}, false)
|
ret, err := env.Interpreter().Run(contract, []byte{}, false, nil)
|
||||||
tracer.OnExit(0, ret, startGas-contract.Gas, err, true)
|
tracer.OnExit(0, ret, startGas-contract.Gas, err, true)
|
||||||
// Rest gas assumes no refund
|
// Rest gas assumes no refund
|
||||||
tracer.OnTxEnd(&types.Receipt{GasUsed: gasLimit - contract.Gas}, nil)
|
tracer.OnTxEnd(&types.Receipt{GasUsed: gasLimit - contract.Gas}, nil)
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ func TestStoreCapture(t *testing.T) {
|
||||||
|
|
||||||
var index common.Hash
|
var index common.Hash
|
||||||
logger.OnTxStart(env.GetVMContext(), nil, common.Address{})
|
logger.OnTxStart(env.GetVMContext(), nil, common.Address{})
|
||||||
_, err := env.Interpreter().Run(contract, []byte{}, false)
|
_, err := env.Interpreter().Run(contract, []byte{}, false, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@
|
||||||
package tracers
|
package tracers
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"context"
|
||||||
"math/big"
|
"math/big"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
|
|
@ -104,7 +105,7 @@ func BenchmarkTransactionTrace(b *testing.B) {
|
||||||
snap := state.StateDB.Snapshot()
|
snap := state.StateDB.Snapshot()
|
||||||
st := core.NewStateTransition(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
|
st := core.NewStateTransition(evm, msg, new(core.GasPool).AddGas(tx.Gas()))
|
||||||
|
|
||||||
_, err = st.TransitionDb()
|
_, err = st.TransitionDb(context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
b.Fatal(err)
|
b.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
8
go.mod
8
go.mod
|
|
@ -91,11 +91,11 @@ require (
|
||||||
go.opentelemetry.io/otel/sdk v1.27.0
|
go.opentelemetry.io/otel/sdk v1.27.0
|
||||||
go.uber.org/automaxprocs v1.5.3
|
go.uber.org/automaxprocs v1.5.3
|
||||||
go.uber.org/goleak v1.3.0
|
go.uber.org/goleak v1.3.0
|
||||||
golang.org/x/crypto v0.24.0
|
golang.org/x/crypto v0.31.0
|
||||||
golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8
|
golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8
|
||||||
golang.org/x/sync v0.7.0
|
golang.org/x/sync v0.10.0
|
||||||
golang.org/x/sys v0.22.0
|
golang.org/x/sys v0.28.0
|
||||||
golang.org/x/text v0.16.0
|
golang.org/x/text v0.21.0
|
||||||
golang.org/x/time v0.5.0
|
golang.org/x/time v0.5.0
|
||||||
golang.org/x/tools v0.22.0
|
golang.org/x/tools v0.22.0
|
||||||
google.golang.org/grpc v1.64.1
|
google.golang.org/grpc v1.64.1
|
||||||
|
|
|
||||||
16
go.sum
16
go.sum
|
|
@ -2386,8 +2386,8 @@ golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq
|
||||||
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
|
golang.org/x/crypto v0.18.0/go.mod h1:R0j02AL6hcrfOiy9T4ZYp/rcWeMxM3L6QYxlOuEG1mg=
|
||||||
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU=
|
||||||
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
|
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
|
||||||
golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI=
|
golang.org/x/crypto v0.31.0 h1:ihbySMvVjLAeSH1IbfcRTkD/iNscyz8rGzjF/E5hV6U=
|
||||||
golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM=
|
golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk=
|
||||||
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||||
|
|
@ -2617,8 +2617,8 @@ golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||||
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||||
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M=
|
golang.org/x/sync v0.10.0 h1:3NQrjDixjgGwUOCaF8w2+VYHv0Ve/vGYSbdkTa98gmQ=
|
||||||
golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
golang.org/x/sync v0.10.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk=
|
||||||
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
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-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||||
|
|
@ -2759,8 +2759,8 @@ golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.16.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI=
|
golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA=
|
||||||
golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
golang.org/x/sys v0.28.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
|
||||||
golang.org/x/telemetry v0.0.0-20240208230135-b75ee8823808/go.mod h1:KG1lNk5ZFNssSZLrpVb4sMXKMpGwGXOxSG3rnu2gZQQ=
|
golang.org/x/telemetry v0.0.0-20240208230135-b75ee8823808/go.mod h1:KG1lNk5ZFNssSZLrpVb4sMXKMpGwGXOxSG3rnu2gZQQ=
|
||||||
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
golang.org/x/telemetry v0.0.0-20240228155512-f48c80bd79b2/go.mod h1:TeRTkGYfJXctD9OcfyVLyj2J3IxLnKwHJR8f4D8a3YE=
|
||||||
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
|
||||||
|
|
@ -2804,8 +2804,8 @@ golang.org/x/text v0.11.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||||
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||||
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
|
||||||
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU=
|
||||||
golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4=
|
golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo=
|
||||||
golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI=
|
golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ=
|
||||||
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||||
|
|
|
||||||
|
|
@ -597,6 +597,8 @@ type ParallelEVMConfig struct {
|
||||||
Enable bool `hcl:"enable,optional" toml:"enable,optional"`
|
Enable bool `hcl:"enable,optional" toml:"enable,optional"`
|
||||||
|
|
||||||
SpeculativeProcesses int `hcl:"procs,optional" toml:"procs,optional"`
|
SpeculativeProcesses int `hcl:"procs,optional" toml:"procs,optional"`
|
||||||
|
|
||||||
|
Enforce bool `hcl:"enforce,optional" toml:"enforce,optional"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func DefaultConfig() *Config {
|
func DefaultConfig() *Config {
|
||||||
|
|
@ -658,9 +660,9 @@ func DefaultConfig() *Config {
|
||||||
PriceLimit: params.BorDefaultTxPoolPriceLimit, // bor's default
|
PriceLimit: params.BorDefaultTxPoolPriceLimit, // bor's default
|
||||||
PriceBump: 10,
|
PriceBump: 10,
|
||||||
AccountSlots: 16,
|
AccountSlots: 16,
|
||||||
GlobalSlots: 32768,
|
GlobalSlots: 131072,
|
||||||
AccountQueue: 16,
|
AccountQueue: 64,
|
||||||
GlobalQueue: 32768,
|
GlobalQueue: 131072,
|
||||||
LifeTime: 3 * time.Hour,
|
LifeTime: 3 * time.Hour,
|
||||||
},
|
},
|
||||||
Sealer: &SealerConfig{
|
Sealer: &SealerConfig{
|
||||||
|
|
@ -794,6 +796,7 @@ func DefaultConfig() *Config {
|
||||||
ParallelEVM: &ParallelEVMConfig{
|
ParallelEVM: &ParallelEVMConfig{
|
||||||
Enable: true,
|
Enable: true,
|
||||||
SpeculativeProcesses: 8,
|
SpeculativeProcesses: 8,
|
||||||
|
Enforce: false,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1199,6 +1202,7 @@ func (c *Config) buildEth(stack *node.Node, accountManager *accounts.Manager) (*
|
||||||
|
|
||||||
n.ParallelEVM.Enable = c.ParallelEVM.Enable
|
n.ParallelEVM.Enable = c.ParallelEVM.Enable
|
||||||
n.ParallelEVM.SpeculativeProcesses = c.ParallelEVM.SpeculativeProcesses
|
n.ParallelEVM.SpeculativeProcesses = c.ParallelEVM.SpeculativeProcesses
|
||||||
|
n.ParallelEVM.Enforce = c.ParallelEVM.Enforce
|
||||||
n.RPCReturnDataLimit = c.RPCReturnDataLimit
|
n.RPCReturnDataLimit = c.RPCReturnDataLimit
|
||||||
|
|
||||||
if c.Ancient != "" {
|
if c.Ancient != "" {
|
||||||
|
|
|
||||||
|
|
@ -986,6 +986,13 @@ func (c *Command) Flags(config *Config) *flagset.Flagset {
|
||||||
Value: &c.cliConfig.ParallelEVM.SpeculativeProcesses,
|
Value: &c.cliConfig.ParallelEVM.SpeculativeProcesses,
|
||||||
Default: c.cliConfig.ParallelEVM.SpeculativeProcesses,
|
Default: c.cliConfig.ParallelEVM.SpeculativeProcesses,
|
||||||
})
|
})
|
||||||
|
f.BoolFlag(&flagset.BoolFlag{
|
||||||
|
Name: "parallelevm.enforce",
|
||||||
|
Usage: "Enforce block processing via Block STM",
|
||||||
|
Value: &c.cliConfig.ParallelEVM.Enforce,
|
||||||
|
Default: c.cliConfig.ParallelEVM.Enforce,
|
||||||
|
})
|
||||||
|
|
||||||
f.Uint64Flag(&flagset.Uint64Flag{
|
f.Uint64Flag(&flagset.Uint64Flag{
|
||||||
Name: "dev.gaslimit",
|
Name: "dev.gaslimit",
|
||||||
Usage: "Initial block gas limit",
|
Usage: "Initial block gas limit",
|
||||||
|
|
|
||||||
7
internal/cli/server/testdata/default.toml
vendored
7
internal/cli/server/testdata/default.toml
vendored
|
|
@ -62,9 +62,9 @@ devfakeauthor = false
|
||||||
pricelimit = 25000000000
|
pricelimit = 25000000000
|
||||||
pricebump = 10
|
pricebump = 10
|
||||||
accountslots = 16
|
accountslots = 16
|
||||||
globalslots = 32768
|
globalslots = 131072
|
||||||
accountqueue = 16
|
accountqueue = 64
|
||||||
globalqueue = 32768
|
globalqueue = 131072
|
||||||
lifetime = "3h0m0s"
|
lifetime = "3h0m0s"
|
||||||
|
|
||||||
[miner]
|
[miner]
|
||||||
|
|
@ -185,6 +185,7 @@ devfakeauthor = false
|
||||||
[parallelevm]
|
[parallelevm]
|
||||||
enable = true
|
enable = true
|
||||||
procs = 8
|
procs = 8
|
||||||
|
enforce = false
|
||||||
|
|
||||||
[pprof]
|
[pprof]
|
||||||
pprof = false
|
pprof = false
|
||||||
|
|
|
||||||
|
|
@ -473,7 +473,7 @@ func checkDeletePermissions(path string) (bool, error) {
|
||||||
func (c *PruneBlockCommand) pruneBlock(stack *node.Node, fdHandles int) error {
|
func (c *PruneBlockCommand) pruneBlock(stack *node.Node, fdHandles int) error {
|
||||||
name := "chaindata"
|
name := "chaindata"
|
||||||
|
|
||||||
oldAncientPath := c.datadirAncient
|
oldAncientPath := strings.TrimSuffix(c.datadirAncient, "/")
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case oldAncientPath == "":
|
case oldAncientPath == "":
|
||||||
|
|
|
||||||
|
|
@ -1392,7 +1392,7 @@ func applyMessageWithEVM(ctx context.Context, evm *vm.EVM, msg *core.Message, st
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Execute the message.
|
// Execute the message.
|
||||||
result, err := core.ApplyMessage(evm, msg, gp)
|
result, err := core.ApplyMessage(evm, msg, gp, context.Background())
|
||||||
if err := state.Error(); err != nil {
|
if err := state.Error(); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
@ -2013,7 +2013,7 @@ func AccessList(ctx context.Context, b Backend, blockNrOrHash rpc.BlockNumberOrH
|
||||||
if msg.BlobGasFeeCap != nil && msg.BlobGasFeeCap.BitLen() == 0 {
|
if msg.BlobGasFeeCap != nil && msg.BlobGasFeeCap.BitLen() == 0 {
|
||||||
vmenv.Context.BlobBaseFee = new(big.Int)
|
vmenv.Context.BlobBaseFee = new(big.Int)
|
||||||
}
|
}
|
||||||
res, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.GasLimit))
|
res, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.GasLimit), context.Background())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, 0, nil, fmt.Errorf("failed to apply transaction: %v err: %v", args.ToTransaction(types.LegacyTxType).Hash(), err)
|
return nil, 0, nil, fmt.Errorf("failed to apply transaction: %v err: %v", args.ToTransaction(types.LegacyTxType).Hash(), err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,762 +0,0 @@
|
||||||
package miner
|
|
||||||
|
|
||||||
import (
|
|
||||||
"context"
|
|
||||||
"errors"
|
|
||||||
"fmt"
|
|
||||||
"os"
|
|
||||||
"sync"
|
|
||||||
"sync/atomic"
|
|
||||||
"time"
|
|
||||||
|
|
||||||
// nolint:typecheck
|
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
|
||||||
cmath "github.com/ethereum/go-ethereum/common/math"
|
|
||||||
"github.com/ethereum/go-ethereum/common/tracing"
|
|
||||||
"github.com/ethereum/go-ethereum/consensus"
|
|
||||||
"github.com/ethereum/go-ethereum/core"
|
|
||||||
"github.com/ethereum/go-ethereum/core/blockstm"
|
|
||||||
"github.com/ethereum/go-ethereum/core/state"
|
|
||||||
"github.com/ethereum/go-ethereum/core/txpool"
|
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
|
||||||
"github.com/ethereum/go-ethereum/core/vm"
|
|
||||||
"github.com/ethereum/go-ethereum/event"
|
|
||||||
"github.com/ethereum/go-ethereum/log"
|
|
||||||
"github.com/ethereum/go-ethereum/params"
|
|
||||||
"github.com/ethereum/go-ethereum/rlp"
|
|
||||||
"github.com/holiman/uint256"
|
|
||||||
|
|
||||||
"go.opentelemetry.io/otel"
|
|
||||||
"go.opentelemetry.io/otel/attribute"
|
|
||||||
"go.opentelemetry.io/otel/trace"
|
|
||||||
|
|
||||||
lru "github.com/hashicorp/golang-lru"
|
|
||||||
)
|
|
||||||
|
|
||||||
// newWorkerWithDelay is newWorker() with extra params to induce artficial delays for tests such as commit-interrupt.
|
|
||||||
// nolint:staticcheck
|
|
||||||
func newWorkerWithDelay(config *Config, chainConfig *params.ChainConfig, engine consensus.Engine, eth Backend, mux *event.TypeMux, isLocalBlock func(header *types.Header) bool, init bool, delay uint, opcodeDelay uint) *worker {
|
|
||||||
worker := &worker{
|
|
||||||
config: config,
|
|
||||||
chainConfig: chainConfig,
|
|
||||||
engine: engine,
|
|
||||||
eth: eth,
|
|
||||||
chain: eth.BlockChain(),
|
|
||||||
mux: mux,
|
|
||||||
isLocalBlock: isLocalBlock,
|
|
||||||
coinbase: config.Etherbase,
|
|
||||||
extra: config.ExtraData,
|
|
||||||
pendingTasks: make(map[common.Hash]*task),
|
|
||||||
txsCh: make(chan core.NewTxsEvent, txChanSize),
|
|
||||||
chainHeadCh: make(chan core.ChainHeadEvent, chainHeadChanSize),
|
|
||||||
newWorkCh: make(chan *newWorkReq),
|
|
||||||
getWorkCh: make(chan *getWorkReq),
|
|
||||||
taskCh: make(chan *task),
|
|
||||||
resultCh: make(chan *types.Block, resultQueueSize),
|
|
||||||
startCh: make(chan struct{}, 1),
|
|
||||||
exitCh: make(chan struct{}),
|
|
||||||
resubmitIntervalCh: make(chan time.Duration),
|
|
||||||
resubmitAdjustCh: make(chan *intervalAdjust, resubmitAdjustChanSize),
|
|
||||||
interruptCommitFlag: config.CommitInterruptFlag,
|
|
||||||
}
|
|
||||||
worker.noempty.Store(true)
|
|
||||||
worker.profileCount = new(int32)
|
|
||||||
// Subscribe for transaction insertion events (whether from network or resurrects)
|
|
||||||
worker.txsSub = eth.TxPool().SubscribeTransactions(worker.txsCh, true)
|
|
||||||
// Subscribe events for blockchain
|
|
||||||
worker.chainHeadSub = eth.BlockChain().SubscribeChainHeadEvent(worker.chainHeadCh)
|
|
||||||
|
|
||||||
interruptedTxCache, err := lru.New(vm.InterruptedTxCacheSize)
|
|
||||||
if err != nil {
|
|
||||||
log.Warn("Failed to create interrupted tx cache", "err", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
worker.interruptedTxCache = &vm.TxCache{
|
|
||||||
Cache: interruptedTxCache,
|
|
||||||
}
|
|
||||||
|
|
||||||
if !worker.interruptCommitFlag {
|
|
||||||
worker.noempty.Store(false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sanitize recommit interval if the user-specified one is too short.
|
|
||||||
recommit := worker.config.Recommit
|
|
||||||
if recommit < minRecommitInterval {
|
|
||||||
log.Warn("Sanitizing miner recommit interval", "provided", recommit, "updated", minRecommitInterval)
|
|
||||||
recommit = minRecommitInterval
|
|
||||||
}
|
|
||||||
|
|
||||||
worker.recommit = recommit
|
|
||||||
|
|
||||||
// Sanitize the timeout config for creating payload.
|
|
||||||
newpayloadTimeout := worker.config.NewPayloadTimeout
|
|
||||||
if newpayloadTimeout == 0 {
|
|
||||||
log.Warn("Sanitizing new payload timeout to default", "provided", newpayloadTimeout, "updated", DefaultConfig.NewPayloadTimeout)
|
|
||||||
newpayloadTimeout = DefaultConfig.NewPayloadTimeout
|
|
||||||
}
|
|
||||||
|
|
||||||
if newpayloadTimeout < time.Millisecond*100 {
|
|
||||||
log.Warn("Low payload timeout may cause high amount of non-full blocks", "provided", newpayloadTimeout, "default", DefaultConfig.NewPayloadTimeout)
|
|
||||||
}
|
|
||||||
|
|
||||||
worker.newpayloadTimeout = newpayloadTimeout
|
|
||||||
|
|
||||||
ctx := tracing.WithTracer(context.Background(), otel.GetTracerProvider().Tracer("MinerWorker"))
|
|
||||||
|
|
||||||
worker.wg.Add(4)
|
|
||||||
|
|
||||||
go worker.mainLoopWithDelay(ctx, delay, opcodeDelay)
|
|
||||||
go worker.newWorkLoop(ctx, recommit)
|
|
||||||
go worker.resultLoop()
|
|
||||||
go worker.taskLoop()
|
|
||||||
|
|
||||||
// Submit first work to initialize pending state.
|
|
||||||
if init {
|
|
||||||
worker.startCh <- struct{}{}
|
|
||||||
}
|
|
||||||
|
|
||||||
return worker
|
|
||||||
}
|
|
||||||
|
|
||||||
// mainLoopWithDelay is mainLoop() with extra params to induce artficial delays for tests such as commit-interrupt.
|
|
||||||
// nolint:gocognit
|
|
||||||
func (w *worker) mainLoopWithDelay(ctx context.Context, delay uint, opcodeDelay uint) {
|
|
||||||
defer w.wg.Done()
|
|
||||||
defer w.txsSub.Unsubscribe()
|
|
||||||
defer w.chainHeadSub.Unsubscribe()
|
|
||||||
defer func() {
|
|
||||||
if w.current != nil {
|
|
||||||
w.current.discard()
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case req := <-w.newWorkCh:
|
|
||||||
if w.chainConfig.ChainID.Cmp(params.BorMainnetChainConfig.ChainID) == 0 || w.chainConfig.ChainID.Cmp(params.MumbaiChainConfig.ChainID) == 0 {
|
|
||||||
if w.eth.PeerCount() > 0 {
|
|
||||||
//nolint:contextcheck
|
|
||||||
w.commitWorkWithDelay(req.ctx, req.interrupt, req.noempty, req.timestamp, delay, opcodeDelay)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//nolint:contextcheck
|
|
||||||
w.commitWorkWithDelay(req.ctx, req.interrupt, req.noempty, req.timestamp, delay, opcodeDelay)
|
|
||||||
}
|
|
||||||
|
|
||||||
case req := <-w.getWorkCh:
|
|
||||||
req.result <- w.generateWork(req.params, false)
|
|
||||||
|
|
||||||
case ev := <-w.txsCh:
|
|
||||||
// Apply transactions to the pending state if we're not sealing
|
|
||||||
//
|
|
||||||
// Note all transactions received may not be continuous with transactions
|
|
||||||
// already included in the current sealing block. These transactions will
|
|
||||||
// be automatically eliminated.
|
|
||||||
// nolint : nestif
|
|
||||||
if !w.IsRunning() && w.current != nil {
|
|
||||||
// If block is already full, abort
|
|
||||||
if gp := w.current.gasPool; gp != nil && gp.Gas() < params.TxGas {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
txs := make(map[common.Address][]*txpool.LazyTransaction, len(ev.Txs))
|
|
||||||
for _, tx := range ev.Txs {
|
|
||||||
acc, _ := types.Sender(w.current.signer, tx)
|
|
||||||
txs[acc] = append(txs[acc], &txpool.LazyTransaction{
|
|
||||||
Pool: w.eth.TxPool(), // We don't know where this came from, yolo resolve from everywhere
|
|
||||||
Hash: tx.Hash(),
|
|
||||||
Tx: nil, // Do *not* set this! We need to resolve it later to pull blobs in
|
|
||||||
Time: tx.Time(),
|
|
||||||
GasFeeCap: uint256.NewInt(tx.GasFeeCap().Uint64()),
|
|
||||||
GasTipCap: uint256.NewInt(tx.GasTipCap().Uint64()),
|
|
||||||
Gas: tx.Gas(),
|
|
||||||
BlobGas: tx.BlobGas(),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
txset := newTransactionsByPriceAndNonce(w.current.signer, txs, w.current.header.BaseFee)
|
|
||||||
tcount := w.current.tcount
|
|
||||||
w.commitTransactions(w.current, txset, nil, nil, new(uint256.Int), context.Background())
|
|
||||||
|
|
||||||
// Only update the snapshot if any new transactons were added
|
|
||||||
// to the pending block
|
|
||||||
if tcount != w.current.tcount {
|
|
||||||
w.updateSnapshot(w.current)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Special case, if the consensus engine is 0 period clique(dev mode),
|
|
||||||
// submit sealing work here since all empty submission will be rejected
|
|
||||||
// by clique. Of course the advance sealing(empty submission) is disabled.
|
|
||||||
if w.chainConfig.Clique != nil && w.chainConfig.Clique.Period == 0 {
|
|
||||||
w.commitWork(ctx, nil, true, time.Now().Unix())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
w.newTxs.Add(int32(len(ev.Txs)))
|
|
||||||
|
|
||||||
// System stopped
|
|
||||||
case <-w.exitCh:
|
|
||||||
return
|
|
||||||
case <-w.txsSub.Err():
|
|
||||||
return
|
|
||||||
case <-w.chainHeadSub.Err():
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// commitWorkWithDelay is commitWork() with extra params to induce artficial delays for tests such as commit-interrupt.
|
|
||||||
func (w *worker) commitWorkWithDelay(ctx context.Context, interrupt *atomic.Int32, noempty bool, timestamp int64, delay uint, opcodeDelay uint) {
|
|
||||||
// Abort committing if node is still syncing
|
|
||||||
if w.syncing.Load() {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
start := time.Now()
|
|
||||||
|
|
||||||
var (
|
|
||||||
work *environment
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
|
|
||||||
tracing.Exec(ctx, "", "worker.prepareWork", func(ctx context.Context, span trace.Span) {
|
|
||||||
// Set the coinbase if the worker is running or it's required
|
|
||||||
var coinbase common.Address
|
|
||||||
if w.IsRunning() {
|
|
||||||
coinbase = w.etherbase()
|
|
||||||
if coinbase == (common.Address{}) {
|
|
||||||
log.Error("Refusing to mine without etherbase")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
work, err = w.prepareWork(&generateParams{
|
|
||||||
timestamp: uint64(timestamp),
|
|
||||||
coinbase: coinbase,
|
|
||||||
}, false)
|
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// nolint:contextcheck
|
|
||||||
var interruptCtx = context.Background()
|
|
||||||
|
|
||||||
stopFn := func() {}
|
|
||||||
defer func() {
|
|
||||||
stopFn()
|
|
||||||
}()
|
|
||||||
|
|
||||||
if !noempty && w.interruptCommitFlag {
|
|
||||||
block := w.chain.GetBlockByHash(w.chain.CurrentBlock().Hash())
|
|
||||||
interruptCtx, stopFn = getInterruptTimer(ctx, work, block)
|
|
||||||
// nolint : staticcheck
|
|
||||||
interruptCtx = vm.PutCache(interruptCtx, w.interruptedTxCache)
|
|
||||||
// nolint : staticcheck
|
|
||||||
interruptCtx = context.WithValue(interruptCtx, vm.InterruptCtxDelayKey, delay)
|
|
||||||
// nolint : staticcheck
|
|
||||||
interruptCtx = context.WithValue(interruptCtx, vm.InterruptCtxOpcodeDelayKey, opcodeDelay)
|
|
||||||
}
|
|
||||||
|
|
||||||
ctx, span := tracing.StartSpan(ctx, "commitWork")
|
|
||||||
defer tracing.EndSpan(span)
|
|
||||||
|
|
||||||
tracing.SetAttributes(
|
|
||||||
span,
|
|
||||||
attribute.Int("number", int(work.header.Number.Uint64())),
|
|
||||||
)
|
|
||||||
|
|
||||||
// Create an empty block based on temporary copied state for
|
|
||||||
// sealing in advance without waiting block execution finished.
|
|
||||||
if !noempty && !w.noempty.Load() {
|
|
||||||
_ = w.commit(ctx, work.copy(), nil, false, start)
|
|
||||||
}
|
|
||||||
// Fill pending transactions from the txpool into the block.
|
|
||||||
err = w.fillTransactionsWithDelay(ctx, interrupt, work, interruptCtx)
|
|
||||||
|
|
||||||
switch {
|
|
||||||
case err == nil:
|
|
||||||
// The entire block is filled, decrease resubmit interval in case
|
|
||||||
// of current interval is larger than the user-specified one.
|
|
||||||
w.resubmitAdjustCh <- &intervalAdjust{inc: false}
|
|
||||||
|
|
||||||
case errors.Is(err, errBlockInterruptedByRecommit):
|
|
||||||
// Notify resubmit loop to increase resubmitting interval if the
|
|
||||||
// interruption is due to frequent commits.
|
|
||||||
gaslimit := work.header.GasLimit
|
|
||||||
|
|
||||||
ratio := float64(gaslimit-work.gasPool.Gas()) / float64(gaslimit)
|
|
||||||
if ratio < 0.1 {
|
|
||||||
ratio = 0.1
|
|
||||||
}
|
|
||||||
w.resubmitAdjustCh <- &intervalAdjust{
|
|
||||||
ratio: ratio,
|
|
||||||
inc: true,
|
|
||||||
}
|
|
||||||
|
|
||||||
case errors.Is(err, errBlockInterruptedByNewHead):
|
|
||||||
// If the block building is interrupted by newhead event, discard it
|
|
||||||
// totally. Committing the interrupted block introduces unnecessary
|
|
||||||
// delay, and possibly causes miner to mine on the previous head,
|
|
||||||
// which could result in higher uncle rate.
|
|
||||||
work.discard()
|
|
||||||
return
|
|
||||||
}
|
|
||||||
// Submit the generated block for consensus sealing.
|
|
||||||
_ = w.commit(ctx, work.copy(), w.fullTaskHook, true, start)
|
|
||||||
|
|
||||||
// Swap out the old work with the new one, terminating any leftover
|
|
||||||
// prefetcher processes in the mean time and starting a new one.
|
|
||||||
if w.current != nil {
|
|
||||||
w.current.discard()
|
|
||||||
}
|
|
||||||
|
|
||||||
w.current = work
|
|
||||||
}
|
|
||||||
|
|
||||||
// fillTransactionsWithDelay is fillTransactions() with extra params to induce artficial delays for tests such as commit-interrupt.
|
|
||||||
// nolint:gocognit
|
|
||||||
func (w *worker) fillTransactionsWithDelay(ctx context.Context, interrupt *atomic.Int32, env *environment, interruptCtx context.Context) error {
|
|
||||||
ctx, span := tracing.StartSpan(ctx, "fillTransactions")
|
|
||||||
defer tracing.EndSpan(span)
|
|
||||||
|
|
||||||
// Split the pending transactions into locals and remotes
|
|
||||||
// Fill the block with all available pending transactions.
|
|
||||||
pending := w.eth.TxPool().Pending(txpool.PendingFilter{})
|
|
||||||
localTxs, remoteTxs := make(map[common.Address][]*txpool.LazyTransaction), pending
|
|
||||||
|
|
||||||
var (
|
|
||||||
localTxsCount int
|
|
||||||
remoteTxsCount int
|
|
||||||
)
|
|
||||||
|
|
||||||
// TODO: move to config or RPC
|
|
||||||
const profiling = false
|
|
||||||
|
|
||||||
if profiling {
|
|
||||||
doneCh := make(chan struct{})
|
|
||||||
|
|
||||||
defer func() {
|
|
||||||
close(doneCh)
|
|
||||||
}()
|
|
||||||
|
|
||||||
go func(number uint64) {
|
|
||||||
closeFn := func() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case <-time.After(150 * time.Millisecond):
|
|
||||||
// Check if we've not crossed limit
|
|
||||||
if attempt := atomic.AddInt32(w.profileCount, 1); attempt >= 10 {
|
|
||||||
log.Info("Completed profiling", "attempt", attempt)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Info("Starting profiling in fill transactions", "number", number)
|
|
||||||
|
|
||||||
dir, err := os.MkdirTemp("", fmt.Sprintf("bor-traces-%s-", time.Now().UTC().Format("2006-01-02-150405Z")))
|
|
||||||
if err != nil {
|
|
||||||
log.Error("Error in profiling", "path", dir, "number", number, "err", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// grab the cpu profile
|
|
||||||
closeFnInternal, err := startProfiler("cpu", dir, number)
|
|
||||||
if err != nil {
|
|
||||||
log.Error("Error in profiling", "path", dir, "number", number, "err", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
closeFn = func() error {
|
|
||||||
err := closeFnInternal()
|
|
||||||
|
|
||||||
log.Info("Completed profiling", "path", dir, "number", number, "error", err)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-doneCh:
|
|
||||||
err := closeFn()
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
log.Info("closing fillTransactions", "number", number, "error", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}(env.header.Number.Uint64())
|
|
||||||
}
|
|
||||||
|
|
||||||
tracing.Exec(ctx, "", "worker.SplittingTransactions", func(ctx context.Context, span trace.Span) {
|
|
||||||
prePendingTime := time.Now()
|
|
||||||
|
|
||||||
pending := w.eth.TxPool().Pending(txpool.PendingFilter{})
|
|
||||||
remoteTxs = pending
|
|
||||||
|
|
||||||
postPendingTime := time.Now()
|
|
||||||
|
|
||||||
for _, account := range w.eth.TxPool().Locals() {
|
|
||||||
if txs := remoteTxs[account]; len(txs) > 0 {
|
|
||||||
delete(remoteTxs, account)
|
|
||||||
|
|
||||||
localTxs[account] = txs
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
postLocalsTime := time.Now()
|
|
||||||
|
|
||||||
tracing.SetAttributes(
|
|
||||||
span,
|
|
||||||
attribute.Int("len of local txs", localTxsCount),
|
|
||||||
attribute.Int("len of remote txs", remoteTxsCount),
|
|
||||||
attribute.String("time taken by Pending()", fmt.Sprintf("%v", postPendingTime.Sub(prePendingTime))),
|
|
||||||
attribute.String("time taken by Locals()", fmt.Sprintf("%v", postLocalsTime.Sub(postPendingTime))),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
var (
|
|
||||||
localEnvTCount int
|
|
||||||
remoteEnvTCount int
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
|
|
||||||
if len(localTxs) > 0 {
|
|
||||||
var txs *transactionsByPriceAndNonce
|
|
||||||
|
|
||||||
tracing.Exec(ctx, "", "worker.LocalTransactionsByPriceAndNonce", func(ctx context.Context, span trace.Span) {
|
|
||||||
var baseFee *uint256.Int
|
|
||||||
if env.header.BaseFee != nil {
|
|
||||||
baseFee = cmath.FromBig(env.header.BaseFee)
|
|
||||||
}
|
|
||||||
|
|
||||||
txs = newTransactionsByPriceAndNonce(env.signer, localTxs, baseFee.ToBig())
|
|
||||||
|
|
||||||
tracing.SetAttributes(
|
|
||||||
span,
|
|
||||||
attribute.Int("len of tx local Heads", txs.GetTxs()),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
tracing.Exec(ctx, "", "worker.LocalCommitTransactions", func(ctx context.Context, span trace.Span) {
|
|
||||||
err = w.commitTransactionsWithDelay(env, txs, interrupt, interruptCtx)
|
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
localEnvTCount = env.tcount
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(remoteTxs) > 0 {
|
|
||||||
var txs *transactionsByPriceAndNonce
|
|
||||||
|
|
||||||
tracing.Exec(ctx, "", "worker.RemoteTransactionsByPriceAndNonce", func(ctx context.Context, span trace.Span) {
|
|
||||||
var baseFee *uint256.Int
|
|
||||||
if env.header.BaseFee != nil {
|
|
||||||
baseFee = cmath.FromBig(env.header.BaseFee)
|
|
||||||
}
|
|
||||||
|
|
||||||
txs = newTransactionsByPriceAndNonce(env.signer, remoteTxs, baseFee.ToBig())
|
|
||||||
|
|
||||||
tracing.SetAttributes(
|
|
||||||
span,
|
|
||||||
attribute.Int("len of tx remote Heads", txs.GetTxs()),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
tracing.Exec(ctx, "", "worker.RemoteCommitTransactions", func(ctx context.Context, span trace.Span) {
|
|
||||||
err = w.commitTransactionsWithDelay(env, txs, interrupt, interruptCtx)
|
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
remoteEnvTCount = env.tcount
|
|
||||||
}
|
|
||||||
|
|
||||||
tracing.SetAttributes(
|
|
||||||
span,
|
|
||||||
attribute.Int("len of final local txs ", localEnvTCount),
|
|
||||||
attribute.Int("len of final remote txs", remoteEnvTCount),
|
|
||||||
)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// commitTransactionsWithDelay is commitTransactions() with extra params to induce artficial delays for tests such as commit-interrupt.
|
|
||||||
// nolint:gocognit, unparam
|
|
||||||
func (w *worker) commitTransactionsWithDelay(env *environment, txs *transactionsByPriceAndNonce, interrupt *atomic.Int32, interruptCtx context.Context) error {
|
|
||||||
gasLimit := env.header.GasLimit
|
|
||||||
if env.gasPool == nil {
|
|
||||||
env.gasPool = new(core.GasPool).AddGas(gasLimit)
|
|
||||||
}
|
|
||||||
|
|
||||||
var coalescedLogs []*types.Log
|
|
||||||
|
|
||||||
var depsMVReadList [][]blockstm.ReadDescriptor
|
|
||||||
|
|
||||||
var depsMVFullWriteList [][]blockstm.WriteDescriptor
|
|
||||||
|
|
||||||
var mvReadMapList []map[blockstm.Key]blockstm.ReadDescriptor
|
|
||||||
|
|
||||||
var deps map[int]map[int]bool
|
|
||||||
|
|
||||||
chDeps := make(chan blockstm.TxDep)
|
|
||||||
|
|
||||||
var count int
|
|
||||||
|
|
||||||
var depsWg sync.WaitGroup
|
|
||||||
|
|
||||||
EnableMVHashMap := w.chainConfig.IsCancun(env.header.Number)
|
|
||||||
|
|
||||||
// create and add empty mvHashMap in statedb
|
|
||||||
if EnableMVHashMap {
|
|
||||||
depsMVReadList = [][]blockstm.ReadDescriptor{}
|
|
||||||
|
|
||||||
depsMVFullWriteList = [][]blockstm.WriteDescriptor{}
|
|
||||||
|
|
||||||
mvReadMapList = []map[blockstm.Key]blockstm.ReadDescriptor{}
|
|
||||||
|
|
||||||
deps = map[int]map[int]bool{}
|
|
||||||
|
|
||||||
chDeps = make(chan blockstm.TxDep)
|
|
||||||
|
|
||||||
count = 0
|
|
||||||
|
|
||||||
depsWg.Add(1)
|
|
||||||
|
|
||||||
go func(chDeps chan blockstm.TxDep) {
|
|
||||||
for t := range chDeps {
|
|
||||||
deps = blockstm.UpdateDeps(deps, t)
|
|
||||||
}
|
|
||||||
|
|
||||||
depsWg.Done()
|
|
||||||
}(chDeps)
|
|
||||||
}
|
|
||||||
|
|
||||||
var lastTxHash common.Hash
|
|
||||||
|
|
||||||
mainloop:
|
|
||||||
for {
|
|
||||||
if interruptCtx != nil {
|
|
||||||
if EnableMVHashMap {
|
|
||||||
env.state.AddEmptyMVHashMap()
|
|
||||||
}
|
|
||||||
|
|
||||||
// case of interrupting by timeout
|
|
||||||
select {
|
|
||||||
case <-interruptCtx.Done():
|
|
||||||
txCommitInterruptCounter.Inc(1)
|
|
||||||
log.Warn("Tx Level Interrupt", "hash", lastTxHash)
|
|
||||||
break mainloop
|
|
||||||
default:
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check interruption signal and abort building if it's fired.
|
|
||||||
if interrupt != nil {
|
|
||||||
if signal := interrupt.Load(); signal != commitInterruptNone {
|
|
||||||
return signalToErr(signal)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// If we don't have enough gas for any further transactions then we're done.
|
|
||||||
if env.gasPool.Gas() < params.TxGas {
|
|
||||||
log.Trace("Not enough gas for further transactions", "have", env.gasPool, "want", params.TxGas)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
// Retrieve the next transaction and abort if all done.
|
|
||||||
ltx, _ := txs.Peek()
|
|
||||||
if ltx == nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
lastTxHash = ltx.Hash
|
|
||||||
// If we don't have enough space for the next transaction, skip the account.
|
|
||||||
if env.gasPool.Gas() < ltx.Gas {
|
|
||||||
log.Trace("Not enough gas left for transaction", "hash", ltx.Hash, "left", env.gasPool.Gas(), "needed", ltx.Gas)
|
|
||||||
txs.Pop()
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if left := uint64(params.MaxBlobGasPerBlock - env.blobs*params.BlobTxBlobGasPerBlob); left < ltx.BlobGas {
|
|
||||||
log.Trace("Not enough blob gas left for transaction", "hash", ltx.Hash, "left", left, "needed", ltx.BlobGas)
|
|
||||||
txs.Pop()
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
// Transaction seems to fit, pull it up from the pool
|
|
||||||
tx := ltx.Resolve()
|
|
||||||
if tx == nil {
|
|
||||||
log.Trace("Ignoring evicted transaction", "hash", ltx.Hash)
|
|
||||||
txs.Pop()
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
// Error may be ignored here. The error has already been checked
|
|
||||||
// during transaction acceptance is the transaction pool.
|
|
||||||
from, _ := types.Sender(env.signer, tx)
|
|
||||||
|
|
||||||
// not prioritising conditional transaction, yet.
|
|
||||||
//nolint:nestif
|
|
||||||
if options := tx.GetOptions(); options != nil {
|
|
||||||
if err := env.header.ValidateBlockNumberOptionsPIP15(options.BlockNumberMin, options.BlockNumberMax); err != nil {
|
|
||||||
log.Trace("Dropping conditional transaction", "from", from, "hash", tx.Hash(), "reason", err)
|
|
||||||
txs.Pop()
|
|
||||||
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := env.header.ValidateTimestampOptionsPIP15(options.TimestampMin, options.TimestampMax); err != nil {
|
|
||||||
log.Trace("Dropping conditional transaction", "from", from, "hash", tx.Hash(), "reason", err)
|
|
||||||
txs.Pop()
|
|
||||||
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := env.state.ValidateKnownAccounts(options.KnownAccounts); err != nil {
|
|
||||||
log.Trace("Dropping conditional transaction", "from", from, "hash", tx.Hash(), "reason", err)
|
|
||||||
txs.Pop()
|
|
||||||
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check whether the tx is replay protected. If we're not in the EIP155 hf
|
|
||||||
// phase, start ignoring the sender until we do.
|
|
||||||
if tx.Protected() && !w.chainConfig.IsEIP155(env.header.Number) {
|
|
||||||
log.Trace("Ignoring replay protected transaction", "hash", ltx.Hash, "eip155", w.chainConfig.EIP155Block)
|
|
||||||
txs.Pop()
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
// Start executing the transaction
|
|
||||||
env.state.SetTxContext(tx.Hash(), env.tcount)
|
|
||||||
|
|
||||||
logs, err := w.commitTransaction(env, tx, interruptCtx)
|
|
||||||
|
|
||||||
if interruptCtx != nil {
|
|
||||||
if delay := interruptCtx.Value(vm.InterruptCtxDelayKey); delay != nil {
|
|
||||||
// nolint : durationcheck
|
|
||||||
time.Sleep(time.Duration(delay.(uint)) * time.Millisecond)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
switch {
|
|
||||||
case errors.Is(err, core.ErrNonceTooLow):
|
|
||||||
// New head notification data race between the transaction pool and miner, shift
|
|
||||||
log.Trace("Skipping transaction with low nonce", "hash", ltx.Hash, "sender", from, "nonce", tx.Nonce())
|
|
||||||
txs.Shift()
|
|
||||||
|
|
||||||
case errors.Is(err, nil):
|
|
||||||
// Everything ok, collect the logs and shift in the next transaction from the same account
|
|
||||||
coalescedLogs = append(coalescedLogs, logs...)
|
|
||||||
env.tcount++
|
|
||||||
|
|
||||||
if EnableMVHashMap {
|
|
||||||
depsMVReadList = append(depsMVReadList, env.state.MVReadList())
|
|
||||||
depsMVFullWriteList = append(depsMVFullWriteList, env.state.MVFullWriteList())
|
|
||||||
mvReadMapList = append(mvReadMapList, env.state.MVReadMap())
|
|
||||||
|
|
||||||
temp := blockstm.TxDep{
|
|
||||||
Index: env.tcount - 1,
|
|
||||||
ReadList: depsMVReadList[count],
|
|
||||||
FullWriteList: depsMVFullWriteList,
|
|
||||||
}
|
|
||||||
|
|
||||||
chDeps <- temp
|
|
||||||
count++
|
|
||||||
}
|
|
||||||
|
|
||||||
txs.Shift()
|
|
||||||
default:
|
|
||||||
// Transaction is regarded as invalid, drop all consecutive transactions from
|
|
||||||
// the same sender because of `nonce-too-high` clause.
|
|
||||||
log.Debug("Transaction failed, account skipped", "hash", ltx.Hash, "err", err)
|
|
||||||
txs.Pop()
|
|
||||||
}
|
|
||||||
|
|
||||||
if EnableMVHashMap {
|
|
||||||
env.state.ClearReadMap()
|
|
||||||
env.state.ClearWriteMap()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// nolint:nestif
|
|
||||||
if EnableMVHashMap && w.IsRunning() {
|
|
||||||
close(chDeps)
|
|
||||||
depsWg.Wait()
|
|
||||||
|
|
||||||
var blockExtraData types.BlockExtraData
|
|
||||||
|
|
||||||
tempVanity := env.header.Extra[:types.ExtraVanityLength]
|
|
||||||
tempSeal := env.header.Extra[len(env.header.Extra)-types.ExtraSealLength:]
|
|
||||||
|
|
||||||
if len(mvReadMapList) > 0 {
|
|
||||||
tempDeps := make([][]uint64, len(mvReadMapList))
|
|
||||||
|
|
||||||
for j := range deps[0] {
|
|
||||||
tempDeps[0] = append(tempDeps[0], uint64(j))
|
|
||||||
}
|
|
||||||
|
|
||||||
delayFlag := true
|
|
||||||
|
|
||||||
for i := 1; i <= len(mvReadMapList)-1; i++ {
|
|
||||||
reads := mvReadMapList[i-1]
|
|
||||||
|
|
||||||
_, ok1 := reads[blockstm.NewSubpathKey(env.coinbase, state.BalancePath)]
|
|
||||||
_, ok2 := reads[blockstm.NewSubpathKey(common.HexToAddress(w.chainConfig.Bor.CalculateBurntContract(env.header.Number.Uint64())), state.BalancePath)]
|
|
||||||
|
|
||||||
if ok1 || ok2 {
|
|
||||||
delayFlag = false
|
|
||||||
}
|
|
||||||
|
|
||||||
for j := range deps[i] {
|
|
||||||
tempDeps[i] = append(tempDeps[i], uint64(j))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := rlp.DecodeBytes(env.header.Extra[types.ExtraVanityLength:len(env.header.Extra)-types.ExtraSealLength], &blockExtraData); err != nil {
|
|
||||||
log.Error("error while decoding block extra data", "err", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
if delayFlag {
|
|
||||||
blockExtraData.TxDependency = tempDeps
|
|
||||||
} else {
|
|
||||||
blockExtraData.TxDependency = nil
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
blockExtraData.TxDependency = nil
|
|
||||||
}
|
|
||||||
|
|
||||||
blockExtraDataBytes, err := rlp.EncodeToBytes(blockExtraData)
|
|
||||||
if err != nil {
|
|
||||||
log.Error("error while encoding block extra data: %v", err)
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
env.header.Extra = []byte{}
|
|
||||||
|
|
||||||
env.header.Extra = append(tempVanity, blockExtraDataBytes...)
|
|
||||||
|
|
||||||
env.header.Extra = append(env.header.Extra, tempSeal...)
|
|
||||||
}
|
|
||||||
|
|
||||||
if !w.IsRunning() && len(coalescedLogs) > 0 {
|
|
||||||
// We don't push the pendingLogsEvent while we are sealing. The reason is that
|
|
||||||
// when we are sealing, the worker will regenerate a sealing block every 3 seconds.
|
|
||||||
// In order to avoid pushing the repeated pendingLog, we disable the pending log pushing.
|
|
||||||
// make a copy, the state caches the logs and these logs get "upgraded" from pending to mined
|
|
||||||
// logs by filling in the block hash when the block was mined by the local miner. This can
|
|
||||||
// cause a race condition if a log was "upgraded" before the PendingLogsEvent is processed.
|
|
||||||
cpy := make([]*types.Log, len(coalescedLogs))
|
|
||||||
for i, l := range coalescedLogs {
|
|
||||||
cpy[i] = new(types.Log)
|
|
||||||
*cpy[i] = *l
|
|
||||||
}
|
|
||||||
|
|
||||||
w.pendingLogsFeed.Send(cpy)
|
|
||||||
}
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
356
miner/worker.go
356
miner/worker.go
|
|
@ -17,15 +17,10 @@
|
||||||
package miner
|
package miner
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"math/big"
|
"math/big"
|
||||||
"os"
|
|
||||||
"runtime"
|
|
||||||
"runtime/pprof"
|
|
||||||
ptrace "runtime/trace"
|
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
@ -33,8 +28,6 @@ import (
|
||||||
lru "github.com/hashicorp/golang-lru"
|
lru "github.com/hashicorp/golang-lru"
|
||||||
"github.com/holiman/uint256"
|
"github.com/holiman/uint256"
|
||||||
"go.opentelemetry.io/otel"
|
"go.opentelemetry.io/otel"
|
||||||
"go.opentelemetry.io/otel/attribute"
|
|
||||||
"go.opentelemetry.io/otel/trace"
|
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/common/tracing"
|
"github.com/ethereum/go-ethereum/common/tracing"
|
||||||
|
|
@ -157,8 +150,6 @@ func (env *environment) discard() {
|
||||||
|
|
||||||
// task contains all information for consensus engine sealing and result submitting.
|
// task contains all information for consensus engine sealing and result submitting.
|
||||||
type task struct {
|
type task struct {
|
||||||
//nolint:containedctx
|
|
||||||
ctx context.Context
|
|
||||||
receipts []*types.Receipt
|
receipts []*types.Receipt
|
||||||
state *state.StateDB
|
state *state.StateDB
|
||||||
block *types.Block
|
block *types.Block
|
||||||
|
|
@ -174,8 +165,6 @@ const (
|
||||||
|
|
||||||
// newWorkReq represents a request for new sealing work submitting with relative interrupt notifier.
|
// newWorkReq represents a request for new sealing work submitting with relative interrupt notifier.
|
||||||
type newWorkReq struct {
|
type newWorkReq struct {
|
||||||
//nolint:containedctx
|
|
||||||
ctx context.Context
|
|
||||||
interrupt *atomic.Int32
|
interrupt *atomic.Int32
|
||||||
noempty bool
|
noempty bool
|
||||||
timestamp int64
|
timestamp int64
|
||||||
|
|
@ -276,8 +265,9 @@ type worker struct {
|
||||||
fullTaskHook func() // Method to call before pushing the full sealing task.
|
fullTaskHook func() // Method to call before pushing the full sealing task.
|
||||||
resubmitHook func(time.Duration, time.Duration) // Method to call upon updating resubmitting interval.
|
resubmitHook func(time.Duration, time.Duration) // Method to call upon updating resubmitting interval.
|
||||||
|
|
||||||
profileCount *int32 // Global count for profiling
|
// Interrupt commit to stop block building on time
|
||||||
interruptCommitFlag bool // Interrupt commit ( Default true )
|
interruptCommitFlag bool // Denotes whether interrupt commit is enabled or not
|
||||||
|
interruptCtx context.Context
|
||||||
interruptedTxCache *vm.TxCache
|
interruptedTxCache *vm.TxCache
|
||||||
|
|
||||||
// noempty is the flag used to control whether the feature of pre-seal empty
|
// noempty is the flag used to control whether the feature of pre-seal empty
|
||||||
|
|
@ -315,7 +305,6 @@ func newWorker(config *Config, chainConfig *params.ChainConfig, engine consensus
|
||||||
interruptCommitFlag: config.CommitInterruptFlag,
|
interruptCommitFlag: config.CommitInterruptFlag,
|
||||||
}
|
}
|
||||||
worker.noempty.Store(true)
|
worker.noempty.Store(true)
|
||||||
worker.profileCount = new(int32)
|
|
||||||
// Subscribe for transaction insertion events (whether from network or resurrects)
|
// Subscribe for transaction insertion events (whether from network or resurrects)
|
||||||
worker.txsSub = eth.TxPool().SubscribeTransactions(worker.txsCh, true)
|
worker.txsSub = eth.TxPool().SubscribeTransactions(worker.txsCh, true)
|
||||||
// Subscribe events for blockchain
|
// Subscribe events for blockchain
|
||||||
|
|
@ -326,6 +315,7 @@ func newWorker(config *Config, chainConfig *params.ChainConfig, engine consensus
|
||||||
log.Warn("Failed to create interrupted tx cache", "err", err)
|
log.Warn("Failed to create interrupted tx cache", "err", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
worker.interruptCtx = context.Background()
|
||||||
worker.interruptedTxCache = &vm.TxCache{
|
worker.interruptedTxCache = &vm.TxCache{
|
||||||
Cache: interruptedTxCache,
|
Cache: interruptedTxCache,
|
||||||
}
|
}
|
||||||
|
|
@ -356,12 +346,10 @@ func newWorker(config *Config, chainConfig *params.ChainConfig, engine consensus
|
||||||
|
|
||||||
worker.newpayloadTimeout = newpayloadTimeout
|
worker.newpayloadTimeout = newpayloadTimeout
|
||||||
|
|
||||||
ctx := tracing.WithTracer(context.Background(), otel.GetTracerProvider().Tracer("MinerWorker"))
|
|
||||||
|
|
||||||
worker.wg.Add(4)
|
worker.wg.Add(4)
|
||||||
|
|
||||||
go worker.mainLoop(ctx)
|
go worker.mainLoop()
|
||||||
go worker.newWorkLoop(ctx, recommit)
|
go worker.newWorkLoop(recommit)
|
||||||
go worker.resultLoop()
|
go worker.resultLoop()
|
||||||
go worker.taskLoop()
|
go worker.taskLoop()
|
||||||
|
|
||||||
|
|
@ -487,7 +475,7 @@ func recalcRecommit(minRecommit, prev time.Duration, target float64, inc bool) t
|
||||||
// newWorkLoop is a standalone goroutine to submit new sealing work upon received events.
|
// newWorkLoop is a standalone goroutine to submit new sealing work upon received events.
|
||||||
//
|
//
|
||||||
//nolint:gocognit
|
//nolint:gocognit
|
||||||
func (w *worker) newWorkLoop(ctx context.Context, recommit time.Duration) {
|
func (w *worker) newWorkLoop(recommit time.Duration) {
|
||||||
defer w.wg.Done()
|
defer w.wg.Done()
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -502,15 +490,13 @@ func (w *worker) newWorkLoop(ctx context.Context, recommit time.Duration) {
|
||||||
|
|
||||||
// commit aborts in-flight transaction execution with given signal and resubmits a new one.
|
// commit aborts in-flight transaction execution with given signal and resubmits a new one.
|
||||||
commit := func(noempty bool, s int32) {
|
commit := func(noempty bool, s int32) {
|
||||||
ctx, span := tracing.Trace(ctx, "worker.newWorkLoop.commit")
|
|
||||||
tracing.EndSpan(span)
|
|
||||||
if interrupt != nil {
|
if interrupt != nil {
|
||||||
interrupt.Store(s)
|
interrupt.Store(s)
|
||||||
}
|
}
|
||||||
|
|
||||||
interrupt = new(atomic.Int32)
|
interrupt = new(atomic.Int32)
|
||||||
select {
|
select {
|
||||||
case w.newWorkCh <- &newWorkReq{interrupt: interrupt, timestamp: timestamp, ctx: ctx, noempty: noempty}:
|
case w.newWorkCh <- &newWorkReq{interrupt: interrupt, timestamp: timestamp, noempty: noempty}:
|
||||||
case <-w.exitCh:
|
case <-w.exitCh:
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
@ -519,9 +505,6 @@ func (w *worker) newWorkLoop(ctx context.Context, recommit time.Duration) {
|
||||||
}
|
}
|
||||||
// clearPending cleans the stale pending tasks.
|
// clearPending cleans the stale pending tasks.
|
||||||
clearPending := func(number uint64) {
|
clearPending := func(number uint64) {
|
||||||
_, span := tracing.Trace(ctx, "worker.newWorkLoop.clearPending")
|
|
||||||
tracing.EndSpan(span)
|
|
||||||
|
|
||||||
w.pendingMu.Lock()
|
w.pendingMu.Lock()
|
||||||
for h, t := range w.pendingTasks {
|
for h, t := range w.pendingTasks {
|
||||||
if t.block.NumberU64()+staleThreshold <= number {
|
if t.block.NumberU64()+staleThreshold <= number {
|
||||||
|
|
@ -598,7 +581,7 @@ func (w *worker) newWorkLoop(ctx context.Context, recommit time.Duration) {
|
||||||
// the received event. It can support two modes: automatically generate task and
|
// the received event. It can support two modes: automatically generate task and
|
||||||
// submit it or return task according to given parameters for various proposes.
|
// submit it or return task according to given parameters for various proposes.
|
||||||
// nolint: gocognit, contextcheck
|
// nolint: gocognit, contextcheck
|
||||||
func (w *worker) mainLoop(ctx context.Context) {
|
func (w *worker) mainLoop() {
|
||||||
defer w.wg.Done()
|
defer w.wg.Done()
|
||||||
defer w.txsSub.Unsubscribe()
|
defer w.txsSub.Unsubscribe()
|
||||||
defer w.chainHeadSub.Unsubscribe()
|
defer w.chainHeadSub.Unsubscribe()
|
||||||
|
|
@ -614,11 +597,11 @@ func (w *worker) mainLoop(ctx context.Context) {
|
||||||
if w.chainConfig.ChainID.Cmp(params.BorMainnetChainConfig.ChainID) == 0 || w.chainConfig.ChainID.Cmp(params.MumbaiChainConfig.ChainID) == 0 || w.chainConfig.ChainID.Cmp(params.AmoyChainConfig.ChainID) == 0 {
|
if w.chainConfig.ChainID.Cmp(params.BorMainnetChainConfig.ChainID) == 0 || w.chainConfig.ChainID.Cmp(params.MumbaiChainConfig.ChainID) == 0 || w.chainConfig.ChainID.Cmp(params.AmoyChainConfig.ChainID) == 0 {
|
||||||
if w.eth.PeerCount() > 0 {
|
if w.eth.PeerCount() > 0 {
|
||||||
//nolint:contextcheck
|
//nolint:contextcheck
|
||||||
w.commitWork(req.ctx, req.interrupt, req.noempty, req.timestamp)
|
w.commitWork(req.interrupt, req.noempty, req.timestamp)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
//nolint:contextcheck
|
//nolint:contextcheck
|
||||||
w.commitWork(req.ctx, req.interrupt, req.noempty, req.timestamp)
|
w.commitWork(req.interrupt, req.noempty, req.timestamp)
|
||||||
}
|
}
|
||||||
|
|
||||||
case req := <-w.getWorkCh:
|
case req := <-w.getWorkCh:
|
||||||
|
|
@ -655,7 +638,7 @@ func (w *worker) mainLoop(ctx context.Context) {
|
||||||
|
|
||||||
tcount := w.current.tcount
|
tcount := w.current.tcount
|
||||||
|
|
||||||
w.commitTransactions(w.current, plainTxs, blobTxs, nil, new(uint256.Int), context.Background())
|
w.commitTransactions(w.current, plainTxs, blobTxs, nil, new(uint256.Int))
|
||||||
|
|
||||||
// Only update the snapshot if any new transactons were added
|
// Only update the snapshot if any new transactons were added
|
||||||
// to the pending block
|
// to the pending block
|
||||||
|
|
@ -667,7 +650,7 @@ func (w *worker) mainLoop(ctx context.Context) {
|
||||||
// submit sealing work here since all empty submission will be rejected
|
// submit sealing work here since all empty submission will be rejected
|
||||||
// by clique. Of course the advance sealing(empty submission) is disabled.
|
// by clique. Of course the advance sealing(empty submission) is disabled.
|
||||||
if w.chainConfig.Clique != nil && w.chainConfig.Clique.Period == 0 {
|
if w.chainConfig.Clique != nil && w.chainConfig.Clique.Period == 0 {
|
||||||
w.commitWork(ctx, nil, true, time.Now().Unix())
|
w.commitWork(nil, true, time.Now().Unix())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -726,7 +709,7 @@ func (w *worker) taskLoop() {
|
||||||
w.pendingTasks[sealHash] = task
|
w.pendingTasks[sealHash] = task
|
||||||
w.pendingMu.Unlock()
|
w.pendingMu.Unlock()
|
||||||
|
|
||||||
if err := w.engine.Seal(task.ctx, w.chain, task.block, w.resultCh, stopCh); err != nil {
|
if err := w.engine.Seal(w.chain, task.block, w.resultCh, stopCh); err != nil {
|
||||||
log.Warn("Block sealing failed", "err", err)
|
log.Warn("Block sealing failed", "err", err)
|
||||||
w.pendingMu.Lock()
|
w.pendingMu.Lock()
|
||||||
delete(w.pendingTasks, sealHash)
|
delete(w.pendingTasks, sealHash)
|
||||||
|
|
@ -787,7 +770,6 @@ func (w *worker) resultLoop() {
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
tracing.Exec(task.ctx, "", "resultLoop", func(ctx context.Context, span trace.Span) {
|
|
||||||
for i, taskReceipt := range task.receipts {
|
for i, taskReceipt := range task.receipts {
|
||||||
receipt := new(types.Receipt)
|
receipt := new(types.Receipt)
|
||||||
receipts[i] = receipt
|
receipts[i] = receipt
|
||||||
|
|
@ -812,20 +794,7 @@ func (w *worker) resultLoop() {
|
||||||
logs = append(logs, receipt.Logs...)
|
logs = append(logs, receipt.Logs...)
|
||||||
}
|
}
|
||||||
// Commit block and state to database.
|
// Commit block and state to database.
|
||||||
tracing.Exec(ctx, "", "resultLoop.WriteBlockAndSetHead", func(ctx context.Context, span trace.Span) {
|
|
||||||
_, err = w.chain.WriteBlockAndSetHead(block, receipts, logs, task.state, true)
|
_, err = w.chain.WriteBlockAndSetHead(block, receipts, logs, task.state, true)
|
||||||
})
|
|
||||||
|
|
||||||
tracing.SetAttributes(
|
|
||||||
span,
|
|
||||||
attribute.String("hash", hash.String()),
|
|
||||||
attribute.Int("number", int(block.Number().Uint64())),
|
|
||||||
attribute.Int("txns", block.Transactions().Len()),
|
|
||||||
attribute.Int("gas used", int(block.GasUsed())),
|
|
||||||
attribute.Int("elapsed", int(time.Since(task.createdAt).Milliseconds())),
|
|
||||||
attribute.Bool("error", err != nil),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Failed writing block to chain", "err", err)
|
log.Error("Failed writing block to chain", "err", err)
|
||||||
|
|
@ -902,16 +871,14 @@ func (w *worker) updateSnapshot(env *environment) {
|
||||||
w.snapshotState = env.state.Copy()
|
w.snapshotState = env.state.Copy()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *worker) commitTransaction(env *environment, tx *types.Transaction, interruptCtx context.Context) ([]*types.Log, error) {
|
func (w *worker) commitTransaction(env *environment, tx *types.Transaction) ([]*types.Log, error) {
|
||||||
var (
|
var (
|
||||||
snap = env.state.Snapshot()
|
snap = env.state.Snapshot()
|
||||||
gp = env.gasPool.Gas()
|
gp = env.gasPool.Gas()
|
||||||
)
|
)
|
||||||
|
|
||||||
// nolint : staticcheck
|
w.interruptCtx = vm.SetCurrentTxOnContext(w.interruptCtx, tx.Hash())
|
||||||
interruptCtx = vm.SetCurrentTxOnContext(interruptCtx, tx.Hash())
|
receipt, err := core.ApplyTransaction(w.chainConfig, w.chain, &env.coinbase, env.gasPool, env.state, env.header, tx, &env.header.GasUsed, *w.chain.GetVMConfig(), w.interruptCtx)
|
||||||
|
|
||||||
receipt, err := core.ApplyTransaction(w.chainConfig, w.chain, &env.coinbase, env.gasPool, env.state, env.header, tx, &env.header.GasUsed, *w.chain.GetVMConfig(), interruptCtx)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
env.state.RevertToSnapshot(snap)
|
env.state.RevertToSnapshot(snap)
|
||||||
env.gasPool.SetGas(gp)
|
env.gasPool.SetGas(gp)
|
||||||
|
|
@ -924,7 +891,7 @@ func (w *worker) commitTransaction(env *environment, tx *types.Transaction, inte
|
||||||
return receipt.Logs, nil
|
return receipt.Logs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *worker) commitTransactions(env *environment, plainTxs, blobTxs *transactionsByPriceAndNonce, interrupt *atomic.Int32, minTip *uint256.Int, interruptCtx context.Context) error {
|
func (w *worker) commitTransactions(env *environment, plainTxs, blobTxs *transactionsByPriceAndNonce, interrupt *atomic.Int32, minTip *uint256.Int) error {
|
||||||
gasLimit := env.header.GasLimit
|
gasLimit := env.header.GasLimit
|
||||||
if env.gasPool == nil {
|
if env.gasPool == nil {
|
||||||
env.gasPool = new(core.GasPool).AddGas(gasLimit)
|
env.gasPool = new(core.GasPool).AddGas(gasLimit)
|
||||||
|
|
@ -974,14 +941,14 @@ mainloop:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if interruptCtx != nil {
|
if w.interruptCtx != nil {
|
||||||
if EnableMVHashMap && w.IsRunning() {
|
if EnableMVHashMap && w.IsRunning() {
|
||||||
env.state.AddEmptyMVHashMap()
|
env.state.AddEmptyMVHashMap()
|
||||||
}
|
}
|
||||||
|
|
||||||
// case of interrupting by timeout
|
// case of interrupting by timeout
|
||||||
select {
|
select {
|
||||||
case <-interruptCtx.Done():
|
case <-w.interruptCtx.Done():
|
||||||
txCommitInterruptCounter.Inc(1)
|
txCommitInterruptCounter.Inc(1)
|
||||||
log.Warn("Tx Level Interrupt", "hash", lastTxHash)
|
log.Warn("Tx Level Interrupt", "hash", lastTxHash)
|
||||||
break mainloop
|
break mainloop
|
||||||
|
|
@ -1088,7 +1055,15 @@ mainloop:
|
||||||
// Start executing the transaction
|
// Start executing the transaction
|
||||||
env.state.SetTxContext(tx.Hash(), env.tcount)
|
env.state.SetTxContext(tx.Hash(), env.tcount)
|
||||||
|
|
||||||
logs, err := w.commitTransaction(env, tx, interruptCtx)
|
logs, err := w.commitTransaction(env, tx)
|
||||||
|
|
||||||
|
// Check if we have a `delay` set in interrup context. It's only set during tests.
|
||||||
|
if w.interruptCtx != nil {
|
||||||
|
if delay := w.interruptCtx.Value(vm.InterruptCtxDelayKey); delay != nil {
|
||||||
|
// nolint : durationcheck
|
||||||
|
time.Sleep(time.Duration(delay.(uint)) * time.Millisecond)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case errors.Is(err, core.ErrNonceTooLow):
|
case errors.Is(err, core.ErrNonceTooLow):
|
||||||
|
|
@ -1317,80 +1292,13 @@ func (w *worker) prepareWork(genParams *generateParams, witness bool) (*environm
|
||||||
return env, nil
|
return env, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func startProfiler(profile string, filepath string, number uint64) (func() error, error) {
|
|
||||||
var (
|
|
||||||
buf bytes.Buffer
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
|
|
||||||
closeFn := func() {}
|
|
||||||
|
|
||||||
switch profile {
|
|
||||||
case "cpu":
|
|
||||||
err = pprof.StartCPUProfile(&buf)
|
|
||||||
|
|
||||||
if err == nil {
|
|
||||||
closeFn = func() {
|
|
||||||
pprof.StopCPUProfile()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case "trace":
|
|
||||||
err = ptrace.Start(&buf)
|
|
||||||
|
|
||||||
if err == nil {
|
|
||||||
closeFn = func() {
|
|
||||||
ptrace.Stop()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case "heap":
|
|
||||||
runtime.GC()
|
|
||||||
|
|
||||||
err = pprof.WriteHeapProfile(&buf)
|
|
||||||
default:
|
|
||||||
log.Info("Incorrect profile name")
|
|
||||||
}
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return func() error {
|
|
||||||
closeFn()
|
|
||||||
return nil
|
|
||||||
}, err
|
|
||||||
}
|
|
||||||
|
|
||||||
closeFnNew := func() error {
|
|
||||||
var err error
|
|
||||||
|
|
||||||
closeFn()
|
|
||||||
|
|
||||||
if buf.Len() == 0 {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
f, err := os.Create(filepath + "/" + profile + "-" + fmt.Sprint(number) + ".prof")
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
defer f.Close()
|
|
||||||
|
|
||||||
_, err = f.Write(buf.Bytes())
|
|
||||||
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
return closeFnNew, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
// fillTransactions retrieves the pending transactions from the txpool and fills them
|
// fillTransactions retrieves the pending transactions from the txpool and fills them
|
||||||
// into the given sealing block. The transaction selection and ordering strategy can
|
// into the given sealing block. The transaction selection and ordering strategy can
|
||||||
// be customized with the plugin in the future.
|
// be customized with the plugin in the future.
|
||||||
|
|
||||||
//
|
//
|
||||||
//nolint:gocognit
|
//nolint:gocognit
|
||||||
func (w *worker) fillTransactions(ctx context.Context, interrupt *atomic.Int32, env *environment, interruptCtx context.Context) error {
|
func (w *worker) fillTransactions(interrupt *atomic.Int32, env *environment) error {
|
||||||
ctx, span := tracing.StartSpan(ctx, "fillTransactions")
|
|
||||||
defer tracing.EndSpan(span)
|
|
||||||
|
|
||||||
w.mu.RLock()
|
w.mu.RLock()
|
||||||
tip := w.tip
|
tip := w.tip
|
||||||
w.mu.RUnlock()
|
w.mu.RUnlock()
|
||||||
|
|
@ -1408,79 +1316,10 @@ func (w *worker) fillTransactions(ctx context.Context, interrupt *atomic.Int32,
|
||||||
filter.BlobFee = uint256.MustFromBig(eip4844.CalcBlobFee(*env.header.ExcessBlobGas))
|
filter.BlobFee = uint256.MustFromBig(eip4844.CalcBlobFee(*env.header.ExcessBlobGas))
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
|
||||||
localPlainTxsCount int
|
|
||||||
remotePlainTxsCount int
|
|
||||||
)
|
|
||||||
|
|
||||||
// TODO: move to config or RPC
|
|
||||||
const profiling = false
|
|
||||||
|
|
||||||
if profiling {
|
|
||||||
doneCh := make(chan struct{})
|
|
||||||
|
|
||||||
defer func() {
|
|
||||||
close(doneCh)
|
|
||||||
}()
|
|
||||||
|
|
||||||
go func(number uint64) {
|
|
||||||
closeFn := func() error {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
for {
|
|
||||||
select {
|
|
||||||
case <-time.After(150 * time.Millisecond):
|
|
||||||
// Check if we've not crossed limit
|
|
||||||
if attempt := atomic.AddInt32(w.profileCount, 1); attempt >= 10 {
|
|
||||||
log.Info("Completed profiling", "attempt", attempt)
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Info("Starting profiling in fill transactions", "number", number)
|
|
||||||
|
|
||||||
dir, err := os.MkdirTemp("", fmt.Sprintf("bor-traces-%s-", time.Now().UTC().Format("2006-01-02-150405Z")))
|
|
||||||
if err != nil {
|
|
||||||
log.Error("Error in profiling", "path", dir, "number", number, "err", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// grab the cpu profile
|
|
||||||
closeFnInternal, err := startProfiler("cpu", dir, number)
|
|
||||||
if err != nil {
|
|
||||||
log.Error("Error in profiling", "path", dir, "number", number, "err", err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
closeFn = func() error {
|
|
||||||
err := closeFnInternal()
|
|
||||||
|
|
||||||
log.Info("Completed profiling", "path", dir, "number", number, "error", err)
|
|
||||||
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
|
|
||||||
case <-doneCh:
|
|
||||||
err := closeFn()
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
log.Info("closing fillTransactions", "number", number, "error", err)
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}(env.header.Number.Uint64())
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
localPlainTxs, remotePlainTxs, localBlobTxs, remoteBlobTxs map[common.Address][]*txpool.LazyTransaction
|
localPlainTxs, remotePlainTxs, localBlobTxs, remoteBlobTxs map[common.Address][]*txpool.LazyTransaction
|
||||||
)
|
)
|
||||||
|
|
||||||
tracing.Exec(ctx, "", "worker.SplittingTransactions", func(ctx context.Context, span trace.Span) {
|
|
||||||
prePendingTime := time.Now()
|
|
||||||
|
|
||||||
filter.OnlyPlainTxs, filter.OnlyBlobTxs = true, false
|
filter.OnlyPlainTxs, filter.OnlyBlobTxs = true, false
|
||||||
pendingPlainTxs := w.eth.TxPool().Pending(filter)
|
pendingPlainTxs := w.eth.TxPool().Pending(filter)
|
||||||
|
|
||||||
|
|
@ -1491,8 +1330,6 @@ func (w *worker) fillTransactions(ctx context.Context, interrupt *atomic.Int32,
|
||||||
localPlainTxs, remotePlainTxs = make(map[common.Address][]*txpool.LazyTransaction), pendingPlainTxs
|
localPlainTxs, remotePlainTxs = make(map[common.Address][]*txpool.LazyTransaction), pendingPlainTxs
|
||||||
localBlobTxs, remoteBlobTxs = make(map[common.Address][]*txpool.LazyTransaction), pendingBlobTxs
|
localBlobTxs, remoteBlobTxs = make(map[common.Address][]*txpool.LazyTransaction), pendingBlobTxs
|
||||||
|
|
||||||
postPendingTime := time.Now()
|
|
||||||
|
|
||||||
for _, account := range w.eth.TxPool().Locals() {
|
for _, account := range w.eth.TxPool().Locals() {
|
||||||
if txs := remotePlainTxs[account]; len(txs) > 0 {
|
if txs := remotePlainTxs[account]; len(txs) > 0 {
|
||||||
delete(remotePlainTxs, account)
|
delete(remotePlainTxs, account)
|
||||||
|
|
@ -1504,78 +1341,29 @@ func (w *worker) fillTransactions(ctx context.Context, interrupt *atomic.Int32,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
postLocalsTime := time.Now()
|
|
||||||
|
|
||||||
tracing.SetAttributes(
|
|
||||||
span,
|
|
||||||
attribute.Int("len of local txs", localPlainTxsCount),
|
|
||||||
attribute.Int("len of remote txs", remotePlainTxsCount),
|
|
||||||
attribute.String("time taken by Pending()", fmt.Sprintf("%v", postPendingTime.Sub(prePendingTime))),
|
|
||||||
attribute.String("time taken by Locals()", fmt.Sprintf("%v", postLocalsTime.Sub(postPendingTime))),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
var (
|
|
||||||
localEnvTCount int
|
|
||||||
remoteEnvTCount int
|
|
||||||
err error
|
|
||||||
)
|
|
||||||
|
|
||||||
// Fill the block with all available pending transactions.
|
// Fill the block with all available pending transactions.
|
||||||
if len(localPlainTxs) > 0 || len(localBlobTxs) > 0 {
|
if len(localPlainTxs) > 0 || len(localBlobTxs) > 0 {
|
||||||
var plainTxs, blobTxs *transactionsByPriceAndNonce
|
var plainTxs, blobTxs *transactionsByPriceAndNonce
|
||||||
|
|
||||||
tracing.Exec(ctx, "", "worker.LocalTransactionsByPriceAndNonce", func(ctx context.Context, span trace.Span) {
|
|
||||||
plainTxs = newTransactionsByPriceAndNonce(env.signer, localPlainTxs, env.header.BaseFee)
|
plainTxs = newTransactionsByPriceAndNonce(env.signer, localPlainTxs, env.header.BaseFee)
|
||||||
blobTxs = newTransactionsByPriceAndNonce(env.signer, localBlobTxs, env.header.BaseFee)
|
blobTxs = newTransactionsByPriceAndNonce(env.signer, localBlobTxs, env.header.BaseFee)
|
||||||
|
|
||||||
tracing.SetAttributes(
|
if err := w.commitTransactions(env, plainTxs, blobTxs, interrupt, new(uint256.Int)); err != nil {
|
||||||
span,
|
|
||||||
attribute.Int("len of tx local Heads", plainTxs.GetTxs()),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
tracing.Exec(ctx, "", "worker.LocalCommitTransactions", func(ctx context.Context, span trace.Span) {
|
|
||||||
err = w.commitTransactions(env, plainTxs, blobTxs, interrupt, new(uint256.Int), interruptCtx)
|
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
localEnvTCount = env.tcount
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(remotePlainTxs) > 0 || len(remoteBlobTxs) > 0 {
|
if len(remotePlainTxs) > 0 || len(remoteBlobTxs) > 0 {
|
||||||
var plainTxs, blobTxs *transactionsByPriceAndNonce
|
var plainTxs, blobTxs *transactionsByPriceAndNonce
|
||||||
|
|
||||||
tracing.Exec(ctx, "", "worker.RemoteTransactionsByPriceAndNonce", func(ctx context.Context, span trace.Span) {
|
|
||||||
plainTxs = newTransactionsByPriceAndNonce(env.signer, remotePlainTxs, env.header.BaseFee)
|
plainTxs = newTransactionsByPriceAndNonce(env.signer, remotePlainTxs, env.header.BaseFee)
|
||||||
blobTxs = newTransactionsByPriceAndNonce(env.signer, remoteBlobTxs, env.header.BaseFee)
|
blobTxs = newTransactionsByPriceAndNonce(env.signer, remoteBlobTxs, env.header.BaseFee)
|
||||||
|
|
||||||
tracing.SetAttributes(
|
if err := w.commitTransactions(env, plainTxs, blobTxs, interrupt, new(uint256.Int)); err != nil {
|
||||||
span,
|
|
||||||
attribute.Int("len of tx remote Heads", plainTxs.GetTxs()),
|
|
||||||
)
|
|
||||||
})
|
|
||||||
|
|
||||||
tracing.Exec(ctx, "", "worker.RemoteCommitTransactions", func(ctx context.Context, span trace.Span) {
|
|
||||||
err = w.commitTransactions(env, plainTxs, blobTxs, interrupt, new(uint256.Int), interruptCtx)
|
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
remoteEnvTCount = env.tcount
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tracing.SetAttributes(
|
|
||||||
span,
|
|
||||||
attribute.Int("len of final local txs ", localEnvTCount),
|
|
||||||
attribute.Int("len of final remote txs", remoteEnvTCount),
|
|
||||||
)
|
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1587,9 +1375,7 @@ func (w *worker) generateWork(params *generateParams, witness bool) *newPayloadR
|
||||||
}
|
}
|
||||||
defer work.discard()
|
defer work.discard()
|
||||||
|
|
||||||
// nolint : contextcheck
|
w.interruptCtx = resetAndCopyInterruptCtx(w.interruptCtx)
|
||||||
var interruptCtx = context.Background()
|
|
||||||
|
|
||||||
if !params.noTxs {
|
if !params.noTxs {
|
||||||
interrupt := new(atomic.Int32)
|
interrupt := new(atomic.Int32)
|
||||||
|
|
||||||
|
|
@ -1598,7 +1384,7 @@ func (w *worker) generateWork(params *generateParams, witness bool) *newPayloadR
|
||||||
})
|
})
|
||||||
defer timer.Stop()
|
defer timer.Stop()
|
||||||
|
|
||||||
err := w.fillTransactions(context.Background(), interrupt, work, interruptCtx)
|
err := w.fillTransactions(interrupt, work)
|
||||||
if errors.Is(err, errBlockInterruptedByTimeout) {
|
if errors.Is(err, errBlockInterruptedByTimeout) {
|
||||||
log.Warn("Block building is interrupted", "allowance", common.PrettyDuration(w.newpayloadTimeout))
|
log.Warn("Block building is interrupted", "allowance", common.PrettyDuration(w.newpayloadTimeout))
|
||||||
}
|
}
|
||||||
|
|
@ -1632,7 +1418,7 @@ func (w *worker) generateWork(params *generateParams, witness bool) *newPayloadR
|
||||||
|
|
||||||
// commitWork generates several new sealing tasks based on the parent block
|
// commitWork generates several new sealing tasks based on the parent block
|
||||||
// and submit them to the sealer.
|
// and submit them to the sealer.
|
||||||
func (w *worker) commitWork(ctx context.Context, interrupt *atomic.Int32, noempty bool, timestamp int64) {
|
func (w *worker) commitWork(interrupt *atomic.Int32, noempty bool, timestamp int64) {
|
||||||
// Abort committing if node is still syncing
|
// Abort committing if node is still syncing
|
||||||
if w.syncing.Load() {
|
if w.syncing.Load() {
|
||||||
return
|
return
|
||||||
|
|
@ -1644,7 +1430,6 @@ func (w *worker) commitWork(ctx context.Context, interrupt *atomic.Int32, noempt
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
tracing.Exec(ctx, "", "worker.prepareWork", func(ctx context.Context, span trace.Span) {
|
|
||||||
// Set the coinbase if the worker is running or it's required
|
// Set the coinbase if the worker is running or it's required
|
||||||
var coinbase common.Address
|
var coinbase common.Address
|
||||||
if w.IsRunning() {
|
if w.IsRunning() {
|
||||||
|
|
@ -1659,15 +1444,12 @@ func (w *worker) commitWork(ctx context.Context, interrupt *atomic.Int32, noempt
|
||||||
timestamp: uint64(timestamp),
|
timestamp: uint64(timestamp),
|
||||||
coinbase: coinbase,
|
coinbase: coinbase,
|
||||||
}, false)
|
}, false)
|
||||||
})
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint:contextcheck
|
w.interruptCtx = resetAndCopyInterruptCtx(w.interruptCtx)
|
||||||
var interruptCtx = context.Background()
|
|
||||||
|
|
||||||
stopFn := func() {}
|
stopFn := func() {}
|
||||||
defer func() {
|
defer func() {
|
||||||
stopFn()
|
stopFn()
|
||||||
|
|
@ -1675,26 +1457,17 @@ func (w *worker) commitWork(ctx context.Context, interrupt *atomic.Int32, noempt
|
||||||
|
|
||||||
if !noempty && w.interruptCommitFlag {
|
if !noempty && w.interruptCommitFlag {
|
||||||
block := w.chain.GetBlockByHash(w.chain.CurrentBlock().Hash())
|
block := w.chain.GetBlockByHash(w.chain.CurrentBlock().Hash())
|
||||||
interruptCtx, stopFn = getInterruptTimer(ctx, work, block)
|
w.interruptCtx, stopFn = getInterruptTimer(w.interruptCtx, work, block)
|
||||||
// nolint : staticcheck
|
w.interruptCtx = vm.PutCache(w.interruptCtx, w.interruptedTxCache)
|
||||||
interruptCtx = vm.PutCache(interruptCtx, w.interruptedTxCache)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx, span := tracing.StartSpan(ctx, "commitWork")
|
|
||||||
defer tracing.EndSpan(span)
|
|
||||||
|
|
||||||
tracing.SetAttributes(
|
|
||||||
span,
|
|
||||||
attribute.Int("number", int(work.header.Number.Uint64())),
|
|
||||||
)
|
|
||||||
|
|
||||||
// Create an empty block based on temporary copied state for
|
// Create an empty block based on temporary copied state for
|
||||||
// sealing in advance without waiting block execution finished.
|
// sealing in advance without waiting block execution finished.
|
||||||
if !noempty && !w.noempty.Load() {
|
if !noempty && !w.noempty.Load() {
|
||||||
_ = w.commit(ctx, work.copy(), nil, false, start)
|
_ = w.commit(work.copy(), nil, false, start)
|
||||||
}
|
}
|
||||||
// Fill pending transactions from the txpool into the block.
|
// Fill pending transactions from the txpool into the block.
|
||||||
err = w.fillTransactions(ctx, interrupt, work, interruptCtx)
|
err = w.fillTransactions(interrupt, work)
|
||||||
|
|
||||||
switch {
|
switch {
|
||||||
case err == nil:
|
case err == nil:
|
||||||
|
|
@ -1725,7 +1498,7 @@ func (w *worker) commitWork(ctx context.Context, interrupt *atomic.Int32, noempt
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// Submit the generated block for consensus sealing.
|
// Submit the generated block for consensus sealing.
|
||||||
_ = w.commit(ctx, work.copy(), w.fullTaskHook, true, start)
|
_ = w.commit(work.copy(), w.fullTaskHook, true, start)
|
||||||
|
|
||||||
// Swap out the old work with the new one, terminating any leftover
|
// Swap out the old work with the new one, terminating any leftover
|
||||||
// prefetcher processes in the mean time and starting a new one.
|
// prefetcher processes in the mean time and starting a new one.
|
||||||
|
|
@ -1736,22 +1509,34 @@ func (w *worker) commitWork(ctx context.Context, interrupt *atomic.Int32, noempt
|
||||||
w.current = work
|
w.current = work
|
||||||
}
|
}
|
||||||
|
|
||||||
func getInterruptTimer(ctx context.Context, work *environment, current *types.Block) (context.Context, func()) {
|
// resetAndCopyInterruptCtx resets the interrupt context and copies the values set
|
||||||
|
// from the old one to newly created one. It is necessary to reset context in this way
|
||||||
|
// to get rid of the older parent timeout context.
|
||||||
|
func resetAndCopyInterruptCtx(interruptCtx context.Context) context.Context {
|
||||||
|
// Create a fresh new context and copy values from old one
|
||||||
|
newCtx := context.Background()
|
||||||
|
if delay := interruptCtx.Value(vm.InterruptCtxDelayKey); delay != nil {
|
||||||
|
newCtx = context.WithValue(newCtx, vm.InterruptCtxDelayKey, delay)
|
||||||
|
}
|
||||||
|
if opcodeDelay := interruptCtx.Value(vm.InterruptCtxOpcodeDelayKey); opcodeDelay != nil {
|
||||||
|
newCtx = context.WithValue(newCtx, vm.InterruptCtxOpcodeDelayKey, opcodeDelay)
|
||||||
|
}
|
||||||
|
|
||||||
|
return newCtx
|
||||||
|
}
|
||||||
|
|
||||||
|
func getInterruptTimer(interruptCtx context.Context, work *environment, current *types.Block) (context.Context, func()) {
|
||||||
delay := time.Until(time.Unix(int64(work.header.Time), 0))
|
delay := time.Until(time.Unix(int64(work.header.Time), 0))
|
||||||
|
|
||||||
interruptCtx, cancel := context.WithTimeout(context.Background(), delay)
|
interruptCtx, cancel := context.WithTimeout(interruptCtx, delay)
|
||||||
|
|
||||||
blockNumber := current.NumberU64() + 1
|
blockNumber := current.NumberU64() + 1
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
select {
|
<-interruptCtx.Done()
|
||||||
case <-interruptCtx.Done():
|
|
||||||
if interruptCtx.Err() != context.Canceled {
|
if interruptCtx.Err() != context.Canceled {
|
||||||
log.Info("Commit Interrupt. Pre-committing the current block", "block", blockNumber)
|
log.Info("Commit Interrupt. Pre-committing the current block", "block", blockNumber)
|
||||||
cancel()
|
cancel()
|
||||||
}
|
}
|
||||||
case <-ctx.Done(): // nothing to do
|
|
||||||
}
|
|
||||||
}()
|
}()
|
||||||
|
|
||||||
return interruptCtx, cancel
|
return interruptCtx, cancel
|
||||||
|
|
@ -1761,11 +1546,8 @@ func getInterruptTimer(ctx context.Context, work *environment, current *types.Bl
|
||||||
// and commits new work if consensus engine is running.
|
// and commits new work if consensus engine is running.
|
||||||
// Note the assumption is held that the mutation is allowed to the passed env, do
|
// Note the assumption is held that the mutation is allowed to the passed env, do
|
||||||
// the deep copy first.
|
// the deep copy first.
|
||||||
func (w *worker) commit(ctx context.Context, env *environment, interval func(), update bool, start time.Time) error {
|
func (w *worker) commit(env *environment, interval func(), update bool, start time.Time) error {
|
||||||
if w.IsRunning() {
|
if w.IsRunning() {
|
||||||
ctx, span := tracing.StartSpan(ctx, "commit")
|
|
||||||
defer tracing.EndSpan(span)
|
|
||||||
|
|
||||||
if interval != nil {
|
if interval != nil {
|
||||||
interval()
|
interval()
|
||||||
}
|
}
|
||||||
|
|
@ -1776,21 +1558,13 @@ func (w *worker) commit(ctx context.Context, env *environment, interval func(),
|
||||||
block, err := w.engine.FinalizeAndAssemble(w.chain, env.header, env.state, &types.Body{
|
block, err := w.engine.FinalizeAndAssemble(w.chain, env.header, env.state, &types.Body{
|
||||||
Transactions: env.txs,
|
Transactions: env.txs,
|
||||||
}, env.receipts)
|
}, env.receipts)
|
||||||
tracing.SetAttributes(
|
|
||||||
span,
|
|
||||||
attribute.Int("number", int(env.header.Number.Uint64())),
|
|
||||||
attribute.String("hash", env.header.Hash().String()),
|
|
||||||
attribute.String("sealhash", w.engine.SealHash(env.header).String()),
|
|
||||||
attribute.Int("len of env.txs", len(env.txs)),
|
|
||||||
attribute.Bool("error", err != nil),
|
|
||||||
)
|
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case w.taskCh <- &task{ctx: ctx, receipts: env.receipts, state: env.state, block: block, createdAt: time.Now()}:
|
case w.taskCh <- &task{receipts: env.receipts, state: env.state, block: block, createdAt: time.Now()}:
|
||||||
fees := totalFees(block, env.receipts)
|
fees := totalFees(block, env.receipts)
|
||||||
feesInEther := new(big.Float).Quo(new(big.Float).SetInt(fees), big.NewFloat(params.Ether))
|
feesInEther := new(big.Float).Quo(new(big.Float).SetInt(fees), big.NewFloat(params.Ether))
|
||||||
log.Info("Commit new sealing work", "number", block.Number(), "sealhash", w.engine.SealHash(block.Header()),
|
log.Info("Commit new sealing work", "number", block.Number(), "sealhash", w.engine.SealHash(block.Header()),
|
||||||
|
|
@ -1837,6 +1611,12 @@ func (w *worker) adjustResubmitInterval(message *intervalAdjust) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setInterruptCtx sets `value` for given `key` for interrupt commit logic. To be only
|
||||||
|
// used for e2e unit tests.
|
||||||
|
func (w *worker) setInterruptCtx(key any, value any) {
|
||||||
|
w.interruptCtx = context.WithValue(w.interruptCtx, key, value)
|
||||||
|
}
|
||||||
|
|
||||||
// copyReceipts makes a deep copy of the given receipts.
|
// copyReceipts makes a deep copy of the given receipts.
|
||||||
func copyReceipts(receipts []*types.Receipt) []*types.Receipt {
|
func copyReceipts(receipts []*types.Receipt) []*types.Receipt {
|
||||||
result := make([]*types.Receipt, len(receipts))
|
result := make([]*types.Receipt, len(receipts))
|
||||||
|
|
|
||||||
|
|
@ -320,13 +320,10 @@ func (b *testWorkerBackend) newStorageContractCallTx(to common.Address, nonce ui
|
||||||
func newTestWorker(t TensingObject, chainConfig *params.ChainConfig, engine consensus.Engine, db ethdb.Database, noempty bool, delay uint, opcodeDelay uint) (*worker, *testWorkerBackend, func()) {
|
func newTestWorker(t TensingObject, chainConfig *params.ChainConfig, engine consensus.Engine, db ethdb.Database, noempty bool, delay uint, opcodeDelay uint) (*worker, *testWorkerBackend, func()) {
|
||||||
backend := newTestWorkerBackend(t, chainConfig, engine, db)
|
backend := newTestWorkerBackend(t, chainConfig, engine, db)
|
||||||
backend.txPool.Add(pendingTxs, true, false)
|
backend.txPool.Add(pendingTxs, true, false)
|
||||||
var w *worker
|
w := newWorker(testConfig, chainConfig, engine, backend, new(event.TypeMux), nil, false)
|
||||||
if delay != 0 || opcodeDelay != 0 {
|
if delay != 0 || opcodeDelay != 0 {
|
||||||
//nolint:staticcheck
|
w.setInterruptCtx(vm.InterruptCtxDelayKey, delay)
|
||||||
w = newWorkerWithDelay(testConfig, chainConfig, engine, backend, new(event.TypeMux), nil, false, delay, opcodeDelay)
|
w.setInterruptCtx(vm.InterruptCtxOpcodeDelayKey, opcodeDelay)
|
||||||
} else {
|
|
||||||
//nolint:staticcheck
|
|
||||||
w = newWorker(testConfig, chainConfig, engine, backend, new(event.TypeMux), nil, false)
|
|
||||||
}
|
}
|
||||||
w.setEtherbase(testBankAddress)
|
w.setEtherbase(testBankAddress)
|
||||||
// enable empty blocks
|
// enable empty blocks
|
||||||
|
|
@ -771,9 +768,7 @@ func testCommitInterruptExperimentBorContract(t *testing.T, delay uint, txCount
|
||||||
}
|
}
|
||||||
|
|
||||||
wrapped := make([]*types.Transaction, len(txs))
|
wrapped := make([]*types.Transaction, len(txs))
|
||||||
for i, tx := range txs {
|
copy(wrapped, txs)
|
||||||
wrapped[i] = tx
|
|
||||||
}
|
|
||||||
|
|
||||||
b.TxPool().Add(wrapped, false, false)
|
b.TxPool().Add(wrapped, false, false)
|
||||||
|
|
||||||
|
|
@ -783,8 +778,9 @@ func testCommitInterruptExperimentBorContract(t *testing.T, delay uint, txCount
|
||||||
w.stop()
|
w.stop()
|
||||||
|
|
||||||
currentBlockNumber := w.current.header.Number.Uint64()
|
currentBlockNumber := w.current.header.Number.Uint64()
|
||||||
assert.Check(t, txCount >= w.chain.GetBlockByNumber(currentBlockNumber-1).Transactions().Len())
|
prevBlockTxCount := w.chain.GetBlockByNumber(currentBlockNumber - 1).Transactions().Len()
|
||||||
assert.Check(t, 0 < w.chain.GetBlockByNumber(currentBlockNumber-1).Transactions().Len()+1)
|
assert.Check(t, prevBlockTxCount > 0)
|
||||||
|
assert.Check(t, prevBlockTxCount <= txCount)
|
||||||
}
|
}
|
||||||
|
|
||||||
// // nolint : thelper
|
// // nolint : thelper
|
||||||
|
|
@ -973,7 +969,7 @@ func BenchmarkBorMiningBlockSTMMetadata(b *testing.B) {
|
||||||
db2 := rawdb.NewMemoryDatabase()
|
db2 := rawdb.NewMemoryDatabase()
|
||||||
back.genesis.MustCommit(db2, triedb.NewDatabase(db2, triedb.HashDefaults))
|
back.genesis.MustCommit(db2, triedb.NewDatabase(db2, triedb.HashDefaults))
|
||||||
|
|
||||||
chain, _ := core.NewParallelBlockChain(db2, nil, back.genesis, nil, engine, vm.Config{}, nil, nil, nil, 8)
|
chain, _ := core.NewParallelBlockChain(db2, nil, back.genesis, nil, engine, vm.Config{}, nil, nil, nil, 8, false)
|
||||||
defer chain.Stop()
|
defer chain.Stop()
|
||||||
|
|
||||||
// Ignore empty commit here for less noise.
|
// Ignore empty commit here for less noise.
|
||||||
|
|
|
||||||
|
|
@ -54,9 +54,9 @@ gcmode = "archive"
|
||||||
nolocals = true
|
nolocals = true
|
||||||
pricelimit = 25000000000
|
pricelimit = 25000000000
|
||||||
accountslots = 16
|
accountslots = 16
|
||||||
globalslots = 32768
|
globalslots = 131072
|
||||||
accountqueue = 16
|
accountqueue = 64
|
||||||
globalqueue = 32768
|
globalqueue = 131072
|
||||||
lifetime = "1h30m0s"
|
lifetime = "1h30m0s"
|
||||||
# locals = []
|
# locals = []
|
||||||
# journal = ""
|
# journal = ""
|
||||||
|
|
@ -169,6 +169,11 @@ gcmode = "archive"
|
||||||
# period = 0
|
# period = 0
|
||||||
# gaslimit = 11500000
|
# gaslimit = 11500000
|
||||||
|
|
||||||
|
# [parallelevm]
|
||||||
|
# enable = true
|
||||||
|
# procs = 8
|
||||||
|
# enforce = false
|
||||||
|
|
||||||
# [pprof]
|
# [pprof]
|
||||||
# pprof = false
|
# pprof = false
|
||||||
# port = 6060
|
# port = 6060
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ syncmode = "full"
|
||||||
# nodekey = ""
|
# nodekey = ""
|
||||||
# nodekeyhex = ""
|
# nodekeyhex = ""
|
||||||
# txarrivalwait = "500ms"
|
# txarrivalwait = "500ms"
|
||||||
# [p2p.discovery]
|
[p2p.discovery]
|
||||||
# v4disc = true
|
# v4disc = true
|
||||||
# v5disc = false
|
# v5disc = false
|
||||||
bootnodes = [ "enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303", "enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303" ]
|
bootnodes = [ "enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303", "enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303" ]
|
||||||
|
|
@ -53,9 +53,9 @@ syncmode = "full"
|
||||||
nolocals = true
|
nolocals = true
|
||||||
pricelimit = 25000000000
|
pricelimit = 25000000000
|
||||||
accountslots = 16
|
accountslots = 16
|
||||||
globalslots = 32768
|
globalslots = 131072
|
||||||
accountqueue = 16
|
accountqueue = 64
|
||||||
globalqueue = 32768
|
globalqueue = 131072
|
||||||
lifetime = "1h30m0s"
|
lifetime = "1h30m0s"
|
||||||
# locals = []
|
# locals = []
|
||||||
# journal = ""
|
# journal = ""
|
||||||
|
|
@ -168,6 +168,11 @@ syncmode = "full"
|
||||||
# period = 0
|
# period = 0
|
||||||
# gaslimit = 11500000
|
# gaslimit = 11500000
|
||||||
|
|
||||||
|
# [parallelevm]
|
||||||
|
# enable = true
|
||||||
|
# procs = 8
|
||||||
|
# enforce = false
|
||||||
|
|
||||||
# [pprof]
|
# [pprof]
|
||||||
# pprof = false
|
# pprof = false
|
||||||
# port = 6060
|
# port = 6060
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ syncmode = "full"
|
||||||
# nodekey = ""
|
# nodekey = ""
|
||||||
# nodekeyhex = ""
|
# nodekeyhex = ""
|
||||||
# txarrivalwait = "500ms"
|
# txarrivalwait = "500ms"
|
||||||
# [p2p.discovery]
|
[p2p.discovery]
|
||||||
# v4disc = true
|
# v4disc = true
|
||||||
# v5disc = false
|
# v5disc = false
|
||||||
bootnodes = [ "enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303", "enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303" ]
|
bootnodes = [ "enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303", "enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303" ]
|
||||||
|
|
@ -55,9 +55,9 @@ syncmode = "full"
|
||||||
nolocals = true
|
nolocals = true
|
||||||
pricelimit = 25000000000
|
pricelimit = 25000000000
|
||||||
accountslots = 16
|
accountslots = 16
|
||||||
globalslots = 32768
|
globalslots = 131072
|
||||||
accountqueue = 16
|
accountqueue = 64
|
||||||
globalqueue = 32768
|
globalqueue = 131072
|
||||||
lifetime = "1h30m0s"
|
lifetime = "1h30m0s"
|
||||||
# locals = []
|
# locals = []
|
||||||
# journal = ""
|
# journal = ""
|
||||||
|
|
@ -170,6 +170,11 @@ syncmode = "full"
|
||||||
# period = 0
|
# period = 0
|
||||||
# gaslimit = 11500000
|
# gaslimit = 11500000
|
||||||
|
|
||||||
|
# [parallelevm]
|
||||||
|
# enable = true
|
||||||
|
# procs = 8
|
||||||
|
# enforce = false
|
||||||
|
|
||||||
# [pprof]
|
# [pprof]
|
||||||
# pprof = false
|
# pprof = false
|
||||||
# port = 6060
|
# port = 6060
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ syncmode = "full"
|
||||||
# nodekey = ""
|
# nodekey = ""
|
||||||
# nodekeyhex = ""
|
# nodekeyhex = ""
|
||||||
# txarrivalwait = "500ms"
|
# txarrivalwait = "500ms"
|
||||||
# [p2p.discovery]
|
[p2p.discovery]
|
||||||
# v4disc = true
|
# v4disc = true
|
||||||
# v5disc = false
|
# v5disc = false
|
||||||
bootnodes = ["enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303", "enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303"]
|
bootnodes = ["enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303", "enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303"]
|
||||||
|
|
@ -55,9 +55,9 @@ syncmode = "full"
|
||||||
nolocals = true
|
nolocals = true
|
||||||
pricelimit = 25000000000
|
pricelimit = 25000000000
|
||||||
accountslots = 16
|
accountslots = 16
|
||||||
globalslots = 32768
|
globalslots = 131072
|
||||||
accountqueue = 16
|
accountqueue = 64
|
||||||
globalqueue = 32768
|
globalqueue = 131072
|
||||||
lifetime = "1h30m0s"
|
lifetime = "1h30m0s"
|
||||||
# locals = []
|
# locals = []
|
||||||
# journal = ""
|
# journal = ""
|
||||||
|
|
@ -170,6 +170,11 @@ syncmode = "full"
|
||||||
# period = 0
|
# period = 0
|
||||||
# gaslimit = 11500000
|
# gaslimit = 11500000
|
||||||
|
|
||||||
|
# [parallelevm]
|
||||||
|
# enable = true
|
||||||
|
# procs = 8
|
||||||
|
# enforce = false
|
||||||
|
|
||||||
# [pprof]
|
# [pprof]
|
||||||
# pprof = false
|
# pprof = false
|
||||||
# port = 6060
|
# port = 6060
|
||||||
|
|
|
||||||
|
|
@ -38,7 +38,7 @@ syncmode = "full"
|
||||||
# nodekey = ""
|
# nodekey = ""
|
||||||
# nodekeyhex = ""
|
# nodekeyhex = ""
|
||||||
# txarrivalwait = "500ms"
|
# txarrivalwait = "500ms"
|
||||||
# [p2p.discovery]
|
[p2p.discovery]
|
||||||
# v4disc = true
|
# v4disc = true
|
||||||
# v5disc = false
|
# v5disc = false
|
||||||
bootnodes = ["enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303", "enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303"]
|
bootnodes = ["enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303", "enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303"]
|
||||||
|
|
@ -57,9 +57,9 @@ syncmode = "full"
|
||||||
nolocals = true
|
nolocals = true
|
||||||
pricelimit = 25000000000
|
pricelimit = 25000000000
|
||||||
accountslots = 16
|
accountslots = 16
|
||||||
globalslots = 32768
|
globalslots = 131072
|
||||||
accountqueue = 16
|
accountqueue = 64
|
||||||
globalqueue = 32768
|
globalqueue = 131072
|
||||||
lifetime = "1h30m0s"
|
lifetime = "1h30m0s"
|
||||||
# locals = []
|
# locals = []
|
||||||
# journal = ""
|
# journal = ""
|
||||||
|
|
@ -172,6 +172,11 @@ syncmode = "full"
|
||||||
# period = 0
|
# period = 0
|
||||||
# gaslimit = 11500000
|
# gaslimit = 11500000
|
||||||
|
|
||||||
|
# [parallelevm]
|
||||||
|
# enable = true
|
||||||
|
# procs = 8
|
||||||
|
# enforce = false
|
||||||
|
|
||||||
# [pprof]
|
# [pprof]
|
||||||
# pprof = false
|
# pprof = false
|
||||||
# port = 6060
|
# port = 6060
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ syncmode = "full"
|
||||||
# nodekey = ""
|
# nodekey = ""
|
||||||
# nodekeyhex = ""
|
# nodekeyhex = ""
|
||||||
# txarrivalwait = "500ms"
|
# txarrivalwait = "500ms"
|
||||||
# [p2p.discovery]
|
[p2p.discovery]
|
||||||
# v4disc = true
|
# v4disc = true
|
||||||
# v5disc = false
|
# v5disc = false
|
||||||
bootnodes = [ "enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303", "enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303" ]
|
bootnodes = [ "enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303", "enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303" ]
|
||||||
|
|
@ -55,9 +55,9 @@ syncmode = "full"
|
||||||
nolocals = true
|
nolocals = true
|
||||||
pricelimit = 25000000000
|
pricelimit = 25000000000
|
||||||
accountslots = 16
|
accountslots = 16
|
||||||
globalslots = 32768
|
globalslots = 131072
|
||||||
accountqueue = 16
|
accountqueue = 64
|
||||||
globalqueue = 32768
|
globalqueue = 131072
|
||||||
lifetime = "1h30m0s"
|
lifetime = "1h30m0s"
|
||||||
# locals = []
|
# locals = []
|
||||||
# journal = ""
|
# journal = ""
|
||||||
|
|
@ -170,6 +170,11 @@ syncmode = "full"
|
||||||
# period = 0
|
# period = 0
|
||||||
# gaslimit = 11500000
|
# gaslimit = 11500000
|
||||||
|
|
||||||
|
# [parallelevm]
|
||||||
|
# enable = true
|
||||||
|
# procs = 8
|
||||||
|
# enforce = false
|
||||||
|
|
||||||
# [pprof]
|
# [pprof]
|
||||||
# pprof = false
|
# pprof = false
|
||||||
# port = 6060
|
# port = 6060
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ syncmode = "full"
|
||||||
# nodekey = ""
|
# nodekey = ""
|
||||||
# nodekeyhex = ""
|
# nodekeyhex = ""
|
||||||
# txarrivalwait = "500ms"
|
# txarrivalwait = "500ms"
|
||||||
# [p2p.discovery]
|
[p2p.discovery]
|
||||||
# v4disc = true
|
# v4disc = true
|
||||||
# v5disc = false
|
# v5disc = false
|
||||||
bootnodes = [ "enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303", "enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303" ]
|
bootnodes = [ "enode://b8f1cc9c5d4403703fbf377116469667d2b1823c0daf16b7250aa576bacf399e42c3930ccfcb02c5df6879565a2b8931335565f0e8d3f8e72385ecf4a4bf160a@3.36.224.80:30303", "enode://8729e0c825f3d9cad382555f3e46dcff21af323e89025a0e6312df541f4a9e73abfa562d64906f5e59c51fe6f0501b3e61b07979606c56329c020ed739910759@54.194.245.5:30303" ]
|
||||||
|
|
@ -56,9 +56,9 @@ syncmode = "full"
|
||||||
nolocals = true
|
nolocals = true
|
||||||
pricelimit = 25000000000
|
pricelimit = 25000000000
|
||||||
accountslots = 16
|
accountslots = 16
|
||||||
globalslots = 32768
|
globalslots = 131072
|
||||||
accountqueue = 16
|
accountqueue = 64
|
||||||
globalqueue = 32768
|
globalqueue = 131072
|
||||||
lifetime = "1h30m0s"
|
lifetime = "1h30m0s"
|
||||||
# locals = []
|
# locals = []
|
||||||
# journal = ""
|
# journal = ""
|
||||||
|
|
@ -171,6 +171,11 @@ syncmode = "full"
|
||||||
# period = 0
|
# period = 0
|
||||||
# gaslimit = 11500000
|
# gaslimit = 11500000
|
||||||
|
|
||||||
|
# [parallelevm]
|
||||||
|
# enable = true
|
||||||
|
# procs = 8
|
||||||
|
# enforce = false
|
||||||
|
|
||||||
# [pprof]
|
# [pprof]
|
||||||
# pprof = false
|
# pprof = false
|
||||||
# port = 6060
|
# port = 6060
|
||||||
|
|
|
||||||
|
|
@ -34,14 +34,14 @@ gcmode = "archive"
|
||||||
# nodekey = ""
|
# nodekey = ""
|
||||||
# nodekeyhex = ""
|
# nodekeyhex = ""
|
||||||
# txarrivalwait = "500ms"
|
# txarrivalwait = "500ms"
|
||||||
# [p2p.discovery]
|
[p2p.discovery]
|
||||||
# v5disc = false
|
# v5disc = false
|
||||||
# bootnodesv4 = []
|
# bootnodesv4 = []
|
||||||
# bootnodesv5 = []
|
# bootnodesv5 = []
|
||||||
bootnodes = [ "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303" ]
|
bootnodes = [ "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303" ]
|
||||||
static-nodes = [ "enode://383ec39eb7f7e23538ea846f502602632110a6bcfc7521bfc2b8833f5a190779507d006b28650d83674b75d188cb36bcb3c3e168a0f2b3d98f9a651cc6603146@52.214.229.208:30303", "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://a4a387ad423a2fd0d652808b270082250d3c616b7e8537209584ebad4806dd50ef8dc66a371c85c7f55e6c1f53747edbb11055c8073cfacf312047eaeb328f58@54.171.220.164:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303", "enode://e8fe33b52f90d4bc7a4e75800945df449d1a091bd347c9f11cd1dbcd98ea28cb4c231cb3b1c6feacdabca2aa91f1a6744724b44edc9382c107968792abdef261@52.74.18.182:30303", "enode://b240f1f18e8f3cc61df96a164ba215ea6fc3f00717e4300da6283362a0438bda53f81ecc24c575ff130066d42096319fa027c952681bbb4f003e0bdd5d5b4e61@52.76.37.145:30303", "enode://de55d16b6e1fca28cdd3d11eb0dd89e3b77b96d4722172bd5e04ac255922324076a87748e97bc021af2307dccbb5ef8062389cfcba1845f77219eee7935dea9f@52.74.125.36:30303", "enode://7f2272685fc3e31c8e43c7687dda43ea3192fd310ba01efcb7811d5dc7ad5a64402ea8cd827650e573a174cf29bb69331dffcca6f0b9894ef17eeafabd97a41d@47.128.184.10:30303", "enode://c66e12243b425b63528dd8b1ce87f2f7fbc85f35485e2d8bf6bbf0ec0dcd05b3a582ef62daadbde061b58058735788335d09ed972a451242b9943b85d323c239@63.32.214.97:30303", "enode://bd56c0f00dd37e14ae2b84f5eb50e357d3a2d326bdbb0cbb987411268b3f132288f6c86157fc132c6902d18b9be0de8bbdcd12d926e16232ebadd8e274aae780@52.208.81.179:30303", "enode://2f015d5b1571165975382281a2117a9b514e1b38e87a8116596fc9b3b121a93cfb238eb6f7b3ae30cf9c0154384372745ce9edc09cbc30526ab7e2059f57ddee@54.74.160.230:30303" ]
|
static-nodes = [ "enode://383ec39eb7f7e23538ea846f502602632110a6bcfc7521bfc2b8833f5a190779507d006b28650d83674b75d188cb36bcb3c3e168a0f2b3d98f9a651cc6603146@52.214.229.208:30303", "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://a4a387ad423a2fd0d652808b270082250d3c616b7e8537209584ebad4806dd50ef8dc66a371c85c7f55e6c1f53747edbb11055c8073cfacf312047eaeb328f58@54.171.220.164:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303", "enode://e8fe33b52f90d4bc7a4e75800945df449d1a091bd347c9f11cd1dbcd98ea28cb4c231cb3b1c6feacdabca2aa91f1a6744724b44edc9382c107968792abdef261@52.74.18.182:30303", "enode://b240f1f18e8f3cc61df96a164ba215ea6fc3f00717e4300da6283362a0438bda53f81ecc24c575ff130066d42096319fa027c952681bbb4f003e0bdd5d5b4e61@52.76.37.145:30303", "enode://de55d16b6e1fca28cdd3d11eb0dd89e3b77b96d4722172bd5e04ac255922324076a87748e97bc021af2307dccbb5ef8062389cfcba1845f77219eee7935dea9f@52.74.125.36:30303", "enode://7f2272685fc3e31c8e43c7687dda43ea3192fd310ba01efcb7811d5dc7ad5a64402ea8cd827650e573a174cf29bb69331dffcca6f0b9894ef17eeafabd97a41d@47.128.184.10:30303", "enode://c66e12243b425b63528dd8b1ce87f2f7fbc85f35485e2d8bf6bbf0ec0dcd05b3a582ef62daadbde061b58058735788335d09ed972a451242b9943b85d323c239@63.32.214.97:30303", "enode://bd56c0f00dd37e14ae2b84f5eb50e357d3a2d326bdbb0cbb987411268b3f132288f6c86157fc132c6902d18b9be0de8bbdcd12d926e16232ebadd8e274aae780@52.208.81.179:30303", "enode://2f015d5b1571165975382281a2117a9b514e1b38e87a8116596fc9b3b121a93cfb238eb6f7b3ae30cf9c0154384372745ce9edc09cbc30526ab7e2059f57ddee@54.74.160.230:30303" ]
|
||||||
# trusted-nodes = []
|
# trusted-nodes = []
|
||||||
# dns = []
|
dns = [ "enrtree://AKUEZKN7PSKVNR65FZDHECMKOJQSGPARGTPPBI7WS2VUL4EGR6XPC@amoy.polygon-peers.io" ]
|
||||||
|
|
||||||
# [heimdall]
|
# [heimdall]
|
||||||
# url = "http://localhost:1317"
|
# url = "http://localhost:1317"
|
||||||
|
|
@ -168,6 +168,11 @@ gcmode = "archive"
|
||||||
# period = 0
|
# period = 0
|
||||||
# gaslimit = 11500000
|
# gaslimit = 11500000
|
||||||
|
|
||||||
|
# [parallelevm]
|
||||||
|
# enable = true
|
||||||
|
# procs = 8
|
||||||
|
# enforce = false
|
||||||
|
|
||||||
# [pprof]
|
# [pprof]
|
||||||
# pprof = false
|
# pprof = false
|
||||||
# port = 6060
|
# port = 6060
|
||||||
|
|
|
||||||
|
|
@ -33,14 +33,14 @@ syncmode = "full"
|
||||||
# nodekey = ""
|
# nodekey = ""
|
||||||
# nodekeyhex = ""
|
# nodekeyhex = ""
|
||||||
# txarrivalwait = "500ms"
|
# txarrivalwait = "500ms"
|
||||||
# [p2p.discovery]
|
[p2p.discovery]
|
||||||
# v5disc = false
|
# v5disc = false
|
||||||
# bootnodesv4 = []
|
# bootnodesv4 = []
|
||||||
# bootnodesv5 = []
|
# bootnodesv5 = []
|
||||||
bootnodes = [ "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303" ]
|
bootnodes = [ "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303" ]
|
||||||
static-nodes = [ "enode://383ec39eb7f7e23538ea846f502602632110a6bcfc7521bfc2b8833f5a190779507d006b28650d83674b75d188cb36bcb3c3e168a0f2b3d98f9a651cc6603146@52.214.229.208:30303", "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://a4a387ad423a2fd0d652808b270082250d3c616b7e8537209584ebad4806dd50ef8dc66a371c85c7f55e6c1f53747edbb11055c8073cfacf312047eaeb328f58@54.171.220.164:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303", "enode://e8fe33b52f90d4bc7a4e75800945df449d1a091bd347c9f11cd1dbcd98ea28cb4c231cb3b1c6feacdabca2aa91f1a6744724b44edc9382c107968792abdef261@52.74.18.182:30303", "enode://b240f1f18e8f3cc61df96a164ba215ea6fc3f00717e4300da6283362a0438bda53f81ecc24c575ff130066d42096319fa027c952681bbb4f003e0bdd5d5b4e61@52.76.37.145:30303", "enode://de55d16b6e1fca28cdd3d11eb0dd89e3b77b96d4722172bd5e04ac255922324076a87748e97bc021af2307dccbb5ef8062389cfcba1845f77219eee7935dea9f@52.74.125.36:30303", "enode://7f2272685fc3e31c8e43c7687dda43ea3192fd310ba01efcb7811d5dc7ad5a64402ea8cd827650e573a174cf29bb69331dffcca6f0b9894ef17eeafabd97a41d@47.128.184.10:30303", "enode://c66e12243b425b63528dd8b1ce87f2f7fbc85f35485e2d8bf6bbf0ec0dcd05b3a582ef62daadbde061b58058735788335d09ed972a451242b9943b85d323c239@63.32.214.97:30303", "enode://bd56c0f00dd37e14ae2b84f5eb50e357d3a2d326bdbb0cbb987411268b3f132288f6c86157fc132c6902d18b9be0de8bbdcd12d926e16232ebadd8e274aae780@52.208.81.179:30303", "enode://2f015d5b1571165975382281a2117a9b514e1b38e87a8116596fc9b3b121a93cfb238eb6f7b3ae30cf9c0154384372745ce9edc09cbc30526ab7e2059f57ddee@54.74.160.230:30303" ]
|
static-nodes = [ "enode://383ec39eb7f7e23538ea846f502602632110a6bcfc7521bfc2b8833f5a190779507d006b28650d83674b75d188cb36bcb3c3e168a0f2b3d98f9a651cc6603146@52.214.229.208:30303", "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://a4a387ad423a2fd0d652808b270082250d3c616b7e8537209584ebad4806dd50ef8dc66a371c85c7f55e6c1f53747edbb11055c8073cfacf312047eaeb328f58@54.171.220.164:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303", "enode://e8fe33b52f90d4bc7a4e75800945df449d1a091bd347c9f11cd1dbcd98ea28cb4c231cb3b1c6feacdabca2aa91f1a6744724b44edc9382c107968792abdef261@52.74.18.182:30303", "enode://b240f1f18e8f3cc61df96a164ba215ea6fc3f00717e4300da6283362a0438bda53f81ecc24c575ff130066d42096319fa027c952681bbb4f003e0bdd5d5b4e61@52.76.37.145:30303", "enode://de55d16b6e1fca28cdd3d11eb0dd89e3b77b96d4722172bd5e04ac255922324076a87748e97bc021af2307dccbb5ef8062389cfcba1845f77219eee7935dea9f@52.74.125.36:30303", "enode://7f2272685fc3e31c8e43c7687dda43ea3192fd310ba01efcb7811d5dc7ad5a64402ea8cd827650e573a174cf29bb69331dffcca6f0b9894ef17eeafabd97a41d@47.128.184.10:30303", "enode://c66e12243b425b63528dd8b1ce87f2f7fbc85f35485e2d8bf6bbf0ec0dcd05b3a582ef62daadbde061b58058735788335d09ed972a451242b9943b85d323c239@63.32.214.97:30303", "enode://bd56c0f00dd37e14ae2b84f5eb50e357d3a2d326bdbb0cbb987411268b3f132288f6c86157fc132c6902d18b9be0de8bbdcd12d926e16232ebadd8e274aae780@52.208.81.179:30303", "enode://2f015d5b1571165975382281a2117a9b514e1b38e87a8116596fc9b3b121a93cfb238eb6f7b3ae30cf9c0154384372745ce9edc09cbc30526ab7e2059f57ddee@54.74.160.230:30303" ]
|
||||||
# trusted-nodes = []
|
# trusted-nodes = []
|
||||||
# dns = []
|
dns = [ "enrtree://AKUEZKN7PSKVNR65FZDHECMKOJQSGPARGTPPBI7WS2VUL4EGR6XPC@amoy.polygon-peers.io" ]
|
||||||
|
|
||||||
# [heimdall]
|
# [heimdall]
|
||||||
# url = "http://localhost:1317"
|
# url = "http://localhost:1317"
|
||||||
|
|
@ -167,6 +167,11 @@ syncmode = "full"
|
||||||
# period = 0
|
# period = 0
|
||||||
# gaslimit = 11500000
|
# gaslimit = 11500000
|
||||||
|
|
||||||
|
# [parallelevm]
|
||||||
|
# enable = true
|
||||||
|
# procs = 8
|
||||||
|
# enforce = false
|
||||||
|
|
||||||
# [pprof]
|
# [pprof]
|
||||||
# pprof = false
|
# pprof = false
|
||||||
# port = 6060
|
# port = 6060
|
||||||
|
|
|
||||||
|
|
@ -34,14 +34,14 @@ syncmode = "full"
|
||||||
# nodekey = ""
|
# nodekey = ""
|
||||||
# nodekeyhex = ""
|
# nodekeyhex = ""
|
||||||
# txarrivalwait = "500ms"
|
# txarrivalwait = "500ms"
|
||||||
# [p2p.discovery]
|
[p2p.discovery]
|
||||||
# v5disc = false
|
# v5disc = false
|
||||||
# bootnodesv4 = []
|
# bootnodesv4 = []
|
||||||
# bootnodesv5 = []
|
# bootnodesv5 = []
|
||||||
bootnodes = [ "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303" ]
|
bootnodes = [ "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303" ]
|
||||||
static-nodes = [ "enode://383ec39eb7f7e23538ea846f502602632110a6bcfc7521bfc2b8833f5a190779507d006b28650d83674b75d188cb36bcb3c3e168a0f2b3d98f9a651cc6603146@52.214.229.208:30303", "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://a4a387ad423a2fd0d652808b270082250d3c616b7e8537209584ebad4806dd50ef8dc66a371c85c7f55e6c1f53747edbb11055c8073cfacf312047eaeb328f58@54.171.220.164:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303", "enode://e8fe33b52f90d4bc7a4e75800945df449d1a091bd347c9f11cd1dbcd98ea28cb4c231cb3b1c6feacdabca2aa91f1a6744724b44edc9382c107968792abdef261@52.74.18.182:30303", "enode://b240f1f18e8f3cc61df96a164ba215ea6fc3f00717e4300da6283362a0438bda53f81ecc24c575ff130066d42096319fa027c952681bbb4f003e0bdd5d5b4e61@52.76.37.145:30303", "enode://de55d16b6e1fca28cdd3d11eb0dd89e3b77b96d4722172bd5e04ac255922324076a87748e97bc021af2307dccbb5ef8062389cfcba1845f77219eee7935dea9f@52.74.125.36:30303", "enode://7f2272685fc3e31c8e43c7687dda43ea3192fd310ba01efcb7811d5dc7ad5a64402ea8cd827650e573a174cf29bb69331dffcca6f0b9894ef17eeafabd97a41d@47.128.184.10:30303", "enode://c66e12243b425b63528dd8b1ce87f2f7fbc85f35485e2d8bf6bbf0ec0dcd05b3a582ef62daadbde061b58058735788335d09ed972a451242b9943b85d323c239@63.32.214.97:30303", "enode://bd56c0f00dd37e14ae2b84f5eb50e357d3a2d326bdbb0cbb987411268b3f132288f6c86157fc132c6902d18b9be0de8bbdcd12d926e16232ebadd8e274aae780@52.208.81.179:30303", "enode://2f015d5b1571165975382281a2117a9b514e1b38e87a8116596fc9b3b121a93cfb238eb6f7b3ae30cf9c0154384372745ce9edc09cbc30526ab7e2059f57ddee@54.74.160.230:30303" ]
|
static-nodes = [ "enode://383ec39eb7f7e23538ea846f502602632110a6bcfc7521bfc2b8833f5a190779507d006b28650d83674b75d188cb36bcb3c3e168a0f2b3d98f9a651cc6603146@52.214.229.208:30303", "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://a4a387ad423a2fd0d652808b270082250d3c616b7e8537209584ebad4806dd50ef8dc66a371c85c7f55e6c1f53747edbb11055c8073cfacf312047eaeb328f58@54.171.220.164:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303", "enode://e8fe33b52f90d4bc7a4e75800945df449d1a091bd347c9f11cd1dbcd98ea28cb4c231cb3b1c6feacdabca2aa91f1a6744724b44edc9382c107968792abdef261@52.74.18.182:30303", "enode://b240f1f18e8f3cc61df96a164ba215ea6fc3f00717e4300da6283362a0438bda53f81ecc24c575ff130066d42096319fa027c952681bbb4f003e0bdd5d5b4e61@52.76.37.145:30303", "enode://de55d16b6e1fca28cdd3d11eb0dd89e3b77b96d4722172bd5e04ac255922324076a87748e97bc021af2307dccbb5ef8062389cfcba1845f77219eee7935dea9f@52.74.125.36:30303", "enode://7f2272685fc3e31c8e43c7687dda43ea3192fd310ba01efcb7811d5dc7ad5a64402ea8cd827650e573a174cf29bb69331dffcca6f0b9894ef17eeafabd97a41d@47.128.184.10:30303", "enode://c66e12243b425b63528dd8b1ce87f2f7fbc85f35485e2d8bf6bbf0ec0dcd05b3a582ef62daadbde061b58058735788335d09ed972a451242b9943b85d323c239@63.32.214.97:30303", "enode://bd56c0f00dd37e14ae2b84f5eb50e357d3a2d326bdbb0cbb987411268b3f132288f6c86157fc132c6902d18b9be0de8bbdcd12d926e16232ebadd8e274aae780@52.208.81.179:30303", "enode://2f015d5b1571165975382281a2117a9b514e1b38e87a8116596fc9b3b121a93cfb238eb6f7b3ae30cf9c0154384372745ce9edc09cbc30526ab7e2059f57ddee@54.74.160.230:30303" ]
|
||||||
# trusted-nodes = []
|
# trusted-nodes = []
|
||||||
# dns = []
|
dns = [ "enrtree://AKUEZKN7PSKVNR65FZDHECMKOJQSGPARGTPPBI7WS2VUL4EGR6XPC@amoy.polygon-peers.io" ]
|
||||||
|
|
||||||
# [heimdall]
|
# [heimdall]
|
||||||
# url = "http://localhost:1317"
|
# url = "http://localhost:1317"
|
||||||
|
|
@ -168,6 +168,11 @@ syncmode = "full"
|
||||||
# period = 0
|
# period = 0
|
||||||
# gaslimit = 11500000
|
# gaslimit = 11500000
|
||||||
|
|
||||||
|
# [parallelevm]
|
||||||
|
# enable = true
|
||||||
|
# procs = 8
|
||||||
|
# enforce = false
|
||||||
|
|
||||||
# [pprof]
|
# [pprof]
|
||||||
# pprof = false
|
# pprof = false
|
||||||
# port = 6060
|
# port = 6060
|
||||||
|
|
|
||||||
|
|
@ -35,14 +35,14 @@ syncmode = "full"
|
||||||
# nodekey = ""
|
# nodekey = ""
|
||||||
# nodekeyhex = ""
|
# nodekeyhex = ""
|
||||||
# txarrivalwait = "500ms"
|
# txarrivalwait = "500ms"
|
||||||
# [p2p.discovery]
|
[p2p.discovery]
|
||||||
# v5disc = false
|
# v5disc = false
|
||||||
# bootnodesv4 = []
|
# bootnodesv4 = []
|
||||||
# bootnodesv5 = []
|
# bootnodesv5 = []
|
||||||
bootnodes = [ "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303" ]
|
bootnodes = [ "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303" ]
|
||||||
static-nodes = [ "enode://383ec39eb7f7e23538ea846f502602632110a6bcfc7521bfc2b8833f5a190779507d006b28650d83674b75d188cb36bcb3c3e168a0f2b3d98f9a651cc6603146@52.214.229.208:30303", "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://a4a387ad423a2fd0d652808b270082250d3c616b7e8537209584ebad4806dd50ef8dc66a371c85c7f55e6c1f53747edbb11055c8073cfacf312047eaeb328f58@54.171.220.164:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303", "enode://e8fe33b52f90d4bc7a4e75800945df449d1a091bd347c9f11cd1dbcd98ea28cb4c231cb3b1c6feacdabca2aa91f1a6744724b44edc9382c107968792abdef261@52.74.18.182:30303", "enode://b240f1f18e8f3cc61df96a164ba215ea6fc3f00717e4300da6283362a0438bda53f81ecc24c575ff130066d42096319fa027c952681bbb4f003e0bdd5d5b4e61@52.76.37.145:30303", "enode://de55d16b6e1fca28cdd3d11eb0dd89e3b77b96d4722172bd5e04ac255922324076a87748e97bc021af2307dccbb5ef8062389cfcba1845f77219eee7935dea9f@52.74.125.36:30303", "enode://7f2272685fc3e31c8e43c7687dda43ea3192fd310ba01efcb7811d5dc7ad5a64402ea8cd827650e573a174cf29bb69331dffcca6f0b9894ef17eeafabd97a41d@47.128.184.10:30303", "enode://c66e12243b425b63528dd8b1ce87f2f7fbc85f35485e2d8bf6bbf0ec0dcd05b3a582ef62daadbde061b58058735788335d09ed972a451242b9943b85d323c239@63.32.214.97:30303", "enode://bd56c0f00dd37e14ae2b84f5eb50e357d3a2d326bdbb0cbb987411268b3f132288f6c86157fc132c6902d18b9be0de8bbdcd12d926e16232ebadd8e274aae780@52.208.81.179:30303", "enode://2f015d5b1571165975382281a2117a9b514e1b38e87a8116596fc9b3b121a93cfb238eb6f7b3ae30cf9c0154384372745ce9edc09cbc30526ab7e2059f57ddee@54.74.160.230:30303" ]
|
static-nodes = [ "enode://383ec39eb7f7e23538ea846f502602632110a6bcfc7521bfc2b8833f5a190779507d006b28650d83674b75d188cb36bcb3c3e168a0f2b3d98f9a651cc6603146@52.214.229.208:30303", "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://a4a387ad423a2fd0d652808b270082250d3c616b7e8537209584ebad4806dd50ef8dc66a371c85c7f55e6c1f53747edbb11055c8073cfacf312047eaeb328f58@54.171.220.164:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303", "enode://e8fe33b52f90d4bc7a4e75800945df449d1a091bd347c9f11cd1dbcd98ea28cb4c231cb3b1c6feacdabca2aa91f1a6744724b44edc9382c107968792abdef261@52.74.18.182:30303", "enode://b240f1f18e8f3cc61df96a164ba215ea6fc3f00717e4300da6283362a0438bda53f81ecc24c575ff130066d42096319fa027c952681bbb4f003e0bdd5d5b4e61@52.76.37.145:30303", "enode://de55d16b6e1fca28cdd3d11eb0dd89e3b77b96d4722172bd5e04ac255922324076a87748e97bc021af2307dccbb5ef8062389cfcba1845f77219eee7935dea9f@52.74.125.36:30303", "enode://7f2272685fc3e31c8e43c7687dda43ea3192fd310ba01efcb7811d5dc7ad5a64402ea8cd827650e573a174cf29bb69331dffcca6f0b9894ef17eeafabd97a41d@47.128.184.10:30303", "enode://c66e12243b425b63528dd8b1ce87f2f7fbc85f35485e2d8bf6bbf0ec0dcd05b3a582ef62daadbde061b58058735788335d09ed972a451242b9943b85d323c239@63.32.214.97:30303", "enode://bd56c0f00dd37e14ae2b84f5eb50e357d3a2d326bdbb0cbb987411268b3f132288f6c86157fc132c6902d18b9be0de8bbdcd12d926e16232ebadd8e274aae780@52.208.81.179:30303", "enode://2f015d5b1571165975382281a2117a9b514e1b38e87a8116596fc9b3b121a93cfb238eb6f7b3ae30cf9c0154384372745ce9edc09cbc30526ab7e2059f57ddee@54.74.160.230:30303" ]
|
||||||
# trusted-nodes = []
|
# trusted-nodes = []
|
||||||
# dns = []
|
dns = [ "enrtree://AKUEZKN7PSKVNR65FZDHECMKOJQSGPARGTPPBI7WS2VUL4EGR6XPC@amoy.polygon-peers.io" ]
|
||||||
|
|
||||||
# [heimdall]
|
# [heimdall]
|
||||||
# url = "http://localhost:1317"
|
# url = "http://localhost:1317"
|
||||||
|
|
@ -169,6 +169,11 @@ syncmode = "full"
|
||||||
# period = 0
|
# period = 0
|
||||||
# gaslimit = 11500000
|
# gaslimit = 11500000
|
||||||
|
|
||||||
|
# [parallelevm]
|
||||||
|
# enable = true
|
||||||
|
# procs = 8
|
||||||
|
# enforce = false
|
||||||
|
|
||||||
# pprof = false
|
# pprof = false
|
||||||
# port = 6060
|
# port = 6060
|
||||||
# addr = "127.0.0.1"
|
# addr = "127.0.0.1"
|
||||||
|
|
|
||||||
|
|
@ -36,14 +36,14 @@ syncmode = "full"
|
||||||
# nodekey = ""
|
# nodekey = ""
|
||||||
# nodekeyhex = ""
|
# nodekeyhex = ""
|
||||||
# txarrivalwait = "500ms"
|
# txarrivalwait = "500ms"
|
||||||
# [p2p.discovery]
|
[p2p.discovery]
|
||||||
# v5disc = false
|
# v5disc = false
|
||||||
# bootnodesv4 = []
|
# bootnodesv4 = []
|
||||||
# bootnodesv5 = []
|
# bootnodesv5 = []
|
||||||
bootnodes = [ "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303" ]
|
bootnodes = [ "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303" ]
|
||||||
static-nodes = [ "enode://383ec39eb7f7e23538ea846f502602632110a6bcfc7521bfc2b8833f5a190779507d006b28650d83674b75d188cb36bcb3c3e168a0f2b3d98f9a651cc6603146@52.214.229.208:30303", "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://a4a387ad423a2fd0d652808b270082250d3c616b7e8537209584ebad4806dd50ef8dc66a371c85c7f55e6c1f53747edbb11055c8073cfacf312047eaeb328f58@54.171.220.164:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303", "enode://e8fe33b52f90d4bc7a4e75800945df449d1a091bd347c9f11cd1dbcd98ea28cb4c231cb3b1c6feacdabca2aa91f1a6744724b44edc9382c107968792abdef261@52.74.18.182:30303", "enode://b240f1f18e8f3cc61df96a164ba215ea6fc3f00717e4300da6283362a0438bda53f81ecc24c575ff130066d42096319fa027c952681bbb4f003e0bdd5d5b4e61@52.76.37.145:30303", "enode://de55d16b6e1fca28cdd3d11eb0dd89e3b77b96d4722172bd5e04ac255922324076a87748e97bc021af2307dccbb5ef8062389cfcba1845f77219eee7935dea9f@52.74.125.36:30303", "enode://7f2272685fc3e31c8e43c7687dda43ea3192fd310ba01efcb7811d5dc7ad5a64402ea8cd827650e573a174cf29bb69331dffcca6f0b9894ef17eeafabd97a41d@47.128.184.10:30303", "enode://c66e12243b425b63528dd8b1ce87f2f7fbc85f35485e2d8bf6bbf0ec0dcd05b3a582ef62daadbde061b58058735788335d09ed972a451242b9943b85d323c239@63.32.214.97:30303", "enode://bd56c0f00dd37e14ae2b84f5eb50e357d3a2d326bdbb0cbb987411268b3f132288f6c86157fc132c6902d18b9be0de8bbdcd12d926e16232ebadd8e274aae780@52.208.81.179:30303", "enode://2f015d5b1571165975382281a2117a9b514e1b38e87a8116596fc9b3b121a93cfb238eb6f7b3ae30cf9c0154384372745ce9edc09cbc30526ab7e2059f57ddee@54.74.160.230:30303" ]
|
static-nodes = [ "enode://383ec39eb7f7e23538ea846f502602632110a6bcfc7521bfc2b8833f5a190779507d006b28650d83674b75d188cb36bcb3c3e168a0f2b3d98f9a651cc6603146@52.214.229.208:30303", "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://a4a387ad423a2fd0d652808b270082250d3c616b7e8537209584ebad4806dd50ef8dc66a371c85c7f55e6c1f53747edbb11055c8073cfacf312047eaeb328f58@54.171.220.164:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303", "enode://e8fe33b52f90d4bc7a4e75800945df449d1a091bd347c9f11cd1dbcd98ea28cb4c231cb3b1c6feacdabca2aa91f1a6744724b44edc9382c107968792abdef261@52.74.18.182:30303", "enode://b240f1f18e8f3cc61df96a164ba215ea6fc3f00717e4300da6283362a0438bda53f81ecc24c575ff130066d42096319fa027c952681bbb4f003e0bdd5d5b4e61@52.76.37.145:30303", "enode://de55d16b6e1fca28cdd3d11eb0dd89e3b77b96d4722172bd5e04ac255922324076a87748e97bc021af2307dccbb5ef8062389cfcba1845f77219eee7935dea9f@52.74.125.36:30303", "enode://7f2272685fc3e31c8e43c7687dda43ea3192fd310ba01efcb7811d5dc7ad5a64402ea8cd827650e573a174cf29bb69331dffcca6f0b9894ef17eeafabd97a41d@47.128.184.10:30303", "enode://c66e12243b425b63528dd8b1ce87f2f7fbc85f35485e2d8bf6bbf0ec0dcd05b3a582ef62daadbde061b58058735788335d09ed972a451242b9943b85d323c239@63.32.214.97:30303", "enode://bd56c0f00dd37e14ae2b84f5eb50e357d3a2d326bdbb0cbb987411268b3f132288f6c86157fc132c6902d18b9be0de8bbdcd12d926e16232ebadd8e274aae780@52.208.81.179:30303", "enode://2f015d5b1571165975382281a2117a9b514e1b38e87a8116596fc9b3b121a93cfb238eb6f7b3ae30cf9c0154384372745ce9edc09cbc30526ab7e2059f57ddee@54.74.160.230:30303" ]
|
||||||
# trusted-nodes = []
|
# trusted-nodes = []
|
||||||
# dns = []
|
dns = [ "enrtree://AKUEZKN7PSKVNR65FZDHECMKOJQSGPARGTPPBI7WS2VUL4EGR6XPC@amoy.polygon-peers.io" ]
|
||||||
|
|
||||||
# [heimdall]
|
# [heimdall]
|
||||||
# url = "http://localhost:1317"
|
# url = "http://localhost:1317"
|
||||||
|
|
@ -170,6 +170,11 @@ syncmode = "full"
|
||||||
# period = 0
|
# period = 0
|
||||||
# gaslimit = 11500000
|
# gaslimit = 11500000
|
||||||
|
|
||||||
|
# [parallelevm]
|
||||||
|
# enable = true
|
||||||
|
# procs = 8
|
||||||
|
# enforce = false
|
||||||
|
|
||||||
# pprof = false
|
# pprof = false
|
||||||
# port = 6060
|
# port = 6060
|
||||||
# addr = "127.0.0.1"
|
# addr = "127.0.0.1"
|
||||||
|
|
|
||||||
|
|
@ -35,14 +35,14 @@ syncmode = "full"
|
||||||
# nodekey = ""
|
# nodekey = ""
|
||||||
# nodekeyhex = ""
|
# nodekeyhex = ""
|
||||||
# txarrivalwait = "500ms"
|
# txarrivalwait = "500ms"
|
||||||
# [p2p.discovery]
|
[p2p.discovery]
|
||||||
# v5disc = false
|
# v5disc = false
|
||||||
# bootnodesv4 = []
|
# bootnodesv4 = []
|
||||||
# bootnodesv5 = []
|
# bootnodesv5 = []
|
||||||
bootnodes = [ "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303" ]
|
bootnodes = [ "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303" ]
|
||||||
static-nodes = [ "enode://383ec39eb7f7e23538ea846f502602632110a6bcfc7521bfc2b8833f5a190779507d006b28650d83674b75d188cb36bcb3c3e168a0f2b3d98f9a651cc6603146@52.214.229.208:30303", "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://a4a387ad423a2fd0d652808b270082250d3c616b7e8537209584ebad4806dd50ef8dc66a371c85c7f55e6c1f53747edbb11055c8073cfacf312047eaeb328f58@54.171.220.164:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303", "enode://e8fe33b52f90d4bc7a4e75800945df449d1a091bd347c9f11cd1dbcd98ea28cb4c231cb3b1c6feacdabca2aa91f1a6744724b44edc9382c107968792abdef261@52.74.18.182:30303", "enode://b240f1f18e8f3cc61df96a164ba215ea6fc3f00717e4300da6283362a0438bda53f81ecc24c575ff130066d42096319fa027c952681bbb4f003e0bdd5d5b4e61@52.76.37.145:30303", "enode://de55d16b6e1fca28cdd3d11eb0dd89e3b77b96d4722172bd5e04ac255922324076a87748e97bc021af2307dccbb5ef8062389cfcba1845f77219eee7935dea9f@52.74.125.36:30303", "enode://7f2272685fc3e31c8e43c7687dda43ea3192fd310ba01efcb7811d5dc7ad5a64402ea8cd827650e573a174cf29bb69331dffcca6f0b9894ef17eeafabd97a41d@47.128.184.10:30303", "enode://c66e12243b425b63528dd8b1ce87f2f7fbc85f35485e2d8bf6bbf0ec0dcd05b3a582ef62daadbde061b58058735788335d09ed972a451242b9943b85d323c239@63.32.214.97:30303", "enode://bd56c0f00dd37e14ae2b84f5eb50e357d3a2d326bdbb0cbb987411268b3f132288f6c86157fc132c6902d18b9be0de8bbdcd12d926e16232ebadd8e274aae780@52.208.81.179:30303", "enode://2f015d5b1571165975382281a2117a9b514e1b38e87a8116596fc9b3b121a93cfb238eb6f7b3ae30cf9c0154384372745ce9edc09cbc30526ab7e2059f57ddee@54.74.160.230:30303" ]
|
static-nodes = [ "enode://383ec39eb7f7e23538ea846f502602632110a6bcfc7521bfc2b8833f5a190779507d006b28650d83674b75d188cb36bcb3c3e168a0f2b3d98f9a651cc6603146@52.214.229.208:30303", "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://a4a387ad423a2fd0d652808b270082250d3c616b7e8537209584ebad4806dd50ef8dc66a371c85c7f55e6c1f53747edbb11055c8073cfacf312047eaeb328f58@54.171.220.164:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303", "enode://e8fe33b52f90d4bc7a4e75800945df449d1a091bd347c9f11cd1dbcd98ea28cb4c231cb3b1c6feacdabca2aa91f1a6744724b44edc9382c107968792abdef261@52.74.18.182:30303", "enode://b240f1f18e8f3cc61df96a164ba215ea6fc3f00717e4300da6283362a0438bda53f81ecc24c575ff130066d42096319fa027c952681bbb4f003e0bdd5d5b4e61@52.76.37.145:30303", "enode://de55d16b6e1fca28cdd3d11eb0dd89e3b77b96d4722172bd5e04ac255922324076a87748e97bc021af2307dccbb5ef8062389cfcba1845f77219eee7935dea9f@52.74.125.36:30303", "enode://7f2272685fc3e31c8e43c7687dda43ea3192fd310ba01efcb7811d5dc7ad5a64402ea8cd827650e573a174cf29bb69331dffcca6f0b9894ef17eeafabd97a41d@47.128.184.10:30303", "enode://c66e12243b425b63528dd8b1ce87f2f7fbc85f35485e2d8bf6bbf0ec0dcd05b3a582ef62daadbde061b58058735788335d09ed972a451242b9943b85d323c239@63.32.214.97:30303", "enode://bd56c0f00dd37e14ae2b84f5eb50e357d3a2d326bdbb0cbb987411268b3f132288f6c86157fc132c6902d18b9be0de8bbdcd12d926e16232ebadd8e274aae780@52.208.81.179:30303", "enode://2f015d5b1571165975382281a2117a9b514e1b38e87a8116596fc9b3b121a93cfb238eb6f7b3ae30cf9c0154384372745ce9edc09cbc30526ab7e2059f57ddee@54.74.160.230:30303" ]
|
||||||
# trusted-nodes = []
|
# trusted-nodes = []
|
||||||
# dns = []
|
dns = [ "enrtree://AKUEZKN7PSKVNR65FZDHECMKOJQSGPARGTPPBI7WS2VUL4EGR6XPC@amoy.polygon-peers.io" ]
|
||||||
|
|
||||||
# [heimdall]
|
# [heimdall]
|
||||||
# url = "http://localhost:1317"
|
# url = "http://localhost:1317"
|
||||||
|
|
@ -169,6 +169,11 @@ syncmode = "full"
|
||||||
# period = 0
|
# period = 0
|
||||||
# gaslimit = 11500000
|
# gaslimit = 11500000
|
||||||
|
|
||||||
|
# [parallelevm]
|
||||||
|
# enable = true
|
||||||
|
# procs = 8
|
||||||
|
# enforce = false
|
||||||
|
|
||||||
# [pprof]
|
# [pprof]
|
||||||
# pprof = false
|
# pprof = false
|
||||||
# port = 6060
|
# port = 6060
|
||||||
|
|
|
||||||
|
|
@ -36,14 +36,14 @@ syncmode = "full"
|
||||||
# nodekey = ""
|
# nodekey = ""
|
||||||
# nodekeyhex = ""
|
# nodekeyhex = ""
|
||||||
# txarrivalwait = "500ms"
|
# txarrivalwait = "500ms"
|
||||||
# [p2p.discovery]
|
[p2p.discovery]
|
||||||
# v5disc = false
|
# v5disc = false
|
||||||
# bootnodesv5 = []
|
# bootnodesv5 = []
|
||||||
# bootnodesv4 = []
|
# bootnodesv4 = []
|
||||||
bootnodes = [ "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303" ]
|
bootnodes = [ "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303" ]
|
||||||
static-nodes = [ "enode://383ec39eb7f7e23538ea846f502602632110a6bcfc7521bfc2b8833f5a190779507d006b28650d83674b75d188cb36bcb3c3e168a0f2b3d98f9a651cc6603146@52.214.229.208:30303", "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://a4a387ad423a2fd0d652808b270082250d3c616b7e8537209584ebad4806dd50ef8dc66a371c85c7f55e6c1f53747edbb11055c8073cfacf312047eaeb328f58@54.171.220.164:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303", "enode://e8fe33b52f90d4bc7a4e75800945df449d1a091bd347c9f11cd1dbcd98ea28cb4c231cb3b1c6feacdabca2aa91f1a6744724b44edc9382c107968792abdef261@52.74.18.182:30303", "enode://b240f1f18e8f3cc61df96a164ba215ea6fc3f00717e4300da6283362a0438bda53f81ecc24c575ff130066d42096319fa027c952681bbb4f003e0bdd5d5b4e61@52.76.37.145:30303", "enode://de55d16b6e1fca28cdd3d11eb0dd89e3b77b96d4722172bd5e04ac255922324076a87748e97bc021af2307dccbb5ef8062389cfcba1845f77219eee7935dea9f@52.74.125.36:30303", "enode://7f2272685fc3e31c8e43c7687dda43ea3192fd310ba01efcb7811d5dc7ad5a64402ea8cd827650e573a174cf29bb69331dffcca6f0b9894ef17eeafabd97a41d@47.128.184.10:30303", "enode://c66e12243b425b63528dd8b1ce87f2f7fbc85f35485e2d8bf6bbf0ec0dcd05b3a582ef62daadbde061b58058735788335d09ed972a451242b9943b85d323c239@63.32.214.97:30303", "enode://bd56c0f00dd37e14ae2b84f5eb50e357d3a2d326bdbb0cbb987411268b3f132288f6c86157fc132c6902d18b9be0de8bbdcd12d926e16232ebadd8e274aae780@52.208.81.179:30303", "enode://2f015d5b1571165975382281a2117a9b514e1b38e87a8116596fc9b3b121a93cfb238eb6f7b3ae30cf9c0154384372745ce9edc09cbc30526ab7e2059f57ddee@54.74.160.230:30303" ]
|
static-nodes = [ "enode://383ec39eb7f7e23538ea846f502602632110a6bcfc7521bfc2b8833f5a190779507d006b28650d83674b75d188cb36bcb3c3e168a0f2b3d98f9a651cc6603146@52.214.229.208:30303", "enode://bce861be777e91b0a5a49d58a51e14f32f201b4c6c2d1fbea6c7a1f14756cbb3f931f3188d6b65de8b07b53ff28d03b6e366d09e56360d2124a9fc5a15a0913d@54.217.171.196:30303", "enode://a4a387ad423a2fd0d652808b270082250d3c616b7e8537209584ebad4806dd50ef8dc66a371c85c7f55e6c1f53747edbb11055c8073cfacf312047eaeb328f58@54.171.220.164:30303", "enode://4a3dc0081a346d26a73d79dd88216a9402d2292318e2db9947dbc97ea9c4afb2498dc519c0af04420dc13a238c279062da0320181e7c1461216ce4513bfd40bf@13.251.184.185:30303", "enode://e8fe33b52f90d4bc7a4e75800945df449d1a091bd347c9f11cd1dbcd98ea28cb4c231cb3b1c6feacdabca2aa91f1a6744724b44edc9382c107968792abdef261@52.74.18.182:30303", "enode://b240f1f18e8f3cc61df96a164ba215ea6fc3f00717e4300da6283362a0438bda53f81ecc24c575ff130066d42096319fa027c952681bbb4f003e0bdd5d5b4e61@52.76.37.145:30303", "enode://de55d16b6e1fca28cdd3d11eb0dd89e3b77b96d4722172bd5e04ac255922324076a87748e97bc021af2307dccbb5ef8062389cfcba1845f77219eee7935dea9f@52.74.125.36:30303", "enode://7f2272685fc3e31c8e43c7687dda43ea3192fd310ba01efcb7811d5dc7ad5a64402ea8cd827650e573a174cf29bb69331dffcca6f0b9894ef17eeafabd97a41d@47.128.184.10:30303", "enode://c66e12243b425b63528dd8b1ce87f2f7fbc85f35485e2d8bf6bbf0ec0dcd05b3a582ef62daadbde061b58058735788335d09ed972a451242b9943b85d323c239@63.32.214.97:30303", "enode://bd56c0f00dd37e14ae2b84f5eb50e357d3a2d326bdbb0cbb987411268b3f132288f6c86157fc132c6902d18b9be0de8bbdcd12d926e16232ebadd8e274aae780@52.208.81.179:30303", "enode://2f015d5b1571165975382281a2117a9b514e1b38e87a8116596fc9b3b121a93cfb238eb6f7b3ae30cf9c0154384372745ce9edc09cbc30526ab7e2059f57ddee@54.74.160.230:30303" ]
|
||||||
# trusted-nodes = []
|
# trusted-nodes = []
|
||||||
# dns = []
|
dns = [ "enrtree://AKUEZKN7PSKVNR65FZDHECMKOJQSGPARGTPPBI7WS2VUL4EGR6XPC@amoy.polygon-peers.io" ]
|
||||||
|
|
||||||
# [heimdall]
|
# [heimdall]
|
||||||
# url = "http://localhost:1317"
|
# url = "http://localhost:1317"
|
||||||
|
|
@ -170,6 +170,11 @@ syncmode = "full"
|
||||||
# period = 0
|
# period = 0
|
||||||
# gaslimit = 11500000
|
# gaslimit = 11500000
|
||||||
|
|
||||||
|
# [parallelevm]
|
||||||
|
# enable = true
|
||||||
|
# procs = 8
|
||||||
|
# enforce = false
|
||||||
|
|
||||||
# [pprof]
|
# [pprof]
|
||||||
# pprof = false
|
# pprof = false
|
||||||
# port = 6060
|
# port = 6060
|
||||||
|
|
|
||||||
|
|
@ -22,9 +22,9 @@ import (
|
||||||
|
|
||||||
const (
|
const (
|
||||||
VersionMajor = 1 // Major version component of the current release
|
VersionMajor = 1 // Major version component of the current release
|
||||||
VersionMinor = 14 // Minor version component of the current release
|
VersionMinor = 5 // Minor version component of the current release
|
||||||
VersionPatch = 10 // Patch version component of the current release
|
VersionPatch = 5 // Patch version component of the current release
|
||||||
VersionMeta = "stable" // Version metadata to append to the version string
|
VersionMeta = "" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
|
||||||
var GitCommit string
|
var GitCommit string
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,6 @@
|
||||||
package bor
|
package bor
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
|
||||||
"crypto/ecdsa"
|
"crypto/ecdsa"
|
||||||
"encoding/hex"
|
"encoding/hex"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
|
@ -219,8 +218,6 @@ func buildNextBlock(t *testing.T, _bor consensus.Engine, chain *core.BlockChain,
|
||||||
b.addTxWithChain(chain, state, tx, addr)
|
b.addTxWithChain(chain, state, tx, addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
ctx := context.Background()
|
|
||||||
|
|
||||||
// Finalize and seal the block
|
// Finalize and seal the block
|
||||||
block, err := _bor.FinalizeAndAssemble(chain, b.header, state, &types.Body{
|
block, err := _bor.FinalizeAndAssemble(chain, b.header, state, &types.Body{
|
||||||
Transactions: b.txs,
|
Transactions: b.txs,
|
||||||
|
|
@ -242,7 +239,7 @@ func buildNextBlock(t *testing.T, _bor consensus.Engine, chain *core.BlockChain,
|
||||||
|
|
||||||
res := make(chan *types.Block, 1)
|
res := make(chan *types.Block, 1)
|
||||||
|
|
||||||
err = _bor.Seal(ctx, chain, block, res, nil)
|
err = _bor.Seal(chain, block, res, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// an error case - sign manually
|
// an error case - sign manually
|
||||||
sign(t, header, signer, borConfig)
|
sign(t, header, signer, borConfig)
|
||||||
|
|
|
||||||
|
|
@ -319,7 +319,7 @@ func (t *StateTest) RunNoVerify(subtest StateSubtest, vmconfig vm.Config, snapsh
|
||||||
snapshot := st.StateDB.Snapshot()
|
snapshot := st.StateDB.Snapshot()
|
||||||
gaspool := new(core.GasPool)
|
gaspool := new(core.GasPool)
|
||||||
gaspool.AddGas(block.GasLimit())
|
gaspool.AddGas(block.GasLimit())
|
||||||
vmRet, err := core.ApplyMessage(evm, msg, gaspool)
|
vmRet, err := core.ApplyMessage(evm, msg, gaspool, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
st.StateDB.RevertToSnapshot(snapshot)
|
st.StateDB.RevertToSnapshot(snapshot)
|
||||||
if tracer := evm.Config.Tracer; tracer != nil && tracer.OnTxEnd != nil {
|
if tracer := evm.Config.Tracer; tracer != nil && tracer.OnTxEnd != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue