simulated

package
v0.0.0-...-15bcbd6 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2024 License: Apache-2.0, MIT Imports: 22 Imported by: 0

Documentation

Overview

Package simulated is simulated of fvm

Index

Constants

View Source
const SimulateDebug = true

Variables

View Source
var (
	ErrorIDValid           = errors.New("id is valid")
	ErrorKeyExists         = errors.New("key already exists")
	ErrorKeyMatchSucess    = errors.New("key match is ok")
	ErrorKeyMatchFail      = errors.New("key match is fail")
	ErrorKeyTypeException  = errors.New("key type is except")
	ErrorIllegalArgument   = errors.New("illegal argument")
	ErrorIllegalOperation  = errors.New("illegal operation")
	ErrorLimitExceeded     = errors.New("limit exceeded")
	ErrorAssertionFailed   = errors.New("filecoin assertion failed")
	ErrorInsufficientFunds = errors.New("insufficient funds")
	ErrorNotFound          = errors.New("resource not found")
	ErrorInvalidHandle     = errors.New("invalid ipld block handle")
	ErrorIllegalCid        = errors.New("illegal cid specification")
	ErrorIllegalCodec      = errors.New("illegal ipld codec")
	ErrorSerialization     = errors.New("serialization error")
	ErrorForbidden         = errors.New("operation forbidden")
	ErrorBufferTooSmall    = errors.New("buffer too small")
)
View Source
var (
	AccountCid          = mustParseCid("bafk2bzacebmfbtdj5vruje5auacrhhprcjdd6uclhukb7je7t2f6ozfcgqlu2")
	CronCid             = mustParseCid("bafk2bzacea4gwsbeux7z4yxvpkxpco77iyxijoyqaoikofrxdewunwh3unjem")
	InitCid             = mustParseCid("bafk2bzacebwkqd6e7gdphfzw2kdmbokdh2bly6fvzgfopxzy7quq4l67gmkks")
	MultisigCid         = mustParseCid("bafk2bzacea5zp2g6ag5qfuro7zw6kyku2swxs57wjxncaaxbih5iqflqy4ghm")
	PaymentchannelCid   = mustParseCid("bafk2bzaced47dbtbygmfwnyfsp5iihzhhdmnkpuyc5nlnfgc4mkkvlsgvj2do")
	RewardCid           = mustParseCid("bafk2bzacecmcagk32pzdzfg7piobzqhlgla37x3g7jjzyndlz7mqdno2zulfi")
	StoragemarketCid    = mustParseCid("bafk2bzacecxqgajcaednamgolc6wc3lzbjc6tz5alfrbwqez2y3c372vts6dg")
	StorageminerCid     = mustParseCid("bafk2bzaceaqwxllfycpq6decpsnkqjdeycpysh5acubonjae7u3wciydlkvki")
	StoragepowerCid     = mustParseCid("bafk2bzaceddmeolsokbxgcr25cuf2skrobtmmoof3dmqfpcfp33lmw63oikvm")
	SystemCid           = mustParseCid("bafk2bzaced6kjkbv7lrb2qwq5we2hqaxc6ztch5p52g27qtjy45zdemsk4b7m")
	VerifiedRegistryCid = mustParseCid("bafk2bzacectzxvtoselhnzsair5nv6k5vokvegnht6z2lfee4p3xexo4kg4m6")
)
View Source
var EmbeddedBuiltinActors = map[string]cid.Cid{
	"account":          mustParseCid("bafk2bzacebmfbtdj5vruje5auacrhhprcjdd6uclhukb7je7t2f6ozfcgqlu2"),
	"cron":             mustParseCid("bafk2bzacea4gwsbeux7z4yxvpkxpco77iyxijoyqaoikofrxdewunwh3unjem"),
	"init":             mustParseCid("bafk2bzacebwkqd6e7gdphfzw2kdmbokdh2bly6fvzgfopxzy7quq4l67gmkks"),
	"multisig":         mustParseCid("bafk2bzacea5zp2g6ag5qfuro7zw6kyku2swxs57wjxncaaxbih5iqflqy4ghm"),
	"paymentchannel":   mustParseCid("bafk2bzaced47dbtbygmfwnyfsp5iihzhhdmnkpuyc5nlnfgc4mkkvlsgvj2do"),
	"reward":           mustParseCid("bafk2bzacecmcagk32pzdzfg7piobzqhlgla37x3g7jjzyndlz7mqdno2zulfi"),
	"storagemarket":    mustParseCid("bafk2bzacecxqgajcaednamgolc6wc3lzbjc6tz5alfrbwqez2y3c372vts6dg"),
	"storageminer":     mustParseCid("bafk2bzaceaqwxllfycpq6decpsnkqjdeycpysh5acubonjae7u3wciydlkvki"),
	"storagepower":     mustParseCid("bafk2bzaceddmeolsokbxgcr25cuf2skrobtmmoof3dmqfpcfp33lmw63oikvm"),
	"system":           mustParseCid("bafk2bzaced6kjkbv7lrb2qwq5we2hqaxc6ztch5p52g27qtjy45zdemsk4b7m"),
	"verifiedregistry": mustParseCid("bafk2bzacectzxvtoselhnzsair5nv6k5vokvegnht6z2lfee4p3xexo4kg4m6"),
}

Functions

func GetSlicePointerAndLen

func GetSlicePointerAndLen(data interface{}) (uintptr, uint32)

func GetStringPointerAndLen

func GetStringPointerAndLen(str string) (uintptr, uint32)

func NewF1Address

func NewF1Address() (address.Address, error)

NewF1Address create f1 address, f3 address not support for now

func NewPtrTokenAmount

func NewPtrTokenAmount(t int64) *abi.TokenAmount

Types

type BlockStat

type BlockStat struct {
	// contains filtered or unexported fields
}

type FvmSimulator

type FvmSimulator struct {
	Context context.Context
	// contains filtered or unexported fields
}

func CreateEmptySimulator

func CreateEmptySimulator() (*FvmSimulator, context.Context)

CreateEmptySimulator new context of simulated

func CreateSimulateEnv

func CreateSimulateEnv(callContext *types.MessageContext, networkContext *types.NetworkContext, totalFilCircSupply big.Int) (*FvmSimulator, context.Context)

CreateSimulateEnv new context of simulated

func NewFvmSimulator

func NewFvmSimulator(callContext *types.MessageContext, networkContext *types.NetworkContext, totalFilCircSupply abi.TokenAmount) *FvmSimulator

func (*FvmSimulator) AppendEvent

func (fvmSimulator *FvmSimulator) AppendEvent(event types.ActorEvent)

func (*FvmSimulator) AvailableGas

func (fvmSimulator *FvmSimulator) AvailableGas() (uint64, error)

func (*FvmSimulator) BalanceOf

func (fvmSimulator *FvmSimulator) BalanceOf(actorID abi.ActorID) (*abi.TokenAmount, error)

func (*FvmSimulator) BatchVerifySeals

func (fvmSimulator *FvmSimulator) BatchVerifySeals(sealVerifyInfos []proof.SealVerifyInfo) ([]bool, error)
func (fvmSimulator *FvmSimulator) BlockLink(id uint32, hashFun uint64, hashLen uint32) (cid.Cid, error)

func (*FvmSimulator) ChargeGas

func (fvmSimulator *FvmSimulator) ChargeGas(_ string, _ uint64) error

func (*FvmSimulator) ComputeUnsealedSectorCid

func (fvmSimulator *FvmSimulator) ComputeUnsealedSectorCid(
	proofType abi.RegisteredSealProof,
	pieces []abi.PieceInfo,
) (cid.Cid, error)

func (*FvmSimulator) Create

func (fvmSimulator *FvmSimulator) Create(codec uint64, data []byte) (uint32, error)

func (*FvmSimulator) CreateActor

func (fvmSimulator *FvmSimulator) CreateActor(actorID abi.ActorID, codeCid cid.Cid) error

CreateActor this is api can only create builtin actor

func (*FvmSimulator) Enabled

func (fvmSimulator *FvmSimulator) Enabled() (bool, error)

func (*FvmSimulator) Exit

func (fvmSimulator *FvmSimulator) Exit(code ferrors.ExitCode, data []byte, msg string)

func (*FvmSimulator) ExitWithId

func (fvmSimulator *FvmSimulator) ExitWithId(code ferrors.ExitCode, blkId types.BlockID, msg string)

func (*FvmSimulator) ExpectSend

func (fvmSimulator *FvmSimulator) ExpectSend(mock ...SendMock)

func (*FvmSimulator) GetActor

func (fvmSimulator *FvmSimulator) GetActor(addr address.Address) (builtin.Actor, error)

func (*FvmSimulator) GetActorCodeCid

func (fvmSimulator *FvmSimulator) GetActorCodeCid(addr address.Address) (cid.Cid, error)

func (*FvmSimulator) GetBeaconRandomness

func (fvmSimulator *FvmSimulator) GetBeaconRandomness(dst int64, round int64, entropy []byte) (abi.Randomness, error)

func (*FvmSimulator) GetBuiltinActorType

func (fvmSimulator *FvmSimulator) GetBuiltinActorType(codeCid cid.Cid) (types.ActorType, error)

func (*FvmSimulator) GetChainRandomness

func (fvmSimulator *FvmSimulator) GetChainRandomness(dst int64, round int64, entropy []byte) (abi.Randomness, error)

func (*FvmSimulator) GetCodeCidForType

func (fvmSimulator *FvmSimulator) GetCodeCidForType(actorT types.ActorType) (cid.Cid, error)

func (*FvmSimulator) HashBlake2b

func (fvmSimulator *FvmSimulator) HashBlake2b(data []byte) ([32]byte, error)

func (*FvmSimulator) Log

func (fvmSimulator *FvmSimulator) Log(msg string) error

