merge: master

This commit is contained in:
anshalshukla 2024-08-13 11:48:57 +05:30
commit 4a9a875738
No known key found for this signature in database
GPG key ID: 84BE5474523D8CBC
60 changed files with 902 additions and 776 deletions

View file

@ -6,7 +6,7 @@ https://camo.githubusercontent.com/915b7be44ada53c290eb157634330494ebe3e30a/6874
)](https://pkg.go.dev/github.com/maticnetwork/bor) )](https://pkg.go.dev/github.com/maticnetwork/bor)
[![Go Report Card](https://goreportcard.com/badge/github.com/maticnetwork/bor)](https://goreportcard.com/report/github.com/maticnetwork/bor) [![Go Report Card](https://goreportcard.com/badge/github.com/maticnetwork/bor)](https://goreportcard.com/report/github.com/maticnetwork/bor)
![MIT License](https://img.shields.io/github/license/maticnetwork/bor) ![MIT License](https://img.shields.io/github/license/maticnetwork/bor)
[![Discord](https://img.shields.io/discord/714888181740339261?color=1C1CE1&label=Polygon%20%7C%20Discord%20%F0%9F%91%8B%20&style=flat-square)](https://discord.com/invite/0xPolygonDevs) [![Discord](https://img.shields.io/discord/714888181740339261?color=1C1CE1&label=Polygon%20%7C%20Discord%20%F0%9F%91%8B%20&style=flat-square)](https://discord.gg/0xpolygon)
[![Twitter Follow](https://img.shields.io/twitter/follow/0xPolygon.svg?style=social)](https://twitter.com/0xPolygon) [![Twitter Follow](https://img.shields.io/twitter/follow/0xPolygon.svg?style=social)](https://twitter.com/0xPolygon)
### Installing bor using packaging ### Installing bor using packaging

View file

@ -56,7 +56,7 @@ syncmode = "full"
[txpool] [txpool]
nolocals = true nolocals = true
pricelimit = 30000000000 pricelimit = 25000000000
accountslots = 16 accountslots = 16
globalslots = 32768 globalslots = 32768
accountqueue = 16 accountqueue = 16
@ -69,7 +69,7 @@ syncmode = "full"
[miner] [miner]
gaslimit = 30000000 gaslimit = 30000000
gasprice = "30000000000" gasprice = "25000000000"
# mine = true # mine = true
# etherbase = "VALIDATOR ADDRESS" # etherbase = "VALIDATOR ADDRESS"
# extradata = "" # extradata = ""
@ -127,7 +127,7 @@ syncmode = "full"
# maxheaderhistory = 1024 # maxheaderhistory = 1024
# maxblockhistory = 1024 # maxblockhistory = 1024
# maxprice = "5000000000000" # maxprice = "5000000000000"
ignoreprice = "30000000000" ignoreprice = "25000000000"
[telemetry] [telemetry]
metrics = true metrics = true

View file

@ -17,8 +17,8 @@ type IHeimdallClient interface {
FetchCheckpointCount(ctx context.Context) (int64, error) FetchCheckpointCount(ctx context.Context) (int64, error)
FetchMilestone(ctx context.Context) (*milestone.Milestone, error) FetchMilestone(ctx context.Context) (*milestone.Milestone, error)
FetchMilestoneCount(ctx context.Context) (int64, error) FetchMilestoneCount(ctx context.Context) (int64, error)
FetchNoAckMilestone(ctx context.Context, milestoneID string) error //Fetch the bool value whether milestone corresponding to the given id failed in the Heimdall FetchNoAckMilestone(ctx context.Context, milestoneID string) error // Fetch the bool value whether milestone corresponding to the given id failed in the Heimdall
FetchLastNoAckMilestone(ctx context.Context) (string, error) //Fetch latest failed milestone id FetchLastNoAckMilestone(ctx context.Context) (string, error) // Fetch latest failed milestone id
FetchMilestoneID(ctx context.Context, milestoneID string) error //Fetch the bool value whether milestone corresponding to the given id is in process in Heimdall FetchMilestoneID(ctx context.Context, milestoneID string) error // Fetch the bool value whether milestone corresponding to the given id is in process in Heimdall
Close() Close()
} }

View file

@ -14,30 +14,31 @@ import (
) )
func (h *HeimdallAppClient) FetchMilestoneCount(_ context.Context) (int64, error) { func (h *HeimdallAppClient) FetchMilestoneCount(_ context.Context) (int64, error) {
log.Info("Fetching milestone count") log.Debug("Fetching milestone count")
res := h.hApp.CheckpointKeeper.GetMilestoneCount(h.NewContext()) res := h.hApp.CheckpointKeeper.GetMilestoneCount(h.NewContext())
log.Info("Fetched Milestone Count") log.Debug("Fetched Milestone Count", "res", int64(res))
return int64(res), nil return int64(res), nil
} }
func (h *HeimdallAppClient) FetchMilestone(_ context.Context) (*milestone.Milestone, error) { func (h *HeimdallAppClient) FetchMilestone(_ context.Context) (*milestone.Milestone, error) {
log.Info("Fetching Latest Milestone") log.Debug("Fetching Latest Milestone")
res, err := h.hApp.CheckpointKeeper.GetLastMilestone(h.NewContext()) res, err := h.hApp.CheckpointKeeper.GetLastMilestone(h.NewContext())
if err != nil { if err != nil {
return nil, err return nil, err
} }
log.Info("Fetched Latest Milestone") milestone := toBorMilestone(res)
log.Debug("Fetched Latest Milestone", "milestone", milestone)
return toBorMilestone(res), nil return milestone, nil
} }
func (h *HeimdallAppClient) FetchNoAckMilestone(_ context.Context, milestoneID string) error { func (h *HeimdallAppClient) FetchNoAckMilestone(_ context.Context, milestoneID string) error {
log.Info("Fetching No Ack Milestone By MilestoneID", "MilestoneID", milestoneID) log.Debug("Fetching No Ack Milestone By MilestoneID", "MilestoneID", milestoneID)
res := h.hApp.CheckpointKeeper.GetNoAckMilestone(h.NewContext(), milestoneID) res := h.hApp.CheckpointKeeper.GetNoAckMilestone(h.NewContext(), milestoneID)
if res { if res {
@ -45,21 +46,21 @@ func (h *HeimdallAppClient) FetchNoAckMilestone(_ context.Context, milestoneID s
return nil return nil
} }
return fmt.Errorf("Still No Ack Milestone exist corresponding to MilestoneId:%v", milestoneID) return fmt.Errorf("still no-ack milestone exist corresponding to milestoneID: %v", milestoneID)
} }
func (h *HeimdallAppClient) FetchLastNoAckMilestone(_ context.Context) (string, error) { func (h *HeimdallAppClient) FetchLastNoAckMilestone(_ context.Context) (string, error) {
log.Info("Fetching Latest No Ack Milestone ID") log.Debug("Fetching Latest No Ack Milestone ID")
res := h.hApp.CheckpointKeeper.GetLastNoAckMilestone(h.NewContext()) res := h.hApp.CheckpointKeeper.GetLastNoAckMilestone(h.NewContext())
log.Info("Fetched Latest No Ack Milestone ID") log.Debug("Fetched Latest No Ack Milestone ID", "res", res)
return res, nil return res, nil
} }
func (h *HeimdallAppClient) FetchMilestoneID(_ context.Context, milestoneID string) error { func (h *HeimdallAppClient) FetchMilestoneID(_ context.Context, milestoneID string) error {
log.Info("Fetching Milestone ID ", "MilestoneID", milestoneID) log.Debug("Fetching Milestone ID ", "MilestoneID", milestoneID)
res := chTypes.GetMilestoneID() res := chTypes.GetMilestoneID()
@ -67,7 +68,7 @@ func (h *HeimdallAppClient) FetchMilestoneID(_ context.Context, milestoneID stri
return nil return nil
} }
return fmt.Errorf("Milestone corresponding to Milestone ID:%v doesn't exist in Heimdall", milestoneID) return fmt.Errorf("milestone corresponding to milestoneID: %v doesn't exist in heimdall", milestoneID)
} }
func toBorMilestone(hdMilestone *hmTypes.Milestone) *milestone.Milestone { func toBorMilestone(hdMilestone *hmTypes.Milestone) *milestone.Milestone {

View file

@ -5,6 +5,7 @@ import (
"fmt" "fmt"
"math/big" "math/big"
"github.com/ethereum/go-ethereum/consensus/bor/heimdall"
"github.com/ethereum/go-ethereum/consensus/bor/heimdall/milestone" "github.com/ethereum/go-ethereum/consensus/bor/heimdall/milestone"
"github.com/ethereum/go-ethereum/log" "github.com/ethereum/go-ethereum/log"
@ -48,14 +49,14 @@ func (h *HeimdallGRPCClient) FetchMilestone(ctx context.Context) (*milestone.Mil
} }
func (h *HeimdallGRPCClient) FetchLastNoAckMilestone(ctx context.Context) (string, error) { func (h *HeimdallGRPCClient) FetchLastNoAckMilestone(ctx context.Context) (string, error) {
log.Info("Fetching latest no ack milestone Id") log.Debug("Fetching latest no ack milestone Id")
res, err := h.client.FetchLastNoAckMilestone(ctx, nil) res, err := h.client.FetchLastNoAckMilestone(ctx, nil)
if err != nil { if err != nil {
return "", err return "", err
} }
log.Info("Fetched last no-ack milestone") log.Debug("Fetched last no-ack milestone", "res", res.Result.Result)
return res.Result.Result, nil return res.Result.Result, nil
} }
@ -65,7 +66,7 @@ func (h *HeimdallGRPCClient) FetchNoAckMilestone(ctx context.Context, milestoneI
MilestoneID: milestoneID, MilestoneID: milestoneID,
} }
log.Info("Fetching no ack milestone", "milestoneaID", milestoneID) log.Debug("Fetching no ack milestone", "milestoneID", milestoneID)
res, err := h.client.FetchNoAckMilestone(ctx, req) res, err := h.client.FetchNoAckMilestone(ctx, req)
if err != nil { if err != nil {
@ -73,10 +74,10 @@ func (h *HeimdallGRPCClient) FetchNoAckMilestone(ctx context.Context, milestoneI
} }
if !res.Result.Result { if !res.Result.Result {
return fmt.Errorf("Not in rejected list: milestoneID %q", milestoneID) return fmt.Errorf("%w: milestoneID %q", heimdall.ErrNotInRejectedList, milestoneID)
} }
log.Info("Fetched no ack milestone", "milestoneaID", milestoneID) log.Debug("Fetched no ack milestone", "milestoneID", milestoneID)
return nil return nil
} }
@ -86,7 +87,7 @@ func (h *HeimdallGRPCClient) FetchMilestoneID(ctx context.Context, milestoneID s
MilestoneID: milestoneID, MilestoneID: milestoneID,
} }
log.Info("Fetching milestone id", "milestoneID", milestoneID) log.Debug("Fetching milestone id", "milestoneID", milestoneID)
res, err := h.client.FetchMilestoneID(ctx, req) res, err := h.client.FetchMilestoneID(ctx, req)
if err != nil { if err != nil {
@ -94,10 +95,10 @@ func (h *HeimdallGRPCClient) FetchMilestoneID(ctx context.Context, milestoneID s
} }
if !res.Result.Result { if !res.Result.Result {
return fmt.Errorf("This milestoneID %q does not exist", milestoneID) return fmt.Errorf("%w: milestoneID %q", heimdall.ErrNotInMilestoneList, milestoneID)
} }
log.Info("Fetched milestone id", "milestoneID", milestoneID) log.Debug("Fetched milestone id", "milestoneID", milestoneID)
return nil return nil
} }

View file

@ -268,6 +268,7 @@ func resolveOffset(db ethdb.KeyValueStore, isLastOffset bool) uint64 {
//nolint:gocognit //nolint:gocognit
func NewDatabaseWithFreezer(db ethdb.KeyValueStore, ancient string, namespace string, readonly, disableFreeze, isLastOffset bool) (ethdb.Database, error) { func NewDatabaseWithFreezer(db ethdb.KeyValueStore, ancient string, namespace string, readonly, disableFreeze, isLastOffset bool) (ethdb.Database, error) {
offset := resolveOffset(db, isLastOffset) offset := resolveOffset(db, isLastOffset)
log.Info("Resolving ancient pruner offset", "isLastOffset", isLastOffset, "offset", offset)
// Create the idle freezer instance. If the given ancient directory is empty, // Create the idle freezer instance. If the given ancient directory is empty,
// in-memory chain freezer is used (e.g. dev mode); otherwise the regular // in-memory chain freezer is used (e.g. dev mode); otherwise the regular

View file

@ -168,7 +168,7 @@ func (config *Config) sanitize() Config {
log.Warn("Sanitizing invalid txpool journal time", "provided", conf.Rejournal, "updated", time.Second) log.Warn("Sanitizing invalid txpool journal time", "provided", conf.Rejournal, "updated", time.Second)
conf.Rejournal = time.Second conf.Rejournal = time.Second
} }
// enforce txpool price limit to 30gwei in bor // PIP-35: Enforce min price limit to 25 gwei
if conf.PriceLimit != params.BorDefaultTxPoolPriceLimit { if conf.PriceLimit != params.BorDefaultTxPoolPriceLimit {
log.Warn("Sanitizing invalid txpool price limit", "provided", conf.PriceLimit, "updated", DefaultConfig.PriceLimit) log.Warn("Sanitizing invalid txpool price limit", "provided", conf.PriceLimit, "updated", DefaultConfig.PriceLimit)
conf.PriceLimit = DefaultConfig.PriceLimit conf.PriceLimit = DefaultConfig.PriceLimit

View file

@ -63,7 +63,7 @@ func init() {
testTxPoolConfig = DefaultConfig testTxPoolConfig = DefaultConfig
testTxPoolConfig.Journal = "" testTxPoolConfig.Journal = ""
/* /*
Given the introduction of `BorDefaultTxPoolPriceLimit=30gwei`, Given the introduction of `BorDefaultTxPoolPriceLimit=25gwei`,
we set `testTxPoolConfig.PriceLimit = 1` to avoid rewriting all `legacypool_test.go` tests, we set `testTxPoolConfig.PriceLimit = 1` to avoid rewriting all `legacypool_test.go` tests,
causing code divergence from geth, as this has been widely tested on different networks. causing code divergence from geth, as this has been widely tested on different networks.
Also, `worker_test.go` has been adapted to reflect such changes. Also, `worker_test.go` has been adapted to reflect such changes.

View file

@ -125,7 +125,7 @@ func TestFilterTxConditional(t *testing.T) {
// and add to the list. // and add to the list.
tx2 := transaction(1, 1000, key) tx2 := transaction(1, 1000, key)
var options types.OptionsAA4337 var options types.OptionsPIP15
options.KnownAccounts = types.KnownAccounts{ options.KnownAccounts = types.KnownAccounts{
common.Address{19: 1}: &types.Value{ common.Address{19: 1}: &types.Value{

View file

@ -190,8 +190,8 @@ func (h *Header) EmptyReceipts() bool {
return h.ReceiptHash == EmptyReceiptsHash return h.ReceiptHash == EmptyReceiptsHash
} }
// ValidateBlockNumberOptions4337 validates the block range passed as in the options parameter in the conditional transaction (EIP-4337) // ValidateBlockNumberOptionsPIP15 validates the block range passed as in the options parameter in the conditional transaction (PIP-15)
func (h *Header) ValidateBlockNumberOptions4337(minBlockNumber *big.Int, maxBlockNumber *big.Int) error { func (h *Header) ValidateBlockNumberOptionsPIP15(minBlockNumber *big.Int, maxBlockNumber *big.Int) error {
currentBlockNumber := h.Number currentBlockNumber := h.Number
if minBlockNumber != nil { if minBlockNumber != nil {
@ -209,8 +209,8 @@ func (h *Header) ValidateBlockNumberOptions4337(minBlockNumber *big.Int, maxBloc
return nil return nil
} }
// ValidateBlockNumberOptions4337 validates the timestamp range passed as in the options parameter in the conditional transaction (EIP-4337) // ValidateBlockNumberOptionsPIP15 validates the timestamp range passed as in the options parameter in the conditional transaction (PIP-15)
func (h *Header) ValidateTimestampOptions4337(minTimestamp *uint64, maxTimestamp *uint64) error { func (h *Header) ValidateTimestampOptionsPIP15(minTimestamp *uint64, maxTimestamp *uint64) error {
currentBlockTime := h.Time currentBlockTime := h.Time
if minTimestamp != nil { if minTimestamp != nil {

View file

@ -434,7 +434,7 @@ func TestRlpDecodeParentHash(t *testing.T) {
} }
} }
func TestValidateBlockNumberOptions4337(t *testing.T) { func TestValidateBlockNumberOptionsPIP15(t *testing.T) {
t.Parallel() t.Parallel()
testsPass := []struct { testsPass := []struct {
@ -502,19 +502,19 @@ func TestValidateBlockNumberOptions4337(t *testing.T) {
} }
for _, test := range testsPass { for _, test := range testsPass {
if err := test.header.ValidateBlockNumberOptions4337(test.minBlockNumber, test.maxBlockNumber); err != nil { if err := test.header.ValidateBlockNumberOptionsPIP15(test.minBlockNumber, test.maxBlockNumber); err != nil {
t.Fatalf("test number %v should not have failed. err: %v", test.number, err) t.Fatalf("test number %v should not have failed. err: %v", test.number, err)
} }
} }
for _, test := range testsFail { for _, test := range testsFail {
if err := test.header.ValidateBlockNumberOptions4337(test.minBlockNumber, test.maxBlockNumber); err == nil { if err := test.header.ValidateBlockNumberOptionsPIP15(test.minBlockNumber, test.maxBlockNumber); err == nil {
t.Fatalf("test number %v should have failed. err is nil", test.number) t.Fatalf("test number %v should have failed. err is nil", test.number)
} }
} }
} }
func TestValidateTimestampOptions4337(t *testing.T) { func TestValidateTimestampOptionsPIP15(t *testing.T) {
t.Parallel() t.Parallel()
u64Ptr := func(n uint64) *uint64 { u64Ptr := func(n uint64) *uint64 {
@ -586,13 +586,13 @@ func TestValidateTimestampOptions4337(t *testing.T) {
} }
for _, test := range testsPass { for _, test := range testsPass {
if err := test.header.ValidateTimestampOptions4337(test.minTimestamp, test.maxTimestamp); err != nil { if err := test.header.ValidateTimestampOptionsPIP15(test.minTimestamp, test.maxTimestamp); err != nil {
t.Fatalf("test number %v should not have failed. err: %v", test.number, err) t.Fatalf("test number %v should not have failed. err: %v", test.number, err)
} }
} }
for _, test := range testsFail { for _, test := range testsFail {
if err := test.header.ValidateTimestampOptions4337(test.minTimestamp, test.maxTimestamp); err == nil { if err := test.header.ValidateTimestampOptionsPIP15(test.minTimestamp, test.maxTimestamp); err == nil {
t.Fatalf("test number %v should have failed. err is nil", test.number) t.Fatalf("test number %v should have failed. err is nil", test.number)
} }
} }

View file

@ -57,8 +57,9 @@ type Transaction struct {
inner TxData // Consensus contents of a transaction inner TxData // Consensus contents of a transaction
time time.Time // Time first seen locally (spam avoidance) time time.Time // Time first seen locally (spam avoidance)
// knownAccounts (EIP-4337) // BOR specific - DO NOT REMOVE
optionsAA4337 *OptionsAA4337 // knownAccounts (PIP-15)
optionsPIP15 *OptionsPIP15
// caches // caches
hash atomic.Pointer[common.Hash] hash atomic.Pointer[common.Hash]
@ -106,14 +107,14 @@ type TxData interface {
decode([]byte) error decode([]byte) error
} }
// PutOptions stores the optionsAA4337 field of the conditional transaction (EIP-4337) // PutOptions stores the optionsPIP15 field of the conditional transaction (PIP-15)
func (tx *Transaction) PutOptions(options *OptionsAA4337) { func (tx *Transaction) PutOptions(options *OptionsPIP15) {
tx.optionsAA4337 = options tx.optionsPIP15 = options
} }
// GetOptions returns the optionsAA4337 field of the conditional transaction (EIP-4337) // GetOptions returns the optionsPIP15 field of the conditional transaction (PIP-15)
func (tx *Transaction) GetOptions() *OptionsAA4337 { func (tx *Transaction) GetOptions() *OptionsPIP15 {
return tx.optionsAA4337 return tx.optionsPIP15
} }
// EncodeRLP implements rlp.Encoder // EncodeRLP implements rlp.Encoder

View file

@ -112,7 +112,7 @@ func InsertKnownAccounts[T common.Hash | map[common.Hash]common.Hash](accounts K
} }
} }
type OptionsAA4337 struct { type OptionsPIP15 struct {
KnownAccounts KnownAccounts `json:"knownAccounts"` KnownAccounts KnownAccounts `json:"knownAccounts"`
BlockNumberMin *big.Int `json:"blockNumberMin"` BlockNumberMin *big.Int `json:"blockNumberMin"`
BlockNumberMax *big.Int `json:"blockNumberMax"` BlockNumberMax *big.Int `json:"blockNumberMax"`

View file

@ -61,7 +61,7 @@ devfakeauthor = false # Run miner without validator set authorization
nolocals = false # Disables price exemptions for locally submitted transactions nolocals = false # Disables price exemptions for locally submitted transactions
journal = "transactions.rlp" # Disk journal for local transaction to survive node restarts journal = "transactions.rlp" # Disk journal for local transaction to survive node restarts
rejournal = "1h0m0s" # Time interval to regenerate the local transaction journal rejournal = "1h0m0s" # Time interval to regenerate the local transaction journal
pricelimit = 30000000000 # Minimum gas price limit to enforce for acceptance into the pool. Regardless the value set, it will be enforced to 30000000000 in bor. pricelimit = 25000000000 # Minimum gas price limit to enforce for acceptance into the pool. Regardless the value set, it will be enforced to 25000000000 for all networks
pricebump = 10 # Price bump percentage to replace an already existing transaction pricebump = 10 # Price bump percentage to replace an already existing transaction
accountslots = 16 # Minimum number of executable transaction slots guaranteed per account accountslots = 16 # Minimum number of executable transaction slots guaranteed per account
globalslots = 32768 # Maximum number of executable transaction slots for all accounts globalslots = 32768 # Maximum number of executable transaction slots for all accounts
@ -74,7 +74,7 @@ devfakeauthor = false # Run miner without validator set authorization
etherbase = "" # Public address for block mining rewards etherbase = "" # Public address for block mining rewards
extradata = "" # Block extra data set by the miner (default = client version) extradata = "" # Block extra data set by the miner (default = client version)
gaslimit = 30000000 # Target gas ceiling for mined blocks gaslimit = 30000000 # Target gas ceiling for mined blocks
gasprice = "30000000000" # Minimum gas price for mining a transaction. Regardless the value set, it will be enforced to 30000000000 in bor, default suitable for amoy/mumbai/devnet. gasprice = "25000000000" # Minimum gas price for mining a transaction. Regardless the value set, it will be enforced to 25000000000 for all networks
recommit = "2m5s" # The time interval for miner to re-create mining work recommit = "2m5s" # The time interval for miner to re-create mining work
commitinterrupt = true # Interrupt the current mining work when time is exceeded and create partial blocks commitinterrupt = true # Interrupt the current mining work when time is exceeded and create partial blocks
@ -128,7 +128,7 @@ devfakeauthor = false # Run miner without validator set authorization
maxheaderhistory = 1024 # Maximum header history of gasprice oracle maxheaderhistory = 1024 # Maximum header history of gasprice oracle
maxblockhistory = 1024 # Maximum block history of gasprice oracle maxblockhistory = 1024 # Maximum block history of gasprice oracle
maxprice = "5000000000000" # Maximum gas price will be recommended by gpo maxprice = "5000000000000" # Maximum gas price will be recommended by gpo
ignoreprice = "2" # Gas price below which gpo will ignore transactions (recommended for mainnet = 30000000000, default suitable for amoy/mumbai/devnet) ignoreprice = "25000000000" # Gas price below which gpo will ignore transactions. Regardless the value set, it will be enforced to 25000000000 for all networks
[telemetry] [telemetry]
metrics = false # Enable metrics collection and reporting metrics = false # Enable metrics collection and reporting

View file

@ -46,7 +46,7 @@ The ```bor server``` command runs the Bor client.
- ```gpo.blocks```: Number of recent blocks to check for gas prices (default: 20) - ```gpo.blocks```: Number of recent blocks to check for gas prices (default: 20)
- ```gpo.ignoreprice```: Gas price below which gpo will ignore transactions (default: 30000000000). It's set to 30gwei in bor - ```gpo.ignoreprice```: Gas price below which gpo will ignore transactions (default: 25000000000)
- ```gpo.maxblockhistory```: Maximum block history of gasprice oracle (default: 1024) - ```gpo.maxblockhistory```: Maximum block history of gasprice oracle (default: 1024)
@ -250,7 +250,7 @@ The ```bor server``` command runs the Bor client.
- ```miner.gaslimit```: Target gas ceiling (gas limit) for mined blocks (default: 30000000) - ```miner.gaslimit```: Target gas ceiling (gas limit) for mined blocks (default: 30000000)
- ```miner.gasprice```: Minimum gas price for mining a transaction (default: 30000000000). It's set to 30gwei in bor - ```miner.gasprice```: Minimum gas price for mining a transaction (default: 25000000000)
- ```miner.interruptcommit```: Interrupt block commit when block creation time is passed (default: true) - ```miner.interruptcommit```: Interrupt block commit when block creation time is passed (default: true)
@ -306,6 +306,6 @@ The ```bor server``` command runs the Bor client.
- ```txpool.pricebump```: Price bump percentage to replace an already existing transaction (default: 10) - ```txpool.pricebump```: Price bump percentage to replace an already existing transaction (default: 10)
- ```txpool.pricelimit```: Minimum gas price limit to enforce the acceptance of txs into the pool (default: 30000000000). It's set to 30gwei in bor - ```txpool.pricelimit```: Minimum gas price limit to enforce for acceptance into the pool (default: 25000000000)
- ```txpool.rejournal```: Time interval to regenerate the local transaction journal (default: 1h0m0s) - ```txpool.rejournal```: Time interval to regenerate the local transaction journal (default: 1h0m0s)

View file

@ -121,11 +121,13 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
if !config.SyncMode.IsValid() { if !config.SyncMode.IsValid() {
return nil, fmt.Errorf("invalid sync mode %d", config.SyncMode) return nil, fmt.Errorf("invalid sync mode %d", config.SyncMode)
} }
// enforce minimum gas price of 30 gwei in bor
// PIP-35: Enforce min gas price to 25 gwei
if config.Miner.GasPrice == nil || config.Miner.GasPrice.Cmp(big.NewInt(params.BorDefaultMinerGasPrice)) != 0 { if config.Miner.GasPrice == nil || config.Miner.GasPrice.Cmp(big.NewInt(params.BorDefaultMinerGasPrice)) != 0 {
log.Warn("Sanitizing invalid miner gas price", "provided", config.Miner.GasPrice, "updated", ethconfig.Defaults.Miner.GasPrice) log.Warn("Sanitizing invalid miner gas price", "provided", config.Miner.GasPrice, "updated", ethconfig.Defaults.Miner.GasPrice)
config.Miner.GasPrice = new(big.Int).Set(ethconfig.Defaults.Miner.GasPrice) config.Miner.GasPrice = ethconfig.Defaults.Miner.GasPrice
} }
if config.NoPruning && config.TrieDirtyCache > 0 { if config.NoPruning && config.TrieDirtyCache > 0 {
if config.SnapshotCache > 0 { if config.SnapshotCache > 0 {
config.TrieCleanCache += config.TrieDirtyCache * 3 / 5 config.TrieCleanCache += config.TrieDirtyCache * 3 / 5
@ -290,6 +292,11 @@ func New(stack *node.Node, config *ethconfig.Config) (*Ethereum, error) {
if err != nil { if err != nil {
return nil, err return nil, err
} }
// The `config.TxPool.PriceLimit` used above doesn't reflect the sanitized/enforced changes
// made in the txpool. Update the `gasTip` explicitly to reflect the enforced value.
eth.txPool.SetGasTip(new(big.Int).SetUint64(params.BorDefaultTxPoolPriceLimit))
// Permit the downloader to use the trie cache allowance during fast sync // Permit the downloader to use the trie cache allowance during fast sync
cacheLimit := cacheConfig.TrieCleanLimit + cacheConfig.TrieDirtyLimit + cacheConfig.SnapshotLimit cacheLimit := cacheConfig.TrieCleanLimit + cacheConfig.TrieDirtyLimit + cacheConfig.SnapshotLimit
if eth.handler, err = newHandler(&handlerConfig{ if eth.handler, err = newHandler(&handlerConfig{
@ -698,16 +705,12 @@ func retryHeimdallHandler(fn heimdallHandler, tickerDuration time.Duration, time
return return
} }
// first run for fetching milestones // first run
firstCtx, cancel := context.WithTimeout(context.Background(), timeout) firstCtx, cancel := context.WithTimeout(context.Background(), timeout)
err = fn(firstCtx, ethHandler, bor) _ = fn(firstCtx, ethHandler, bor)
cancel() cancel()
if err != nil {
log.Warn(fmt.Sprintf("unable to start the %s service - first run", fnName), "err", err)
}
ticker := time.NewTicker(tickerDuration) ticker := time.NewTicker(tickerDuration)
defer ticker.Stop() defer ticker.Stop()
@ -715,13 +718,11 @@ func retryHeimdallHandler(fn heimdallHandler, tickerDuration time.Duration, time
select { select {
case <-ticker.C: case <-ticker.C:
ctx, cancel := context.WithTimeout(context.Background(), timeout) ctx, cancel := context.WithTimeout(context.Background(), timeout)
err := fn(ctx, ethHandler, bor)
// Skip any error reporting here as it's handled in respective functions
_ = fn(ctx, ethHandler, bor)
cancel() cancel()
if err != nil {
log.Warn(fmt.Sprintf("unable to handle %s", fnName), "err", err)
}
case <-closeCh: case <-closeCh:
return return
} }
@ -757,7 +758,7 @@ func (s *Ethereum) handleMilestone(ctx context.Context, ethHandler *ethHandler,
// If the current chain head is behind the received milestone, add it to the future milestone // If the current chain head is behind the received milestone, add it to the future milestone
// list. Also, the hash mismatch (end block hash) error will lead to rewind so also // list. Also, the hash mismatch (end block hash) error will lead to rewind so also
// add that milestone to the future milestone list. // add that milestone to the future milestone list.
if errors.Is(err, errMissingBlocks) || errors.Is(err, errHashMismatch) { if errors.Is(err, errChainOutOfSync) || errors.Is(err, errHashMismatch) {
ethHandler.downloader.ProcessFutureMilestone(num, hash) ethHandler.downloader.ProcessFutureMilestone(num, hash)
} }

View file

@ -53,16 +53,16 @@ func (b *EthAPIBackend) GetVoteOnHash(ctx context.Context, starBlockNr uint64, e
return false, errBorEngineNotAvailable return false, errBorEngineNotAvailable
} }
//Confirmation of 16 blocks on the endblock // Confirmation of 16 blocks on the endblock
tipConfirmationBlockNr := endBlockNr + uint64(16) tipConfirmationBlockNr := endBlockNr + uint64(16)
//Check if tipConfirmation block exit // Check if tipConfirmation block exit
_, err := b.BlockByNumber(ctx, rpc.BlockNumber(tipConfirmationBlockNr)) _, err := b.BlockByNumber(ctx, rpc.BlockNumber(tipConfirmationBlockNr))
if err != nil { if err != nil {
return false, errTipConfirmationBlock return false, errTipConfirmationBlock
} }
//Check if end block exist // Check if end block exist
localEndBlock, err := b.BlockByNumber(ctx, rpc.BlockNumber(endBlockNr)) localEndBlock, err := b.BlockByNumber(ctx, rpc.BlockNumber(endBlockNr))
if err != nil { if err != nil {
return false, errEndBlock return false, errEndBlock
@ -75,12 +75,12 @@ func (b *EthAPIBackend) GetVoteOnHash(ctx context.Context, starBlockNr uint64, e
if !isLocked { if !isLocked {
downloader.UnlockMutex(false, "", endBlockNr, common.Hash{}) downloader.UnlockMutex(false, "", endBlockNr, common.Hash{})
return false, errors.New("Whitelisted number or locked sprint number is more than the received end block number") return false, errors.New("whitelisted number or locked sprint number is more than the received end block number")
} }
if localEndBlockHash != hash { if localEndBlockHash != hash {
downloader.UnlockMutex(false, "", endBlockNr, common.Hash{}) downloader.UnlockMutex(false, "", endBlockNr, common.Hash{})
return false, fmt.Errorf("Hash mismatch: localChainHash %s, milestoneHash %s", localEndBlockHash, hash) return false, fmt.Errorf("hash mismatch: localChainHash %s, milestoneHash %s", localEndBlockHash, hash)
} }
downloader.UnlockMutex(true, milestoneId, endBlockNr, localEndBlock.Hash()) downloader.UnlockMutex(true, milestoneId, endBlockNr, localEndBlock.Hash())

View file

@ -12,12 +12,16 @@ import (
) )
var ( var (
// errMissingBlocks is returned when we don't have the blocks locally, yet. // errMissingCurrentBlock is returned when we don't have the current block
errMissingBlocks = errors.New("missing blocks") // present locally.
errMissingCurrentBlock = errors.New("current block missing")
// errRootHash is returned when we aren't able to calculate the root hash // errChainOutOfSync is returned when we're trying to process a future
// locally for a range of blocks. // checkpoint/milestone and we haven't reached at that number yet.
errRootHash = errors.New("failed to get local root hash") errChainOutOfSync = errors.New("chain out of sync")
// errRootHash is returned when the root hash calculation for a range of blocks fails.
errRootHash = errors.New("root hash calculation failed")
// errHashMismatch is returned when the local hash doesn't match // errHashMismatch is returned when the local hash doesn't match
// with the hash of checkpoint/milestone. It is the root hash of blocks // with the hash of checkpoint/milestone. It is the root hash of blocks
@ -27,13 +31,10 @@ var (
// errEndBlock is returned when we're unable to fetch a block locally. // errEndBlock is returned when we're unable to fetch a block locally.
errEndBlock = errors.New("failed to get end block") errEndBlock = errors.New("failed to get end block")
// errEndBlock is returned when we're unable to fetch a block locally. // errEndBlock is returned when we're unable to fetch the tip confirmation block locally.
errTipConfirmationBlock = errors.New("failed to get tip confirmation block") errTipConfirmationBlock = errors.New("failed to get tip confirmation block")
// errBlockNumberConversion is returned when we get err in parsing hexautil block number // rewindLengthMeter for collecting info about the length of chain rewinded
errBlockNumberConversion = errors.New("failed to parse the block number")
//Metrics for collecting the rewindLength
rewindLengthMeter = metrics.NewRegisteredMeter("chain/autorewind/length", nil) rewindLengthMeter = metrics.NewRegisteredMeter("chain/autorewind/length", nil)
) )
@ -57,14 +58,14 @@ func borVerify(ctx context.Context, eth *Ethereum, handler *ethHandler, start ui
currentBlock := eth.BlockChain().CurrentBlock() currentBlock := eth.BlockChain().CurrentBlock()
if currentBlock == nil { if currentBlock == nil {
log.Debug(fmt.Sprintf("Failed to fetch current block from blockchain while verifying incoming %s", str)) log.Debug(fmt.Sprintf("Failed to fetch current block from blockchain while verifying incoming %s", str))
return hash, errMissingBlocks return hash, errMissingCurrentBlock
} }
head := currentBlock.Number.Uint64() head := currentBlock.Number.Uint64()
if head < end { if head < end {
log.Debug(fmt.Sprintf("Current head block behind incoming %s block", str), "head", head, "end block", end) log.Debug(fmt.Sprintf("Current head block behind incoming %s block", str), "head", head, "end block", end)
return hash, errMissingBlocks return hash, errChainOutOfSync
} }
var localHash string var localHash string
@ -77,15 +78,15 @@ func borVerify(ctx context.Context, eth *Ethereum, handler *ethHandler, start ui
localHash, err = handler.ethAPI.GetRootHash(ctx, start, end) localHash, err = handler.ethAPI.GetRootHash(ctx, start, end)
if err != nil { if err != nil {
log.Debug("Failed to get root hash of given block range while whitelisting checkpoint", "start", start, "end", end, "err", err) log.Debug("Failed to calculate root hash of given block range while whitelisting checkpoint", "start", start, "end", end, "err", err)
return hash, errRootHash return hash, fmt.Errorf("%w: %v", errRootHash, err)
} }
} else { } else {
// in case of milestone(isCheckpoint==false) get the hash of endBlock // in case of milestone(isCheckpoint==false) get the hash of endBlock
block, err := handler.ethAPI.GetBlockByNumber(ctx, rpc.BlockNumber(end), false) block, err := handler.ethAPI.GetBlockByNumber(ctx, rpc.BlockNumber(end), false)
if err != nil { if err != nil {
log.Debug("Failed to get end block hash while whitelisting milestone", "number", end, "err", err) log.Debug("Failed to get end block hash while whitelisting milestone", "number", end, "err", err)
return hash, errEndBlock return hash, fmt.Errorf("%w: %v", errEndBlock, err)
} }
localHash = fmt.Sprintf("%v", block["hash"])[2:] localHash = fmt.Sprintf("%v", block["hash"])[2:]
@ -93,7 +94,6 @@ func borVerify(ctx context.Context, eth *Ethereum, handler *ethHandler, start ui
//nolint //nolint
if localHash != hash { if localHash != hash {
if isCheckpoint { if isCheckpoint {
log.Warn("Root hash mismatch while whitelisting checkpoint", "expected", localHash, "got", hash) log.Warn("Root hash mismatch while whitelisting checkpoint", "expected", localHash, "got", hash)
} else { } else {
@ -124,9 +124,9 @@ func borVerify(ctx context.Context, eth *Ethereum, handler *ethHandler, start ui
} }
if isCheckpoint { if isCheckpoint {
log.Warn("Rewinding chain due to checkpoint root hash mismatch", "number", rewindTo) log.Info("Rewinding chain due to checkpoint root hash mismatch", "number", rewindTo)
} else { } else {
log.Warn("Rewinding chain due to milestone endblock hash mismatch", "number", rewindTo) log.Info("Rewinding chain due to milestone endblock hash mismatch", "number", rewindTo)
} }
rewindBack(eth, head, rewindTo) rewindBack(eth, head, rewindTo)
@ -138,7 +138,7 @@ func borVerify(ctx context.Context, eth *Ethereum, handler *ethHandler, start ui
block, err := handler.ethAPI.GetBlockByNumber(ctx, rpc.BlockNumber(end), false) block, err := handler.ethAPI.GetBlockByNumber(ctx, rpc.BlockNumber(end), false)
if err != nil { if err != nil {
log.Debug("Failed to get end block hash while whitelisting", "err", err) log.Debug("Failed to get end block hash while whitelisting", "err", err)
return hash, errEndBlock return hash, fmt.Errorf("%w: %v", errEndBlock, err)
} }
hash = fmt.Sprintf("%v", block["hash"]) hash = fmt.Sprintf("%v", block["hash"])
@ -170,5 +170,4 @@ func rewind(eth *Ethereum, head uint64, rewindTo uint64) {
} else { } else {
rewindLengthMeter.Mark(int64(head - rewindTo)) rewindLengthMeter.Mark(int64(head - rewindTo))
} }
} }

View file

@ -84,7 +84,7 @@ func generateMergeChain(n int, merged bool) (*core.Genesis, []*types.Block) {
generate := func(i int, g *core.BlockGen) { generate := func(i int, g *core.BlockGen) {
g.OffsetTime(5) g.OffsetTime(5)
g.SetExtra([]byte("test")) g.SetExtra([]byte("test"))
tx, _ := types.SignTx(types.NewTransaction(testNonce, common.HexToAddress("0x9a9070028361F7AAbeB3f2F2Dc07F82C4a98A02a"), big.NewInt(1), params.TxGas, big.NewInt(params.InitialBaseFee*32), nil), types.LatestSigner(&config), testKey) tx, _ := types.SignTx(types.NewTransaction(testNonce, common.HexToAddress("0x9a9070028361F7AAbeB3f2F2Dc07F82C4a98A02a"), big.NewInt(1), params.TxGas, big.NewInt(params.InitialBaseFee*26), nil), types.LatestSigner(&config), testKey)
g.AddTx(tx) g.AddTx(tx)
testNonce++ testNonce++
} }
@ -603,7 +603,7 @@ func TestNewPayloadOnInvalidChain(t *testing.T) {
Nonce: statedb.GetNonce(testAddr), Nonce: statedb.GetNonce(testAddr),
Value: new(big.Int), Value: new(big.Int),
Gas: 1000000, Gas: 1000000,
GasPrice: big.NewInt(32 * params.InitialBaseFee), GasPrice: big.NewInt(26 * params.InitialBaseFee),
Data: logCode, Data: logCode,
}) })
ethservice.TxPool().Add([]*types.Transaction{tx}, false, true) ethservice.TxPool().Add([]*types.Transaction{tx}, false, true)

View file

@ -18,6 +18,7 @@ type finality[T rawdb.BlockFinality[T]] struct {
Number uint64 // Number , populated by reaching out to heimdall Number uint64 // Number , populated by reaching out to heimdall
interval uint64 // Interval, until which we can allow importing interval uint64 // Interval, until which we can allow importing
doExist bool doExist bool
name string // Name of the service (checkpoint or milestone)
} }
type finalityService interface { type finalityService interface {
@ -43,21 +44,33 @@ func (f *finality[T]) IsValidPeer(fetchHeadersByNumber func(number uint64, amoun
return isValidPeer(fetchHeadersByNumber, doExist, number, hash) return isValidPeer(fetchHeadersByNumber, doExist, number, hash)
} }
// IsValidChain checks the validity of chain by comparing it // IsValidChain checks the validity of chain by comparing it against the local
// against the local checkpoint entry // whitelisted entry of checkpoint/milestone.
// todo: need changes
func (f *finality[T]) IsValidChain(currentHeader *types.Header, chain []*types.Header) (bool, error) { func (f *finality[T]) IsValidChain(currentHeader *types.Header, chain []*types.Header) (bool, error) {
// Return if we've received empty chain // Return if we've received empty chain
if len(chain) == 0 { if len(chain) == 0 {
return false, nil return false, nil
} }
res, err := isValidChain(currentHeader, chain, f.doExist, f.Number, f.Hash) return isValidChain(currentHeader, chain, f.doExist, f.Number, f.Hash)
}
return res, err // reportWhitelist logs the block number and hash if a new and unique entry is being inserted
// and it doesn't log for duplicate/redundant entries.
func (f *finality[T]) reportWhitelist(block uint64, hash common.Hash) {
msg := fmt.Sprintf("Whitelisting new %s from heimdall", f.name)
if !f.doExist {
log.Info(msg, "block", block, "hash", hash)
} else {
if f.Number != block && f.Hash != hash {
log.Info(msg, "block", block, "hash", hash)
}
}
} }
func (f *finality[T]) Process(block uint64, hash common.Hash) { func (f *finality[T]) Process(block uint64, hash common.Hash) {
f.reportWhitelist(block, hash)
f.doExist = true f.doExist = true
f.Hash = hash f.Hash = hash
f.Number = block f.Number = block

View file

@ -60,6 +60,7 @@ func NewService(db ethdb.Database) *Service {
Hash: checkpointHash, Hash: checkpointHash,
interval: 256, interval: 256,
db: db, db: db,
name: "checkpoint",
}, },
}, },
@ -70,6 +71,7 @@ func NewService(db ethdb.Database) *Service {
Hash: milestoneHash, Hash: milestoneHash,
interval: 256, interval: 256,
db: db, db: db,
name: "milestone",
}, },
Locked: locked, Locked: locked,

View file

@ -37,7 +37,7 @@ const sampleNumber = 3 // Number of transactions sampled in a block
var ( var (
DefaultMaxPrice = big.NewInt(500 * params.GWei) DefaultMaxPrice = big.NewInt(500 * params.GWei)
DefaultIgnorePrice = big.NewInt(params.BorDefaultGpoIgnorePrice) DefaultIgnorePrice = big.NewInt(params.BorDefaultGpoIgnorePrice) // bor's default
) )
type Config struct { type Config struct {
@ -101,11 +101,12 @@ func NewOracle(backend OracleBackend, params Config) *Oracle {
log.Warn("Sanitizing invalid gasprice oracle price cap", "provided", params.MaxPrice, "updated", maxPrice) log.Warn("Sanitizing invalid gasprice oracle price cap", "provided", params.MaxPrice, "updated", maxPrice)
} }
// PIP-35: Enforce the ignore price to 25 gwei
ignorePrice := params.IgnorePrice ignorePrice := params.IgnorePrice
if ignorePrice == nil || ignorePrice.Int64() != DefaultIgnorePrice.Int64() { if ignorePrice == nil || ignorePrice.Int64() != DefaultIgnorePrice.Int64() {
ignorePrice = DefaultIgnorePrice ignorePrice = DefaultIgnorePrice
log.Warn("Sanitizing invalid gasprice oracle ignore price", "provided", params.IgnorePrice, "updated", ignorePrice) log.Warn("Sanitizing invalid gasprice oracle ignore price", "provided", params.IgnorePrice, "updated", ignorePrice)
} else if ignorePrice.Int64() > 0 { } else {
log.Info("Gasprice oracle is ignoring threshold set", "threshold", ignorePrice) log.Info("Gasprice oracle is ignoring threshold set", "threshold", ignorePrice)
} }

View file

@ -3,6 +3,8 @@ package eth
import ( import (
"context" "context"
"errors" "errors"
"fmt"
"strings"
"github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/consensus/bor" "github.com/ethereum/go-ethereum/consensus/bor"
@ -18,8 +20,6 @@ var (
// errMilestone is returned when we are unable to fetch the // errMilestone is returned when we are unable to fetch the
// latest milestone from the local heimdall. // latest milestone from the local heimdall.
errMilestone = errors.New("failed to fetch latest milestone") errMilestone = errors.New("failed to fetch latest milestone")
ErrNotInRejectedList = errors.New("MilestoneID not in rejected list")
) )
// fetchWhitelistCheckpoint fetches the latest checkpoint from it's local heimdall // fetchWhitelistCheckpoint fetches the latest checkpoint from it's local heimdall
@ -32,19 +32,23 @@ func (h *ethHandler) fetchWhitelistCheckpoint(ctx context.Context, bor *bor.Bor,
// fetch the latest checkpoint from Heimdall // fetch the latest checkpoint from Heimdall
checkpoint, err := bor.HeimdallClient.FetchCheckpoint(ctx, -1) checkpoint, err := bor.HeimdallClient.FetchCheckpoint(ctx, -1)
err = reportCommonErrors("latest checkpoint", err, errCheckpoint)
if err != nil { if err != nil {
log.Debug("Failed to fetch latest checkpoint for whitelisting", "err", err) return blockNum, blockHash, err
return blockNum, blockHash, errCheckpoint
} }
log.Info("Got new checkpoint from heimdall", "start", checkpoint.StartBlock.Uint64(), "end", checkpoint.EndBlock.Uint64(), "rootHash", checkpoint.RootHash.String()) log.Debug("Got new checkpoint from heimdall", "start", checkpoint.StartBlock.Uint64(), "end", checkpoint.EndBlock.Uint64(), "rootHash", checkpoint.RootHash.String())
// Verify if the checkpoint fetched can be added to the local whitelist entry or not // Verify if the checkpoint fetched can be added to the local whitelist entry or not
// If verified, it returns the hash of the end block of the checkpoint. If not, // If verified, it returns the hash of the end block of the checkpoint. If not,
// it will return appropriate error. // it will return appropriate error.
hash, err := verifier.verify(ctx, eth, h, checkpoint.StartBlock.Uint64(), checkpoint.EndBlock.Uint64(), checkpoint.RootHash.String()[2:], true) hash, err := verifier.verify(ctx, eth, h, checkpoint.StartBlock.Uint64(), checkpoint.EndBlock.Uint64(), checkpoint.RootHash.String()[2:], true)
if err != nil { if err != nil {
if errors.Is(err, errChainOutOfSync) {
log.Info("Whitelisting checkpoint deferred", "err", err)
} else {
log.Warn("Failed to whitelist checkpoint", "err", err) log.Warn("Failed to whitelist checkpoint", "err", err)
}
return blockNum, blockHash, err return blockNum, blockHash, err
} }
@ -64,72 +68,68 @@ func (h *ethHandler) fetchWhitelistMilestone(ctx context.Context, bor *bor.Bor,
// fetch latest milestone // fetch latest milestone
milestone, err := bor.HeimdallClient.FetchMilestone(ctx) milestone, err := bor.HeimdallClient.FetchMilestone(ctx)
if errors.Is(err, heimdall.ErrServiceUnavailable) { err = reportCommonErrors("latest milestone", err, errMilestone)
log.Debug("Failed to fetch latest milestone for whitelisting", "err", err)
return num, hash, err
}
if err != nil { if err != nil {
log.Error("Failed to fetch latest milestone for whitelisting", "err", err) return num, hash, err
return num, hash, errMilestone
} }
num = milestone.EndBlock.Uint64() num = milestone.EndBlock.Uint64()
hash = milestone.Hash hash = milestone.Hash
log.Info("Got new milestone from heimdall", "start", milestone.StartBlock.Uint64(), "end", milestone.EndBlock.Uint64(), "hash", milestone.Hash.String()) log.Debug("Got new milestone from heimdall", "start", milestone.StartBlock.Uint64(), "end", milestone.EndBlock.Uint64(), "hash", milestone.Hash.String())
// Verify if the milestone fetched can be added to the local whitelist entry or not // Verify if the milestone fetched can be added to the local whitelist entry or not. If verified,
// If verified, it returns the hash of the end block of the milestone. If not, // the hash of the end block of the milestone is returned else appropriate error is returned.
// it will return appropriate error.
_, err = verifier.verify(ctx, eth, h, milestone.StartBlock.Uint64(), milestone.EndBlock.Uint64(), milestone.Hash.String()[2:], false) _, err = verifier.verify(ctx, eth, h, milestone.StartBlock.Uint64(), milestone.EndBlock.Uint64(), milestone.Hash.String()[2:], false)
if err != nil { if err != nil {
if errors.Is(err, errChainOutOfSync) {
log.Info("Whitelisting milestone deferred", "err", err)
} else {
log.Warn("Failed to whitelist milestone", "err", err)
}
h.downloader.UnlockSprint(milestone.EndBlock.Uint64()) h.downloader.UnlockSprint(milestone.EndBlock.Uint64())
return num, hash, err
} }
return num, hash, nil return num, hash, err
} }
func (h *ethHandler) fetchNoAckMilestone(ctx context.Context, bor *bor.Bor) (string, error) { func (h *ethHandler) fetchNoAckMilestone(ctx context.Context, bor *bor.Bor) (string, error) {
var (
milestoneID string
)
// fetch latest milestone
milestoneID, err := bor.HeimdallClient.FetchLastNoAckMilestone(ctx) milestoneID, err := bor.HeimdallClient.FetchLastNoAckMilestone(ctx)
if errors.Is(err, heimdall.ErrServiceUnavailable) { err = reportCommonErrors("latest no-ack milestone", err, nil)
log.Debug("Failed to fetch latest no-ack milestone", "err", err)
return milestoneID, err return milestoneID, err
}
if err != nil {
log.Error("Failed to fetch latest no-ack milestone", "err", err)
return milestoneID, errMilestone
}
return milestoneID, nil
} }
func (h *ethHandler) fetchNoAckMilestoneByID(ctx context.Context, bor *bor.Bor, milestoneID string) error { func (h *ethHandler) fetchNoAckMilestoneByID(ctx context.Context, bor *bor.Bor, milestoneID string) error {
// fetch latest milestone
err := bor.HeimdallClient.FetchNoAckMilestone(ctx, milestoneID) err := bor.HeimdallClient.FetchNoAckMilestone(ctx, milestoneID)
if errors.Is(err, heimdall.ErrServiceUnavailable) { if errors.Is(err, heimdall.ErrNotInRejectedList) {
log.Debug("Failed to fetch no-ack milestone by ID", "milestoneID", milestoneID, "err", err) log.Debug("MilestoneID not in rejected list", "milestoneID", milestoneID)
}
err = reportCommonErrors("no-ack milestone by ID", err, nil, "milestoneID", milestoneID)
return err
}
// reportCommonErrors reports common errors which can occur while fetching data from heimdall. It also
// returns back the wrapped erorr if required to the caller.
func reportCommonErrors(msg string, err error, wrapError error, ctx ...interface{}) error {
if err == nil {
return err
}
// We're skipping extra check to the `heimdall.ErrServiceUnavailable` error as it should not
// occur post HF (in heimdall). If it does, we'll anyways warn below as a normal error.
ctx = append(ctx, "err", err)
if strings.Contains(err.Error(), "context deadline exceeded") {
log.Warn(fmt.Sprintf("Failed to fetch %s, please check the heimdall endpoint and status of your heimdall node", msg), ctx...)
} else {
log.Warn(fmt.Sprintf("Failed to fetch %s", msg), ctx...)
}
if wrapError != nil {
return fmt.Errorf("%w: %v", wrapError, err)
}
return err return err
}
// fixme: handle different types of errors
if errors.Is(err, ErrNotInRejectedList) {
log.Warn("MilestoneID not in rejected list", "milestoneID", milestoneID, "err", err)
return err
}
if err != nil {
log.Error("Failed to fetch no-ack milestone by ID ", "milestoneID", milestoneID, "err", err)
return errMilestone
}
return nil
} }

View file

@ -103,7 +103,7 @@ func fetchCheckpointTest(t *testing.T, heimdall *mockHeimdall, bor *bor.Bor, han
ctx := context.Background() ctx := context.Background()
_, _, err := handler.fetchWhitelistCheckpoint(ctx, bor, nil, verifier) _, _, err := handler.fetchWhitelistCheckpoint(ctx, bor, nil, verifier)
require.Equal(t, err, errCheckpoint) require.ErrorIs(t, err, errCheckpoint)
// create 4 mock checkpoints // create 4 mock checkpoints
checkpoints = createMockCheckpoints(4) checkpoints = createMockCheckpoints(4)
@ -133,7 +133,7 @@ func fetchMilestoneTest(t *testing.T, heimdall *mockHeimdall, bor *bor.Bor, hand
ctx := context.Background() ctx := context.Background()
_, _, err := handler.fetchWhitelistMilestone(ctx, bor, nil, verifier) _, _, err := handler.fetchWhitelistMilestone(ctx, bor, nil, verifier)
require.Equal(t, err, errMilestone) require.ErrorIs(t, err, errMilestone)
// create 4 mock checkpoints // create 4 mock checkpoints
milestones = createMockMilestones(4) milestones = createMockMilestones(4)

View file

@ -80,7 +80,11 @@ func (p *Peer) broadcastTransactions() {
size common.StorageSize size common.StorageSize
) )
for i := 0; i < len(queue) && size < maxTxPacketSize; i++ { for i := 0; i < len(queue) && size < maxTxPacketSize; i++ {
if tx := p.txpool.Get(queue[i]); tx != nil { tx := p.txpool.Get(queue[i])
// BOR specific - DO NOT REMOVE
// Skip PIP-15 bundled transactions
if tx != nil && tx.GetOptions() == nil {
txs = append(txs, tx) txs = append(txs, tx)
size += common.StorageSize(tx.Size()) size += common.StorageSize(tx.Size())
} }
@ -151,7 +155,8 @@ func (p *Peer) announceTransactions() {
) )
for count = 0; count < len(queue) && size < maxTxPacketSize; count++ { for count = 0; count < len(queue) && size < maxTxPacketSize; count++ {
tx := p.txpool.Get(queue[count]) tx := p.txpool.Get(queue[count])
// Skip EIP-4337 bundled transactions // BOR specific - DO NOT REMOVE
// Skip PIP-15 bundled transactions
if tx != nil && tx.GetOptions() == nil { if tx != nil && tx.GetOptions() == nil {
pending = append(pending, queue[count]) pending = append(pending, queue[count])
pendingTypes = append(pendingTypes, tx.Type()) pendingTypes = append(pendingTypes, tx.Type())

View file

@ -642,7 +642,10 @@ 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 !ok || err != nil { if 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,

218
go.mod
View file

@ -5,38 +5,37 @@ go 1.22
toolchain go1.22.1 toolchain go1.22.1
require ( require (
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.1 github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v1.3.2
github.com/BurntSushi/toml v1.3.2 github.com/BurntSushi/toml v1.4.0
github.com/JekaMas/go-grpc-net-conn v0.0.0-20220708155319-6aff21f2d13d github.com/JekaMas/go-grpc-net-conn v0.0.0-20220708155319-6aff21f2d13d
github.com/JekaMas/workerpool v1.1.8 github.com/JekaMas/workerpool v1.1.8
github.com/Microsoft/go-winio v0.6.1 github.com/Microsoft/go-winio v0.6.2
github.com/VictoriaMetrics/fastcache v1.12.2 github.com/VictoriaMetrics/fastcache v1.12.2
github.com/aws/aws-sdk-go-v2 v1.25.2 github.com/aws/aws-sdk-go-v2 v1.27.2
github.com/aws/aws-sdk-go-v2/config v1.18.45 github.com/aws/aws-sdk-go-v2/config v1.27.18
github.com/aws/aws-sdk-go-v2/credentials v1.13.43 github.com/aws/aws-sdk-go-v2/credentials v1.17.18
github.com/aws/aws-sdk-go-v2/service/route53 v1.30.2 github.com/aws/aws-sdk-go-v2/service/route53 v1.40.10
github.com/btcsuite/btcd/btcec/v2 v2.3.2 github.com/btcsuite/btcd/btcec/v2 v2.3.3
github.com/cespare/cp v1.1.1 github.com/cespare/cp v1.1.1
github.com/cloudflare/cloudflare-go v0.79.0 github.com/cloudflare/cloudflare-go v0.97.0
github.com/cockroachdb/pebble v1.1.1 github.com/cockroachdb/pebble v1.1.1
github.com/consensys/gnark-crypto v0.12.1 github.com/consensys/gnark-crypto v0.12.1
github.com/cosmos/cosmos-sdk v0.47.3 github.com/cosmos/cosmos-sdk v0.50.6
github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c github.com/crate-crypto/go-ipa v0.0.0-20240223125850-b1e8a79f509c
github.com/crate-crypto/go-kzg-4844 v1.0.0 github.com/crate-crypto/go-kzg-4844 v1.0.0
github.com/davecgh/go-spew v1.1.1 github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc
github.com/deckarep/golang-set/v2 v2.6.0 github.com/deckarep/golang-set/v2 v2.6.0
github.com/donovanhide/eventsource v0.0.0-20210830082556-c59027999da0 github.com/donovanhide/eventsource v0.0.0-20210830082556-c59027999da0
github.com/dop251/goja v0.0.0-20240220182346-e401ed450204 github.com/dop251/goja v0.0.0-20240516125602-ccbae20bcec2
github.com/emirpasic/gods v1.18.1 github.com/emirpasic/gods v1.18.1
github.com/ethereum/c-kzg-4844 v1.0.0 github.com/ethereum/c-kzg-4844 v1.0.0
github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0 github.com/ethereum/go-verkle v0.1.1-0.20240306133620-7d920df305f0
github.com/fatih/color v1.16.0 github.com/fatih/color v1.17.0
github.com/ferranbt/fastssz v0.1.2 github.com/ferranbt/fastssz v0.1.2
github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e github.com/fjl/gencodec v0.0.0-20230517082657-f9840df7b83e
github.com/fjl/memsize v0.0.2 github.com/fjl/memsize v0.0.2
github.com/fsnotify/fsnotify v1.6.0 github.com/fsnotify/fsnotify v1.7.0
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08
github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46
github.com/gofrs/flock v0.8.1 github.com/gofrs/flock v0.8.1
github.com/golang-jwt/jwt/v4 v4.5.0 github.com/golang-jwt/jwt/v4 v4.5.0
github.com/golang/mock v1.6.0 github.com/golang/mock v1.6.0
@ -44,14 +43,14 @@ require (
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb
github.com/google/gofuzz v1.2.0 github.com/google/gofuzz v1.2.0
github.com/google/uuid v1.6.0 github.com/google/uuid v1.6.0
github.com/gorilla/websocket v1.5.0 github.com/gorilla/websocket v1.5.2
github.com/graph-gophers/graphql-go v1.3.0 github.com/graph-gophers/graphql-go v1.5.0
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 github.com/grpc-ecosystem/go-grpc-middleware v1.4.0
github.com/hashicorp/go-bexpr v0.1.10 github.com/hashicorp/go-bexpr v0.1.14
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d github.com/hashicorp/golang-lru v1.0.2
github.com/hashicorp/hcl/v2 v2.10.1 github.com/hashicorp/hcl/v2 v2.20.1
github.com/heimdalr/dag v1.2.1 github.com/heimdalr/dag v1.4.0
github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 github.com/holiman/billy v0.0.0-20240322075458-72a4e81ec6da
github.com/holiman/bloomfilter/v2 v2.0.3 github.com/holiman/bloomfilter/v2 v2.0.3
github.com/holiman/uint256 v1.2.4 github.com/holiman/uint256 v1.2.4
github.com/huin/goupnp v1.3.0 github.com/huin/goupnp v1.3.0
@ -66,7 +65,7 @@ require (
github.com/kilic/bls12-381 v0.1.0 github.com/kilic/bls12-381 v0.1.0
github.com/kylelemons/godebug v1.1.0 github.com/kylelemons/godebug v1.1.0
github.com/maticnetwork/crand v1.0.2 github.com/maticnetwork/crand v1.0.2
github.com/maticnetwork/heimdall v1.0.4 github.com/maticnetwork/heimdall v1.0.7
github.com/maticnetwork/polyproto v0.0.3-0.20230216113155-340ea926ca53 github.com/maticnetwork/polyproto v0.0.3-0.20230216113155-340ea926ca53
github.com/mattn/go-colorable v0.1.13 github.com/mattn/go-colorable v0.1.13
github.com/mattn/go-isatty v0.0.20 github.com/mattn/go-isatty v0.0.20
@ -79,61 +78,60 @@ require (
github.com/protolambda/bls12-381-util v0.1.0 github.com/protolambda/bls12-381-util v0.1.0
github.com/protolambda/zrnt v0.32.2 github.com/protolambda/zrnt v0.32.2
github.com/protolambda/ztyp v0.2.2 github.com/protolambda/ztyp v0.2.2
github.com/rs/cors v1.10.1 github.com/rs/cors v1.11.0
github.com/ryanuber/columnize v2.1.2+incompatible github.com/ryanuber/columnize v2.1.2+incompatible
github.com/shirou/gopsutil v3.21.11+incompatible github.com/shirou/gopsutil v3.21.11+incompatible
github.com/status-im/keycard-go v0.3.2 github.com/status-im/keycard-go v0.3.2
github.com/stretchr/testify v1.9.0 github.com/stretchr/testify v1.9.0
github.com/supranational/blst v0.3.11 github.com/supranational/blst v0.3.12
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/tendermint/tendermint v0.34.24 github.com/tendermint/tendermint v0.34.24
github.com/tyler-smith/go-bip39 v1.1.0 github.com/tyler-smith/go-bip39 v1.1.0
github.com/urfave/cli/v2 v2.25.7 github.com/urfave/cli/v2 v2.27.2
github.com/xsleonard/go-merkle v1.1.0 github.com/xsleonard/go-merkle v1.1.0
go.opentelemetry.io/otel v1.19.0 go.opentelemetry.io/otel v1.27.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0 go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.27.0
go.opentelemetry.io/otel/sdk v1.19.0 go.opentelemetry.io/otel/sdk v1.27.0
go.uber.org/automaxprocs v1.5.2 go.uber.org/automaxprocs v1.5.3
go.uber.org/goleak v1.2.1 go.uber.org/goleak v1.3.0
golang.org/x/crypto v0.22.0 golang.org/x/crypto v0.24.0
golang.org/x/exp v0.0.0-20231110203233-9a3e6036ecaa golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8
golang.org/x/sync v0.7.0 golang.org/x/sync v0.7.0
golang.org/x/sys v0.20.0 golang.org/x/sys v0.21.0
golang.org/x/text v0.14.0 golang.org/x/text v0.16.0
golang.org/x/time v0.5.0 golang.org/x/time v0.5.0
golang.org/x/tools v0.20.0 golang.org/x/tools v0.22.0
google.golang.org/grpc v1.58.3 google.golang.org/grpc v1.64.0
gopkg.in/natefinch/lumberjack.v2 v2.2.1 gopkg.in/natefinch/lumberjack.v2 v2.2.1
gopkg.in/yaml.v3 v3.0.1 gopkg.in/yaml.v3 v3.0.1
) )
require ( require (
cloud.google.com/go/compute v1.21.0 // indirect cloud.google.com/go/iam v1.1.6 // indirect
cloud.google.com/go/iam v1.1.1 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pborman/uuid v1.2.1 // indirect github.com/pborman/uuid v1.2.1 // indirect
github.com/pelletier/go-toml/v2 v2.0.9 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect
github.com/subosito/gotenv v1.4.1 // indirect github.com/subosito/gotenv v1.6.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect
) )
require ( require (
cloud.google.com/go v0.110.4 // indirect cloud.google.com/go v0.112.1 // indirect
cloud.google.com/go/pubsub v1.32.0 // indirect cloud.google.com/go/pubsub v1.36.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/azcore v1.9.2 // indirect github.com/Azure/azure-sdk-for-go/sdk/azcore v1.11.1 // indirect
github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect github.com/Azure/azure-sdk-for-go/sdk/internal v1.5.2 // indirect
github.com/DataDog/zstd v1.5.2 // indirect github.com/DataDog/zstd v1.5.2 // indirect
github.com/agext/levenshtein v1.2.1 // indirect github.com/agext/levenshtein v1.2.1 // indirect
github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect github.com/apparentlymart/go-textseg/v13 v13.0.0 // indirect
github.com/armon/go-radix v1.0.0 // indirect github.com/armon/go-radix v1.0.0 // indirect
github.com/aws/aws-sdk-go v1.40.45 // indirect github.com/aws/aws-sdk-go v1.40.45 // indirect
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.15.2 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.5 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.4 // indirect github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.11.11 // indirect
github.com/aws/aws-sdk-go-v2/service/sso v1.20.1 // indirect github.com/aws/aws-sdk-go-v2/service/sso v1.20.11 // indirect
github.com/aws/aws-sdk-go-v2/service/sts v1.28.3 // indirect github.com/aws/aws-sdk-go-v2/service/sts v1.28.12 // indirect
github.com/aws/smithy-go v1.20.1 // indirect github.com/aws/smithy-go v1.20.2 // indirect
github.com/beorn7/perks v1.0.1 // indirect github.com/beorn7/perks v1.0.1 // indirect
github.com/bits-and-blooms/bitset v1.10.0 // indirect github.com/bits-and-blooms/bitset v1.10.0 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect
@ -143,7 +141,7 @@ require (
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/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.4 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
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
@ -155,31 +153,30 @@ require (
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
github.com/klauspost/compress v1.16.7 // indirect github.com/klauspost/compress v1.17.0 // indirect
github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect
github.com/kr/pretty v0.3.1 // indirect github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect github.com/kr/text v0.2.0 // indirect
github.com/mattn/go-runewidth v0.0.13 // indirect github.com/mattn/go-runewidth v0.0.13 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/minio/sha256-simd v1.0.0 // indirect github.com/minio/sha256-simd v1.0.0 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/pointerstructure v1.2.1 // indirect github.com/mitchellh/pointerstructure v1.2.1 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pkg/errors v0.9.1 // indirect github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect github.com/prometheus/client_golang v1.19.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.39.0 // indirect github.com/prometheus/common v0.48.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect github.com/prometheus/procfs v0.12.0 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect github.com/tklauser/go-sysconf v0.3.11 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect github.com/tklauser/numcpus v0.6.0 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect
golang.org/x/mod v0.17.0 // indirect golang.org/x/mod v0.18.0 // indirect
golang.org/x/net v0.24.0 // indirect golang.org/x/net v0.26.0 // indirect
google.golang.org/protobuf v1.33.0 google.golang.org/protobuf v1.34.1
gopkg.in/yaml.v2 v2.4.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect
gotest.tools v2.2.0+incompatible gotest.tools v2.2.0+incompatible
pgregory.net/rapid v1.1.0 pgregory.net/rapid v1.1.0
@ -187,69 +184,76 @@ require (
) )
require ( require (
cloud.google.com/go/compute/metadata v0.2.3 // indirect cloud.google.com/go/compute/metadata v0.3.0 // indirect
github.com/Masterminds/semver/v3 v3.1.1 // indirect github.com/Masterminds/semver/v3 v3.1.1 // indirect
github.com/Masterminds/sprig/v3 v3.2.1 // indirect github.com/Masterminds/sprig/v3 v3.2.1 // indirect
github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect github.com/apapsch/go-jsonmerge/v2 v2.0.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.2 // indirect github.com/apparentlymart/go-textseg/v15 v15.0.0 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.2 // indirect github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.9 // indirect
github.com/aws/aws-sdk-go-v2/internal/endpoints/v2 v2.6.9 // indirect
github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect github.com/aws/aws-sdk-go-v2/internal/ini v1.8.0 // indirect
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.1 // indirect github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.11.2 // indirect
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.23.1 // indirect github.com/aws/aws-sdk-go-v2/service/ssooidc v1.24.5 // indirect
github.com/bartekn/go-bip39 v0.0.0-20171116152956-a05967ea095d // indirect github.com/bartekn/go-bip39 v0.0.0-20171116152956-a05967ea095d // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b // indirect github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b // indirect
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 // indirect github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 // indirect
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.3.0 // 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/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f // indirect
github.com/etcd-io/bbolt v1.3.3 // indirect github.com/etcd-io/bbolt v1.3.3 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/gammazero/deque v0.2.1 // indirect github.com/gammazero/deque v0.2.1 // indirect
github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/kit v0.12.0 // indirect
github.com/go-kit/log v0.2.1 // indirect github.com/go-kit/log v0.2.1 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-logr/logr v1.2.4 // indirect github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-redis/redis v6.15.7+incompatible // indirect github.com/go-redis/redis/v8 v8.11.5 // indirect
github.com/goccy/go-json v0.10.2 // indirect github.com/go-redsync/redsync/v4 v4.0.4 // indirect
github.com/goccy/go-json v0.10.3 // 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-cmp v0.5.9 // indirect github.com/google/go-cmp v0.6.0 // indirect
github.com/google/s2a-go v0.1.4 // indirect github.com/google/s2a-go v0.1.7 // indirect
github.com/googleapis/gax-go/v2 v2.11.0 // indirect github.com/googleapis/gax-go/v2 v2.12.2 // indirect
github.com/gorilla/mux v1.8.0 // indirect github.com/gorilla/mux v1.8.1 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.20.0 // indirect
github.com/hashicorp/errwrap v1.0.0 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect
github.com/hashicorp/go-multierror v1.1.0 // indirect github.com/hashicorp/go-multierror v1.1.0 // indirect
github.com/hashicorp/go-retryablehttp v0.7.5 // indirect github.com/hashicorp/go-retryablehttp v0.7.7 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huandu/xstrings v1.3.2 // indirect github.com/huandu/xstrings v1.3.2 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect
github.com/kelseyhightower/envconfig v1.4.0 // indirect github.com/kelseyhightower/envconfig v1.4.0 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/magiconair/properties v1.8.6 // indirect github.com/magiconair/properties v1.8.7 // indirect
github.com/mitchellh/copystructure v1.0.0 // indirect github.com/mitchellh/copystructure v1.0.0 // indirect
github.com/mitchellh/go-wordwrap v0.0.0-20150314170334-ad45545899c7 // indirect github.com/mitchellh/go-wordwrap v1.0.1 // indirect
github.com/mitchellh/reflectwalk v1.0.0 // indirect github.com/mitchellh/reflectwalk v1.0.0 // indirect
github.com/montanaflynn/stats v0.0.0-20171201202039-1bf9dbcd8cbe // indirect github.com/montanaflynn/stats v0.7.0 // indirect
github.com/naoina/go-stringutil v0.1.0 // indirect github.com/naoina/go-stringutil v0.1.0 // indirect
github.com/oapi-codegen/runtime v1.0.0 // indirect github.com/oapi-codegen/runtime v1.0.0 // indirect
github.com/posener/complete v1.2.3 // indirect github.com/posener/complete v1.2.3 // indirect
github.com/rakyll/statik v0.1.7 // indirect github.com/rakyll/statik v0.1.7 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rivo/uniseg v0.2.0 // indirect github.com/rivo/uniseg v0.2.0 // indirect
github.com/robfig/cron/v3 v3.0.1 // indirect
github.com/sagikazarmark/locafero v0.4.0 // indirect
github.com/sagikazarmark/slog-shim v0.1.0 // indirect
github.com/shopspring/decimal v1.2.0 // indirect github.com/shopspring/decimal v1.2.0 // indirect
github.com/spf13/afero v1.9.2 // indirect github.com/sourcegraph/conc v0.3.0 // indirect
github.com/spf13/cast v1.5.0 // indirect github.com/spf13/afero v1.11.0 // indirect
github.com/spf13/cobra v1.5.0 // indirect github.com/spf13/cast v1.6.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect github.com/spf13/cobra v1.8.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.13.0 // indirect github.com/spf13/viper v1.18.2 // indirect
github.com/streadway/amqp v1.0.0 // indirect github.com/streadway/amqp v1.1.0 // indirect
github.com/stumble/gorocksdb v0.0.3 // indirect github.com/stumble/gorocksdb v0.0.3 // indirect
github.com/tendermint/btcd v0.1.1 // indirect github.com/tendermint/btcd v0.1.1 // indirect
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 // indirect
@ -260,30 +264,32 @@ require (
github.com/xdg-go/scram v1.1.2 // indirect github.com/xdg-go/scram v1.1.2 // indirect
github.com/xdg-go/stringprep v1.0.4 // indirect github.com/xdg-go/stringprep v1.0.4 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect github.com/yusufpapurcu/wmi v1.2.3 // indirect
github.com/zondax/ledger-go v0.14.1 // indirect github.com/zondax/ledger-go v0.14.1 // indirect
go.opentelemetry.io/otel/metric v1.19.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect go.opentelemetry.io/otel/metric v1.27.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.9.0 // indirect
golang.org/x/oauth2 v0.20.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240520151616-dc85e6b867a5 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240515191416-fc5f0ca64291 // indirect
) )
require ( require (
github.com/Masterminds/goutils v1.1.1 // indirect github.com/Masterminds/goutils v1.1.1 // indirect
github.com/RichardKnop/logging v0.0.0-20190827224416-1a693bdd4fae // indirect github.com/RichardKnop/logging v0.0.0-20190827224416-1a693bdd4fae // indirect
github.com/RichardKnop/machinery v1.7.4 // indirect github.com/RichardKnop/machinery v1.10.6 // indirect
github.com/RichardKnop/redsync v1.2.0 // indirect
github.com/prometheus/tsdb v0.10.0 github.com/prometheus/tsdb v0.10.0
github.com/zclconf/go-cty v1.13.0 // indirect github.com/zclconf/go-cty v1.13.0 // indirect
github.com/zondax/hid v0.9.1 // indirect github.com/zondax/hid v0.9.1 // indirect
go.mongodb.org/mongo-driver v1.14.0 // indirect go.mongodb.org/mongo-driver v1.14.0 // indirect
go.opencensus.io v0.24.0 // indirect go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0 // indirect go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.27.0 // indirect
go.opentelemetry.io/otel/trace v1.19.0 go.opentelemetry.io/otel/trace v1.27.0
go.opentelemetry.io/proto/otlp v1.0.0 // indirect go.opentelemetry.io/proto/otlp v1.2.0 // indirect
google.golang.org/api v0.126.0 // indirect google.golang.org/api v0.169.0 // indirect
google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect
google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 // indirect
) )
replace github.com/cosmos/cosmos-sdk => github.com/maticnetwork/cosmos-sdk v0.38.4 replace github.com/cosmos/cosmos-sdk => github.com/maticnetwork/cosmos-sdk v0.38.4
@ -292,7 +298,7 @@ replace github.com/tendermint/tendermint => github.com/maticnetwork/tendermint v
replace github.com/tendermint/tm-db => github.com/tendermint/tm-db v0.2.0 replace github.com/tendermint/tm-db => github.com/tendermint/tm-db v0.2.0
replace github.com/ethereum/go-ethereum => github.com/maticnetwork/bor v1.2.7 replace github.com/ethereum/go-ethereum => github.com/maticnetwork/bor v1.3.2
replace github.com/Masterminds/goutils => github.com/Masterminds/goutils v1.1.1 replace github.com/Masterminds/goutils => github.com/Masterminds/goutils v1.1.1

941
go.sum

File diff suppressed because it is too large Load diff

View file

@ -86,7 +86,7 @@ func TestFlagsWithConfig(t *testing.T) {
"32000000": "0x875500011e5eecc0c554f95d07b31cf59df4ca2505f4dbbfffa7d4e4da917c68", "32000000": "0x875500011e5eecc0c554f95d07b31cf59df4ca2505f4dbbfffa7d4e4da917c68",
}, },
) )
require.Equal(t, c.config.Sealer.GasPrice, big.NewInt(30000000000)) require.Equal(t, c.config.Sealer.GasPrice, big.NewInt(25000000000))
require.Equal(t, c.config.Sealer.Recommit, recommit) require.Equal(t, c.config.Sealer.Recommit, recommit)
require.Equal(t, c.config.JsonRPC.RPCEVMTimeout, evmTimeout) require.Equal(t, c.config.JsonRPC.RPCEVMTimeout, evmTimeout)
require.Equal(t, c.config.JsonRPC.Http.API, []string{"eth", "bor"}) require.Equal(t, c.config.JsonRPC.Http.API, []string{"eth", "bor"})

View file

@ -678,7 +678,7 @@ func DefaultConfig() *Config {
MaxHeaderHistory: 1024, MaxHeaderHistory: 1024,
MaxBlockHistory: 1024, MaxBlockHistory: 1024,
MaxPrice: gasprice.DefaultMaxPrice, MaxPrice: gasprice.DefaultMaxPrice,
IgnorePrice: gasprice.DefaultIgnorePrice, IgnorePrice: gasprice.DefaultIgnorePrice, // bor's default
}, },
JsonRPC: &JsonRPCConfig{ JsonRPC: &JsonRPCConfig{
IPCDisable: false, IPCDisable: false,

View file

@ -26,7 +26,7 @@ func TestConfigLegacy(t *testing.T) {
"31000000": "0x2087b9e2b353209c2c21e370c82daa12278efd0fe5f0febe6c29035352cf050e", "31000000": "0x2087b9e2b353209c2c21e370c82daa12278efd0fe5f0febe6c29035352cf050e",
"32000000": "0x875500011e5eecc0c554f95d07b31cf59df4ca2505f4dbbfffa7d4e4da917c68", "32000000": "0x875500011e5eecc0c554f95d07b31cf59df4ca2505f4dbbfffa7d4e4da917c68",
} }
testConfig.Sealer.GasPrice = big.NewInt(30000000000) testConfig.Sealer.GasPrice = big.NewInt(25000000000)
testConfig.Sealer.Recommit = 20 * time.Second testConfig.Sealer.Recommit = 20 * time.Second
testConfig.JsonRPC.RPCEVMTimeout = 5 * time.Second testConfig.JsonRPC.RPCEVMTimeout = 5 * time.Second
testConfig.JsonRPC.TxFeeCap = 6.0 testConfig.JsonRPC.TxFeeCap = 6.0

View file

@ -58,7 +58,7 @@ devfakeauthor = false
nolocals = false nolocals = false
journal = "transactions.rlp" journal = "transactions.rlp"
rejournal = "1h0m0s" rejournal = "1h0m0s"
pricelimit = 30000000000 pricelimit = 25000000000
pricebump = 10 pricebump = 10
accountslots = 16 accountslots = 16
globalslots = 32768 globalslots = 32768
@ -71,7 +71,7 @@ devfakeauthor = false
etherbase = "" etherbase = ""
extradata = "" extradata = ""
gaslimit = 30000000 gaslimit = 30000000
gasprice = "30000000000" gasprice = "25000000000"
recommit = "2m5s" recommit = "2m5s"
commitinterrupt = true commitinterrupt = true
@ -127,7 +127,7 @@ devfakeauthor = false
maxheaderhistory = 1024 maxheaderhistory = 1024
maxblockhistory = 1024 maxblockhistory = 1024
maxprice = "500000000000" maxprice = "500000000000"
ignoreprice = "30000000000" ignoreprice = "25000000000"
[telemetry] [telemetry]
metrics = false metrics = false

View file

@ -11,7 +11,7 @@ snapshot = true
"32000000" = "0x875500011e5eecc0c554f95d07b31cf59df4ca2505f4dbbfffa7d4e4da917c68" "32000000" = "0x875500011e5eecc0c554f95d07b31cf59df4ca2505f4dbbfffa7d4e4da917c68"
[miner] [miner]
gasprice = "30000000000" gasprice = "25000000000"
recommit = "20s" recommit = "20s"
[jsonrpc] [jsonrpc]

View file

@ -445,6 +445,28 @@ func (c *PruneBlockCommand) validateAgainstSnapshot(stack *node.Node, dbHandles
return nil return nil
} }
// checkDeletePermissions checks if the user has the permission to
// delete the given `path`.
func checkDeletePermissions(path string) (bool, error) {
dirInfo, err := os.Stat(path)
if err != nil {
return false, err
}
// Check if the user has write and execute permissions on the directory
if dirInfo.Mode().Perm()&(0200|0100) == (0200 | 0100) {
// Also check if the parent directory has write permissions because delete needs them
parentDir := filepath.Dir(path)
parentDirInfo, err := os.Stat(parentDir)
if err != nil {
return false, err
}
if parentDirInfo.Mode().Perm()&0200 != 0 {
return true, nil
}
}
return false, nil
}
// pruneBlock is the entry point for the ancient pruning process. Based on the user specified // pruneBlock is the entry point for the ancient pruning process. Based on the user specified
// params, it will prune the ancient data. It also handles the case where the pruning process // params, it will prune the ancient data. It also handles the case where the pruning process
// was interrupted earlier. // was interrupted earlier.
@ -466,6 +488,17 @@ func (c *PruneBlockCommand) pruneBlock(stack *node.Node, fdHandles int) error {
} }
newAncientPath := filepath.Join(path, "ancient_back") newAncientPath := filepath.Join(path, "ancient_back")
// Check if we have delete permissions on the ancient datadir path beforehand
allow, err := checkDeletePermissions(oldAncientPath)
if err != nil {
log.Error("Failed to check delete permissions for ancient datadir", "path", oldAncientPath, "err", err)
return err
}
if !allow {
return fmt.Errorf("user doesn't have delete permissions on ancient datadir: %s", oldAncientPath)
}
blockpruner := pruner.NewBlockPruner(stack, oldAncientPath, newAncientPath, c.blockAmountReserved) blockpruner := pruner.NewBlockPruner(stack, oldAncientPath, newAncientPath, c.blockAmountReserved)
lock, exist, err := fileutil.Flock(filepath.Join(oldAncientPath, "PRUNEFLOCK")) lock, exist, err := fileutil.Flock(filepath.Join(oldAncientPath, "PRUNEFLOCK"))

View file

@ -67,7 +67,7 @@ func NewBorAPI(b Backend) *BorAPI {
// SendRawTransactionConditional will add the signed transaction to the transaction pool. // SendRawTransactionConditional will add the signed transaction to the transaction pool.
// The sender/bundler is responsible for signing the transaction // The sender/bundler is responsible for signing the transaction
func (api *BorAPI) SendRawTransactionConditional(ctx context.Context, input hexutil.Bytes, options types.OptionsAA4337) (common.Hash, error) { func (api *BorAPI) SendRawTransactionConditional(ctx context.Context, input hexutil.Bytes, options types.OptionsPIP15) (common.Hash, error) {
tx := new(types.Transaction) tx := new(types.Transaction)
if err := tx.UnmarshalBinary(input); err != nil { if err := tx.UnmarshalBinary(input); err != nil {
return common.Hash{}, err return common.Hash{}, err
@ -81,12 +81,12 @@ func (api *BorAPI) SendRawTransactionConditional(ctx context.Context, input hexu
} }
// check block number range // check block number range
if err := currentHeader.ValidateBlockNumberOptions4337(options.BlockNumberMin, options.BlockNumberMax); err != nil { if err := currentHeader.ValidateBlockNumberOptionsPIP15(options.BlockNumberMin, options.BlockNumberMax); err != nil {
return common.Hash{}, &rpc.OptionsValidateError{Message: "out of block range. err: " + err.Error()} return common.Hash{}, &rpc.OptionsValidateError{Message: "out of block range. err: " + err.Error()}
} }
// check timestamp range // check timestamp range
if err := currentHeader.ValidateTimestampOptions4337(options.TimestampMin, options.TimestampMax); err != nil { if err := currentHeader.ValidateTimestampOptionsPIP15(options.TimestampMin, options.TimestampMax); err != nil {
return common.Hash{}, &rpc.OptionsValidateError{Message: "out of time range. err: " + err.Error()} return common.Hash{}, &rpc.OptionsValidateError{Message: "out of time range. err: " + err.Error()}
} }

View file

@ -231,6 +231,10 @@ func appendBigInt(dst []byte, n *big.Int) []byte {
return appendInt64(dst, n.Int64()) return appendInt64(dst, n.Int64())
} }
if len(n.String()) > 64*1024*1024 {
_ = fmt.Errorf("%s value in appendBigInt is too large to format", n.String())
}
var ( var (
text = n.String() text = n.String()
buf = make([]byte, len(text)+len(text)/3) buf = make([]byte, len(text)+len(text)/3)

View file

@ -59,7 +59,7 @@ type Config struct {
// DefaultConfig contains default settings for miner. // DefaultConfig contains default settings for miner.
var DefaultConfig = Config{ var DefaultConfig = Config{
GasCeil: 30_000_000, GasCeil: 30_000_000,
GasPrice: big.NewInt(params.BorDefaultMinerGasPrice), // enforces minimum gas price of 30 gwei in bor GasPrice: big.NewInt(params.BorDefaultMinerGasPrice), // enforces minimum gas price of 25 gwei in bor
// The default recommit time is chosen as two seconds since // The default recommit time is chosen as two seconds since
// consensus-layer usually will wait a half slot of time(6s) // consensus-layer usually will wait a half slot of time(6s)

View file

@ -539,6 +539,8 @@ func (w *worker) commitTransactionsWithDelay(env *environment, txs *transactions
}(chDeps) }(chDeps)
} }
var lastTxHash common.Hash
mainloop: mainloop:
for { for {
if interruptCtx != nil { if interruptCtx != nil {
@ -550,7 +552,7 @@ mainloop:
select { select {
case <-interruptCtx.Done(): case <-interruptCtx.Done():
txCommitInterruptCounter.Inc(1) txCommitInterruptCounter.Inc(1)
log.Warn("Tx Level Interrupt") log.Warn("Tx Level Interrupt", "hash", lastTxHash)
break mainloop break mainloop
default: default:
} }
@ -572,6 +574,7 @@ mainloop:
if ltx == nil { if ltx == nil {
break break
} }
lastTxHash = ltx.Hash
// If we don't have enough space for the next transaction, skip the account. // If we don't have enough space for the next transaction, skip the account.
if env.gasPool.Gas() < ltx.Gas { if env.gasPool.Gas() < ltx.Gas {
log.Trace("Not enough gas left for transaction", "hash", ltx.Hash, "left", env.gasPool.Gas(), "needed", ltx.Gas) log.Trace("Not enough gas left for transaction", "hash", ltx.Hash, "left", env.gasPool.Gas(), "needed", ltx.Gas)
@ -597,14 +600,14 @@ mainloop:
// not prioritising conditional transaction, yet. // not prioritising conditional transaction, yet.
//nolint:nestif //nolint:nestif
if options := tx.GetOptions(); options != nil { if options := tx.GetOptions(); options != nil {
if err := env.header.ValidateBlockNumberOptions4337(options.BlockNumberMin, options.BlockNumberMax); err != nil { if err := env.header.ValidateBlockNumberOptionsPIP15(options.BlockNumberMin, options.BlockNumberMax); err != nil {
log.Trace("Dropping conditional transaction", "from", from, "hash", tx.Hash(), "reason", err) log.Trace("Dropping conditional transaction", "from", from, "hash", tx.Hash(), "reason", err)
txs.Pop() txs.Pop()
continue continue
} }
if err := env.header.ValidateTimestampOptions4337(options.TimestampMin, options.TimestampMax); err != nil { if err := env.header.ValidateTimestampOptionsPIP15(options.TimestampMin, options.TimestampMax); err != nil {
log.Trace("Dropping conditional transaction", "from", from, "hash", tx.Hash(), "reason", err) log.Trace("Dropping conditional transaction", "from", from, "hash", tx.Hash(), "reason", err)
txs.Pop() txs.Pop()

View file

@ -954,6 +954,8 @@ func (w *worker) commitTransactions(env *environment, plainTxs, blobTxs *transac
}(chDeps) }(chDeps)
} }
var lastTxHash common.Hash
mainloop: mainloop:
for { for {
// Check interruption signal and abort building if it's fired. // Check interruption signal and abort building if it's fired.
@ -972,7 +974,7 @@ mainloop:
select { select {
case <-interruptCtx.Done(): case <-interruptCtx.Done():
txCommitInterruptCounter.Inc(1) txCommitInterruptCounter.Inc(1)
log.Warn("Tx Level Interrupt") log.Warn("Tx Level Interrupt", "hash", lastTxHash)
break mainloop break mainloop
default: default:
} }
@ -1014,6 +1016,7 @@ mainloop:
if ltx == nil { if ltx == nil {
break break
} }
lastTxHash = ltx.Hash
// If we don't have enough space for the next transaction, skip the account. // If we don't have enough space for the next transaction, skip the account.
if env.gasPool.Gas() < ltx.Gas { if env.gasPool.Gas() < ltx.Gas {
log.Trace("Not enough gas left for transaction", "hash", ltx.Hash, "left", env.gasPool.Gas(), "needed", ltx.Gas) log.Trace("Not enough gas left for transaction", "hash", ltx.Hash, "left", env.gasPool.Gas(), "needed", ltx.Gas)
@ -1040,14 +1043,14 @@ mainloop:
// not prioritising conditional transaction, yet. // not prioritising conditional transaction, yet.
//nolint:nestif //nolint:nestif
if options := tx.GetOptions(); options != nil { if options := tx.GetOptions(); options != nil {
if err := env.header.ValidateBlockNumberOptions4337(options.BlockNumberMin, options.BlockNumberMax); err != nil { if err := env.header.ValidateBlockNumberOptionsPIP15(options.BlockNumberMin, options.BlockNumberMax); err != nil {
log.Trace("Dropping conditional transaction", "from", from, "hash", tx.Hash(), "reason", err) log.Trace("Dropping conditional transaction", "from", from, "hash", tx.Hash(), "reason", err)
txs.Pop() txs.Pop()
continue continue
} }
if err := env.header.ValidateTimestampOptions4337(options.TimestampMin, options.TimestampMax); err != nil { if err := env.header.ValidateTimestampOptionsPIP15(options.TimestampMin, options.TimestampMax); err != nil {
log.Trace("Dropping conditional transaction", "from", from, "hash", tx.Hash(), "reason", err) log.Trace("Dropping conditional transaction", "from", from, "hash", tx.Hash(), "reason", err)
txs.Pop() txs.Pop()

View file

@ -725,6 +725,10 @@ func (t *UDPv5) readLoop() {
// dispatchReadPacket sends a packet into the dispatch loop. // dispatchReadPacket sends a packet into the dispatch loop.
func (t *UDPv5) dispatchReadPacket(from netip.AddrPort, content []byte) bool { func (t *UDPv5) dispatchReadPacket(from netip.AddrPort, content []byte) bool {
// Unwrap IPv4-in-6 source address.
if from.Addr().Is4In6() {
from = netip.AddrPortFrom(netip.AddrFrom4(from.Addr().As4()), from.Port())
}
select { select {
case t.packetInCh <- ReadPacket{content, from}: case t.packetInCh <- ReadPacket{content, from}:
return true return true

View file

@ -51,7 +51,7 @@ gcmode = "archive"
[txpool] [txpool]
nolocals = true nolocals = true
pricelimit = 30000000000 pricelimit = 25000000000
accountslots = 16 accountslots = 16
globalslots = 32768 globalslots = 32768
accountqueue = 16 accountqueue = 16
@ -64,7 +64,7 @@ gcmode = "archive"
[miner] [miner]
gaslimit = 30000000 gaslimit = 30000000
gasprice = "30000000000" gasprice = "25000000000"
# mine = false # mine = false
# etherbase = "" # etherbase = ""
# extradata = "" # extradata = ""
@ -121,7 +121,7 @@ gcmode = "archive"
# maxheaderhistory = 1024 # maxheaderhistory = 1024
# maxblockhistory = 1024 # maxblockhistory = 1024
# maxprice = "5000000000000" # maxprice = "5000000000000"
ignoreprice = "30000000000" ignoreprice = "25000000000"
[telemetry] [telemetry]
metrics = true metrics = true

View file

@ -51,7 +51,7 @@ syncmode = "full"
[txpool] [txpool]
nolocals = true nolocals = true
pricelimit = 30000000000 pricelimit = 25000000000
accountslots = 16 accountslots = 16
globalslots = 32768 globalslots = 32768
accountqueue = 16 accountqueue = 16
@ -64,7 +64,7 @@ syncmode = "full"
[miner] [miner]
gaslimit = 30000000 gaslimit = 30000000
gasprice = "30000000000" gasprice = "25000000000"
# mine = false # mine = false
# etherbase = "" # etherbase = ""
# extradata = "" # extradata = ""
@ -121,7 +121,7 @@ syncmode = "full"
# maxheaderhistory = 1024 # maxheaderhistory = 1024
# maxblockhistory = 1024 # maxblockhistory = 1024
# maxprice = "5000000000000" # maxprice = "5000000000000"
ignoreprice = "30000000000" ignoreprice = "25000000000"
[telemetry] [telemetry]
metrics = true metrics = true

View file

@ -53,7 +53,7 @@ syncmode = "full"
[txpool] [txpool]
nolocals = true nolocals = true
pricelimit = 30000000000 pricelimit = 25000000000
accountslots = 16 accountslots = 16
globalslots = 32768 globalslots = 32768
accountqueue = 16 accountqueue = 16
@ -67,7 +67,7 @@ syncmode = "full"
[miner] [miner]
mine = true mine = true
gaslimit = 30000000 gaslimit = 30000000
gasprice = "30000000000" gasprice = "25000000000"
# etherbase = "" # etherbase = ""
# extradata = "" # extradata = ""
# recommit = "2m5s" # recommit = "2m5s"
@ -123,7 +123,7 @@ syncmode = "full"
# maxheaderhistory = 1024 # maxheaderhistory = 1024
# maxblockhistory = 1024 # maxblockhistory = 1024
# maxprice = "5000000000000" # maxprice = "5000000000000"
ignoreprice = "30000000000" ignoreprice = "25000000000"
[telemetry] [telemetry]
metrics = true metrics = true

View file

@ -53,7 +53,7 @@ syncmode = "full"
[txpool] [txpool]
nolocals = true nolocals = true
pricelimit = 30000000000 pricelimit = 25000000000
accountslots = 16 accountslots = 16
globalslots = 32768 globalslots = 32768
accountqueue = 16 accountqueue = 16
@ -67,7 +67,7 @@ syncmode = "full"
[miner] [miner]
mine = true mine = true
gaslimit = 30000000 gaslimit = 30000000
gasprice = "30000000000" gasprice = "25000000000"
# etherbase = "" # etherbase = ""
# extradata = "" # extradata = ""
# recommit = "2m5s" # recommit = "2m5s"
@ -123,7 +123,7 @@ syncmode = "full"
# maxheaderhistory = 1024 # maxheaderhistory = 1024
# maxblockhistory = 1024 # maxblockhistory = 1024
# maxprice = "5000000000000" # maxprice = "5000000000000"
ignoreprice = "30000000000" ignoreprice = "25000000000"
[telemetry] [telemetry]
metrics = true metrics = true

View file

@ -1,5 +1,5 @@
Source: bor Source: bor
Version: 1.3.3 Version: 1.3.7
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor Source: bor
Version: 1.3.3 Version: 1.3.7
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile Source: bor-profile
Version: 1.3.3 Version: 1.3.7
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile Source: bor-profile
Version: 1.3.3 Version: 1.3.7
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile Source: bor-profile
Version: 1.3.3 Version: 1.3.7
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -1,5 +1,5 @@
Source: bor-profile Source: bor-profile
Version: 1.3.3 Version: 1.3.7
Section: develop Section: develop
Priority: standard Priority: standard
Maintainer: Polygon <release-team@polygon.technology> Maintainer: Polygon <release-team@polygon.technology>

View file

@ -57,12 +57,12 @@ gcmode = "archive"
# locals = [] # locals = []
# journal = "" # journal = ""
# rejournal = "1h0m0s" # rejournal = "1h0m0s"
# pricelimit = 30000000000 # pricelimit = 25000000000
# pricebump = 10 # pricebump = 10
[miner] [miner]
gaslimit = 30000000 gaslimit = 30000000
# gasprice = "30000000000" # gasprice = "25000000000"
# mine = false # mine = false
# etherbase = "" # etherbase = ""
# extradata = "" # extradata = ""
@ -119,7 +119,7 @@ gcmode = "archive"
# maxheaderhistory = 1024 # maxheaderhistory = 1024
# maxblockhistory = 1024 # maxblockhistory = 1024
# maxprice = "5000000000000" # maxprice = "5000000000000"
# ignoreprice = "30000000000" # ignoreprice = "25000000000"
[telemetry] [telemetry]
metrics = true metrics = true

View file

@ -57,12 +57,12 @@ syncmode = "full"
# locals = [] # locals = []
# journal = "" # journal = ""
# rejournal = "1h0m0s" # rejournal = "1h0m0s"
# pricelimit = 30000000000 # pricelimit = 25000000000
# pricebump = 10 # pricebump = 10
[miner] [miner]
gaslimit = 30000000 gaslimit = 30000000
# gasprice = "30000000000" # gasprice = "25000000000"
# mine = false # mine = false
# etherbase = "" # etherbase = ""
# extradata = "" # extradata = ""
@ -119,7 +119,7 @@ syncmode = "full"
# maxheaderhistory = 1024 # maxheaderhistory = 1024
# maxblockhistory = 1024 # maxblockhistory = 1024
# maxprice = "5000000000000" # maxprice = "5000000000000"
# ignoreprice = "30000000000" # ignoreprice = "25000000000"
[telemetry] [telemetry]
metrics = true metrics = true

View file

@ -59,13 +59,13 @@ syncmode = "full"
# locals = [] # locals = []
# journal = "" # journal = ""
# rejournal = "1h0m0s" # rejournal = "1h0m0s"
# pricelimit = 30000000000 # pricelimit = 25000000000
# pricebump = 10 # pricebump = 10
[miner] [miner]
mine = true mine = true
gaslimit = 30000000 gaslimit = 30000000
# gasprice = "30000000000" # gasprice = "25000000000"
# etherbase = "" # etherbase = ""
# extradata = "" # extradata = ""
# recommit = "2m5s" # recommit = "2m5s"
@ -121,7 +121,7 @@ syncmode = "full"
# maxheaderhistory = 1024 # maxheaderhistory = 1024
# maxblockhistory = 1024 # maxblockhistory = 1024
# maxprice = "5000000000000" # maxprice = "5000000000000"
# ignoreprice = "30000000000" # ignoreprice = "25000000000"
[telemetry] [telemetry]
metrics = true metrics = true

View file

@ -59,13 +59,13 @@ syncmode = "full"
# locals = [] # locals = []
# journal = "" # journal = ""
# rejournal = "1h0m0s" # rejournal = "1h0m0s"
# pricelimit = 30000000000 # pricelimit = 25000000000
# pricebump = 10 # pricebump = 10
[miner] [miner]
mine = true mine = true
gaslimit = 30000000 gaslimit = 30000000
# gasprice = "30000000000" # gasprice = "25000000000"
# etherbase = "" # etherbase = ""
# extradata = "" # extradata = ""
# recommit = "2m5s" # recommit = "2m5s"
@ -121,7 +121,7 @@ syncmode = "full"
# maxheaderhistory = 1024 # maxheaderhistory = 1024
# maxblockhistory = 1024 # maxblockhistory = 1024
# maxprice = "5000000000000" # maxprice = "5000000000000"
# ignoreprice = "30000000000" # ignoreprice = "25000000000"
[telemetry] [telemetry]
metrics = true metrics = true

View file

@ -59,12 +59,12 @@ gcmode = "archive"
# locals = [] # locals = []
# journal = "" # journal = ""
# rejournal = "1h0m0s" # rejournal = "1h0m0s"
# pricelimit = 30000000000 # pricelimit = 25000000000
# pricebump = 10 # pricebump = 10
[miner] [miner]
gaslimit = 30000000 gaslimit = 30000000
# gasprice = "30000000000" # gasprice = "25000000000"
# mine = false # mine = false
# etherbase = "" # etherbase = ""
# extradata = "" # extradata = ""
@ -121,7 +121,7 @@ gcmode = "archive"
# maxheaderhistory = 1024 # maxheaderhistory = 1024
# maxblockhistory = 1024 # maxblockhistory = 1024
# maxprice = "5000000000000" # maxprice = "5000000000000"
# ignoreprice = "30000000000" # ignoreprice = "25000000000"
[telemetry] [telemetry]
metrics = true metrics = true

View file

@ -59,12 +59,12 @@ syncmode = "full"
# locals = [] # locals = []
# journal = "" # journal = ""
# rejournal = "1h0m0s" # rejournal = "1h0m0s"
# pricelimit = 30000000000 # pricelimit = 25000000000
# pricebump = 10 # pricebump = 10
[miner] [miner]
gaslimit = 30000000 gaslimit = 30000000
# gasprice = "30000000000" # gasprice = "25000000000"
# mine = false # mine = false
# etherbase = "" # etherbase = ""
# extradata = "" # extradata = ""
@ -121,7 +121,7 @@ syncmode = "full"
# maxheaderhistory = 1024 # maxheaderhistory = 1024
# maxblockhistory = 1024 # maxblockhistory = 1024
# maxprice = "5000000000000" # maxprice = "5000000000000"
# ignoreprice = "30000000000" # ignoreprice = "25000000000"
[telemetry] [telemetry]
metrics = true metrics = true

View file

@ -61,13 +61,13 @@ syncmode = "full"
# locals = [] # locals = []
# journal = "" # journal = ""
# rejournal = "1h0m0s" # rejournal = "1h0m0s"
# pricelimit = 30000000000 # pricelimit = 25000000000
# pricebump = 10 # pricebump = 10
[miner] [miner]
mine = true mine = true
gaslimit = 30000000 gaslimit = 30000000
# gasprice = "30000000000" # gasprice = "25000000000"
# etherbase = "" # etherbase = ""
# extradata = "" # extradata = ""
# recommit = "2m5s" # recommit = "2m5s"
@ -123,7 +123,7 @@ syncmode = "full"
# maxheaderhistory = 1024 # maxheaderhistory = 1024
# maxblockhistory = 1024 # maxblockhistory = 1024
# maxprice = "5000000000000" # maxprice = "5000000000000"
# ignoreprice = "30000000000" # ignoreprice = "25000000000"
[telemetry] [telemetry]
metrics = true metrics = true

View file

@ -61,13 +61,13 @@ syncmode = "full"
# locals = [] # locals = []
# journal = "" # journal = ""
# rejournal = "1h0m0s" # rejournal = "1h0m0s"
# pricelimit = 30000000000 # pricelimit = 25000000000
# pricebump = 10 # pricebump = 10
[miner] [miner]
mine = true mine = true
gaslimit = 30000000 gaslimit = 30000000
# gasprice = "30000000000" # gasprice = "25000000000"
# etherbase = "" # etherbase = ""
# extradata = "" # extradata = ""
# recommit = "2m5s" # recommit = "2m5s"
@ -123,7 +123,7 @@ syncmode = "full"
# maxheaderhistory = 1024 # maxheaderhistory = 1024
# maxblockhistory = 1024 # maxblockhistory = 1024
# maxprice = "5000000000000" # maxprice = "5000000000000"
# ignoreprice = "30000000000" # ignoreprice = "25000000000"
[telemetry] [telemetry]
metrics = true metrics = true

View file

@ -183,13 +183,13 @@ const (
MaxBlobGasPerBlock = 6 * BlobTxBlobGasPerBlob // Maximum consumable blob gas for data blobs per block MaxBlobGasPerBlock = 6 * BlobTxBlobGasPerBlob // Maximum consumable blob gas for data blobs per block
// BorDefaultMinerGasPrice defines the minimum gas price for bor validators to mine a transaction. // BorDefaultMinerGasPrice defines the minimum gas price for bor validators to mine a transaction.
BorDefaultMinerGasPrice = 30 * GWei BorDefaultMinerGasPrice = 25 * GWei
// BorDefaultTxPoolPriceLimit defines the minimum gas price limit for bor to enforce txs acceptance into the pool. // BorDefaultTxPoolPriceLimit defines the minimum gas price limit for bor to enforce txs acceptance into the pool.
BorDefaultTxPoolPriceLimit = 30 * GWei BorDefaultTxPoolPriceLimit = 25 * GWei
// BorDefaultGpoIgnorePrice defines the minimum gas price below which bor gpo will ignore transactions. // BorDefaultGpoIgnorePrice defines the minimum gas price below which bor gpo will ignore transactions.
BorDefaultGpoIgnorePrice = 30 * GWei BorDefaultGpoIgnorePrice = 25 * GWei
) )
// Gas discount table for BLS12-381 G1 and G2 multi exponentiation operations // Gas discount table for BLS12-381 G1 and G2 multi exponentiation operations

View file

@ -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 = 3 // Patch version component of the current release VersionPatch = 7 // 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
) )