Documentation
¶
Index ¶
- Constants
- func PrepareKVDicts(r *ExecutionRequest, proofs map[string]*StateProof) (map[string]KVDict, error)
- type Contract
- type ContractHeader
- type ContractRaw
- type DFU
- type DFUIdentity
- type DFURegistry
- type DataDependency
- type ExecutionPlan
- type ExecutionRequest
- type FSM
- type KV
- type KVDict
- type Opcode
- type OpcodeReceipt
- type StateProof
- type Storage
- type Transaction
- type Transition
- type VerificationData
- type Workflow
Constants ¶
const ( SUID string = "state" CEUID string = "codeexec" )
const ( OPCODE string = "OPCODE" KEYVALUE string = "KEYVALUE" PRECOMMIT string = "PRECOMMIT" CONST string = "CONST" )
Variables ¶
This section is empty.
Functions ¶
func PrepareKVDicts ¶
func PrepareKVDicts(r *ExecutionRequest, proofs map[string]*StateProof) (map[string]KVDict, error)
Types ¶
type ContractHeader ¶
type ContractHeader struct {
CID byzcoin.InstanceID
CodeHash []byte
Lock bool
CurrState string
}
type ContractRaw ¶
type ContractRaw struct {
CID byzcoin.InstanceID
Contract *Contract
FSM *FSM
}
type DFUIdentity ¶
type DFURegistry ¶
type DataDependency ¶
type DataDependency struct {
Src string `json:"src"`
SrcName string `json:"src_name,omitempty"`
Idx int `json:"idx,omitempty"`
Value interface{} `json:"value,omitempty"`
// This is a terrible hack but the only quick way I could think of to
//make it work with protobuf.
//DataDependency is serialized as part of sending the contract
//data to the state unit. However,
//protobuf does not like the interface{} type. Therefore,
//after reading in the JSON files,
//we check the type of Value; assign its value to one of the following
//variables; and set Value to nil.
StringValue string
UintValue uint64
}
type ExecutionPlan ¶
type ExecutionPlan struct {
CID []byte
StateRoot []byte
CodeHash []byte
WfName string
TxnName string
Txn *Transaction
DFUData map[string]*DFUIdentity
Sig bdnproto.BdnSignature
}
func (*ExecutionPlan) Hash ¶
func (p *ExecutionPlan) Hash() []byte
func (*ExecutionPlan) String ¶
func (p *ExecutionPlan) String() string
type ExecutionRequest ¶
type ExecutionRequest struct {
Index int
EP *ExecutionPlan
OpReceipts map[string]*OpcodeReceipt
}
func (*ExecutionRequest) Verify ¶
func (r *ExecutionRequest) Verify(data *VerificationData) error
type FSM ¶
type FSM struct {
InitialState string `json:"initial_state"`
States []string `json:"states"`
Transitions map[string]*Transition `json:"transitions"`
}
type Opcode ¶
type Opcode struct {
Name string `json:"name"`
DFUID string `json:"dfu_id"`
Dependencies map[string]*DataDependency `json:"inputs,omitempty"`
}
type OpcodeReceipt ¶
type OpcodeReceipt struct {
EPID []byte // Hash of the execution plan
OpIdx int
//OpName string
// Name of the output variable
Name string
// hash = H(output)
HashBytes []byte
Sig bdnproto.BdnSignature
}
func (*OpcodeReceipt) Hash ¶
func (r *OpcodeReceipt) Hash() []byte
type StateProof ¶
func (StateProof) VerifyFromBlock ¶
func (p StateProof) VerifyFromBlock(publics []kyber.Point) error
VerifyFromBlock takes a skipchain id and the first block of the proof. It verifies that the proof is valid for this skipchain. It verifies the proof, that the merkle-root is stored in the skipblock of the proof and the fact that the skipblock is indeed part of the skipchain. It also uses the provided block to insure the first roster is correct. If all verifications are correct, the error will be nil. It does not verify wether a certain key/value pair exists in the proof. func (p StateProof) VerifyFromBlock(verifiedBlock *skipchain.SkipBlock, publics []kyber.Point) error {
type Storage ¶
type Storage struct {
Store []KV
}
Storage holds the contract state. Store[0] stores the raw contract data, and Store[1] stores the contract header. (i.e. Store[0].Key == "raw", Store[1].Key == "header"). The stored value is a protobuf-encoded core.ContractRaw and core.ContractHeader struct.
type Transaction ¶
type Transaction struct {
Opcodes []*Opcode `json:"opcodes"`
}
type Transition ¶
type VerificationData ¶
type Workflow ¶
type Workflow struct {
Txns map[string]*Transaction `json:"txns"`
}