mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
Merge pull request #1230 from maticnetwork/v1.3.1
v1.3.1 Stable Release
This commit is contained in:
commit
b8ad00095a
40 changed files with 479 additions and 113 deletions
|
|
@ -6,8 +6,6 @@ run:
|
||||||
# default is true. Enables skipping of directories:
|
# default is true. Enables skipping of directories:
|
||||||
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
|
# vendor$, third_party$, testdata$, examples$, Godeps$, builtin$
|
||||||
skip-dirs-use-default: true
|
skip-dirs-use-default: true
|
||||||
skip-files:
|
|
||||||
- core/genesis_alloc.go
|
|
||||||
|
|
||||||
linters:
|
linters:
|
||||||
disable-all: true
|
disable-all: true
|
||||||
|
|
@ -44,6 +42,8 @@ linters-settings:
|
||||||
min-occurrences: 6 # minimum number of occurrences
|
min-occurrences: 6 # minimum number of occurrences
|
||||||
|
|
||||||
issues:
|
issues:
|
||||||
|
exclude-files:
|
||||||
|
- core/genesis_alloc.go
|
||||||
exclude-rules:
|
exclude-rules:
|
||||||
- path: crypto/bn256/cloudflare/optate.go
|
- path: crypto/bn256/cloudflare/optate.go
|
||||||
linters:
|
linters:
|
||||||
|
|
@ -64,4 +64,4 @@ issues:
|
||||||
- 'SA1029: should not use built-in type string as key for value'
|
- 'SA1029: should not use built-in type string as key for value'
|
||||||
- 'SA1019: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package [io] or package [os], and those implementations should be preferred in new code. See the specific function documentation for details'
|
- 'SA1019: "io/ioutil" has been deprecated since Go 1.19: As of Go 1.16, the same functionality is now provided by package [io] or package [os], and those implementations should be preferred in new code. See the specific function documentation for details'
|
||||||
- 'SA1019: grpc.WithInsecure is deprecated: use WithTransportCredentials and insecure.NewCredentials() instead. Will be supported throughout 1.x'
|
- 'SA1019: grpc.WithInsecure is deprecated: use WithTransportCredentials and insecure.NewCredentials() instead. Will be supported throughout 1.x'
|
||||||
- "SA1019: rand.Read has been deprecated since Go 1.20 because it shouldn't be used: For almost all use cases, crypto/rand.Read is more appropriate"
|
- "SA1019: rand.Read has been deprecated since Go 1.20 because it shouldn't be used: For almost all use cases, crypto/rand.Read is more appropriate"
|
||||||
2
Makefile
2
Makefile
|
|
@ -80,7 +80,7 @@ lint:
|
||||||
|
|
||||||
lintci-deps:
|
lintci-deps:
|
||||||
rm -f ./build/bin/golangci-lint
|
rm -f ./build/bin/golangci-lint
|
||||||
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.53.3
|
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ./build/bin v1.57.2
|
||||||
|
|
||||||
goimports:
|
goimports:
|
||||||
goimports -local "$(PACKAGE)" -w .
|
goimports -local "$(PACKAGE)" -w .
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,7 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/core"
|
"github.com/ethereum/go-ethereum/core"
|
||||||
"github.com/ethereum/go-ethereum/core/types"
|
"github.com/ethereum/go-ethereum/core/types"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
|
"github.com/ethereum/go-ethereum/params"
|
||||||
)
|
)
|
||||||
|
|
||||||
var testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
var testKey, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
||||||
|
|
@ -64,7 +65,7 @@ func TestWaitDeployed(t *testing.T) {
|
||||||
|
|
||||||
// Create the transaction
|
// Create the transaction
|
||||||
head, _ := backend.HeaderByNumber(context.Background(), nil) // Should be child's, good enough
|
head, _ := backend.HeaderByNumber(context.Background(), nil) // Should be child's, good enough
|
||||||
gasPrice := new(big.Int).Add(head.BaseFee, big.NewInt(1))
|
gasPrice := new(big.Int).Add(head.BaseFee, big.NewInt(params.GWei))
|
||||||
|
|
||||||
tx := types.NewContractCreation(0, big.NewInt(0), test.gas, gasPrice, common.FromHex(test.code))
|
tx := types.NewContractCreation(0, big.NewInt(0), test.gas, gasPrice, common.FromHex(test.code))
|
||||||
tx, _ = types.SignTx(tx, types.HomesteadSigner{}, testKey)
|
tx, _ = types.SignTx(tx, types.HomesteadSigner{}, testKey)
|
||||||
|
|
|
||||||
BIN
audit/audit-feature-milestones.pdf
Normal file
BIN
audit/audit-feature-milestones.pdf
Normal file
Binary file not shown.
|
|
@ -883,6 +883,10 @@ func (c *Bor) changeContractCodeIfNeeded(headerNumber uint64, state *state.State
|
||||||
for addr, account := range allocs {
|
for addr, account := range allocs {
|
||||||
log.Info("change contract code", "address", addr)
|
log.Info("change contract code", "address", addr)
|
||||||
state.SetCode(addr, account.Code)
|
state.SetCode(addr, account.Code)
|
||||||
|
|
||||||
|
if state.GetBalance(addr).Cmp(big.NewInt(0)) == 0 {
|
||||||
|
state.SetBalance(addr, account.Balance)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -41,6 +41,12 @@ func TestGenesisContractChange(t *testing.T) {
|
||||||
"balance": "0x1000",
|
"balance": "0x1000",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"6": map[string]interface{}{
|
||||||
|
addr0.Hex(): map[string]interface{}{
|
||||||
|
"code": hexutil.Bytes{0x1, 0x4},
|
||||||
|
"balance": "0x2000",
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
@ -87,24 +93,35 @@ func TestGenesisContractChange(t *testing.T) {
|
||||||
|
|
||||||
root := genesis.Root()
|
root := genesis.Root()
|
||||||
|
|
||||||
// code does not change
|
// code does not change, balance remains 0
|
||||||
root, statedb = addBlock(root, 1)
|
root, statedb = addBlock(root, 1)
|
||||||
require.Equal(t, statedb.GetCode(addr0), []byte{0x1, 0x1})
|
require.Equal(t, statedb.GetCode(addr0), []byte{0x1, 0x1})
|
||||||
|
require.Equal(t, statedb.GetBalance(addr0), big.NewInt(0))
|
||||||
|
|
||||||
// code changes 1st time
|
// code changes 1st time, balance remains 0
|
||||||
root, statedb = addBlock(root, 2)
|
root, statedb = addBlock(root, 2)
|
||||||
require.Equal(t, statedb.GetCode(addr0), []byte{0x1, 0x2})
|
require.Equal(t, statedb.GetCode(addr0), []byte{0x1, 0x2})
|
||||||
|
require.Equal(t, statedb.GetBalance(addr0), big.NewInt(0))
|
||||||
|
|
||||||
// code same as 1st change
|
// code same as 1st change, balance remains 0
|
||||||
root, statedb = addBlock(root, 3)
|
root, statedb = addBlock(root, 3)
|
||||||
require.Equal(t, statedb.GetCode(addr0), []byte{0x1, 0x2})
|
require.Equal(t, statedb.GetCode(addr0), []byte{0x1, 0x2})
|
||||||
|
|
||||||
// code changes 2nd time
|
|
||||||
_, statedb = addBlock(root, 4)
|
|
||||||
require.Equal(t, statedb.GetCode(addr0), []byte{0x1, 0x3})
|
|
||||||
|
|
||||||
// make sure balance change DOES NOT take effect
|
|
||||||
require.Equal(t, statedb.GetBalance(addr0), big.NewInt(0))
|
require.Equal(t, statedb.GetBalance(addr0), big.NewInt(0))
|
||||||
|
|
||||||
|
// code changes 2nd time, balance updates to 4096
|
||||||
|
root, statedb = addBlock(root, 4)
|
||||||
|
require.Equal(t, statedb.GetCode(addr0), []byte{0x1, 0x3})
|
||||||
|
require.Equal(t, statedb.GetBalance(addr0), big.NewInt(4096))
|
||||||
|
|
||||||
|
// code same as 2nd change, balance remains 4096
|
||||||
|
root, statedb = addBlock(root, 5)
|
||||||
|
require.Equal(t, statedb.GetCode(addr0), []byte{0x1, 0x3})
|
||||||
|
require.Equal(t, statedb.GetBalance(addr0), big.NewInt(4096))
|
||||||
|
|
||||||
|
// code changes 3rd time, balance remains 4096
|
||||||
|
_, statedb = addBlock(root, 6)
|
||||||
|
require.Equal(t, statedb.GetCode(addr0), []byte{0x1, 0x4})
|
||||||
|
require.Equal(t, statedb.GetBalance(addr0), big.NewInt(4096))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestEncodeSigHeaderJaipur(t *testing.T) {
|
func TestEncodeSigHeaderJaipur(t *testing.T) {
|
||||||
|
|
|
||||||
|
|
@ -435,7 +435,7 @@ func verifyUpdates(updates []*Validator, vals *ValidatorSet) (updatedTotalVoting
|
||||||
_, val := vals.GetByAddress(address)
|
_, val := vals.GetByAddress(address)
|
||||||
|
|
||||||
if val == nil {
|
if val == nil {
|
||||||
// New validator, add its voting power the the total.
|
// New validator, add its voting power the total.
|
||||||
updatedTotalVotingPower += valUpdate.VotingPower
|
updatedTotalVotingPower += valUpdate.VotingPower
|
||||||
numNewValidators++
|
numNewValidators++
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
|
|
@ -158,7 +158,7 @@ func TestMVHashMapBasics(t *testing.T) {
|
||||||
mvh.Write(ap1, Version{10, 1}, valueFor(10, 1))
|
mvh.Write(ap1, Version{10, 1}, valueFor(10, 1))
|
||||||
|
|
||||||
res = mvh.Read(ap1, 9)
|
res = mvh.Read(ap1, 9)
|
||||||
require.Equal(t, -1, res.depIdx, "reads that should go the the DB return dependency -1")
|
require.Equal(t, -1, res.depIdx, "reads that should go the DB return dependency -1")
|
||||||
res = mvh.Read(ap1, 10)
|
res = mvh.Read(ap1, 10)
|
||||||
require.Equal(t, -1, res.depIdx, "Read returns entries from smaller txns, not txn 10")
|
require.Equal(t, -1, res.depIdx, "Read returns entries from smaller txns, not txn 10")
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -155,7 +155,8 @@ var DefaultConfig = Config{
|
||||||
AccountQueue: 64,
|
AccountQueue: 64,
|
||||||
GlobalQueue: 1024,
|
GlobalQueue: 1024,
|
||||||
|
|
||||||
Lifetime: 3 * time.Hour,
|
Lifetime: 3 * time.Hour,
|
||||||
|
AllowUnprotectedTxs: false,
|
||||||
}
|
}
|
||||||
|
|
||||||
// sanitize checks the provided user configurations and changes anything that's
|
// sanitize checks the provided user configurations and changes anything that's
|
||||||
|
|
@ -601,7 +602,8 @@ func (pool *LegacyPool) local() map[common.Address]types.Transactions {
|
||||||
// and does not require the pool mutex to be held.
|
// and does not require the pool mutex to be held.
|
||||||
func (pool *LegacyPool) validateTxBasics(tx *types.Transaction, local bool) error {
|
func (pool *LegacyPool) validateTxBasics(tx *types.Transaction, local bool) error {
|
||||||
opts := &txpool.ValidationOptions{
|
opts := &txpool.ValidationOptions{
|
||||||
Config: pool.chainconfig,
|
Config: pool.chainconfig,
|
||||||
|
AllowUnprotectedTxs: pool.config.AllowUnprotectedTxs,
|
||||||
Accept: 0 |
|
Accept: 0 |
|
||||||
1<<types.LegacyTxType |
|
1<<types.LegacyTxType |
|
||||||
1<<types.AccessListTxType |
|
1<<types.AccessListTxType |
|
||||||
|
|
@ -671,6 +673,11 @@ func (pool *LegacyPool) add(tx *types.Transaction, local bool) (replaced bool, e
|
||||||
knownTxMeter.Mark(1)
|
knownTxMeter.Mark(1)
|
||||||
return false, txpool.ErrAlreadyKnown
|
return false, txpool.ErrAlreadyKnown
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if pool.config.AllowUnprotectedTxs {
|
||||||
|
pool.signer = types.NewFakeSigner(tx.ChainId())
|
||||||
|
}
|
||||||
|
|
||||||
// Make the local flag. If it's from local source or it's from the network but
|
// Make the local flag. If it's from local source or it's from the network but
|
||||||
// the sender is marked as local previously, treat it as the local transaction.
|
// the sender is marked as local previously, treat it as the local transaction.
|
||||||
isLocal := local || pool.locals.containsTx(tx)
|
isLocal := local || pool.locals.containsTx(tx)
|
||||||
|
|
@ -984,6 +991,11 @@ func (pool *LegacyPool) Add(txs []*types.Transaction, local, sync bool) []error
|
||||||
knownTxMeter.Mark(1)
|
knownTxMeter.Mark(1)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if pool.config.AllowUnprotectedTxs {
|
||||||
|
pool.signer = types.NewFakeSigner(tx.ChainId())
|
||||||
|
}
|
||||||
|
|
||||||
// Exclude transactions with basic errors, e.g invalid signatures and
|
// Exclude transactions with basic errors, e.g invalid signatures and
|
||||||
// insufficient intrinsic gas as soon as possible and cache senders
|
// insufficient intrinsic gas as soon as possible and cache senders
|
||||||
// in transactions before obtaining lock
|
// in transactions before obtaining lock
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ package legacypool
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"crypto/ecdsa"
|
"crypto/ecdsa"
|
||||||
|
crand "crypto/rand"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
@ -30,7 +31,7 @@ import (
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/holiman/uint256"
|
"github.com/holiman/uint256"
|
||||||
"github.com/maticnetwork/crand"
|
crand2 "github.com/maticnetwork/crand"
|
||||||
|
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
"github.com/ethereum/go-ethereum/core"
|
"github.com/ethereum/go-ethereum/core"
|
||||||
|
|
@ -115,7 +116,7 @@ func pricedTransaction(nonce uint64, gaslimit uint64, gasprice *big.Int, key *ec
|
||||||
|
|
||||||
func pricedDataTransaction(nonce uint64, gaslimit uint64, gasprice *big.Int, key *ecdsa.PrivateKey, bytes uint64) *types.Transaction {
|
func pricedDataTransaction(nonce uint64, gaslimit uint64, gasprice *big.Int, key *ecdsa.PrivateKey, bytes uint64) *types.Transaction {
|
||||||
data := make([]byte, bytes)
|
data := make([]byte, bytes)
|
||||||
rand.Read(data)
|
crand.Read(data)
|
||||||
|
|
||||||
tx, _ := types.SignTx(types.NewTransaction(nonce, common.Address{}, big.NewInt(0), gaslimit, gasprice, data), types.HomesteadSigner{}, key)
|
tx, _ := types.SignTx(types.NewTransaction(nonce, common.Address{}, big.NewInt(0), gaslimit, gasprice, data), types.HomesteadSigner{}, key)
|
||||||
|
|
||||||
|
|
@ -3801,7 +3802,7 @@ func BenchmarkBigs(b *testing.B) {
|
||||||
var over bool
|
var over bool
|
||||||
|
|
||||||
for i := 0; i < len(ints); i++ {
|
for i := 0; i < len(ints); i++ {
|
||||||
ints[i] = crand.BigInt(max)
|
ints[i] = crand2.BigInt(max)
|
||||||
intUs[i], over = uint256.FromBig(ints[i])
|
intUs[i], over = uint256.FromBig(ints[i])
|
||||||
|
|
||||||
if over {
|
if over {
|
||||||
|
|
|
||||||
|
|
@ -35,6 +35,8 @@ import (
|
||||||
type ValidationOptions struct {
|
type ValidationOptions struct {
|
||||||
Config *params.ChainConfig // Chain configuration to selectively validate based on current fork rules
|
Config *params.ChainConfig // Chain configuration to selectively validate based on current fork rules
|
||||||
|
|
||||||
|
AllowUnprotectedTxs bool // Whether to allow unprotected transactions in the pool
|
||||||
|
|
||||||
Accept uint8 // Bitmap of transaction types that should be accepted for the calling pool
|
Accept uint8 // Bitmap of transaction types that should be accepted for the calling pool
|
||||||
MaxSize uint64 // Maximum size of a transaction that the caller can meaningfully handle
|
MaxSize uint64 // Maximum size of a transaction that the caller can meaningfully handle
|
||||||
MinTip *big.Int // Minimum gas tip needed to allow a transaction into the caller pool
|
MinTip *big.Int // Minimum gas tip needed to allow a transaction into the caller pool
|
||||||
|
|
@ -91,7 +93,7 @@ func ValidateTransaction(tx *types.Transaction, head *types.Header, signer types
|
||||||
return core.ErrTipAboveFeeCap
|
return core.ErrTipAboveFeeCap
|
||||||
}
|
}
|
||||||
// Make sure the transaction is signed properly
|
// Make sure the transaction is signed properly
|
||||||
if _, err := types.Sender(signer, tx); err != nil {
|
if _, err := types.Sender(signer, tx); err != nil && !opts.AllowUnprotectedTxs {
|
||||||
return ErrInvalidSender
|
return ErrInvalidSender
|
||||||
}
|
}
|
||||||
// Ensure the transaction has more gas than the bare minimum needed to cover
|
// Ensure the transaction has more gas than the bare minimum needed to cover
|
||||||
|
|
|
||||||
|
|
@ -582,3 +582,38 @@ func deriveChainId(v *big.Int) *big.Int {
|
||||||
v = new(big.Int).Sub(v, big.NewInt(35))
|
v = new(big.Int).Sub(v, big.NewInt(35))
|
||||||
return v.Div(v, big.NewInt(2))
|
return v.Div(v, big.NewInt(2))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FakeSigner implements the Signer interface and accepts unprotected transactions
|
||||||
|
type FakeSigner struct{ londonSigner }
|
||||||
|
|
||||||
|
var _ Signer = FakeSigner{}
|
||||||
|
|
||||||
|
func NewFakeSigner(chainId *big.Int) Signer {
|
||||||
|
signer := NewLondonSigner(chainId)
|
||||||
|
ls, _ := signer.(londonSigner)
|
||||||
|
return FakeSigner{londonSigner: ls}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f FakeSigner) Sender(tx *Transaction) (common.Address, error) {
|
||||||
|
return f.londonSigner.Sender(tx)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f FakeSigner) SignatureValues(tx *Transaction, sig []byte) (r, s, v *big.Int, err error) {
|
||||||
|
return f.londonSigner.SignatureValues(tx, sig)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f FakeSigner) ChainID() *big.Int {
|
||||||
|
return f.londonSigner.ChainID()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hash returns 'signature hash', i.e. the transaction hash that is signed by the
|
||||||
|
// private key. This hash does not uniquely identify the transaction.
|
||||||
|
func (f FakeSigner) Hash(tx *Transaction) common.Hash {
|
||||||
|
return f.londonSigner.Hash(tx)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Equal returns true if the given signer is the same as the receiver.
|
||||||
|
func (f FakeSigner) Equal(Signer) bool {
|
||||||
|
// Always return true
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -64,6 +64,7 @@ func (api *MinerAPI) SetGasPrice(gasPrice hexutil.Big) bool {
|
||||||
api.e.lock.Unlock()
|
api.e.lock.Unlock()
|
||||||
|
|
||||||
api.e.txPool.SetGasTip((*big.Int)(&gasPrice))
|
api.e.txPool.SetGasTip((*big.Int)(&gasPrice))
|
||||||
|
api.e.Miner().SetGasTip((*big.Int)(&gasPrice))
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -174,8 +174,7 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
|
||||||
|
|
||||||
eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().AllowUnprotectedTxs, eth, nil}
|
eth.APIBackend = &EthAPIBackend{stack.Config().ExtRPCEnabled(), stack.Config().AllowUnprotectedTxs, eth, nil}
|
||||||
if eth.APIBackend.allowUnprotectedTxs {
|
if eth.APIBackend.allowUnprotectedTxs {
|
||||||
log.Debug(" ###########", "Unprotected transactions allowed")
|
log.Info("------Unprotected transactions allowed-------")
|
||||||
|
|
||||||
config.TxPool.AllowUnprotectedTxs = true
|
config.TxPool.AllowUnprotectedTxs = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -822,6 +821,12 @@ func (s *Ethereum) Stop() error {
|
||||||
// Stop all the peer-related stuff first.
|
// Stop all the peer-related stuff first.
|
||||||
s.ethDialCandidates.Close()
|
s.ethDialCandidates.Close()
|
||||||
s.snapDialCandidates.Close()
|
s.snapDialCandidates.Close()
|
||||||
|
|
||||||
|
// Close the engine before handler else it may cause a deadlock where
|
||||||
|
// the heimdall is unresponsive and the syncing loop keeps waiting
|
||||||
|
// for a response and is unable to proceed to exit `Finalize` during
|
||||||
|
// block processing.
|
||||||
|
s.engine.Close()
|
||||||
s.handler.Stop()
|
s.handler.Stop()
|
||||||
|
|
||||||
// Then stop everything else.
|
// Then stop everything else.
|
||||||
|
|
@ -834,7 +839,6 @@ func (s *Ethereum) Stop() error {
|
||||||
s.txPool.Close()
|
s.txPool.Close()
|
||||||
s.miner.Close()
|
s.miner.Close()
|
||||||
s.blockchain.Stop()
|
s.blockchain.Stop()
|
||||||
s.engine.Close()
|
|
||||||
|
|
||||||
// Clean shutdown marker as the last thing before closing db
|
// Clean shutdown marker as the last thing before closing db
|
||||||
s.shutdownTracker.Stop()
|
s.shutdownTracker.Stop()
|
||||||
|
|
|
||||||
|
|
@ -83,21 +83,6 @@ func (b *EthAPIBackend) GetVoteOnHash(ctx context.Context, starBlockNr uint64, e
|
||||||
return false, fmt.Errorf("Hash mismatch: localChainHash %s, milestoneHash %s", localEndBlockHash, hash)
|
return false, fmt.Errorf("Hash mismatch: localChainHash %s, milestoneHash %s", localEndBlockHash, hash)
|
||||||
}
|
}
|
||||||
|
|
||||||
ethHandler := (*ethHandler)(b.eth.handler)
|
|
||||||
|
|
||||||
bor, ok := ethHandler.chain.Engine().(*bor.Bor)
|
|
||||||
|
|
||||||
if !ok {
|
|
||||||
return false, fmt.Errorf("Bor not available")
|
|
||||||
}
|
|
||||||
|
|
||||||
err = bor.HeimdallClient.FetchMilestoneID(ctx, milestoneId)
|
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
downloader.UnlockMutex(false, "", endBlockNr, common.Hash{})
|
|
||||||
return false, fmt.Errorf("Milestone ID doesn't exist in Heimdall")
|
|
||||||
}
|
|
||||||
|
|
||||||
downloader.UnlockMutex(true, milestoneId, endBlockNr, localEndBlock.Hash())
|
downloader.UnlockMutex(true, milestoneId, endBlockNr, localEndBlock.Hash())
|
||||||
|
|
||||||
return true, nil
|
return true, nil
|
||||||
|
|
|
||||||
|
|
@ -57,6 +57,8 @@ var (
|
||||||
fsHeaderSafetyNet = 2048 // Number of headers to discard in case a chain violation is detected
|
fsHeaderSafetyNet = 2048 // Number of headers to discard in case a chain violation is detected
|
||||||
fsHeaderContCheck = 3 * time.Second // Time interval to check for header continuations during state download
|
fsHeaderContCheck = 3 * time.Second // Time interval to check for header continuations during state download
|
||||||
fsMinFullBlocks = 64 // Number of blocks to retrieve fully even in snap sync
|
fsMinFullBlocks = 64 // Number of blocks to retrieve fully even in snap sync
|
||||||
|
|
||||||
|
maxValidationThreshold = uint64(1024) // Number of block difference from remote peer to start validation
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -147,7 +149,9 @@ type Downloader struct {
|
||||||
quitCh chan struct{} // Quit channel to signal termination
|
quitCh chan struct{} // Quit channel to signal termination
|
||||||
quitLock sync.Mutex // Lock to prevent double closes
|
quitLock sync.Mutex // Lock to prevent double closes
|
||||||
|
|
||||||
|
// Validation
|
||||||
ethereum.ChainValidator
|
ethereum.ChainValidator
|
||||||
|
maxValidationThreshold uint64 // Number of block difference from remote peer to start validation
|
||||||
|
|
||||||
// Testing hooks
|
// Testing hooks
|
||||||
syncInitHook func(uint64, uint64) // Method to call upon initiating a new sync run
|
syncInitHook func(uint64, uint64) // Method to call upon initiating a new sync run
|
||||||
|
|
@ -228,19 +232,20 @@ func New(stateDb ethdb.Database, mux *event.TypeMux, chain BlockChain, lightchai
|
||||||
}
|
}
|
||||||
|
|
||||||
dl := &Downloader{
|
dl := &Downloader{
|
||||||
stateDB: stateDb,
|
stateDB: stateDb,
|
||||||
mux: mux,
|
mux: mux,
|
||||||
queue: newQueue(blockCacheMaxItems, blockCacheInitialItems),
|
queue: newQueue(blockCacheMaxItems, blockCacheInitialItems),
|
||||||
peers: newPeerSet(),
|
peers: newPeerSet(),
|
||||||
blockchain: chain,
|
blockchain: chain,
|
||||||
lightchain: lightchain,
|
lightchain: lightchain,
|
||||||
dropPeer: dropPeer,
|
dropPeer: dropPeer,
|
||||||
headerProcCh: make(chan *headerTask, 1),
|
headerProcCh: make(chan *headerTask, 1),
|
||||||
quitCh: make(chan struct{}),
|
quitCh: make(chan struct{}),
|
||||||
SnapSyncer: snap.NewSyncer(stateDb, chain.TrieDB().Scheme()),
|
SnapSyncer: snap.NewSyncer(stateDb, chain.TrieDB().Scheme()),
|
||||||
stateSyncStart: make(chan *stateSync),
|
stateSyncStart: make(chan *stateSync),
|
||||||
syncStartBlock: chain.CurrentSnapBlock().Number.Uint64(),
|
syncStartBlock: chain.CurrentSnapBlock().Number.Uint64(),
|
||||||
ChainValidator: whitelistService,
|
ChainValidator: whitelistService,
|
||||||
|
maxValidationThreshold: maxValidationThreshold,
|
||||||
}
|
}
|
||||||
// Create the post-merge skeleton syncer and start the process
|
// Create the post-merge skeleton syncer and start the process
|
||||||
dl.skeleton = newSkeleton(stateDb, dl.peers, dropPeer, newBeaconBackfiller(dl, success))
|
dl.skeleton = newSkeleton(stateDb, dl.peers, dropPeer, newBeaconBackfiller(dl, success))
|
||||||
|
|
@ -893,13 +898,6 @@ func (d *Downloader) getFetchHeadersByNumber(p *peerConnection) func(number uint
|
||||||
// In the rare scenario when we ended up on a long reorganisation (i.e. none of
|
// In the rare scenario when we ended up on a long reorganisation (i.e. none of
|
||||||
// the head links match), we do a binary search to find the common ancestor.
|
// the head links match), we do a binary search to find the common ancestor.
|
||||||
func (d *Downloader) findAncestor(p *peerConnection, remoteHeader *types.Header) (uint64, error) {
|
func (d *Downloader) findAncestor(p *peerConnection, remoteHeader *types.Header) (uint64, error) {
|
||||||
// Check the validity of peer from which the chain is to be downloaded
|
|
||||||
if d.ChainValidator != nil {
|
|
||||||
if _, err := d.IsValidPeer(d.getFetchHeadersByNumber(p)); err != nil {
|
|
||||||
return 0, err
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Figure out the valid ancestor range to prevent rewrite attacks
|
// Figure out the valid ancestor range to prevent rewrite attacks
|
||||||
var (
|
var (
|
||||||
floor = int64(-1)
|
floor = int64(-1)
|
||||||
|
|
@ -917,6 +915,25 @@ func (d *Downloader) findAncestor(p *peerConnection, remoteHeader *types.Header)
|
||||||
localHeight = d.lightchain.CurrentHeader().Number.Uint64()
|
localHeight = d.lightchain.CurrentHeader().Number.Uint64()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check the validity of peer from which the chain is to be downloaded
|
||||||
|
if d.ChainValidator != nil {
|
||||||
|
_, err := d.IsValidPeer(d.getFetchHeadersByNumber(p))
|
||||||
|
if errors.Is(err, whitelist.ErrMismatch) {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if errors.Is(err, whitelist.ErrNoRemote) {
|
||||||
|
// Don't validate the peer against whitelisted milestones until the different of
|
||||||
|
// our local height and remote peer's height is less than `maxValidationThreshold`
|
||||||
|
if localHeight >= remoteHeight-d.maxValidationThreshold {
|
||||||
|
log.Info("Remote peer didn't respond", "id", p.id, "local", localHeight, "remote", remoteHeight, "err", err)
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Info("Remote peer didn't respond but is far ahead, skipping validation", "id", p.id, "local", localHeight, "remote", remoteHeight, "err", err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
p.log.Debug("Looking for common ancestor", "local", localHeight, "remote", remoteHeight)
|
p.log.Debug("Looking for common ancestor", "local", localHeight, "remote", remoteHeight)
|
||||||
|
|
||||||
// Recap floor value for binary search
|
// Recap floor value for binary search
|
||||||
|
|
|
||||||
|
|
@ -1649,14 +1649,42 @@ func TestFakedSyncProgress67NoRemoteCheckpoint(t *testing.T) {
|
||||||
chainA := testChainForkLightA.blocks
|
chainA := testChainForkLightA.blocks
|
||||||
tester.newPeer("light", protocol, chainA[1:])
|
tester.newPeer("light", protocol, chainA[1:])
|
||||||
|
|
||||||
|
// Set the max validation threshold equal to chain length to enforce validation
|
||||||
|
tester.downloader.maxValidationThreshold = uint64(len(chainA) - 1)
|
||||||
|
|
||||||
// Synchronise with the peer and make sure all blocks were retrieved
|
// Synchronise with the peer and make sure all blocks were retrieved
|
||||||
// Should fail in first attempt
|
// Should fail in first attempt
|
||||||
if err := tester.sync("light", nil, mode); err != nil {
|
err := tester.sync("light", nil, mode)
|
||||||
assert.Equal(t, whitelist.ErrNoRemote, err, "failed synchronisation")
|
assert.Equal(t, whitelist.ErrNoRemote, err, "failed synchronisation")
|
||||||
}
|
|
||||||
|
|
||||||
// Try syncing again, should succeed
|
// Try syncing again, should succeed
|
||||||
if err := tester.sync("light", nil, mode); err != nil {
|
if err := tester.sync("light", nil, mode); err != nil {
|
||||||
t.Fatal("succeeded attacker synchronisation")
|
t.Fatal("succeeded attacker synchronisation")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TestFakedSyncProgress67BypassWhitelistValidation tests if peer validation
|
||||||
|
// via whitelist is bypassed when remote peer is far away or not
|
||||||
|
func TestFakedSyncProgress67BypassWhitelistValidation(t *testing.T) {
|
||||||
|
protocol := uint(eth.ETH67)
|
||||||
|
mode := FullSync
|
||||||
|
|
||||||
|
tester := newTester(t)
|
||||||
|
validate := func(count int) (bool, error) {
|
||||||
|
return false, whitelist.ErrNoRemote
|
||||||
|
}
|
||||||
|
|
||||||
|
tester.downloader.ChainValidator = newWhitelistFake(validate)
|
||||||
|
|
||||||
|
defer tester.terminate()
|
||||||
|
|
||||||
|
// 1223 length chain
|
||||||
|
chainA := testChainBase.blocks
|
||||||
|
tester.newPeer("light", protocol, chainA[1:])
|
||||||
|
|
||||||
|
// Although the validate function above returns an error (which says that
|
||||||
|
// remote peer doesn't have that block), sync will go through as the chain
|
||||||
|
// import length is 1223 which is more than the default threshold of 1024
|
||||||
|
err := tester.sync("light", nil, mode)
|
||||||
|
assert.NoError(t, err, "failed synchronisation")
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -488,7 +488,7 @@ func testBroadcastBlock(t *testing.T, peers, bcasts int) {
|
||||||
)
|
)
|
||||||
|
|
||||||
for i, sink := range sinks {
|
for i, sink := range sinks {
|
||||||
sink := sink // Closure for gorotuine below
|
sink := sink // Closure for goroutine below
|
||||||
|
|
||||||
sourcePipe, sinkPipe := p2p.MsgPipe()
|
sourcePipe, sinkPipe := p2p.MsgPipe()
|
||||||
defer sourcePipe.Close()
|
defer sourcePipe.Close()
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,6 @@ import (
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/cockroachdb/errors"
|
|
||||||
"github.com/cockroachdb/pebble"
|
"github.com/cockroachdb/pebble"
|
||||||
"github.com/cockroachdb/pebble/bloom"
|
"github.com/cockroachdb/pebble/bloom"
|
||||||
|
|
||||||
|
|
@ -136,7 +135,7 @@ func (l panicLogger) Errorf(format string, args ...interface{}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l panicLogger) Fatalf(format string, args ...interface{}) {
|
func (l panicLogger) Fatalf(format string, args ...interface{}) {
|
||||||
panic(errors.Errorf("fatal: "+format, args...))
|
panic(fmt.Errorf("fatal: "+format, args...))
|
||||||
}
|
}
|
||||||
|
|
||||||
// New returns a wrapped pebble DB object. The namespace is the prefix that the
|
// New returns a wrapped pebble DB object. The namespace is the prefix that the
|
||||||
|
|
@ -628,10 +627,7 @@ func (b *batch) Replay(w ethdb.KeyValueWriter) error {
|
||||||
|
|
||||||
for {
|
for {
|
||||||
kind, k, v, ok, err := reader.Next()
|
kind, k, v, ok, err := reader.Next()
|
||||||
if err != nil {
|
if !ok || err != nil {
|
||||||
return err
|
|
||||||
}
|
|
||||||
if !ok {
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
// The (k,v) slices might be overwritten if the batch is reset/reused,
|
// The (k,v) slices might be overwritten if the batch is reset/reused,
|
||||||
|
|
@ -650,9 +646,12 @@ func (b *batch) Replay(w ethdb.KeyValueWriter) error {
|
||||||
|
|
||||||
// pebbleIterator is a wrapper of underlying iterator in storage engine.
|
// pebbleIterator is a wrapper of underlying iterator in storage engine.
|
||||||
// The purpose of this structure is to implement the missing APIs.
|
// The purpose of this structure is to implement the missing APIs.
|
||||||
|
//
|
||||||
|
// The pebble iterator is not thread-safe.
|
||||||
type pebbleIterator struct {
|
type pebbleIterator struct {
|
||||||
iter *pebble.Iterator
|
iter *pebble.Iterator
|
||||||
moved bool
|
moved bool
|
||||||
|
released bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewIterator creates a binary-alphabetical iterator over a subset
|
// NewIterator creates a binary-alphabetical iterator over a subset
|
||||||
|
|
@ -664,8 +663,7 @@ func (d *Database) NewIterator(prefix []byte, start []byte) ethdb.Iterator {
|
||||||
UpperBound: upperBound(prefix),
|
UpperBound: upperBound(prefix),
|
||||||
})
|
})
|
||||||
iter.First()
|
iter.First()
|
||||||
|
return &pebbleIterator{iter: iter, moved: true, released: false}
|
||||||
return &pebbleIterator{iter: iter, moved: true}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Next moves the iterator to the next key/value pair. It returns whether the
|
// Next moves the iterator to the next key/value pair. It returns whether the
|
||||||
|
|
@ -701,4 +699,9 @@ func (iter *pebbleIterator) Value() []byte {
|
||||||
|
|
||||||
// Release releases associated resources. Release should always succeed and can
|
// Release releases associated resources. Release should always succeed and can
|
||||||
// be called multiple times without causing error.
|
// be called multiple times without causing error.
|
||||||
func (iter *pebbleIterator) Release() { iter.iter.Close() }
|
func (iter *pebbleIterator) Release() {
|
||||||
|
if !iter.released {
|
||||||
|
iter.iter.Close()
|
||||||
|
iter.released = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
||||||
10
go.mod
10
go.mod
|
|
@ -16,7 +16,6 @@ require (
|
||||||
github.com/btcsuite/btcd/btcec/v2 v2.3.2
|
github.com/btcsuite/btcd/btcec/v2 v2.3.2
|
||||||
github.com/cespare/cp v1.1.1
|
github.com/cespare/cp v1.1.1
|
||||||
github.com/cloudflare/cloudflare-go v0.89.0
|
github.com/cloudflare/cloudflare-go v0.89.0
|
||||||
github.com/cockroachdb/errors v1.11.1
|
|
||||||
github.com/cockroachdb/pebble v1.1.0
|
github.com/cockroachdb/pebble v1.1.0
|
||||||
github.com/consensys/gnark-crypto v0.12.1
|
github.com/consensys/gnark-crypto v0.12.1
|
||||||
github.com/cosmos/cosmos-sdk v0.50.4
|
github.com/cosmos/cosmos-sdk v0.50.4
|
||||||
|
|
@ -124,8 +123,10 @@ require (
|
||||||
github.com/beorn7/perks v1.0.1 // indirect
|
github.com/beorn7/perks v1.0.1 // indirect
|
||||||
github.com/bits-and-blooms/bitset v1.7.0 // indirect
|
github.com/bits-and-blooms/bitset v1.7.0 // indirect
|
||||||
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
github.com/cespare/xxhash/v2 v2.2.0 // indirect
|
||||||
|
github.com/cockroachdb/errors v1.11.1 // indirect
|
||||||
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
|
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
|
||||||
github.com/cockroachdb/redact v1.1.5 // indirect
|
github.com/cockroachdb/redact v1.1.5 // indirect
|
||||||
|
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
|
||||||
github.com/consensys/bavard v0.1.13 // indirect
|
github.com/consensys/bavard v0.1.13 // indirect
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
|
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
|
||||||
github.com/crate-crypto/go-ipa v0.0.0-20230905211650-63ccabc1a949 // indirect
|
github.com/crate-crypto/go-ipa v0.0.0-20230905211650-63ccabc1a949 // indirect
|
||||||
|
|
@ -133,10 +134,10 @@ require (
|
||||||
github.com/dlclark/regexp2 v1.7.0 // indirect
|
github.com/dlclark/regexp2 v1.7.0 // indirect
|
||||||
github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61 // indirect
|
github.com/garslo/gogen v0.0.0-20170306192744-1d203ffc1f61 // indirect
|
||||||
github.com/getsentry/sentry-go v0.18.0 // indirect
|
github.com/getsentry/sentry-go v0.18.0 // indirect
|
||||||
github.com/go-ole/go-ole v1.2.6 // indirect
|
github.com/go-ole/go-ole v1.3.0 // indirect
|
||||||
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
|
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
|
||||||
github.com/gogo/protobuf v1.3.2 // indirect
|
github.com/gogo/protobuf v1.3.2 // indirect
|
||||||
github.com/google/go-cmp v0.5.9 // indirect
|
github.com/google/go-querystring v1.1.0 // indirect
|
||||||
github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect
|
github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect
|
||||||
github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097 // indirect
|
github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097 // indirect
|
||||||
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
github.com/jmespath/go-jmespath v0.4.0 // indirect
|
||||||
|
|
@ -194,7 +195,6 @@ require (
|
||||||
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect
|
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect
|
||||||
github.com/cbergoon/merkletree v0.2.0 // indirect
|
github.com/cbergoon/merkletree v0.2.0 // indirect
|
||||||
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
|
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
|
||||||
github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect
|
|
||||||
github.com/cosmos/go-bip39 v1.0.0 // indirect
|
github.com/cosmos/go-bip39 v1.0.0 // indirect
|
||||||
github.com/cosmos/ledger-cosmos-go v0.13.0 // indirect
|
github.com/cosmos/ledger-cosmos-go v0.13.0 // indirect
|
||||||
github.com/etcd-io/bbolt v1.3.3 // indirect
|
github.com/etcd-io/bbolt v1.3.3 // indirect
|
||||||
|
|
@ -208,7 +208,7 @@ require (
|
||||||
github.com/goccy/go-json v0.10.2 // indirect
|
github.com/goccy/go-json v0.10.2 // indirect
|
||||||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
|
||||||
github.com/gomodule/redigo v2.0.0+incompatible // indirect
|
github.com/gomodule/redigo v2.0.0+incompatible // indirect
|
||||||
github.com/google/go-querystring v1.1.0 // indirect
|
github.com/google/go-cmp v0.5.9 // indirect
|
||||||
github.com/google/s2a-go v0.1.4 // indirect
|
github.com/google/s2a-go v0.1.4 // indirect
|
||||||
github.com/googleapis/gax-go/v2 v2.11.0 // indirect
|
github.com/googleapis/gax-go/v2 v2.11.0 // indirect
|
||||||
github.com/gorilla/mux v1.8.0 // indirect
|
github.com/gorilla/mux v1.8.0 // indirect
|
||||||
|
|
|
||||||
3
go.sum
3
go.sum
|
|
@ -1214,8 +1214,9 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag=
|
||||||
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE=
|
||||||
github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8=
|
github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8=
|
||||||
github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||||
github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
|
|
||||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||||
|
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
|
||||||
|
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
|
||||||
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg=
|
||||||
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk=
|
||||||
github.com/go-pdf/fpdf v0.5.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M=
|
github.com/go-pdf/fpdf v0.5.0/go.mod h1:HzcnA+A23uwogo0tp9yU+l3V+KXhiESpt1PMayhOh5M=
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ func (p *DumpconfigCommand) MarkDown() string {
|
||||||
func (c *DumpconfigCommand) Help() string {
|
func (c *DumpconfigCommand) Help() string {
|
||||||
return `Usage: bor dumpconfig <your-favourite-flags>
|
return `Usage: bor dumpconfig <your-favourite-flags>
|
||||||
|
|
||||||
This command will will export the user provided flags into a configuration file`
|
This command will export the user provided flags into a configuration file`
|
||||||
}
|
}
|
||||||
|
|
||||||
// Synopsis implements the cli.Command interface
|
// Synopsis implements the cli.Command interface
|
||||||
|
|
|
||||||
|
|
@ -42,3 +42,22 @@ func TestConfigLegacy(t *testing.T) {
|
||||||
readFile("./testdata/test.toml")
|
readFile("./testdata/test.toml")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestDefaultConfigLegacy(t *testing.T) {
|
||||||
|
readFile := func(path string) {
|
||||||
|
expectedConfig, err := readLegacyConfig(path)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
|
||||||
|
testConfig := DefaultConfig()
|
||||||
|
|
||||||
|
testConfig.Identity = "Polygon-Devs"
|
||||||
|
testConfig.DataDir = "/var/lib/bor"
|
||||||
|
|
||||||
|
assert.Equal(t, expectedConfig, testConfig)
|
||||||
|
}
|
||||||
|
|
||||||
|
// read file in hcl format
|
||||||
|
t.Run("toml", func(t *testing.T) {
|
||||||
|
readFile("./testdata/default.toml")
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
|
||||||
193
internal/cli/server/testdata/default.toml
vendored
Normal file
193
internal/cli/server/testdata/default.toml
vendored
Normal file
|
|
@ -0,0 +1,193 @@
|
||||||
|
chain = "mainnet"
|
||||||
|
identity = "Polygon-Devs"
|
||||||
|
verbosity = 3
|
||||||
|
log-level = ""
|
||||||
|
vmdebug = false
|
||||||
|
datadir = "/var/lib/bor"
|
||||||
|
ancient = ""
|
||||||
|
"db.engine" = "leveldb"
|
||||||
|
keystore = ""
|
||||||
|
"rpc.batchlimit" = 100
|
||||||
|
"rpc.returndatalimit" = 100000
|
||||||
|
syncmode = "full"
|
||||||
|
gcmode = "full"
|
||||||
|
snapshot = true
|
||||||
|
"bor.logs" = false
|
||||||
|
ethstats = ""
|
||||||
|
devfakeauthor = false
|
||||||
|
|
||||||
|
["eth.requiredblocks"]
|
||||||
|
|
||||||
|
[log]
|
||||||
|
vmodule = ""
|
||||||
|
json = false
|
||||||
|
backtrace = ""
|
||||||
|
debug = false
|
||||||
|
|
||||||
|
[p2p]
|
||||||
|
maxpeers = 50
|
||||||
|
maxpendpeers = 50
|
||||||
|
bind = "0.0.0.0"
|
||||||
|
port = 30303
|
||||||
|
nodiscover = false
|
||||||
|
nat = "any"
|
||||||
|
netrestrict = ""
|
||||||
|
nodekey = ""
|
||||||
|
nodekeyhex = ""
|
||||||
|
txarrivalwait = "500ms"
|
||||||
|
[p2p.discovery]
|
||||||
|
v4disc = true
|
||||||
|
v5disc = false
|
||||||
|
bootnodes = []
|
||||||
|
bootnodesv4 = []
|
||||||
|
bootnodesv5 = []
|
||||||
|
static-nodes = []
|
||||||
|
trusted-nodes = []
|
||||||
|
dns = []
|
||||||
|
|
||||||
|
[heimdall]
|
||||||
|
url = "http://localhost:1317"
|
||||||
|
"bor.without" = false
|
||||||
|
grpc-address = ""
|
||||||
|
"bor.runheimdall" = false
|
||||||
|
"bor.runheimdallargs" = ""
|
||||||
|
"bor.useheimdallapp" = false
|
||||||
|
|
||||||
|
[txpool]
|
||||||
|
locals = []
|
||||||
|
nolocals = false
|
||||||
|
journal = "transactions.rlp"
|
||||||
|
rejournal = "1h0m0s"
|
||||||
|
pricelimit = 1
|
||||||
|
pricebump = 10
|
||||||
|
accountslots = 16
|
||||||
|
globalslots = 32768
|
||||||
|
accountqueue = 16
|
||||||
|
globalqueue = 32768
|
||||||
|
lifetime = "3h0m0s"
|
||||||
|
|
||||||
|
[miner]
|
||||||
|
mine = false
|
||||||
|
etherbase = ""
|
||||||
|
extradata = ""
|
||||||
|
gaslimit = 30000000
|
||||||
|
gasprice = "1000000000"
|
||||||
|
recommit = "2m5s"
|
||||||
|
commitinterrupt = true
|
||||||
|
|
||||||
|
[jsonrpc]
|
||||||
|
ipcdisable = false
|
||||||
|
ipcpath = ""
|
||||||
|
gascap = 50000000
|
||||||
|
evmtimeout = "5s"
|
||||||
|
txfeecap = 1.0
|
||||||
|
allow-unprotected-txs = false
|
||||||
|
enabledeprecatedpersonal = false
|
||||||
|
[jsonrpc.http]
|
||||||
|
enabled = false
|
||||||
|
port = 8545
|
||||||
|
prefix = ""
|
||||||
|
host = "localhost"
|
||||||
|
api = ["eth", "net", "web3", "txpool", "bor"]
|
||||||
|
vhosts = ["localhost"]
|
||||||
|
corsdomain = ["localhost"]
|
||||||
|
ep-size = 40
|
||||||
|
ep-requesttimeout = "0s"
|
||||||
|
[jsonrpc.ws]
|
||||||
|
enabled = false
|
||||||
|
port = 8546
|
||||||
|
prefix = ""
|
||||||
|
host = "localhost"
|
||||||
|
api = ["net", "web3"]
|
||||||
|
origins = ["localhost"]
|
||||||
|
ep-size = 40
|
||||||
|
ep-requesttimeout = "0s"
|
||||||
|
[jsonrpc.graphql]
|
||||||
|
enabled = false
|
||||||
|
port = 0
|
||||||
|
prefix = ""
|
||||||
|
host = ""
|
||||||
|
vhosts = ["localhost"]
|
||||||
|
corsdomain = ["localhost"]
|
||||||
|
ep-size = 0
|
||||||
|
ep-requesttimeout = ""
|
||||||
|
[jsonrpc.auth]
|
||||||
|
jwtsecret = ""
|
||||||
|
addr = "localhost"
|
||||||
|
port = 8551
|
||||||
|
vhosts = ["localhost"]
|
||||||
|
[jsonrpc.timeouts]
|
||||||
|
read = "10s"
|
||||||
|
write = "30s"
|
||||||
|
idle = "2m0s"
|
||||||
|
|
||||||
|
[gpo]
|
||||||
|
blocks = 20
|
||||||
|
percentile = 60
|
||||||
|
maxheaderhistory = 1024
|
||||||
|
maxblockhistory = 1024
|
||||||
|
maxprice = "500000000000"
|
||||||
|
ignoreprice = "2"
|
||||||
|
|
||||||
|
[telemetry]
|
||||||
|
metrics = false
|
||||||
|
expensive = false
|
||||||
|
prometheus-addr = "127.0.0.1:7071"
|
||||||
|
opencollector-endpoint = ""
|
||||||
|
[telemetry.influx]
|
||||||
|
influxdb = false
|
||||||
|
endpoint = ""
|
||||||
|
database = ""
|
||||||
|
username = ""
|
||||||
|
password = ""
|
||||||
|
influxdbv2 = false
|
||||||
|
token = ""
|
||||||
|
bucket = ""
|
||||||
|
organization = ""
|
||||||
|
[telemetry.influx.tags]
|
||||||
|
|
||||||
|
[cache]
|
||||||
|
cache = 1024
|
||||||
|
gc = 25
|
||||||
|
snapshot = 10
|
||||||
|
database = 50
|
||||||
|
trie = 15
|
||||||
|
noprefetch = false
|
||||||
|
preimages = false
|
||||||
|
txlookuplimit = 2350000
|
||||||
|
triesinmemory = 128
|
||||||
|
blocklogs = 32
|
||||||
|
timeout = "1h0m0s"
|
||||||
|
fdlimit = 0
|
||||||
|
|
||||||
|
[leveldb]
|
||||||
|
compactiontablesize = 2
|
||||||
|
compactiontablesizemultiplier = 1.0
|
||||||
|
compactiontotalsize = 10
|
||||||
|
compactiontotalsizemultiplier = 10.0
|
||||||
|
|
||||||
|
[accounts]
|
||||||
|
unlock = []
|
||||||
|
password = ""
|
||||||
|
allow-insecure-unlock = false
|
||||||
|
lightkdf = false
|
||||||
|
disable-bor-wallet = true
|
||||||
|
|
||||||
|
[grpc]
|
||||||
|
addr = ":3131"
|
||||||
|
|
||||||
|
[developer]
|
||||||
|
dev = false
|
||||||
|
period = 0
|
||||||
|
gaslimit = 11500000
|
||||||
|
|
||||||
|
[parallelevm]
|
||||||
|
enable = true
|
||||||
|
procs = 8
|
||||||
|
|
||||||
|
[pprof]
|
||||||
|
pprof = false
|
||||||
|
port = 6060
|
||||||
|
addr = "127.0.0.1"
|
||||||
|
memprofilerate = 524288
|
||||||
|
blockprofilerate = 0
|
||||||
17
internal/ethapi/testdata/eth_getTransactionReceipt-state-sync-tx.json
vendored
Normal file
17
internal/ethapi/testdata/eth_getTransactionReceipt-state-sync-tx.json
vendored
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"blockHash": "0x4d780246cde52e535f40603d47af8fa1aea807dd3065e1acd97127bea0922b3e",
|
||||||
|
"blockNumber": "0x6",
|
||||||
|
"contractAddress": null,
|
||||||
|
"cumulativeGasUsed": "0xe01c",
|
||||||
|
"effectiveGasPrice": "0x1ecb3fb4",
|
||||||
|
"from": "0x703c4b2bd70c169f5717101caee543299fc946c7",
|
||||||
|
"gasUsed": "0xe01c",
|
||||||
|
"logs": [],
|
||||||
|
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
|
||||||
|
"status": "0x1",
|
||||||
|
"to": null,
|
||||||
|
"transactionHash": "0xb5a1148819cfdfff9bfe70035524fec940eb735d89b76960b97751d01ae2a9f2",
|
||||||
|
"transactionIndex": "0x0",
|
||||||
|
"type": "0x1"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
@ -1405,7 +1405,7 @@ var SolidityType = function (config) {
|
||||||
* @return {Bool} true if type match this SolidityType, otherwise false
|
* @return {Bool} true if type match this SolidityType, otherwise false
|
||||||
*/
|
*/
|
||||||
SolidityType.prototype.isType = function (name) {
|
SolidityType.prototype.isType = function (name) {
|
||||||
throw "this method should be overrwritten for type " + name;
|
throw "this method should be overwritten for type " + name;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -219,6 +219,11 @@ func (miner *Miner) SetExtra(extra []byte) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (miner *Miner) SetGasTip(tip *big.Int) error {
|
||||||
|
miner.worker.setGasTip(tip)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// SetRecommitInterval sets the interval for sealing work resubmitting.
|
// SetRecommitInterval sets the interval for sealing work resubmitting.
|
||||||
func (miner *Miner) SetRecommitInterval(interval time.Duration) {
|
func (miner *Miner) SetRecommitInterval(interval time.Duration) {
|
||||||
miner.worker.setRecommitInterval(interval)
|
miner.worker.setRecommitInterval(interval)
|
||||||
|
|
|
||||||
|
|
@ -119,11 +119,11 @@ func newTransactionsByPriceAndNonce(signer types.Signer, txs map[common.Address]
|
||||||
}
|
}
|
||||||
|
|
||||||
// Peek returns the next transaction by price.
|
// Peek returns the next transaction by price.
|
||||||
func (t *transactionsByPriceAndNonce) Peek() *txpool.LazyTransaction {
|
func (t *transactionsByPriceAndNonce) Peek() (*txpool.LazyTransaction, *big.Int) {
|
||||||
if len(t.heads) == 0 {
|
if len(t.heads) == 0 {
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
return t.heads[0].tx
|
return t.heads[0].tx, t.heads[0].fees
|
||||||
}
|
}
|
||||||
|
|
||||||
// Shift replaces the current best head with the next one from the same account.
|
// Shift replaces the current best head with the next one from the same account.
|
||||||
|
|
|
||||||
|
|
@ -102,7 +102,7 @@ func testTransactionPriceNonceSort(t *testing.T, baseFee *big.Int) {
|
||||||
txset := newTransactionsByPriceAndNonce(signer, groups, baseFee)
|
txset := newTransactionsByPriceAndNonce(signer, groups, baseFee)
|
||||||
|
|
||||||
txs := types.Transactions{}
|
txs := types.Transactions{}
|
||||||
for tx := txset.Peek(); tx != nil; tx = txset.Peek() {
|
for tx, _ := txset.Peek(); tx != nil; tx, _ = txset.Peek() {
|
||||||
txs = append(txs, tx.Tx)
|
txs = append(txs, tx.Tx)
|
||||||
txset.Shift()
|
txset.Shift()
|
||||||
}
|
}
|
||||||
|
|
@ -167,7 +167,7 @@ func TestTransactionTimeSort(t *testing.T) {
|
||||||
txset := newTransactionsByPriceAndNonce(signer, groups, nil)
|
txset := newTransactionsByPriceAndNonce(signer, groups, nil)
|
||||||
|
|
||||||
txs := types.Transactions{}
|
txs := types.Transactions{}
|
||||||
for tx := txset.Peek(); tx != nil; tx = txset.Peek() {
|
for tx, _ := txset.Peek(); tx != nil; tx, _ = txset.Peek() {
|
||||||
txs = append(txs, tx.Tx)
|
txs = append(txs, tx.Tx)
|
||||||
txset.Shift()
|
txset.Shift()
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"math/big"
|
||||||
"os"
|
"os"
|
||||||
"sync"
|
"sync"
|
||||||
"sync/atomic"
|
"sync/atomic"
|
||||||
|
|
@ -175,7 +176,7 @@ func (w *worker) mainLoopWithDelay(ctx context.Context, delay uint, opcodeDelay
|
||||||
}
|
}
|
||||||
txset := newTransactionsByPriceAndNonce(w.current.signer, txs, w.current.header.BaseFee)
|
txset := newTransactionsByPriceAndNonce(w.current.signer, txs, w.current.header.BaseFee)
|
||||||
tcount := w.current.tcount
|
tcount := w.current.tcount
|
||||||
w.commitTransactions(w.current, txset, nil, context.Background())
|
w.commitTransactions(w.current, txset, nil, new(big.Int), context.Background())
|
||||||
|
|
||||||
// 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
|
||||||
|
|
@ -587,7 +588,7 @@ mainloop:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
// Retrieve the next transaction and abort if all done.
|
// Retrieve the next transaction and abort if all done.
|
||||||
ltx := txs.Peek()
|
ltx, _ := txs.Peek()
|
||||||
if ltx == nil {
|
if ltx == nil {
|
||||||
breakCause = "all transactions has been included"
|
breakCause = "all transactions has been included"
|
||||||
break
|
break
|
||||||
|
|
|
||||||
|
|
@ -237,6 +237,7 @@ type worker struct {
|
||||||
mu sync.RWMutex // The lock used to protect the coinbase and extra fields
|
mu sync.RWMutex // The lock used to protect the coinbase and extra fields
|
||||||
coinbase common.Address
|
coinbase common.Address
|
||||||
extra []byte
|
extra []byte
|
||||||
|
tip *big.Int // Minimum tip needed for non-local transaction to include them
|
||||||
|
|
||||||
pendingMu sync.RWMutex
|
pendingMu sync.RWMutex
|
||||||
pendingTasks map[common.Hash]*task
|
pendingTasks map[common.Hash]*task
|
||||||
|
|
@ -295,6 +296,7 @@ func newWorker(config *Config, chainConfig *params.ChainConfig, engine consensus
|
||||||
isLocalBlock: isLocalBlock,
|
isLocalBlock: isLocalBlock,
|
||||||
coinbase: config.Etherbase,
|
coinbase: config.Etherbase,
|
||||||
extra: config.ExtraData,
|
extra: config.ExtraData,
|
||||||
|
tip: config.GasPrice,
|
||||||
pendingTasks: make(map[common.Hash]*task),
|
pendingTasks: make(map[common.Hash]*task),
|
||||||
txsCh: make(chan core.NewTxsEvent, txChanSize),
|
txsCh: make(chan core.NewTxsEvent, txChanSize),
|
||||||
chainHeadCh: make(chan core.ChainHeadEvent, chainHeadChanSize),
|
chainHeadCh: make(chan core.ChainHeadEvent, chainHeadChanSize),
|
||||||
|
|
@ -395,6 +397,13 @@ func (w *worker) setExtra(extra []byte) {
|
||||||
w.extra = extra
|
w.extra = extra
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// setGasTip sets the minimum miner tip needed to include a non-local transaction.
|
||||||
|
func (w *worker) setGasTip(tip *big.Int) {
|
||||||
|
w.mu.Lock()
|
||||||
|
defer w.mu.Unlock()
|
||||||
|
w.tip = tip
|
||||||
|
}
|
||||||
|
|
||||||
// setRecommitInterval updates the interval for miner sealing work recommitting.
|
// setRecommitInterval updates the interval for miner sealing work recommitting.
|
||||||
func (w *worker) setRecommitInterval(interval time.Duration) {
|
func (w *worker) setRecommitInterval(interval time.Duration) {
|
||||||
select {
|
select {
|
||||||
|
|
@ -648,7 +657,7 @@ func (w *worker) mainLoop(ctx context.Context) {
|
||||||
}
|
}
|
||||||
txset := newTransactionsByPriceAndNonce(w.current.signer, txs, w.current.header.BaseFee)
|
txset := newTransactionsByPriceAndNonce(w.current.signer, txs, w.current.header.BaseFee)
|
||||||
tcount := w.current.tcount
|
tcount := w.current.tcount
|
||||||
w.commitTransactions(w.current, txset, nil, context.Background())
|
w.commitTransactions(w.current, txset, nil, new(big.Int), context.Background())
|
||||||
|
|
||||||
// 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
|
||||||
|
|
@ -908,7 +917,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, txs *transactionsByPriceAndNonce, interrupt *atomic.Int32, interruptCtx context.Context) error {
|
func (w *worker) commitTransactions(env *environment, txs *transactionsByPriceAndNonce, interrupt *atomic.Int32, minTip *big.Int, interruptCtx context.Context) 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)
|
||||||
|
|
@ -921,6 +930,7 @@ func (w *worker) commitTransactions(env *environment, txs *transactionsByPriceAn
|
||||||
chDeps := make(chan blockstm.TxDep)
|
chDeps := make(chan blockstm.TxDep)
|
||||||
|
|
||||||
var depsWg sync.WaitGroup
|
var depsWg sync.WaitGroup
|
||||||
|
var once sync.Once
|
||||||
|
|
||||||
EnableMVHashMap := w.chainConfig.IsCancun(env.header.Number)
|
EnableMVHashMap := w.chainConfig.IsCancun(env.header.Number)
|
||||||
|
|
||||||
|
|
@ -930,6 +940,11 @@ func (w *worker) commitTransactions(env *environment, txs *transactionsByPriceAn
|
||||||
|
|
||||||
chDeps = make(chan blockstm.TxDep)
|
chDeps = make(chan blockstm.TxDep)
|
||||||
|
|
||||||
|
// Make sure we safely close the channel in case of interrupt
|
||||||
|
defer once.Do(func() {
|
||||||
|
close(chDeps)
|
||||||
|
})
|
||||||
|
|
||||||
depsWg.Add(1)
|
depsWg.Add(1)
|
||||||
|
|
||||||
go func(chDeps chan blockstm.TxDep) {
|
go func(chDeps chan blockstm.TxDep) {
|
||||||
|
|
@ -990,7 +1005,7 @@ mainloop:
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
// Retrieve the next transaction and abort if all done.
|
// Retrieve the next transaction and abort if all done.
|
||||||
ltx := txs.Peek()
|
ltx, tip := txs.Peek()
|
||||||
if ltx == nil {
|
if ltx == nil {
|
||||||
breakCause = "all transactions has been included"
|
breakCause = "all transactions has been included"
|
||||||
break
|
break
|
||||||
|
|
@ -1006,6 +1021,11 @@ mainloop:
|
||||||
txs.Pop()
|
txs.Pop()
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
// If we don't receive enough tip for the next transaction, skip the account
|
||||||
|
if tip.Cmp(minTip) < 0 {
|
||||||
|
log.Trace("Not enough tip for transaction", "hash", ltx.Hash, "tip", tip, "needed", minTip)
|
||||||
|
break // If the next-best is too low, surely no better will be available
|
||||||
|
}
|
||||||
// Transaction seems to fit, pull it up from the pool
|
// Transaction seems to fit, pull it up from the pool
|
||||||
tx := ltx.Resolve()
|
tx := ltx.Resolve()
|
||||||
if tx == nil {
|
if tx == nil {
|
||||||
|
|
@ -1109,7 +1129,9 @@ mainloop:
|
||||||
|
|
||||||
// nolint:nestif
|
// nolint:nestif
|
||||||
if EnableMVHashMap && w.IsRunning() {
|
if EnableMVHashMap && w.IsRunning() {
|
||||||
close(chDeps)
|
once.Do(func() {
|
||||||
|
close(chDeps)
|
||||||
|
})
|
||||||
depsWg.Wait()
|
depsWg.Wait()
|
||||||
|
|
||||||
var blockExtraData types.BlockExtraData
|
var blockExtraData types.BlockExtraData
|
||||||
|
|
@ -1461,6 +1483,10 @@ func (w *worker) fillTransactions(ctx context.Context, interrupt *atomic.Int32,
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
||||||
|
w.mu.RLock()
|
||||||
|
tip := w.tip
|
||||||
|
w.mu.RUnlock()
|
||||||
|
|
||||||
if len(localTxs) > 0 {
|
if len(localTxs) > 0 {
|
||||||
var txs *transactionsByPriceAndNonce
|
var txs *transactionsByPriceAndNonce
|
||||||
|
|
||||||
|
|
@ -1479,7 +1505,7 @@ func (w *worker) fillTransactions(ctx context.Context, interrupt *atomic.Int32,
|
||||||
})
|
})
|
||||||
|
|
||||||
tracing.Exec(ctx, "", "worker.LocalCommitTransactions", func(ctx context.Context, span trace.Span) {
|
tracing.Exec(ctx, "", "worker.LocalCommitTransactions", func(ctx context.Context, span trace.Span) {
|
||||||
err = w.commitTransactions(env, txs, interrupt, interruptCtx)
|
err = w.commitTransactions(env, txs, interrupt, new(big.Int), interruptCtx)
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -1507,7 +1533,7 @@ func (w *worker) fillTransactions(ctx context.Context, interrupt *atomic.Int32,
|
||||||
})
|
})
|
||||||
|
|
||||||
tracing.Exec(ctx, "", "worker.RemoteCommitTransactions", func(ctx context.Context, span trace.Span) {
|
tracing.Exec(ctx, "", "worker.RemoteCommitTransactions", func(ctx context.Context, span trace.Span) {
|
||||||
err = w.commitTransactions(env, txs, interrupt, interruptCtx)
|
err = w.commitTransactions(env, txs, interrupt, tip, interruptCtx)
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
Source: bor
|
Source: bor
|
||||||
Version: 1.3.0
|
Version: 1.3.1
|
||||||
Section: develop
|
Section: develop
|
||||||
Priority: standard
|
Priority: standard
|
||||||
Maintainer: Polygon <release-team@polygon.technology>
|
Maintainer: Polygon <release-team@polygon.technology>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
Source: bor
|
Source: bor
|
||||||
Version: 1.3.0
|
Version: 1.3.1
|
||||||
Section: develop
|
Section: develop
|
||||||
Priority: standard
|
Priority: standard
|
||||||
Maintainer: Polygon <release-team@polygon.technology>
|
Maintainer: Polygon <release-team@polygon.technology>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
Source: bor-profile
|
Source: bor-profile
|
||||||
Version: 1.3.0
|
Version: 1.3.1
|
||||||
Section: develop
|
Section: develop
|
||||||
Priority: standard
|
Priority: standard
|
||||||
Maintainer: Polygon <release-team@polygon.technology>
|
Maintainer: Polygon <release-team@polygon.technology>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
Source: bor-profile
|
Source: bor-profile
|
||||||
Version: 1.3.0
|
Version: 1.3.1
|
||||||
Section: develop
|
Section: develop
|
||||||
Priority: standard
|
Priority: standard
|
||||||
Maintainer: Polygon <release-team@polygon.technology>
|
Maintainer: Polygon <release-team@polygon.technology>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
Source: bor-profile
|
Source: bor-profile
|
||||||
Version: 1.3.0
|
Version: 1.3.1
|
||||||
Section: develop
|
Section: develop
|
||||||
Priority: standard
|
Priority: standard
|
||||||
Maintainer: Polygon <release-team@polygon.technology>
|
Maintainer: Polygon <release-team@polygon.technology>
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
Source: bor-profile
|
Source: bor-profile
|
||||||
Version: 1.3.0
|
Version: 1.3.1
|
||||||
Section: develop
|
Section: develop
|
||||||
Priority: standard
|
Priority: standard
|
||||||
Maintainer: Polygon <release-team@polygon.technology>
|
Maintainer: Polygon <release-team@polygon.technology>
|
||||||
|
|
|
||||||
|
|
@ -960,9 +960,9 @@ func (c *ChainConfig) CheckConfigForkOrder() error {
|
||||||
{name: "arrowGlacierBlock", block: c.ArrowGlacierBlock, optional: true},
|
{name: "arrowGlacierBlock", block: c.ArrowGlacierBlock, optional: true},
|
||||||
{name: "grayGlacierBlock", block: c.GrayGlacierBlock, optional: true},
|
{name: "grayGlacierBlock", block: c.GrayGlacierBlock, optional: true},
|
||||||
{name: "mergeNetsplitBlock", block: c.MergeNetsplitBlock, optional: true},
|
{name: "mergeNetsplitBlock", block: c.MergeNetsplitBlock, optional: true},
|
||||||
{name: "ShanghaiBlock", block: c.ShanghaiBlock},
|
{name: "shanghaiBlock", block: c.ShanghaiBlock},
|
||||||
{name: "CancunBlock", block: c.CancunBlock, optional: true},
|
{name: "cancunBlock", block: c.CancunBlock, optional: true},
|
||||||
{name: "pragueTime", block: c.PragueBlock, optional: true},
|
{name: "pragueBlock", block: c.PragueBlock, optional: true},
|
||||||
} {
|
} {
|
||||||
if lastFork.name != "" {
|
if lastFork.name != "" {
|
||||||
switch {
|
switch {
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import (
|
||||||
const (
|
const (
|
||||||
VersionMajor = 1 // Major version component of the current release
|
VersionMajor = 1 // Major version component of the current release
|
||||||
VersionMinor = 3 // Minor version component of the current release
|
VersionMinor = 3 // Minor version component of the current release
|
||||||
VersionPatch = 0 // Patch version component of the current release
|
VersionPatch = 1 // Patch version component of the current release
|
||||||
VersionMeta = "" // Version metadata to append to the version string
|
VersionMeta = "" // Version metadata to append to the version string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -26,11 +26,5 @@ import (
|
||||||
|
|
||||||
// byteArrayBytes returns a slice of the byte array v.
|
// byteArrayBytes returns a slice of the byte array v.
|
||||||
func byteArrayBytes(v reflect.Value, length int) []byte {
|
func byteArrayBytes(v reflect.Value, length int) []byte {
|
||||||
var s []byte
|
return unsafe.Slice((*byte)(unsafe.Pointer(v.UnsafeAddr())), length)
|
||||||
hdr := (*reflect.SliceHeader)(unsafe.Pointer(&s))
|
|
||||||
hdr.Data = v.UnsafeAddr()
|
|
||||||
hdr.Cap = length
|
|
||||||
hdr.Len = length
|
|
||||||
|
|
||||||
return s
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue