Skip to content

Commit

Permalink
feat: support v2 actor codes (#84)
Browse files Browse the repository at this point in the history
* feat: support v2 actor codes

* chore: Update go.sum

Co-authored-by: Mike Greenberg <[email protected]>
  • Loading branch information
iand and placer14 authored Oct 11, 2020
1 parent 10fd147 commit 4c57122
Show file tree
Hide file tree
Showing 7 changed files with 69 additions and 38 deletions.
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ require (
contrib.go.opencensus.io/exporter/prometheus v0.1.0
github.com/AndreasBriese/bbloom v0.0.0-20190825152654-46b345b51c96 // indirect
github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c // indirect
github.com/filecoin-project/go-address v0.0.3
github.com/filecoin-project/go-amt-ipld/v2 v2.1.1-0.20200731171407-e559a0579161 // indirect
github.com/filecoin-project/go-bitfield v0.2.0
github.com/filecoin-project/go-address v0.0.4
github.com/filecoin-project/go-bitfield v0.2.1
github.com/filecoin-project/go-jsonrpc v0.1.2-0.20200822201400-474f4fdccc52
github.com/filecoin-project/go-state-types v0.0.0-20200911004822-964d6c679cfc
github.com/filecoin-project/lotus v0.8.0
github.com/filecoin-project/specs-actors v0.9.11
github.com/filecoin-project/go-state-types v0.0.0-20200928172055-2df22083d8ab
github.com/filecoin-project/lotus v0.9.0
github.com/filecoin-project/specs-actors v0.9.12
github.com/filecoin-project/specs-actors/v2 v2.0.1
github.com/go-pg/migrations/v8 v8.0.1
github.com/go-pg/pg/v10 v10.3.1
github.com/go-pg/pgext v0.1.4
Expand Down
61 changes: 41 additions & 20 deletions go.sum

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions tasks/actorstate/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (
"golang.org/x/xerrors"

"github.com/filecoin-project/lotus/chain/events/state"
"github.com/filecoin-project/specs-actors/actors/builtin"
sa0builtin "github.com/filecoin-project/specs-actors/actors/builtin"
sa2builtin "github.com/filecoin-project/specs-actors/v2/actors/builtin"

"github.com/filecoin-project/sentinel-visor/metrics"
"github.com/filecoin-project/sentinel-visor/model"
Expand All @@ -20,7 +21,8 @@ import (
type InitExtractor struct{}

func init() {
Register(builtin.InitActorCodeID, InitExtractor{})
Register(sa0builtin.InitActorCodeID, InitExtractor{})
Register(sa2builtin.InitActorCodeID, InitExtractor{})
}

func (InitExtractor) Extract(ctx context.Context, a ActorInfo, node ActorStateAPI) (model.Persistable, error) {
Expand Down
6 changes: 4 additions & 2 deletions tasks/actorstate/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import (

market "github.com/filecoin-project/lotus/chain/actors/builtin/market"
"github.com/filecoin-project/lotus/chain/events/state"
"github.com/filecoin-project/specs-actors/actors/builtin"
sa0builtin "github.com/filecoin-project/specs-actors/actors/builtin"
sa2builtin "github.com/filecoin-project/specs-actors/v2/actors/builtin"

"github.com/filecoin-project/sentinel-visor/metrics"
"github.com/filecoin-project/sentinel-visor/model"
Expand All @@ -21,7 +22,8 @@ import (
type StorageMarketExtractor struct{}

func init() {
Register(builtin.StorageMarketActorCodeID, StorageMarketExtractor{})
Register(sa0builtin.StorageMarketActorCodeID, StorageMarketExtractor{})
Register(sa2builtin.StorageMarketActorCodeID, StorageMarketExtractor{})
}

func (m StorageMarketExtractor) Extract(ctx context.Context, a ActorInfo, node ActorStateAPI) (model.Persistable, error) {
Expand Down
6 changes: 4 additions & 2 deletions tasks/actorstate/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (
"golang.org/x/xerrors"

miner "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/specs-actors/actors/builtin"
sa0builtin "github.com/filecoin-project/specs-actors/actors/builtin"
sa2builtin "github.com/filecoin-project/specs-actors/v2/actors/builtin"

"github.com/filecoin-project/sentinel-visor/metrics"
"github.com/filecoin-project/sentinel-visor/model"
Expand All @@ -20,7 +21,8 @@ import (
type StorageMinerExtractor struct{}

func init() {
Register(builtin.StorageMinerActorCodeID, StorageMinerExtractor{})
Register(sa0builtin.StorageMinerActorCodeID, StorageMinerExtractor{})
Register(sa2builtin.StorageMinerActorCodeID, StorageMinerExtractor{})
}

func (m StorageMinerExtractor) Extract(ctx context.Context, a ActorInfo, node ActorStateAPI) (model.Persistable, error) {
Expand Down
8 changes: 5 additions & 3 deletions tasks/actorstate/power.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ import (
"golang.org/x/xerrors"

"github.com/filecoin-project/lotus/chain/actors/builtin/power"
"github.com/filecoin-project/specs-actors/actors/builtin"
sa0builtin "github.com/filecoin-project/specs-actors/actors/builtin"
sa2builtin "github.com/filecoin-project/specs-actors/v2/actors/builtin"

"github.com/filecoin-project/sentinel-visor/metrics"
"github.com/filecoin-project/sentinel-visor/model"
Expand All @@ -20,7 +21,8 @@ import (
type StoragePowerExtractor struct{}

func init() {
Register(builtin.StoragePowerActorCodeID, StoragePowerExtractor{})
Register(sa0builtin.StoragePowerActorCodeID, StoragePowerExtractor{})
Register(sa2builtin.StoragePowerActorCodeID, StoragePowerExtractor{})
}

func (StoragePowerExtractor) Extract(ctx context.Context, a ActorInfo, node ActorStateAPI) (model.Persistable, error) {
Expand All @@ -30,7 +32,7 @@ func (StoragePowerExtractor) Extract(ctx context.Context, a ActorInfo, node Acto
stop := metrics.Timer(ctx, metrics.ProcessingDuration)
defer stop()

powerActor, err := node.StateGetActor(ctx, builtin.StoragePowerActorAddr, a.TipSet)
powerActor, err := node.StateGetActor(ctx, power.Address, a.TipSet)
if err != nil {
return nil, xerrors.Errorf("loading power actor: %w", err)
}
Expand Down
8 changes: 5 additions & 3 deletions tasks/actorstate/reward.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import (
"context"

"github.com/filecoin-project/lotus/chain/actors/builtin/reward"
"github.com/filecoin-project/specs-actors/actors/builtin"
sa0builtin "github.com/filecoin-project/specs-actors/actors/builtin"
sa2builtin "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"go.opentelemetry.io/otel/api/global"

"github.com/filecoin-project/sentinel-visor/metrics"
Expand All @@ -18,7 +19,8 @@ import (
type RewardExtractor struct{}

func init() {
Register(builtin.RewardActorCodeID, RewardExtractor{})
Register(sa0builtin.RewardActorCodeID, RewardExtractor{})
Register(sa2builtin.RewardActorCodeID, RewardExtractor{})
}

func (RewardExtractor) Extract(ctx context.Context, a ActorInfo, node ActorStateAPI) (model.Persistable, error) {
Expand All @@ -28,7 +30,7 @@ func (RewardExtractor) Extract(ctx context.Context, a ActorInfo, node ActorState
stop := metrics.Timer(ctx, metrics.ProcessingDuration)
defer stop()

rewardActor, err := node.StateGetActor(ctx, builtin.RewardActorAddr, a.TipSet)
rewardActor, err := node.StateGetActor(ctx, reward.Address, a.TipSet)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 4c57122

Please sign in to comment.