Infer index provider topic from network name by default
Index provider integration uses a gossipsub topic to announce changes to the advertised content. The topic name was fixed to the default topic which is `/indexer/ingest/mainnet`. In the case of lotus, the gossipsub validators enforce a list of topics the instance is permitted to join by setting subscription filter option when `PubSub` instance is constructed via DI. Having the fixed topic name meant that any SP starting up a node on a network other than `mainnet` would have to override the default config to avoid the node crashing when index provider is enabled. Instead of a fixed default, the changes here infer the allowed indexer topic name from network name automatically if the topic configuration is left empty. Fixes #8510
This commit is contained in:
+4
-2
@@ -199,8 +199,10 @@ func DefaultStorageMiner() *StorageMiner {
|
||||
Enable: true,
|
||||
EntriesCacheCapacity: 1024,
|
||||
EntriesChunkSize: 16384,
|
||||
TopicName: "/indexer/ingest/mainnet",
|
||||
PurgeCacheOnStart: false,
|
||||
// The default empty TopicName means it is inferred from network name, in the following
|
||||
// format: "/indexer/ingest/<network-name>"
|
||||
TopicName: "",
|
||||
PurgeCacheOnStart: false,
|
||||
},
|
||||
|
||||
Subsystems: MinerSubsystemConfig{
|
||||
|
||||
@@ -74,8 +74,8 @@ func TestDefaultMinerRoundtrip(t *testing.T) {
|
||||
require.True(t, reflect.DeepEqual(c, c2))
|
||||
}
|
||||
|
||||
func TestDefaultStorageMiner_SetsIndexIngestTopic(t *testing.T) {
|
||||
func TestDefaultStorageMiner_IsEmpty(t *testing.T) {
|
||||
subject := DefaultStorageMiner()
|
||||
require.True(t, subject.IndexProvider.Enable)
|
||||
require.Equal(t, "/indexer/ingest/mainnet", subject.IndexProvider.TopicName)
|
||||
require.Equal(t, "", subject.IndexProvider.TopicName)
|
||||
}
|
||||
|
||||
@@ -404,7 +404,9 @@ advertisements that include more multihashes than the configured EntriesChunkSiz
|
||||
Type: "string",
|
||||
|
||||
Comment: `TopicName sets the topic name on which the changes to the advertised content are announced.
|
||||
Defaults to '/indexer/ingest/mainnet' if not specified.`,
|
||||
If not explicitly specified, the topic name is automatically inferred from the network name
|
||||
in following format: '/indexer/ingest/<network-name>'
|
||||
Defaults to empty, which implies the topic name is inferred from network name.`,
|
||||
},
|
||||
{
|
||||
Name: "PurgeCacheOnStart",
|
||||
|
||||
@@ -186,7 +186,9 @@ type IndexProviderConfig struct {
|
||||
EntriesChunkSize int
|
||||
|
||||
// TopicName sets the topic name on which the changes to the advertised content are announced.
|
||||
// Defaults to '/indexer/ingest/mainnet' if not specified.
|
||||
// If not explicitly specified, the topic name is automatically inferred from the network name
|
||||
// in following format: '/indexer/ingest/<network-name>'
|
||||
// Defaults to empty, which implies the topic name is inferred from network name.
|
||||
TopicName string
|
||||
|
||||
// PurgeCacheOnStart sets whether to clear any cached entries chunks when the provider engine
|
||||
|
||||
Reference in New Issue
Block a user