func (*FvmSimulator) LookupDelegatedAddress

func (fvmSimulator *FvmSimulator) LookupDelegatedAddress(actorID abi.ActorID) (address.Address, error)

func (*FvmSimulator) NetworkContext

func (fvmSimulator *FvmSimulator) NetworkContext() (*types.NetworkContext, error)

func (*FvmSimulator) NextActorAddress

func (fvmSimulator *FvmSimulator) NextActorAddress() (address.Address, error)

func (*FvmSimulator) Open

func (fvmSimulator *FvmSimulator) Open(id cid.Cid) (*types.IpldOpen, error)

func (*FvmSimulator) Read

func (fvmSimulator *FvmSimulator) Read(id uint32, offset, size uint32) ([]byte, uint32, error)

func (*FvmSimulator) ResolveAddress

func (fvmSimulator *FvmSimulator) ResolveAddress(addr address.Address) (abi.ActorID, error)

func (*FvmSimulator) SelfCurrentBalance

func (fvmSimulator *FvmSimulator) SelfCurrentBalance() (*abi.TokenAmount, error)

func (*FvmSimulator) SelfDestruct

func (fvmSimulator *FvmSimulator) SelfDestruct(addr address.Address) error

func (*FvmSimulator) SelfRoot

func (fvmSimulator *FvmSimulator) SelfRoot() (cid.Cid, error)

func (*FvmSimulator) SelfSetRoot

func (fvmSimulator *FvmSimulator) SelfSetRoot(id cid.Cid) error

func (*FvmSimulator) Send

func (fvmSimulator *FvmSimulator) Send(to address.Address, method abi.MethodNum, params uint32, value abi.TokenAmount) (*types.SendResult, error)

func (*FvmSimulator) SetActor

func (fvmSimulator *FvmSimulator) SetActor(actorID abi.ActorID, addr address.Address, actor builtin.Actor)

func (*FvmSimulator) SetMessageContext

func (fvmSimulator *FvmSimulator) SetMessageContext(messageCtx *types.MessageContext)

func (*FvmSimulator) SetNetworkContext

func (fvmSimulator *FvmSimulator) SetNetworkContext(networkContext *types.NetworkContext)

func (*FvmSimulator) SetTipsetCid

func (fvmSimulator *FvmSimulator) SetTipsetCid(epoch abi.ChainEpoch, cid *cid.Cid)

func (*FvmSimulator) SetTotalFilCircSupply

func (fvmSimulator *FvmSimulator) SetTotalFilCircSupply(amount abi.TokenAmount)

func (*FvmSimulator) Stat

func (fvmSimulator *FvmSimulator) Stat(id uint32) (*types.IpldStat, error)

func (*FvmSimulator) StoreArtifact

func (fvmSimulator *FvmSimulator) StoreArtifact(name string, data []byte) error

func (*FvmSimulator) TipsetCid

func (fvmSimulator *FvmSimulator) TipsetCid(epoch abi.ChainEpoch) (*cid.Cid, error)

func (*FvmSimulator) TipsetTimestamp

func (fvmSimulator *FvmSimulator) TipsetTimestamp() (uint64, error)

func (*FvmSimulator) TotalFilCircSupply

func (fvmSimulator *FvmSimulator) TotalFilCircSupply() (abi.TokenAmount, error)

func (*FvmSimulator) VMMessageContext

func (fvmSimulator *FvmSimulator) VMMessageContext() (*types.MessageContext, error)

func (*FvmSimulator) VerifyAggregateSeals

func (fvmSimulator *FvmSimulator) VerifyAggregateSeals(info *types.AggregateSealVerifyProofAndInfos) (bool, error)

func (*FvmSimulator) VerifyConsensusFault

func (fvmSimulator *FvmSimulator) VerifyConsensusFault(h1 []byte, h2 []byte, extra []byte,
) (*runtime.ConsensusFault, error)

func (*FvmSimulator) VerifyPost

func (fvmSimulator *FvmSimulator) VerifyPost(info *proof.WindowPoStVerifyInfo) (bool, error)

func (*FvmSimulator) VerifyReplicaUpdate

func (fvmSimulator *FvmSimulator) VerifyReplicaUpdate(info *types.ReplicaUpdateInfo) (bool, error)

func (*FvmSimulator) VerifySeal

func (fvmSimulator *FvmSimulator) VerifySeal(info *proof.SealVerifyInfo) (bool, error)

func (*FvmSimulator) VerifySignature

func (fvmSimulator *FvmSimulator) VerifySignature(
	signature *crypto.Signature,
	signer *address.Address,
	plaintext []byte,
) (bool, error)

type IpldOpen

type IpldOpen struct {
	// contains filtered or unexported fields
}

nolint

type SendMock

type SendMock struct {
	To     address.Address
	Method abi.MethodNum
	Params []byte
	Value  big.Int
	Out    types.SendResult
}

Jump to

Keyboard shortcuts

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