diff --git a/CHANGELOG.md b/CHANGELOG.md index 7fbdc74..b6f76e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - `blockstream.Source` now sends gRPC keepalive pings after `30s` without data (was `5m` from dgrpc) and drops the connection after `10s` without an ack, so a relayer that disappears without closing the connection (e.g. host reboot) is detected in about 40s instead of 5 minutes. - The hub no longer reads the `SOURCE_CHAN_SIZE` environment variable; set `hub.SubscriptionMaxBufferedBlocks` instead. The default goes from `100` to `10000` blocks: on fast chains, a burst of live blocks after a short pause from the live source filled 100 slots before the consumer could send the first block, closing healthy subscriptions. A consumer that cannot keep up is now caught by `SubscriptionCatchUpTimeout` instead. +- `OneBlockFile.CanonicalName` no longer includes the LIB number (`num-id-prevID` instead of `num-id-prevID-lib`). Readers whose view of the LIB differs, as on Polygon PoS / Amoy, write the same block with different LIB numbers, and these copies used to be seen as different blocks. - `DBinBlockReader.Read` no longer copies the block payload out of the message it decodes: `Payload.Value` (and the legacy `PayloadBuffer`) now point into the buffer the message was read into. Reading merged blocks is 30-47% faster and allocates half as much. ### Fixed diff --git a/oneblockfile.go b/oneblockfile.go index 0e77bf0..b1ca85c 100644 --- a/oneblockfile.go +++ b/oneblockfile.go @@ -148,7 +148,8 @@ func ParseFilename(filename string) (blockNum uint64, blockIDSuffix string, prev err = fmt.Errorf("failed parsing lib num %q: %s", parts[4], parseErr) return } - canonicalName = strings.Join(parts[0:4], "-") + // readers can disagree on the LIB of a same block, so it is not part of its identity + canonicalName = strings.Join(parts[0:3], "-") return } diff --git a/oneblockfile_test.go b/oneblockfile_test.go index 4a5154f..974690b 100644 --- a/oneblockfile_test.go +++ b/oneblockfile_test.go @@ -16,7 +16,6 @@ package bstream import ( "fmt" - "strings" "testing" pbbstream "github.com/streamingfast/bstream/pb/sf/bstream/v1" @@ -35,7 +34,7 @@ func TestOneBlockFile_MustNewOneBlockFile(t *testing.T) { name := "0000000100-0000000000000100a-0000000000000099a-90-suffix" obf := MustNewOneBlockFile(name) require.IsType(t, OneBlockFile{}, *obf) - require.Equal(t, obf.CanonicalName, strings.Split(name, "-suffix")[0]) + require.Equal(t, "0000000100-0000000000000100a-0000000000000099a", obf.CanonicalName) } func TestOneBlockFile_ParseFilename(t *testing.T) { @@ -66,7 +65,7 @@ func TestOneBlockFile_ParseFilename(t *testing.T) { expectLibNum: 90, expectBlockIDSuffix: "aaaabbbb24a07267", expectPreviousBlockIDSuffix: "ccccdddde5914b39", - expectCanonicalName: "0000000100-aaaabbbb24a07267-ccccdddde5914b39-90", + expectCanonicalName: "0000000100-aaaabbbb24a07267-ccccdddde5914b39", }, }