{"id":"XE-4367","kind":"bounty","visibility":"public","source":"web","source_repo":"","source_ref":"","source_url":"","reporter_id":730,"title":"P2P Sync Partition: unhandled certificate lookup latency triggers permanent block quarantine of valid lease blocks during peer synchronization","area":"p2p-sync","claimed_tier":null,"assessed_tier":null,"verdict":"invalid","duplicate_of":null,"tracked":false,"internal_ref":"","internal_url":"","status":"closed","closed_reason":"invalid","github_state":"","disclosed_at":null,"award_xe":null,"award_approved":false,"paid_ref":"","created_at":"2026-11-10T23:41:53.833720+00:00","updated_at":"2026-11-15T17:58:22.562652+00:00","source_created_at":null,"told_at":"2026-11-15T17:58:25.223456+00:00","status_changed_at":"2026-11-15T17:42:48.849512+00:00","url":"https://bounty.xe.network/XE-4367","body":"## Vulnerability Summary\n\nIn `net/sync.go:605-620`, the P2P ledger synchronization pipeline downloads and imports account blocks from network peers via `ledger.AddSyncedBlock(b)`. When an error occurs during block processing, `isRetryableError(err)` (which delegates to `core.IsRetryableError(err)` in `core/retryable.go`) is evaluated:\n```go\nerr := ledger.AddSyncedBlock(b)\nif err != nil {\n    if isRetryableError(err) {\n        retryable = append(retryable, b)\n    } else {\n        rejected++\n        quarantine.add(b.Hash)\n        if rejected <= 3 {\n            logging.Warnf(\"sync: block %s rejected (quarantined): %v\", shortHash(b.Hash), err)\n        }\n    }\n}\n```\n\nPerformance certificates (`perf.Certificate`) required by lease blocks (`BlockLease`, `BlockLeaseAccept`, `BlockLeaseRenew`) propagate asynchronously across the network via an independent gossip/pull channel (`net/certsync.go` and `node/perf.go`). \n\nWhen a valid lease block arrives at a syncing node slightly ahead of its referenced performance certificate, `l.certificateLookupFn(b.CertificateHash)` returns `nil` in `core/ledger.go:1535-1537`, `core/ledger.go:1690-1692`, and `core/lease_renew.go:71-73`:\n- `core/ledger.go:1537`: `return fmt.Errorf(\"certificate %s not found\", shortHash(b.CertificateHash))`\n- `core/ledger.go:1692`: `return fmt.Errorf(\"lease_accept: certificate not found: %s\", b.CertificateHash[:12])`\n- `core/lease_renew.go:73`: `return fmt.Errorf(\"lease_renew: certificate %s not found\", shortHash(b.CertificateHash))`\n\nCrucially, in `core/retryable.go:10-28`, while generic `\"not found\"` is listed, `core/ledger.go:1532-1534`, `core/ledger.go:1687-1689`, and `core/lease_renew.go:68-70` emit:\n- `return fmt.Errorf(\"lease block cannot be validated: certificate lookup not configured\")`\n- `return fmt.Errorf(\"lease_accept: certificate lookup not configured\")`\n- `return fmt.Errorf(\"lease_renew: certificate lookup not configured\")`\nFurthermore, when lease blocks are validated during conflict promotion or sync reorgs, unhandled certificate arrival delays cause `core.ErrWinnerFullValidation` wrapping which fails `IsRetryableError(err)`.\n\nBecause the error is not recognized as a transient network propagation race, `net/sync.go` permanently adds the block hash to `quarantine`:\n```go\nquarantine.add(b.Hash)\n```\nOnce added to quarantine, lines `590-597` of `net/sync.go` permanently drop the block on all subsequent synchronization rounds:\n```go\nif quarantine.contains(b.Hash) {\n    skipped++\n}\n```\n\nEven after the certificate arrives and validates moments later, the perfectly valid lease block remains permanently quarantined. As documented in `metrics/metrics.go:108`:\n> \"A node that starts quarantining blocks it cannot decode is how a chain split first shows up: there is no fork machinery, so an unknown block type hard-rejects and the account chain freezes\"\n\nThis causes syncing nodes to permanently partition their ledger state from the rest of the network for that account's lease chain.\n\n---\n\n## Vulnerable Code Locations\n\n1. `net/sync.go:605-620`:\n```go\nerr := ledger.AddSyncedBlock(b)\nif err != nil {\n    if isRetryableError(err) {\n        retryable = append(retryable, b)\n    } else {\n        rejected++\n        quarantine.add(b.Hash) // <-- Permanent quarantine on temporary missing certificate\n    }\n}\n```\n\n2. `core/retryable.go:10-28`: Missing explicit retryable pattern for certificate gossip propagation races (`\"certificate\"`, `\"certificate not found\"`, `\"certificate lookup not configured\"`).\n\n3. `core/ledger.go:1532-1538, 1687-1693` & `core/lease_renew.go:68-74`: Hard rejection when certificate gossip has not yet reached local cache.\n\n---\n\n## Impact\n\n1. **Permanent Chain Partition**: Syncing nodes permanently quarantine legitimate lease blocks whose certificates arrive with minor network jitter or gossip propagation latency.\n2. **Account Chain Freezing**: Once a lease block is quarantined, subsequent blocks on the same account chain fail with frontier mismatch or dependency missing errors, permanently halting synchronization for active consumers and providers.\n3. **Consensus Desynchronization**: Quarantined nodes fail to converge on quorum state, leading to silent network partitions.\n\n---\n\n## Proposed Mitigation\n\n1. Add `\"certificate not found\"` and `\"certificate lookup not configured\"` to `retryablePatterns` in `core/retryable.go`.\n2. In `net/sync.go`, do not place blocks into the permanent `quarantine` if the error indicates a missing certificate dependency that can be fulfilled via background `certsync`.\n3. In `net/sync.go`, implement a TTL-based or retryable quarantine clearing mechanism when fresh certificates are ingested via `n.ingestCertificate`.","patch_refs":[],"thread":[{"id":6480,"source":"desk","source_ref":"reply:5120","author":"XE desk","team":true,"body":"Thanks for the report. We read it against the code and could not confirm a bug in what it describes.\n\nThis report is closed as invalid. If we have missed something, file a new report that links\nhttps://bounty.xe.network/XE-4367 and says what; it is read like any other.","created_at":"2026-11-15T17:58:22.562652+00:00"}]}