Skip to content

Conversation

@pull
Copy link

@pull pull bot commented Jan 30, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

lexnv and others added 2 commits January 30, 2026 17:46
…e updated (#10891)

The collator protocol contained a race-condition which could manifest as
"Collation wasn't advertised".

A given peer ("A") can connect before the new authority keys are
received via `UpdatedAuthorityIds` (nk -- new key).

- T0: peer A connects`PeerConnected`
- T1: peer A sends its current view `PeerViewChange`
  - Peer A wants the block N 
- T2: `validator_group.should_advertise_to`: checks peer A for key nK
(the new key)
- We don't have this key stored and therefore return
`ShouldAdvertiseTo::NotAuthority`
- T3: `UpdatedAuthorityIds` arrives with (peer A, [nK])

At this point, we have the collation, peer A wants to collation, we know
peer A is an authority but we never send the collation back. Then, the
collation will expire with "Collation wasn't advertised".

To close the gap, the `UpdatedAuthorityIds` events will trigger a
re-advertisement of collations
- note: if the advertisement was already sent, the logic does not resend
it (achieved in should_advertise_to).

Part of the stabilization of: 
- #10425

---------

Signed-off-by: Alexandru Vasile <[email protected]>
Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
## Summary

Fixes a UNIQUE constraint violation when processing blocks after a
re-org:
```
UNIQUE constraint failed: transaction_hashes.transaction_hash
```

## Problem

When a blockchain re-org occurs:
1. Block A contains transaction TX1 → stored in `transaction_hashes`
2. Server restarts (clearing the in-memory `block_number_to_hashes` map)
3. Re-org happens, Block B (different hash) now contains the same TX1
4. INSERT fails because TX1 already exists with old block_hash

---------

Co-authored-by: cmd[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@pull pull bot locked and limited conversation to collaborators Jan 30, 2026
@pull pull bot added the ⤵️ pull label Jan 30, 2026
@pull pull bot merged commit 684c79c into cshein45:master Jan 30, 2026
1 check failed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants