From 522858c8711e5f56f3b5d6d32ec6f75b5013527f Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Mon, 30 Aug 2021 14:35:15 +0200 Subject: [PATCH 01/76] Add lotus tracer interface --- node/modules/lp2p/tracer.go | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 node/modules/lp2p/tracer.go diff --git a/node/modules/lp2p/tracer.go b/node/modules/lp2p/tracer.go new file mode 100644 index 000000000..36dd6d456 --- /dev/null +++ b/node/modules/lp2p/tracer.go @@ -0,0 +1,26 @@ +package lp2p + +import ( + peer "github.com/libp2p/go-libp2p-core/peer" + pubsub "github.com/libp2p/go-libp2p-pubsub" + pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb" +) + +func newLotusTracer(tr pubsub.EventTracer) LotusTracer { + return &lotusTracer{ + tr: tr, + } +} + +type lotusTracer struct { + tr pubsub.EventTracer +} + +type LotusTracer interface { + TracePeerScore(scores map[peer.ID]*pubsub.PeerScoreSnapshot) + Trace(evt *pubsub_pb.TraceEvent) +} + +func (lt *lotusTracer) TracePeerScore(scores map[peer.ID]*pubsub.PeerScoreSnapshot) {} + +func (lt *lotusTracer) Trace(evt *pubsub_pb.TraceEvent) {} From 99fbd7039e524daca65106ff1846d20178a726a1 Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Mon, 30 Aug 2021 14:38:15 +0200 Subject: [PATCH 02/76] Update pubsub tracking to trace from lotus and lp2p tracers --- node/modules/lp2p/pubsub.go | 70 +++++++++++++++++++++++++++---------- 1 file changed, 52 insertions(+), 18 deletions(-) diff --git a/node/modules/lp2p/pubsub.go b/node/modules/lp2p/pubsub.go index 32b85daf3..5bee17298 100644 --- a/node/modules/lp2p/pubsub.go +++ b/node/modules/lp2p/pubsub.go @@ -358,11 +358,12 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) { return nil, err } - trw := newTracerWrapper(tr, build.BlocksTopic(in.Nn)) + lt := newLotusTracer(tr) + trw := newTracerWrapper(tr, lt, build.BlocksTopic(in.Nn)) options = append(options, pubsub.WithEventTracer(trw)) } else { // still instantiate a tracer for collecting metrics - trw := newTracerWrapper(nil) + trw := newTracerWrapper(nil, nil) options = append(options, pubsub.WithEventTracer(trw)) } @@ -374,7 +375,11 @@ func HashMsgId(m *pubsub_pb.Message) string { return string(hash[:]) } -func newTracerWrapper(tr pubsub.EventTracer, topics ...string) pubsub.EventTracer { +func newTracerWrapper( + lp2pTracer pubsub.EventTracer, + lotusTracer pubsub.EventTracer, + topics ...string, +) pubsub.EventTracer { var topicsMap map[string]struct{} if len(topics) > 0 { topicsMap = make(map[string]struct{}) @@ -383,12 +388,13 @@ func newTracerWrapper(tr pubsub.EventTracer, topics ...string) pubsub.EventTrace } } - return &tracerWrapper{tr: tr, topics: topicsMap} + return &tracerWrapper{lp2pTracer: lp2pTracer, lotusTracer: lotusTracer, topics: topicsMap} } type tracerWrapper struct { - tr pubsub.EventTracer - topics map[string]struct{} + lp2pTracer pubsub.EventTracer + lotusTracer pubsub.EventTracer + topics map[string]struct{} } func (trw *tracerWrapper) traceMessage(topic string) bool { @@ -406,33 +412,61 @@ func (trw *tracerWrapper) Trace(evt *pubsub_pb.TraceEvent) { switch evt.GetType() { case pubsub_pb.TraceEvent_PUBLISH_MESSAGE: stats.Record(context.TODO(), metrics.PubsubPublishMessage.M(1)) - if trw.tr != nil && trw.traceMessage(evt.GetPublishMessage().GetTopic()) { - trw.tr.Trace(evt) + if trw.traceMessage(evt.GetPublishMessage().GetTopic()) { + if trw.lp2pTracer != nil { + trw.lp2pTracer.Trace(evt) + } + + if trw.lotusTracer != nil { + trw.lotusTracer.Trace(evt) + } } case pubsub_pb.TraceEvent_DELIVER_MESSAGE: stats.Record(context.TODO(), metrics.PubsubDeliverMessage.M(1)) - if trw.tr != nil && trw.traceMessage(evt.GetDeliverMessage().GetTopic()) { - trw.tr.Trace(evt) + if trw.traceMessage(evt.GetDeliverMessage().GetTopic()) { + if trw.lp2pTracer != nil { + trw.lp2pTracer.Trace(evt) + } + + if trw.lotusTracer != nil { + trw.lotusTracer.Trace(evt) + } } case pubsub_pb.TraceEvent_REJECT_MESSAGE: stats.Record(context.TODO(), metrics.PubsubRejectMessage.M(1)) case pubsub_pb.TraceEvent_DUPLICATE_MESSAGE: stats.Record(context.TODO(), metrics.PubsubDuplicateMessage.M(1)) case pubsub_pb.TraceEvent_JOIN: - if trw.tr != nil { - trw.tr.Trace(evt) + if trw.lp2pTracer != nil { + trw.lp2pTracer.Trace(evt) + } + + if trw.lotusTracer != nil { + trw.lotusTracer.Trace(evt) } case pubsub_pb.TraceEvent_LEAVE: - if trw.tr != nil { - trw.tr.Trace(evt) + if trw.lp2pTracer != nil { + trw.lp2pTracer.Trace(evt) + } + + if trw.lotusTracer != nil { + trw.lotusTracer.Trace(evt) } case pubsub_pb.TraceEvent_GRAFT: - if trw.tr != nil { - trw.tr.Trace(evt) + if trw.lp2pTracer != nil { + trw.lp2pTracer.Trace(evt) + } + + if trw.lotusTracer != nil { + trw.lotusTracer.Trace(evt) } case pubsub_pb.TraceEvent_PRUNE: - if trw.tr != nil { - trw.tr.Trace(evt) + if trw.lp2pTracer != nil { + trw.lp2pTracer.Trace(evt) + } + + if trw.lotusTracer != nil { + trw.lotusTracer.Trace(evt) } case pubsub_pb.TraceEvent_RECV_RPC: stats.Record(context.TODO(), metrics.PubsubRecvRPC.M(1)) From b1dafd81b84cbe298fc514e0d2840d0c4aeaa4d1 Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Mon, 30 Aug 2021 14:49:10 +0200 Subject: [PATCH 03/76] Add peer score tracing on pubsub peer score inspect --- node/modules/lp2p/pubsub.go | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/node/modules/lp2p/pubsub.go b/node/modules/lp2p/pubsub.go index 5bee17298..321108e4a 100644 --- a/node/modules/lp2p/pubsub.go +++ b/node/modules/lp2p/pubsub.go @@ -49,6 +49,30 @@ func ScoreKeeper() *dtypes.ScoreKeeper { return new(dtypes.ScoreKeeper) } +type PeerScoreTracker interface { + UpdatePeerScore(scores map[peer.ID]*pubsub.PeerScoreSnapshot) +} + +type peerScoreTracker struct { + sk *dtypes.ScoreKeeper + lt LotusTracer +} + +func newPeerScoreTracker(lt LotusTracer, sk *dtypes.ScoreKeeper) PeerScoreTracker { + return &peerScoreTracker{ + sk: sk, + lt: lt, + } +} + +func (pst *peerScoreTracker) UpdatePeerScore(scores map[peer.ID]*pubsub.PeerScoreSnapshot) { + if pst.lt != nil { + pst.lt.TracePeerScore(scores) + } + + pst.sk.Update(scores) +} + type GossipIn struct { fx.In Mctx helpers.MetricsCtx @@ -272,7 +296,6 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) { OpportunisticGraftThreshold: OpportunisticGraftScoreThreshold, }, ), - pubsub.WithPeerScoreInspect(in.Sk.Update, 10*time.Second), } // enable Peer eXchange on bootstrappers @@ -359,12 +382,18 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) { } lt := newLotusTracer(tr) + pst := newPeerScoreTracker(lt, in.Sk) trw := newTracerWrapper(tr, lt, build.BlocksTopic(in.Nn)) + options = append(options, pubsub.WithEventTracer(trw)) + options = append(options, pubsub.WithPeerScoreInspect(pst.UpdatePeerScore, 10*time.Second)) } else { // still instantiate a tracer for collecting metrics trw := newTracerWrapper(nil, nil) options = append(options, pubsub.WithEventTracer(trw)) + + pst := newPeerScoreTracker(nil, in.Sk) + options = append(options, pubsub.WithPeerScoreInspect(pst.UpdatePeerScore, 10*time.Second)) } return pubsub.NewGossipSub(helpers.LifecycleCtx(in.Mctx, in.Lc), in.Host, options...) From c367533a3cd5f901ea474d17d7ea510331573439 Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Fri, 10 Sep 2021 12:36:38 +0200 Subject: [PATCH 04/76] Add transport interface --- node/modules/{lp2p => tracer}/tracer.go | 10 ++++++---- node/modules/tracer/transport.go | 5 +++++ 2 files changed, 11 insertions(+), 4 deletions(-) rename node/modules/{lp2p => tracer}/tracer.go (75%) create mode 100644 node/modules/tracer/transport.go diff --git a/node/modules/lp2p/tracer.go b/node/modules/tracer/tracer.go similarity index 75% rename from node/modules/lp2p/tracer.go rename to node/modules/tracer/tracer.go index 36dd6d456..a19ae065d 100644 --- a/node/modules/lp2p/tracer.go +++ b/node/modules/tracer/tracer.go @@ -1,4 +1,4 @@ -package lp2p +package tracer import ( peer "github.com/libp2p/go-libp2p-core/peer" @@ -6,14 +6,16 @@ import ( pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb" ) -func newLotusTracer(tr pubsub.EventTracer) LotusTracer { +func newLotusTracer(et pubsub.EventTracer, tt TracerTransport) LotusTracer { return &lotusTracer{ - tr: tr, + et: et, + tt: tt, } } type lotusTracer struct { - tr pubsub.EventTracer + et pubsub.EventTracer + tt TracerTransport } type LotusTracer interface { diff --git a/node/modules/tracer/transport.go b/node/modules/tracer/transport.go new file mode 100644 index 000000000..73ef80690 --- /dev/null +++ b/node/modules/tracer/transport.go @@ -0,0 +1,5 @@ +package tracer + +type TracerTransport interface { + Transport(jsonEvent []byte) +} From d5a4b0637abf50b418756d02c796c15230febc0c Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Fri, 10 Sep 2021 15:37:38 +0200 Subject: [PATCH 05/76] Add lotus tracer transport calls --- node/modules/tracer/tracer.go | 31 +++++++++++++++++++++++++++++-- node/modules/tracer/transport.go | 2 +- 2 files changed, 30 insertions(+), 3 deletions(-) diff --git a/node/modules/tracer/tracer.go b/node/modules/tracer/tracer.go index a19ae065d..6d60352e7 100644 --- a/node/modules/tracer/tracer.go +++ b/node/modules/tracer/tracer.go @@ -1,11 +1,16 @@ package tracer import ( + "encoding/json" + + logging "github.com/ipfs/go-log/v2" peer "github.com/libp2p/go-libp2p-core/peer" pubsub "github.com/libp2p/go-libp2p-pubsub" pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb" ) +var log = logging.Logger("lotus-tracer") + func newLotusTracer(et pubsub.EventTracer, tt TracerTransport) LotusTracer { return &lotusTracer{ et: et, @@ -23,6 +28,28 @@ type LotusTracer interface { Trace(evt *pubsub_pb.TraceEvent) } -func (lt *lotusTracer) TracePeerScore(scores map[peer.ID]*pubsub.PeerScoreSnapshot) {} +func (lt *lotusTracer) TracePeerScore(scores map[peer.ID]*pubsub.PeerScoreSnapshot) { + jsonEvent, err := json.Marshal(scores) + if err != nil { + log.Errorf("error while marshaling peer score: %s", err) + return + } -func (lt *lotusTracer) Trace(evt *pubsub_pb.TraceEvent) {} + err = lt.tt.Transport(jsonEvent) + if err != nil { + log.Errorf("error while transporting peer scores: %s", err) + } +} + +func (lt *lotusTracer) Trace(evt *pubsub_pb.TraceEvent) { + jsonEvent, err := json.Marshal(evt) + if err != nil { + log.Errorf("error while marshaling tracer event: %s", err) + return + } + + err = lt.tt.Transport(jsonEvent) + if err != nil { + log.Errorf("error while transporting trace event: %s", err) + } +} diff --git a/node/modules/tracer/transport.go b/node/modules/tracer/transport.go index 73ef80690..c8495821e 100644 --- a/node/modules/tracer/transport.go +++ b/node/modules/tracer/transport.go @@ -1,5 +1,5 @@ package tracer type TracerTransport interface { - Transport(jsonEvent []byte) + Transport(jsonEvent []byte) error } From 8e6a01de6ddd156f721c9039db0407a8277874eb Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Wed, 15 Sep 2021 13:40:54 +0200 Subject: [PATCH 06/76] Add configuration in pubsub to trace locally to json file --- node/config/types.go | 1 + node/modules/lp2p/pubsub.go | 20 ++++++++++++++++---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/node/config/types.go b/node/config/types.go index 1576169e6..05ea472f3 100644 --- a/node/config/types.go +++ b/node/config/types.go @@ -309,6 +309,7 @@ type Pubsub struct { DirectPeers []string IPColocationWhitelist []string RemoteTracer string + JsonTracerFile string } type Chainstore struct { diff --git a/node/modules/lp2p/pubsub.go b/node/modules/lp2p/pubsub.go index 321108e4a..6cf52fdf0 100644 --- a/node/modules/lp2p/pubsub.go +++ b/node/modules/lp2p/pubsub.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "net" + "os" "time" host "github.com/libp2p/go-libp2p-core/host" @@ -21,6 +22,7 @@ import ( "github.com/filecoin-project/lotus/node/config" "github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/modules/helpers" + "github.com/filecoin-project/lotus/node/modules/tracer" ) func init() { @@ -55,10 +57,10 @@ type PeerScoreTracker interface { type peerScoreTracker struct { sk *dtypes.ScoreKeeper - lt LotusTracer + lt tracer.LotusTracer } -func newPeerScoreTracker(lt LotusTracer, sk *dtypes.ScoreKeeper) PeerScoreTracker { +func newPeerScoreTracker(lt tracer.LotusTracer, sk *dtypes.ScoreKeeper) PeerScoreTracker { return &peerScoreTracker{ sk: sk, lt: lt, @@ -67,7 +69,7 @@ func newPeerScoreTracker(lt LotusTracer, sk *dtypes.ScoreKeeper) PeerScoreTracke func (pst *peerScoreTracker) UpdatePeerScore(scores map[peer.ID]*pubsub.PeerScoreSnapshot) { if pst.lt != nil { - pst.lt.TracePeerScore(scores) + pst.lt.PeerScores(scores) } pst.sk.Update(scores) @@ -364,6 +366,17 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) { pubsub.NewAllowlistSubscriptionFilter(allowTopics...), 100))) + var lt tracer.LotusTracer + if in.Cfg.JsonTracerFile != "" { + out, err := os.OpenFile(in.Cfg.JsonTracerFile, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0660) + if err != nil { + return nil, err + } + + jsonTransport := tracer.NewJsonTracerTransport(out) + lt = tracer.NewLotusTracer(jsonTransport, in.Host.ID()) + } + // tracer if in.Cfg.RemoteTracer != "" { a, err := ma.NewMultiaddr(in.Cfg.RemoteTracer) @@ -381,7 +394,6 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) { return nil, err } - lt := newLotusTracer(tr) pst := newPeerScoreTracker(lt, in.Sk) trw := newTracerWrapper(tr, lt, build.BlocksTopic(in.Nn)) From ab86c5419d6ac0fcfdd789e4f421a8cc2db61cef Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Wed, 15 Sep 2021 13:41:03 +0200 Subject: [PATCH 07/76] Implement json tracer transport --- node/modules/tracer/json_transport.go | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 node/modules/tracer/json_transport.go diff --git a/node/modules/tracer/json_transport.go b/node/modules/tracer/json_transport.go new file mode 100644 index 000000000..2ab004d9c --- /dev/null +++ b/node/modules/tracer/json_transport.go @@ -0,0 +1,20 @@ +package tracer + +import ( + "os" +) + +type jsonTracerTransport struct { + out *os.File +} + +func NewJsonTracerTransport(out *os.File) TracerTransport { + return &jsonTracerTransport{ + out: out, + } +} + +func (jtt *jsonTracerTransport) Transport(jsonEvent []byte) error { + _, err := jtt.out.Write(jsonEvent) + return err +} From 8a657b90a7d5eba00db902afff5ddd7673ea0e22 Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Wed, 15 Sep 2021 13:41:56 +0200 Subject: [PATCH 08/76] Refactor lotus tracer to behave like lp2p tracer --- node/modules/tracer/tracer.go | 50 ++++++++++++++++++++++++++++------- 1 file changed, 41 insertions(+), 9 deletions(-) diff --git a/node/modules/tracer/tracer.go b/node/modules/tracer/tracer.go index 6d60352e7..af3a987b0 100644 --- a/node/modules/tracer/tracer.go +++ b/node/modules/tracer/tracer.go @@ -2,34 +2,66 @@ package tracer import ( "encoding/json" + "time" logging "github.com/ipfs/go-log/v2" - peer "github.com/libp2p/go-libp2p-core/peer" + "github.com/libp2p/go-libp2p-core/peer" pubsub "github.com/libp2p/go-libp2p-pubsub" pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb" ) var log = logging.Logger("lotus-tracer") -func newLotusTracer(et pubsub.EventTracer, tt TracerTransport) LotusTracer { +func NewLotusTracer(tt TracerTransport, pid peer.ID) LotusTracer { return &lotusTracer{ - et: et, - tt: tt, + tt: tt, + pid: pid, } } type lotusTracer struct { - et pubsub.EventTracer - tt TracerTransport + tt TracerTransport + pid peer.ID +} + +const ( + TraceEvent_PEER_SCORES pubsub_pb.TraceEvent_Type = 100 +) + +type LotusTraceEvent struct { + Type pubsub_pb.TraceEvent_Type `json:"type,omitempty"` + PeerID []byte `json:"peerID,omitempty"` + Timestamp *int64 `json:"timestamp,omitempty"` + PeerScores *TraceEvent_PeerScores `json:"peerScores,omitempty"` +} + +type TraceEvent_PeerScores struct { + Scores map[peer.ID]*pubsub.PeerScoreSnapshot `json:"scores,omitempty"` } type LotusTracer interface { - TracePeerScore(scores map[peer.ID]*pubsub.PeerScoreSnapshot) Trace(evt *pubsub_pb.TraceEvent) + TraceLotusEvent(evt *LotusTraceEvent) + + PeerScores(scores map[peer.ID]*pubsub.PeerScoreSnapshot) } -func (lt *lotusTracer) TracePeerScore(scores map[peer.ID]*pubsub.PeerScoreSnapshot) { - jsonEvent, err := json.Marshal(scores) +func (lt *lotusTracer) PeerScores(scores map[peer.ID]*pubsub.PeerScoreSnapshot) { + now := time.Now().UnixNano() + evt := &LotusTraceEvent{ + Type: *TraceEvent_PEER_SCORES.Enum(), + PeerID: []byte(lt.pid), + Timestamp: &now, + PeerScores: &TraceEvent_PeerScores{ + Scores: scores, + }, + } + + lt.TraceLotusEvent(evt) +} + +func (lt *lotusTracer) TraceLotusEvent(evt *LotusTraceEvent) { + jsonEvent, err := json.Marshal(evt) if err != nil { log.Errorf("error while marshaling peer score: %s", err) return From c064ce485283cb96a751c1924996c9cc28fd6a44 Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Wed, 15 Sep 2021 14:22:48 +0200 Subject: [PATCH 09/76] Add generated documentation --- node/config/doc_gen.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/node/config/doc_gen.go b/node/config/doc_gen.go index 9efe4e03c..05e7afff4 100644 --- a/node/config/doc_gen.go +++ b/node/config/doc_gen.go @@ -525,6 +525,12 @@ Type: Array of multiaddress peerinfo strings, must include peerid (/p2p/12D3K... Name: "RemoteTracer", Type: "string", + Comment: ``, + }, + { + Name: "JsonTracerFile", + Type: "string", + Comment: ``, }, }, From bb85ca031d9466cc77fec59b04361680822a7f2f Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Wed, 15 Sep 2021 14:50:27 +0200 Subject: [PATCH 10/76] Add elasticsearch transport --- go.mod | 1 + go.sum | 2 + node/config/doc_gen.go | 6 ++ node/config/types.go | 1 + node/modules/lp2p/pubsub.go | 3 + .../modules/tracer/elasticsearch_transport.go | 59 +++++++++++++++++++ node/modules/tracer/tracer.go | 21 ++++--- 7 files changed, 85 insertions(+), 8 deletions(-) create mode 100644 node/modules/tracer/elasticsearch_transport.go diff --git a/go.mod b/go.mod index f73511574..a5adcca6f 100644 --- a/go.mod +++ b/go.mod @@ -22,6 +22,7 @@ require ( github.com/drand/drand v1.2.1 github.com/drand/kyber v1.1.4 github.com/dustin/go-humanize v1.0.0 + github.com/elastic/go-elasticsearch/v7 v7.14.0 github.com/elastic/go-sysinfo v1.3.0 github.com/elastic/gosigar v0.12.0 github.com/etclabscore/go-openrpc-reflect v0.0.36 diff --git a/go.sum b/go.sum index f16a81a9f..6347ac4f7 100644 --- a/go.sum +++ b/go.sum @@ -235,6 +235,8 @@ github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5m github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/elastic/go-elasticsearch/v7 v7.14.0 h1:extp3jos/rwJn3J+lgbaGlwAgs0TVsIHme00GyNAyX4= +github.com/elastic/go-elasticsearch/v7 v7.14.0/go.mod h1:OJ4wdbtDNk5g503kvlHLyErCgQwwzmDtaFC4XyOxXA4= github.com/elastic/go-sysinfo v1.3.0 h1:eb2XFGTMlSwG/yyU9Y8jVAYLIzU2sFzWXwo2gmetyrE= github.com/elastic/go-sysinfo v1.3.0/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6eh0ikPT9F0= github.com/elastic/go-windows v1.0.0 h1:qLURgZFkkrYyTTkvYpsZIgf83AUsdIHfvlJaqaZ7aSY= diff --git a/node/config/doc_gen.go b/node/config/doc_gen.go index 05e7afff4..fd4ec0366 100644 --- a/node/config/doc_gen.go +++ b/node/config/doc_gen.go @@ -531,6 +531,12 @@ Type: Array of multiaddress peerinfo strings, must include peerid (/p2p/12D3K... Name: "JsonTracerFile", Type: "string", + Comment: ``, + }, + { + Name: "ElasticSearchTracer", + Type: "string", + Comment: ``, }, }, diff --git a/node/config/types.go b/node/config/types.go index 05ea472f3..025a9c1af 100644 --- a/node/config/types.go +++ b/node/config/types.go @@ -310,6 +310,7 @@ type Pubsub struct { IPColocationWhitelist []string RemoteTracer string JsonTracerFile string + ElasticSearchTracer string } type Chainstore struct { diff --git a/node/modules/lp2p/pubsub.go b/node/modules/lp2p/pubsub.go index 6cf52fdf0..04f21c84f 100644 --- a/node/modules/lp2p/pubsub.go +++ b/node/modules/lp2p/pubsub.go @@ -375,6 +375,9 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) { jsonTransport := tracer.NewJsonTracerTransport(out) lt = tracer.NewLotusTracer(jsonTransport, in.Host.ID()) + } else if in.Cfg.ElasticSearchTracer != "" { + elasticSearchTransport := tracer.NewElasticSearchTransport() + lt = tracer.NewLotusTracer(elasticSearchTransport, in.Host.ID()) } // tracer diff --git a/node/modules/tracer/elasticsearch_transport.go b/node/modules/tracer/elasticsearch_transport.go new file mode 100644 index 000000000..2cba23478 --- /dev/null +++ b/node/modules/tracer/elasticsearch_transport.go @@ -0,0 +1,59 @@ +package tracer + +import ( + "context" + "encoding/json" + "fmt" + "strings" + + "github.com/elastic/go-elasticsearch/v7" + "github.com/elastic/go-elasticsearch/v7/esapi" + logging "github.com/ipfs/go-log/v2" +) + +var rpclog = logging.Logger("elasticsearch") + +func NewElasticSearchTransport() TracerTransport { + es, err := elasticsearch.NewDefaultClient() + + if err != nil { + rpclog.Fatalf("Error on creating elastic search client: %+v", err) + } + + return &elasticSearchTransport{ + cl: es, + } +} + +type elasticSearchTransport struct { + cl *elasticsearch.Client +} + +func (est *elasticSearchTransport) Transport(jsonEvent []byte) error { + req := esapi.IndexRequest{ + Index: "PeerScore", + DocumentID: "1", // todo + Body: strings.NewReader(string(jsonEvent)), + Refresh: "true", + } + + // Perform the request with the client. + res, err := req.Do(context.Background(), est.cl) + if err != nil { + return err + } + defer res.Body.Close() + + if res.IsError() { + return fmt.Errorf("[%s] Error indexing document ID=%s", res.Status(), req.DocumentID) + } else { + // Deserialize the response into a map. + var r map[string]interface{} + if err := json.NewDecoder(res.Body).Decode(&r); err != nil { + return err + } else { + rpclog.Infof("[%s] %s; version=%d", res.Status(), r["result"], int(r["_version"].(float64))) + } + } + return nil +} diff --git a/node/modules/tracer/tracer.go b/node/modules/tracer/tracer.go index af3a987b0..8c6250151 100644 --- a/node/modules/tracer/tracer.go +++ b/node/modules/tracer/tracer.go @@ -12,7 +12,7 @@ import ( var log = logging.Logger("lotus-tracer") -func NewLotusTracer(tt TracerTransport, pid peer.ID) LotusTracer { +func NewLotusTracer(tt []TracerTransport, pid peer.ID) LotusTracer { return &lotusTracer{ tt: tt, pid: pid, @@ -20,7 +20,7 @@ func NewLotusTracer(tt TracerTransport, pid peer.ID) LotusTracer { } type lotusTracer struct { - tt TracerTransport + tt []TracerTransport pid peer.ID } @@ -67,10 +67,13 @@ func (lt *lotusTracer) TraceLotusEvent(evt *LotusTraceEvent) { return } - err = lt.tt.Transport(jsonEvent) - if err != nil { - log.Errorf("error while transporting peer scores: %s", err) + for _, t := range lt.tt { + err = t.Transport(jsonEvent) + if err != nil { + log.Errorf("error while transporting peer scores: %s", err) + } } + } func (lt *lotusTracer) Trace(evt *pubsub_pb.TraceEvent) { @@ -80,8 +83,10 @@ func (lt *lotusTracer) Trace(evt *pubsub_pb.TraceEvent) { return } - err = lt.tt.Transport(jsonEvent) - if err != nil { - log.Errorf("error while transporting trace event: %s", err) + for _, t := range lt.tt { + err = t.Transport(jsonEvent) + if err != nil { + log.Errorf("error while transporting trace event: %s", err) + } } } From cf060965658c933290ddeea205effb97bb54c0ca Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Wed, 15 Sep 2021 14:54:20 +0200 Subject: [PATCH 11/76] Fix tracer initialization --- node/modules/lp2p/pubsub.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/node/modules/lp2p/pubsub.go b/node/modules/lp2p/pubsub.go index 04f21c84f..c9755a680 100644 --- a/node/modules/lp2p/pubsub.go +++ b/node/modules/lp2p/pubsub.go @@ -366,19 +366,19 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) { pubsub.NewAllowlistSubscriptionFilter(allowTopics...), 100))) - var lt tracer.LotusTracer + var transports []tracer.TracerTransport if in.Cfg.JsonTracerFile != "" { out, err := os.OpenFile(in.Cfg.JsonTracerFile, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0660) if err != nil { return nil, err } - jsonTransport := tracer.NewJsonTracerTransport(out) - lt = tracer.NewLotusTracer(jsonTransport, in.Host.ID()) + transports = append(transports, jsonTransport) } else if in.Cfg.ElasticSearchTracer != "" { elasticSearchTransport := tracer.NewElasticSearchTransport() - lt = tracer.NewLotusTracer(elasticSearchTransport, in.Host.ID()) + transports = append(transports, elasticSearchTransport) } + lt := tracer.NewLotusTracer(transports, in.Host.ID()) // tracer if in.Cfg.RemoteTracer != "" { From e20cd0ef27c6abb0f8135c801796d128d81c657c Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Wed, 15 Sep 2021 14:58:36 +0200 Subject: [PATCH 12/76] Propagate error on creating transport --- node/modules/lp2p/pubsub.go | 5 ++++- node/modules/tracer/elasticsearch_transport.go | 6 +++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/node/modules/lp2p/pubsub.go b/node/modules/lp2p/pubsub.go index c9755a680..7f2a4d678 100644 --- a/node/modules/lp2p/pubsub.go +++ b/node/modules/lp2p/pubsub.go @@ -375,7 +375,10 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) { jsonTransport := tracer.NewJsonTracerTransport(out) transports = append(transports, jsonTransport) } else if in.Cfg.ElasticSearchTracer != "" { - elasticSearchTransport := tracer.NewElasticSearchTransport() + elasticSearchTransport, err := tracer.NewElasticSearchTransport() + if err != nil { + return nil, err + } transports = append(transports, elasticSearchTransport) } lt := tracer.NewLotusTracer(transports, in.Host.ID()) diff --git a/node/modules/tracer/elasticsearch_transport.go b/node/modules/tracer/elasticsearch_transport.go index 2cba23478..f45dd9ef5 100644 --- a/node/modules/tracer/elasticsearch_transport.go +++ b/node/modules/tracer/elasticsearch_transport.go @@ -13,16 +13,16 @@ import ( var rpclog = logging.Logger("elasticsearch") -func NewElasticSearchTransport() TracerTransport { +func NewElasticSearchTransport() (TracerTransport, error) { es, err := elasticsearch.NewDefaultClient() if err != nil { - rpclog.Fatalf("Error on creating elastic search client: %+v", err) + return nil, err } return &elasticSearchTransport{ cl: es, - } + }, nil } type elasticSearchTransport struct { From 707faf57b54967a384bf46196b79ff8ec80c79b1 Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Wed, 15 Sep 2021 15:11:34 +0200 Subject: [PATCH 13/76] Code cleanup --- node/modules/lp2p/pubsub.go | 4 +++- node/modules/tracer/elasticsearch_transport.go | 9 ++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/node/modules/lp2p/pubsub.go b/node/modules/lp2p/pubsub.go index 7f2a4d678..6656abf01 100644 --- a/node/modules/lp2p/pubsub.go +++ b/node/modules/lp2p/pubsub.go @@ -374,7 +374,9 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) { } jsonTransport := tracer.NewJsonTracerTransport(out) transports = append(transports, jsonTransport) - } else if in.Cfg.ElasticSearchTracer != "" { + } + + if in.Cfg.ElasticSearchTracer != "" { elasticSearchTransport, err := tracer.NewElasticSearchTransport() if err != nil { return nil, err diff --git a/node/modules/tracer/elasticsearch_transport.go b/node/modules/tracer/elasticsearch_transport.go index f45dd9ef5..8e214a4e9 100644 --- a/node/modules/tracer/elasticsearch_transport.go +++ b/node/modules/tracer/elasticsearch_transport.go @@ -8,10 +8,11 @@ import ( "github.com/elastic/go-elasticsearch/v7" "github.com/elastic/go-elasticsearch/v7/esapi" - logging "github.com/ipfs/go-log/v2" ) -var rpclog = logging.Logger("elasticsearch") +const ( + ElasticSearch_INDEX = "pubsub" +) func NewElasticSearchTransport() (TracerTransport, error) { es, err := elasticsearch.NewDefaultClient() @@ -31,7 +32,7 @@ type elasticSearchTransport struct { func (est *elasticSearchTransport) Transport(jsonEvent []byte) error { req := esapi.IndexRequest{ - Index: "PeerScore", + Index: ElasticSearch_INDEX, DocumentID: "1", // todo Body: strings.NewReader(string(jsonEvent)), Refresh: "true", @@ -51,8 +52,6 @@ func (est *elasticSearchTransport) Transport(jsonEvent []byte) error { var r map[string]interface{} if err := json.NewDecoder(res.Body).Decode(&r); err != nil { return err - } else { - rpclog.Infof("[%s] %s; version=%d", res.Status(), r["result"], int(r["_version"].(float64))) } } return nil From 71a2ca9e7cd96b277a6c29049283645d235fe2e4 Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Wed, 15 Sep 2021 16:03:51 +0200 Subject: [PATCH 14/76] Add new wrapper structure in tracer transport --- .../modules/tracer/elasticsearch_transport.go | 24 +++++++++++++++++-- node/modules/tracer/json_transport.go | 20 ++++++++++++++-- node/modules/tracer/tracer.go | 23 +++++++----------- node/modules/tracer/transport.go | 9 ++++++- 4 files changed, 56 insertions(+), 20 deletions(-) diff --git a/node/modules/tracer/elasticsearch_transport.go b/node/modules/tracer/elasticsearch_transport.go index 8e214a4e9..f9cf621eb 100644 --- a/node/modules/tracer/elasticsearch_transport.go +++ b/node/modules/tracer/elasticsearch_transport.go @@ -12,6 +12,9 @@ import ( const ( ElasticSearch_INDEX = "pubsub" + + ElasticSearch_DOC_LOTUS = "doc_lotus" + ElasticSearch_DOC_PUBSUB = "doc_pubsub" ) func NewElasticSearchTransport() (TracerTransport, error) { @@ -30,10 +33,27 @@ type elasticSearchTransport struct { cl *elasticsearch.Client } -func (est *elasticSearchTransport) Transport(jsonEvent []byte) error { +func (est *elasticSearchTransport) Transport(event TracerTransportEvent) error { + var e interface{} + var docId string + if event.lotusTraceEvent != nil { + e = *event.lotusTraceEvent + docId = ElasticSearch_DOC_LOTUS + } else if event.pubsubTraceEvent != nil { + e = *event.pubsubTraceEvent + docId = ElasticSearch_DOC_PUBSUB + } else { + return nil + } + + jsonEvent, err := json.Marshal(e) + if err != nil { + return fmt.Errorf("error while marshaling peer score: %s", err) + } + req := esapi.IndexRequest{ Index: ElasticSearch_INDEX, - DocumentID: "1", // todo + DocumentID: docId, Body: strings.NewReader(string(jsonEvent)), Refresh: "true", } diff --git a/node/modules/tracer/json_transport.go b/node/modules/tracer/json_transport.go index 2ab004d9c..128c37473 100644 --- a/node/modules/tracer/json_transport.go +++ b/node/modules/tracer/json_transport.go @@ -1,6 +1,8 @@ package tracer import ( + "encoding/json" + "fmt" "os" ) @@ -14,7 +16,21 @@ func NewJsonTracerTransport(out *os.File) TracerTransport { } } -func (jtt *jsonTracerTransport) Transport(jsonEvent []byte) error { - _, err := jtt.out.Write(jsonEvent) +func (jtt *jsonTracerTransport) Transport(event TracerTransportEvent) error { + var e interface{} + if event.lotusTraceEvent != nil { + e = *event.lotusTraceEvent + } else if event.pubsubTraceEvent != nil { + e = *event.pubsubTraceEvent + } else { + return nil + } + + jsonEvent, err := json.Marshal(e) + if err != nil { + return fmt.Errorf("error while marshaling event: %s", err) + } + + _, err = jtt.out.Write(jsonEvent) return err } diff --git a/node/modules/tracer/tracer.go b/node/modules/tracer/tracer.go index 8c6250151..ad5f5c6b7 100644 --- a/node/modules/tracer/tracer.go +++ b/node/modules/tracer/tracer.go @@ -1,7 +1,6 @@ package tracer import ( - "encoding/json" "time" logging "github.com/ipfs/go-log/v2" @@ -61,14 +60,11 @@ func (lt *lotusTracer) PeerScores(scores map[peer.ID]*pubsub.PeerScoreSnapshot) } func (lt *lotusTracer) TraceLotusEvent(evt *LotusTraceEvent) { - jsonEvent, err := json.Marshal(evt) - if err != nil { - log.Errorf("error while marshaling peer score: %s", err) - return - } - for _, t := range lt.tt { - err = t.Transport(jsonEvent) + err := t.Transport(TracerTransportEvent{ + lotusTraceEvent: evt, + pubsubTraceEvent: nil, + }) if err != nil { log.Errorf("error while transporting peer scores: %s", err) } @@ -77,14 +73,11 @@ func (lt *lotusTracer) TraceLotusEvent(evt *LotusTraceEvent) { } func (lt *lotusTracer) Trace(evt *pubsub_pb.TraceEvent) { - jsonEvent, err := json.Marshal(evt) - if err != nil { - log.Errorf("error while marshaling tracer event: %s", err) - return - } - for _, t := range lt.tt { - err = t.Transport(jsonEvent) + err := t.Transport(TracerTransportEvent{ + lotusTraceEvent: nil, + pubsubTraceEvent: evt, + }) if err != nil { log.Errorf("error while transporting trace event: %s", err) } diff --git a/node/modules/tracer/transport.go b/node/modules/tracer/transport.go index c8495821e..e67867fd7 100644 --- a/node/modules/tracer/transport.go +++ b/node/modules/tracer/transport.go @@ -1,5 +1,12 @@ package tracer +import pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb" + type TracerTransport interface { - Transport(jsonEvent []byte) error + Transport(jsonEvent TracerTransportEvent) error +} + +type TracerTransportEvent struct { + lotusTraceEvent *LotusTraceEvent + pubsubTraceEvent *pubsub_pb.TraceEvent } From add13c2646cbbe4157fe7a86d0aae26e3d056c3a Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Wed, 15 Sep 2021 16:05:44 +0200 Subject: [PATCH 15/76] Code cleanup --- node/modules/lp2p/pubsub.go | 1 - node/modules/tracer/elasticsearch_transport.go | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/node/modules/lp2p/pubsub.go b/node/modules/lp2p/pubsub.go index 6656abf01..905643ed0 100644 --- a/node/modules/lp2p/pubsub.go +++ b/node/modules/lp2p/pubsub.go @@ -375,7 +375,6 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) { jsonTransport := tracer.NewJsonTracerTransport(out) transports = append(transports, jsonTransport) } - if in.Cfg.ElasticSearchTracer != "" { elasticSearchTransport, err := tracer.NewElasticSearchTransport() if err != nil { diff --git a/node/modules/tracer/elasticsearch_transport.go b/node/modules/tracer/elasticsearch_transport.go index f9cf621eb..4fe8149be 100644 --- a/node/modules/tracer/elasticsearch_transport.go +++ b/node/modules/tracer/elasticsearch_transport.go @@ -48,7 +48,7 @@ func (est *elasticSearchTransport) Transport(event TracerTransportEvent) error { jsonEvent, err := json.Marshal(e) if err != nil { - return fmt.Errorf("error while marshaling peer score: %s", err) + return fmt.Errorf("error while marshaling event: %s", err) } req := esapi.IndexRequest{ From 67c1d633c68a77baff415af5560444be93914122 Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Wed, 15 Sep 2021 16:16:12 +0200 Subject: [PATCH 16/76] Rename jsonEvent to evt --- node/modules/tracer/elasticsearch_transport.go | 14 +++++++------- node/modules/tracer/json_transport.go | 14 +++++++------- node/modules/tracer/transport.go | 2 +- 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/node/modules/tracer/elasticsearch_transport.go b/node/modules/tracer/elasticsearch_transport.go index 4fe8149be..c2cfdb87a 100644 --- a/node/modules/tracer/elasticsearch_transport.go +++ b/node/modules/tracer/elasticsearch_transport.go @@ -33,20 +33,20 @@ type elasticSearchTransport struct { cl *elasticsearch.Client } -func (est *elasticSearchTransport) Transport(event TracerTransportEvent) error { +func (est *elasticSearchTransport) Transport(evt TracerTransportEvent) error { var e interface{} var docId string - if event.lotusTraceEvent != nil { - e = *event.lotusTraceEvent + if evt.lotusTraceEvent != nil { + e = *evt.lotusTraceEvent docId = ElasticSearch_DOC_LOTUS - } else if event.pubsubTraceEvent != nil { - e = *event.pubsubTraceEvent + } else if evt.pubsubTraceEvent != nil { + e = *evt.pubsubTraceEvent docId = ElasticSearch_DOC_PUBSUB } else { return nil } - jsonEvent, err := json.Marshal(e) + jsonEvt, err := json.Marshal(e) if err != nil { return fmt.Errorf("error while marshaling event: %s", err) } @@ -54,7 +54,7 @@ func (est *elasticSearchTransport) Transport(event TracerTransportEvent) error { req := esapi.IndexRequest{ Index: ElasticSearch_INDEX, DocumentID: docId, - Body: strings.NewReader(string(jsonEvent)), + Body: strings.NewReader(string(jsonEvt)), Refresh: "true", } diff --git a/node/modules/tracer/json_transport.go b/node/modules/tracer/json_transport.go index 128c37473..26537a600 100644 --- a/node/modules/tracer/json_transport.go +++ b/node/modules/tracer/json_transport.go @@ -16,21 +16,21 @@ func NewJsonTracerTransport(out *os.File) TracerTransport { } } -func (jtt *jsonTracerTransport) Transport(event TracerTransportEvent) error { +func (jtt *jsonTracerTransport) Transport(evt TracerTransportEvent) error { var e interface{} - if event.lotusTraceEvent != nil { - e = *event.lotusTraceEvent - } else if event.pubsubTraceEvent != nil { - e = *event.pubsubTraceEvent + if evt.lotusTraceEvent != nil { + e = *evt.lotusTraceEvent + } else if evt.pubsubTraceEvent != nil { + e = *evt.pubsubTraceEvent } else { return nil } - jsonEvent, err := json.Marshal(e) + jsonEvt, err := json.Marshal(e) if err != nil { return fmt.Errorf("error while marshaling event: %s", err) } - _, err = jtt.out.Write(jsonEvent) + _, err = jtt.out.Write(jsonEvt) return err } diff --git a/node/modules/tracer/transport.go b/node/modules/tracer/transport.go index e67867fd7..56d926afc 100644 --- a/node/modules/tracer/transport.go +++ b/node/modules/tracer/transport.go @@ -3,7 +3,7 @@ package tracer import pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb" type TracerTransport interface { - Transport(jsonEvent TracerTransportEvent) error + Transport(evt TracerTransportEvent) error } type TracerTransportEvent struct { From 5cbd2519daf3fc0560317c249d7c031b6d52085c Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Wed, 15 Sep 2021 16:20:36 +0200 Subject: [PATCH 17/76] Remove processing elasticsearch result --- node/modules/tracer/elasticsearch_transport.go | 6 ------ 1 file changed, 6 deletions(-) diff --git a/node/modules/tracer/elasticsearch_transport.go b/node/modules/tracer/elasticsearch_transport.go index c2cfdb87a..3bf86ee29 100644 --- a/node/modules/tracer/elasticsearch_transport.go +++ b/node/modules/tracer/elasticsearch_transport.go @@ -67,12 +67,6 @@ func (est *elasticSearchTransport) Transport(evt TracerTransportEvent) error { if res.IsError() { return fmt.Errorf("[%s] Error indexing document ID=%s", res.Status(), req.DocumentID) - } else { - // Deserialize the response into a map. - var r map[string]interface{} - if err := json.NewDecoder(res.Body).Decode(&r); err != nil { - return err - } } return nil } From c25a5e06cf5f3b84699bf187bd9129f9ea65e29a Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Thu, 16 Sep 2021 12:15:42 +0200 Subject: [PATCH 18/76] Use config string for elasticsearch client --- node/modules/lp2p/pubsub.go | 4 +++- node/modules/tracer/elasticsearch_transport.go | 17 +++++++++++++++-- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/node/modules/lp2p/pubsub.go b/node/modules/lp2p/pubsub.go index 905643ed0..d12a3fa1c 100644 --- a/node/modules/lp2p/pubsub.go +++ b/node/modules/lp2p/pubsub.go @@ -376,7 +376,9 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) { transports = append(transports, jsonTransport) } if in.Cfg.ElasticSearchTracer != "" { - elasticSearchTransport, err := tracer.NewElasticSearchTransport() + elasticSearchTransport, err := tracer.NewElasticSearchTransport( + in.Cfg.ElasticSearchTracer, + ) if err != nil { return nil, err } diff --git a/node/modules/tracer/elasticsearch_transport.go b/node/modules/tracer/elasticsearch_transport.go index 3bf86ee29..45ddd36aa 100644 --- a/node/modules/tracer/elasticsearch_transport.go +++ b/node/modules/tracer/elasticsearch_transport.go @@ -4,6 +4,7 @@ import ( "context" "encoding/json" "fmt" + "net/url" "strings" "github.com/elastic/go-elasticsearch/v7" @@ -17,8 +18,20 @@ const ( ElasticSearch_DOC_PUBSUB = "doc_pubsub" ) -func NewElasticSearchTransport() (TracerTransport, error) { - es, err := elasticsearch.NewDefaultClient() +func NewElasticSearchTransport(connectionString string) (TracerTransport, error) { + conUrl, err := url.Parse(connectionString) + + username := conUrl.User.Username() + password, _ := conUrl.User.Password() + cfg := elasticsearch.Config{ + Addresses: []string{ + "https://" + conUrl.Host, + }, + Username: username, + Password: password, + } + + es, err := elasticsearch.NewClient(cfg) if err != nil { return nil, err From e2206147cc6dc6346dd11aadbee7226f04792c65 Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Thu, 16 Sep 2021 11:51:59 +0200 Subject: [PATCH 19/76] Add source auth token to lotus traces --- node/config/types.go | 1 + node/modules/lp2p/pubsub.go | 2 +- node/modules/tracer/tracer.go | 12 ++++++++---- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/node/config/types.go b/node/config/types.go index 025a9c1af..aa061baef 100644 --- a/node/config/types.go +++ b/node/config/types.go @@ -311,6 +311,7 @@ type Pubsub struct { RemoteTracer string JsonTracerFile string ElasticSearchTracer string + TracerSourceAuth string } type Chainstore struct { diff --git a/node/modules/lp2p/pubsub.go b/node/modules/lp2p/pubsub.go index d12a3fa1c..aa391a42b 100644 --- a/node/modules/lp2p/pubsub.go +++ b/node/modules/lp2p/pubsub.go @@ -384,7 +384,7 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) { } transports = append(transports, elasticSearchTransport) } - lt := tracer.NewLotusTracer(transports, in.Host.ID()) + lt := tracer.NewLotusTracer(transports, in.Host.ID(), in.Cfg.TracerSourceAuth) // tracer if in.Cfg.RemoteTracer != "" { diff --git a/node/modules/tracer/tracer.go b/node/modules/tracer/tracer.go index ad5f5c6b7..69967565a 100644 --- a/node/modules/tracer/tracer.go +++ b/node/modules/tracer/tracer.go @@ -11,16 +11,18 @@ import ( var log = logging.Logger("lotus-tracer") -func NewLotusTracer(tt []TracerTransport, pid peer.ID) LotusTracer { +func NewLotusTracer(tt []TracerTransport, pid peer.ID, sourceAuth string) LotusTracer { return &lotusTracer{ tt: tt, pid: pid, + sa: sourceAuth, } } type lotusTracer struct { tt []TracerTransport pid peer.ID + sa string } const ( @@ -32,6 +34,7 @@ type LotusTraceEvent struct { PeerID []byte `json:"peerID,omitempty"` Timestamp *int64 `json:"timestamp,omitempty"` PeerScores *TraceEvent_PeerScores `json:"peerScores,omitempty"` + SourceAuth string `json:"sourceAuth,omitempty"` } type TraceEvent_PeerScores struct { @@ -48,9 +51,10 @@ type LotusTracer interface { func (lt *lotusTracer) PeerScores(scores map[peer.ID]*pubsub.PeerScoreSnapshot) { now := time.Now().UnixNano() evt := &LotusTraceEvent{ - Type: *TraceEvent_PEER_SCORES.Enum(), - PeerID: []byte(lt.pid), - Timestamp: &now, + Type: *TraceEvent_PEER_SCORES.Enum(), + PeerID: []byte(lt.pid), + Timestamp: &now, + SourceAuth: lt.sa, PeerScores: &TraceEvent_PeerScores{ Scores: scores, }, From d067bc9f0109ad17a9ea368d89e6045f8969f50b Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Thu, 16 Sep 2021 15:22:18 +0200 Subject: [PATCH 20/76] Move creating and opening file to json transport constructor --- node/modules/lp2p/pubsub.go | 5 ++--- node/modules/tracer/json_transport.go | 9 +++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/node/modules/lp2p/pubsub.go b/node/modules/lp2p/pubsub.go index d12a3fa1c..0a3f5e042 100644 --- a/node/modules/lp2p/pubsub.go +++ b/node/modules/lp2p/pubsub.go @@ -4,7 +4,6 @@ import ( "context" "encoding/json" "net" - "os" "time" host "github.com/libp2p/go-libp2p-core/host" @@ -368,11 +367,11 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) { var transports []tracer.TracerTransport if in.Cfg.JsonTracerFile != "" { - out, err := os.OpenFile(in.Cfg.JsonTracerFile, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0660) + jsonTransport, err := tracer.NewJsonTracerTransport(in.Cfg.JsonTracerFile) if err != nil { return nil, err } - jsonTransport := tracer.NewJsonTracerTransport(out) + transports = append(transports, jsonTransport) } if in.Cfg.ElasticSearchTracer != "" { diff --git a/node/modules/tracer/json_transport.go b/node/modules/tracer/json_transport.go index 26537a600..1d5e81f30 100644 --- a/node/modules/tracer/json_transport.go +++ b/node/modules/tracer/json_transport.go @@ -10,10 +10,15 @@ type jsonTracerTransport struct { out *os.File } -func NewJsonTracerTransport(out *os.File) TracerTransport { +func NewJsonTracerTransport(file string) (TracerTransport, error) { + out, err := os.OpenFile(file, os.O_CREATE|os.O_APPEND|os.O_WRONLY, 0660) + if err != nil { + return nil, err + } + return &jsonTracerTransport{ out: out, - } + }, nil } func (jtt *jsonTracerTransport) Transport(evt TracerTransportEvent) error { From 9cdc5261c44050acd7aab47418a74b48a70bccd3 Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Thu, 16 Sep 2021 15:53:39 +0200 Subject: [PATCH 21/76] Fix lotus tracer being nil when remote tracer is not configured --- node/modules/lp2p/pubsub.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/modules/lp2p/pubsub.go b/node/modules/lp2p/pubsub.go index 0a3f5e042..a071b36a5 100644 --- a/node/modules/lp2p/pubsub.go +++ b/node/modules/lp2p/pubsub.go @@ -409,7 +409,7 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) { options = append(options, pubsub.WithPeerScoreInspect(pst.UpdatePeerScore, 10*time.Second)) } else { // still instantiate a tracer for collecting metrics - trw := newTracerWrapper(nil, nil) + trw := newTracerWrapper(nil, lt) options = append(options, pubsub.WithEventTracer(trw)) pst := newPeerScoreTracker(nil, in.Sk) From 941a0f715327a341accc371cd727a3eeee42a2d2 Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Thu, 16 Sep 2021 16:31:36 +0200 Subject: [PATCH 22/76] Update peer score tracker creation to include lotus tracer --- node/modules/lp2p/pubsub.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/modules/lp2p/pubsub.go b/node/modules/lp2p/pubsub.go index a071b36a5..25ee4963f 100644 --- a/node/modules/lp2p/pubsub.go +++ b/node/modules/lp2p/pubsub.go @@ -412,7 +412,7 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) { trw := newTracerWrapper(nil, lt) options = append(options, pubsub.WithEventTracer(trw)) - pst := newPeerScoreTracker(nil, in.Sk) + pst := newPeerScoreTracker(lt, in.Sk) options = append(options, pubsub.WithPeerScoreInspect(pst.UpdatePeerScore, 10*time.Second)) } From 9efa495b0ebbdbb82f0e6047a352b7c5b3c5cc9b Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Thu, 16 Sep 2021 16:42:18 +0200 Subject: [PATCH 23/76] Write every trace to new line when using json transport --- node/modules/tracer/json_transport.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/modules/tracer/json_transport.go b/node/modules/tracer/json_transport.go index 1d5e81f30..ca8535f4b 100644 --- a/node/modules/tracer/json_transport.go +++ b/node/modules/tracer/json_transport.go @@ -36,6 +36,6 @@ func (jtt *jsonTracerTransport) Transport(evt TracerTransportEvent) error { return fmt.Errorf("error while marshaling event: %s", err) } - _, err = jtt.out.Write(jsonEvt) + _, err = jtt.out.WriteString(string(jsonEvt) + "\n") return err } From 8e2b474fc774a92f815c93df513d9770ebdec5b3 Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Thu, 16 Sep 2021 16:44:35 +0200 Subject: [PATCH 24/76] Use only one document on elastic --- node/modules/tracer/elasticsearch_transport.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/modules/tracer/elasticsearch_transport.go b/node/modules/tracer/elasticsearch_transport.go index 45ddd36aa..f57ce85de 100644 --- a/node/modules/tracer/elasticsearch_transport.go +++ b/node/modules/tracer/elasticsearch_transport.go @@ -54,7 +54,7 @@ func (est *elasticSearchTransport) Transport(evt TracerTransportEvent) error { docId = ElasticSearch_DOC_LOTUS } else if evt.pubsubTraceEvent != nil { e = *evt.pubsubTraceEvent - docId = ElasticSearch_DOC_PUBSUB + docId = ElasticSearch_DOC_LOTUS } else { return nil } From f09f5c2d1144bbceef2f013ad23325bdc080dd8a Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Thu, 16 Sep 2021 16:49:47 +0200 Subject: [PATCH 25/76] Change elastic document name --- node/modules/tracer/elasticsearch_transport.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node/modules/tracer/elasticsearch_transport.go b/node/modules/tracer/elasticsearch_transport.go index f57ce85de..612080ef8 100644 --- a/node/modules/tracer/elasticsearch_transport.go +++ b/node/modules/tracer/elasticsearch_transport.go @@ -51,10 +51,10 @@ func (est *elasticSearchTransport) Transport(evt TracerTransportEvent) error { var docId string if evt.lotusTraceEvent != nil { e = *evt.lotusTraceEvent - docId = ElasticSearch_DOC_LOTUS + docId = ElasticSearch_DOC_PUBSUB } else if evt.pubsubTraceEvent != nil { e = *evt.pubsubTraceEvent - docId = ElasticSearch_DOC_LOTUS + docId = ElasticSearch_DOC_PUBSUB } else { return nil } From dc79ea363d0b8803a405847bc9ef611bf4a4c01a Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Fri, 17 Sep 2021 11:35:36 +0200 Subject: [PATCH 26/76] Change index name --- node/modules/tracer/elasticsearch_transport.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/modules/tracer/elasticsearch_transport.go b/node/modules/tracer/elasticsearch_transport.go index 612080ef8..3f9a47e67 100644 --- a/node/modules/tracer/elasticsearch_transport.go +++ b/node/modules/tracer/elasticsearch_transport.go @@ -12,7 +12,7 @@ import ( ) const ( - ElasticSearch_INDEX = "pubsub" + ElasticSearch_INDEX = "lotus" ElasticSearch_DOC_LOTUS = "doc_lotus" ElasticSearch_DOC_PUBSUB = "doc_pubsub" From a91ffa60d67f8b3fe1f90460e5a3f70ba1e2bb4f Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Fri, 17 Sep 2021 12:11:14 +0200 Subject: [PATCH 27/76] Set peer id event as string in lotus trace event --- node/modules/tracer/tracer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node/modules/tracer/tracer.go b/node/modules/tracer/tracer.go index ad5f5c6b7..7d8d9e2c4 100644 --- a/node/modules/tracer/tracer.go +++ b/node/modules/tracer/tracer.go @@ -29,7 +29,7 @@ const ( type LotusTraceEvent struct { Type pubsub_pb.TraceEvent_Type `json:"type,omitempty"` - PeerID []byte `json:"peerID,omitempty"` + PeerID string `json:"peerID,omitempty"` Timestamp *int64 `json:"timestamp,omitempty"` PeerScores *TraceEvent_PeerScores `json:"peerScores,omitempty"` } @@ -49,7 +49,7 @@ func (lt *lotusTracer) PeerScores(scores map[peer.ID]*pubsub.PeerScoreSnapshot) now := time.Now().UnixNano() evt := &LotusTraceEvent{ Type: *TraceEvent_PEER_SCORES.Enum(), - PeerID: []byte(lt.pid), + PeerID: string(lt.pid), Timestamp: &now, PeerScores: &TraceEvent_PeerScores{ Scores: scores, From 7d0aefacbb9216221fb9d3d7ee1b863a452579b7 Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Fri, 17 Sep 2021 13:46:26 +0200 Subject: [PATCH 28/76] Change peer score event type to avoid exceeding elastisearch field limit --- node/modules/tracer/tracer.go | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/node/modules/tracer/tracer.go b/node/modules/tracer/tracer.go index 7d8d9e2c4..4367e8fda 100644 --- a/node/modules/tracer/tracer.go +++ b/node/modules/tracer/tracer.go @@ -31,11 +31,12 @@ type LotusTraceEvent struct { Type pubsub_pb.TraceEvent_Type `json:"type,omitempty"` PeerID string `json:"peerID,omitempty"` Timestamp *int64 `json:"timestamp,omitempty"` - PeerScores *TraceEvent_PeerScores `json:"peerScores,omitempty"` + PeerScores []TraceEvent_PeerScore `json:"peerScores,omitempty"` } -type TraceEvent_PeerScores struct { - Scores map[peer.ID]*pubsub.PeerScoreSnapshot `json:"scores,omitempty"` +type TraceEvent_PeerScore struct { + PeerID string `json:"peerID"` + Score float32 `json:"score"` } type LotusTracer interface { @@ -46,14 +47,17 @@ type LotusTracer interface { } func (lt *lotusTracer) PeerScores(scores map[peer.ID]*pubsub.PeerScoreSnapshot) { + var peerScores []TraceEvent_PeerScore + for pid, score := range scores { + peerScores = append(peerScores, TraceEvent_PeerScore{PeerID: pid.Pretty(), Score: float32(score.Score)}) + } + now := time.Now().UnixNano() evt := &LotusTraceEvent{ - Type: *TraceEvent_PEER_SCORES.Enum(), - PeerID: string(lt.pid), - Timestamp: &now, - PeerScores: &TraceEvent_PeerScores{ - Scores: scores, - }, + Type: *TraceEvent_PEER_SCORES.Enum(), + PeerID: string(lt.pid), + Timestamp: &now, + PeerScores: peerScores, } lt.TraceLotusEvent(evt) From 0962e73e3e8a0ddb506ef044030014229c147555 Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Fri, 17 Sep 2021 14:22:57 +0200 Subject: [PATCH 29/76] Add loger to elastic search client --- node/modules/tracer/elasticsearch_transport.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/node/modules/tracer/elasticsearch_transport.go b/node/modules/tracer/elasticsearch_transport.go index 3f9a47e67..a1c271afc 100644 --- a/node/modules/tracer/elasticsearch_transport.go +++ b/node/modules/tracer/elasticsearch_transport.go @@ -5,14 +5,16 @@ import ( "encoding/json" "fmt" "net/url" + "os" "strings" "github.com/elastic/go-elasticsearch/v7" "github.com/elastic/go-elasticsearch/v7/esapi" + "github.com/elastic/go-elasticsearch/v7/estransport" ) const ( - ElasticSearch_INDEX = "lotus" + ElasticSearch_INDEX = "lotus2" ElasticSearch_DOC_LOTUS = "doc_lotus" ElasticSearch_DOC_PUBSUB = "doc_pubsub" @@ -29,6 +31,11 @@ func NewElasticSearchTransport(connectionString string) (TracerTransport, error) }, Username: username, Password: password, + Logger: &estransport.CurlLogger{ + Output: os.Stdout, + EnableRequestBody: true, + EnableResponseBody: true, + }, } es, err := elasticsearch.NewClient(cfg) From a685ccc9555b52c62a0ffec8f448dfbc46426adb Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Fri, 17 Sep 2021 15:14:39 +0200 Subject: [PATCH 30/76] Remove document id --- node/modules/tracer/elasticsearch_transport.go | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/node/modules/tracer/elasticsearch_transport.go b/node/modules/tracer/elasticsearch_transport.go index a1c271afc..4709ef756 100644 --- a/node/modules/tracer/elasticsearch_transport.go +++ b/node/modules/tracer/elasticsearch_transport.go @@ -14,10 +14,7 @@ import ( ) const ( - ElasticSearch_INDEX = "lotus2" - - ElasticSearch_DOC_LOTUS = "doc_lotus" - ElasticSearch_DOC_PUBSUB = "doc_pubsub" + ElasticSearch_INDEX = "lotus-pubsub" ) func NewElasticSearchTransport(connectionString string) (TracerTransport, error) { @@ -55,13 +52,11 @@ type elasticSearchTransport struct { func (est *elasticSearchTransport) Transport(evt TracerTransportEvent) error { var e interface{} - var docId string + if evt.lotusTraceEvent != nil { e = *evt.lotusTraceEvent - docId = ElasticSearch_DOC_PUBSUB } else if evt.pubsubTraceEvent != nil { e = *evt.pubsubTraceEvent - docId = ElasticSearch_DOC_PUBSUB } else { return nil } @@ -72,10 +67,9 @@ func (est *elasticSearchTransport) Transport(evt TracerTransportEvent) error { } req := esapi.IndexRequest{ - Index: ElasticSearch_INDEX, - DocumentID: docId, - Body: strings.NewReader(string(jsonEvt)), - Refresh: "true", + Index: ElasticSearch_INDEX, + Body: strings.NewReader(string(jsonEvt)), + Refresh: "true", } // Perform the request with the client. From 082f70757c485827552c9731a85c796673de7735 Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Mon, 20 Sep 2021 12:29:12 +0200 Subject: [PATCH 31/76] Revert additional logging in elastic client --- node/modules/tracer/elasticsearch_transport.go | 7 ------- 1 file changed, 7 deletions(-) diff --git a/node/modules/tracer/elasticsearch_transport.go b/node/modules/tracer/elasticsearch_transport.go index 4709ef756..8823b8199 100644 --- a/node/modules/tracer/elasticsearch_transport.go +++ b/node/modules/tracer/elasticsearch_transport.go @@ -5,12 +5,10 @@ import ( "encoding/json" "fmt" "net/url" - "os" "strings" "github.com/elastic/go-elasticsearch/v7" "github.com/elastic/go-elasticsearch/v7/esapi" - "github.com/elastic/go-elasticsearch/v7/estransport" ) const ( @@ -28,11 +26,6 @@ func NewElasticSearchTransport(connectionString string) (TracerTransport, error) }, Username: username, Password: password, - Logger: &estransport.CurlLogger{ - Output: os.Stdout, - EnableRequestBody: true, - EnableResponseBody: true, - }, } es, err := elasticsearch.NewClient(cfg) From d65d9aa6e0a25fe5df8d955e2cd79a07fbd44932 Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Tue, 21 Sep 2021 12:30:50 +0200 Subject: [PATCH 32/76] Send peerID peer score as separate events to enable usage of kibana runtime fields --- node/modules/tracer/tracer.go | 29 +++++++++++++---------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/node/modules/tracer/tracer.go b/node/modules/tracer/tracer.go index 4367e8fda..01ed1196a 100644 --- a/node/modules/tracer/tracer.go +++ b/node/modules/tracer/tracer.go @@ -28,10 +28,10 @@ const ( ) type LotusTraceEvent struct { - Type pubsub_pb.TraceEvent_Type `json:"type,omitempty"` - PeerID string `json:"peerID,omitempty"` - Timestamp *int64 `json:"timestamp,omitempty"` - PeerScores []TraceEvent_PeerScore `json:"peerScores,omitempty"` + Type pubsub_pb.TraceEvent_Type `json:"type,omitempty"` + PeerID string `json:"peerID,omitempty"` + Timestamp *int64 `json:"timestamp,omitempty"` + PeerScore TraceEvent_PeerScore `json:"peerScore,omitempty"` } type TraceEvent_PeerScore struct { @@ -47,20 +47,17 @@ type LotusTracer interface { } func (lt *lotusTracer) PeerScores(scores map[peer.ID]*pubsub.PeerScoreSnapshot) { - var peerScores []TraceEvent_PeerScore - for pid, score := range scores { - peerScores = append(peerScores, TraceEvent_PeerScore{PeerID: pid.Pretty(), Score: float32(score.Score)}) - } - now := time.Now().UnixNano() - evt := &LotusTraceEvent{ - Type: *TraceEvent_PEER_SCORES.Enum(), - PeerID: string(lt.pid), - Timestamp: &now, - PeerScores: peerScores, - } + for pid, score := range scores { + evt := &LotusTraceEvent{ + Type: *TraceEvent_PEER_SCORES.Enum(), + PeerID: lt.pid.Pretty(), + Timestamp: &now, + PeerScore: TraceEvent_PeerScore{PeerID: pid.Pretty(), Score: float32(score.Score)}, + } - lt.TraceLotusEvent(evt) + lt.TraceLotusEvent(evt) + } } func (lt *lotusTracer) TraceLotusEvent(evt *LotusTraceEvent) { From e46da5a1812efd54723eae3949bd40cb2dba9731 Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Fri, 24 Sep 2021 12:37:16 +0200 Subject: [PATCH 33/76] Add cli flags --- cmd/lotus/daemon.go | 28 ++++++++++++++++++++++++++++ node/config/doc_gen.go | 12 ++++++++++++ node/config/types.go | 1 + node/modules/dtypes/tracer.go | 6 ++++++ 4 files changed, 47 insertions(+) create mode 100644 node/modules/dtypes/tracer.go diff --git a/cmd/lotus/daemon.go b/cmd/lotus/daemon.go index 486ac8ed7..89901a6f5 100644 --- a/cmd/lotus/daemon.go +++ b/cmd/lotus/daemon.go @@ -153,6 +153,22 @@ var DaemonCmd = &cli.Command{ Name: "restore-config", Usage: "config file to use when restoring from backup", }, + &cli.StringFlag{ + Name: "trace-to-json", + Usage: "starts tracer and outputs to json file defined with this flag", + }, + &cli.StringFlag{ + Name: "trace-to-elasticsearch", + Usage: "starts tracer and outputs to elasticsearch, flag must contain connection string for elasticsearch", + }, + &cli.StringFlag{ + Name: "elasticsearch-index", + Usage: "configure elasticearch index name if elasticsearch tracer is configured", + }, + &cli.StringFlag{ + Name: "trace-source-auth", + Usage: "auth token for trusted source of traces", + }, }, Action: func(cctx *cli.Context) error { isLite := cctx.Bool("lite") @@ -193,6 +209,14 @@ var DaemonCmd = &cli.Command{ return fmt.Errorf("unrecognized profile type: %q", profile) } + traceToJsonFile := cctx.String("trace-to-json") + + traceToElasticsearch := cctx.String("trace-to-elasticsearch") + + elasticsearchIndex := cctx.String("elasticsearch-index") + + traceSourceAuth := cctx.String("trace-source-auth") + ctx, _ := tag.New(context.Background(), tag.Insert(metrics.Version, build.BuildVersion), tag.Insert(metrics.Commit, build.CurrentCommit), @@ -319,6 +343,10 @@ var DaemonCmd = &cli.Command{ node.Override(new(dtypes.Bootstrapper), isBootstrapper), node.Override(new(dtypes.ShutdownChan), shutdownChan), + node.Override(new(dtypes.JsonTracerFile), traceToJsonFile), + node.Override(new(dtypes.ElasticSearchTracer), traceToElasticsearch), + node.Override(new(dtypes.ElasticSearchTracer), elasticsearchIndex), + node.Override(new(dtypes.TracerSourceAuth), traceSourceAuth), genesis, liteModeDeps, diff --git a/node/config/doc_gen.go b/node/config/doc_gen.go index fd4ec0366..f22156170 100644 --- a/node/config/doc_gen.go +++ b/node/config/doc_gen.go @@ -537,6 +537,18 @@ Type: Array of multiaddress peerinfo strings, must include peerid (/p2p/12D3K... Name: "ElasticSearchTracer", Type: "string", + Comment: ``, + }, + { + Name: "ElasticSearchIndex", + Type: "string", + + Comment: ``, + }, + { + Name: "TracerSourceAuth", + Type: "string", + Comment: ``, }, }, diff --git a/node/config/types.go b/node/config/types.go index aa061baef..630ae61fd 100644 --- a/node/config/types.go +++ b/node/config/types.go @@ -311,6 +311,7 @@ type Pubsub struct { RemoteTracer string JsonTracerFile string ElasticSearchTracer string + ElasticSearchIndex string TracerSourceAuth string } diff --git a/node/modules/dtypes/tracer.go b/node/modules/dtypes/tracer.go new file mode 100644 index 000000000..9317924f7 --- /dev/null +++ b/node/modules/dtypes/tracer.go @@ -0,0 +1,6 @@ +package dtypes + +type JsonTracerFile string +type ElasticSearchTracer string +type ElasticSearchIndex string +type TracerSourceAuth string From 94a1601ab268314734370d13412f8ee5ebf972ad Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Fri, 24 Sep 2021 12:40:33 +0200 Subject: [PATCH 34/76] Remove hardcoded url schema --- node/modules/tracer/elasticsearch_transport.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/node/modules/tracer/elasticsearch_transport.go b/node/modules/tracer/elasticsearch_transport.go index 8823b8199..dbacf5823 100644 --- a/node/modules/tracer/elasticsearch_transport.go +++ b/node/modules/tracer/elasticsearch_transport.go @@ -18,11 +18,15 @@ const ( func NewElasticSearchTransport(connectionString string) (TracerTransport, error) { conUrl, err := url.Parse(connectionString) + if err != nil { + return nil, err + } + username := conUrl.User.Username() password, _ := conUrl.User.Password() cfg := elasticsearch.Config{ Addresses: []string{ - "https://" + conUrl.Host, + conUrl.Scheme + conUrl.Host, }, Username: username, Password: password, From 22bbb113e7afc20f73d91583b60915fcf8d0546b Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Fri, 24 Sep 2021 12:58:32 +0200 Subject: [PATCH 35/76] Fix schema creation --- node/modules/tracer/elasticsearch_transport.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/modules/tracer/elasticsearch_transport.go b/node/modules/tracer/elasticsearch_transport.go index dbacf5823..621b1d437 100644 --- a/node/modules/tracer/elasticsearch_transport.go +++ b/node/modules/tracer/elasticsearch_transport.go @@ -26,7 +26,7 @@ func NewElasticSearchTransport(connectionString string) (TracerTransport, error) password, _ := conUrl.User.Password() cfg := elasticsearch.Config{ Addresses: []string{ - conUrl.Scheme + conUrl.Host, + conUrl.Scheme + "://" + conUrl.Host, }, Username: username, Password: password, From 4438c4bd87b637a9231caadca0785b6c102b4ae7 Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Fri, 24 Sep 2021 13:43:25 +0200 Subject: [PATCH 36/76] Move index name to config only and add default value --- cmd/lotus/daemon.go | 7 ------- node/modules/dtypes/tracer.go | 1 - node/modules/lp2p/pubsub.go | 1 + node/modules/tracer/elasticsearch_transport.go | 17 +++++++++++++---- 4 files changed, 14 insertions(+), 12 deletions(-) diff --git a/cmd/lotus/daemon.go b/cmd/lotus/daemon.go index 89901a6f5..9579d9534 100644 --- a/cmd/lotus/daemon.go +++ b/cmd/lotus/daemon.go @@ -161,10 +161,6 @@ var DaemonCmd = &cli.Command{ Name: "trace-to-elasticsearch", Usage: "starts tracer and outputs to elasticsearch, flag must contain connection string for elasticsearch", }, - &cli.StringFlag{ - Name: "elasticsearch-index", - Usage: "configure elasticearch index name if elasticsearch tracer is configured", - }, &cli.StringFlag{ Name: "trace-source-auth", Usage: "auth token for trusted source of traces", @@ -213,8 +209,6 @@ var DaemonCmd = &cli.Command{ traceToElasticsearch := cctx.String("trace-to-elasticsearch") - elasticsearchIndex := cctx.String("elasticsearch-index") - traceSourceAuth := cctx.String("trace-source-auth") ctx, _ := tag.New(context.Background(), @@ -345,7 +339,6 @@ var DaemonCmd = &cli.Command{ node.Override(new(dtypes.ShutdownChan), shutdownChan), node.Override(new(dtypes.JsonTracerFile), traceToJsonFile), node.Override(new(dtypes.ElasticSearchTracer), traceToElasticsearch), - node.Override(new(dtypes.ElasticSearchTracer), elasticsearchIndex), node.Override(new(dtypes.TracerSourceAuth), traceSourceAuth), genesis, diff --git a/node/modules/dtypes/tracer.go b/node/modules/dtypes/tracer.go index 9317924f7..622f4baf4 100644 --- a/node/modules/dtypes/tracer.go +++ b/node/modules/dtypes/tracer.go @@ -2,5 +2,4 @@ package dtypes type JsonTracerFile string type ElasticSearchTracer string -type ElasticSearchIndex string type TracerSourceAuth string diff --git a/node/modules/lp2p/pubsub.go b/node/modules/lp2p/pubsub.go index a8ba126e0..818832562 100644 --- a/node/modules/lp2p/pubsub.go +++ b/node/modules/lp2p/pubsub.go @@ -377,6 +377,7 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) { if in.Cfg.ElasticSearchTracer != "" { elasticSearchTransport, err := tracer.NewElasticSearchTransport( in.Cfg.ElasticSearchTracer, + in.Cfg.ElasticSearchIndex, ) if err != nil { return nil, err diff --git a/node/modules/tracer/elasticsearch_transport.go b/node/modules/tracer/elasticsearch_transport.go index 621b1d437..d0d7b84a1 100644 --- a/node/modules/tracer/elasticsearch_transport.go +++ b/node/modules/tracer/elasticsearch_transport.go @@ -12,10 +12,10 @@ import ( ) const ( - ElasticSearch_INDEX = "lotus-pubsub" + ElasticSearch_INDEX_DEFAULT = "lotus-pubsub" ) -func NewElasticSearchTransport(connectionString string) (TracerTransport, error) { +func NewElasticSearchTransport(connectionString string, elasticsearchIndex string) (TracerTransport, error) { conUrl, err := url.Parse(connectionString) if err != nil { @@ -38,13 +38,22 @@ func NewElasticSearchTransport(connectionString string) (TracerTransport, error) return nil, err } + var esIndex string + if elasticsearchIndex != "" { + esIndex = elasticsearchIndex + } else { + esIndex = ElasticSearch_INDEX_DEFAULT + } + return &elasticSearchTransport{ - cl: es, + cl: es, + esIndex: esIndex, }, nil } type elasticSearchTransport struct { - cl *elasticsearch.Client + cl *elasticsearch.Client + esIndex string } func (est *elasticSearchTransport) Transport(evt TracerTransportEvent) error { From 9332b9f39976af76221dc225c898a98e4590cee0 Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Fri, 24 Sep 2021 13:53:31 +0200 Subject: [PATCH 37/76] Change json config naming --- node/config/doc_gen.go | 8 +++++++- node/config/types.go | 2 +- node/modules/lp2p/pubsub.go | 4 ++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/node/config/doc_gen.go b/node/config/doc_gen.go index fd4ec0366..21e9ccc6b 100644 --- a/node/config/doc_gen.go +++ b/node/config/doc_gen.go @@ -528,7 +528,7 @@ Type: Array of multiaddress peerinfo strings, must include peerid (/p2p/12D3K... Comment: ``, }, { - Name: "JsonTracerFile", + Name: "JsonTracer", Type: "string", Comment: ``, @@ -537,6 +537,12 @@ Type: Array of multiaddress peerinfo strings, must include peerid (/p2p/12D3K... Name: "ElasticSearchTracer", Type: "string", + Comment: ``, + }, + { + Name: "TracerSourceAuth", + Type: "string", + Comment: ``, }, }, diff --git a/node/config/types.go b/node/config/types.go index aa061baef..b421a7e8e 100644 --- a/node/config/types.go +++ b/node/config/types.go @@ -309,7 +309,7 @@ type Pubsub struct { DirectPeers []string IPColocationWhitelist []string RemoteTracer string - JsonTracerFile string + JsonTracer string ElasticSearchTracer string TracerSourceAuth string } diff --git a/node/modules/lp2p/pubsub.go b/node/modules/lp2p/pubsub.go index a8ba126e0..b91779ac5 100644 --- a/node/modules/lp2p/pubsub.go +++ b/node/modules/lp2p/pubsub.go @@ -366,8 +366,8 @@ func GossipSub(in GossipIn) (service *pubsub.PubSub, err error) { 100))) var transports []tracer.TracerTransport - if in.Cfg.JsonTracerFile != "" { - jsonTransport, err := tracer.NewJsonTracerTransport(in.Cfg.JsonTracerFile) + if in.Cfg.JsonTracer != "" { + jsonTransport, err := tracer.NewJsonTracerTransport(in.Cfg.JsonTracer) if err != nil { return nil, err } From 72d8e620752174d8f561a6c833351ae4f6ebd298 Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Fri, 24 Sep 2021 14:07:47 +0200 Subject: [PATCH 38/76] Add kibana dashboard configurations --- tools/kibana/block-propagation-dashboard.ndjson | 2 ++ tools/kibana/peer-scores-dashboard.ndjson | 3 +++ 2 files changed, 5 insertions(+) create mode 100644 tools/kibana/block-propagation-dashboard.ndjson create mode 100644 tools/kibana/peer-scores-dashboard.ndjson diff --git a/tools/kibana/block-propagation-dashboard.ndjson b/tools/kibana/block-propagation-dashboard.ndjson new file mode 100644 index 000000000..dc5121183 --- /dev/null +++ b/tools/kibana/block-propagation-dashboard.ndjson @@ -0,0 +1,2 @@ +{"attributes":{"description":"","hits":0,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"optionsJSON":"{\"useMargins\":true,\"syncColors\":false,\"hidePanelTitles\":false}","panelsJSON":"[{\"version\":\"7.14.1\",\"type\":\"visualization\",\"gridData\":{\"x\":0,\"y\":0,\"w\":48,\"h\":42,\"i\":\"c7e4001d-38c9-4fa0-a488-e069dd50d274\"},\"panelIndex\":\"c7e4001d-38c9-4fa0-a488-e069dd50d274\",\"embeddableConfig\":{\"savedVis\":{\"title\":\"Block propagation\",\"description\":\"\",\"type\":\"vega\",\"params\":{\"spec\":\"{\\n $schema: https://vega.github.io/schema/vega/v5.json\\n title: Node block propagation\\n\\n\\n \\\"signals\\\": [\\n { \\\"name\\\": \\\"cx\\\", \\\"update\\\": \\\"width / 2\\\" },\\n { \\\"name\\\": \\\"cy\\\", \\\"update\\\": \\\"height / 2\\\" },\\n { \\\"name\\\": \\\"nodeRadius\\\", \\\"value\\\": 10,\\n \\\"bind\\\": {\\\"input\\\": \\\"range\\\", \\\"min\\\": 1, \\\"max\\\": 20, \\\"step\\\": 1} },\\n { \\\"name\\\": \\\"propagationMultiplier\\\", \\\"value\\\": 50,\\n \\\"bind\\\": {\\\"input\\\": \\\"range\\\", \\\"min\\\": 1, \\\"max\\\": 100, \\\"step\\\": 1} },\\n ],\\n\\n data: [\\n {\\n \\n name: \\\"node-data\\\",\\n url: {\\n index: lotus-pubsub\\n body: {\\n size: 0,\\n aggs: {\\n unique_peerID: {\\n terms: { \\n field: \\\"peerID\\\",\\n size: 10000\\n },\\n }\\n }\\n }\\n },\\n format: {\\\"property\\\": \\\"aggregations.unique_peerID.buckets\\\"},\\n transform: [\\n {\\n \\\"type\\\": \\\"project\\\",\\n \\\"fields\\\": [\\\"key\\\"],\\n \\\"as\\\": [\\\"peerID\\\"]\\n },\\n {\\n type: \\\"identifier\\\",\\n as: \\\"id\\\"\\n },\\n {\\n type: \\\"formula\\\",\\n expr: \\\"datum.id - 1\\\",\\n as: \\\"index\\\"\\n }\\n ]\\n },\\n {\\n name: \\\"published-message-data\\\",\\n url: {\\n index: lotus-pubsub\\n body: {\\n size: 10000,\\n query: {\\n bool: {\\n must: [\\n {\\n match: {\\n type: 0\\n }\\n }\\n ]\\n }\\n }\\n }\\n },\\n format: {\\\"property\\\": \\\"hits.hits\\\"},\\n },\\n {\\n name: \\\"link-data\\\",\\n url: {\\n index: lotus-pubsub\\n body: {\\n size: 10000,\\n query: {\\n bool: {\\n must: [\\n {\\n match: {\\n type: 1\\n }\\n }\\n ]\\n }\\n }\\n }\\n },\\n format: {\\\"property\\\": \\\"hits.hits\\\"},\\n transform: [\\n {\\n \\\"type\\\": \\\"lookup\\\",\\n \\\"from\\\": \\\"published-message-data\\\",\\n \\\"key\\\": \\\"_source.publishMessage.messageID\\\",\\n \\\"fields\\\": [\\\"_source.deliverMessage.messageID\\\"],\\n \\\"as\\\": [\\\"publishedMessage\\\"],\\n },\\n {\\n \\\"type\\\": \\\"lookup\\\",\\n \\\"from\\\": \\\"node-data\\\",\\n \\\"key\\\": \\\"peerID\\\",\\n \\\"fields\\\": [\\\"_source.peerID\\\"],\\n \\\"as\\\": [\\\"source\\\"],\\n },\\n {\\n \\\"type\\\": \\\"lookup\\\",\\n \\\"from\\\": \\\"node-data\\\",\\n \\\"key\\\": \\\"peerID\\\",\\n \\\"fields\\\": [\\\"publishedMessage._source.peerID\\\"],\\n \\\"as\\\": [\\\"target\\\"],\\n },\\n {\\n \\\"type\\\": \\\"formula\\\",\\n \\\"expr\\\": \\\"(datum._source.timestamp - datum.publishedMessage._source.timestamp) * propagationMultiplier\\\",\\n \\\"as\\\": \\\"distance\\\"\\n },\\n {\\n \\\"type\\\": \\\"project\\\",\\n \\\"fields\\\": [\\\"source.index\\\", \\\"target.index\\\", \\\"distance\\\"]\\n \\\"as\\\": [\\\"source\\\", \\\"target\\\", \\\"distance\\\"]\\n },\\n {\\n \\\"type\\\": \\\"aggregate\\\",\\n \\\"ops\\\": [\\\"average\\\"],\\n \\\"fields\\\": [\\\"distance\\\"],\\n \\\"groupby\\\": [\\\"source\\\", \\\"target\\\"],\\n \\\"as\\\": [\\\"distance\\\"]\\n }\\n ]\\n }\\n ]\\n\\n scales: [\\n {\\n \\\"name\\\": \\\"color\\\",\\n \\\"type\\\": \\\"ordinal\\\",\\n \\\"domain\\\": {\\\"data\\\": \\\"node-data\\\", \\\"field\\\": \\\"id\\\"},\\n \\\"range\\\": {\\\"scheme\\\": \\\"category20c\\\"}\\n }\\n ]\\n\\n marks: [\\n {\\n \\\"name\\\": \\\"nodes\\\",\\n \\\"type\\\": \\\"symbol\\\",\\n \\\"zindex\\\": 1,\\n \\n \\\"encode\\\": {\\n \\\"enter\\\": {\\n \\\"fill\\\": {\\\"scale\\\": \\\"color\\\", \\\"field\\\": \\\"id\\\"},\\n \\\"stroke\\\": {\\\"value\\\": \\\"black\\\"},\\n \\\"tooltip\\\": {\\\"signal\\\": \\\"{'PeerID': datum.peerID}\\\"}\\n },\\n \\\"update\\\": {\\n \\\"size\\\": {\\\"signal\\\": \\\"2 * nodeRadius * nodeRadius\\\"},\\n \\\"fill\\\": {\\\"scale\\\": \\\"color\\\", \\\"field\\\": \\\"id\\\"},\\n },\\n \\\"hover\\\": { \\\"fill\\\": {\\\"value\\\": \\\"red\\\"} },\\n },\\n\\n \\\"from\\\": {\\\"data\\\": \\\"node-data\\\"},\\n \\\"transform\\\": [\\n {\\n \\\"type\\\": \\\"force\\\",\\n \\\"restart\\\": false,\\n \\\"static\\\": true,\\n \\\"signal\\\": \\\"force\\\",\\n \\\"forces\\\": [\\n {\\\"force\\\": \\\"link\\\", \\\"links\\\": \\\"link-data\\\", distance: {field: \\\"distance\\\"}},\\n {\\\"force\\\": \\\"center\\\", \\\"x\\\": {\\\"signal\\\": \\\"cx\\\"}, \\\"y\\\": {\\\"signal\\\": \\\"cy\\\"}},\\n ]\\n }\\n ]\\n },\\n {\\n \\\"type\\\": \\\"path\\\",\\n \\\"from\\\": {\\\"data\\\": \\\"link-data\\\"},\\n \\\"encode\\\": {\\n \\\"enter\\\": {\\n \\\"tooltip\\\": {\\\"signal\\\": \\\"{'Block propagation': datum.distance}\\\"}\\n },\\n \\\"update\\\": {\\n \\\"stroke\\\": {\\\"value\\\": \\\"#ccc\\\"},\\n \\\"strokeWidth\\\": {\\\"value\\\": 1.5}\\n },\\n \\\"hover\\\": { \\\"stroke\\\": { \\\"value\\\": \\\"#0B33A0\\\" }}\\n },\\n \\\"transform\\\": [\\n {\\n \\\"type\\\": \\\"linkpath\\\",\\n \\\"require\\\": {\\\"signal\\\": \\\"force\\\"},\\n \\\"shape\\\": \\\"line\\\",\\n \\\"sourceX\\\": \\\"datum.source.x\\\", \\\"sourceY\\\": \\\"datum.source.y\\\",\\n \\\"targetX\\\": \\\"datum.target.x\\\", \\\"targetY\\\": \\\"datum.target.y\\\"\\n }\\n ]\\n }\\n ]\\n}\\n\"},\"uiState\":{},\"data\":{\"aggs\":[],\"searchSource\":{\"query\":{\"language\":\"kuery\",\"query\":\"\"},\"filter\":[]}}},\"enhancements\":{}}}]","timeRestore":false,"title":"Block propagation","version":1},"coreMigrationVersion":"7.14.1","id":"eff2ade0-19fa-11ec-99f4-75d57f0cd0d8","migrationVersion":{"dashboard":"7.14.0"},"references":[],"type":"dashboard","updated_at":"2021-09-24T09:46:01.693Z","version":"WzYzMjAsMV0="} +{"excludedObjects":[],"excludedObjectsCount":0,"exportedCount":1,"missingRefCount":0,"missingReferences":[]} diff --git a/tools/kibana/peer-scores-dashboard.ndjson b/tools/kibana/peer-scores-dashboard.ndjson new file mode 100644 index 000000000..c4d491706 --- /dev/null +++ b/tools/kibana/peer-scores-dashboard.ndjson @@ -0,0 +1,3 @@ +{"attributes":{"fieldAttrs":"{}","fields":"[]","runtimeFieldMap":"{\"peerScore.weightedScore\":{\"type\":\"double\",\"script\":{\"source\":\"if (doc['type'].value == 100) {\\n def score = doc['peerScore.score'].value;\\n if (doc['sourceAuth'] == \\\"\\\") {\\n\\n emit(score * 1.2)\\n } else {\\n emit(score)\\n }\\n}\\n\\n\"}},\"sourceAuth\":{\"type\":\"keyword\"}}","title":"lotus-pubsub*","typeMeta":"{}"},"coreMigrationVersion":"7.14.1","id":"2c407db0-1acb-11ec-99f4-75d57f0cd0d8","migrationVersion":{"index-pattern":"7.11.0"},"references":[],"type":"index-pattern","updated_at":"2021-09-24T12:03:02.575Z","version":"WzcwMzksMV0="} +{"attributes":{"description":"Average peer score table per node peerID","hits":0,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"optionsJSON":"{\"useMargins\":true,\"syncColors\":false,\"hidePanelTitles\":false}","panelsJSON":"[{\"version\":\"7.14.1\",\"type\":\"lens\",\"gridData\":{\"x\":0,\"y\":0,\"w\":48,\"h\":43,\"i\":\"cddc98a5-45f3-4ba7-a7c6-6b9d216b19da\"},\"panelIndex\":\"cddc98a5-45f3-4ba7-a7c6-6b9d216b19da\",\"embeddableConfig\":{\"attributes\":{\"title\":\"\",\"type\":\"lens\",\"visualizationType\":\"lnsDatatable\",\"state\":{\"datasourceStates\":{\"indexpattern\":{\"layers\":{\"666e2f39-8868-45ad-b747-fe124830b0ae\":{\"columns\":{\"504c50bd-14c1-4119-820e-c961866fc3b4\":{\"label\":\"peerID\",\"dataType\":\"string\",\"operationType\":\"terms\",\"scale\":\"ordinal\",\"sourceField\":\"peerScore.peerID.keyword\",\"isBucketed\":true,\"params\":{\"size\":100,\"orderBy\":{\"type\":\"column\",\"columnId\":\"ec82c5f7-b3c4-4715-8646-a8fe584400fc\"},\"orderDirection\":\"desc\",\"otherBucket\":false,\"missingBucket\":false},\"customLabel\":true},\"ec82c5f7-b3c4-4715-8646-a8fe584400fc\":{\"label\":\"Score\",\"dataType\":\"number\",\"operationType\":\"average\",\"sourceField\":\"peerScore.score\",\"isBucketed\":false,\"scale\":\"ratio\",\"customLabel\":true},\"e22a19e8-1d71-43d6-9ca0-b30ddd423447\":{\"label\":\"Weighted Score\",\"dataType\":\"number\",\"operationType\":\"average\",\"sourceField\":\"peerScore.weightedScore\",\"isBucketed\":false,\"scale\":\"ratio\",\"customLabel\":true}},\"columnOrder\":[\"504c50bd-14c1-4119-820e-c961866fc3b4\",\"ec82c5f7-b3c4-4715-8646-a8fe584400fc\",\"e22a19e8-1d71-43d6-9ca0-b30ddd423447\"],\"incompleteColumns\":{}}}}},\"visualization\":{\"columns\":[{\"isTransposed\":false,\"columnId\":\"504c50bd-14c1-4119-820e-c961866fc3b4\"},{\"isTransposed\":false,\"columnId\":\"ec82c5f7-b3c4-4715-8646-a8fe584400fc\",\"colorMode\":\"cell\",\"palette\":{\"type\":\"palette\",\"name\":\"positive\",\"params\":{\"stops\":[{\"color\":\"#d6e9e4\",\"stop\":20},{\"color\":\"#aed3ca\",\"stop\":40},{\"color\":\"#85bdb1\",\"stop\":60},{\"color\":\"#5aa898\",\"stop\":80},{\"color\":\"#209280\",\"stop\":100}]}}},{\"columnId\":\"e22a19e8-1d71-43d6-9ca0-b30ddd423447\",\"isTransposed\":false,\"colorMode\":\"cell\",\"palette\":{\"type\":\"palette\",\"name\":\"positive\",\"params\":{\"stops\":[{\"color\":\"#d6e9e4\",\"stop\":20},{\"color\":\"#aed3ca\",\"stop\":40},{\"color\":\"#85bdb1\",\"stop\":60},{\"color\":\"#5aa898\",\"stop\":80},{\"color\":\"#209280\",\"stop\":100}]}}}],\"layerId\":\"666e2f39-8868-45ad-b747-fe124830b0ae\"},\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filters\":[]},\"references\":[{\"type\":\"index-pattern\",\"id\":\"9890c040-17b7-11ec-99f4-75d57f0cd0d8\",\"name\":\"indexpattern-datasource-current-indexpattern\"},{\"type\":\"index-pattern\",\"id\":\"2c407db0-1acb-11ec-99f4-75d57f0cd0d8\",\"name\":\"indexpattern-datasource-layer-666e2f39-8868-45ad-b747-fe124830b0ae\"}]},\"hidePanelTitles\":false,\"enhancements\":{}},\"title\":\"Peer Scores\"}]","timeRestore":false,"title":"Peer Scores","version":1},"coreMigrationVersion":"7.14.1","id":"e7e4fd70-1acb-11ec-99f4-75d57f0cd0d8","migrationVersion":{"dashboard":"7.14.0"},"references":[{"id":"2c407db0-1acb-11ec-99f4-75d57f0cd0d8","name":"cddc98a5-45f3-4ba7-a7c6-6b9d216b19da:indexpattern-datasource-current-indexpattern","type":"index-pattern"},{"id":"2c407db0-1acb-11ec-99f4-75d57f0cd0d8","name":"cddc98a5-45f3-4ba7-a7c6-6b9d216b19da:indexpattern-datasource-layer-666e2f39-8868-45ad-b747-fe124830b0ae","type":"index-pattern"}],"type":"dashboard","updated_at":"2021-09-24T11:59:46.187Z","version":"WzY5NjcsMV0="} +{"excludedObjects":[],"excludedObjectsCount":0,"exportedCount":2,"missingRefCount":0,"missingReferences":[]} \ No newline at end of file From 6c680e306dd6b6cb6f20c3f0ecc20bf8d9b4186c Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Fri, 24 Sep 2021 16:25:41 +0200 Subject: [PATCH 39/76] Rename json tracer flag --- cmd/lotus/daemon.go | 13 ++++++------- node/modules/dtypes/tracer.go | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/cmd/lotus/daemon.go b/cmd/lotus/daemon.go index 9579d9534..e58523999 100644 --- a/cmd/lotus/daemon.go +++ b/cmd/lotus/daemon.go @@ -1,3 +1,4 @@ +//go:build !nodaemon // +build !nodaemon package main @@ -205,12 +206,6 @@ var DaemonCmd = &cli.Command{ return fmt.Errorf("unrecognized profile type: %q", profile) } - traceToJsonFile := cctx.String("trace-to-json") - - traceToElasticsearch := cctx.String("trace-to-elasticsearch") - - traceSourceAuth := cctx.String("trace-source-auth") - ctx, _ := tag.New(context.Background(), tag.Insert(metrics.Version, build.BuildVersion), tag.Insert(metrics.Commit, build.CurrentCommit), @@ -328,6 +323,10 @@ var DaemonCmd = &cli.Command{ log.Warnf("unable to inject prometheus ipfs/go-metrics exporter; some metrics will be unavailable; err: %s", err) } + traceToJsonFile := cctx.String("trace-to-json") + traceToElasticsearch := cctx.String("trace-to-elasticsearch") + traceSourceAuth := cctx.String("trace-source-auth") + var api api.FullNode stop, err := node.New(ctx, node.FullAPI(&api, node.Lite(isLite)), @@ -337,7 +336,7 @@ var DaemonCmd = &cli.Command{ node.Override(new(dtypes.Bootstrapper), isBootstrapper), node.Override(new(dtypes.ShutdownChan), shutdownChan), - node.Override(new(dtypes.JsonTracerFile), traceToJsonFile), + node.Override(new(dtypes.JsonTracer), traceToJsonFile), node.Override(new(dtypes.ElasticSearchTracer), traceToElasticsearch), node.Override(new(dtypes.TracerSourceAuth), traceSourceAuth), diff --git a/node/modules/dtypes/tracer.go b/node/modules/dtypes/tracer.go index 622f4baf4..735ff05c3 100644 --- a/node/modules/dtypes/tracer.go +++ b/node/modules/dtypes/tracer.go @@ -1,5 +1,5 @@ package dtypes -type JsonTracerFile string +type JsonTracer string type ElasticSearchTracer string type TracerSourceAuth string From 36913f4efce511d5e1fbcb6c3b892ffb699e1d8b Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Mon, 27 Sep 2021 13:28:28 +0200 Subject: [PATCH 40/76] Fix elasticsearch index setup --- node/modules/tracer/elasticsearch_transport.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/modules/tracer/elasticsearch_transport.go b/node/modules/tracer/elasticsearch_transport.go index d0d7b84a1..49060a13d 100644 --- a/node/modules/tracer/elasticsearch_transport.go +++ b/node/modules/tracer/elasticsearch_transport.go @@ -73,7 +73,7 @@ func (est *elasticSearchTransport) Transport(evt TracerTransportEvent) error { } req := esapi.IndexRequest{ - Index: ElasticSearch_INDEX, + Index: est.esIndex, Body: strings.NewReader(string(jsonEvt)), Refresh: "true", } From 581a54663c7d0dcfdb46e4107de7c9ecededfc34 Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Mon, 27 Sep 2021 15:09:03 +0200 Subject: [PATCH 41/76] Add README for creating kibana dashboards --- tools/kibana/README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 tools/kibana/README.md diff --git a/tools/kibana/README.md b/tools/kibana/README.md new file mode 100644 index 000000000..e4e451bbb --- /dev/null +++ b/tools/kibana/README.md @@ -0,0 +1,14 @@ +## Lotus Kibana Dashboard + +This folder contains configuration files to create Kibana dashboards to track peer scores and block propagation +throughout Filecoin network. + +### Importing dashboard + +The peer score and block propagation dashboard configuration is imported via Kibana import saved object [functionality](https://www.elastic.co/guide/en/kibana/current/managing-saved-objects.html#managing-saved-objects-export-objects). + +The index patterns will be created automatically when importing dashboards. + +#### Custom index + +By default, the dashboards target `lotus-pubsub` index which is the default one when running node. The index can be customised via edit on dashboard visualizations. From 45bb8c3ebf6fe44f4783c35893909f978b96a720 Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Wed, 29 Sep 2021 12:50:30 +0200 Subject: [PATCH 42/76] Remove cli flags --- cmd/lotus/daemon.go | 19 ------------------- 1 file changed, 19 deletions(-) diff --git a/cmd/lotus/daemon.go b/cmd/lotus/daemon.go index e58523999..51995136b 100644 --- a/cmd/lotus/daemon.go +++ b/cmd/lotus/daemon.go @@ -154,18 +154,6 @@ var DaemonCmd = &cli.Command{ Name: "restore-config", Usage: "config file to use when restoring from backup", }, - &cli.StringFlag{ - Name: "trace-to-json", - Usage: "starts tracer and outputs to json file defined with this flag", - }, - &cli.StringFlag{ - Name: "trace-to-elasticsearch", - Usage: "starts tracer and outputs to elasticsearch, flag must contain connection string for elasticsearch", - }, - &cli.StringFlag{ - Name: "trace-source-auth", - Usage: "auth token for trusted source of traces", - }, }, Action: func(cctx *cli.Context) error { isLite := cctx.Bool("lite") @@ -323,10 +311,6 @@ var DaemonCmd = &cli.Command{ log.Warnf("unable to inject prometheus ipfs/go-metrics exporter; some metrics will be unavailable; err: %s", err) } - traceToJsonFile := cctx.String("trace-to-json") - traceToElasticsearch := cctx.String("trace-to-elasticsearch") - traceSourceAuth := cctx.String("trace-source-auth") - var api api.FullNode stop, err := node.New(ctx, node.FullAPI(&api, node.Lite(isLite)), @@ -336,9 +320,6 @@ var DaemonCmd = &cli.Command{ node.Override(new(dtypes.Bootstrapper), isBootstrapper), node.Override(new(dtypes.ShutdownChan), shutdownChan), - node.Override(new(dtypes.JsonTracer), traceToJsonFile), - node.Override(new(dtypes.ElasticSearchTracer), traceToElasticsearch), - node.Override(new(dtypes.TracerSourceAuth), traceSourceAuth), genesis, liteModeDeps, From 3433fa4a6e6f1fc07619ab8aadf9c1a4c8572242 Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Wed, 29 Sep 2021 12:51:43 +0200 Subject: [PATCH 43/76] Add stringdocs to config props and generate docs --- node/config/doc_gen.go | 17 ++++++++++++++--- node/config/types.go | 17 +++++++++++++---- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/node/config/doc_gen.go b/node/config/doc_gen.go index 21e9ccc6b..c9079dac4 100644 --- a/node/config/doc_gen.go +++ b/node/config/doc_gen.go @@ -531,19 +531,30 @@ Type: Array of multiaddress peerinfo strings, must include peerid (/p2p/12D3K... Name: "JsonTracer", Type: "string", - Comment: ``, + Comment: `Path to file that will be used to output tracer content in JSON format. +If present tracer will save data to defined file. +Format: file path`, }, { Name: "ElasticSearchTracer", Type: "string", - Comment: ``, + Comment: `Connection string for elasticsearch instance. +If present tracer will save data to elasticsearch. +Format: https://:@:/`, + }, + { + Name: "ElasticSearchIndex", + Type: "string", + + Comment: `Name of elasticsearch index that will be used to save tracer data. +This property is used only if ElasticSearchTracer propery is set.`, }, { Name: "TracerSourceAuth", Type: "string", - Comment: ``, + Comment: `Auth token that will be passed with logs to elasticsearch - used for weighted peers score.`, }, }, "RetrievalPricing": []DocField{ diff --git a/node/config/types.go b/node/config/types.go index a7de81328..b8320be20 100644 --- a/node/config/types.go +++ b/node/config/types.go @@ -309,10 +309,19 @@ type Pubsub struct { DirectPeers []string IPColocationWhitelist []string RemoteTracer string - JsonTracer string - ElasticSearchTracer string - ElasticSearchIndex string - TracerSourceAuth string + // Path to file that will be used to output tracer content in JSON format. + // If present tracer will save data to defined file. + // Format: file path + JsonTracer string + // Connection string for elasticsearch instance. + // If present tracer will save data to elasticsearch. + // Format: https://:@:/ + ElasticSearchTracer string + // Name of elasticsearch index that will be used to save tracer data. + // This property is used only if ElasticSearchTracer propery is set. + ElasticSearchIndex string + // Auth token that will be passed with logs to elasticsearch - used for weighted peers score. + TracerSourceAuth string } type Chainstore struct { From 7b19beaf5d122b98ce6bc36976b6b460e6eed9e2 Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Wed, 29 Sep 2021 13:12:42 +0200 Subject: [PATCH 44/76] Fix linter errors --- node/modules/tracer/elasticsearch_transport.go | 11 ++++++++--- node/modules/tracer/tracer.go | 10 +++++----- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/node/modules/tracer/elasticsearch_transport.go b/node/modules/tracer/elasticsearch_transport.go index 49060a13d..1f6f9a157 100644 --- a/node/modules/tracer/elasticsearch_transport.go +++ b/node/modules/tracer/elasticsearch_transport.go @@ -12,7 +12,7 @@ import ( ) const ( - ElasticSearch_INDEX_DEFAULT = "lotus-pubsub" + ElasticSearchDefaultIndex = "lotus-pubsub" ) func NewElasticSearchTransport(connectionString string, elasticsearchIndex string) (TracerTransport, error) { @@ -42,7 +42,7 @@ func NewElasticSearchTransport(connectionString string, elasticsearchIndex strin if elasticsearchIndex != "" { esIndex = elasticsearchIndex } else { - esIndex = ElasticSearch_INDEX_DEFAULT + esIndex = ElasticSearchDefaultIndex } return &elasticSearchTransport{ @@ -83,10 +83,15 @@ func (est *elasticSearchTransport) Transport(evt TracerTransportEvent) error { if err != nil { return err } - defer res.Body.Close() + + err = res.Body.Close() + if err != nil { + return err + } if res.IsError() { return fmt.Errorf("[%s] Error indexing document ID=%s", res.Status(), req.DocumentID) } + return nil } diff --git a/node/modules/tracer/tracer.go b/node/modules/tracer/tracer.go index 9badfc9cb..417c5c28c 100644 --- a/node/modules/tracer/tracer.go +++ b/node/modules/tracer/tracer.go @@ -26,18 +26,18 @@ type lotusTracer struct { } const ( - TraceEvent_PEER_SCORES pubsub_pb.TraceEvent_Type = 100 + TraceEventPeerScores pubsub_pb.TraceEvent_Type = 100 ) type LotusTraceEvent struct { Type pubsub_pb.TraceEvent_Type `json:"type,omitempty"` PeerID string `json:"peerID,omitempty"` Timestamp *int64 `json:"timestamp,omitempty"` - PeerScore TraceEvent_PeerScore `json:"peerScore,omitempty"` + PeerScore TraceEventPeerScore `json:"peerScore,omitempty"` SourceAuth string `json:"sourceAuth,omitempty"` } -type TraceEvent_PeerScore struct { +type TraceEventPeerScore struct { PeerID string `json:"peerID"` Score float32 `json:"score"` } @@ -53,11 +53,11 @@ func (lt *lotusTracer) PeerScores(scores map[peer.ID]*pubsub.PeerScoreSnapshot) now := time.Now().UnixNano() for pid, score := range scores { evt := &LotusTraceEvent{ - Type: *TraceEvent_PEER_SCORES.Enum(), + Type: *TraceEventPeerScores.Enum(), PeerID: lt.pid.Pretty(), Timestamp: &now, SourceAuth: lt.sa, - PeerScore: TraceEvent_PeerScore{PeerID: pid.Pretty(), Score: float32(score.Score)}, + PeerScore: TraceEventPeerScore{PeerID: pid.Pretty(), Score: float32(score.Score)}, } lt.TraceLotusEvent(evt) From 181b35dc5e7b20aebd2a5f1e24436a58677c5509 Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Wed, 29 Sep 2021 16:20:43 +0200 Subject: [PATCH 45/76] Extend peer score event with score components --- node/modules/tracer/tracer.go | 36 ++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/node/modules/tracer/tracer.go b/node/modules/tracer/tracer.go index 417c5c28c..e31b4ea52 100644 --- a/node/modules/tracer/tracer.go +++ b/node/modules/tracer/tracer.go @@ -37,9 +37,21 @@ type LotusTraceEvent struct { SourceAuth string `json:"sourceAuth,omitempty"` } +type TopicScore struct { + Topic string `json:"topic"` + TimeInMesh time.Duration `json:"timeInMesh"` + FirstMessageDeliveries float64 `json:"firstMessageDeliveries"` + MeshMessageDeliveries float64 `json:"meshMessageDeliveries"` + InvalidMessageDeliveries float64 `json:"invalidMessageDeliveries"` +} + type TraceEventPeerScore struct { - PeerID string `json:"peerID"` - Score float32 `json:"score"` + PeerID string `json:"peerID"` + Score float64 `json:"score"` + AppSpecificScore float64 `json:"appSpecificScore"` + IPColocationFactor float64 `json:"ipColocationFactor"` + BehaviourPenalty float64 `json:"behaviourPenalty"` + Topics []TopicScore `json:"topics"` } type LotusTracer interface { @@ -52,12 +64,30 @@ type LotusTracer interface { func (lt *lotusTracer) PeerScores(scores map[peer.ID]*pubsub.PeerScoreSnapshot) { now := time.Now().UnixNano() for pid, score := range scores { + var topics []TopicScore + for topic, snapshot := range score.Topics { + topics = append(topics, TopicScore{ + Topic: topic, + TimeInMesh: snapshot.TimeInMesh, + FirstMessageDeliveries: snapshot.FirstMessageDeliveries, + MeshMessageDeliveries: snapshot.MeshMessageDeliveries, + InvalidMessageDeliveries: snapshot.InvalidMessageDeliveries, + }) + } + evt := &LotusTraceEvent{ Type: *TraceEventPeerScores.Enum(), PeerID: lt.pid.Pretty(), Timestamp: &now, SourceAuth: lt.sa, - PeerScore: TraceEventPeerScore{PeerID: pid.Pretty(), Score: float32(score.Score)}, + PeerScore: TraceEventPeerScore{ + PeerID: pid.Pretty(), + Score: score.Score, + AppSpecificScore: score.AppSpecificScore, + IPColocationFactor: score.IPColocationFactor, + BehaviourPenalty: score.BehaviourPenalty, + Topics: topics, + }, } lt.TraceLotusEvent(evt) From c34e15bbb78b4e555720c921b173209d98504bc5 Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Wed, 29 Sep 2021 16:21:16 +0200 Subject: [PATCH 46/76] Add elasticsearch index template and update dashboards --- tools/kibana/README.md | 12 +++- .../kibana/block-propagation-dashboard.ndjson | 2 +- tools/kibana/index-template.json | 66 +++++++++++++++++++ tools/kibana/peer-scores-dashboard.ndjson | 5 +- 4 files changed, 78 insertions(+), 7 deletions(-) create mode 100644 tools/kibana/index-template.json diff --git a/tools/kibana/README.md b/tools/kibana/README.md index e4e451bbb..c556ae10c 100644 --- a/tools/kibana/README.md +++ b/tools/kibana/README.md @@ -3,12 +3,18 @@ This folder contains configuration files to create Kibana dashboards to track peer scores and block propagation throughout Filecoin network. +### Importing index template + +Index template needs to be imported into Elasticsearch for score weights and to +prevent Elasticsearch from infering wrong field type. + +The [template](./index-template.json) is loaded via [Kibana Index Management](https://www.elastic.co/guide/en/elasticsearch/reference/current/index-mgmt.html) and pasted +into newly created Index Template. + ### Importing dashboard The peer score and block propagation dashboard configuration is imported via Kibana import saved object [functionality](https://www.elastic.co/guide/en/kibana/current/managing-saved-objects.html#managing-saved-objects-export-objects). -The index patterns will be created automatically when importing dashboards. - #### Custom index -By default, the dashboards target `lotus-pubsub` index which is the default one when running node. The index can be customised via edit on dashboard visualizations. +By default, the dashboards and index template target `lotus-pubsub` index which is the default one when running node. The index can be customised via edit on dashboard visualizations and also index template needs to be updated to target new index. diff --git a/tools/kibana/block-propagation-dashboard.ndjson b/tools/kibana/block-propagation-dashboard.ndjson index dc5121183..c7b14c0c3 100644 --- a/tools/kibana/block-propagation-dashboard.ndjson +++ b/tools/kibana/block-propagation-dashboard.ndjson @@ -1,2 +1,2 @@ -{"attributes":{"description":"","hits":0,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"optionsJSON":"{\"useMargins\":true,\"syncColors\":false,\"hidePanelTitles\":false}","panelsJSON":"[{\"version\":\"7.14.1\",\"type\":\"visualization\",\"gridData\":{\"x\":0,\"y\":0,\"w\":48,\"h\":42,\"i\":\"c7e4001d-38c9-4fa0-a488-e069dd50d274\"},\"panelIndex\":\"c7e4001d-38c9-4fa0-a488-e069dd50d274\",\"embeddableConfig\":{\"savedVis\":{\"title\":\"Block propagation\",\"description\":\"\",\"type\":\"vega\",\"params\":{\"spec\":\"{\\n $schema: https://vega.github.io/schema/vega/v5.json\\n title: Node block propagation\\n\\n\\n \\\"signals\\\": [\\n { \\\"name\\\": \\\"cx\\\", \\\"update\\\": \\\"width / 2\\\" },\\n { \\\"name\\\": \\\"cy\\\", \\\"update\\\": \\\"height / 2\\\" },\\n { \\\"name\\\": \\\"nodeRadius\\\", \\\"value\\\": 10,\\n \\\"bind\\\": {\\\"input\\\": \\\"range\\\", \\\"min\\\": 1, \\\"max\\\": 20, \\\"step\\\": 1} },\\n { \\\"name\\\": \\\"propagationMultiplier\\\", \\\"value\\\": 50,\\n \\\"bind\\\": {\\\"input\\\": \\\"range\\\", \\\"min\\\": 1, \\\"max\\\": 100, \\\"step\\\": 1} },\\n ],\\n\\n data: [\\n {\\n \\n name: \\\"node-data\\\",\\n url: {\\n index: lotus-pubsub\\n body: {\\n size: 0,\\n aggs: {\\n unique_peerID: {\\n terms: { \\n field: \\\"peerID\\\",\\n size: 10000\\n },\\n }\\n }\\n }\\n },\\n format: {\\\"property\\\": \\\"aggregations.unique_peerID.buckets\\\"},\\n transform: [\\n {\\n \\\"type\\\": \\\"project\\\",\\n \\\"fields\\\": [\\\"key\\\"],\\n \\\"as\\\": [\\\"peerID\\\"]\\n },\\n {\\n type: \\\"identifier\\\",\\n as: \\\"id\\\"\\n },\\n {\\n type: \\\"formula\\\",\\n expr: \\\"datum.id - 1\\\",\\n as: \\\"index\\\"\\n }\\n ]\\n },\\n {\\n name: \\\"published-message-data\\\",\\n url: {\\n index: lotus-pubsub\\n body: {\\n size: 10000,\\n query: {\\n bool: {\\n must: [\\n {\\n match: {\\n type: 0\\n }\\n }\\n ]\\n }\\n }\\n }\\n },\\n format: {\\\"property\\\": \\\"hits.hits\\\"},\\n },\\n {\\n name: \\\"link-data\\\",\\n url: {\\n index: lotus-pubsub\\n body: {\\n size: 10000,\\n query: {\\n bool: {\\n must: [\\n {\\n match: {\\n type: 1\\n }\\n }\\n ]\\n }\\n }\\n }\\n },\\n format: {\\\"property\\\": \\\"hits.hits\\\"},\\n transform: [\\n {\\n \\\"type\\\": \\\"lookup\\\",\\n \\\"from\\\": \\\"published-message-data\\\",\\n \\\"key\\\": \\\"_source.publishMessage.messageID\\\",\\n \\\"fields\\\": [\\\"_source.deliverMessage.messageID\\\"],\\n \\\"as\\\": [\\\"publishedMessage\\\"],\\n },\\n {\\n \\\"type\\\": \\\"lookup\\\",\\n \\\"from\\\": \\\"node-data\\\",\\n \\\"key\\\": \\\"peerID\\\",\\n \\\"fields\\\": [\\\"_source.peerID\\\"],\\n \\\"as\\\": [\\\"source\\\"],\\n },\\n {\\n \\\"type\\\": \\\"lookup\\\",\\n \\\"from\\\": \\\"node-data\\\",\\n \\\"key\\\": \\\"peerID\\\",\\n \\\"fields\\\": [\\\"publishedMessage._source.peerID\\\"],\\n \\\"as\\\": [\\\"target\\\"],\\n },\\n {\\n \\\"type\\\": \\\"formula\\\",\\n \\\"expr\\\": \\\"(datum._source.timestamp - datum.publishedMessage._source.timestamp) * propagationMultiplier\\\",\\n \\\"as\\\": \\\"distance\\\"\\n },\\n {\\n \\\"type\\\": \\\"project\\\",\\n \\\"fields\\\": [\\\"source.index\\\", \\\"target.index\\\", \\\"distance\\\"]\\n \\\"as\\\": [\\\"source\\\", \\\"target\\\", \\\"distance\\\"]\\n },\\n {\\n \\\"type\\\": \\\"aggregate\\\",\\n \\\"ops\\\": [\\\"average\\\"],\\n \\\"fields\\\": [\\\"distance\\\"],\\n \\\"groupby\\\": [\\\"source\\\", \\\"target\\\"],\\n \\\"as\\\": [\\\"distance\\\"]\\n }\\n ]\\n }\\n ]\\n\\n scales: [\\n {\\n \\\"name\\\": \\\"color\\\",\\n \\\"type\\\": \\\"ordinal\\\",\\n \\\"domain\\\": {\\\"data\\\": \\\"node-data\\\", \\\"field\\\": \\\"id\\\"},\\n \\\"range\\\": {\\\"scheme\\\": \\\"category20c\\\"}\\n }\\n ]\\n\\n marks: [\\n {\\n \\\"name\\\": \\\"nodes\\\",\\n \\\"type\\\": \\\"symbol\\\",\\n \\\"zindex\\\": 1,\\n \\n \\\"encode\\\": {\\n \\\"enter\\\": {\\n \\\"fill\\\": {\\\"scale\\\": \\\"color\\\", \\\"field\\\": \\\"id\\\"},\\n \\\"stroke\\\": {\\\"value\\\": \\\"black\\\"},\\n \\\"tooltip\\\": {\\\"signal\\\": \\\"{'PeerID': datum.peerID}\\\"}\\n },\\n \\\"update\\\": {\\n \\\"size\\\": {\\\"signal\\\": \\\"2 * nodeRadius * nodeRadius\\\"},\\n \\\"fill\\\": {\\\"scale\\\": \\\"color\\\", \\\"field\\\": \\\"id\\\"},\\n },\\n \\\"hover\\\": { \\\"fill\\\": {\\\"value\\\": \\\"red\\\"} },\\n },\\n\\n \\\"from\\\": {\\\"data\\\": \\\"node-data\\\"},\\n \\\"transform\\\": [\\n {\\n \\\"type\\\": \\\"force\\\",\\n \\\"restart\\\": false,\\n \\\"static\\\": true,\\n \\\"signal\\\": \\\"force\\\",\\n \\\"forces\\\": [\\n {\\\"force\\\": \\\"link\\\", \\\"links\\\": \\\"link-data\\\", distance: {field: \\\"distance\\\"}},\\n {\\\"force\\\": \\\"center\\\", \\\"x\\\": {\\\"signal\\\": \\\"cx\\\"}, \\\"y\\\": {\\\"signal\\\": \\\"cy\\\"}},\\n ]\\n }\\n ]\\n },\\n {\\n \\\"type\\\": \\\"path\\\",\\n \\\"from\\\": {\\\"data\\\": \\\"link-data\\\"},\\n \\\"encode\\\": {\\n \\\"enter\\\": {\\n \\\"tooltip\\\": {\\\"signal\\\": \\\"{'Block propagation': datum.distance}\\\"}\\n },\\n \\\"update\\\": {\\n \\\"stroke\\\": {\\\"value\\\": \\\"#ccc\\\"},\\n \\\"strokeWidth\\\": {\\\"value\\\": 1.5}\\n },\\n \\\"hover\\\": { \\\"stroke\\\": { \\\"value\\\": \\\"#0B33A0\\\" }}\\n },\\n \\\"transform\\\": [\\n {\\n \\\"type\\\": \\\"linkpath\\\",\\n \\\"require\\\": {\\\"signal\\\": \\\"force\\\"},\\n \\\"shape\\\": \\\"line\\\",\\n \\\"sourceX\\\": \\\"datum.source.x\\\", \\\"sourceY\\\": \\\"datum.source.y\\\",\\n \\\"targetX\\\": \\\"datum.target.x\\\", \\\"targetY\\\": \\\"datum.target.y\\\"\\n }\\n ]\\n }\\n ]\\n}\\n\"},\"uiState\":{},\"data\":{\"aggs\":[],\"searchSource\":{\"query\":{\"language\":\"kuery\",\"query\":\"\"},\"filter\":[]}}},\"enhancements\":{}}}]","timeRestore":false,"title":"Block propagation","version":1},"coreMigrationVersion":"7.14.1","id":"eff2ade0-19fa-11ec-99f4-75d57f0cd0d8","migrationVersion":{"dashboard":"7.14.0"},"references":[],"type":"dashboard","updated_at":"2021-09-24T09:46:01.693Z","version":"WzYzMjAsMV0="} +{"attributes":{"description":"Force layout vega graph where link force distance between peers is block propagation","hits":0,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"optionsJSON":"{\"useMargins\":true,\"syncColors\":false,\"hidePanelTitles\":false}","panelsJSON":"[{\"version\":\"7.14.1\",\"type\":\"visualization\",\"gridData\":{\"x\":0,\"y\":0,\"w\":48,\"h\":42,\"i\":\"c7e4001d-38c9-4fa0-a488-e069dd50d274\"},\"panelIndex\":\"c7e4001d-38c9-4fa0-a488-e069dd50d274\",\"embeddableConfig\":{\"savedVis\":{\"title\":\"Block propagation\",\"description\":\"\",\"type\":\"vega\",\"params\":{\"spec\":\"{\\n $schema: https://vega.github.io/schema/vega/v5.json\\n title: Node block propagation\\n\\n\\n \\\"signals\\\": [\\n { \\\"name\\\": \\\"cx\\\", \\\"update\\\": \\\"width / 2\\\" },\\n { \\\"name\\\": \\\"cy\\\", \\\"update\\\": \\\"height / 2\\\" },\\n { \\\"name\\\": \\\"nodeRadius\\\", \\\"value\\\": 10,\\n \\\"bind\\\": {\\\"input\\\": \\\"range\\\", \\\"min\\\": 1, \\\"max\\\": 20, \\\"step\\\": 1} },\\n { \\\"name\\\": \\\"propagationMultiplier\\\", \\\"value\\\": 1,\\n \\\"bind\\\": {\\\"input\\\": \\\"range\\\", \\\"min\\\": 1, \\\"max\\\": 100, \\\"step\\\": 1} },\\n ],\\n\\n data: [\\n {\\n \\n name: \\\"node-data\\\",\\n url: {\\n index: lotus-pubsub\\n body: {\\n size: 0,\\n aggs: {\\n unique_peerID: {\\n terms: { \\n field: \\\"peerID\\\",\\n size: 10000\\n },\\n }\\n }\\n }\\n },\\n format: {\\\"property\\\": \\\"aggregations.unique_peerID.buckets\\\"},\\n transform: [\\n {\\n \\\"type\\\": \\\"project\\\",\\n \\\"fields\\\": [\\\"key\\\"],\\n \\\"as\\\": [\\\"peerID\\\"]\\n },\\n {\\n type: \\\"identifier\\\",\\n as: \\\"id\\\"\\n },\\n {\\n type: \\\"formula\\\",\\n expr: \\\"datum.id - 1\\\",\\n as: \\\"index\\\"\\n }\\n ]\\n },\\n {\\n name: \\\"published-message-data\\\",\\n url: {\\n index: lotus-pubsub\\n body: {\\n size: 10000,\\n query: {\\n bool: {\\n must: [\\n {\\n match: {\\n type: 0\\n }\\n }\\n ]\\n }\\n }\\n }\\n },\\n format: {\\\"property\\\": \\\"hits.hits\\\"},\\n },\\n {\\n name: \\\"link-data\\\",\\n url: {\\n index: lotus-pubsub\\n body: {\\n size: 10000,\\n query: {\\n bool: {\\n must: [\\n {\\n match: {\\n type: 1\\n }\\n }\\n ]\\n }\\n }\\n }\\n },\\n format: {\\\"property\\\": \\\"hits.hits\\\"},\\n transform: [\\n {\\n \\\"type\\\": \\\"lookup\\\",\\n \\\"from\\\": \\\"published-message-data\\\",\\n \\\"key\\\": \\\"_source.publishMessage.messageID\\\",\\n \\\"fields\\\": [\\\"_source.deliverMessage.messageID\\\"],\\n \\\"as\\\": [\\\"publishedMessage\\\"],\\n },\\n {\\n \\\"type\\\": \\\"filter\\\",\\n \\\"expr\\\": \\\"datum.publishedMessage != null\\\"\\n },\\n {\\n \\\"type\\\": \\\"lookup\\\",\\n \\\"from\\\": \\\"node-data\\\",\\n \\\"key\\\": \\\"peerID\\\",\\n \\\"fields\\\": [\\\"_source.peerID\\\"],\\n \\\"as\\\": [\\\"source\\\"],\\n },\\n {\\n \\\"type\\\": \\\"lookup\\\",\\n \\\"from\\\": \\\"node-data\\\",\\n \\\"key\\\": \\\"peerID\\\",\\n \\\"fields\\\": [\\\"publishedMessage._source.peerID\\\"],\\n \\\"as\\\": [\\\"target\\\"],\\n },\\n {\\n \\\"type\\\": \\\"formula\\\",\\n \\\"expr\\\": \\\"(datum._source.timestamp - datum.publishedMessage._source.timestamp) * propagationMultiplier\\\",\\n \\\"as\\\": \\\"distance\\\"\\n },\\n {\\n \\\"type\\\": \\\"project\\\",\\n \\\"fields\\\": [\\\"source.index\\\", \\\"target.index\\\", \\\"distance\\\"]\\n \\\"as\\\": [\\\"source\\\", \\\"target\\\", \\\"distance\\\"]\\n },\\n {\\n \\\"type\\\": \\\"aggregate\\\",\\n \\\"ops\\\": [\\\"average\\\"],\\n \\\"fields\\\": [\\\"distance\\\"],\\n \\\"groupby\\\": [\\\"source\\\", \\\"target\\\"],\\n \\\"as\\\": [\\\"distance\\\"]\\n }\\n ]\\n }\\n ]\\n\\n scales: [\\n {\\n \\\"name\\\": \\\"color\\\",\\n \\\"type\\\": \\\"ordinal\\\",\\n \\\"domain\\\": {\\\"data\\\": \\\"node-data\\\", \\\"field\\\": \\\"id\\\"},\\n \\\"range\\\": {\\\"scheme\\\": \\\"category20c\\\"}\\n }\\n ]\\n\\n marks: [\\n {\\n \\\"name\\\": \\\"nodes\\\",\\n \\\"type\\\": \\\"symbol\\\",\\n \\\"zindex\\\": 1,\\n \\n \\\"encode\\\": {\\n \\\"enter\\\": {\\n \\\"fill\\\": {\\\"scale\\\": \\\"color\\\", \\\"field\\\": \\\"id\\\"},\\n \\\"stroke\\\": {\\\"value\\\": \\\"black\\\"},\\n \\\"tooltip\\\": {\\\"signal\\\": \\\"{'PeerID': datum.peerID}\\\"}\\n },\\n \\\"update\\\": {\\n \\\"size\\\": {\\\"signal\\\": \\\"2 * nodeRadius * nodeRadius\\\"},\\n \\\"fill\\\": {\\\"scale\\\": \\\"color\\\", \\\"field\\\": \\\"id\\\"},\\n },\\n \\\"hover\\\": { \\\"fill\\\": {\\\"value\\\": \\\"red\\\"} },\\n },\\n\\n \\\"from\\\": {\\\"data\\\": \\\"node-data\\\"},\\n \\\"transform\\\": [\\n {\\n \\\"type\\\": \\\"force\\\",\\n \\\"restart\\\": false,\\n \\\"static\\\": true,\\n \\\"signal\\\": \\\"force\\\",\\n \\\"forces\\\": [\\n {\\\"force\\\": \\\"link\\\", \\\"links\\\": \\\"link-data\\\", distance: {field: \\\"distance\\\"}},\\n {\\\"force\\\": \\\"center\\\", \\\"x\\\": {\\\"signal\\\": \\\"cx\\\"}, \\\"y\\\": {\\\"signal\\\": \\\"cy\\\"}},\\n ]\\n }\\n ]\\n },\\n {\\n \\\"type\\\": \\\"path\\\",\\n \\\"from\\\": {\\\"data\\\": \\\"link-data\\\"},\\n \\\"encode\\\": {\\n \\\"enter\\\": {\\n \\\"tooltip\\\": {\\\"signal\\\": \\\"{'Block propagation': datum.distance}\\\"}\\n },\\n \\\"update\\\": {\\n \\\"stroke\\\": {\\\"value\\\": \\\"#ccc\\\"},\\n \\\"strokeWidth\\\": {\\\"value\\\": 1.5}\\n },\\n \\\"hover\\\": { \\\"stroke\\\": { \\\"value\\\": \\\"#0B33A0\\\" }}\\n },\\n \\\"transform\\\": [\\n {\\n \\\"type\\\": \\\"linkpath\\\",\\n \\\"require\\\": {\\\"signal\\\": \\\"force\\\"},\\n \\\"shape\\\": \\\"line\\\",\\n \\\"sourceX\\\": \\\"datum.source.x\\\", \\\"sourceY\\\": \\\"datum.source.y\\\",\\n \\\"targetX\\\": \\\"datum.target.x\\\", \\\"targetY\\\": \\\"datum.target.y\\\"\\n }\\n ]\\n }\\n ]\\n}\\n\"},\"uiState\":{},\"data\":{\"aggs\":[],\"searchSource\":{\"query\":{\"language\":\"kuery\",\"query\":\"\"},\"filter\":[]}}},\"enhancements\":{}}}]","timeRestore":false,"title":"Peer block propagation","version":1},"coreMigrationVersion":"7.14.1","id":"937b1470-212b-11ec-99f4-75d57f0cd0d8","migrationVersion":{"dashboard":"7.14.0"},"references":[],"type":"dashboard","updated_at":"2021-09-29T13:45:58.342Z","version":"Wzg4NzMsMV0="} {"excludedObjects":[],"excludedObjectsCount":0,"exportedCount":1,"missingRefCount":0,"missingReferences":[]} diff --git a/tools/kibana/index-template.json b/tools/kibana/index-template.json new file mode 100644 index 000000000..f08298ad1 --- /dev/null +++ b/tools/kibana/index-template.json @@ -0,0 +1,66 @@ +{ + "template": { + "settings": {}, + "mappings": { + "runtime": { + "peerScore.weightedScore": { + "type": "double", + "script": { + "source": "if (doc['type'].value == 100) {\n def score = doc['peerScore.score'].value;\n if (doc['sourceAuth'] == \"\") {\n\n emit(score * 1.2)\n } else {\n emit(score)\n }\n}\n", + "lang": "painless" + } + } + }, + "properties": { + "peerScore": { + "properties": { + "appSpecificScore": { + "type": "double" + }, + "behaviourPenalty": { + "type": "double" + }, + "ipColocationFactor": { + "type": "double" + }, + "score": { + "type": "double" + }, + "topics": { + "type": "nested", + "properties": { + "firstMessageDeliveries": { + "type": "double", + "ignore_malformed": false, + "coerce": true + }, + "invalidMessageDeliveries": { + "type": "double", + "ignore_malformed": false, + "coerce": true + }, + "meshMessageDeliveries": { + "type": "double", + "ignore_malformed": false, + "coerce": true + }, + "timeInMesh": { + "type": "double", + "ignore_malformed": false, + "coerce": true + }, + "topic": { + "type": "keyword" + } + } + } + } + }, + "sourceAuth": { + "type": "keyword" + } + } + }, + "aliases": {} + } +} diff --git a/tools/kibana/peer-scores-dashboard.ndjson b/tools/kibana/peer-scores-dashboard.ndjson index c4d491706..4df376ab3 100644 --- a/tools/kibana/peer-scores-dashboard.ndjson +++ b/tools/kibana/peer-scores-dashboard.ndjson @@ -1,3 +1,2 @@ -{"attributes":{"fieldAttrs":"{}","fields":"[]","runtimeFieldMap":"{\"peerScore.weightedScore\":{\"type\":\"double\",\"script\":{\"source\":\"if (doc['type'].value == 100) {\\n def score = doc['peerScore.score'].value;\\n if (doc['sourceAuth'] == \\\"\\\") {\\n\\n emit(score * 1.2)\\n } else {\\n emit(score)\\n }\\n}\\n\\n\"}},\"sourceAuth\":{\"type\":\"keyword\"}}","title":"lotus-pubsub*","typeMeta":"{}"},"coreMigrationVersion":"7.14.1","id":"2c407db0-1acb-11ec-99f4-75d57f0cd0d8","migrationVersion":{"index-pattern":"7.11.0"},"references":[],"type":"index-pattern","updated_at":"2021-09-24T12:03:02.575Z","version":"WzcwMzksMV0="} -{"attributes":{"description":"Average peer score table per node peerID","hits":0,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"optionsJSON":"{\"useMargins\":true,\"syncColors\":false,\"hidePanelTitles\":false}","panelsJSON":"[{\"version\":\"7.14.1\",\"type\":\"lens\",\"gridData\":{\"x\":0,\"y\":0,\"w\":48,\"h\":43,\"i\":\"cddc98a5-45f3-4ba7-a7c6-6b9d216b19da\"},\"panelIndex\":\"cddc98a5-45f3-4ba7-a7c6-6b9d216b19da\",\"embeddableConfig\":{\"attributes\":{\"title\":\"\",\"type\":\"lens\",\"visualizationType\":\"lnsDatatable\",\"state\":{\"datasourceStates\":{\"indexpattern\":{\"layers\":{\"666e2f39-8868-45ad-b747-fe124830b0ae\":{\"columns\":{\"504c50bd-14c1-4119-820e-c961866fc3b4\":{\"label\":\"peerID\",\"dataType\":\"string\",\"operationType\":\"terms\",\"scale\":\"ordinal\",\"sourceField\":\"peerScore.peerID.keyword\",\"isBucketed\":true,\"params\":{\"size\":100,\"orderBy\":{\"type\":\"column\",\"columnId\":\"ec82c5f7-b3c4-4715-8646-a8fe584400fc\"},\"orderDirection\":\"desc\",\"otherBucket\":false,\"missingBucket\":false},\"customLabel\":true},\"ec82c5f7-b3c4-4715-8646-a8fe584400fc\":{\"label\":\"Score\",\"dataType\":\"number\",\"operationType\":\"average\",\"sourceField\":\"peerScore.score\",\"isBucketed\":false,\"scale\":\"ratio\",\"customLabel\":true},\"e22a19e8-1d71-43d6-9ca0-b30ddd423447\":{\"label\":\"Weighted Score\",\"dataType\":\"number\",\"operationType\":\"average\",\"sourceField\":\"peerScore.weightedScore\",\"isBucketed\":false,\"scale\":\"ratio\",\"customLabel\":true}},\"columnOrder\":[\"504c50bd-14c1-4119-820e-c961866fc3b4\",\"ec82c5f7-b3c4-4715-8646-a8fe584400fc\",\"e22a19e8-1d71-43d6-9ca0-b30ddd423447\"],\"incompleteColumns\":{}}}}},\"visualization\":{\"columns\":[{\"isTransposed\":false,\"columnId\":\"504c50bd-14c1-4119-820e-c961866fc3b4\"},{\"isTransposed\":false,\"columnId\":\"ec82c5f7-b3c4-4715-8646-a8fe584400fc\",\"colorMode\":\"cell\",\"palette\":{\"type\":\"palette\",\"name\":\"positive\",\"params\":{\"stops\":[{\"color\":\"#d6e9e4\",\"stop\":20},{\"color\":\"#aed3ca\",\"stop\":40},{\"color\":\"#85bdb1\",\"stop\":60},{\"color\":\"#5aa898\",\"stop\":80},{\"color\":\"#209280\",\"stop\":100}]}}},{\"columnId\":\"e22a19e8-1d71-43d6-9ca0-b30ddd423447\",\"isTransposed\":false,\"colorMode\":\"cell\",\"palette\":{\"type\":\"palette\",\"name\":\"positive\",\"params\":{\"stops\":[{\"color\":\"#d6e9e4\",\"stop\":20},{\"color\":\"#aed3ca\",\"stop\":40},{\"color\":\"#85bdb1\",\"stop\":60},{\"color\":\"#5aa898\",\"stop\":80},{\"color\":\"#209280\",\"stop\":100}]}}}],\"layerId\":\"666e2f39-8868-45ad-b747-fe124830b0ae\"},\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filters\":[]},\"references\":[{\"type\":\"index-pattern\",\"id\":\"9890c040-17b7-11ec-99f4-75d57f0cd0d8\",\"name\":\"indexpattern-datasource-current-indexpattern\"},{\"type\":\"index-pattern\",\"id\":\"2c407db0-1acb-11ec-99f4-75d57f0cd0d8\",\"name\":\"indexpattern-datasource-layer-666e2f39-8868-45ad-b747-fe124830b0ae\"}]},\"hidePanelTitles\":false,\"enhancements\":{}},\"title\":\"Peer Scores\"}]","timeRestore":false,"title":"Peer Scores","version":1},"coreMigrationVersion":"7.14.1","id":"e7e4fd70-1acb-11ec-99f4-75d57f0cd0d8","migrationVersion":{"dashboard":"7.14.0"},"references":[{"id":"2c407db0-1acb-11ec-99f4-75d57f0cd0d8","name":"cddc98a5-45f3-4ba7-a7c6-6b9d216b19da:indexpattern-datasource-current-indexpattern","type":"index-pattern"},{"id":"2c407db0-1acb-11ec-99f4-75d57f0cd0d8","name":"cddc98a5-45f3-4ba7-a7c6-6b9d216b19da:indexpattern-datasource-layer-666e2f39-8868-45ad-b747-fe124830b0ae","type":"index-pattern"}],"type":"dashboard","updated_at":"2021-09-24T11:59:46.187Z","version":"WzY5NjcsMV0="} -{"excludedObjects":[],"excludedObjectsCount":0,"exportedCount":2,"missingRefCount":0,"missingReferences":[]} \ No newline at end of file +{"attributes":{"description":"Average peer score table per node peerID","hits":0,"kibanaSavedObjectMeta":{"searchSourceJSON":"{\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filter\":[]}"},"optionsJSON":"{\"useMargins\":true,\"syncColors\":false,\"hidePanelTitles\":false}","panelsJSON":"[{\"version\":\"7.14.1\",\"type\":\"lens\",\"gridData\":{\"x\":0,\"y\":0,\"w\":48,\"h\":43,\"i\":\"cddc98a5-45f3-4ba7-a7c6-6b9d216b19da\"},\"panelIndex\":\"cddc98a5-45f3-4ba7-a7c6-6b9d216b19da\",\"embeddableConfig\":{\"attributes\":{\"title\":\"\",\"type\":\"lens\",\"visualizationType\":\"lnsDatatable\",\"state\":{\"datasourceStates\":{\"indexpattern\":{\"layers\":{\"666e2f39-8868-45ad-b747-fe124830b0ae\":{\"columns\":{\"504c50bd-14c1-4119-820e-c961866fc3b4\":{\"label\":\"peerID\",\"dataType\":\"string\",\"operationType\":\"terms\",\"scale\":\"ordinal\",\"sourceField\":\"peerScore.peerID.keyword\",\"isBucketed\":true,\"params\":{\"size\":100,\"orderBy\":{\"type\":\"column\",\"columnId\":\"ec82c5f7-b3c4-4715-8646-a8fe584400fc\"},\"orderDirection\":\"desc\",\"otherBucket\":false,\"missingBucket\":false},\"customLabel\":true},\"ec82c5f7-b3c4-4715-8646-a8fe584400fc\":{\"label\":\"Score\",\"dataType\":\"number\",\"operationType\":\"average\",\"sourceField\":\"peerScore.score\",\"isBucketed\":false,\"scale\":\"ratio\",\"customLabel\":true},\"e22a19e8-1d71-43d6-9ca0-b30ddd423447\":{\"label\":\"Weighted Score\",\"dataType\":\"number\",\"operationType\":\"average\",\"sourceField\":\"peerScore.weightedScore\",\"isBucketed\":false,\"scale\":\"ratio\",\"customLabel\":true}},\"columnOrder\":[\"504c50bd-14c1-4119-820e-c961866fc3b4\",\"ec82c5f7-b3c4-4715-8646-a8fe584400fc\",\"e22a19e8-1d71-43d6-9ca0-b30ddd423447\"],\"incompleteColumns\":{}}}}},\"visualization\":{\"columns\":[{\"isTransposed\":false,\"columnId\":\"504c50bd-14c1-4119-820e-c961866fc3b4\"},{\"isTransposed\":false,\"columnId\":\"ec82c5f7-b3c4-4715-8646-a8fe584400fc\",\"colorMode\":\"cell\",\"palette\":{\"type\":\"palette\",\"name\":\"positive\",\"params\":{\"stops\":[{\"color\":\"#d6e9e4\",\"stop\":20},{\"color\":\"#aed3ca\",\"stop\":40},{\"color\":\"#85bdb1\",\"stop\":60},{\"color\":\"#5aa898\",\"stop\":80},{\"color\":\"#209280\",\"stop\":100}]}}},{\"columnId\":\"e22a19e8-1d71-43d6-9ca0-b30ddd423447\",\"isTransposed\":false,\"colorMode\":\"cell\",\"palette\":{\"type\":\"palette\",\"name\":\"positive\",\"params\":{\"stops\":[{\"color\":\"#d6e9e4\",\"stop\":20},{\"color\":\"#aed3ca\",\"stop\":40},{\"color\":\"#85bdb1\",\"stop\":60},{\"color\":\"#5aa898\",\"stop\":80},{\"color\":\"#209280\",\"stop\":100}]}}}],\"layerId\":\"666e2f39-8868-45ad-b747-fe124830b0ae\"},\"query\":{\"query\":\"\",\"language\":\"kuery\"},\"filters\":[]},\"references\":[{\"type\":\"index-pattern\",\"id\":\"9890c040-17b7-11ec-99f4-75d57f0cd0d8\",\"name\":\"indexpattern-datasource-current-indexpattern\"},{\"type\":\"index-pattern\",\"id\":\"2c407db0-1acb-11ec-99f4-75d57f0cd0d8\",\"name\":\"indexpattern-datasource-layer-666e2f39-8868-45ad-b747-fe124830b0ae\"}]},\"hidePanelTitles\":false,\"enhancements\":{}},\"title\":\"Peer Scores\"}]","timeRestore":false,"title":"Peer Scores","version":1},"coreMigrationVersion":"7.14.1","id":"e7e4fd70-1acb-11ec-99f4-75d57f0cd0d8","migrationVersion":{"dashboard":"7.14.0"},"references":[{"id":"2c407db0-1acb-11ec-99f4-75d57f0cd0d8","name":"cddc98a5-45f3-4ba7-a7c6-6b9d216b19da:indexpattern-datasource-current-indexpattern","type":"index-pattern"},{"id":"2c407db0-1acb-11ec-99f4-75d57f0cd0d8","name":"cddc98a5-45f3-4ba7-a7c6-6b9d216b19da:indexpattern-datasource-layer-666e2f39-8868-45ad-b747-fe124830b0ae","type":"index-pattern"}],"type":"dashboard","updated_at":"2021-09-24T12:06:00.625Z","version":"WzczNDgsMV0="} +{"excludedObjects":[],"excludedObjectsCount":0,"exportedCount":1,"missingRefCount":0,"missingReferences":[]} From 53c8e68fba566d8f0f07492294832deff5866b53 Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Wed, 29 Sep 2021 16:23:08 +0200 Subject: [PATCH 47/76] Remove extra tracer dtypes --- node/modules/dtypes/tracer.go | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 node/modules/dtypes/tracer.go diff --git a/node/modules/dtypes/tracer.go b/node/modules/dtypes/tracer.go deleted file mode 100644 index 735ff05c3..000000000 --- a/node/modules/dtypes/tracer.go +++ /dev/null @@ -1,5 +0,0 @@ -package dtypes - -type JsonTracer string -type ElasticSearchTracer string -type TracerSourceAuth string From ea7673618d125277ae0d124ad5cabb255dd1c296 Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Wed, 29 Sep 2021 16:39:44 +0200 Subject: [PATCH 48/76] Add unit tests for lotus tracer --- node/modules/tracer/tracer_test.go | 110 +++++++++++++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 node/modules/tracer/tracer_test.go diff --git a/node/modules/tracer/tracer_test.go b/node/modules/tracer/tracer_test.go new file mode 100644 index 000000000..8ce809d3e --- /dev/null +++ b/node/modules/tracer/tracer_test.go @@ -0,0 +1,110 @@ +package tracer + +import ( + "testing" + "time" + + "github.com/libp2p/go-libp2p-core/peer" + pubsub "github.com/libp2p/go-libp2p-pubsub" + pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb" + "github.com/stretchr/testify/require" +) + +type testTracerTransport struct { + t *testing.T + executeTest func(t *testing.T, evt TracerTransportEvent) +} + +const peerIdA peer.ID = "12D3KooWAbSVMgRejb6ECg6fRTkCPGCfu8396msZVryu8ivcz44G" + +func NewTestTraceTransport(t *testing.T, executeTest func(t *testing.T, evt TracerTransportEvent)) TracerTransport { + return &testTracerTransport{ + t: t, + executeTest: executeTest, + } +} + +func (ttt *testTracerTransport) Transport(evt TracerTransportEvent) error { + ttt.executeTest(ttt.t, evt) + return nil +} + +func TestTracer_PeerScores(t *testing.T) { + + testTransport := NewTestTraceTransport(t, func(t *testing.T, evt TracerTransportEvent) { + require.Equal(t, peerIdA.Pretty(), evt.lotusTraceEvent.PeerID) + require.Equal(t, "source-auth-token-test", evt.lotusTraceEvent.SourceAuth) + require.Equal(t, float64(32), evt.lotusTraceEvent.PeerScore.Score) + + n := time.Now().UnixNano() + require.LessOrEqual(t, *evt.lotusTraceEvent.Timestamp, n) + + require.Equal(t, peerIdA.Pretty(), evt.lotusTraceEvent.PeerScore.PeerID) + require.Equal(t, 1, len(evt.lotusTraceEvent.PeerScore.Topics)) + + topic := evt.lotusTraceEvent.PeerScore.Topics[0] + require.Equal(t, "topicA", topic.Topic) + require.Equal(t, float64(100), topic.FirstMessageDeliveries) + }) + + lt := NewLotusTracer( + []TracerTransport{testTransport}, + peerIdA, + "source-auth-token-test", + ) + + topics := make(map[string]*pubsub.TopicScoreSnapshot) + topics["topicA"] = &pubsub.TopicScoreSnapshot{ + FirstMessageDeliveries: float64(100), + } + + m := make(map[peer.ID]*pubsub.PeerScoreSnapshot) + m[peerIdA] = &pubsub.PeerScoreSnapshot{ + Score: float64(32), + Topics: topics, + } + + lt.PeerScores(m) +} + +func TestTracer_PubSubTrace(t *testing.T) { + now := time.Now() + n := int64(now.Unix()) + + testTransport := NewTestTraceTransport(t, func(t *testing.T, evt TracerTransportEvent) { + require.Equal(t, []byte(peerIdA), evt.pubsubTraceEvent.PeerID) + require.Equal(t, &n, evt.pubsubTraceEvent.Timestamp) + }) + + lt := NewLotusTracer( + []TracerTransport{testTransport}, + "pid", + "source-auth", + ) + + lt.Trace(&pubsub_pb.TraceEvent{ + PeerID: []byte(peerIdA), + Timestamp: &n, + }) + +} + +func TestTracer_MultipleTransports(t *testing.T) { + testTransportA := NewTestTraceTransport(t, func(t *testing.T, evt TracerTransportEvent) { + require.Equal(t, []byte(peerIdA), evt.pubsubTraceEvent.PeerID) + }) + + testTransportB := NewTestTraceTransport(t, func(t *testing.T, evt TracerTransportEvent) { + require.Equal(t, []byte(peerIdA), evt.pubsubTraceEvent.PeerID) + }) + + executeTest := NewLotusTracer( + []TracerTransport{testTransportA, testTransportB}, + "pid", + "source-auth", + ) + + executeTest.Trace(&pubsub_pb.TraceEvent{ + PeerID: []byte(peerIdA), + }) +} From 530df4298e2703ffef7ed388d859e80d809daa23 Mon Sep 17 00:00:00 2001 From: Mak Muftic Date: Wed, 29 Sep 2021 16:49:03 +0200 Subject: [PATCH 49/76] Fix linter errors --- node/modules/tracer/tracer_test.go | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/node/modules/tracer/tracer_test.go b/node/modules/tracer/tracer_test.go index 8ce809d3e..d5faf8a62 100644 --- a/node/modules/tracer/tracer_test.go +++ b/node/modules/tracer/tracer_test.go @@ -15,7 +15,7 @@ type testTracerTransport struct { executeTest func(t *testing.T, evt TracerTransportEvent) } -const peerIdA peer.ID = "12D3KooWAbSVMgRejb6ECg6fRTkCPGCfu8396msZVryu8ivcz44G" +const peerIDA peer.ID = "12D3KooWAbSVMgRejb6ECg6fRTkCPGCfu8396msZVryu8ivcz44G" func NewTestTraceTransport(t *testing.T, executeTest func(t *testing.T, evt TracerTransportEvent)) TracerTransport { return &testTracerTransport{ @@ -32,14 +32,14 @@ func (ttt *testTracerTransport) Transport(evt TracerTransportEvent) error { func TestTracer_PeerScores(t *testing.T) { testTransport := NewTestTraceTransport(t, func(t *testing.T, evt TracerTransportEvent) { - require.Equal(t, peerIdA.Pretty(), evt.lotusTraceEvent.PeerID) + require.Equal(t, peerIDA.Pretty(), evt.lotusTraceEvent.PeerID) require.Equal(t, "source-auth-token-test", evt.lotusTraceEvent.SourceAuth) require.Equal(t, float64(32), evt.lotusTraceEvent.PeerScore.Score) n := time.Now().UnixNano() require.LessOrEqual(t, *evt.lotusTraceEvent.Timestamp, n) - require.Equal(t, peerIdA.Pretty(), evt.lotusTraceEvent.PeerScore.PeerID) + require.Equal(t, peerIDA.Pretty(), evt.lotusTraceEvent.PeerScore.PeerID) require.Equal(t, 1, len(evt.lotusTraceEvent.PeerScore.Topics)) topic := evt.lotusTraceEvent.PeerScore.Topics[0] @@ -49,7 +49,7 @@ func TestTracer_PeerScores(t *testing.T) { lt := NewLotusTracer( []TracerTransport{testTransport}, - peerIdA, + peerIDA, "source-auth-token-test", ) @@ -59,7 +59,7 @@ func TestTracer_PeerScores(t *testing.T) { } m := make(map[peer.ID]*pubsub.PeerScoreSnapshot) - m[peerIdA] = &pubsub.PeerScoreSnapshot{ + m[peerIDA] = &pubsub.PeerScoreSnapshot{ Score: float64(32), Topics: topics, } @@ -68,11 +68,10 @@ func TestTracer_PeerScores(t *testing.T) { } func TestTracer_PubSubTrace(t *testing.T) { - now := time.Now() - n := int64(now.Unix()) + n := time.Now().Unix() testTransport := NewTestTraceTransport(t, func(t *testing.T, evt TracerTransportEvent) { - require.Equal(t, []byte(peerIdA), evt.pubsubTraceEvent.PeerID) + require.Equal(t, []byte(peerIDA), evt.pubsubTraceEvent.PeerID) require.Equal(t, &n, evt.pubsubTraceEvent.Timestamp) }) @@ -83,7 +82,7 @@ func TestTracer_PubSubTrace(t *testing.T) { ) lt.Trace(&pubsub_pb.TraceEvent{ - PeerID: []byte(peerIdA), + PeerID: []byte(peerIDA), Timestamp: &n, }) @@ -91,11 +90,11 @@ func TestTracer_PubSubTrace(t *testing.T) { func TestTracer_MultipleTransports(t *testing.T) { testTransportA := NewTestTraceTransport(t, func(t *testing.T, evt TracerTransportEvent) { - require.Equal(t, []byte(peerIdA), evt.pubsubTraceEvent.PeerID) + require.Equal(t, []byte(peerIDA), evt.pubsubTraceEvent.PeerID) }) testTransportB := NewTestTraceTransport(t, func(t *testing.T, evt TracerTransportEvent) { - require.Equal(t, []byte(peerIdA), evt.pubsubTraceEvent.PeerID) + require.Equal(t, []byte(peerIDA), evt.pubsubTraceEvent.PeerID) }) executeTest := NewLotusTracer( @@ -105,6 +104,6 @@ func TestTracer_MultipleTransports(t *testing.T) { ) executeTest.Trace(&pubsub_pb.TraceEvent{ - PeerID: []byte(peerIdA), + PeerID: []byte(peerIDA), }) } From 59040d44196978d310dc6b4abc0e8c3c44401228 Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Wed, 10 Nov 2021 13:45:40 +0100 Subject: [PATCH 50/76] Trace reject messages in pubsub --- node/modules/lp2p/pubsub.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/node/modules/lp2p/pubsub.go b/node/modules/lp2p/pubsub.go index 9d9350074..017375940 100644 --- a/node/modules/lp2p/pubsub.go +++ b/node/modules/lp2p/pubsub.go @@ -484,6 +484,15 @@ func (trw *tracerWrapper) Trace(evt *pubsub_pb.TraceEvent) { } case pubsub_pb.TraceEvent_REJECT_MESSAGE: stats.Record(context.TODO(), metrics.PubsubRejectMessage.M(1)) + if trw.traceMessage(evt.GetRejectMessage().GetTopic()) { + if trw.lp2pTracer != nil { + trw.lp2pTracer.Trace(evt) + } + + if trw.lotusTracer != nil { + trw.lotusTracer.Trace(evt) + } + } case pubsub_pb.TraceEvent_DUPLICATE_MESSAGE: stats.Record(context.TODO(), metrics.PubsubDuplicateMessage.M(1)) case pubsub_pb.TraceEvent_JOIN: From 62e98c1964961ac3c60e66f38f53ec398df439a1 Mon Sep 17 00:00:00 2001 From: Matija Petrunic Date: Wed, 10 Nov 2021 14:11:15 +0100 Subject: [PATCH 51/76] Regenerate lotus config --- documentation/en/default-lotus-config.toml | 29 +++++++++++++++++++ .../en/default-lotus-miner-config.toml | 29 +++++++++++++++++++ 2 files changed, 58 insertions(+) diff --git a/documentation/en/default-lotus-config.toml b/documentation/en/default-lotus-config.toml index 3cb8977b2..b84d124af 100644 --- a/documentation/en/default-lotus-config.toml +++ b/documentation/en/default-lotus-config.toml @@ -89,6 +89,35 @@ # env var: LOTUS_PUBSUB_REMOTETRACER #RemoteTracer = "" + # Path to file that will be used to output tracer content in JSON format. + # If present tracer will save data to defined file. + # Format: file path + # + # type: string + # env var: LOTUS_PUBSUB_JSONTRACER + #JsonTracer = "" + + # Connection string for elasticsearch instance. + # If present tracer will save data to elasticsearch. + # Format: https://:@:/ + # + # type: string + # env var: LOTUS_PUBSUB_ELASTICSEARCHTRACER + #ElasticSearchTracer = "" + + # Name of elasticsearch index that will be used to save tracer data. + # This property is used only if ElasticSearchTracer propery is set. + # + # type: string + # env var: LOTUS_PUBSUB_ELASTICSEARCHINDEX + #ElasticSearchIndex = "" + + # Auth token that will be passed with logs to elasticsearch - used for weighted peers score. + # + # type: string + # env var: LOTUS_PUBSUB_TRACERSOURCEAUTH + #TracerSourceAuth = "" + [Client] # type: bool diff --git a/documentation/en/default-lotus-miner-config.toml b/documentation/en/default-lotus-miner-config.toml index d402f65ed..08617715b 100644 --- a/documentation/en/default-lotus-miner-config.toml +++ b/documentation/en/default-lotus-miner-config.toml @@ -89,6 +89,35 @@ # env var: LOTUS_PUBSUB_REMOTETRACER #RemoteTracer = "" + # Path to file that will be used to output tracer content in JSON format. + # If present tracer will save data to defined file. + # Format: file path + # + # type: string + # env var: LOTUS_PUBSUB_JSONTRACER + #JsonTracer = "" + + # Connection string for elasticsearch instance. + # If present tracer will save data to elasticsearch. + # Format: https://:@:/ + # + # type: string + # env var: LOTUS_PUBSUB_ELASTICSEARCHTRACER + #ElasticSearchTracer = "" + + # Name of elasticsearch index that will be used to save tracer data. + # This property is used only if ElasticSearchTracer propery is set. + # + # type: string + # env var: LOTUS_PUBSUB_ELASTICSEARCHINDEX + #ElasticSearchIndex = "" + + # Auth token that will be passed with logs to elasticsearch - used for weighted peers score. + # + # type: string + # env var: LOTUS_PUBSUB_TRACERSOURCEAUTH + #TracerSourceAuth = "" + [Subsystems] # type: bool From c2e469095ccc0bb3146df2b8d0ee21eebb1df7fb Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 29 Nov 2022 14:51:52 -0500 Subject: [PATCH 52/76] Check upper bound for deal duration --- cli/client.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cli/client.go b/cli/client.go index 377505363..1c41262a5 100644 --- a/cli/client.go +++ b/cli/client.go @@ -627,7 +627,13 @@ uiLoop: minDealDurationDays := uint64(build.MinDealDuration) / (builtin.SecondsInDay / build.BlockDelaySecs) if days < int(minDealDurationDays) { - printErr(xerrors.Errorf("minimum duration is %d days", minDealDurationDays)) + printErr(xerrors.Errorf("minimum duration is %d days, got %d", minDealDurationDays, days)) + continue + } + + maxDealDurationDays := uint64(build.MaxDealDuration) / (builtin.SecondsInDay / build.BlockDelaySecs) + if days > int(maxDealDurationDays) { + printErr(xerrors.Errorf("maximum duration is %d days, got %d", maxDealDurationDays, days)) continue } From f8754d91f78a4168bbda1d342f7f7fa5a2a4bbf1 Mon Sep 17 00:00:00 2001 From: Ian Davis Date: Mon, 5 Dec 2022 15:23:40 +0000 Subject: [PATCH 53/76] Switch release name template from "Release vX.X.X" to "vX.X.X":wq --- .goreleaser.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 021945acf..7e96e3ce8 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -75,7 +75,7 @@ release: owner: filecoin-project name: lotus prerelease: auto - name_template: "Release v{{.Version}}" + name_template: "v{{.Version}}" brews: - tap: From 2fd0cb4affc98ef3218f1628e34ee374a8ba5ea7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 9 Dec 2022 09:54:28 +0100 Subject: [PATCH 54/76] fix: sealing: Avoid nil dereference in debug log --- storage/pipeline/input.go | 4 ---- storage/pipeline/sealing.go | 26 +++++++++++++++++++++++++- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/storage/pipeline/input.go b/storage/pipeline/input.go index 3499c855c..e49e39d86 100644 --- a/storage/pipeline/input.go +++ b/storage/pipeline/input.go @@ -494,10 +494,6 @@ func (m *Sealing) updateInput(ctx context.Context, sp abi.RegisteredSealProof) e continue } if !ok { - exp, _, _ := getExpirationCached(sector.number) - - // todo move this log into checkDealAssignable, make more detailed about the reason - log.Debugf("CC update sector %d cannot fit deal, expiration %d before deal end epoch %d", id, exp, piece.deal.DealProposal.EndEpoch) continue } diff --git a/storage/pipeline/sealing.go b/storage/pipeline/sealing.go index 6caa9ddc6..0fadb6131 100644 --- a/storage/pipeline/sealing.go +++ b/storage/pipeline/sealing.go @@ -142,8 +142,21 @@ type openSector struct { } func (o *openSector) checkDealAssignable(piece *pendingPiece, expF expFn) (bool, error) { + log := log.With( + "sector", o.number, + + "deal", piece.deal.DealID, + "dealEnd", piece.deal.DealProposal.EndEpoch, + "dealStart", piece.deal.DealProposal.StartEpoch, + "dealClaimEnd", piece.claimTerms.claimTermEnd, + + "lastAssignedDealEnd", o.lastDealEnd, + "update", o.ccUpdate, + ) + // if there are deals assigned, check that no assigned deal expires after termMax if o.lastDealEnd > piece.claimTerms.claimTermEnd { + log.Debugw("deal not assignable to sector", "reason", "term end beyond last assigned deal end") return false, nil } @@ -153,15 +166,26 @@ func (o *openSector) checkDealAssignable(piece *pendingPiece, expF expFn) (bool, } sectorExpiration, _, err := expF(o.number) if err != nil { + log.Debugw("deal not assignable to sector", "reason", "error getting sector expiranion", "error", err) return false, err } + log = log.With( + "sectorExpiration", sectorExpiration, + ) + // check that in case of upgrade sector, it's expiration isn't above deals claim TermMax if sectorExpiration > piece.claimTerms.claimTermEnd { + log.Debugw("deal not assignable to sector", "reason", "term end beyond sector expiration") return false, nil } - return sectorExpiration >= piece.deal.DealProposal.EndEpoch, nil + if sectorExpiration < piece.deal.DealProposal.EndEpoch { + log.Debugw("deal not assignable to sector", "reason", "sector expiration less than deal expiration") + return false, nil + } + + return true, nil } type pieceAcceptResp struct { From f0bf3408bc5c694a637cb78c0b987e5afa7e887f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 9 Dec 2022 09:56:11 +0100 Subject: [PATCH 55/76] sealing: Add a guard check to getExpirationCached when sector not found --- storage/pipeline/input.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/storage/pipeline/input.go b/storage/pipeline/input.go index e49e39d86..25c752e5f 100644 --- a/storage/pipeline/input.go +++ b/storage/pipeline/input.go @@ -449,6 +449,9 @@ func (m *Sealing) updateInput(ctx context.Context, sp abi.RegisteredSealProof) e if err != nil { return 0, big.Zero(), err } + if onChainInfo == nil { + return 0, big.Zero(), xerrors.Errorf("sector info for sector %d not found", sn) + } memo[sn] = struct { e abi.ChainEpoch p abi.TokenAmount From 4854bef927cd988718ae663a33b7fecf2ff2dd15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 9 Dec 2022 10:03:20 +0100 Subject: [PATCH 56/76] mod tidy, fix lint --- node/modules/tracer/tracer.go | 2 +- node/modules/tracer/tracer_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/node/modules/tracer/tracer.go b/node/modules/tracer/tracer.go index e31b4ea52..0d0a156d9 100644 --- a/node/modules/tracer/tracer.go +++ b/node/modules/tracer/tracer.go @@ -4,9 +4,9 @@ import ( "time" logging "github.com/ipfs/go-log/v2" - "github.com/libp2p/go-libp2p-core/peer" pubsub "github.com/libp2p/go-libp2p-pubsub" pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb" + "github.com/libp2p/go-libp2p/core/peer" ) var log = logging.Logger("lotus-tracer") diff --git a/node/modules/tracer/tracer_test.go b/node/modules/tracer/tracer_test.go index d5faf8a62..7ade67861 100644 --- a/node/modules/tracer/tracer_test.go +++ b/node/modules/tracer/tracer_test.go @@ -4,9 +4,9 @@ import ( "testing" "time" - "github.com/libp2p/go-libp2p-core/peer" pubsub "github.com/libp2p/go-libp2p-pubsub" pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb" + "github.com/libp2p/go-libp2p/core/peer" "github.com/stretchr/testify/require" ) From c46bf475f70e50c468cfdfe32d0773cea359b532 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 9 Dec 2022 10:23:49 +0100 Subject: [PATCH 57/76] fix: miner info: Output correct StartTime --- cmd/lotus-miner/info.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/lotus-miner/info.go b/cmd/lotus-miner/info.go index b1075be37..d791b0760 100644 --- a/cmd/lotus-miner/info.go +++ b/cmd/lotus-miner/info.go @@ -93,7 +93,7 @@ func infoCmdAct(cctx *cli.Context) error { fmt.Println("Enabled subsystems (from markets API):", subsystems) - start, err := fullapi.StartTime(ctx) + start, err := minerApi.StartTime(ctx) if err != nil { return err } From 1234647b9db82014614bd04db0c91b5e916d06bf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Magiera?= Date: Fri, 9 Dec 2022 10:27:33 +0100 Subject: [PATCH 58/76] fix: don't log sp address in binary on node startup --- node/modules/storageminer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/modules/storageminer.go b/node/modules/storageminer.go index 04814ffdc..dff9c1415 100644 --- a/node/modules/storageminer.go +++ b/node/modules/storageminer.go @@ -233,7 +233,7 @@ func PreflightChecks(mctx helpers.MetricsCtx, lc fx.Lifecycle, api v1api.FullNod return xerrors.New("key for worker not found in local wallet") } - log.Infof("starting up miner %s, worker addr %s", maddr, workerKey) + log.Infof("starting up miner %s, worker addr %s", address.Address(maddr), workerKey) return nil }}) From 36183c72d16ac4dbf4d2161978895de6a14b552f Mon Sep 17 00:00:00 2001 From: Ian Davis Date: Fri, 9 Dec 2022 18:18:08 +0000 Subject: [PATCH 59/76] Remove echo so docker images actually push --- .circleci/config.yml | 8 ++++---- .circleci/template.yml | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c0bd0bc66..5e59cf33d 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -586,10 +586,10 @@ jobs: - run: name: Docker push command: | - echo docker push filecoin/<>:<> + docker push filecoin/<>:<> if [[ ! -z $CIRCLE_TAG ]]; then docker image tag filecoin/<>:<> filecoin/<>:"${CIRCLE_TAG}" - echo docker push filecoin/<>:"${CIRCLE_TAG}" + docker push filecoin/<>:"${CIRCLE_TAG}" fi - unless: condition: <> @@ -612,10 +612,10 @@ jobs: - run: name: Docker push command: | - echo docker push filecoin/<>:<>-<> + docker push filecoin/<>:<>-<> if [[ ! -z $CIRCLE_TAG ]]; then docker image tag filecoin/<>:<>-<> filecoin/<>:"${CIRCLE_TAG}"-<> - echo docker push filecoin/<>:"${CIRCLE_TAG}"-<> + docker push filecoin/<>:"${CIRCLE_TAG}"-<> fi - unless: condition: <> diff --git a/.circleci/template.yml b/.circleci/template.yml index 3127f253c..40b05d52b 100644 --- a/.circleci/template.yml +++ b/.circleci/template.yml @@ -586,10 +586,10 @@ jobs: - run: name: Docker push command: | - echo docker push filecoin/<>:<> + docker push filecoin/<>:<> if [["[[ ! -z $CIRCLE_TAG ]]"]]; then docker image tag filecoin/<>:<> filecoin/<>:"${CIRCLE_TAG}" - echo docker push filecoin/<>:"${CIRCLE_TAG}" + docker push filecoin/<>:"${CIRCLE_TAG}" fi - unless: condition: <> @@ -612,10 +612,10 @@ jobs: - run: name: Docker push command: | - echo docker push filecoin/<>:<>-<> + docker push filecoin/<>:<>-<> if [["[[ ! -z $CIRCLE_TAG ]]"]]; then docker image tag filecoin/<>:<>-<> filecoin/<>:"${CIRCLE_TAG}"-<> - echo docker push filecoin/<>:"${CIRCLE_TAG}"-<> + docker push filecoin/<>:"${CIRCLE_TAG}"-<> fi - unless: condition: <> From 3b9b688c9710e591fc6e90e6131bdbb0543eac36 Mon Sep 17 00:00:00 2001 From: Ian Davis Date: Fri, 9 Dec 2022 18:18:25 +0000 Subject: [PATCH 60/76] Deploy lotus-all-in-one:master on all master merges --- .circleci/config.yml | 40 ++++++++++++++++++++++++++++++++++++++++ .circleci/template.yml | 10 ++++++++++ 2 files changed, 50 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 5e59cf33d..4328e9c08 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1132,6 +1132,16 @@ workflows: tags: only: - /^v\d+\.\d+\.\d+-rc\d+$/ + - build-docker: + name: "Docker push (lotus-all-in-one / edge / mainnet)" + image: lotus-all-in-one + channel: master + network: mainnet + push: true + filters: + branches: + only: + - master - build-docker: name: "Docker build (lotus-all-in-one / mainnet)" image: lotus-all-in-one @@ -1167,6 +1177,16 @@ workflows: tags: only: - /^v\d+\.\d+\.\d+-rc\d+$/ + - build-docker: + name: "Docker push (lotus-all-in-one / edge / butterflynet)" + image: lotus-all-in-one + channel: master + network: butterflynet + push: true + filters: + branches: + only: + - master - build-docker: name: "Docker build (lotus-all-in-one / butterflynet)" image: lotus-all-in-one @@ -1202,6 +1222,16 @@ workflows: tags: only: - /^v\d+\.\d+\.\d+-rc\d+$/ + - build-docker: + name: "Docker push (lotus-all-in-one / edge / calibnet)" + image: lotus-all-in-one + channel: master + network: calibnet + push: true + filters: + branches: + only: + - master - build-docker: name: "Docker build (lotus-all-in-one / calibnet)" image: lotus-all-in-one @@ -1237,6 +1267,16 @@ workflows: tags: only: - /^v\d+\.\d+\.\d+-rc\d+$/ + - build-docker: + name: "Docker push (lotus-all-in-one / edge / debug)" + image: lotus-all-in-one + channel: master + network: debug + push: true + filters: + branches: + only: + - master - build-docker: name: "Docker build (lotus-all-in-one / debug)" image: lotus-all-in-one diff --git a/.circleci/template.yml b/.circleci/template.yml index 40b05d52b..95c8e1ea7 100644 --- a/.circleci/template.yml +++ b/.circleci/template.yml @@ -798,6 +798,16 @@ workflows: tags: only: - /^v\d+\.\d+\.\d+-rc\d+$/ + - build-docker: + name: "Docker push (lotus-all-in-one / edge / [[.]])" + image: lotus-all-in-one + channel: master + network: [[.]] + push: true + filters: + branches: + only: + - master - build-docker: name: "Docker build (lotus-all-in-one / [[.]])" image: lotus-all-in-one From 0635c1c3b5bcc1a983e75c7049e3c87d4dd6f95d Mon Sep 17 00:00:00 2001 From: Ian Davis Date: Fri, 9 Dec 2022 18:27:31 +0000 Subject: [PATCH 61/76] Also build / push lotus images --- .circleci/config.yml | 45 ++++++++++++++++++++++++++++++++++++++++++ .circleci/template.yml | 45 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 90 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4328e9c08..8a33a9872 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1286,6 +1286,51 @@ workflows: branches: only: - /^release\/v\d+\.\d+\.\d+(-rc\d+)?$/ + - build-docker: + name: "Docker push (lotus / stable / mainnet)" + image: lotus + channel: stable + network: mainnet + push: true + filters: + branches: + ignore: + - /.*/ + tags: + only: + - /^v\d+\.\d+\.\d+$/ + - build-docker: + name: "Docker push (lotus / candidate / mainnet)" + image: lotus + channel: candidate + network: mainnet + push: true + filters: + branches: + ignore: + - /.*/ + tags: + only: + - /^v\d+\.\d+\.\d+-rc\d+$/ + - build-docker: + name: "Docker push (lotus / master / mainnet)" + image: lotus + channel: master + network: mainnet + push: true + filters: + branches: + only: + - master + - build-docker: + name: "Docker build (lotus / mainnet)" + image: lotus + network: mainnet + push: false + filters: + branches: + only: + - /^release\/v\d+\.\d+\.\d+(-rc\d+)?$/ nightly: triggers: diff --git a/.circleci/template.yml b/.circleci/template.yml index 95c8e1ea7..a9cd82d4d 100644 --- a/.circleci/template.yml +++ b/.circleci/template.yml @@ -818,6 +818,51 @@ workflows: only: - /^release\/v\d+\.\d+\.\d+(-rc\d+)?$/ [[- end]] + - build-docker: + name: "Docker push (lotus / stable / mainnet)" + image: lotus + channel: stable + network: mainnet + push: true + filters: + branches: + ignore: + - /.*/ + tags: + only: + - /^v\d+\.\d+\.\d+$/ + - build-docker: + name: "Docker push (lotus / candidate / mainnet)" + image: lotus + channel: candidate + network: mainnet + push: true + filters: + branches: + ignore: + - /.*/ + tags: + only: + - /^v\d+\.\d+\.\d+-rc\d+$/ + - build-docker: + name: "Docker push (lotus / master / mainnet)" + image: lotus + channel: master + network: mainnet + push: true + filters: + branches: + only: + - master + - build-docker: + name: "Docker build (lotus / mainnet)" + image: lotus + network: mainnet + push: false + filters: + branches: + only: + - /^release\/v\d+\.\d+\.\d+(-rc\d+)?$/ nightly: triggers: From 5ad27f56b1aa279c35f869237d6730bcf7465a2f Mon Sep 17 00:00:00 2001 From: Ian Davis Date: Fri, 9 Dec 2022 18:35:29 +0000 Subject: [PATCH 62/76] Also push docker images to SHA tags --- .circleci/config.yml | 8 ++++++++ .circleci/template.yml | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8a33a9872..4e9ab435e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -587,6 +587,10 @@ jobs: name: Docker push command: | docker push filecoin/<>:<> + if [[ ! -z $CIRCLE_SHA ]]; then + docker image tag filecoin/<>:<>-<> filecoin/<>:"${CIRCLE_SHA}" + docker push filecoin/<>:"${CIRCLE_SHA}" + fi if [[ ! -z $CIRCLE_TAG ]]; then docker image tag filecoin/<>:<> filecoin/<>:"${CIRCLE_TAG}" docker push filecoin/<>:"${CIRCLE_TAG}" @@ -613,6 +617,10 @@ jobs: name: Docker push command: | docker push filecoin/<>:<>-<> + if [[ ! -z $CIRCLE_SHA ]]; then + docker image tag filecoin/<>:<>-<> filecoin/<>:"${CIRCLE_SHA}"-<> + docker push filecoin/<>:"${CIRCLE_SHA}"-<> + fi if [[ ! -z $CIRCLE_TAG ]]; then docker image tag filecoin/<>:<>-<> filecoin/<>:"${CIRCLE_TAG}"-<> docker push filecoin/<>:"${CIRCLE_TAG}"-<> diff --git a/.circleci/template.yml b/.circleci/template.yml index a9cd82d4d..4c7ca9e1b 100644 --- a/.circleci/template.yml +++ b/.circleci/template.yml @@ -587,6 +587,10 @@ jobs: name: Docker push command: | docker push filecoin/<>:<> + if [["[[ ! -z $CIRCLE_SHA ]]"]]; then + docker image tag filecoin/<>:<>-<> filecoin/<>:"${CIRCLE_SHA}" + docker push filecoin/<>:"${CIRCLE_SHA}" + fi if [["[[ ! -z $CIRCLE_TAG ]]"]]; then docker image tag filecoin/<>:<> filecoin/<>:"${CIRCLE_TAG}" docker push filecoin/<>:"${CIRCLE_TAG}" @@ -613,6 +617,10 @@ jobs: name: Docker push command: | docker push filecoin/<>:<>-<> + if [["[[ ! -z $CIRCLE_SHA ]]"]]; then + docker image tag filecoin/<>:<>-<> filecoin/<>:"${CIRCLE_SHA}"-<> + docker push filecoin/<>:"${CIRCLE_SHA}"-<> + fi if [["[[ ! -z $CIRCLE_TAG ]]"]]; then docker image tag filecoin/<>:<>-<> filecoin/<>:"${CIRCLE_TAG}"-<> docker push filecoin/<>:"${CIRCLE_TAG}"-<> From 7722155db1c22ec808e185cb654825d2a314f4c7 Mon Sep 17 00:00:00 2001 From: Ian Davis Date: Fri, 9 Dec 2022 18:40:35 +0000 Subject: [PATCH 63/76] go mody tidy --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index f8f875350..baf21b7c4 100644 --- a/go.mod +++ b/go.mod @@ -114,6 +114,7 @@ require ( github.com/libp2p/go-buffer-pool v0.1.0 github.com/libp2p/go-libp2p v0.23.2 github.com/libp2p/go-libp2p-consensus v0.0.1 + github.com/libp2p/go-libp2p-core v0.20.1 github.com/libp2p/go-libp2p-gorpc v0.4.0 github.com/libp2p/go-libp2p-kad-dht v0.18.0 github.com/libp2p/go-libp2p-pubsub v0.8.2 @@ -262,7 +263,6 @@ require ( github.com/libp2p/go-flow-metrics v0.1.0 // indirect github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect github.com/libp2p/go-libp2p-connmgr v0.4.0 // indirect - github.com/libp2p/go-libp2p-core v0.20.1 // indirect github.com/libp2p/go-libp2p-gostream v0.5.0 // indirect github.com/libp2p/go-libp2p-kbucket v0.5.0 // indirect github.com/libp2p/go-libp2p-noise v0.5.0 // indirect From 958fc6990649ec6b697c03dc666fe7d86a668df0 Mon Sep 17 00:00:00 2001 From: Ian Davis Date: Fri, 9 Dec 2022 18:47:21 +0000 Subject: [PATCH 64/76] Fix linter issues --- node/modules/tracer/tracer.go | 2 +- node/modules/tracer/tracer_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/node/modules/tracer/tracer.go b/node/modules/tracer/tracer.go index e31b4ea52..f1988d8f2 100644 --- a/node/modules/tracer/tracer.go +++ b/node/modules/tracer/tracer.go @@ -4,7 +4,7 @@ import ( "time" logging "github.com/ipfs/go-log/v2" - "github.com/libp2p/go-libp2p-core/peer" + "github.com/libp2p/go-libp2p/core/peer" pubsub "github.com/libp2p/go-libp2p-pubsub" pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb" ) diff --git a/node/modules/tracer/tracer_test.go b/node/modules/tracer/tracer_test.go index d5faf8a62..c4b052024 100644 --- a/node/modules/tracer/tracer_test.go +++ b/node/modules/tracer/tracer_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/libp2p/go-libp2p-core/peer" + "github.com/libp2p/go-libp2p/core/peer" pubsub "github.com/libp2p/go-libp2p-pubsub" pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb" "github.com/stretchr/testify/require" From 4936b7e1aee1d6c54b8c7d069b9f438d96642cc2 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 9 Dec 2022 15:20:51 -0500 Subject: [PATCH 65/76] make gen --- node/modules/tracer/tracer.go | 2 +- node/modules/tracer/tracer_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/node/modules/tracer/tracer.go b/node/modules/tracer/tracer.go index f1988d8f2..0d0a156d9 100644 --- a/node/modules/tracer/tracer.go +++ b/node/modules/tracer/tracer.go @@ -4,9 +4,9 @@ import ( "time" logging "github.com/ipfs/go-log/v2" - "github.com/libp2p/go-libp2p/core/peer" pubsub "github.com/libp2p/go-libp2p-pubsub" pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb" + "github.com/libp2p/go-libp2p/core/peer" ) var log = logging.Logger("lotus-tracer") diff --git a/node/modules/tracer/tracer_test.go b/node/modules/tracer/tracer_test.go index c4b052024..7ade67861 100644 --- a/node/modules/tracer/tracer_test.go +++ b/node/modules/tracer/tracer_test.go @@ -4,9 +4,9 @@ import ( "testing" "time" - "github.com/libp2p/go-libp2p/core/peer" pubsub "github.com/libp2p/go-libp2p-pubsub" pubsub_pb "github.com/libp2p/go-libp2p-pubsub/pb" + "github.com/libp2p/go-libp2p/core/peer" "github.com/stretchr/testify/require" ) From b135f7dbceb154a60933c5f9522c5e06da4d83e6 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Fri, 9 Dec 2022 15:40:04 -0500 Subject: [PATCH 66/76] go mod tidy --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index baf21b7c4..f8f875350 100644 --- a/go.mod +++ b/go.mod @@ -114,7 +114,6 @@ require ( github.com/libp2p/go-buffer-pool v0.1.0 github.com/libp2p/go-libp2p v0.23.2 github.com/libp2p/go-libp2p-consensus v0.0.1 - github.com/libp2p/go-libp2p-core v0.20.1 github.com/libp2p/go-libp2p-gorpc v0.4.0 github.com/libp2p/go-libp2p-kad-dht v0.18.0 github.com/libp2p/go-libp2p-pubsub v0.8.2 @@ -263,6 +262,7 @@ require ( github.com/libp2p/go-flow-metrics v0.1.0 // indirect github.com/libp2p/go-libp2p-asn-util v0.2.0 // indirect github.com/libp2p/go-libp2p-connmgr v0.4.0 // indirect + github.com/libp2p/go-libp2p-core v0.20.1 // indirect github.com/libp2p/go-libp2p-gostream v0.5.0 // indirect github.com/libp2p/go-libp2p-kbucket v0.5.0 // indirect github.com/libp2p/go-libp2p-noise v0.5.0 // indirect From f95e6602a0d25701ae2bcac0a14dee47b72be5c9 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Mon, 12 Dec 2022 10:44:08 -0500 Subject: [PATCH 67/76] Check for nil returns from StateSectorGetInfo --- chain/actors/builtin/miner/actor.go.template | 1 + chain/actors/builtin/miner/miner.go | 1 + chain/actors/builtin/miner/state.go.template | 1 + chain/actors/builtin/miner/v0.go | 1 + chain/actors/builtin/miner/v10.go | 1 + chain/actors/builtin/miner/v2.go | 1 + chain/actors/builtin/miner/v3.go | 1 + chain/actors/builtin/miner/v4.go | 1 + chain/actors/builtin/miner/v5.go | 1 + chain/actors/builtin/miner/v6.go | 1 + chain/actors/builtin/miner/v7.go | 1 + chain/actors/builtin/miner/v8.go | 1 + chain/actors/builtin/miner/v9.go | 1 + chain/stmgr/actors.go | 1 + itests/ccupgrade_test.go | 1 + itests/sector_make_cc_avail_test.go | 1 + itests/sector_prefer_no_upgrade_test.go | 1 + itests/sector_revert_available_test.go | 1 + miner/warmup.go | 3 +++ node/impl/full/state.go | 1 + storage/pipeline/states_replica_update.go | 4 ++++ storage/pipeline/upgrade_queue.go | 3 +++ 22 files changed, 29 insertions(+) diff --git a/chain/actors/builtin/miner/actor.go.template b/chain/actors/builtin/miner/actor.go.template index 74923a453..069b74d31 100644 --- a/chain/actors/builtin/miner/actor.go.template +++ b/chain/actors/builtin/miner/actor.go.template @@ -79,6 +79,7 @@ type State interface { LockedFunds() (LockedFunds, error) FeeDebt() (abi.TokenAmount, error) + // Returns nil, nil if sector is not found GetSector(abi.SectorNumber) (*SectorOnChainInfo, error) FindSector(abi.SectorNumber) (*SectorLocation, error) GetSectorExpiration(abi.SectorNumber) (*SectorExpiration, error) diff --git a/chain/actors/builtin/miner/miner.go b/chain/actors/builtin/miner/miner.go index 8d1dc89e9..4f93ff6a9 100644 --- a/chain/actors/builtin/miner/miner.go +++ b/chain/actors/builtin/miner/miner.go @@ -127,6 +127,7 @@ type State interface { LockedFunds() (LockedFunds, error) FeeDebt() (abi.TokenAmount, error) + // Returns nil, nil if sector is not found GetSector(abi.SectorNumber) (*SectorOnChainInfo, error) FindSector(abi.SectorNumber) (*SectorLocation, error) GetSectorExpiration(abi.SectorNumber) (*SectorExpiration, error) diff --git a/chain/actors/builtin/miner/state.go.template b/chain/actors/builtin/miner/state.go.template index e6994daa3..5ba5f5463 100644 --- a/chain/actors/builtin/miner/state.go.template +++ b/chain/actors/builtin/miner/state.go.template @@ -100,6 +100,7 @@ func (s *state{{.v}}) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state{{.v}}) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { diff --git a/chain/actors/builtin/miner/v0.go b/chain/actors/builtin/miner/v0.go index d053df0ac..10903b46b 100644 --- a/chain/actors/builtin/miner/v0.go +++ b/chain/actors/builtin/miner/v0.go @@ -90,6 +90,7 @@ func (s *state0) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state0) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { diff --git a/chain/actors/builtin/miner/v10.go b/chain/actors/builtin/miner/v10.go index 3cd3974b5..d72f7124a 100644 --- a/chain/actors/builtin/miner/v10.go +++ b/chain/actors/builtin/miner/v10.go @@ -90,6 +90,7 @@ func (s *state10) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state10) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { diff --git a/chain/actors/builtin/miner/v2.go b/chain/actors/builtin/miner/v2.go index 33c00ae62..c9870a124 100644 --- a/chain/actors/builtin/miner/v2.go +++ b/chain/actors/builtin/miner/v2.go @@ -89,6 +89,7 @@ func (s *state2) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state2) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { diff --git a/chain/actors/builtin/miner/v3.go b/chain/actors/builtin/miner/v3.go index c59a053bd..c71c8315a 100644 --- a/chain/actors/builtin/miner/v3.go +++ b/chain/actors/builtin/miner/v3.go @@ -90,6 +90,7 @@ func (s *state3) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state3) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { diff --git a/chain/actors/builtin/miner/v4.go b/chain/actors/builtin/miner/v4.go index 0eecd89f3..2e3c6ee79 100644 --- a/chain/actors/builtin/miner/v4.go +++ b/chain/actors/builtin/miner/v4.go @@ -90,6 +90,7 @@ func (s *state4) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state4) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { diff --git a/chain/actors/builtin/miner/v5.go b/chain/actors/builtin/miner/v5.go index f667a7149..28ab438e4 100644 --- a/chain/actors/builtin/miner/v5.go +++ b/chain/actors/builtin/miner/v5.go @@ -90,6 +90,7 @@ func (s *state5) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state5) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { diff --git a/chain/actors/builtin/miner/v6.go b/chain/actors/builtin/miner/v6.go index 37e4aba0b..9e819e55f 100644 --- a/chain/actors/builtin/miner/v6.go +++ b/chain/actors/builtin/miner/v6.go @@ -90,6 +90,7 @@ func (s *state6) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state6) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { diff --git a/chain/actors/builtin/miner/v7.go b/chain/actors/builtin/miner/v7.go index 4d330a4e7..f98233c37 100644 --- a/chain/actors/builtin/miner/v7.go +++ b/chain/actors/builtin/miner/v7.go @@ -90,6 +90,7 @@ func (s *state7) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state7) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { diff --git a/chain/actors/builtin/miner/v8.go b/chain/actors/builtin/miner/v8.go index 1822a3c25..ee3c475ea 100644 --- a/chain/actors/builtin/miner/v8.go +++ b/chain/actors/builtin/miner/v8.go @@ -90,6 +90,7 @@ func (s *state8) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state8) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { diff --git a/chain/actors/builtin/miner/v9.go b/chain/actors/builtin/miner/v9.go index 39328c559..12e888706 100644 --- a/chain/actors/builtin/miner/v9.go +++ b/chain/actors/builtin/miner/v9.go @@ -90,6 +90,7 @@ func (s *state9) PreCommitDeposits() (abi.TokenAmount, error) { return s.State.PreCommitDeposits, nil } +// Returns nil, nil if sector is not found func (s *state9) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) { info, ok, err := s.State.GetSector(s.store, num) if !ok || err != nil { diff --git a/chain/stmgr/actors.go b/chain/stmgr/actors.go index f4fa2d98d..0c2524b7b 100644 --- a/chain/stmgr/actors.go +++ b/chain/stmgr/actors.go @@ -103,6 +103,7 @@ func PreCommitInfo(ctx context.Context, sm *StateManager, maddr address.Address, return mas.GetPrecommittedSector(sid) } +// Returns nil, nil if sector is not found func MinerSectorInfo(ctx context.Context, sm *StateManager, maddr address.Address, sid abi.SectorNumber, ts *types.TipSet) (*miner.SectorOnChainInfo, error) { act, err := sm.LoadActor(ctx, maddr, ts) if err != nil { diff --git a/itests/ccupgrade_test.go b/itests/ccupgrade_test.go index 909b5691e..819340ea1 100644 --- a/itests/ccupgrade_test.go +++ b/itests/ccupgrade_test.go @@ -71,6 +71,7 @@ func runTestCCUpgrade(t *testing.T) *kit.TestFullNode { { si, err := client.StateSectorGetInfo(ctx, maddr, CCUpgrade, types.EmptyTSK) require.NoError(t, err) + require.NotNil(t, si) require.Less(t, 50000, int(si.Expiration)) } client.WaitForSectorActive(ctx, t, CCUpgrade, maddr) diff --git a/itests/sector_make_cc_avail_test.go b/itests/sector_make_cc_avail_test.go index c6ed4b36d..524b3c70f 100644 --- a/itests/sector_make_cc_avail_test.go +++ b/itests/sector_make_cc_avail_test.go @@ -44,6 +44,7 @@ func TestMakeAvailable(t *testing.T) { { si, err := client.StateSectorGetInfo(ctx, maddr, CCUpgrade, types.EmptyTSK) require.NoError(t, err) + require.NotNil(t, si) require.Less(t, 50000, int(si.Expiration)) } client.WaitForSectorActive(ctx, t, CCUpgrade, maddr) diff --git a/itests/sector_prefer_no_upgrade_test.go b/itests/sector_prefer_no_upgrade_test.go index 0294899d9..96f07f9e4 100644 --- a/itests/sector_prefer_no_upgrade_test.go +++ b/itests/sector_prefer_no_upgrade_test.go @@ -46,6 +46,7 @@ func TestPreferNoUpgrade(t *testing.T) { { si, err := client.StateSectorGetInfo(ctx, maddr, CCUpgrade, types.EmptyTSK) require.NoError(t, err) + require.NotNil(t, si) require.Less(t, 50000, int(si.Expiration)) } client.WaitForSectorActive(ctx, t, CCUpgrade, maddr) diff --git a/itests/sector_revert_available_test.go b/itests/sector_revert_available_test.go index 99d410e95..41a46024f 100644 --- a/itests/sector_revert_available_test.go +++ b/itests/sector_revert_available_test.go @@ -42,6 +42,7 @@ func TestAbortUpgradeAvailable(t *testing.T) { { si, err := client.StateSectorGetInfo(ctx, maddr, CCUpgrade, types.EmptyTSK) require.NoError(t, err) + require.NotNil(t, si) require.Less(t, 50000, int(si.Expiration)) } client.WaitForSectorActive(ctx, t, CCUpgrade, maddr) diff --git a/miner/warmup.go b/miner/warmup.go index 3b73afbc9..46236784a 100644 --- a/miner/warmup.go +++ b/miner/warmup.go @@ -59,6 +59,9 @@ out: if err != nil { return xerrors.Errorf("getting sector info: %w", err) } + if si == nil { + return xerrors.Errorf("sector not found %d", sector) + } ts, err := m.api.ChainHead(ctx) if err != nil { diff --git a/node/impl/full/state.go b/node/impl/full/state.go index c91fcb298..91ffd3b9e 100644 --- a/node/impl/full/state.go +++ b/node/impl/full/state.go @@ -1046,6 +1046,7 @@ func (a *StateAPI) StateSectorPreCommitInfo(ctx context.Context, maddr address.A return pci, err } +// Returns nil, nil if sector is not found func (m *StateModule) StateSectorGetInfo(ctx context.Context, maddr address.Address, n abi.SectorNumber, tsk types.TipSetKey) (*miner.SectorOnChainInfo, error) { ts, err := m.Chain.GetTipSetFromKey(ctx, tsk) if err != nil { diff --git a/storage/pipeline/states_replica_update.go b/storage/pipeline/states_replica_update.go index b42820f48..e1b9cfc30 100644 --- a/storage/pipeline/states_replica_update.go +++ b/storage/pipeline/states_replica_update.go @@ -143,6 +143,10 @@ func (m *Sealing) handleSubmitReplicaUpdate(ctx statemachine.Context, sector Sec log.Errorf("handleSubmitReplicaUpdate: api error, not proceeding: %+v", err) return nil } + if onChainInfo == nil { + return xerrors.Errorf("sector not found %d", sector.SectorNumber) + } + sp, err := m.currentSealProof(ctx.Context()) if err != nil { log.Errorf("sealer failed to return current seal proof not proceeding: %+v", err) diff --git a/storage/pipeline/upgrade_queue.go b/storage/pipeline/upgrade_queue.go index 309e59573..9d9e1ca46 100644 --- a/storage/pipeline/upgrade_queue.go +++ b/storage/pipeline/upgrade_queue.go @@ -33,6 +33,9 @@ func (m *Sealing) MarkForUpgrade(ctx context.Context, id abi.SectorNumber) error if err != nil { return xerrors.Errorf("failed to read sector on chain info: %w", err) } + if onChainInfo == nil { + return xerrors.Errorf("sector not found %d", id) + } active, err := m.sectorActive(ctx, ts.Key(), id) if err != nil { From 466f0c583f7462db8eea88d4433893d907ead9aa Mon Sep 17 00:00:00 2001 From: Shrenuj Bansal Date: Mon, 12 Dec 2022 11:45:44 -0500 Subject: [PATCH 68/76] cli: Add lotus-shed cli for computing frc42 method num --- cmd/lotus-shed/actor.go | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/cmd/lotus-shed/actor.go b/cmd/lotus-shed/actor.go index 037b6d433..f8d56a0da 100644 --- a/cmd/lotus-shed/actor.go +++ b/cmd/lotus-shed/actor.go @@ -34,6 +34,7 @@ var actorCmd = &cli.Command{ actorControl, actorProposeChangeWorker, actorConfirmChangeWorker, + actorGetMethodNum, }, } @@ -809,3 +810,24 @@ var actorConfirmChangeWorker = &cli.Command{ return nil }, } + +var actorGetMethodNum = &cli.Command{ + Name: "generate-method-num", + Usage: "Generate method number from method name", + ArgsUsage: "[methodName]", + Action: func(cctx *cli.Context) error { + if !cctx.Args().Present() { + return fmt.Errorf("must pass methodNum") + } + + methodName := cctx.Args().First() + methodNum, err := builtin.GenerateMethodNum(methodName) + if err != nil { + return err + } + + fmt.Println("Method Num: ", methodNum) + + return nil + }, +} From a5d773da9f791df1b1a684680c7c3d44de71cfb1 Mon Sep 17 00:00:00 2001 From: Shrenuj Bansal Date: Mon, 12 Dec 2022 12:03:06 -0500 Subject: [PATCH 69/76] go mod changes --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index f8f875350..21b18674e 100644 --- a/go.mod +++ b/go.mod @@ -43,7 +43,7 @@ require ( github.com/filecoin-project/go-legs v0.4.4 github.com/filecoin-project/go-padreader v0.0.1 github.com/filecoin-project/go-paramfetch v0.0.4 - github.com/filecoin-project/go-state-types v0.10.0-alpha-2 + github.com/filecoin-project/go-state-types v0.10.0-alpha-3 github.com/filecoin-project/go-statemachine v1.0.2 github.com/filecoin-project/go-statestore v0.2.0 github.com/filecoin-project/go-storedcounter v0.1.0 diff --git a/go.sum b/go.sum index 28d74d583..3e1b1fe77 100644 --- a/go.sum +++ b/go.sum @@ -356,8 +356,8 @@ github.com/filecoin-project/go-state-types v0.1.0/go.mod h1:ezYnPf0bNkTsDibL/psS github.com/filecoin-project/go-state-types v0.1.6/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q= github.com/filecoin-project/go-state-types v0.1.8/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q= github.com/filecoin-project/go-state-types v0.1.10/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q= -github.com/filecoin-project/go-state-types v0.10.0-alpha-2 h1:xz8+sXAuCMane7SkEYCtQjD/zYJ4n1d5bxwYNL8Thf0= -github.com/filecoin-project/go-state-types v0.10.0-alpha-2/go.mod h1:7ty480tvttEAqWKywhAaDCElk7ksTqEXtXWAzTSdEKo= +github.com/filecoin-project/go-state-types v0.10.0-alpha-3 h1:8iM9uz+rWRbrg1Zet+YlTJN4XEPNqRkqa3zay2pwV7w= +github.com/filecoin-project/go-state-types v0.10.0-alpha-3/go.mod h1:FPgQE05BFwZxKw/vCuIaIrzfJKo4RPQQMMPGd43dAFI= github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig= github.com/filecoin-project/go-statemachine v1.0.2 h1:421SSWBk8GIoCoWYYTE/d+qCWccgmRH0uXotXRDjUbc= github.com/filecoin-project/go-statemachine v1.0.2/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54= From 3b33f65408a81e573f8775c9a0ce6c09fc259072 Mon Sep 17 00:00:00 2001 From: Shrenuj Bansal Date: Tue, 13 Dec 2022 10:53:37 -0500 Subject: [PATCH 70/76] chore: merge releases back into master --- CHANGELOG.md | 171 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 171 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 622de475a..cd450afd2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,176 @@ # Lotus changelog +# 1.19.0 / 2022-12-07 + +This is an optional feature release of Lotus. This feature release includes the SplitStore beta, the experimental Lotus node cluster feature, as well as numerous enhancments and bugfixes. + +## Highlights +### 🟢 SplitStore v2(Beta) 🟢 + +Splitstore aims to reduce the node performance impact that's caused by the Filecoin's very large, and continuously growing chain datastore by having a hot and cold blockstore. You can find more about the Splitstore implementation [here](https://github.com/filecoin-project/lotus/blob/master/blockstore/splitstore/README.md). +Splitstore has three basic modes for node operators to configure according to your needs: +- `discard`: hotstore only, automatically archive out-of-scope objects that are beyond 4 finalities(3600 epochs). +- `universal`: stores all chain data that's beyond 4 finalities into coldstore. +- `messages`: only stores on-chain messages into coldstore. + +The `EnableColdStoreAutoPrune=` configuration is being deprecated in this release, as there is only ever one compaction running. We welcome all node operators to try the new feature and let us know [here](https://github.com/filecoin-project/lotus/discussions/9179) if you have any feedback! +There are more configuration one may set, you can read the full documentation about the SplitStoreV2 here: https://lotus.filecoin.io/lotus/configure/splitstore/. + +### 🧪 Node Cluster (*EXPERIMENTAL.*) 🧪 +The Lotus HA node cluster feature allows you to run multiple Lotus daemons for the same lotus-miner increasing resiliency. We welcome all Lotus users to join the early testing for this feature and provide your feedback. Please note that this feature is targeted towards more enterprise users of Lotus and requires at least 3 lotus nodes to be set up in a cluster. +Check out the documentation here: https://lotus.filecoin.io/lotus/configure/clusters/ + +### ⭐️ SnapDeals Enhancements ⭐️ +Numerous SnapDeals related improvements and fixes made it into this release before the code freeze. Some the highlights of the issues that has been fixed in this feature release are: + +- *Unable to snap-up a sector again if something went wrong.* - This has now been fixed ✅ +- *Error messages on loop during an open deadline.* - This has now been fixed ✅ + +## New features +- feat:splitstore:single compaction that can handle prune aka two marksets one compaction (#9571) ([filecoin-project/lotus#9571](https://github.com/filecoin-project/lotus/pull/9571)) + - Introduces a new SplitStore-mode, `messages`, which will only store on-chain messages. Fixes previously issues with regards to `AutoPrune` not compacting the coldstore. [Link to documentation](https://lotus.filecoin.io/lotus/configure/splitstore/) +- feat: Raft consensus for lotus nodes in a cluster ([filecoin-project/lotus#9294](https://github.com/filecoin-project/lotus/pull/9294)) + - Adds the experimental node cluster feature. +- feat: storage: Force exit GenerateSingleVanillaProof on cancelled context ([filecoin-project/lotus#9613](https://github.com/filecoin-project/lotus/pull/9613)) + - `GenerateSingleVanillaProof` now respects context, which means that it will skip slow to read sectors :snail: and return a context error. Instead of being blocked forever if storage reads where blocked (e.g disconnected NFS). +- feat: wdpost: Configurable pre-check timeouts ([filecoin-project/lotus#9680](https://github.com/filecoin-project/lotus/pull/9680)) + - Adds configuration knobs for setting custom amount of time a proving pre-check can take before a sector and partition will be skipped. [Link to documentation](https://lotus.filecoin.io/storage-providers/advanced-configurations/proving/#pre-check-sector-timeout) +- feat: chain: future proof the from & to address protocols ([filecoin-project/lotus#9515](https://github.com/filecoin-project/lotus/pull/9515)) + - This lets us add new address protocols to go-address without implicitly accepting them in messages on the network. +- feat: Retrieval into remote blockstores ([filecoin-project/lotus#9565](https://github.com/filecoin-project/lotus/pull/9565)) + - Makes it possible to point retrievals at a network-backed blockstore. +- feat: Add node uptime rpc / output in info command ([filecoin-project/lotus#9436](https://github.com/filecoin-project/lotus/pull/9436)) + - Adds node uptime stats to the `lotus-miner info` and `lotus info` commands +- feat: wdpost: Add ability to only have single partition per msg for partitions with… ([filecoin-project/lotus#9413](https://github.com/filecoin-project/lotus/pull/9413)) + - Adds a configuration option to have a single partition per PoSt Message for partitions containing recovering sectors. +- feat: miner paramfetch: Don't fetch param files when not needed ([filecoin-project/lotus#9391](https://github.com/filecoin-project/lotus/pull/9391)) + - A Lotus-Miner processes that has disabled local PoSt / C2 / PR2 does not need the param-files. This makes node startup much faster, reducing downtime by a lot when restarts are needed. +- feat: client: Add retrieval deal ID and bytes transferred to retrieval output ([filecoin-project/lotus#9398](https://github.com/filecoin-project/lotus/pull/9398)) + - Appends retrieval deal ID and bytes transferred to the retrieval output. +- feat: dealpublisher: check for duplicate deals before adding ([filecoin-project/lotus#9365](https://github.com/filecoin-project/lotus/pull/9365)) +- feat: Drop active retrieval check (#764) ([filecoin-project/go-fil-markets#764](https://github.com/filecoin-project/go-fil-markets/pull/764)) +- feat(retrievalmarkets): expose GetDynamicAsk (#748) ([filecoin-project/go-fil-markets#748](https://github.com/filecoin-project/go-fil-markets/pull/748)) +- feat: handle retrieval queries for unindexed identity payload CIDs (#747) ([filecoin-project/go-fil-markets#747](https://github.com/filecoin-project/go-fil-markets/pull/747)) +- feat: add a method for validating an address for a network version (#115) ([filecoin-project/go-state-types#115](https://github.com/filecoin-project/go-state-types/pull/115)) + +## Improvements +- fix: miner-cli: Fix lotus-miner proving check ([filecoin-project/lotus#9643](https://github.com/filecoin-project/lotus/pull/9643)) + - Fixes the issue where the `lotus-miner proving check` command always outputted `Error: rg is nil` +- fix: sealing pipeline: Clear CreationTime when starting sector upgrade ([filecoin-project/lotus#9642](https://github.com/filecoin-project/lotus/pull/9642)) + - Fixes the issue where an aborted SnapDeal upgrade could no longer be retried with SnapDeals. +- fix:sealing-fsm:wait mutable fsm state for immutable sector upgrade error ([filecoin-project/lotus#9598](https://github.com/filecoin-project/lotus/pull/9598)) + - Creating a new WaitMutable state - now if the deadline is open and the sectors are trying finalize they will wait on the worker until the deadline has closed. Important to note that they will not finalize as soon as the deadline closes, they will wait 1h before continuing. Fixes the previous issue where upgraded Snap-sectors for an open deadline cause a lot of `error-messages` and `p_aux` issues +- fix: cli: add beneficiary info to lotus-miner actor control list ([filecoin-project/lotus#9632](https://github.com/filecoin-project/lotus/pull/9632)) + - Adds the beneficiary address to the `lotus-miner actor control list` output. +- fix: sealing pipeine: Release assigned deals on snapdeals abort ([filecoin-project/lotus#9601](https://github.com/filecoin-project/lotus/pull/9601)) +- fix: docker: make compatible with arm platform ([filecoin-project/lotus#9363](https://github.com/filecoin-project/lotus/pull/9363)) + - Makes the `Dockerfile.lotus` compatible with ARM-platforms (e.g Mac M1). +- fix: post worker sched: Don't check worker session in a busy loop ([filecoin-project/lotus#9495](https://github.com/filecoin-project/lotus/pull/9495)) + - Fixes a looping pattern which could result in a flood of requests between `lotus-miner`<->`lotus-worker`, potentially exhausting resources needed to make http requests, that lead to all sorts of random RPC-related issues. +- fix: miner: init miner's with 32GiB sectors by default ([filecoin-project/lotus#9364](https://github.com/filecoin-project/lotus/pull/9364)) + - Makes the `lotus-miner init` defualt to 32GiB sectors. +- fix: store identity CIDs in CARs for online deals (#749) ([filecoin-project/go-fil-markets#749](https://github.com/filecoin-project/go-fil-markets/pull/749)) +- fix: cliutil: Fix URL-based API endpoint parsing + +## Dependencies +- deps: upgrade go-merkledag to 0.8.1 (#9717) +- deps: Update go-fil-markets to v1.25.0 ([filecoin-project/lotus#9633](https://github.com/filecoin-project/lotus/pull/9633)) +- deps: upgrade go-merkledag to 0.8.0 ([filecoin-project/lotus#9455](https://github.com/filecoin-project/lotus/pull/9455)) + +## Others +- fix/build: Update Zondax/hid to 0.9.1 +- refactor: sealing: minor refactor of FinalizeReplicaUpdate ([filecoin-project/lotus#9614](https://github.com/filecoin-project/lotus/pull/9614)) +- update ffi to 280c4f8b94fd46dc (#9608) ([filecoin-project/lotus#9608](https://github.com/filecoin-project/lotus/pull/9608)) +- fix: tvx: make it work with the FVM ([filecoin-project/lotus#9604](https://github.com/filecoin-project/lotus/pull/9604)) +- fix: autobatch: remove potential deadlock when a block is missing ([filecoin-project/lotus#9602](https://github.com/filecoin-project/lotus/pull/9602)) +- feat: shed: set control address: add dump bytes option ([filecoin-project/lotus#9572](https://github.com/filecoin-project/lotus/pull/9572)) +- feat: shed: Online export-car ([filecoin-project/lotus#9590](https://github.com/filecoin-project/lotus/pull/9590)) +- fix: chain: Update chain.go ([filecoin-project/lotus#9373](https://github.com/filecoin-project/lotus/pull/9373)) +- fix: fvm: Allow setting local bundles for Debug FVM for av 9+ ([filecoin-project/lotus#9509](https://github.com/filecoin-project/lotus/pull/9509)) +- fix: ux: Add outputs to wallet commands ([filecoin-project/lotus#9416](https://github.com/filecoin-project/lotus/pull/9416)) +- fix: ux: specify arg in `net ping` cmd ([filecoin-project/lotus#9459](https://github.com/filecoin-project/lotus/pull/9459)) +- fix: cli: renew --only-cc with sectorfile ([filecoin-project/lotus#9402](https://github.com/filecoin-project/lotus/pull/9402)) +- fix: bstore: Handle codecs correctly in membstore Get ([filecoin-project/lotus#9471](https://github.com/filecoin-project/lotus/pull/9471)) +- fix: not multiplied by the number of seconds ([filecoin-project/lotus#9460](https://github.com/filecoin-project/lotus/pull/9460)) +- Makefile: Drop rarely used binaries from build-devnets (#9513) ([filecoin-project/lotus#9513](https://github.com/filecoin-project/lotus/pull/9513)) +- _ci_ Remove unneeded homebrew deps ([filecoin-project/lotus#9559](https://github.com/filecoin-project/lotus/pull/9559)) +- _ci_: Have apt-get wait until it can get a lock in packer builds ([filecoin-project/lotus#9534](https://github.com/filecoin-project/lotus/pull/9534)) +- _ci_ Appimage go1.18.1 fix ([filecoin-project/lotus#9496](https://github.com/filecoin-project/lotus/pull/9496)) +- _ci_: Fix failing Digital Ocean and Amazon Machine Image release process ([filecoin-project/lotus#9425](https://github.com/filecoin-project/lotus/pull/9425)) +- _ci_: Don't publish new homebrew releases for RC builds ([filecoin-project/lotus#9350](https://github.com/filecoin-project/lotus/pull/9350)) +- _ci_: Use golang 1.18.1 to build appimage ([filecoin-project/lotus#9386](https://github.com/filecoin-project/lotus/pull/9386)) +- _ci_ Refactor release pipeline to better support m1 builds ([filecoin-project/lotus#9600](https://github.com/filecoin-project/lotus/pull/9600)) +- _ci_: Rely on local env varibale instead of context ([filecoin-project/lotus#9740](https://github.com/filecoin-project/lotus/pull/9740)) +- feat: shed: FIP0036 post poll result processing ([filecoin-project/lotus#9387](https://github.com/filecoin-project/lotus/pull/9387)) +- misc: github: Cleanup PR template ([filecoin-project/lotus#9472](https://github.com/filecoin-project/lotus/pull/9472)) +- docs: release template: Mention codegen in release prep ([filecoin-project/lotus#9430](https://github.com/filecoin-project/lotus/pull/9430)) +- chore: merge releases (v1.17.2) into master ([filecoin-project/lotus#9433](https://github.com/filecoin-project/lotus/pull/9433)) +- chore: merge release/v1.18.0 into master ([filecoin-project/lotus#9597](https://github.com/filecoin-project/lotus/pull/9597)) +- chore:shed: Teach shed/sim to understand --tipset=@nnn notation ([filecoin-project/lotus#9434](https://github.com/filecoin-project/lotus/pull/9434)) +- _chore_: Upgrade `hid` ([filecoin-project/lotus#9406](https://github.com/filecoin-project/lotus/pull/9406)) +- chore: release: Update `release_issue_template` ([filecoin-project/lotus#9150](https://github.com/filecoin-project/lotus/pull/9150)) +- chore: update lotus version to 1.19.0-rc1 +- chore: merge release into master ([filecoin-project/lotus#9657](https://github.com/filecoin-project/lotus/pull/9657)) +- Backport: #9061 rpc errors ([filecoin-project/lotus#9384](https://github.com/filecoin-project/lotus/pull/9384)) +- shed: util: get all msig ([filecoin-project/lotus#9322](https://github.com/filecoin-project/lotus/pull/9322)) +- fix: test: simplify TestDeadlineToggling ([filecoin-project/lotus#9356](https://github.com/filecoin-project/lotus/pull/9356)) +- fix: build: set PropagationDelaySecs correctly ([filecoin-project/lotus#9358](https://github.com/filecoin-project/lotus/pull/9358)) +- fix: test: flaky TestDeadlineToggling around nulls (#9354) ([filecoin-project/lotus#9354](https://github.com/filecoin-project/lotus/pull/9354)) +- fix: retrievals: price-per-byte calculation fix ([filecoin-project/lotus#9353](https://github.com/filecoin-project/lotus/pull/9353)) +- fix: docs: update Go-badge in readme ([filecoin-project/lotus#9347](https://github.com/filecoin-project/lotus/pull/9347)) +- docs: release template: clarify location of version.go ([filecoin-project/lotus#9338](https://github.com/filecoin-project/lotus/pull/9338)) +- build: Bump version to v1.17.3-dev ([filecoin-project/lotus#9337](https://github.com/filecoin-project/lotus/pull/9337)) +- github.com/filecoin-project/go-fil-markets (v1.24.0-v17 -> v1.25.0): +- Merge branch 'release/v1.24.3' +- Update ffi and update markets to v9 (#751) (#761) ([filecoin-project/go-fil-markets#761](https://github.com/filecoin-project/go-fil-markets/pull/761)) +- chore: extract Provider piece logic to separate file (#750) ([filecoin-project/go-fil-markets#750](https://github.com/filecoin-project/go-fil-markets/pull/750)) +- Merge branch 'release/v1.24.2' +- Feat/support custom metadata (#759) ([filecoin-project/go-fil-markets#759](https://github.com/filecoin-project/go-fil-markets/pull/759)) +- Revert "Update ffi and update markets to v9 (#751)" (#755) ([filecoin-project/go-fil-markets#755](https://github.com/filecoin-project/go-fil-markets/pull/755)) +- Update ffi and update markets to v9 (#751) ([filecoin-project/go-fil-markets#751](https://github.com/filecoin-project/go-fil-markets/pull/751)) +- release: v1.24.0 ([filecoin-project/go-fil-markets#745](https://github.com/filecoin-project/go-fil-markets/pull/745)) +- github.com/filecoin-project/go-state-types (v0.9.8 -> v0.9.9): + +## lotus-market EOL notice + +As mentioned in [lotus v1.17.0 release notes](https://github.com/filecoin-project/lotus/releases/tag/v1.17.0), markets related features, enhancements and fixes is now lower priority for Lotus. We recommend our users to migrate to other deal making focused software, like [boost](https://boost.filecoin.io/) as soon as possible. That being said, the lotus maintainers will be: +- Lotus maintainers will stop supporting lotus-market subcomponent/**storage** deal making related issues or enhancements on Jan 31, 2023. +- In Q2 2023, we will be deprecating/removing lotus-market related code from this repository. + +If you have any questions or concerns, please raise them in [Lotus discussion](https://github.com/filecoin-project/lotus/discussions/categories/market)! + +## Contributors + +| Contributor | Commits | Lines ± | Files Changed | +|-------------|---------|---------|---------------| +| Geoff Stuart | 69 | +4745/-19478 | 405 | +| Shrenuj Bansal | 39 | +5257/-2183 | 243 | +| Łukasz Magiera | 32 | +2763/-730 | 169 | +| Aayush | 47 | +1439/-1138 | 157 | +| Ian Davis | 21 | +556/-1065 | 41 | +| Rod Vagg | 5 | +657/-320 | 18 | +| jennijuju | 4 | +632/-317 | 6 | +| Aayush Rajasekaran | 13 | +700/-135 | 18 | +| Jennifer Wang | 14 | +740/-54 | 25 | +| ZenGround0 | 1 | +193/-195 | 14 | +| Hannah Howard | 4 | +138/-122 | 52 | +| Steven Allen | 4 | +105/-24 | 11 | +| zenground0 | 9 | +109/-16 | 14 | +| Peter Rabbitson | 1 | +27/-23 | 3 | +| hannahhoward | 2 | +49/-0 | 2 | +| Airenas Vaičiūnas | 2 | +31/-16 | 2 | +| simlecode | 6 | +19/-10 | 12 | +| Phi | 5 | +16/-10 | 7 | +| sectrgt | 2 | +18/-0 | 2 | +| Jiaying Wang | 2 | +4/-4 | 3 | +| Rob Quist | 1 | +3/-1 | 1 | +| Jakub Sztandera | 1 | +1/-1 | 1 | + +# 1.18.2 / 2022-12-10 + +This is an OPTIONAL patch release that fixes a recently reported bug, where the miner process crashes due to a panic during an AddPiece process. More details can be found [here](https://github.com/filecoin-project/lotus/pull/9822). + + # 1.18.1 / 2022-11-28 This is a small OPTIONAL patch release for the mandatory v1.18.0 release that supports the Filecoin nv17 Shark Upgrade. From e1926a06e8589fd9489c863e943a5d44f5a88601 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 13 Dec 2022 11:49:22 -0500 Subject: [PATCH 71/76] Use abi.MethodNum instead of uint64 for method nums --- chain/actors/builtin/registry.go | 9 +++++---- chain/actors/builtin/registry.go.template | 9 +++++---- chain/vm/invoker.go | 10 +++++----- go.mod | 2 +- go.sum | 4 ++-- 5 files changed, 18 insertions(+), 16 deletions(-) diff --git a/chain/actors/builtin/registry.go b/chain/actors/builtin/registry.go index 73c9c117f..6b47b0fc7 100644 --- a/chain/actors/builtin/registry.go +++ b/chain/actors/builtin/registry.go @@ -7,6 +7,7 @@ import ( "github.com/ipfs/go-cid" + "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/builtin" account10 "github.com/filecoin-project/go-state-types/builtin/v10/account" @@ -53,14 +54,14 @@ import ( type RegistryEntry struct { state cbor.Er code cid.Cid - methods map[uint64]builtin.MethodMeta + methods map[abi.MethodNum]builtin.MethodMeta } func (r RegistryEntry) State() cbor.Er { return r.state } -func (r RegistryEntry) Exports() map[uint64]builtin.MethodMeta { +func (r RegistryEntry) Exports() map[abi.MethodNum]builtin.MethodMeta { return r.methods } @@ -72,10 +73,10 @@ func MakeRegistryLegacy(actors []rtt.VMActor) []RegistryEntry { registry := make([]RegistryEntry, 0) for _, actor := range actors { - methodMap := make(map[uint64]builtin.MethodMeta) + methodMap := make(map[abi.MethodNum]builtin.MethodMeta) for methodNum, method := range actor.Exports() { if method != nil { - methodMap[uint64(methodNum)] = makeMethodMeta(method) + methodMap[abi.MethodNum(methodNum)] = makeMethodMeta(method) } } registry = append(registry, RegistryEntry{ diff --git a/chain/actors/builtin/registry.go.template b/chain/actors/builtin/registry.go.template index 39211c476..0eb061297 100644 --- a/chain/actors/builtin/registry.go.template +++ b/chain/actors/builtin/registry.go.template @@ -29,19 +29,20 @@ import ( "github.com/filecoin-project/go-state-types/cbor" rtt "github.com/filecoin-project/go-state-types/rt" "github.com/filecoin-project/lotus/chain/actors" + "github.com/filecoin-project/go-state-types/abi" ) type RegistryEntry struct { state cbor.Er code cid.Cid - methods map[uint64]builtin.MethodMeta + methods map[abi.MethodNum]builtin.MethodMeta } func (r RegistryEntry) State() cbor.Er { return r.state } -func (r RegistryEntry) Exports() map[uint64]builtin.MethodMeta { +func (r RegistryEntry) Exports() map[abi.MethodNum]builtin.MethodMeta { return r.methods } @@ -53,10 +54,10 @@ func MakeRegistryLegacy(actors []rtt.VMActor) []RegistryEntry { registry := make([]RegistryEntry, 0) for _, actor := range actors { - methodMap := make(map[uint64]builtin.MethodMeta) + methodMap := make(map[abi.MethodNum]builtin.MethodMeta) for methodNum, method := range actor.Exports() { if method != nil { - methodMap[uint64(methodNum)] = makeMethodMeta(method) + methodMap[abi.MethodNum(methodNum)] = makeMethodMeta(method) } } registry = append(registry, RegistryEntry{ diff --git a/chain/vm/invoker.go b/chain/vm/invoker.go index bcd81995f..a97a454bf 100644 --- a/chain/vm/invoker.go +++ b/chain/vm/invoker.go @@ -53,7 +53,7 @@ func ActorsVersionPredicate(ver actorstypes.Version) ActorPredicate { } type invokeFunc func(rt vmr.Runtime, params []byte) ([]byte, aerrors.ActorError) -type nativeCode map[uint64]invokeFunc +type nativeCode map[abi.MethodNum]invokeFunc type actorInfo struct { methods nativeCode @@ -78,10 +78,10 @@ func (ar *ActorRegistry) Invoke(codeCid cid.Cid, rt vmr.Runtime, method abi.Meth if err := act.predicate(rt, codeCid); err != nil { return nil, aerrors.Newf(exitcode.SysErrorIllegalActor, "unsupported actor: %s", err) } - if act.methods[uint64(method)] == nil { + if act.methods[method] == nil { return nil, aerrors.Newf(exitcode.SysErrInvalidMethod, "no method %d on actor", method) } - return act.methods[uint64(method)](rt, params) + return act.methods[method](rt, params) } @@ -156,7 +156,7 @@ func (ar *ActorRegistry) Register(av actorstypes.Version, pred ActorPredicate, v mm.Params = et.In(0) } - methods[abi.MethodNum(number)] = mm + methods[number] = mm } if realCode.Defined() { ar.Methods[realCode] = methods @@ -185,7 +185,7 @@ func (ar *ActorRegistry) Create(codeCid cid.Cid, rt vmr.Runtime) (*types.Actor, } type invokee interface { - Exports() map[uint64]builtinst.MethodMeta + Exports() map[abi.MethodNum]builtinst.MethodMeta } func (*ActorRegistry) transform(instance invokee) (nativeCode, error) { diff --git a/go.mod b/go.mod index 21b18674e..7ceb685cc 100644 --- a/go.mod +++ b/go.mod @@ -43,7 +43,7 @@ require ( github.com/filecoin-project/go-legs v0.4.4 github.com/filecoin-project/go-padreader v0.0.1 github.com/filecoin-project/go-paramfetch v0.0.4 - github.com/filecoin-project/go-state-types v0.10.0-alpha-3 + github.com/filecoin-project/go-state-types v0.10.0-alpha-4 github.com/filecoin-project/go-statemachine v1.0.2 github.com/filecoin-project/go-statestore v0.2.0 github.com/filecoin-project/go-storedcounter v0.1.0 diff --git a/go.sum b/go.sum index 3e1b1fe77..5a326ae47 100644 --- a/go.sum +++ b/go.sum @@ -356,8 +356,8 @@ github.com/filecoin-project/go-state-types v0.1.0/go.mod h1:ezYnPf0bNkTsDibL/psS github.com/filecoin-project/go-state-types v0.1.6/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q= github.com/filecoin-project/go-state-types v0.1.8/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q= github.com/filecoin-project/go-state-types v0.1.10/go.mod h1:UwGVoMsULoCK+bWjEdd/xLCvLAQFBC7EDT477SKml+Q= -github.com/filecoin-project/go-state-types v0.10.0-alpha-3 h1:8iM9uz+rWRbrg1Zet+YlTJN4XEPNqRkqa3zay2pwV7w= -github.com/filecoin-project/go-state-types v0.10.0-alpha-3/go.mod h1:FPgQE05BFwZxKw/vCuIaIrzfJKo4RPQQMMPGd43dAFI= +github.com/filecoin-project/go-state-types v0.10.0-alpha-4 h1:qFuw0C+ShmpyRTpJIYAB+u11F6fYqI/4vU138EFc3ps= +github.com/filecoin-project/go-state-types v0.10.0-alpha-4/go.mod h1:FPgQE05BFwZxKw/vCuIaIrzfJKo4RPQQMMPGd43dAFI= github.com/filecoin-project/go-statemachine v0.0.0-20200925024713-05bd7c71fbfe/go.mod h1:FGwQgZAt2Gh5mjlwJUlVB62JeYdo+if0xWxSEfBD9ig= github.com/filecoin-project/go-statemachine v1.0.2 h1:421SSWBk8GIoCoWYYTE/d+qCWccgmRH0uXotXRDjUbc= github.com/filecoin-project/go-statemachine v1.0.2/go.mod h1:jZdXXiHa61n4NmgWFG4w8tnqgvZVHYbJ3yW7+y8bF54= From ae4010ffb6d48b6c87647ee75c3b715dcf469698 Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Tue, 13 Dec 2022 18:02:34 -0500 Subject: [PATCH 72/76] Drop actor keys from chain/actors/manifest.go --- build/builtin_actors_test.go | 3 +- chain/actors/actor_cids.go | 25 +++---- chain/actors/builtin/account/account.go | 3 +- .../actors/builtin/account/actor.go.template | 3 +- .../actors/builtin/account/state.go.template | 3 +- chain/actors/builtin/account/v0.go | 3 +- chain/actors/builtin/account/v10.go | 3 +- chain/actors/builtin/account/v2.go | 3 +- chain/actors/builtin/account/v3.go | 3 +- chain/actors/builtin/account/v4.go | 3 +- chain/actors/builtin/account/v5.go | 3 +- chain/actors/builtin/account/v6.go | 3 +- chain/actors/builtin/account/v7.go | 3 +- chain/actors/builtin/account/v8.go | 3 +- chain/actors/builtin/account/v9.go | 3 +- chain/actors/builtin/builtin.go | 5 +- chain/actors/builtin/builtin.go.template | 5 +- chain/actors/builtin/cron/actor.go.template | 3 +- chain/actors/builtin/cron/cron.go | 3 +- chain/actors/builtin/cron/state.go.template | 3 +- chain/actors/builtin/cron/v0.go | 3 +- chain/actors/builtin/cron/v10.go | 3 +- chain/actors/builtin/cron/v2.go | 3 +- chain/actors/builtin/cron/v3.go | 3 +- chain/actors/builtin/cron/v4.go | 3 +- chain/actors/builtin/cron/v5.go | 3 +- chain/actors/builtin/cron/v6.go | 3 +- chain/actors/builtin/cron/v7.go | 3 +- chain/actors/builtin/cron/v8.go | 3 +- chain/actors/builtin/cron/v9.go | 3 +- .../actors/builtin/datacap/actor.go.template | 3 +- chain/actors/builtin/datacap/datacap.go | 3 +- .../actors/builtin/datacap/state.go.template | 3 +- chain/actors/builtin/datacap/v10.go | 3 +- chain/actors/builtin/datacap/v9.go | 3 +- chain/actors/builtin/evm/actor.go.template | 3 +- chain/actors/builtin/evm/evm.go | 3 +- chain/actors/builtin/init/actor.go.template | 3 +- chain/actors/builtin/init/init.go | 3 +- chain/actors/builtin/init/state.go.template | 3 +- chain/actors/builtin/init/v0.go | 3 +- chain/actors/builtin/init/v10.go | 3 +- chain/actors/builtin/init/v2.go | 3 +- chain/actors/builtin/init/v3.go | 3 +- chain/actors/builtin/init/v4.go | 3 +- chain/actors/builtin/init/v5.go | 3 +- chain/actors/builtin/init/v6.go | 3 +- chain/actors/builtin/init/v7.go | 3 +- chain/actors/builtin/init/v8.go | 3 +- chain/actors/builtin/init/v9.go | 3 +- chain/actors/builtin/market/actor.go.template | 3 +- chain/actors/builtin/market/market.go | 3 +- chain/actors/builtin/market/state.go.template | 3 +- chain/actors/builtin/market/v0.go | 3 +- chain/actors/builtin/market/v10.go | 3 +- chain/actors/builtin/market/v2.go | 3 +- chain/actors/builtin/market/v3.go | 3 +- chain/actors/builtin/market/v4.go | 3 +- chain/actors/builtin/market/v5.go | 3 +- chain/actors/builtin/market/v6.go | 3 +- chain/actors/builtin/market/v7.go | 3 +- chain/actors/builtin/market/v8.go | 3 +- chain/actors/builtin/market/v9.go | 3 +- chain/actors/builtin/miner/actor.go.template | 3 +- chain/actors/builtin/miner/miner.go | 3 +- chain/actors/builtin/miner/state.go.template | 3 +- chain/actors/builtin/miner/v0.go | 3 +- chain/actors/builtin/miner/v10.go | 3 +- chain/actors/builtin/miner/v2.go | 3 +- chain/actors/builtin/miner/v3.go | 3 +- chain/actors/builtin/miner/v4.go | 3 +- chain/actors/builtin/miner/v5.go | 3 +- chain/actors/builtin/miner/v6.go | 3 +- chain/actors/builtin/miner/v7.go | 3 +- chain/actors/builtin/miner/v8.go | 3 +- chain/actors/builtin/miner/v9.go | 3 +- .../actors/builtin/multisig/actor.go.template | 3 +- .../builtin/multisig/message.go.template | 3 +- chain/actors/builtin/multisig/message10.go | 3 +- chain/actors/builtin/multisig/message8.go | 3 +- chain/actors/builtin/multisig/message9.go | 3 +- chain/actors/builtin/multisig/multisig.go | 3 +- .../actors/builtin/multisig/state.go.template | 3 +- chain/actors/builtin/multisig/v0.go | 3 +- chain/actors/builtin/multisig/v10.go | 3 +- chain/actors/builtin/multisig/v2.go | 3 +- chain/actors/builtin/multisig/v3.go | 3 +- chain/actors/builtin/multisig/v4.go | 3 +- chain/actors/builtin/multisig/v5.go | 3 +- chain/actors/builtin/multisig/v6.go | 3 +- chain/actors/builtin/multisig/v7.go | 3 +- chain/actors/builtin/multisig/v8.go | 3 +- chain/actors/builtin/multisig/v9.go | 3 +- chain/actors/builtin/paych/actor.go.template | 3 +- chain/actors/builtin/paych/mock/mock.go | 4 +- chain/actors/builtin/paych/paych.go | 3 +- chain/actors/builtin/paych/state.go.template | 3 +- chain/actors/builtin/paych/v0.go | 3 +- chain/actors/builtin/paych/v10.go | 3 +- chain/actors/builtin/paych/v2.go | 3 +- chain/actors/builtin/paych/v3.go | 3 +- chain/actors/builtin/paych/v4.go | 3 +- chain/actors/builtin/paych/v5.go | 3 +- chain/actors/builtin/paych/v6.go | 3 +- chain/actors/builtin/paych/v7.go | 3 +- chain/actors/builtin/paych/v8.go | 3 +- chain/actors/builtin/paych/v9.go | 3 +- chain/actors/builtin/power/actor.go.template | 3 +- chain/actors/builtin/power/power.go | 3 +- chain/actors/builtin/power/state.go.template | 3 +- chain/actors/builtin/power/v0.go | 3 +- chain/actors/builtin/power/v10.go | 3 +- chain/actors/builtin/power/v2.go | 3 +- chain/actors/builtin/power/v3.go | 3 +- chain/actors/builtin/power/v4.go | 3 +- chain/actors/builtin/power/v5.go | 3 +- chain/actors/builtin/power/v6.go | 3 +- chain/actors/builtin/power/v7.go | 3 +- chain/actors/builtin/power/v8.go | 3 +- chain/actors/builtin/power/v9.go | 3 +- chain/actors/builtin/registry.go | 71 ++++++++++--------- chain/actors/builtin/registry.go.template | 25 +++---- chain/actors/builtin/reward/actor.go.template | 3 +- chain/actors/builtin/reward/reward.go | 3 +- chain/actors/builtin/reward/state.go.template | 3 +- chain/actors/builtin/reward/v0.go | 3 +- chain/actors/builtin/reward/v10.go | 3 +- chain/actors/builtin/reward/v2.go | 3 +- chain/actors/builtin/reward/v3.go | 3 +- chain/actors/builtin/reward/v4.go | 3 +- chain/actors/builtin/reward/v5.go | 3 +- chain/actors/builtin/reward/v6.go | 3 +- chain/actors/builtin/reward/v7.go | 3 +- chain/actors/builtin/reward/v8.go | 3 +- chain/actors/builtin/reward/v9.go | 3 +- chain/actors/builtin/system/actor.go.template | 3 +- chain/actors/builtin/system/state.go.template | 3 +- chain/actors/builtin/system/system.go | 3 +- chain/actors/builtin/system/v0.go | 3 +- chain/actors/builtin/system/v10.go | 3 +- chain/actors/builtin/system/v2.go | 3 +- chain/actors/builtin/system/v3.go | 3 +- chain/actors/builtin/system/v4.go | 3 +- chain/actors/builtin/system/v5.go | 3 +- chain/actors/builtin/system/v6.go | 3 +- chain/actors/builtin/system/v7.go | 3 +- chain/actors/builtin/system/v8.go | 3 +- chain/actors/builtin/system/v9.go | 3 +- .../actors/builtin/verifreg/actor.go.template | 3 +- .../actors/builtin/verifreg/state.go.template | 3 +- chain/actors/builtin/verifreg/v0.go | 3 +- chain/actors/builtin/verifreg/v10.go | 3 +- chain/actors/builtin/verifreg/v2.go | 3 +- chain/actors/builtin/verifreg/v3.go | 3 +- chain/actors/builtin/verifreg/v4.go | 3 +- chain/actors/builtin/verifreg/v5.go | 3 +- chain/actors/builtin/verifreg/v6.go | 3 +- chain/actors/builtin/verifreg/v7.go | 3 +- chain/actors/builtin/verifreg/v8.go | 3 +- chain/actors/builtin/verifreg/v9.go | 3 +- chain/actors/builtin/verifreg/verifreg.go | 3 +- chain/actors/manifest.go | 47 +----------- chain/consensus/filcns/upgrades.go | 4 +- chain/gen/genesis/f00_system.go | 2 +- chain/gen/genesis/f01_init.go | 3 +- chain/gen/genesis/f02_reward.go | 3 +- chain/gen/genesis/f03_cron.go | 3 +- chain/gen/genesis/f04_power.go | 3 +- chain/gen/genesis/f05_market.go | 3 +- chain/gen/genesis/f06_vreg.go | 3 +- chain/gen/genesis/f07_dcap.go | 3 +- chain/gen/genesis/genesis.go | 5 +- chain/vm/fvm.go | 3 +- cmd/lotus-shed/migrations.go | 3 +- itests/lite_migration_test.go | 3 +- storage/wdpost/wdpost_run_test.go | 3 +- 176 files changed, 410 insertions(+), 281 deletions(-) diff --git a/build/builtin_actors_test.go b/build/builtin_actors_test.go index 384193fee..858a8b3a1 100644 --- a/build/builtin_actors_test.go +++ b/build/builtin_actors_test.go @@ -6,6 +6,7 @@ import ( "github.com/stretchr/testify/require" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/actors" @@ -26,7 +27,7 @@ func TestRegistration(t *testing.T) { require.True(t, found) require.True(t, manifestCid.Defined()) - for _, key := range actors.GetBuiltinActorsKeys(av) { + for _, key := range manifest.GetBuiltinActorsKeys(av) { actorCid, found := actors.GetActorCodeID(av, key) require.True(t, found) name, version, found := actors.GetActorMetaByCode(actorCid) diff --git a/chain/actors/actor_cids.go b/chain/actors/actor_cids.go index 042426801..ad9ae4909 100644 --- a/chain/actors/actor_cids.go +++ b/chain/actors/actor_cids.go @@ -5,6 +5,7 @@ import ( "golang.org/x/xerrors" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin" @@ -28,7 +29,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { // Actors V7 and lower switch name { - case AccountKey: + case manifest.AccountKey: switch av { case actorstypes.Version0: @@ -53,7 +54,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { return builtin7.AccountActorCodeID, true } - case CronKey: + case manifest.CronKey: switch av { case actorstypes.Version0: @@ -78,7 +79,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { return builtin7.CronActorCodeID, true } - case InitKey: + case manifest.InitKey: switch av { case actorstypes.Version0: @@ -103,7 +104,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { return builtin7.InitActorCodeID, true } - case MarketKey: + case manifest.MarketKey: switch av { case actorstypes.Version0: @@ -128,7 +129,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { return builtin7.StorageMarketActorCodeID, true } - case MinerKey: + case manifest.MinerKey: switch av { case actorstypes.Version0: @@ -153,7 +154,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { return builtin7.StorageMinerActorCodeID, true } - case MultisigKey: + case manifest.MultisigKey: switch av { case actorstypes.Version0: @@ -178,7 +179,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { return builtin7.MultisigActorCodeID, true } - case PaychKey: + case manifest.PaychKey: switch av { case actorstypes.Version0: @@ -203,7 +204,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { return builtin7.PaymentChannelActorCodeID, true } - case PowerKey: + case manifest.PowerKey: switch av { case actorstypes.Version0: @@ -228,7 +229,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { return builtin7.StoragePowerActorCodeID, true } - case RewardKey: + case manifest.RewardKey: switch av { case actorstypes.Version0: @@ -253,7 +254,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { return builtin7.RewardActorCodeID, true } - case SystemKey: + case manifest.SystemKey: switch av { case actorstypes.Version0: @@ -278,7 +279,7 @@ func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) { return builtin7.SystemActorCodeID, true } - case VerifregKey: + case manifest.VerifregKey: switch av { case actorstypes.Version0: @@ -314,7 +315,7 @@ func GetActorCodeIDs(av actorstypes.Version) (map[string]cid.Cid, error) { return cids, nil } - actorsKeys := GetBuiltinActorsKeys(av) + actorsKeys := manifest.GetBuiltinActorsKeys(av) synthCids := make(map[string]cid.Cid) for _, key := range actorsKeys { diff --git a/chain/actors/builtin/account/account.go b/chain/actors/builtin/account/account.go index 5a2d55961..4542ad767 100644 --- a/chain/actors/builtin/account/account.go +++ b/chain/actors/builtin/account/account.go @@ -8,6 +8,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" builtin10 "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin" @@ -25,7 +26,7 @@ var Methods = builtin10.MethodsAccount func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.AccountKey { + if name != manifest.AccountKey { return nil, xerrors.Errorf("actor code is not account: %s", name) } diff --git a/chain/actors/builtin/account/actor.go.template b/chain/actors/builtin/account/actor.go.template index ef6e7ac3d..2db38eff6 100644 --- a/chain/actors/builtin/account/actor.go.template +++ b/chain/actors/builtin/account/actor.go.template @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/go-state-types/manifest" {{range .versions}} {{if (le . 7)}} @@ -24,7 +25,7 @@ var Methods = builtin{{.latestVersion}}.MethodsAccount func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.AccountKey { + if name != manifest.AccountKey { return nil, xerrors.Errorf("actor code is not account: %s", name) } diff --git a/chain/actors/builtin/account/state.go.template b/chain/actors/builtin/account/state.go.template index 9b623519d..55a56de8c 100644 --- a/chain/actors/builtin/account/state.go.template +++ b/chain/actors/builtin/account/state.go.template @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors" + "github.com/filecoin-project/go-state-types/manifest" {{if (le .v 7)}} account{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/account" @@ -48,7 +49,7 @@ func (s *state{{.v}}) GetState() interface{} { } func (s *state{{.v}}) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/account/v0.go b/chain/actors/builtin/account/v0.go index f6af2c79c..a41ee3879 100644 --- a/chain/actors/builtin/account/v0.go +++ b/chain/actors/builtin/account/v0.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" account0 "github.com/filecoin-project/specs-actors/actors/builtin/account" "github.com/filecoin-project/lotus/chain/actors" @@ -44,7 +45,7 @@ func (s *state0) GetState() interface{} { } func (s *state0) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/account/v10.go b/chain/actors/builtin/account/v10.go index dbe7c609e..ff87c4212 100644 --- a/chain/actors/builtin/account/v10.go +++ b/chain/actors/builtin/account/v10.go @@ -8,6 +8,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" account10 "github.com/filecoin-project/go-state-types/builtin/v10/account" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -44,7 +45,7 @@ func (s *state10) GetState() interface{} { } func (s *state10) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/account/v2.go b/chain/actors/builtin/account/v2.go index 5e2297b4a..db0af77e2 100644 --- a/chain/actors/builtin/account/v2.go +++ b/chain/actors/builtin/account/v2.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" account2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/account" "github.com/filecoin-project/lotus/chain/actors" @@ -44,7 +45,7 @@ func (s *state2) GetState() interface{} { } func (s *state2) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/account/v3.go b/chain/actors/builtin/account/v3.go index 4e142bcf7..9e6c71ad0 100644 --- a/chain/actors/builtin/account/v3.go +++ b/chain/actors/builtin/account/v3.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" account3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/account" "github.com/filecoin-project/lotus/chain/actors" @@ -44,7 +45,7 @@ func (s *state3) GetState() interface{} { } func (s *state3) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/account/v4.go b/chain/actors/builtin/account/v4.go index 7b1e7f0dd..907896312 100644 --- a/chain/actors/builtin/account/v4.go +++ b/chain/actors/builtin/account/v4.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" account4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/account" "github.com/filecoin-project/lotus/chain/actors" @@ -44,7 +45,7 @@ func (s *state4) GetState() interface{} { } func (s *state4) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/account/v5.go b/chain/actors/builtin/account/v5.go index ad8bed522..8514ab325 100644 --- a/chain/actors/builtin/account/v5.go +++ b/chain/actors/builtin/account/v5.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" account5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/account" "github.com/filecoin-project/lotus/chain/actors" @@ -44,7 +45,7 @@ func (s *state5) GetState() interface{} { } func (s *state5) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/account/v6.go b/chain/actors/builtin/account/v6.go index 74c959c5f..16369f38c 100644 --- a/chain/actors/builtin/account/v6.go +++ b/chain/actors/builtin/account/v6.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" account6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/account" "github.com/filecoin-project/lotus/chain/actors" @@ -44,7 +45,7 @@ func (s *state6) GetState() interface{} { } func (s *state6) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/account/v7.go b/chain/actors/builtin/account/v7.go index 24d259f33..cd420da92 100644 --- a/chain/actors/builtin/account/v7.go +++ b/chain/actors/builtin/account/v7.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" account7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/account" "github.com/filecoin-project/lotus/chain/actors" @@ -44,7 +45,7 @@ func (s *state7) GetState() interface{} { } func (s *state7) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/account/v8.go b/chain/actors/builtin/account/v8.go index 2a4a74ca4..13b478de8 100644 --- a/chain/actors/builtin/account/v8.go +++ b/chain/actors/builtin/account/v8.go @@ -8,6 +8,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" account8 "github.com/filecoin-project/go-state-types/builtin/v8/account" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -44,7 +45,7 @@ func (s *state8) GetState() interface{} { } func (s *state8) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/account/v9.go b/chain/actors/builtin/account/v9.go index 97bcd43d7..fc1fc4d14 100644 --- a/chain/actors/builtin/account/v9.go +++ b/chain/actors/builtin/account/v9.go @@ -8,6 +8,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" account9 "github.com/filecoin-project/go-state-types/builtin/v9/account" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -44,7 +45,7 @@ func (s *state9) GetState() interface{} { } func (s *state9) ActorKey() string { - return actors.AccountKey + return manifest.AccountKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/builtin.go b/chain/actors/builtin/builtin.go index 82e80365a..7811aab6c 100644 --- a/chain/actors/builtin/builtin.go +++ b/chain/actors/builtin/builtin.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-state-types/builtin" smoothingtypes "github.com/filecoin-project/go-state-types/builtin/v8/util/smoothing" minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/go-state-types/proof" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" @@ -165,7 +166,7 @@ func IsAccountActor(c cid.Cid) bool { func IsStorageMinerActor(c cid.Cid) bool { name, _, ok := actors.GetActorMetaByCode(c) if ok { - return name == actors.MinerKey + return name == manifest.MinerKey } if c == builtin0.StorageMinerActorCodeID { @@ -202,7 +203,7 @@ func IsStorageMinerActor(c cid.Cid) bool { func IsMultisigActor(c cid.Cid) bool { name, _, ok := actors.GetActorMetaByCode(c) if ok { - return name == actors.MultisigKey + return name == manifest.MultisigKey } if c == builtin0.MultisigActorCodeID { diff --git a/chain/actors/builtin/builtin.go.template b/chain/actors/builtin/builtin.go.template index 825f6cc07..766279451 100644 --- a/chain/actors/builtin/builtin.go.template +++ b/chain/actors/builtin/builtin.go.template @@ -15,6 +15,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/proof" "github.com/filecoin-project/go-state-types/builtin" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" @@ -107,7 +108,7 @@ func IsAccountActor(c cid.Cid) bool { func IsStorageMinerActor(c cid.Cid) bool { name, _, ok := actors.GetActorMetaByCode(c) if ok { - return name == actors.MinerKey + return name == manifest.MinerKey } {{range .versions}} @@ -123,7 +124,7 @@ func IsStorageMinerActor(c cid.Cid) bool { func IsMultisigActor(c cid.Cid) bool { name, _, ok := actors.GetActorMetaByCode(c) if ok { - return name == actors.MultisigKey + return name == manifest.MultisigKey } {{range .versions}} diff --git a/chain/actors/builtin/cron/actor.go.template b/chain/actors/builtin/cron/actor.go.template index 3abb33e63..7e01483d2 100644 --- a/chain/actors/builtin/cron/actor.go.template +++ b/chain/actors/builtin/cron/actor.go.template @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "golang.org/x/xerrors" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/go-state-types/manifest" {{range .versions}} {{if (le . 7)}} @@ -18,7 +19,7 @@ import ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.CronKey { + if name != manifest.CronKey { return nil, xerrors.Errorf("actor code is not cron: %s", name) } diff --git a/chain/actors/builtin/cron/cron.go b/chain/actors/builtin/cron/cron.go index 3f573789a..43b8c0eaa 100644 --- a/chain/actors/builtin/cron/cron.go +++ b/chain/actors/builtin/cron/cron.go @@ -6,6 +6,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" builtin10 "github.com/filecoin-project/go-state-types/builtin" + "github.com/filecoin-project/go-state-types/manifest" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin" @@ -21,7 +22,7 @@ import ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.CronKey { + if name != manifest.CronKey { return nil, xerrors.Errorf("actor code is not cron: %s", name) } diff --git a/chain/actors/builtin/cron/state.go.template b/chain/actors/builtin/cron/state.go.template index 24739f162..ca82d8be8 100644 --- a/chain/actors/builtin/cron/state.go.template +++ b/chain/actors/builtin/cron/state.go.template @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" {{if (le .v 7)}} cron{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/cron" @@ -42,7 +43,7 @@ func (s *state{{.v}}) GetState() interface{} { } func (s *state{{.v}}) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/cron/v0.go b/chain/actors/builtin/cron/v0.go index ef5f6d93e..6dce524f6 100644 --- a/chain/actors/builtin/cron/v0.go +++ b/chain/actors/builtin/cron/v0.go @@ -6,6 +6,7 @@ import ( "github.com/ipfs/go-cid" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" cron0 "github.com/filecoin-project/specs-actors/actors/builtin/cron" "github.com/filecoin-project/lotus/chain/actors" @@ -39,7 +40,7 @@ func (s *state0) GetState() interface{} { } func (s *state0) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/cron/v10.go b/chain/actors/builtin/cron/v10.go index 4e2e1c815..2d20e2401 100644 --- a/chain/actors/builtin/cron/v10.go +++ b/chain/actors/builtin/cron/v10.go @@ -7,6 +7,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" cron10 "github.com/filecoin-project/go-state-types/builtin/v10/cron" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -39,7 +40,7 @@ func (s *state10) GetState() interface{} { } func (s *state10) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/cron/v2.go b/chain/actors/builtin/cron/v2.go index fc45be0de..97b3ffbe0 100644 --- a/chain/actors/builtin/cron/v2.go +++ b/chain/actors/builtin/cron/v2.go @@ -6,6 +6,7 @@ import ( "github.com/ipfs/go-cid" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" cron2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/cron" "github.com/filecoin-project/lotus/chain/actors" @@ -39,7 +40,7 @@ func (s *state2) GetState() interface{} { } func (s *state2) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/cron/v3.go b/chain/actors/builtin/cron/v3.go index 6f8e66a3b..4c0d4f1d9 100644 --- a/chain/actors/builtin/cron/v3.go +++ b/chain/actors/builtin/cron/v3.go @@ -6,6 +6,7 @@ import ( "github.com/ipfs/go-cid" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" cron3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/cron" "github.com/filecoin-project/lotus/chain/actors" @@ -39,7 +40,7 @@ func (s *state3) GetState() interface{} { } func (s *state3) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/cron/v4.go b/chain/actors/builtin/cron/v4.go index 2539f2b1c..a222f0d93 100644 --- a/chain/actors/builtin/cron/v4.go +++ b/chain/actors/builtin/cron/v4.go @@ -6,6 +6,7 @@ import ( "github.com/ipfs/go-cid" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" cron4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/cron" "github.com/filecoin-project/lotus/chain/actors" @@ -39,7 +40,7 @@ func (s *state4) GetState() interface{} { } func (s *state4) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/cron/v5.go b/chain/actors/builtin/cron/v5.go index 8aba47a2b..2487cbbc6 100644 --- a/chain/actors/builtin/cron/v5.go +++ b/chain/actors/builtin/cron/v5.go @@ -6,6 +6,7 @@ import ( "github.com/ipfs/go-cid" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" cron5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/cron" "github.com/filecoin-project/lotus/chain/actors" @@ -39,7 +40,7 @@ func (s *state5) GetState() interface{} { } func (s *state5) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/cron/v6.go b/chain/actors/builtin/cron/v6.go index f607a409f..673e7588a 100644 --- a/chain/actors/builtin/cron/v6.go +++ b/chain/actors/builtin/cron/v6.go @@ -6,6 +6,7 @@ import ( "github.com/ipfs/go-cid" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" cron6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/cron" "github.com/filecoin-project/lotus/chain/actors" @@ -39,7 +40,7 @@ func (s *state6) GetState() interface{} { } func (s *state6) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/cron/v7.go b/chain/actors/builtin/cron/v7.go index ef962fd41..cd71bd418 100644 --- a/chain/actors/builtin/cron/v7.go +++ b/chain/actors/builtin/cron/v7.go @@ -6,6 +6,7 @@ import ( "github.com/ipfs/go-cid" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" cron7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/cron" "github.com/filecoin-project/lotus/chain/actors" @@ -39,7 +40,7 @@ func (s *state7) GetState() interface{} { } func (s *state7) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/cron/v8.go b/chain/actors/builtin/cron/v8.go index 377cba060..904de5496 100644 --- a/chain/actors/builtin/cron/v8.go +++ b/chain/actors/builtin/cron/v8.go @@ -7,6 +7,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" cron8 "github.com/filecoin-project/go-state-types/builtin/v8/cron" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -39,7 +40,7 @@ func (s *state8) GetState() interface{} { } func (s *state8) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/cron/v9.go b/chain/actors/builtin/cron/v9.go index b2e1d1265..201348b6c 100644 --- a/chain/actors/builtin/cron/v9.go +++ b/chain/actors/builtin/cron/v9.go @@ -7,6 +7,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" cron9 "github.com/filecoin-project/go-state-types/builtin/v9/cron" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -39,7 +40,7 @@ func (s *state9) GetState() interface{} { } func (s *state9) ActorKey() string { - return actors.CronKey + return manifest.CronKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/datacap/actor.go.template b/chain/actors/builtin/datacap/actor.go.template index 15272d7d1..f1bafc301 100644 --- a/chain/actors/builtin/datacap/actor.go.template +++ b/chain/actors/builtin/datacap/actor.go.template @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/go-state-types/manifest" ) var ( @@ -23,7 +24,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.DatacapKey { + if name != manifest.DataCapKey { return nil, xerrors.Errorf("actor code is not datacap: %s", name) } diff --git a/chain/actors/builtin/datacap/datacap.go b/chain/actors/builtin/datacap/datacap.go index 977c020d3..f94b03704 100644 --- a/chain/actors/builtin/datacap/datacap.go +++ b/chain/actors/builtin/datacap/datacap.go @@ -9,6 +9,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" builtin10 "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -22,7 +23,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.DatacapKey { + if name != manifest.DataCapKey { return nil, xerrors.Errorf("actor code is not datacap: %s", name) } diff --git a/chain/actors/builtin/datacap/state.go.template b/chain/actors/builtin/datacap/state.go.template index dfb6eaad4..337ee3e25 100644 --- a/chain/actors/builtin/datacap/state.go.template +++ b/chain/actors/builtin/datacap/state.go.template @@ -12,6 +12,7 @@ import ( datacap{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}datacap" adt{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}util/adt" + "github.com/filecoin-project/go-state-types/manifest" ) var _ State = (*state{{.v}})(nil) @@ -63,7 +64,7 @@ func (s *state{{.v}}) VerifiedClientDataCap(addr address.Address) (bool, abi.Sto } func (s *state{{.v}}) ActorKey() string { - return actors.DatacapKey + return manifest.DataCapKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/datacap/v10.go b/chain/actors/builtin/datacap/v10.go index 6f4c8593d..7a68879a9 100644 --- a/chain/actors/builtin/datacap/v10.go +++ b/chain/actors/builtin/datacap/v10.go @@ -10,6 +10,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" datacap10 "github.com/filecoin-project/go-state-types/builtin/v10/datacap" adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -64,7 +65,7 @@ func (s *state10) VerifiedClientDataCap(addr address.Address) (bool, abi.Storage } func (s *state10) ActorKey() string { - return actors.DatacapKey + return manifest.DataCapKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/datacap/v9.go b/chain/actors/builtin/datacap/v9.go index 6dcf04477..76ce22ed0 100644 --- a/chain/actors/builtin/datacap/v9.go +++ b/chain/actors/builtin/datacap/v9.go @@ -10,6 +10,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" datacap9 "github.com/filecoin-project/go-state-types/builtin/v9/datacap" adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -64,7 +65,7 @@ func (s *state9) VerifiedClientDataCap(addr address.Address) (bool, abi.StorageP } func (s *state9) ActorKey() string { - return actors.DatacapKey + return manifest.DataCapKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/evm/actor.go.template b/chain/actors/builtin/evm/actor.go.template index 698029253..d20db6bcb 100644 --- a/chain/actors/builtin/evm/actor.go.template +++ b/chain/actors/builtin/evm/actor.go.template @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/go-state-types/manifest" builtin{{.latestVersion}} "github.com/filecoin-project/go-state-types/builtin" ) @@ -18,7 +19,7 @@ var Methods = builtin{{.latestVersion}}.MethodsEVM func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.EvmKey { + if name != manifest.EvmKey { return nil, xerrors.Errorf("actor code is not evm: %s", name) } diff --git a/chain/actors/builtin/evm/evm.go b/chain/actors/builtin/evm/evm.go index 69bd90c42..120ca66f8 100644 --- a/chain/actors/builtin/evm/evm.go +++ b/chain/actors/builtin/evm/evm.go @@ -7,6 +7,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" builtin10 "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -17,7 +18,7 @@ var Methods = builtin10.MethodsEVM func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.EvmKey { + if name != manifest.EvmKey { return nil, xerrors.Errorf("actor code is not evm: %s", name) } diff --git a/chain/actors/builtin/init/actor.go.template b/chain/actors/builtin/init/actor.go.template index 453aba963..1d19ebb40 100644 --- a/chain/actors/builtin/init/actor.go.template +++ b/chain/actors/builtin/init/actor.go.template @@ -13,6 +13,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/node/modules/dtypes" + "github.com/filecoin-project/go-state-types/manifest" {{range .versions}} {{if (le . 7)}} builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin" @@ -28,7 +29,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.InitKey { + if name != manifest.InitKey { return nil, xerrors.Errorf("actor code is not init: %s", name) } diff --git a/chain/actors/builtin/init/init.go b/chain/actors/builtin/init/init.go index a97d40297..c38629d2d 100644 --- a/chain/actors/builtin/init/init.go +++ b/chain/actors/builtin/init/init.go @@ -9,6 +9,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" builtin10 "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin" @@ -30,7 +31,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.InitKey { + if name != manifest.InitKey { return nil, xerrors.Errorf("actor code is not init: %s", name) } diff --git a/chain/actors/builtin/init/state.go.template b/chain/actors/builtin/init/state.go.template index c31aef6a0..52e223a85 100644 --- a/chain/actors/builtin/init/state.go.template +++ b/chain/actors/builtin/init/state.go.template @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/lotus/node/modules/dtypes" + "github.com/filecoin-project/go-state-types/manifest" {{if (le .v 7)}} {{if (ge .v 3)}} @@ -148,7 +149,7 @@ func (s *state{{.v}}) AddressMapHashFunction() func(input []byte) []byte { } func (s *state{{.v}}) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/init/v0.go b/chain/actors/builtin/init/v0.go index 61ae3f2db..7e48dda9e 100644 --- a/chain/actors/builtin/init/v0.go +++ b/chain/actors/builtin/init/v0.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" init0 "github.com/filecoin-project/specs-actors/actors/builtin/init" adt0 "github.com/filecoin-project/specs-actors/actors/util/adt" @@ -128,7 +129,7 @@ func (s *state0) AddressMapHashFunction() func(input []byte) []byte { } func (s *state0) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/init/v10.go b/chain/actors/builtin/init/v10.go index 761f9dacc..dd8c778dd 100644 --- a/chain/actors/builtin/init/v10.go +++ b/chain/actors/builtin/init/v10.go @@ -14,6 +14,7 @@ import ( builtin10 "github.com/filecoin-project/go-state-types/builtin" init10 "github.com/filecoin-project/go-state-types/builtin/v10/init" adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -129,7 +130,7 @@ func (s *state10) AddressMapHashFunction() func(input []byte) []byte { } func (s *state10) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/init/v2.go b/chain/actors/builtin/init/v2.go index dfbdde6c9..c107bd52d 100644 --- a/chain/actors/builtin/init/v2.go +++ b/chain/actors/builtin/init/v2.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init" adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt" @@ -128,7 +129,7 @@ func (s *state2) AddressMapHashFunction() func(input []byte) []byte { } func (s *state2) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/init/v3.go b/chain/actors/builtin/init/v3.go index 56a5e4afd..0be11f976 100644 --- a/chain/actors/builtin/init/v3.go +++ b/chain/actors/builtin/init/v3.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin" init3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/init" adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt" @@ -129,7 +130,7 @@ func (s *state3) AddressMapHashFunction() func(input []byte) []byte { } func (s *state3) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/init/v4.go b/chain/actors/builtin/init/v4.go index b1ecd3188..5ca6bc1c8 100644 --- a/chain/actors/builtin/init/v4.go +++ b/chain/actors/builtin/init/v4.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin" init4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/init" adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt" @@ -129,7 +130,7 @@ func (s *state4) AddressMapHashFunction() func(input []byte) []byte { } func (s *state4) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/init/v5.go b/chain/actors/builtin/init/v5.go index b8a6438d7..f6450789d 100644 --- a/chain/actors/builtin/init/v5.go +++ b/chain/actors/builtin/init/v5.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" init5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/init" adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt" @@ -129,7 +130,7 @@ func (s *state5) AddressMapHashFunction() func(input []byte) []byte { } func (s *state5) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/init/v6.go b/chain/actors/builtin/init/v6.go index aeadc2caf..4d2267aa1 100644 --- a/chain/actors/builtin/init/v6.go +++ b/chain/actors/builtin/init/v6.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" init6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/init" adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt" @@ -129,7 +130,7 @@ func (s *state6) AddressMapHashFunction() func(input []byte) []byte { } func (s *state6) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/init/v7.go b/chain/actors/builtin/init/v7.go index e62c56277..052faf985 100644 --- a/chain/actors/builtin/init/v7.go +++ b/chain/actors/builtin/init/v7.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin" init7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/init" adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt" @@ -129,7 +130,7 @@ func (s *state7) AddressMapHashFunction() func(input []byte) []byte { } func (s *state7) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/init/v8.go b/chain/actors/builtin/init/v8.go index 145b75551..c7c7860d3 100644 --- a/chain/actors/builtin/init/v8.go +++ b/chain/actors/builtin/init/v8.go @@ -14,6 +14,7 @@ import ( builtin8 "github.com/filecoin-project/go-state-types/builtin" init8 "github.com/filecoin-project/go-state-types/builtin/v8/init" adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -129,7 +130,7 @@ func (s *state8) AddressMapHashFunction() func(input []byte) []byte { } func (s *state8) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/init/v9.go b/chain/actors/builtin/init/v9.go index 8cba18e7a..a221a4a7c 100644 --- a/chain/actors/builtin/init/v9.go +++ b/chain/actors/builtin/init/v9.go @@ -14,6 +14,7 @@ import ( builtin9 "github.com/filecoin-project/go-state-types/builtin" init9 "github.com/filecoin-project/go-state-types/builtin/v9/init" adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -129,7 +130,7 @@ func (s *state9) AddressMapHashFunction() func(input []byte) []byte { } func (s *state9) ActorKey() string { - return actors.InitKey + return manifest.InitKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/actor.go.template b/chain/actors/builtin/market/actor.go.template index b8d8c987b..a84c04ab9 100644 --- a/chain/actors/builtin/market/actor.go.template +++ b/chain/actors/builtin/market/actor.go.template @@ -13,6 +13,7 @@ import ( "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/cbor" cbg "github.com/whyrusleeping/cbor-gen" + "github.com/filecoin-project/go-state-types/manifest" markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" @@ -36,7 +37,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.MarketKey { + if name != manifest.MarketKey { return nil, xerrors.Errorf("actor code is not market: %s", name) } diff --git a/chain/actors/builtin/market/market.go b/chain/actors/builtin/market/market.go index e96484d64..fc057549d 100644 --- a/chain/actors/builtin/market/market.go +++ b/chain/actors/builtin/market/market.go @@ -15,6 +15,7 @@ import ( markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/go-state-types/network" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" @@ -36,7 +37,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.MarketKey { + if name != manifest.MarketKey { return nil, xerrors.Errorf("actor code is not market: %s", name) } diff --git a/chain/actors/builtin/market/state.go.template b/chain/actors/builtin/market/state.go.template index ef5dff0a5..bbaa5c775 100644 --- a/chain/actors/builtin/market/state.go.template +++ b/chain/actors/builtin/market/state.go.template @@ -20,6 +20,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/types" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" {{if (le .v 7)}} market{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/market" @@ -394,7 +395,7 @@ func (s *state{{.v}}) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifreg func (s *state{{.v}}) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/v0.go b/chain/actors/builtin/market/v0.go index 4af5fe9b0..c0a628b47 100644 --- a/chain/actors/builtin/market/v0.go +++ b/chain/actors/builtin/market/v0.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" market0 "github.com/filecoin-project/specs-actors/actors/builtin/market" adt0 "github.com/filecoin-project/specs-actors/actors/util/adt" @@ -312,7 +313,7 @@ func (s *state0) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes } func (s *state0) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/v10.go b/chain/actors/builtin/market/v10.go index 21acf15ac..aaa0ee0f1 100644 --- a/chain/actors/builtin/market/v10.go +++ b/chain/actors/builtin/market/v10.go @@ -18,6 +18,7 @@ import ( adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt" markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -359,7 +360,7 @@ func (s *state10) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtype } func (s *state10) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/v2.go b/chain/actors/builtin/market/v2.go index 45a357f33..89ffdde8f 100644 --- a/chain/actors/builtin/market/v2.go +++ b/chain/actors/builtin/market/v2.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market" adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt" @@ -312,7 +313,7 @@ func (s *state2) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes } func (s *state2) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/v3.go b/chain/actors/builtin/market/v3.go index ec745f5a0..f4d073ed8 100644 --- a/chain/actors/builtin/market/v3.go +++ b/chain/actors/builtin/market/v3.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" market3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/market" adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt" @@ -307,7 +308,7 @@ func (s *state3) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes } func (s *state3) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/v4.go b/chain/actors/builtin/market/v4.go index 03e728c15..422a30cbb 100644 --- a/chain/actors/builtin/market/v4.go +++ b/chain/actors/builtin/market/v4.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" market4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/market" adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt" @@ -307,7 +308,7 @@ func (s *state4) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes } func (s *state4) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/v5.go b/chain/actors/builtin/market/v5.go index 98d498258..b30decb03 100644 --- a/chain/actors/builtin/market/v5.go +++ b/chain/actors/builtin/market/v5.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" market5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/market" adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt" @@ -307,7 +308,7 @@ func (s *state5) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes } func (s *state5) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/v6.go b/chain/actors/builtin/market/v6.go index 5966f2f8b..377b278ae 100644 --- a/chain/actors/builtin/market/v6.go +++ b/chain/actors/builtin/market/v6.go @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" market6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/market" adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt" @@ -325,7 +326,7 @@ func (s *state6) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes } func (s *state6) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/v7.go b/chain/actors/builtin/market/v7.go index df910cd4a..cd4607cbe 100644 --- a/chain/actors/builtin/market/v7.go +++ b/chain/actors/builtin/market/v7.go @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market" adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt" @@ -325,7 +326,7 @@ func (s *state7) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes } func (s *state7) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/v8.go b/chain/actors/builtin/market/v8.go index 1c0bfd3c5..5cce06d3a 100644 --- a/chain/actors/builtin/market/v8.go +++ b/chain/actors/builtin/market/v8.go @@ -17,6 +17,7 @@ import ( adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt" markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -342,7 +343,7 @@ func (s *state8) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes } func (s *state8) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/market/v9.go b/chain/actors/builtin/market/v9.go index 9335a235a..095c20850 100644 --- a/chain/actors/builtin/market/v9.go +++ b/chain/actors/builtin/market/v9.go @@ -18,6 +18,7 @@ import ( markettypes "github.com/filecoin-project/go-state-types/builtin/v9/market" adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -359,7 +360,7 @@ func (s *state9) GetAllocationIdForPendingDeal(dealId abi.DealID) (verifregtypes } func (s *state9) ActorKey() string { - return actors.MarketKey + return manifest.MarketKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/actor.go.template b/chain/actors/builtin/miner/actor.go.template index 069b74d31..abbcbfeb6 100644 --- a/chain/actors/builtin/miner/actor.go.template +++ b/chain/actors/builtin/miner/actor.go.template @@ -18,6 +18,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/types" minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner" + "github.com/filecoin-project/go-state-types/manifest" {{range .versions}} {{if (le . 7)}} @@ -28,7 +29,7 @@ import ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.MinerKey { + if name != manifest.MinerKey { return nil, xerrors.Errorf("actor code is not miner: %s", name) } diff --git a/chain/actors/builtin/miner/miner.go b/chain/actors/builtin/miner/miner.go index 4f93ff6a9..1931af3d3 100644 --- a/chain/actors/builtin/miner/miner.go +++ b/chain/actors/builtin/miner/miner.go @@ -12,6 +12,7 @@ import ( minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner" "github.com/filecoin-project/go-state-types/cbor" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/proof" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" @@ -29,7 +30,7 @@ import ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.MinerKey { + if name != manifest.MinerKey { return nil, xerrors.Errorf("actor code is not miner: %s", name) } diff --git a/chain/actors/builtin/miner/state.go.template b/chain/actors/builtin/miner/state.go.template index 5ba5f5463..b322b2283 100644 --- a/chain/actors/builtin/miner/state.go.template +++ b/chain/actors/builtin/miner/state.go.template @@ -18,6 +18,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" {{if (le .v 7)}} {{if (ge .v 3)}} @@ -614,7 +615,7 @@ func (s *state{{.v}}) GetState() interface{} { } func (s *state{{.v}}) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/v0.go b/chain/actors/builtin/miner/v0.go index 10903b46b..7d5eaf8e0 100644 --- a/chain/actors/builtin/miner/v0.go +++ b/chain/actors/builtin/miner/v0.go @@ -15,6 +15,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" adt0 "github.com/filecoin-project/specs-actors/actors/util/adt" @@ -535,7 +536,7 @@ func (s *state0) GetState() interface{} { } func (s *state0) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/v10.go b/chain/actors/builtin/miner/v10.go index d72f7124a..4d47ba396 100644 --- a/chain/actors/builtin/miner/v10.go +++ b/chain/actors/builtin/miner/v10.go @@ -17,6 +17,7 @@ import ( miner10 "github.com/filecoin-project/go-state-types/builtin/v10/miner" adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -573,7 +574,7 @@ func (s *state10) GetState() interface{} { } func (s *state10) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/v2.go b/chain/actors/builtin/miner/v2.go index c9870a124..14341ae38 100644 --- a/chain/actors/builtin/miner/v2.go +++ b/chain/actors/builtin/miner/v2.go @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner" adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt" @@ -566,7 +567,7 @@ func (s *state2) GetState() interface{} { } func (s *state2) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/v3.go b/chain/actors/builtin/miner/v3.go index c71c8315a..52808da8c 100644 --- a/chain/actors/builtin/miner/v3.go +++ b/chain/actors/builtin/miner/v3.go @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin" miner3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/miner" adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt" @@ -566,7 +567,7 @@ func (s *state3) GetState() interface{} { } func (s *state3) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/v4.go b/chain/actors/builtin/miner/v4.go index 2e3c6ee79..5980ef769 100644 --- a/chain/actors/builtin/miner/v4.go +++ b/chain/actors/builtin/miner/v4.go @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin" miner4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/miner" adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt" @@ -566,7 +567,7 @@ func (s *state4) GetState() interface{} { } func (s *state4) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/v5.go b/chain/actors/builtin/miner/v5.go index 28ab438e4..886300ea3 100644 --- a/chain/actors/builtin/miner/v5.go +++ b/chain/actors/builtin/miner/v5.go @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner" adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt" @@ -566,7 +567,7 @@ func (s *state5) GetState() interface{} { } func (s *state5) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/v6.go b/chain/actors/builtin/miner/v6.go index 9e819e55f..4737b0ee2 100644 --- a/chain/actors/builtin/miner/v6.go +++ b/chain/actors/builtin/miner/v6.go @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" miner6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/miner" adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt" @@ -566,7 +567,7 @@ func (s *state6) GetState() interface{} { } func (s *state6) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/v7.go b/chain/actors/builtin/miner/v7.go index f98233c37..72803eb75 100644 --- a/chain/actors/builtin/miner/v7.go +++ b/chain/actors/builtin/miner/v7.go @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin" miner7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/miner" adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt" @@ -567,7 +568,7 @@ func (s *state7) GetState() interface{} { } func (s *state7) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/v8.go b/chain/actors/builtin/miner/v8.go index ee3c475ea..3e3739591 100644 --- a/chain/actors/builtin/miner/v8.go +++ b/chain/actors/builtin/miner/v8.go @@ -17,6 +17,7 @@ import ( miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner" adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -567,7 +568,7 @@ func (s *state8) GetState() interface{} { } func (s *state8) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/miner/v9.go b/chain/actors/builtin/miner/v9.go index 12e888706..72d9dbd59 100644 --- a/chain/actors/builtin/miner/v9.go +++ b/chain/actors/builtin/miner/v9.go @@ -17,6 +17,7 @@ import ( miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner" adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -573,7 +574,7 @@ func (s *state9) GetState() interface{} { } func (s *state9) ActorKey() string { - return actors.MinerKey + return manifest.MinerKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/actor.go.template b/chain/actors/builtin/multisig/actor.go.template index 40e49e702..9bb69a048 100644 --- a/chain/actors/builtin/multisig/actor.go.template +++ b/chain/actors/builtin/multisig/actor.go.template @@ -21,6 +21,7 @@ import ( {{end}} builtintypes "github.com/filecoin-project/go-state-types/builtin" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -29,7 +30,7 @@ import ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.MultisigKey { + if name != manifest.MultisigKey { return nil, xerrors.Errorf("actor code is not multisig: %s", name) } diff --git a/chain/actors/builtin/multisig/message.go.template b/chain/actors/builtin/multisig/message.go.template index 1e1559968..b5bc6924f 100644 --- a/chain/actors/builtin/multisig/message.go.template +++ b/chain/actors/builtin/multisig/message.go.template @@ -14,6 +14,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" multisig{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}multisig" init{{.latestVersion}} "github.com/filecoin-project/go-state-types/builtin/v{{.latestVersion}}/init" + "github.com/filecoin-project/go-state-types/manifest" {{end}} builtintypes "github.com/filecoin-project/go-state-types/builtin" @@ -68,7 +69,7 @@ func (m message{{.v}}) Create( ConstructorParams: enc, } {{else}} - code, ok := actors.GetActorCodeID(actorstypes.Version{{.v}}, actors.MultisigKey) + code, ok := actors.GetActorCodeID(actorstypes.Version{{.v}}, manifest.MultisigKey) if !ok { return nil, xerrors.Errorf("failed to get multisig code ID") } diff --git a/chain/actors/builtin/multisig/message10.go b/chain/actors/builtin/multisig/message10.go index 944911643..87ee759bd 100644 --- a/chain/actors/builtin/multisig/message10.go +++ b/chain/actors/builtin/multisig/message10.go @@ -9,6 +9,7 @@ import ( builtintypes "github.com/filecoin-project/go-state-types/builtin" init10 "github.com/filecoin-project/go-state-types/builtin/v10/init" multisig10 "github.com/filecoin-project/go-state-types/builtin/v10/multisig" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init" @@ -50,7 +51,7 @@ func (m message10) Create( return nil, actErr } - code, ok := actors.GetActorCodeID(actorstypes.Version10, actors.MultisigKey) + code, ok := actors.GetActorCodeID(actorstypes.Version10, manifest.MultisigKey) if !ok { return nil, xerrors.Errorf("failed to get multisig code ID") } diff --git a/chain/actors/builtin/multisig/message8.go b/chain/actors/builtin/multisig/message8.go index 7c79f3f50..4131a1b76 100644 --- a/chain/actors/builtin/multisig/message8.go +++ b/chain/actors/builtin/multisig/message8.go @@ -9,6 +9,7 @@ import ( builtintypes "github.com/filecoin-project/go-state-types/builtin" init10 "github.com/filecoin-project/go-state-types/builtin/v10/init" multisig8 "github.com/filecoin-project/go-state-types/builtin/v8/multisig" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init" @@ -50,7 +51,7 @@ func (m message8) Create( return nil, actErr } - code, ok := actors.GetActorCodeID(actorstypes.Version8, actors.MultisigKey) + code, ok := actors.GetActorCodeID(actorstypes.Version8, manifest.MultisigKey) if !ok { return nil, xerrors.Errorf("failed to get multisig code ID") } diff --git a/chain/actors/builtin/multisig/message9.go b/chain/actors/builtin/multisig/message9.go index be49894fa..f9c8c3103 100644 --- a/chain/actors/builtin/multisig/message9.go +++ b/chain/actors/builtin/multisig/message9.go @@ -9,6 +9,7 @@ import ( builtintypes "github.com/filecoin-project/go-state-types/builtin" init10 "github.com/filecoin-project/go-state-types/builtin/v10/init" multisig9 "github.com/filecoin-project/go-state-types/builtin/v9/multisig" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init" @@ -50,7 +51,7 @@ func (m message9) Create( return nil, actErr } - code, ok := actors.GetActorCodeID(actorstypes.Version9, actors.MultisigKey) + code, ok := actors.GetActorCodeID(actorstypes.Version9, manifest.MultisigKey) if !ok { return nil, xerrors.Errorf("failed to get multisig code ID") } diff --git a/chain/actors/builtin/multisig/multisig.go b/chain/actors/builtin/multisig/multisig.go index adb2fcfa0..4abdf7bbb 100644 --- a/chain/actors/builtin/multisig/multisig.go +++ b/chain/actors/builtin/multisig/multisig.go @@ -14,6 +14,7 @@ import ( builtintypes "github.com/filecoin-project/go-state-types/builtin" msig10 "github.com/filecoin-project/go-state-types/builtin/v10/multisig" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin" @@ -29,7 +30,7 @@ import ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.MultisigKey { + if name != manifest.MultisigKey { return nil, xerrors.Errorf("actor code is not multisig: %s", name) } diff --git a/chain/actors/builtin/multisig/state.go.template b/chain/actors/builtin/multisig/state.go.template index 457e8cb4d..5d04b94be 100644 --- a/chain/actors/builtin/multisig/state.go.template +++ b/chain/actors/builtin/multisig/state.go.template @@ -15,6 +15,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors" + "github.com/filecoin-project/go-state-types/manifest" {{if (le .v 7)}} {{if (ge .v 3)}} @@ -136,7 +137,7 @@ func (s *state{{.v}}) GetState() interface{} { } func (s *state{{.v}}) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/v0.go b/chain/actors/builtin/multisig/v0.go index 38cc76411..86bfdaaf3 100644 --- a/chain/actors/builtin/multisig/v0.go +++ b/chain/actors/builtin/multisig/v0.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig" adt0 "github.com/filecoin-project/specs-actors/actors/util/adt" @@ -119,7 +120,7 @@ func (s *state0) GetState() interface{} { } func (s *state0) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/v10.go b/chain/actors/builtin/multisig/v10.go index 3b9babebe..d87fc5807 100644 --- a/chain/actors/builtin/multisig/v10.go +++ b/chain/actors/builtin/multisig/v10.go @@ -15,6 +15,7 @@ import ( builtin10 "github.com/filecoin-project/go-state-types/builtin" msig10 "github.com/filecoin-project/go-state-types/builtin/v10/multisig" adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -120,7 +121,7 @@ func (s *state10) GetState() interface{} { } func (s *state10) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/v2.go b/chain/actors/builtin/multisig/v2.go index 2d72b3215..77330d513 100644 --- a/chain/actors/builtin/multisig/v2.go +++ b/chain/actors/builtin/multisig/v2.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" msig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig" adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt" @@ -119,7 +120,7 @@ func (s *state2) GetState() interface{} { } func (s *state2) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/v3.go b/chain/actors/builtin/multisig/v3.go index bd45ecdaa..e8659093f 100644 --- a/chain/actors/builtin/multisig/v3.go +++ b/chain/actors/builtin/multisig/v3.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin" msig3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/multisig" adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt" @@ -120,7 +121,7 @@ func (s *state3) GetState() interface{} { } func (s *state3) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/v4.go b/chain/actors/builtin/multisig/v4.go index 1f5f2a9ce..ddaac5470 100644 --- a/chain/actors/builtin/multisig/v4.go +++ b/chain/actors/builtin/multisig/v4.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin" msig4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/multisig" adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt" @@ -120,7 +121,7 @@ func (s *state4) GetState() interface{} { } func (s *state4) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/v5.go b/chain/actors/builtin/multisig/v5.go index bf4a58cbf..50474d5fd 100644 --- a/chain/actors/builtin/multisig/v5.go +++ b/chain/actors/builtin/multisig/v5.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" msig5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/multisig" adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt" @@ -120,7 +121,7 @@ func (s *state5) GetState() interface{} { } func (s *state5) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/v6.go b/chain/actors/builtin/multisig/v6.go index f5c6f66bb..c51404dc4 100644 --- a/chain/actors/builtin/multisig/v6.go +++ b/chain/actors/builtin/multisig/v6.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" msig6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/multisig" adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt" @@ -120,7 +121,7 @@ func (s *state6) GetState() interface{} { } func (s *state6) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/v7.go b/chain/actors/builtin/multisig/v7.go index e75865841..9ddce167a 100644 --- a/chain/actors/builtin/multisig/v7.go +++ b/chain/actors/builtin/multisig/v7.go @@ -12,6 +12,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin" msig7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/multisig" adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt" @@ -120,7 +121,7 @@ func (s *state7) GetState() interface{} { } func (s *state7) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/v8.go b/chain/actors/builtin/multisig/v8.go index 677f4ffe9..b28ec5684 100644 --- a/chain/actors/builtin/multisig/v8.go +++ b/chain/actors/builtin/multisig/v8.go @@ -15,6 +15,7 @@ import ( builtin8 "github.com/filecoin-project/go-state-types/builtin" msig8 "github.com/filecoin-project/go-state-types/builtin/v8/multisig" adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -120,7 +121,7 @@ func (s *state8) GetState() interface{} { } func (s *state8) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/multisig/v9.go b/chain/actors/builtin/multisig/v9.go index 2700470d3..faa3b7d37 100644 --- a/chain/actors/builtin/multisig/v9.go +++ b/chain/actors/builtin/multisig/v9.go @@ -15,6 +15,7 @@ import ( builtin9 "github.com/filecoin-project/go-state-types/builtin" msig9 "github.com/filecoin-project/go-state-types/builtin/v9/multisig" adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -120,7 +121,7 @@ func (s *state9) GetState() interface{} { } func (s *state9) ActorKey() string { - return actors.MultisigKey + return manifest.MultisigKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/actor.go.template b/chain/actors/builtin/paych/actor.go.template index 4250b4770..e19ac5e29 100644 --- a/chain/actors/builtin/paych/actor.go.template +++ b/chain/actors/builtin/paych/actor.go.template @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/cbor" ipldcbor "github.com/ipfs/go-ipld-cbor" + "github.com/filecoin-project/go-state-types/manifest" paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych" paychtypes "github.com/filecoin-project/go-state-types/builtin/v8/paych" @@ -31,7 +32,7 @@ import ( // Load returns an abstract copy of payment channel state, irregardless of actor version func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.PaychKey { + if name != manifest.PaychKey { return nil, xerrors.Errorf("actor code is not paych: %s", name) } diff --git a/chain/actors/builtin/paych/mock/mock.go b/chain/actors/builtin/paych/mock/mock.go index 8b8624ac8..3b8881319 100644 --- a/chain/actors/builtin/paych/mock/mock.go +++ b/chain/actors/builtin/paych/mock/mock.go @@ -9,8 +9,8 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" - "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/builtin/paych" ) @@ -27,7 +27,7 @@ func (ms *mockState) Code() cid.Cid { } func (ms *mockState) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (ms *mockState) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/paych.go b/chain/actors/builtin/paych/paych.go index 537ae8d92..0e6a3ca07 100644 --- a/chain/actors/builtin/paych/paych.go +++ b/chain/actors/builtin/paych/paych.go @@ -14,6 +14,7 @@ import ( "github.com/filecoin-project/go-state-types/big" paychtypes "github.com/filecoin-project/go-state-types/builtin/v8/paych" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" @@ -31,7 +32,7 @@ import ( // Load returns an abstract copy of payment channel state, irregardless of actor version func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.PaychKey { + if name != manifest.PaychKey { return nil, xerrors.Errorf("actor code is not paych: %s", name) } diff --git a/chain/actors/builtin/paych/state.go.template b/chain/actors/builtin/paych/state.go.template index c00f7dc56..0b0f9f9a1 100644 --- a/chain/actors/builtin/paych/state.go.template +++ b/chain/actors/builtin/paych/state.go.template @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors" + "github.com/filecoin-project/go-state-types/manifest" {{if (le .v 7)}} paych{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/paych" @@ -122,7 +123,7 @@ func (ls *laneState{{.v}}) Nonce() (uint64, error) { } func (s *state{{.v}}) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/v0.go b/chain/actors/builtin/paych/v0.go index 8cdc27c39..facc7f656 100644 --- a/chain/actors/builtin/paych/v0.go +++ b/chain/actors/builtin/paych/v0.go @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych" adt0 "github.com/filecoin-project/specs-actors/actors/util/adt" @@ -117,7 +118,7 @@ func (ls *laneState0) Nonce() (uint64, error) { } func (s *state0) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/v10.go b/chain/actors/builtin/paych/v10.go index 0527c36d1..edc6c96b6 100644 --- a/chain/actors/builtin/paych/v10.go +++ b/chain/actors/builtin/paych/v10.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-state-types/big" paych10 "github.com/filecoin-project/go-state-types/builtin/v10/paych" adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -117,7 +118,7 @@ func (ls *laneState10) Nonce() (uint64, error) { } func (s *state10) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/v2.go b/chain/actors/builtin/paych/v2.go index ae94adc17..63a3cc75e 100644 --- a/chain/actors/builtin/paych/v2.go +++ b/chain/actors/builtin/paych/v2.go @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" paych2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/paych" adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt" @@ -117,7 +118,7 @@ func (ls *laneState2) Nonce() (uint64, error) { } func (s *state2) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/v3.go b/chain/actors/builtin/paych/v3.go index 5c57ea729..c672c0027 100644 --- a/chain/actors/builtin/paych/v3.go +++ b/chain/actors/builtin/paych/v3.go @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" paych3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/paych" adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt" @@ -117,7 +118,7 @@ func (ls *laneState3) Nonce() (uint64, error) { } func (s *state3) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/v4.go b/chain/actors/builtin/paych/v4.go index b243be2e3..842e52093 100644 --- a/chain/actors/builtin/paych/v4.go +++ b/chain/actors/builtin/paych/v4.go @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" paych4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/paych" adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt" @@ -117,7 +118,7 @@ func (ls *laneState4) Nonce() (uint64, error) { } func (s *state4) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/v5.go b/chain/actors/builtin/paych/v5.go index b3b9ad50e..8f53fe43f 100644 --- a/chain/actors/builtin/paych/v5.go +++ b/chain/actors/builtin/paych/v5.go @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" paych5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/paych" adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt" @@ -117,7 +118,7 @@ func (ls *laneState5) Nonce() (uint64, error) { } func (s *state5) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/v6.go b/chain/actors/builtin/paych/v6.go index a3b80c8e1..0a8a93896 100644 --- a/chain/actors/builtin/paych/v6.go +++ b/chain/actors/builtin/paych/v6.go @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" paych6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/paych" adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt" @@ -117,7 +118,7 @@ func (ls *laneState6) Nonce() (uint64, error) { } func (s *state6) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/v7.go b/chain/actors/builtin/paych/v7.go index bb6721b01..ce0dcba0a 100644 --- a/chain/actors/builtin/paych/v7.go +++ b/chain/actors/builtin/paych/v7.go @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" paych7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/paych" adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt" @@ -117,7 +118,7 @@ func (ls *laneState7) Nonce() (uint64, error) { } func (s *state7) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/v8.go b/chain/actors/builtin/paych/v8.go index fc6853cad..51067e87b 100644 --- a/chain/actors/builtin/paych/v8.go +++ b/chain/actors/builtin/paych/v8.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-state-types/big" paych8 "github.com/filecoin-project/go-state-types/builtin/v8/paych" adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -117,7 +118,7 @@ func (ls *laneState8) Nonce() (uint64, error) { } func (s *state8) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/paych/v9.go b/chain/actors/builtin/paych/v9.go index 817541dfb..8a69e16d4 100644 --- a/chain/actors/builtin/paych/v9.go +++ b/chain/actors/builtin/paych/v9.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-state-types/big" paych9 "github.com/filecoin-project/go-state-types/builtin/v9/paych" adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -117,7 +118,7 @@ func (ls *laneState9) Nonce() (uint64, error) { } func (s *state9) ActorKey() string { - return actors.PaychKey + return manifest.PaychKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/actor.go.template b/chain/actors/builtin/power/actor.go.template index 0a4d70f46..ed2d3fa77 100644 --- a/chain/actors/builtin/power/actor.go.template +++ b/chain/actors/builtin/power/actor.go.template @@ -15,6 +15,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/go-state-types/manifest" {{range .versions}} {{if (le . 7)}} @@ -31,7 +32,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.PowerKey { + if name != manifest.PowerKey { return nil, xerrors.Errorf("actor code is not power: %s", name) } diff --git a/chain/actors/builtin/power/power.go b/chain/actors/builtin/power/power.go index 893a25cd7..6dca61435 100644 --- a/chain/actors/builtin/power/power.go +++ b/chain/actors/builtin/power/power.go @@ -11,6 +11,7 @@ import ( "github.com/filecoin-project/go-state-types/big" builtin10 "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin" @@ -32,7 +33,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.PowerKey { + if name != manifest.PowerKey { return nil, xerrors.Errorf("actor code is not power: %s", name) } diff --git a/chain/actors/builtin/power/state.go.template b/chain/actors/builtin/power/state.go.template index 8c2a8ce97..d37a8b98a 100644 --- a/chain/actors/builtin/power/state.go.template +++ b/chain/actors/builtin/power/state.go.template @@ -13,6 +13,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin" + "github.com/filecoin-project/go-state-types/manifest" {{if (le .v 7)}} {{if (ge .v 3)}} @@ -210,7 +211,7 @@ func fromV{{.v}}Claim(v{{.v}} power{{.v}}.Claim) Claim { } func (s *state{{.v}}) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/v0.go b/chain/actors/builtin/power/v0.go index 56982e77b..4cf550616 100644 --- a/chain/actors/builtin/power/v0.go +++ b/chain/actors/builtin/power/v0.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" power0 "github.com/filecoin-project/specs-actors/actors/builtin/power" adt0 "github.com/filecoin-project/specs-actors/actors/util/adt" @@ -193,7 +194,7 @@ func fromV0Claim(v0 power0.Claim) Claim { } func (s *state0) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/v10.go b/chain/actors/builtin/power/v10.go index 7359ca947..dd7a9decf 100644 --- a/chain/actors/builtin/power/v10.go +++ b/chain/actors/builtin/power/v10.go @@ -13,6 +13,7 @@ import ( builtin10 "github.com/filecoin-project/go-state-types/builtin" power10 "github.com/filecoin-project/go-state-types/builtin/v10/power" adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -189,7 +190,7 @@ func fromV10Claim(v10 power10.Claim) Claim { } func (s *state10) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/v2.go b/chain/actors/builtin/power/v2.go index b4e253024..bac0fa179 100644 --- a/chain/actors/builtin/power/v2.go +++ b/chain/actors/builtin/power/v2.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" power2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/power" adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt" @@ -193,7 +194,7 @@ func fromV2Claim(v2 power2.Claim) Claim { } func (s *state2) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/v3.go b/chain/actors/builtin/power/v3.go index 2b2b75ae7..bdb66e384 100644 --- a/chain/actors/builtin/power/v3.go +++ b/chain/actors/builtin/power/v3.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin" power3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/power" adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt" @@ -189,7 +190,7 @@ func fromV3Claim(v3 power3.Claim) Claim { } func (s *state3) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/v4.go b/chain/actors/builtin/power/v4.go index c40dad92a..b2dc95347 100644 --- a/chain/actors/builtin/power/v4.go +++ b/chain/actors/builtin/power/v4.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin" power4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/power" adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt" @@ -189,7 +190,7 @@ func fromV4Claim(v4 power4.Claim) Claim { } func (s *state4) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/v5.go b/chain/actors/builtin/power/v5.go index 5d740a40b..3a3adaf32 100644 --- a/chain/actors/builtin/power/v5.go +++ b/chain/actors/builtin/power/v5.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" power5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/power" adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt" @@ -189,7 +190,7 @@ func fromV5Claim(v5 power5.Claim) Claim { } func (s *state5) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/v6.go b/chain/actors/builtin/power/v6.go index 45c0db9e8..7e8eb3654 100644 --- a/chain/actors/builtin/power/v6.go +++ b/chain/actors/builtin/power/v6.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" power6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/power" adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt" @@ -189,7 +190,7 @@ func fromV6Claim(v6 power6.Claim) Claim { } func (s *state6) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/v7.go b/chain/actors/builtin/power/v7.go index 314318263..893c58667 100644 --- a/chain/actors/builtin/power/v7.go +++ b/chain/actors/builtin/power/v7.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin" power7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/power" adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt" @@ -189,7 +190,7 @@ func fromV7Claim(v7 power7.Claim) Claim { } func (s *state7) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/v8.go b/chain/actors/builtin/power/v8.go index a462b2600..b15fe4355 100644 --- a/chain/actors/builtin/power/v8.go +++ b/chain/actors/builtin/power/v8.go @@ -13,6 +13,7 @@ import ( builtin8 "github.com/filecoin-project/go-state-types/builtin" power8 "github.com/filecoin-project/go-state-types/builtin/v8/power" adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -189,7 +190,7 @@ func fromV8Claim(v8 power8.Claim) Claim { } func (s *state8) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/power/v9.go b/chain/actors/builtin/power/v9.go index 0e8d5b072..126fbbfbf 100644 --- a/chain/actors/builtin/power/v9.go +++ b/chain/actors/builtin/power/v9.go @@ -13,6 +13,7 @@ import ( builtin9 "github.com/filecoin-project/go-state-types/builtin" power9 "github.com/filecoin-project/go-state-types/builtin/v9/power" adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -189,7 +190,7 @@ func fromV9Claim(v9 power9.Claim) Claim { } func (s *state9) ActorKey() string { - return actors.PowerKey + return manifest.PowerKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/registry.go b/chain/actors/builtin/registry.go index 6b47b0fc7..f591e9e1b 100644 --- a/chain/actors/builtin/registry.go +++ b/chain/actors/builtin/registry.go @@ -46,6 +46,7 @@ import ( system9 "github.com/filecoin-project/go-state-types/builtin/v9/system" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" rtt "github.com/filecoin-project/go-state-types/rt" "github.com/filecoin-project/lotus/chain/actors" @@ -119,67 +120,67 @@ func MakeRegistry(av actorstypes.Version) []RegistryEntry { case actorstypes.Version8: for key, codeID := range codeIDs { switch key { - case actors.AccountKey: + case manifest.AccountKey: registry = append(registry, RegistryEntry{ code: codeID, methods: account8.Methods, state: new(account8.State), }) - case actors.CronKey: + case manifest.CronKey: registry = append(registry, RegistryEntry{ code: codeID, methods: cron8.Methods, state: new(cron8.State), }) - case actors.InitKey: + case manifest.InitKey: registry = append(registry, RegistryEntry{ code: codeID, methods: _init8.Methods, state: new(_init8.State), }) - case actors.MarketKey: + case manifest.MarketKey: registry = append(registry, RegistryEntry{ code: codeID, methods: market8.Methods, state: new(market8.State), }) - case actors.MinerKey: + case manifest.MinerKey: registry = append(registry, RegistryEntry{ code: codeID, methods: miner8.Methods, state: new(miner8.State), }) - case actors.MultisigKey: + case manifest.MultisigKey: registry = append(registry, RegistryEntry{ code: codeID, methods: multisig8.Methods, state: new(multisig8.State), }) - case actors.PaychKey: + case manifest.PaychKey: registry = append(registry, RegistryEntry{ code: codeID, methods: paych8.Methods, state: new(paych8.State), }) - case actors.PowerKey: + case manifest.PowerKey: registry = append(registry, RegistryEntry{ code: codeID, methods: power8.Methods, state: new(power8.State), }) - case actors.RewardKey: + case manifest.RewardKey: registry = append(registry, RegistryEntry{ code: codeID, methods: reward8.Methods, state: new(reward8.State), }) - case actors.SystemKey: + case manifest.SystemKey: registry = append(registry, RegistryEntry{ code: codeID, methods: system8.Methods, state: new(system8.State), }) - case actors.VerifregKey: + case manifest.VerifregKey: registry = append(registry, RegistryEntry{ code: codeID, methods: verifreg8.Methods, @@ -192,73 +193,73 @@ func MakeRegistry(av actorstypes.Version) []RegistryEntry { case actorstypes.Version9: for key, codeID := range codeIDs { switch key { - case actors.AccountKey: + case manifest.AccountKey: registry = append(registry, RegistryEntry{ code: codeID, methods: account9.Methods, state: new(account9.State), }) - case actors.CronKey: + case manifest.CronKey: registry = append(registry, RegistryEntry{ code: codeID, methods: cron9.Methods, state: new(cron9.State), }) - case actors.InitKey: + case manifest.InitKey: registry = append(registry, RegistryEntry{ code: codeID, methods: _init9.Methods, state: new(_init9.State), }) - case actors.MarketKey: + case manifest.MarketKey: registry = append(registry, RegistryEntry{ code: codeID, methods: market9.Methods, state: new(market9.State), }) - case actors.MinerKey: + case manifest.MinerKey: registry = append(registry, RegistryEntry{ code: codeID, methods: miner9.Methods, state: new(miner9.State), }) - case actors.MultisigKey: + case manifest.MultisigKey: registry = append(registry, RegistryEntry{ code: codeID, methods: multisig9.Methods, state: new(multisig9.State), }) - case actors.PaychKey: + case manifest.PaychKey: registry = append(registry, RegistryEntry{ code: codeID, methods: paych9.Methods, state: new(paych9.State), }) - case actors.PowerKey: + case manifest.PowerKey: registry = append(registry, RegistryEntry{ code: codeID, methods: power9.Methods, state: new(power9.State), }) - case actors.RewardKey: + case manifest.RewardKey: registry = append(registry, RegistryEntry{ code: codeID, methods: reward9.Methods, state: new(reward9.State), }) - case actors.SystemKey: + case manifest.SystemKey: registry = append(registry, RegistryEntry{ code: codeID, methods: system9.Methods, state: new(system9.State), }) - case actors.VerifregKey: + case manifest.VerifregKey: registry = append(registry, RegistryEntry{ code: codeID, methods: verifreg9.Methods, state: new(verifreg9.State), }) - case actors.DatacapKey: + case manifest.DataCapKey: registry = append(registry, RegistryEntry{ code: codeID, methods: datacap9.Methods, @@ -270,73 +271,73 @@ func MakeRegistry(av actorstypes.Version) []RegistryEntry { case actorstypes.Version10: for key, codeID := range codeIDs { switch key { - case actors.AccountKey: + case manifest.AccountKey: registry = append(registry, RegistryEntry{ code: codeID, methods: account10.Methods, state: new(account10.State), }) - case actors.CronKey: + case manifest.CronKey: registry = append(registry, RegistryEntry{ code: codeID, methods: cron10.Methods, state: new(cron10.State), }) - case actors.InitKey: + case manifest.InitKey: registry = append(registry, RegistryEntry{ code: codeID, methods: _init10.Methods, state: new(_init10.State), }) - case actors.MarketKey: + case manifest.MarketKey: registry = append(registry, RegistryEntry{ code: codeID, methods: market10.Methods, state: new(market10.State), }) - case actors.MinerKey: + case manifest.MinerKey: registry = append(registry, RegistryEntry{ code: codeID, methods: miner10.Methods, state: new(miner10.State), }) - case actors.MultisigKey: + case manifest.MultisigKey: registry = append(registry, RegistryEntry{ code: codeID, methods: multisig10.Methods, state: new(multisig10.State), }) - case actors.PaychKey: + case manifest.PaychKey: registry = append(registry, RegistryEntry{ code: codeID, methods: paych10.Methods, state: new(paych10.State), }) - case actors.PowerKey: + case manifest.PowerKey: registry = append(registry, RegistryEntry{ code: codeID, methods: power10.Methods, state: new(power10.State), }) - case actors.RewardKey: + case manifest.RewardKey: registry = append(registry, RegistryEntry{ code: codeID, methods: reward10.Methods, state: new(reward10.State), }) - case actors.SystemKey: + case manifest.SystemKey: registry = append(registry, RegistryEntry{ code: codeID, methods: system10.Methods, state: new(system10.State), }) - case actors.VerifregKey: + case manifest.VerifregKey: registry = append(registry, RegistryEntry{ code: codeID, methods: verifreg10.Methods, state: new(verifreg10.State), }) - case actors.DatacapKey: + case manifest.DataCapKey: registry = append(registry, RegistryEntry{ code: codeID, methods: datacap10.Methods, diff --git a/chain/actors/builtin/registry.go.template b/chain/actors/builtin/registry.go.template index 0eb061297..76837eef5 100644 --- a/chain/actors/builtin/registry.go.template +++ b/chain/actors/builtin/registry.go.template @@ -30,6 +30,7 @@ import ( rtt "github.com/filecoin-project/go-state-types/rt" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/go-state-types/abi" + "github.com/filecoin-project/go-state-types/manifest" ) type RegistryEntry struct { @@ -101,73 +102,73 @@ func MakeRegistry(av actorstypes.Version) []RegistryEntry { case actorstypes.Version{{.}}: for key, codeID := range codeIDs { switch key { - case actors.AccountKey: + case manifest.AccountKey: registry = append(registry, RegistryEntry{ code: codeID, methods: account{{.}}.Methods, state: new(account{{.}}.State), }) - case actors.CronKey: + case manifest.CronKey: registry = append(registry, RegistryEntry{ code: codeID, methods: cron{{.}}.Methods, state: new(cron{{.}}.State), }) - case actors.InitKey: + case manifest.InitKey: registry = append(registry, RegistryEntry{ code: codeID, methods: _init{{.}}.Methods, state: new(_init{{.}}.State), }) - case actors.MarketKey: + case manifest.MarketKey: registry = append(registry, RegistryEntry{ code: codeID, methods: market{{.}}.Methods, state: new(market{{.}}.State), }) - case actors.MinerKey: + case manifest.MinerKey: registry = append(registry, RegistryEntry{ code: codeID, methods: miner{{.}}.Methods, state: new(miner{{.}}.State), }) - case actors.MultisigKey: + case manifest.MultisigKey: registry = append(registry, RegistryEntry{ code: codeID, methods: multisig{{.}}.Methods, state: new(multisig{{.}}.State), }) - case actors.PaychKey: + case manifest.PaychKey: registry = append(registry, RegistryEntry{ code: codeID, methods: paych{{.}}.Methods, state: new(paych{{.}}.State), }) - case actors.PowerKey: + case manifest.PowerKey: registry = append(registry, RegistryEntry{ code: codeID, methods: power{{.}}.Methods, state: new(power{{.}}.State), }) - case actors.RewardKey: + case manifest.RewardKey: registry = append(registry, RegistryEntry{ code: codeID, methods: reward{{.}}.Methods, state: new(reward{{.}}.State), }) - case actors.SystemKey: + case manifest.SystemKey: registry = append(registry, RegistryEntry{ code: codeID, methods: system{{.}}.Methods, state: new(system{{.}}.State), }) - case actors.VerifregKey: + case manifest.VerifregKey: registry = append(registry, RegistryEntry{ code: codeID, methods: verifreg{{.}}.Methods, state: new(verifreg{{.}}.State), }) - {{if (ge . 9)}}case actors.DatacapKey: + {{if (ge . 9)}}case manifest.DataCapKey: registry = append(registry, RegistryEntry{ code: codeID, methods: datacap{{.}}.Methods, diff --git a/chain/actors/builtin/reward/actor.go.template b/chain/actors/builtin/reward/actor.go.template index 4fd317c97..81bf91ac3 100644 --- a/chain/actors/builtin/reward/actor.go.template +++ b/chain/actors/builtin/reward/actor.go.template @@ -19,6 +19,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/types" + "github.com/filecoin-project/go-state-types/manifest" ) var ( @@ -28,7 +29,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.RewardKey { + if name != manifest.RewardKey { return nil, xerrors.Errorf("actor code is not reward: %s", name) } diff --git a/chain/actors/builtin/reward/reward.go b/chain/actors/builtin/reward/reward.go index 0efbdaf79..01462d680 100644 --- a/chain/actors/builtin/reward/reward.go +++ b/chain/actors/builtin/reward/reward.go @@ -8,6 +8,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" builtin10 "github.com/filecoin-project/go-state-types/builtin" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" @@ -30,7 +31,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.RewardKey { + if name != manifest.RewardKey { return nil, xerrors.Errorf("actor code is not reward: %s", name) } diff --git a/chain/actors/builtin/reward/state.go.template b/chain/actors/builtin/reward/state.go.template index 104aefbaf..28ddb80f0 100644 --- a/chain/actors/builtin/reward/state.go.template +++ b/chain/actors/builtin/reward/state.go.template @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin" + "github.com/filecoin-project/go-state-types/manifest" {{if (le .v 7)}} miner{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/miner" @@ -122,7 +123,7 @@ func (s *state{{.v}}) GetState() interface{} { } func (s *state{{.v}}) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/reward/v0.go b/chain/actors/builtin/reward/v0.go index 332e97128..66736f9e0 100644 --- a/chain/actors/builtin/reward/v0.go +++ b/chain/actors/builtin/reward/v0.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward" smoothing0 "github.com/filecoin-project/specs-actors/actors/util/smoothing" @@ -99,7 +100,7 @@ func (s *state0) GetState() interface{} { } func (s *state0) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/reward/v10.go b/chain/actors/builtin/reward/v10.go index 75c23e1a6..3ffe9a267 100644 --- a/chain/actors/builtin/reward/v10.go +++ b/chain/actors/builtin/reward/v10.go @@ -10,6 +10,7 @@ import ( miner10 "github.com/filecoin-project/go-state-types/builtin/v10/miner" reward10 "github.com/filecoin-project/go-state-types/builtin/v10/reward" smoothing10 "github.com/filecoin-project/go-state-types/builtin/v10/util/smoothing" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -102,7 +103,7 @@ func (s *state10) GetState() interface{} { } func (s *state10) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/reward/v2.go b/chain/actors/builtin/reward/v2.go index 33f6c120f..6d640f2e9 100644 --- a/chain/actors/builtin/reward/v2.go +++ b/chain/actors/builtin/reward/v2.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner" reward2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/reward" smoothing2 "github.com/filecoin-project/specs-actors/v2/actors/util/smoothing" @@ -102,7 +103,7 @@ func (s *state2) GetState() interface{} { } func (s *state2) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/reward/v3.go b/chain/actors/builtin/reward/v3.go index d727a9861..fe8e555c9 100644 --- a/chain/actors/builtin/reward/v3.go +++ b/chain/actors/builtin/reward/v3.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" miner3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/miner" reward3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/reward" smoothing3 "github.com/filecoin-project/specs-actors/v3/actors/util/smoothing" @@ -102,7 +103,7 @@ func (s *state3) GetState() interface{} { } func (s *state3) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/reward/v4.go b/chain/actors/builtin/reward/v4.go index 94ebc43c4..f0decd392 100644 --- a/chain/actors/builtin/reward/v4.go +++ b/chain/actors/builtin/reward/v4.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" miner4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/miner" reward4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/reward" smoothing4 "github.com/filecoin-project/specs-actors/v4/actors/util/smoothing" @@ -102,7 +103,7 @@ func (s *state4) GetState() interface{} { } func (s *state4) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/reward/v5.go b/chain/actors/builtin/reward/v5.go index 563b8f42a..82be12c0a 100644 --- a/chain/actors/builtin/reward/v5.go +++ b/chain/actors/builtin/reward/v5.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner" reward5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/reward" smoothing5 "github.com/filecoin-project/specs-actors/v5/actors/util/smoothing" @@ -102,7 +103,7 @@ func (s *state5) GetState() interface{} { } func (s *state5) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/reward/v6.go b/chain/actors/builtin/reward/v6.go index 523736766..71884dada 100644 --- a/chain/actors/builtin/reward/v6.go +++ b/chain/actors/builtin/reward/v6.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" miner6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/miner" reward6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/reward" smoothing6 "github.com/filecoin-project/specs-actors/v6/actors/util/smoothing" @@ -102,7 +103,7 @@ func (s *state6) GetState() interface{} { } func (s *state6) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/reward/v7.go b/chain/actors/builtin/reward/v7.go index 79db860e1..bc39f3666 100644 --- a/chain/actors/builtin/reward/v7.go +++ b/chain/actors/builtin/reward/v7.go @@ -7,6 +7,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" miner7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/miner" reward7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/reward" smoothing7 "github.com/filecoin-project/specs-actors/v7/actors/util/smoothing" @@ -102,7 +103,7 @@ func (s *state7) GetState() interface{} { } func (s *state7) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/reward/v8.go b/chain/actors/builtin/reward/v8.go index a9d6fae69..5f6b96d29 100644 --- a/chain/actors/builtin/reward/v8.go +++ b/chain/actors/builtin/reward/v8.go @@ -10,6 +10,7 @@ import ( miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner" reward8 "github.com/filecoin-project/go-state-types/builtin/v8/reward" smoothing8 "github.com/filecoin-project/go-state-types/builtin/v8/util/smoothing" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -102,7 +103,7 @@ func (s *state8) GetState() interface{} { } func (s *state8) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/reward/v9.go b/chain/actors/builtin/reward/v9.go index 34b8a7d34..6118e2b30 100644 --- a/chain/actors/builtin/reward/v9.go +++ b/chain/actors/builtin/reward/v9.go @@ -10,6 +10,7 @@ import ( miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner" reward9 "github.com/filecoin-project/go-state-types/builtin/v9/reward" smoothing9 "github.com/filecoin-project/go-state-types/builtin/v9/util/smoothing" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -102,7 +103,7 @@ func (s *state9) GetState() interface{} { } func (s *state9) ActorKey() string { - return actors.RewardKey + return manifest.RewardKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/actor.go.template b/chain/actors/builtin/system/actor.go.template index a6442c6a9..b725f0820 100644 --- a/chain/actors/builtin/system/actor.go.template +++ b/chain/actors/builtin/system/actor.go.template @@ -3,6 +3,7 @@ package system import ( "github.com/ipfs/go-cid" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/types" @@ -24,7 +25,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.SystemKey { + if name != manifest.SystemKey { return nil, xerrors.Errorf("actor code is not system: %s", name) } diff --git a/chain/actors/builtin/system/state.go.template b/chain/actors/builtin/system/state.go.template index 62dba041a..c6cab0583 100644 --- a/chain/actors/builtin/system/state.go.template +++ b/chain/actors/builtin/system/state.go.template @@ -3,6 +3,7 @@ package system import ( "fmt" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" "github.com/ipfs/go-cid" @@ -63,7 +64,7 @@ func (s *state{{.v}}) SetBuiltinActors(c cid.Cid) error { } func (s *state{{.v}}) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/system.go b/chain/actors/builtin/system/system.go index 747563cc0..c7589efa1 100644 --- a/chain/actors/builtin/system/system.go +++ b/chain/actors/builtin/system/system.go @@ -6,6 +6,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" builtin10 "github.com/filecoin-project/go-state-types/builtin" + "github.com/filecoin-project/go-state-types/manifest" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin" @@ -25,7 +26,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.SystemKey { + if name != manifest.SystemKey { return nil, xerrors.Errorf("actor code is not system: %s", name) } diff --git a/chain/actors/builtin/system/v0.go b/chain/actors/builtin/system/v0.go index 17fa9e8c7..d5f0f079e 100644 --- a/chain/actors/builtin/system/v0.go +++ b/chain/actors/builtin/system/v0.go @@ -7,6 +7,7 @@ import ( "golang.org/x/xerrors" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" system0 "github.com/filecoin-project/specs-actors/actors/builtin/system" "github.com/filecoin-project/lotus/chain/actors" @@ -52,7 +53,7 @@ func (s *state0) SetBuiltinActors(c cid.Cid) error { } func (s *state0) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/v10.go b/chain/actors/builtin/system/v10.go index e6d6fbe96..2cdb39682 100644 --- a/chain/actors/builtin/system/v10.go +++ b/chain/actors/builtin/system/v10.go @@ -7,6 +7,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" system10 "github.com/filecoin-project/go-state-types/builtin/v10/system" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -54,7 +55,7 @@ func (s *state10) SetBuiltinActors(c cid.Cid) error { } func (s *state10) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/v2.go b/chain/actors/builtin/system/v2.go index 7821bee58..b0c642054 100644 --- a/chain/actors/builtin/system/v2.go +++ b/chain/actors/builtin/system/v2.go @@ -7,6 +7,7 @@ import ( "golang.org/x/xerrors" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" system2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/system" "github.com/filecoin-project/lotus/chain/actors" @@ -52,7 +53,7 @@ func (s *state2) SetBuiltinActors(c cid.Cid) error { } func (s *state2) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/v3.go b/chain/actors/builtin/system/v3.go index 0c80218c4..8334f780e 100644 --- a/chain/actors/builtin/system/v3.go +++ b/chain/actors/builtin/system/v3.go @@ -7,6 +7,7 @@ import ( "golang.org/x/xerrors" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" system3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/system" "github.com/filecoin-project/lotus/chain/actors" @@ -52,7 +53,7 @@ func (s *state3) SetBuiltinActors(c cid.Cid) error { } func (s *state3) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/v4.go b/chain/actors/builtin/system/v4.go index e41792110..227104f37 100644 --- a/chain/actors/builtin/system/v4.go +++ b/chain/actors/builtin/system/v4.go @@ -7,6 +7,7 @@ import ( "golang.org/x/xerrors" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" system4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/system" "github.com/filecoin-project/lotus/chain/actors" @@ -52,7 +53,7 @@ func (s *state4) SetBuiltinActors(c cid.Cid) error { } func (s *state4) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/v5.go b/chain/actors/builtin/system/v5.go index a2760b096..bbfb70b51 100644 --- a/chain/actors/builtin/system/v5.go +++ b/chain/actors/builtin/system/v5.go @@ -7,6 +7,7 @@ import ( "golang.org/x/xerrors" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" system5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/system" "github.com/filecoin-project/lotus/chain/actors" @@ -52,7 +53,7 @@ func (s *state5) SetBuiltinActors(c cid.Cid) error { } func (s *state5) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/v6.go b/chain/actors/builtin/system/v6.go index 0de085a5e..2319b5929 100644 --- a/chain/actors/builtin/system/v6.go +++ b/chain/actors/builtin/system/v6.go @@ -7,6 +7,7 @@ import ( "golang.org/x/xerrors" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" system6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/system" "github.com/filecoin-project/lotus/chain/actors" @@ -52,7 +53,7 @@ func (s *state6) SetBuiltinActors(c cid.Cid) error { } func (s *state6) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/v7.go b/chain/actors/builtin/system/v7.go index 2753251c0..0b10129e8 100644 --- a/chain/actors/builtin/system/v7.go +++ b/chain/actors/builtin/system/v7.go @@ -7,6 +7,7 @@ import ( "golang.org/x/xerrors" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" system7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/system" "github.com/filecoin-project/lotus/chain/actors" @@ -52,7 +53,7 @@ func (s *state7) SetBuiltinActors(c cid.Cid) error { } func (s *state7) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/v8.go b/chain/actors/builtin/system/v8.go index 00cafdfed..eca3b0c04 100644 --- a/chain/actors/builtin/system/v8.go +++ b/chain/actors/builtin/system/v8.go @@ -7,6 +7,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" system8 "github.com/filecoin-project/go-state-types/builtin/v8/system" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -54,7 +55,7 @@ func (s *state8) SetBuiltinActors(c cid.Cid) error { } func (s *state8) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/system/v9.go b/chain/actors/builtin/system/v9.go index 8bf96a917..55e073efe 100644 --- a/chain/actors/builtin/system/v9.go +++ b/chain/actors/builtin/system/v9.go @@ -7,6 +7,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" system9 "github.com/filecoin-project/go-state-types/builtin/v9/system" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -54,7 +55,7 @@ func (s *state9) SetBuiltinActors(c cid.Cid) error { } func (s *state9) ActorKey() string { - return actors.SystemKey + return manifest.SystemKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/actor.go.template b/chain/actors/builtin/verifreg/actor.go.template index 97d1417f7..9f9efef92 100644 --- a/chain/actors/builtin/verifreg/actor.go.template +++ b/chain/actors/builtin/verifreg/actor.go.template @@ -3,6 +3,7 @@ package verifreg import ( "github.com/ipfs/go-cid" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" "golang.org/x/xerrors" "github.com/filecoin-project/go-address" @@ -29,7 +30,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.VerifregKey { + if name != manifest.VerifregKey { return nil, xerrors.Errorf("actor code is not verifreg: %s", name) } diff --git a/chain/actors/builtin/verifreg/state.go.template b/chain/actors/builtin/verifreg/state.go.template index 960b2b604..526dff54e 100644 --- a/chain/actors/builtin/verifreg/state.go.template +++ b/chain/actors/builtin/verifreg/state.go.template @@ -3,6 +3,7 @@ package verifreg import ( "fmt" actorstypes "github.com/filecoin-project/go-state-types/actors" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" "github.com/ipfs/go-cid" @@ -170,7 +171,7 @@ func (s *state{{.v}}) GetClaims(providerIdAddr address.Address) (map[ClaimId]Cla } func (s *state{{.v}}) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state{{.v}}) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/v0.go b/chain/actors/builtin/verifreg/v0.go index 4917667ea..8d97ebbc2 100644 --- a/chain/actors/builtin/verifreg/v0.go +++ b/chain/actors/builtin/verifreg/v0.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" adt0 "github.com/filecoin-project/specs-actors/actors/util/adt" @@ -118,7 +119,7 @@ func (s *state0) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, e } func (s *state0) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state0) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/v10.go b/chain/actors/builtin/verifreg/v10.go index a510d1970..63b161da3 100644 --- a/chain/actors/builtin/verifreg/v10.go +++ b/chain/actors/builtin/verifreg/v10.go @@ -14,6 +14,7 @@ import ( adt10 "github.com/filecoin-project/go-state-types/builtin/v10/util/adt" verifreg10 "github.com/filecoin-project/go-state-types/builtin/v10/verifreg" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -134,7 +135,7 @@ func (s *state10) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, } func (s *state10) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state10) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/v2.go b/chain/actors/builtin/verifreg/v2.go index 28061c2d1..61c175c7a 100644 --- a/chain/actors/builtin/verifreg/v2.go +++ b/chain/actors/builtin/verifreg/v2.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" verifreg2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/verifreg" adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt" @@ -118,7 +119,7 @@ func (s *state2) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, e } func (s *state2) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state2) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/v3.go b/chain/actors/builtin/verifreg/v3.go index 4096059a6..5ba478500 100644 --- a/chain/actors/builtin/verifreg/v3.go +++ b/chain/actors/builtin/verifreg/v3.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin" verifreg3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/verifreg" adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt" @@ -119,7 +120,7 @@ func (s *state3) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, e } func (s *state3) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state3) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/v4.go b/chain/actors/builtin/verifreg/v4.go index 457704504..3ad739f68 100644 --- a/chain/actors/builtin/verifreg/v4.go +++ b/chain/actors/builtin/verifreg/v4.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin" verifreg4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/verifreg" adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt" @@ -119,7 +120,7 @@ func (s *state4) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, e } func (s *state4) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state4) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/v5.go b/chain/actors/builtin/verifreg/v5.go index b1e6db424..1ffe06f3f 100644 --- a/chain/actors/builtin/verifreg/v5.go +++ b/chain/actors/builtin/verifreg/v5.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin" verifreg5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/verifreg" adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt" @@ -119,7 +120,7 @@ func (s *state5) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, e } func (s *state5) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state5) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/v6.go b/chain/actors/builtin/verifreg/v6.go index d66ae105c..9786838d1 100644 --- a/chain/actors/builtin/verifreg/v6.go +++ b/chain/actors/builtin/verifreg/v6.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin" verifreg6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/verifreg" adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt" @@ -119,7 +120,7 @@ func (s *state6) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, e } func (s *state6) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state6) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/v7.go b/chain/actors/builtin/verifreg/v7.go index 72235e268..e63e27742 100644 --- a/chain/actors/builtin/verifreg/v7.go +++ b/chain/actors/builtin/verifreg/v7.go @@ -10,6 +10,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin" verifreg7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/verifreg" adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt" @@ -118,7 +119,7 @@ func (s *state7) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, e } func (s *state7) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state7) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/v8.go b/chain/actors/builtin/verifreg/v8.go index b39895bd9..a1edeba34 100644 --- a/chain/actors/builtin/verifreg/v8.go +++ b/chain/actors/builtin/verifreg/v8.go @@ -13,6 +13,7 @@ import ( adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt" verifreg8 "github.com/filecoin-project/go-state-types/builtin/v8/verifreg" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -118,7 +119,7 @@ func (s *state8) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, e } func (s *state8) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state8) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/v9.go b/chain/actors/builtin/verifreg/v9.go index 2348007e6..bf6424ba7 100644 --- a/chain/actors/builtin/verifreg/v9.go +++ b/chain/actors/builtin/verifreg/v9.go @@ -13,6 +13,7 @@ import ( builtin9 "github.com/filecoin-project/go-state-types/builtin" adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/adt" @@ -133,7 +134,7 @@ func (s *state9) GetClaims(providerIdAddr address.Address) (map[ClaimId]Claim, e } func (s *state9) ActorKey() string { - return actors.VerifregKey + return manifest.VerifregKey } func (s *state9) ActorVersion() actorstypes.Version { diff --git a/chain/actors/builtin/verifreg/verifreg.go b/chain/actors/builtin/verifreg/verifreg.go index 82c630c0f..1380a9207 100644 --- a/chain/actors/builtin/verifreg/verifreg.go +++ b/chain/actors/builtin/verifreg/verifreg.go @@ -10,6 +10,7 @@ import ( builtin10 "github.com/filecoin-project/go-state-types/builtin" verifregtypes "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" "github.com/filecoin-project/go-state-types/cbor" + "github.com/filecoin-project/go-state-types/manifest" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin" @@ -30,7 +31,7 @@ var ( func Load(store adt.Store, act *types.Actor) (State, error) { if name, av, ok := actors.GetActorMetaByCode(act.Code); ok { - if name != actors.VerifregKey { + if name != manifest.VerifregKey { return nil, xerrors.Errorf("actor code is not verifreg: %s", name) } diff --git a/chain/actors/manifest.go b/chain/actors/manifest.go index 225c8b990..f58768ca2 100644 --- a/chain/actors/manifest.go +++ b/chain/actors/manifest.go @@ -15,50 +15,9 @@ import ( "github.com/filecoin-project/lotus/chain/actors/adt" ) -var manifestCids map[actorstypes.Version]cid.Cid = make(map[actorstypes.Version]cid.Cid) -var manifests map[actorstypes.Version]map[string]cid.Cid = make(map[actorstypes.Version]map[string]cid.Cid) -var actorMeta map[cid.Cid]actorEntry = make(map[cid.Cid]actorEntry) - -const ( - AccountKey = "account" - CronKey = "cron" - InitKey = "init" - MarketKey = "storagemarket" - MinerKey = "storageminer" - MultisigKey = "multisig" - PaychKey = "paymentchannel" - PowerKey = "storagepower" - RewardKey = "reward" - SystemKey = "system" - VerifregKey = "verifiedregistry" - DatacapKey = "datacap" - EvmKey = "evm" - EamKey = "eam" - EmbryoKey = "embryo" -) - -func GetBuiltinActorsKeys(av actorstypes.Version) []string { - keys := []string{ - AccountKey, - CronKey, - InitKey, - MarketKey, - MinerKey, - MultisigKey, - PaychKey, - PowerKey, - RewardKey, - SystemKey, - VerifregKey, - } - if av >= 9 { - keys = append(keys, DatacapKey) - } - if av >= 10 { - keys = append(keys, EvmKey, EamKey, EmbryoKey) - } - return keys -} +var manifestCids = make(map[actorstypes.Version]cid.Cid) +var manifests = make(map[actorstypes.Version]map[string]cid.Cid) +var actorMeta = make(map[cid.Cid]actorEntry) var ( manifestMx sync.RWMutex diff --git a/chain/consensus/filcns/upgrades.go b/chain/consensus/filcns/upgrades.go index f3345ea7d..54e507277 100644 --- a/chain/consensus/filcns/upgrades.go +++ b/chain/consensus/filcns/upgrades.go @@ -1651,10 +1651,10 @@ func LiteMigration(ctx context.Context, bstore blockstore.Blockstore, newActorsM return cid.Undef, xerrors.Errorf("error loading new manifest data: %w", err) } - if len(oldManifestData.Entries) != len(actors.GetBuiltinActorsKeys(oldAv)) { + if len(oldManifestData.Entries) != len(manifest.GetBuiltinActorsKeys(oldAv)) { return cid.Undef, xerrors.Errorf("incomplete old manifest with %d code CIDs", len(oldManifestData.Entries)) } - if len(newManifestData.Entries) != len(actors.GetBuiltinActorsKeys(newAv)) { + if len(newManifestData.Entries) != len(manifest.GetBuiltinActorsKeys(newAv)) { return cid.Undef, xerrors.Errorf("incomplete new manifest with %d code CIDs", len(newManifestData.Entries)) } diff --git a/chain/gen/genesis/f00_system.go b/chain/gen/genesis/f00_system.go index 93849bcc9..5c6ecacbf 100644 --- a/chain/gen/genesis/f00_system.go +++ b/chain/gen/genesis/f00_system.go @@ -48,7 +48,7 @@ func SetupSystemActor(ctx context.Context, bs bstore.Blockstore, av actorstypes. return nil, err } - actcid, ok := actors.GetActorCodeID(av, actors.SystemKey) + actcid, ok := actors.GetActorCodeID(av, manifest.SystemKey) if !ok { return nil, xerrors.Errorf("failed to get system actor code ID for actors version %d", av) } diff --git a/chain/gen/genesis/f01_init.go b/chain/gen/genesis/f01_init.go index 26062cf27..706328d21 100644 --- a/chain/gen/genesis/f01_init.go +++ b/chain/gen/genesis/f01_init.go @@ -13,6 +13,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/specs-actors/actors/util/adt" bstore "github.com/filecoin-project/lotus/blockstore" @@ -174,7 +175,7 @@ func SetupInitActor(ctx context.Context, bs bstore.Blockstore, netname string, i return 0, nil, nil, err } - actcid, ok := actors.GetActorCodeID(av, actors.InitKey) + actcid, ok := actors.GetActorCodeID(av, manifest.InitKey) if !ok { return 0, nil, nil, xerrors.Errorf("failed to get init actor code ID for actors version %d", av) } diff --git a/chain/gen/genesis/f02_reward.go b/chain/gen/genesis/f02_reward.go index 4a5ac9fa1..db32517f9 100644 --- a/chain/gen/genesis/f02_reward.go +++ b/chain/gen/genesis/f02_reward.go @@ -8,6 +8,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" bstore "github.com/filecoin-project/lotus/blockstore" "github.com/filecoin-project/lotus/build" @@ -29,7 +30,7 @@ func SetupRewardActor(ctx context.Context, bs bstore.Blockstore, qaPower big.Int return nil, err } - actcid, ok := actors.GetActorCodeID(av, actors.RewardKey) + actcid, ok := actors.GetActorCodeID(av, manifest.RewardKey) if !ok { return nil, xerrors.Errorf("failed to get reward actor code ID for actors version %d", av) } diff --git a/chain/gen/genesis/f03_cron.go b/chain/gen/genesis/f03_cron.go index 16396c437..4c377b191 100644 --- a/chain/gen/genesis/f03_cron.go +++ b/chain/gen/genesis/f03_cron.go @@ -8,6 +8,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" bstore "github.com/filecoin-project/lotus/blockstore" "github.com/filecoin-project/lotus/chain/actors" @@ -28,7 +29,7 @@ func SetupCronActor(ctx context.Context, bs bstore.Blockstore, av actorstypes.Ve return nil, err } - actcid, ok := actors.GetActorCodeID(av, actors.CronKey) + actcid, ok := actors.GetActorCodeID(av, manifest.CronKey) if !ok { return nil, xerrors.Errorf("failed to get cron actor code ID for actors version %d", av) } diff --git a/chain/gen/genesis/f04_power.go b/chain/gen/genesis/f04_power.go index f05b0c746..385cc97d2 100644 --- a/chain/gen/genesis/f04_power.go +++ b/chain/gen/genesis/f04_power.go @@ -8,6 +8,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/specs-actors/actors/util/adt" bstore "github.com/filecoin-project/lotus/blockstore" @@ -29,7 +30,7 @@ func SetupStoragePowerActor(ctx context.Context, bs bstore.Blockstore, av actors return nil, err } - actcid, ok := actors.GetActorCodeID(av, actors.PowerKey) + actcid, ok := actors.GetActorCodeID(av, manifest.PowerKey) if !ok { return nil, xerrors.Errorf("failed to get power actor code ID for actors version %d", av) } diff --git a/chain/gen/genesis/f05_market.go b/chain/gen/genesis/f05_market.go index 28a258c40..59c61a3ae 100644 --- a/chain/gen/genesis/f05_market.go +++ b/chain/gen/genesis/f05_market.go @@ -8,6 +8,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" bstore "github.com/filecoin-project/lotus/blockstore" "github.com/filecoin-project/lotus/chain/actors" @@ -28,7 +29,7 @@ func SetupStorageMarketActor(ctx context.Context, bs bstore.Blockstore, av actor return nil, err } - actcid, ok := actors.GetActorCodeID(av, actors.MarketKey) + actcid, ok := actors.GetActorCodeID(av, manifest.MarketKey) if !ok { return nil, xerrors.Errorf("failed to get market actor code ID for actors version %d", av) } diff --git a/chain/gen/genesis/f06_vreg.go b/chain/gen/genesis/f06_vreg.go index 1b3582d4d..ffddc814f 100644 --- a/chain/gen/genesis/f06_vreg.go +++ b/chain/gen/genesis/f06_vreg.go @@ -9,6 +9,7 @@ import ( "github.com/filecoin-project/go-address" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/specs-actors/actors/util/adt" bstore "github.com/filecoin-project/lotus/blockstore" @@ -41,7 +42,7 @@ func SetupVerifiedRegistryActor(ctx context.Context, bs bstore.Blockstore, av ac return nil, err } - actcid, ok := actors.GetActorCodeID(av, actors.VerifregKey) + actcid, ok := actors.GetActorCodeID(av, manifest.VerifregKey) if !ok { return nil, xerrors.Errorf("failed to get verifreg actor code ID for actors version %d", av) } diff --git a/chain/gen/genesis/f07_dcap.go b/chain/gen/genesis/f07_dcap.go index 235cb0ce3..ba7f48e8b 100644 --- a/chain/gen/genesis/f07_dcap.go +++ b/chain/gen/genesis/f07_dcap.go @@ -10,6 +10,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/builtin" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/specs-actors/actors/util/adt" bstore "github.com/filecoin-project/lotus/blockstore" @@ -41,7 +42,7 @@ func SetupDatacapActor(ctx context.Context, bs bstore.Blockstore, av actorstypes return nil, err } - actcid, ok := actors.GetActorCodeID(av, actors.DatacapKey) + actcid, ok := actors.GetActorCodeID(av, manifest.DataCapKey) if !ok { return nil, xerrors.Errorf("failed to get datacap actor code ID for actors version %d", av) } diff --git a/chain/gen/genesis/genesis.go b/chain/gen/genesis/genesis.go index 964dc2f1c..300571f15 100644 --- a/chain/gen/genesis/genesis.go +++ b/chain/gen/genesis/genesis.go @@ -17,6 +17,7 @@ import ( actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/crypto" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/go-state-types/network" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" @@ -380,7 +381,7 @@ func MakeAccountActor(ctx context.Context, cst cbor.IpldStore, av actorstypes.Ve return nil, err } - actcid, ok := actors.GetActorCodeID(av, actors.AccountKey) + actcid, ok := actors.GetActorCodeID(av, manifest.AccountKey) if !ok { return nil, xerrors.Errorf("failed to get account actor code ID for actors version %d", av) } @@ -463,7 +464,7 @@ func CreateMultisigAccount(ctx context.Context, cst cbor.IpldStore, state *state return err } - actcid, ok := actors.GetActorCodeID(av, actors.MultisigKey) + actcid, ok := actors.GetActorCodeID(av, manifest.MultisigKey) if !ok { return xerrors.Errorf("failed to get multisig code ID for actors version %d", av) } diff --git a/chain/vm/fvm.go b/chain/vm/fvm.go index b229c826c..653110586 100644 --- a/chain/vm/fvm.go +++ b/chain/vm/fvm.go @@ -23,6 +23,7 @@ import ( "github.com/filecoin-project/go-state-types/abi" actorstypes "github.com/filecoin-project/go-state-types/actors" "github.com/filecoin-project/go-state-types/exitcode" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/lotus/blockstore" "github.com/filecoin-project/lotus/build" @@ -400,7 +401,7 @@ func NewDebugFVM(ctx context.Context, opts *VMOpts) (*FVM, error) { // create actor redirect mapping actorRedirect := make(map[cid.Cid]cid.Cid) - for _, key := range actors.GetBuiltinActorsKeys(av) { + for _, key := range manifest.GetBuiltinActorsKeys(av) { from, ok := actors.GetActorCodeID(av, key) if !ok { log.Warnf("actor missing in the from manifest %s", key) diff --git a/cmd/lotus-shed/migrations.go b/cmd/lotus-shed/migrations.go index f23942326..ce570c6ac 100644 --- a/cmd/lotus-shed/migrations.go +++ b/cmd/lotus-shed/migrations.go @@ -24,6 +24,7 @@ import ( miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner" adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt" verifreg9 "github.com/filecoin-project/go-state-types/builtin/v9/verifreg" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/specs-actors/v7/actors/migration/nv15" "github.com/filecoin-project/lotus/blockstore" @@ -587,7 +588,7 @@ func checkAllMinersUnsealedCID(stateTreeV9 *state.StateTree, store adt.Store) er } func checkMinerUnsealedCID(act *types.Actor, stateTreeV9 *state.StateTree, store adt.Store) error { - minerCodeCid, found := actors.GetActorCodeID(actorstypes.Version9, actors.MinerKey) + minerCodeCid, found := actors.GetActorCodeID(actorstypes.Version9, manifest.MinerKey) if !found { return xerrors.Errorf("could not find code cid for miner actor") } diff --git a/itests/lite_migration_test.go b/itests/lite_migration_test.go index 541a56b21..0f846e6fa 100644 --- a/itests/lite_migration_test.go +++ b/itests/lite_migration_test.go @@ -19,7 +19,6 @@ import ( "github.com/filecoin-project/specs-actors/v8/actors/util/adt" "github.com/filecoin-project/lotus/blockstore" - "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/builtin/system" "github.com/filecoin-project/lotus/chain/consensus/filcns" "github.com/filecoin-project/lotus/chain/state" @@ -95,7 +94,7 @@ func makeTestManifest(t *testing.T, ctxStore adt.Store, av actorstypes.Version) builder := cid.V1Builder{Codec: cid.Raw, MhType: mh.IDENTITY} manifestData := manifest.ManifestData{} - for _, name := range actors.GetBuiltinActorsKeys(av) { + for _, name := range manifest.GetBuiltinActorsKeys(av) { codeCid, err := builder.Sum([]byte(fmt.Sprintf("fil/8/%s", name))) if err != nil { t.Fatal(err) diff --git a/storage/wdpost/wdpost_run_test.go b/storage/wdpost/wdpost_run_test.go index 140e0886e..64d470dba 100644 --- a/storage/wdpost/wdpost_run_test.go +++ b/storage/wdpost/wdpost_run_test.go @@ -19,6 +19,7 @@ import ( minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner" "github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/dline" + "github.com/filecoin-project/go-state-types/manifest" "github.com/filecoin-project/go-state-types/network" prooftypes "github.com/filecoin-project/go-state-types/proof" tutils "github.com/filecoin-project/specs-actors/v2/support/testing" @@ -570,7 +571,7 @@ func (m *mockStorageMinerAPI) StateMinerProvingDeadline(ctx context.Context, add } func (m *mockStorageMinerAPI) StateGetActor(ctx context.Context, actor address.Address, ts types.TipSetKey) (*types.Actor, error) { - code, ok := actors.GetActorCodeID(actorstypes.Version7, actors.MinerKey) + code, ok := actors.GetActorCodeID(actorstypes.Version7, manifest.MinerKey) if !ok { return nil, xerrors.Errorf("failed to get miner actor code ID for actors version %d", actors.Version7) } From 9720ce68f236ff49fdbb52a6abb4169a60b4f9c1 Mon Sep 17 00:00:00 2001 From: Ian Davis Date: Tue, 13 Dec 2022 15:49:23 -0800 Subject: [PATCH 73/76] Download the right go binary on darwin-arm64 --- .circleci/config.yml | 8 +++++++- .circleci/template.yml | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 4e9ab435e..9bb1b5d47 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -34,6 +34,10 @@ commands: default: false description: is a darwin build environment? type: boolean + darwin-architecture: + default: "amd64" + description: which darwin architecture is being used? + type: string steps: - checkout - git_fetch_all_tags @@ -59,7 +63,7 @@ commands: - run: name: Install Go command: | - curl https://dl.google.com/go/go`cat GO_VERSION_MIN`.darwin-amd64.pkg -o /tmp/go.pkg && \ + curl https://dl.google.com/go/go`cat GO_VERSION_MIN`.darwin-<>.pkg -o /tmp/go.pkg && \ sudo installer -pkg /tmp/go.pkg -target / - run: name: Export Go @@ -276,6 +280,7 @@ jobs: - prepare: linux: false darwin: true + darwin-architecture: amd64 - run: make lotus lotus-miner lotus-worker - run: name: check tag and version output match @@ -298,6 +303,7 @@ jobs: - prepare: linux: false darwin: true + darwin-architecture: arm64 - run: | export CPATH=$(brew --prefix)/include export LIBRARY_PATH=$(brew --prefix)/lib diff --git a/.circleci/template.yml b/.circleci/template.yml index 4c7ca9e1b..f5eda5b79 100644 --- a/.circleci/template.yml +++ b/.circleci/template.yml @@ -34,6 +34,10 @@ commands: default: false description: is a darwin build environment? type: boolean + darwin-architecture: + default: "amd64" + description: which darwin architecture is being used? + type: string steps: - checkout - git_fetch_all_tags @@ -59,7 +63,7 @@ commands: - run: name: Install Go command: | - curl https://dl.google.com/go/go`cat GO_VERSION_MIN`.darwin-amd64.pkg -o /tmp/go.pkg && \ + curl https://dl.google.com/go/go`cat GO_VERSION_MIN`.darwin-<>.pkg -o /tmp/go.pkg && \ sudo installer -pkg /tmp/go.pkg -target / - run: name: Export Go @@ -276,6 +280,7 @@ jobs: - prepare: linux: false darwin: true + darwin-architecture: amd64 - run: make lotus lotus-miner lotus-worker - run: name: check tag and version output match @@ -298,6 +303,7 @@ jobs: - prepare: linux: false darwin: true + darwin-architecture: arm64 - run: | export CPATH=$(brew --prefix)/include export LIBRARY_PATH=$(brew --prefix)/lib From 93d12e1642f2cb6e2d4a1bcfddd51a26f0476e63 Mon Sep 17 00:00:00 2001 From: Ian Davis Date: Tue, 13 Dec 2022 15:49:45 -0800 Subject: [PATCH 74/76] Add v prefix to .tar.gz file names --- .goreleaser.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 7e96e3ce8..766f4f30a 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -65,6 +65,7 @@ archives: - id: primary format: tar.gz wrap_in_directory: true + name_template: "{{ .ProjectName }}_v{{ .Version }}_{{ .Os }}_{{ .Arch }}" files: # this is a dumb but required hack so it doesn't include the default files # https://github.com/goreleaser/goreleaser/issues/602 @@ -105,4 +106,4 @@ checksum: disable: true snapshot: - name_template: "{{ .Tag }}" + name_template: "{{ .Version }}" From 8960c11f86e24239ae5655c816c8d111cf6b5963 Mon Sep 17 00:00:00 2001 From: Ian Davis Date: Tue, 13 Dec 2022 15:53:01 -0800 Subject: [PATCH 75/76] Add otool -hv check to make sure binary is correct --- .circleci/config.yml | 2 ++ .circleci/template.yml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 9bb1b5d47..5dd617e6a 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -282,6 +282,7 @@ jobs: darwin: true darwin-architecture: amd64 - run: make lotus lotus-miner lotus-worker + - run: otool -hv lotus - run: name: check tag and version output match command: ./scripts/version-check.sh ./lotus @@ -308,6 +309,7 @@ jobs: export CPATH=$(brew --prefix)/include export LIBRARY_PATH=$(brew --prefix)/lib make lotus lotus-miner lotus-worker + - run: otool -hv lotus - run: name: check tag and version output match command: ./scripts/version-check.sh ./lotus diff --git a/.circleci/template.yml b/.circleci/template.yml index f5eda5b79..4240d7ae2 100644 --- a/.circleci/template.yml +++ b/.circleci/template.yml @@ -282,6 +282,7 @@ jobs: darwin: true darwin-architecture: amd64 - run: make lotus lotus-miner lotus-worker + - run: otool -hv lotus - run: name: check tag and version output match command: ./scripts/version-check.sh ./lotus @@ -308,6 +309,7 @@ jobs: export CPATH=$(brew --prefix)/include export LIBRARY_PATH=$(brew --prefix)/lib make lotus lotus-miner lotus-worker + - run: otool -hv lotus - run: name: check tag and version output match command: ./scripts/version-check.sh ./lotus From 8c566c3bda72997236afcb3af09f5a9e2f761f5e Mon Sep 17 00:00:00 2001 From: Geoff Stuart Date: Wed, 14 Dec 2022 12:27:06 -0500 Subject: [PATCH 76/76] Print addr when key not found --- chain/wallet/multi.go | 10 +++++----- chain/wallet/wallet.go | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/chain/wallet/multi.go b/chain/wallet/multi.go index a88475c2e..91d271477 100644 --- a/chain/wallet/multi.go +++ b/chain/wallet/multi.go @@ -120,22 +120,22 @@ func (m MultiWallet) WalletSign(ctx context.Context, signer address.Address, toS return nil, err } if w == nil { - return nil, xerrors.Errorf("key not found") + return nil, xerrors.Errorf("key not found for %s", signer) } return w.WalletSign(ctx, signer, toSign, meta) } -func (m MultiWallet) WalletExport(ctx context.Context, address address.Address) (*types.KeyInfo, error) { - w, err := m.find(ctx, address, m.Remote, m.Local) +func (m MultiWallet) WalletExport(ctx context.Context, addr address.Address) (*types.KeyInfo, error) { + w, err := m.find(ctx, addr, m.Remote, m.Local) if err != nil { return nil, err } if w == nil { - return nil, xerrors.Errorf("key not found") + return nil, xerrors.Errorf("key not found for %s", addr) } - return w.WalletExport(ctx, address) + return w.WalletExport(ctx, addr) } func (m MultiWallet) WalletImport(ctx context.Context, info *types.KeyInfo) (address.Address, error) { diff --git a/chain/wallet/wallet.go b/chain/wallet/wallet.go index b88d776b5..2f382d5f8 100644 --- a/chain/wallet/wallet.go +++ b/chain/wallet/wallet.go @@ -140,7 +140,7 @@ func (w *LocalWallet) WalletExport(ctx context.Context, addr address.Address) (* return nil, xerrors.Errorf("failed to find key to export: %w", err) } if k == nil { - return nil, xerrors.Errorf("key not found") + return nil, xerrors.Errorf("key not found for %s", addr) } return &k.KeyInfo, nil