statediff

package module
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2020 License: Apache-2.0, MIT Imports: 37 Imported by: 2

README

State exploration for filecoin (lotus centric)

This tool provides functionality for exploration and comparing changes to filecoin state.

Contents

Installation

go get github.com/filecoin-project/statediff/cmd/statediff
go generate ./...

Usage

See what state change is expected by a test vector:

statediff vector --file vector.json 

See what state chaned on the local lotus chain across a block or message:

statediff chain --expand-actors all bafy...

Explore the state tree of a connected lotus node

statediff explore

API

Other tools working with state trees can access statediff by importing github.com/filecoin-project/statediff.

  • Diff(context.Context, blockstore.Blockstore, a, b cid.Cid, ...Option) string Diff generates a textual unified diff between stateroots a and b. State objects are retreived out of the provided blockstore.
    • Options can be used to control the amount of recursion / expansion performed. In particular, ExpandActors will perform recursive introspection into each individual actor account with a differing HEAD state, and ExpandActorByCid will selectively expand actor accounts based on provided CIDs.

License

Dual-licensed under MIT + Apache 2.0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Diff

func Diff(ctx context.Context, store blockstore.Blockstore, a, b cid.Cid, opts ...Option) string

func ExpandActors

func ExpandActors(c *config)

ExpandActors indicates that exploration should recurse into actor states when they differ, rather than simply indicating which state roots have diverged.

func StoreFor

func StoreFor(ctx context.Context, client api.FullNode) blockstore.Blockstore

func Transform added in v0.0.2

func Transform(ctx context.Context, c cid.Cid, store blockstore.Blockstore, as string) (interface{}, error)

Transform will unmarshal cbor data based on a provided type hint.

Types

type JSONBitField added in v0.0.2

type JSONBitField struct {
	bitfield.BitField
}

func (JSONBitField) MarshalJSON added in v0.0.2

func (j JSONBitField) MarshalJSON() ([]byte, error)

type LotusType added in v0.0.2

type LotusType string
const (
	LotusTypeTipset                            LotusType = "tipset"
	LotusTypeStateroot                         LotusType = "stateRoot"
	AccountActorState                          LotusType = "accountActor"
	CronActorState                             LotusType = "cronActor"
	InitActorState                             LotusType = "initActor"
	InitActorAddresses                         LotusType = "initActorAddresses"
	MarketActorState                           LotusType = "storageMarketActor"
	MarketActorProposals                       LotusType = "storageMarketActor.Proposals"
	MarketActorStates                          LotusType = "storageMarketActor.State"
	MarketActorPendingProposals                LotusType = "storageMarketActor.PendingProposals"
	MarketActorEscrowTable                     LotusType = "storageMarketActor.EscrowTable"
	MarketActorLockedTable                     LotusType = "storageMarketActor.LockedTable"
	MarketActorDealOpsByEpoch                  LotusType = "storageMarketActor.DealOpsByEpoch"
	MultisigActorState                         LotusType = "multisigActor"
	MultisigActorPending                       LotusType = "multisigActor.PendingTxns"
	StorageMinerActorState                     LotusType = "storageMinerActor"
	StorageMinerActorInfo                      LotusType = "storageMinerActor.Info"
	StorageMinerActorVestingFunds              LotusType = "storageMinerActor.VestingFunds"
	StorageMinerActorPreCommittedSectors       LotusType = "storageMinerActor.PreCommittedSectors"
	StorageMinerActorPreCommittedSectorsExpiry LotusType = "storageMinerActor.PreCommittedSectorsExpiry"
	StorageMinerActorAllocatedSectors          LotusType = "storageMinerActor.AllocatedSectors"
	StorageMinerActorSectors                   LotusType = "storageMinerActor.Sectors"
	StorageMinerActorDeadlines                 LotusType = "storageMinerActor.Deadlines"
	StorageMinerActorDeadline                  LotusType = "storageMinerActor.Deadlines.Due"
	StorageMinerActorDeadlinePartitions        LotusType = "storageMinerActor.Deadlines.Due.Partitions"
	StorageMinerActorDeadlineExpiry            LotusType = "storageMinerActor.Deadlines.Due.ExpirationsEpochs"
	StoragePowerActorState                     LotusType = "storagePowerActor"
	StoragePowerActorCronEventQueue            LotusType = "storagePowerCronEventQueue"
	StoragePowerActorClaims                    LotusType = "storagePowerClaims"
	RewardActorState                           LotusType = "rewardActor"
	VerifiedRegistryActorState                 LotusType = "verifiedRegistryActor"
	VerifiedRegistryActorVerifiers             LotusType = "verifiedRegistryActor.Verifiers"
	VerifiedRegistryActorVerifiedClients       LotusType = "verifiedRegistryActor.VerifiedClients"
	PaymentChannelActorState                   LotusType = "paymentChannelActor"
)

type Option

type Option func(c *config)

func ExpandActorByCid

func ExpandActorByCid(cids []cid.Cid) Option

ExpandActorByCid expands only specific actor states that diverge. Cids that diverge can bes specified by the `CodeID` to expand a specific type of actor e.g. `builtin.AccountActorCodeID`. or a specific instance of an actor based on the specific `Actor.Head`.

func WithActorExpansionFromUser

func WithActorExpansionFromUser(arg string) (Option, error)

Parse a user entered fuzzy definition for actor expansion.

Directories

Path Synopsis
gen command
cmd
statediff command
stateexplorer command
extern
fil-ledger module
filecoin-ffi module
establish connection to a 'FullNode' filecoin API with cli configuration.
establish connection to a 'FullNode' filecoin API with cli configuration.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL