Documentation ¶
Overview ¶
in the blocklog core contract the VM keeps indices of blocks and requests in an optimized way for fast checking and timestamp access.
Index ¶
- Constants
- Variables
- func CheckAuthorizationByChainOwner(state kv.KVStore, agentID *iscp.AgentID) bool
- func GetDefaultFeeInfo(state kv.KVStoreReader) (colored.Color, uint64, uint64, error)
- func GetFeeInfo(ctx iscp.SandboxView, hname iscp.Hname) (colored.Color, uint64, uint64)
- func GetFeeInfoByHname(state kv.KVStoreReader, hname iscp.Hname) (colored.Color, uint64, uint64)
- func GetFeeInfoFromContractFeesRecord(state kv.KVStoreReader, rec *ContractFeesRecord) (colored.Color, uint64, uint64)
- func GetRotationAddress(state kv.KVStoreReader) ledgerstate.Address
- func MustGetChainOwnerID(state kv.KVStoreReader) *iscp.AgentID
- type AccessNodeInfo
- func NewAccessNodeInfoFromAddCandidateNodeParams(ctx iscp.Sandbox) *AccessNodeInfo
- func NewAccessNodeInfoFromBytes(pubKey, value []byte) (*AccessNodeInfo, error)
- func NewAccessNodeInfoFromRevokeAccessNodeParams(ctx iscp.Sandbox) *AccessNodeInfo
- func NewAccessNodeInfoListFromMap(infoMap *collections.ImmutableMap) ([]*AccessNodeInfo, error)
- func (a *AccessNodeInfo) AddCertificate(nodeKeyPair *ed25519.KeyPair, ownerAddress ledgerstate.Address) *AccessNodeInfo
- func (a *AccessNodeInfo) Bytes() []byte
- func (a *AccessNodeInfo) ToAddCandidateNodeParams() dict.Dict
- func (a *AccessNodeInfo) ToRevokeAccessNodeParams() dict.Dict
- func (a *AccessNodeInfo) ValidateCertificate(ctx iscp.Sandbox) bool
- type ChainInfo
- type ChangeAccessNodeAction
- type ChangeAccessNodesRequest
- func (req *ChangeAccessNodesRequest) Accept(pubKey ed25519.PublicKey) *ChangeAccessNodesRequest
- func (req *ChangeAccessNodesRequest) AsDict() dict.Dict
- func (req *ChangeAccessNodesRequest) Drop(pubKey ed25519.PublicKey) *ChangeAccessNodesRequest
- func (req *ChangeAccessNodesRequest) Remove(pubKey ed25519.PublicKey) *ChangeAccessNodesRequest
- type ContractFeesRecord
- func ContractFeesRecordFromBytes(data []byte) (*ContractFeesRecord, error)
- func ContractFeesRecordFromMarshalUtil(mu *marshalutil.MarshalUtil) (*ContractFeesRecord, error)
- func FindContractFees(state kv.KVStoreReader, hname iscp.Hname) *ContractFeesRecord
- func NewContractFeesRecord(ownerFee, validatorFee uint64) *ContractFeesRecord
- type GetChainNodesRequest
- type GetChainNodesResponse
- type NodeOwnershipCertificate
Constants ¶
const ( ChangeAccessNodeActionRemove = ChangeAccessNodeAction(iota) ChangeAccessNodeActionAccept ChangeAccessNodeActionDrop )
const ( MinEventSize = uint16(200) MinEventsPerRequest = uint16(10) DefaultMaxEventsPerRequest = uint16(50) DefaultMaxEventSize = uint16(2000) // 2Kb DefaultMaxBlobSize = uint32(1000000) // 1Mb )
constants
const ( // state controller StateVarAllowedStateControllerAddresses = "a" StateVarRotateToAddress = "r" // chain owner VarChainOwnerID = "o" VarChainOwnerIDDelegated = "n" VarDefaultOwnerFee = "do" VarOwnerFee = "of" // fees VarDefaultValidatorFee = "dv" VarValidatorFee = "vf" VarFeeColor = "f" VarContractFeesRegistry = "fr" // chain info VarChainID = "c" VarDescription = "d" VarMaxBlobSize = "mb" VarMaxEventSize = "me" VarMaxEventsPerReq = "mr" // access nodes VarAccessNodes = "an" VarAccessNodeCandidates = "ac" VarValidatorNodes = "vn" )
state variables
const ( // state controller ParamStateControllerAddress = coreutil.ParamStateControllerAddress ParamAllowedStateControllerAddresses = "a" // chain owner ParamChainOwner = "oi" ParamOwnerFee = "of" // fees ParamFeeColor = "fc" ParamValidatorFee = "vf" ParamHname = "hn" // chain info ParamChainID = "ci" ParamDescription = "ds" ParamMaxBlobSize = "bs" ParamMaxEventSize = "es" ParamMaxEventsPerRequest = "ne" // access nodes: getChainNodes ParamGetChainNodesAccessNodeCandidates = "c" ParamGetChainNodesAccessNodes = "a" // access nodes: addCandidateNode ParamAccessNodeInfoForCommittee = "f" ParamAccessNodeInfoPubKey = "p" ParamAccessNodeInfoCertificate = "c" ParamAccessNodeInfoAccessAPI = "a" // access nodes: changeAccessNodes ParamChangeAccessNodesActions = "a" )
params
Variables ¶
var ( // state controller (entity that owns the state output via AliasAddress) FuncRotateStateController = coreutil.Func(coreutil.CoreEPRotateStateController) FuncAddAllowedStateControllerAddress = coreutil.Func("addAllowedStateControllerAddress") FuncRemoveAllowedStateControllerAddress = coreutil.Func("removeAllowedStateControllerAddress") FuncGetAllowedStateControllerAddresses = coreutil.ViewFunc("getAllowedStateControllerAddresses") // chain owner (L1 entity that is the "owner of the chain") FuncClaimChainOwnership = coreutil.Func("claimChainOwnership") FuncDelegateChainOwnership = coreutil.Func("delegateChainOwnership") FuncGetChainOwner = coreutil.ViewFunc("getChainOwner") // fees FuncSetContractFee = coreutil.Func("setContractFee") FuncGetFeeInfo = coreutil.ViewFunc("getFeeInfo") // chain info FuncSetChainInfo = coreutil.Func("setChainInfo") FuncGetChainInfo = coreutil.ViewFunc("getChainInfo") FuncGetMaxBlobSize = coreutil.ViewFunc("getMaxBlobSize") // access nodes FuncGetChainNodes = coreutil.ViewFunc("getChainNodes") FuncAddCandidateNode = coreutil.Func("addCandidateNode") FuncRevokeAccessNode = coreutil.Func("revokeAccessNode") FuncChangeAccessNodes = coreutil.Func("changeAccessNodes") )
var Contract = coreutil.NewContract(coreutil.CoreContractGovernance, "Governance contract")
Functions ¶
func GetDefaultFeeInfo ¶
func GetFeeInfo ¶
GetFeeInfo is an internal utility function which returns fee info for the contract It is called from VMContext and viewcontext objects It is not exposed to the sandbox
func GetFeeInfoByHname ¶
GetFeeInfoByHname is an internal utility function which returns fee info for the contract It is called from VMContext and viewcontext objects It is not exposed to the sandbox
func GetFeeInfoFromContractFeesRecord ¶
func GetFeeInfoFromContractFeesRecord(state kv.KVStoreReader, rec *ContractFeesRecord) (colored.Color, uint64, uint64)
func GetRotationAddress ¶
func GetRotationAddress(state kv.KVStoreReader) ledgerstate.Address
GetRotationAddress tries to read the state of 'governance' and extract rotation address If succeeds, it means this block is fake. If fails, return nil
func MustGetChainOwnerID ¶
func MustGetChainOwnerID(state kv.KVStoreReader) *iscp.AgentID
Types ¶
type AccessNodeInfo ¶ added in v0.2.3
type AccessNodeInfo struct { NodePubKey []byte // Public Key of the node. Stored as a key in the SC State and Params. ValidatorAddr []byte // Address of the validator owning the node. Not sent via parameters. Certificate []byte // Proof that Validator owns the Node. ForCommittee bool // true, if Node should be a candidate to a committee. AccessAPI string // API URL, if any. }
AccessNodeInfo conveys all the information that is maintained on the governance SC about a specific node.
func NewAccessNodeInfoFromAddCandidateNodeParams ¶ added in v0.2.3
func NewAccessNodeInfoFromAddCandidateNodeParams(ctx iscp.Sandbox) *AccessNodeInfo
func NewAccessNodeInfoFromBytes ¶ added in v0.2.3
func NewAccessNodeInfoFromBytes(pubKey, value []byte) (*AccessNodeInfo, error)
func NewAccessNodeInfoFromRevokeAccessNodeParams ¶ added in v0.2.3
func NewAccessNodeInfoFromRevokeAccessNodeParams(ctx iscp.Sandbox) *AccessNodeInfo
func NewAccessNodeInfoListFromMap ¶ added in v0.2.4
func NewAccessNodeInfoListFromMap(infoMap *collections.ImmutableMap) ([]*AccessNodeInfo, error)
func (*AccessNodeInfo) AddCertificate ¶ added in v0.2.3
func (a *AccessNodeInfo) AddCertificate(nodeKeyPair *ed25519.KeyPair, ownerAddress ledgerstate.Address) *AccessNodeInfo
func (*AccessNodeInfo) Bytes ¶ added in v0.2.3
func (a *AccessNodeInfo) Bytes() []byte
func (*AccessNodeInfo) ToAddCandidateNodeParams ¶ added in v0.2.3
func (a *AccessNodeInfo) ToAddCandidateNodeParams() dict.Dict
func (*AccessNodeInfo) ToRevokeAccessNodeParams ¶ added in v0.2.3
func (a *AccessNodeInfo) ToRevokeAccessNodeParams() dict.Dict
func (*AccessNodeInfo) ValidateCertificate ¶ added in v0.2.3
func (a *AccessNodeInfo) ValidateCertificate(ctx iscp.Sandbox) bool
type ChainInfo ¶
type ChainInfo struct { ChainID *iscp.ChainID ChainOwnerID *iscp.AgentID Description string FeeColor colored.Color DefaultOwnerFee int64 DefaultValidatorFee int64 MaxBlobSize uint32 MaxEventSize uint16 MaxEventsPerReq uint16 }
ChainInfo is an API structure which contains main properties of the chain in on place
func MustGetChainInfo ¶
func MustGetChainInfo(state kv.KVStoreReader) ChainInfo
MustGetChainInfo return global variables of the chain
type ChangeAccessNodeAction ¶ added in v0.2.3
type ChangeAccessNodeAction byte
type ChangeAccessNodesRequest ¶ added in v0.2.3
type ChangeAccessNodesRequest struct {
// contains filtered or unexported fields
}
func NewChangeAccessNodesRequest ¶ added in v0.2.3
func NewChangeAccessNodesRequest() *ChangeAccessNodesRequest
func (*ChangeAccessNodesRequest) Accept ¶ added in v0.2.3
func (req *ChangeAccessNodesRequest) Accept(pubKey ed25519.PublicKey) *ChangeAccessNodesRequest
func (*ChangeAccessNodesRequest) AsDict ¶ added in v0.2.3
func (req *ChangeAccessNodesRequest) AsDict() dict.Dict
func (*ChangeAccessNodesRequest) Drop ¶ added in v0.2.3
func (req *ChangeAccessNodesRequest) Drop(pubKey ed25519.PublicKey) *ChangeAccessNodesRequest
func (*ChangeAccessNodesRequest) Remove ¶ added in v0.2.3
func (req *ChangeAccessNodesRequest) Remove(pubKey ed25519.PublicKey) *ChangeAccessNodesRequest
type ContractFeesRecord ¶
type ContractFeesRecord struct { // Chain owner part of the fee. If it is 0, it means chain-global default is in effect OwnerFee uint64 // Validator part of the fee. If it is 0, it means chain-global default is in effect ValidatorFee uint64 }
ContractFeesRecord is a structure which contains the fee information for a contract
func ContractFeesRecordFromBytes ¶
func ContractFeesRecordFromBytes(data []byte) (*ContractFeesRecord, error)
func ContractFeesRecordFromMarshalUtil ¶
func ContractFeesRecordFromMarshalUtil(mu *marshalutil.MarshalUtil) (*ContractFeesRecord, error)
func FindContractFees ¶
func FindContractFees(state kv.KVStoreReader, hname iscp.Hname) *ContractFeesRecord
FindContractFees is an internal utility function which finds a contract in the KVStore It is called from within the 'governance' contract as well as VMContext and viewcontext objects It is not directly exposed to the sandbox If contract fees are not found by the given hname, nil is returned the bool flag indicates if a contract-fees record was found or not
func NewContractFeesRecord ¶
func NewContractFeesRecord(ownerFee, validatorFee uint64) *ContractFeesRecord
func (*ContractFeesRecord) Bytes ¶
func (p *ContractFeesRecord) Bytes() []byte
type GetChainNodesRequest ¶ added in v0.2.3
type GetChainNodesRequest struct{}
GetChainNodesRequest
func (GetChainNodesRequest) AsDict ¶ added in v0.2.3
func (req GetChainNodesRequest) AsDict() dict.Dict
type GetChainNodesResponse ¶ added in v0.2.3
type GetChainNodesResponse struct { AccessNodeCandidates []*AccessNodeInfo // Application info for the AccessNodes. AccessNodes []ed25519.PublicKey // Public Keys of Access Nodes. }
GetChainNodesResponse
func NewGetChainNodesResponseFromDict ¶ added in v0.2.3
func NewGetChainNodesResponseFromDict(d dict.Dict) *GetChainNodesResponse
type NodeOwnershipCertificate ¶ added in v0.2.4
type NodeOwnershipCertificate []byte
NodeOwnershipCertificate is a proof that a specified address is an owner of the specified node. It is implemented as a signature over the node pub key concatenated with the owner address.
func NewNodeOwnershipCertificate ¶ added in v0.2.4
func NewNodeOwnershipCertificate(nodeKeyPair *ed25519.KeyPair, ownerAddress ledgerstate.Address) NodeOwnershipCertificate
func NewNodeOwnershipCertificateFromBytes ¶ added in v0.2.4
func NewNodeOwnershipCertificateFromBytes(data []byte) NodeOwnershipCertificate
func (NodeOwnershipCertificate) Bytes ¶ added in v0.2.4
func (c NodeOwnershipCertificate) Bytes() []byte
func (NodeOwnershipCertificate) Verify ¶ added in v0.2.4
func (c NodeOwnershipCertificate) Verify(nodePubKey ed25519.PublicKey, ownerAddress ledgerstate.Address) bool
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
This file provides implementation for the governance SC, the ChainNode management functions.
|
This file provides implementation for the governance SC, the ChainNode management functions. |