Versions in this module Expand all Collapse all v1 v1.2.10 Feb 9, 2022 v1.2.9 Jan 6, 2021 v1.2.8 Mar 10, 2020 v1.2.7 Feb 11, 2020 v1.2.6 Feb 6, 2020 Changes in this version + const ByteMask + const DisassembleTabWidth + const HighBit + const MaxListSize + const StDef + const StDefPlus + const StElse + const StError + const StHandler + const StHndPlus + const StIf + const StIfMinus + const StIfPlus + const StNull + var DedentOpcodes map[Opcode]struct + var DisasmHelpers = make(map[Opcode]Stringizer) + var EnabledOpcodes = bitset256.New(byte(OpNop), byte(OpDrop), byte(OpDrop2), byte(OpDup), byte(OpDup2), ...) + var IndentOpcodes map[Opcode]struct + func DisableOpcode(op Opcode) bool + func FractionLess(n1, d1, n2, d2 int64) bool + func Serialize(name string, comment string, b []byte, w io.Writer) error + func SetMaxLengths(code, total int) + func ToBytes(n int64) []byte + func ToBytesU(n uint64) []byte + func Trace(vm *ChaincodeVM) + type Bytes struct + func NewBytes(ab []byte) *Bytes + func (vt *Bytes) Equal(rhs Value) bool + func (vt *Bytes) IsScalar() bool + func (vt *Bytes) IsTrue() bool + func (vt *Bytes) Less(rhs Value) (bool, error) + func (vt *Bytes) String() string + type CachingNow struct + func NewCachingNow(ts Timestamp) (*CachingNow, error) + func (cn *CachingNow) Now() (Timestamp, error) + type CachingRand struct + func NewCachingRand() (*CachingRand, error) + func (dr *CachingRand) RandInt() (int64, error) + type Chaincode []Opcode + func ConvertToOpcodes(b []byte) Chaincode + func MiniAsm(s string) Chaincode + func MiniAsmSafe(s string) (c Chaincode, err error) + func ToChaincode(b []byte) Chaincode + func (c *Chaincode) UnmarshalText(text []byte) error + func (c Chaincode) Bytes() []byte + func (c Chaincode) IsValid() error + func (c Chaincode) MarshalText() (text []byte, err error) + func (code Chaincode) CodeSize() int + func (z *Chaincode) DecodeMsg(dc *msgp.Reader) (err error) + func (z *Chaincode) UnmarshalMsg(bts []byte) (o []byte, err error) + func (z Chaincode) EncodeMsg(en *msgp.Writer) (err error) + func (z Chaincode) MarshalMsg(b []byte) (o []byte, err error) + func (z Chaincode) Msgsize() (s int) + type ChaincodeVM struct + func New(bin ChasmBinary) (*ChaincodeVM, error) + func NewChaincode(c Chaincode) (*ChaincodeVM, error) + func NewEmpty() (*ChaincodeVM, error) + func (vm *ChaincodeVM) Bytes() []byte + func (vm *ChaincodeVM) CreateForFunc(funcnum int) (*ChaincodeVM, error) + func (vm *ChaincodeVM) Disassemble(pc int) (string, int) + func (vm *ChaincodeVM) DisassembleAll(w io.Writer) + func (vm *ChaincodeVM) DisassembleLine(pc int) *DisassembledLine + func (vm *ChaincodeVM) DisassembleLines() []*DisassembledLine + func (vm *ChaincodeVM) HandlerIDs() []int + func (vm *ChaincodeVM) History() []HistoryState + func (vm *ChaincodeVM) IP() int + func (vm *ChaincodeVM) Init(eventID byte, values ...Value) error + func (vm *ChaincodeVM) InitFromStack(eventID byte, stk *Stack) error + func (vm *ChaincodeVM) MakeMutable() *MutableChaincodeVM + func (vm *ChaincodeVM) PreLoad(cb ChasmBinary) error + func (vm *ChaincodeVM) PreLoadOpcodes(data Chaincode) error + func (vm *ChaincodeVM) Run(debug Dumper) error + func (vm *ChaincodeVM) SetNow(n Nower) + func (vm *ChaincodeVM) SetRand(r Randomer) + func (vm *ChaincodeVM) Stack() *Stack + func (vm *ChaincodeVM) Step(debug Dumper) error + func (vm *ChaincodeVM) String() string + type ChasmBinary struct + Comment string + Data []Opcode + Name string + func Deserialize(r io.Reader) (ChasmBinary, error) + type DefaultNow struct + func NewDefaultNow() (*DefaultNow, error) + func (dr *DefaultNow) Now() (Timestamp, error) + type DefaultRand struct + func NewDefaultRand() (*DefaultRand, error) + func (dr *DefaultRand) RandInt() (int64, error) + type DisassembledLine struct + ArgBytes []byte + NumExtra int + Opcode Opcode + PC int + func (l DisassembledLine) String() string + type Dumper func(*ChaincodeVM) + type HistoryState struct + PC int + Stack *Stack + type Instruction []Opcode + type List []Value + func NewList(vs ...Value) List + func (vt List) Append(v Value) List + func (vt List) Equal(rhs Value) bool + func (vt List) Extend(other List) List + func (vt List) Index(n int64) (Value, error) + func (vt List) IsScalar() bool + func (vt List) IsTrue() bool + func (vt List) Len() int64 + func (vt List) Less(rhs Value) (bool, error) + func (vt List) Map(f func(Value) (Value, error)) (List, error) + func (vt List) Reduce(f func(prev, item Value) Value, init Value) Value + func (vt List) String() string + type MutableChaincodeVM struct + func (vm *MutableChaincodeVM) Inject(code []Opcode, debug Dumper) error + type Nower interface + Now func() (Timestamp, error) + type Number struct + func NewFalse() Number + func NewNumber(n int64) Number + func NewTrue() Number + func (vt Number) AsInt64() int64 + func (vt Number) Equal(rhs Value) bool + func (vt Number) IsScalar() bool + func (vt Number) IsTrue() bool + func (vt Number) Less(rhs Value) (bool, error) + func (vt Number) String() string + type Numeric interface + AsInt64 func() int64 + type Opcode byte + const OpAdd + const OpAnd + const OpAppend + const OpAvg + const OpBNot + const OpCall + const OpChoice + const OpCount1s + const OpDec + const OpDeco + const OpDef + const OpDiv + const OpDivMod + const OpDrop + const OpDrop2 + const OpDup + const OpDup2 + const OpElse + const OpEndDef + const OpEndIf + const OpEq + const OpExtend + const OpFail + const OpFalse + const OpField + const OpFieldL + const OpGt + const OpGte + const OpHandler + const OpIfNZ + const OpIfZ + const OpInc + const OpIndex + const OpIsField + const OpLen + const OpLookup + const OpLt + const OpLte + const OpMax + const OpMaxNum + const OpMin + const OpMinNum + const OpMod + const OpMul + const OpMulDiv + const OpNeg + const OpNeg1 + const OpNop + const OpNot + const OpNow + const OpOne + const OpOr + const OpOver + const OpPick + const OpPush1 + const OpPush2 + const OpPush3 + const OpPush4 + const OpPush5 + const OpPush6 + const OpPush7 + const OpPush8 + const OpPushB + const OpPushL + const OpPushT + const OpRand + const OpRet + const OpRoll + const OpSlice + const OpSort + const OpSub + const OpSum + const OpSwap + const OpTrue + const OpTuck + const OpWChoice + const OpXor + const OpZero + func (i Opcode) String() string + func (z *Opcode) DecodeMsg(dc *msgp.Reader) (err error) + func (z *Opcode) UnmarshalMsg(bts []byte) (o []byte, err error) + func (z Opcode) EncodeMsg(en *msgp.Writer) (err error) + func (z Opcode) MarshalMsg(b []byte) (o []byte, err error) + func (z Opcode) Msgsize() (s int) + type Randomer interface + RandInt func() (int64, error) + type RunState byte + const RsComplete + const RsError + const RsNotReady + const RsReady + const RsRunning + type RuntimeError struct + func (e RuntimeError) Error() string + func (e RuntimeError) PC(pc int) RuntimeError + type Stack struct + func NewStack() *Stack + func (st *Stack) Clone() *Stack + func (st *Stack) Depth() int + func (st *Stack) Get(n int) (Value, error) + func (st *Stack) InsertAt(n int, v Value) error + func (st *Stack) Peek() (Value, error) + func (st *Stack) Pop() (Value, error) + func (st *Stack) PopAsInt64() (int64, error) + func (st *Stack) PopAsList() (List, error) + func (st *Stack) PopAsListOfStructs(ix int) (List, error) + func (st *Stack) PopAsStruct() (*Struct, error) + func (st *Stack) PopAt(n int) (Value, error) + func (st *Stack) Push(v Value) error + func (st *Stack) String() string + func (st *Stack) TopN(n int) (*Stack, error) + type Stringizer func(op Opcode, extra []Opcode) string + type Struct struct + func NewStruct() *Struct + func NewTestStruct(vs ...Value) *Struct + func NewTupleStruct(vs ...Value) *Struct + func (vt *Struct) Equal(rhs Value) bool + func (vt *Struct) Get(ix byte) (Value, error) + func (vt *Struct) Indices() []byte + func (vt *Struct) IsCompatible(other *Struct) bool + func (vt *Struct) IsScalar() bool + func (vt *Struct) IsTrue() bool + func (vt *Struct) Len() int + func (vt *Struct) Less(rhs Value) (bool, error) + func (vt *Struct) SafeSet(ix byte, v Value) (*Struct, error) + func (vt *Struct) Set(ix byte, v Value) *Struct + func (vt *Struct) String() string + type Timestamp struct + func NewTimestamp(t types.Timestamp) Timestamp + func NewTimestampFromInt(n int64) Timestamp + func NewTimestampFromTime(t time.Time) (Timestamp, error) + func ParseTimestamp(s string) (Timestamp, error) + func (vt Timestamp) AsInt64() int64 + func (vt Timestamp) Equal(rhs Value) bool + func (vt Timestamp) IsScalar() bool + func (vt Timestamp) IsTrue() bool + func (vt Timestamp) Less(rhs Value) (bool, error) + func (vt Timestamp) String() string + func (vt Timestamp) T() int64 + type ValidationError struct + func (e ValidationError) Error() string + type Value interface + Equal func(rhs Value) bool + IsScalar func() bool + IsTrue func() bool + Less func(rhs Value) (bool, error) + String func() string + type ValueError struct + func (e ValueError) Error() string