Categorygithub.com/filecoin-project/statediff
modulepackage
0.0.28
Repository: https://github.com/filecoin-project/statediff.git
Documentation: pkg.go.dev

# README

State exploration for filecoin (lotus centric)

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

Contents

CLI

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

Usage

See what state change is expected by a test vector:

statediff vector --file vector.json 

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

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

Compare two roots in a CAR

statediff car --file export.car <left CID> <right CID>

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.

Web

The web viewer (stateexplorer) provides a JSON transformation layer and interactive state tree exploration.

git clone https://github.com/filecoin-project/statediff
go generate ./...

Note: you need npm installed for go generate to properly bundle frontend assets.

When running in production, either use the provided docker image, or run the explorer in its self-contained-binary form (assets are bundled via the go generate above.)

go run ./cmd/stateexplorer explore --bind 0.0.0.0:33333 --api $(cat ~/.lotus/token):$(cat ~/.lotus/api)

If not explicitly provided as an argument, statediff/stateexplorer will attempt to locate a lotus instance running on the same host by probing your home directory.

In development mode, assets can be loaded from disk so that changes are reflected on reload.

go run ./cmd/stateexplorer explore --bind 0.0.0.0:33333 --assets .

License

Dual-licensed under MIT + Apache 2.0

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
establish connection to a 'FullNode' filecoin API with cli configuration.
No description provided by the author

# Functions

Diff provides a human readable difference between two ipld dags.
No description provided by the author
GetStateRoot gets a stateroot node from a cid The cid can be the block of a tipset, the stateroot itself, or the versioned stateroot.
LinkDest fills in a gap in current schema: what type does a `LinkReference` point to.
Load will load c into a given assembler.
No description provided by the author
No description provided by the author
No description provided by the author
ResolveType maps incoming type strings to enum known types.
StoreFor creates a blockstore proxying access to a lotus node.
Transform will unmarshal cbor data based on a provided type hint.
TypeActorHead takes a LotusActor node, and returns a `Link__<actortype>State` link reference corresponding to the untyped `Head` Link when the type can be inferred from the `Code` of the actor.
TypeOfActor returns the type a given actor will be based on its binary address and stateroot.

# Constants

LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.
LotusType enum.

# Variables

AllowDegradedADLNodes uses adl walks that ignore store.Get fails.
LotusActorCodes for actor states.
LotusPrototypes provide expected node types for each state type.
LotusTypeAliases lists non-direct mapped aliases.
No description provided by the author

# Structs

No description provided by the author
No description provided by the author
Ref is an indirection to help goCmp deal with the multiple transformations involved in resolving an ipld Link.

# Type aliases

CBORBytes wraps already-serialized bytes as CBOR-marshalable.
Loader is the conformer for our wrapper around ADLs.
LotusType represents known types.
No description provided by the author