Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
7210739
Enable rebroadcast by default (#2028)
cffls Jan 30, 2026
b6f0b94
Merge branch 'v2.6.0-beta-candidate' of https://github.com/0xPolygon/…
marcello33 Feb 4, 2026
418a563
Merge branch 'develop' into v2.6.0-beta-candidate
marcello33 Feb 5, 2026
5c4029c
chore: bump version
marcello33 Feb 5, 2026
a2a67b7
consensus/misc/eip4844: small update to fix simulatev1 crash (#2054)
pratikspatil024 Feb 13, 2026
e2a8ee6
core, internal, params: lisovoPro HF and version bump (#2055)
marcello33 Feb 13, 2026
468c847
consensus/bor: fix goroutine leak in runMilestoneFetcher when Heimdal…
cffls Feb 14, 2026
d9fac7a
consensus, crypto, p2p: fix issues 44, 47, 48, 49
marcello33 Feb 17, 2026
20cee94
bump go
marcello33 Feb 17, 2026
71f1f72
ci: update workflows
marcello33 Feb 17, 2026
12b209f
consensus/bor: better naming on heimdallgrpc client context for ss txs
marcello33 Feb 17, 2026
e18de16
consensus/bor: lower global timeout for ss txs
marcello33 Feb 17, 2026
f73798e
Merge pull request #2059 from 0xPolygon/v2.5.9-candidate
marcello33 Feb 17, 2026
239aa88
fix(shutdown): cancel in-flight Heimdall queries on engine shutdown (…
kamuikatsurgi Feb 17, 2026
e332079
consensus/bor: fix sub-second late block detection producing empty bl…
cffls Feb 18, 2026
e8bbe6d
Merge branch 'master' into v2.6.0-beta-candidate
marcello33 Feb 18, 2026
bff847a
fix(core): cap verifyPendingHeaders to prevent OOM from unbounded hea…
kamuikatsurgi Feb 18, 2026
aa5b993
cmd: bump go
marcello33 Feb 18, 2026
a06d73f
Merge branch 'v2.6.0-beta-candidate' of https://github.com/0xPolygon/…
marcello33 Feb 18, 2026
1f257a6
builder, internal, params: pip-82 and lisovo HF in mainnet (#2064)
marcello33 Feb 18, 2026
6f2d79b
v2.6.0 (#2065)
marcello33 Feb 18, 2026
c1c25f7
Merge remote-tracking branch 'origin/master' into merge-master-to-dev…
kamuikatsurgi Feb 18, 2026
07a910c
fix: tests
kamuikatsurgi Feb 18, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions builder/files/genesis-amoy.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
"madhugiriProBlock": 29287400,
"dandeliBlock": 31890000,
"lisovoBlock": 33634700,
"lisovoProBlock": 34062000,
"skipValidatorByteCheck": [26160367, 26161087, 26171567, 26173743, 26175647],
"stateSyncConfirmationDelay": {
"0": 128
Expand Down
7 changes: 5 additions & 2 deletions builder/files/genesis-mainnet-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
"madhugiriBlock": 80084800,
"madhugiriProBlock": 80084800,
"dandeliBlock": 81424000,
"lisovoBlock": 83756500,
"lisovoProBlock": 83756500,
"stateSyncConfirmationDelay": {
"44934656": 128
},
Expand Down Expand Up @@ -112,7 +114,8 @@
},
"burntContract": {
"23850000": "0x70bca57f4579f58670ab2d18ef16e02c17553c38",
"50523000": "0x7A8ed27F4C30512326878652d20fC85727401854"
"50523000": "0x7A8ed27F4C30512326878652d20fC85727401854",
"83756500": "0x3ef57def668054dd750bd260526105c4eeef104f"
}
}
},
Expand Down Expand Up @@ -161,4 +164,4 @@
"number": "0x0",
"gasUsed": "0x0",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
}
34 changes: 25 additions & 9 deletions consensus/bor/bor.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ import (
)

const (
defaultSpanLength = 6400 // Default span length i.e. number of bor blocks in a span
defaultSpanLength = params.DefaultSpanLength
zerothSpanEnd = 255 // End block of 0th span
checkpointInterval = 1024 // Number of blocks after which to save the vote snapshot to the database
inmemorySnapshots = 128 // Number of recent vote snapshots to keep in memory
Expand Down Expand Up @@ -265,6 +265,10 @@ type Bor struct {

quit chan struct{}
closeOnce sync.Once

// ctx is cancelled when Close() is called, allowing in-flight operations to abort promptly.
ctx context.Context
ctxCancel context.CancelFunc
}

type signer struct {
Expand Down Expand Up @@ -309,6 +313,8 @@ func New(
// Create a new span store
spanStore := NewSpanStore(heimdallClient, spanner, chainConfig.ChainID.String())

ctx, ctxCancel := context.WithCancel(context.Background())

c := &Bor{
chainConfig: chainConfig,
config: borConfig,
Expand All @@ -325,6 +331,8 @@ func New(
DevFakeAuthor: devFakeAuthor,
blockTime: blockTime,
quit: make(chan struct{}),
ctx: ctx,
ctxCancel: ctxCancel,
}

c.authorizedSigner.Store(&signer{
Expand Down Expand Up @@ -543,10 +551,15 @@ func (c *Bor) verifyCascadingFields(chain consensus.ChainHeaderReader, header *t
parent = chain.GetHeader(header.ParentHash, number-1)
}

if parent == nil || parent.Number.Uint64() != number-1 || parent.Hash() != header.ParentHash {
if parent == nil || parent.Hash() != header.ParentHash {
return consensus.ErrUnknownAncestor
}

// Verify block number continuity
if diff := new(big.Int).Sub(header.Number, parent.Number); diff.Cmp(big.NewInt(1)) != 0 {
return consensus.ErrInvalidNumber
}

// Verify that the gasUsed is <= gasLimit
if header.GasUsed > header.GasLimit {
return fmt.Errorf("invalid gasUsed: have %d, gasLimit %d", header.GasUsed, header.GasLimit)
Expand Down Expand Up @@ -583,7 +596,7 @@ func (c *Bor) verifyCascadingFields(chain consensus.ChainHeaderReader, header *t
// validation stateless, we use the span from heimdall (via span store) instead of
// span from validator set genesis contract as both are supposed to be equivalent.
if number > zerothSpanEnd && IsSprintStart(number+1, c.config.CalculateSprint(number)) {
span, err := c.spanStore.spanByBlockNumber(context.Background(), number+1)
span, err := c.spanStore.spanByBlockNumber(c.ctx, number+1)
if err != nil {
return err
}
Expand Down Expand Up @@ -693,7 +706,7 @@ func (c *Bor) snapshot(chain consensus.ChainHeaderReader, targetHeader *types.He
hash := checkpoint.Hash()

// get validators from span
span, err := c.spanStore.spanByBlockNumber(context.Background(), number+1)
span, err := c.spanStore.spanByBlockNumber(c.ctx, number+1)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -772,7 +785,7 @@ func (c *Bor) getVeBlopSnapshot(chain consensus.ChainHeaderReader, targetHeader
}
}

span, err := c.spanStore.spanByBlockNumber(context.Background(), number)
span, err := c.spanStore.spanByBlockNumber(c.ctx, number)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -1080,7 +1093,7 @@ func (c *Bor) Prepare(chain consensus.ChainHeaderReader, header *types.Header, w
}

now := time.Now()
if header.Time < uint64(now.Unix()) {
if now.After(header.GetActualTime()) {
additionalBlockTime := time.Duration(c.config.CalculatePeriod(number)) * time.Second
if c.blockTime > 0 && c.config.IsRio(header.Number) {
additionalBlockTime = c.blockTime
Expand Down Expand Up @@ -1469,6 +1482,7 @@ func (c *Bor) APIs(chain consensus.ChainHeaderReader) []rpc.API {
// Close implements consensus.Engine.
func (c *Bor) Close() error {
c.closeOnce.Do(func() {
c.ctxCancel()
close(c.quit)
if c.HeimdallClient != nil {
c.HeimdallClient.Close()
Expand All @@ -1490,7 +1504,9 @@ func (c *Bor) runMilestoneFetcher() {
select {
case <-ticker.C:
if c.HeimdallClient != nil {
milestone, err := c.HeimdallClient.FetchMilestone(context.Background())
ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second)
milestone, err := c.HeimdallClient.FetchMilestone(ctx)
cancel()
if err != nil {
log.Warn("Error while fetching milestone", "error", err)
continue
Expand Down Expand Up @@ -1692,9 +1708,9 @@ func (c *Bor) CommitStates(
var eventRecords []*clerk.EventRecordWithTime

// Wait for heimdall to be synced before fetching state sync events
c.spanStore.waitUntilHeimdallIsSynced(context.Background())
c.spanStore.waitUntilHeimdallIsSynced(c.ctx)

eventRecords, err = c.HeimdallClient.StateSyncEvents(context.Background(), from, to.Unix())
eventRecords, err = c.HeimdallClient.StateSyncEvents(c.ctx, from, to.Unix())
if err != nil {
log.Error("Error occurred when fetching state sync events", "fromID", from, "to", to.Unix(), "err", err)

Expand Down
Loading
Loading