Compare commits

...
Author SHA1 Message Date
Masih H. Derkani 031bfaf120 Update to the head of go-fil-markets#673
Update to the head of the PR that introduces indexing integration in
`go-fil-markets` so that failure to connect to full node is logged only
instead of crashing markets process.

Relates to:
 - https://github.com/filecoin-project/go-fil-markets/pull/673
 - https://github.com/filecoin-project/index-provider/issues/177
2022-02-15 12:37:13 +00:00
Masih H. Derkani f15a1edbf2 Protect index provider peer ID before connecting to full node
Add the peer ID of index provider host to the list of protected peers
before connecting to full node. Otherwise, it is possible for the
connection to be reset by full node before we reach the line that adds
the ID to list of protected peers via JsonRPC API.

Relates to:
 - https://github.com/filecoin-project/index-provider/issues/177
2022-02-15 11:49:29 +00:00
3 changed files with 14 additions and 8 deletions
+1 -1
View File
@@ -36,7 +36,7 @@ require (
github.com/filecoin-project/go-data-transfer v1.14.0
github.com/filecoin-project/go-fil-commcid v0.1.0
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0
github.com/filecoin-project/go-fil-markets v1.19.1-0.20220210121001-44fb837759c1
github.com/filecoin-project/go-fil-markets v1.19.1-0.20220215120226-a0db7a73d4fd
github.com/filecoin-project/go-indexer-core v0.2.8
github.com/filecoin-project/go-jsonrpc v0.1.5
github.com/filecoin-project/go-legs v0.3.0
+2 -2
View File
@@ -336,8 +336,8 @@ github.com/filecoin-project/go-fil-commcid v0.1.0 h1:3R4ds1A9r6cr8mvZBfMYxTS88Oq
github.com/filecoin-project/go-fil-commcid v0.1.0/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ=
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0 h1:imrrpZWEHRnNqqv0tN7LXep5bFEVOVmQWHJvl2mgsGo=
github.com/filecoin-project/go-fil-commp-hashhash v0.1.0/go.mod h1:73S8WSEWh9vr0fDJVnKADhfIv/d6dCbAGaAGWbdJEI8=
github.com/filecoin-project/go-fil-markets v1.19.1-0.20220210121001-44fb837759c1 h1:gGfvTCfHDCqEfVhGZSIALKtzF3D4p5Lhm4wH4KGv+60=
github.com/filecoin-project/go-fil-markets v1.19.1-0.20220210121001-44fb837759c1/go.mod h1:Q7EWzO9s4sg2KYBUJduTYdtVhVhusDuH2W0keyyub3I=
github.com/filecoin-project/go-fil-markets v1.19.1-0.20220215120226-a0db7a73d4fd h1:RO4M6fD9L6+OGqgk6OnMrFJcN5JkcMo3MX40vqxUfmQ=
github.com/filecoin-project/go-fil-markets v1.19.1-0.20220215120226-a0db7a73d4fd/go.mod h1:Q7EWzO9s4sg2KYBUJduTYdtVhVhusDuH2W0keyyub3I=
github.com/filecoin-project/go-hamt-ipld v0.1.5 h1:uoXrKbCQZ49OHpsTCkrThPNelC4W3LPEk0OrS/ytIBM=
github.com/filecoin-project/go-hamt-ipld v0.1.5/go.mod h1:6Is+ONR5Cd5R6XZoCse1CWaXZc0Hdb/JeX+EQCQzX24=
github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 h1:b3UDemBYN2HNfk3KOXNuxgTTxlWi3xVvbQP0IT38fvM=
+11 -5
View File
@@ -23,22 +23,28 @@ type Libp2pMeshCreator struct {
}
func (mc Libp2pMeshCreator) Connect(ctx context.Context) error {
// Add the index provider's host ID to list of protected peers first, before any attempt to
// connect to full node.
idxProvID := mc.idxProvHost.ID()
if err := mc.fullnodeApi.NetProtectAdd(ctx, []peer.ID{idxProvID}); err != nil {
return fmt.Errorf("failed to call NetProtectAdd on the full node, err: %w", err)
}
faddrs, err := mc.fullnodeApi.NetAddrsListen(ctx)
if err != nil {
return fmt.Errorf("failed to fetch full node listen addrs, err: %w", err)
}
// otherwise, connect to the full node, ask it to protect the connection and protect the connection on our end too
// Connect to the full node, ask it to protect the connection and protect the connection on
// markets end too.
if err := mc.idxProvHost.Connect(ctx, faddrs); err != nil {
return fmt.Errorf("failed to connect index provider host with the full node: %w", err)
}
mc.idxProvHost.ConnManager().Protect(faddrs.ID, "index-provider-gossipsub")
if err := mc.fullnodeApi.NetProtectAdd(ctx, []peer.ID{mc.idxProvHost.ID()}); err != nil {
return fmt.Errorf("failed to call NetProtectAdd on the full node, err: %w", err)
}
log.Debugw("successfully connected to full node and asked it protect indexer provider peer conn", "fullNodeInfo", faddrs.String(),
"idxProviderPeerId", mc.idxProvHost.ID())
"idxProviderPeerId", idxProvID)
return nil
}