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 AccessNodeCandidatesMap(state kv.KVStore) *collections.Map
- func AccessNodeCandidatesMapR(state kv.KVStoreReader) *collections.ImmutableMap
- func AccessNodesMap(state kv.KVStore) *collections.Map
- func AccessNodesMapR(state kv.KVStoreReader) *collections.ImmutableMap
- func GetBlockKeepAmount(state kv.KVStoreReader) int32
- func GetChainInfo(state kv.KVStoreReader, chainID isc.ChainID) (*isc.ChainInfo, error)
- func GetGasFeePolicy(state kv.KVStoreReader) (*gas.FeePolicy, error)
- func GetGasLimits(state kv.KVStoreReader) (*gas.Limits, error)
- func GetMetadata(state kv.KVStoreReader) (*isc.PublicChainMetadata, error)
- func GetPublicURL(state kv.KVStoreReader) (string, error)
- func GetRotationAddress(state kv.KVStoreReader) iotago.Address
- func MustGetChainInfo(state kv.KVStoreReader, chainID isc.ChainID) *isc.ChainInfo
- func MustGetGasFeePolicy(state kv.KVStoreReader) *gas.FeePolicy
- func MustGetGasLimits(state kv.KVStoreReader) *gas.Limits
- func MustGetMetadata(state kv.KVStoreReader) *isc.PublicChainMetadata
- func MustGetMinCommonAccountBalance(state kv.KVStoreReader) uint64
- func MustGetPayoutAgentID(state kv.KVStoreReader) isc.AgentID
- func SetMetadata(state kv.KVStore, metadata *isc.PublicChainMetadata)
- func SetPublicURL(state kv.KVStore, url string)
- type AccessNodeInfo
- func (a *AccessNodeInfo) AddCertificate(nodeKeyPair *cryptolib.KeyPair, ownerAddress iotago.Address) *AccessNodeInfo
- func (a *AccessNodeInfo) Bytes() []byte
- func (a *AccessNodeInfo) ToAddCandidateNodeParams() dict.Dict
- func (a *AccessNodeInfo) ToRevokeAccessNodeParams() dict.Dict
- func (a *AccessNodeInfo) ValidateCertificate() bool
- type ChangeAccessNodeAction
- type ChangeAccessNodesRequest
- func (req *ChangeAccessNodesRequest) Accept(pubKey *cryptolib.PublicKey) *ChangeAccessNodesRequest
- func (req *ChangeAccessNodesRequest) AsDict() dict.Dict
- func (req *ChangeAccessNodesRequest) Drop(pubKey *cryptolib.PublicKey) *ChangeAccessNodesRequest
- func (req *ChangeAccessNodesRequest) Remove(pubKey *cryptolib.PublicKey) *ChangeAccessNodesRequest
- type ContractFeesRecord
- type GetChainNodesRequest
- type GetChainNodesResponse
- type NodeOwnershipCertificate
- type StateAccess
- func (sa *StateAccess) AccessNodes() []*cryptolib.PublicKey
- func (sa *StateAccess) CandidateNodes() []*AccessNodeInfo
- func (sa *StateAccess) ChainInfo(chainID isc.ChainID) *isc.ChainInfo
- func (sa *StateAccess) ChainOwnerID() isc.AgentID
- func (sa *StateAccess) GetBlockKeepAmount() int32
- func (sa *StateAccess) MaintenanceStatus() bool
Constants ¶
const ( ChangeAccessNodeActionRemove = ChangeAccessNodeAction(iota) ChangeAccessNodeActionAccept ChangeAccessNodeActionDrop )
const ( // state controller VarAllowedStateControllerAddresses = "a" // covered in: TestGovernance1 VarRotateToAddress = "r" // should never persist in the state VarPayoutAgentID = "pa" // covered in: TestMetadata VarMinBaseTokensOnCommonAccount = "vs" // covered in: TestMetadata // chain owner VarChainOwnerID = "o" // covered in: TestMetadata VarChainOwnerIDDelegated = "n" // covered in: TestMaintenanceMode // gas VarGasFeePolicyBytes = "g" // covered in: TestMetadata VarGasLimitsBytes = "l" // covered in: TestMetadata // access nodes VarAccessNodes = "an" // covered in: TestAccessNodes VarAccessNodeCandidates = "ac" // covered in: TestAccessNodes // maintenance VarMaintenanceStatus = "m" // covered in: TestMetadata // L2 metadata (provided by the webapi, located by the public url) VarMetadata = "md" // covered in: TestMetadata // L1 metadata (stored and provided in the tangle) VarPublicURL = "x" // covered in: TestL1Metadata // state pruning VarBlockKeepAmount = "b" // covered in: TestMetadata )
state variables
const ( // state controller ParamStateControllerAddress = coreutil.ParamStateControllerAddress ParamAllowedStateControllerAddresses = "a" // chain owner ParamChainOwner = "o" // gas ParamFeePolicyBytes = "g" ParamEVMGasRatio = "e" ParamGasLimitsBytes = "l" // chain info ParamChainID = "c" ParamGetChainNodesAccessNodeCandidates = "an" ParamGetChainNodesAccessNodes = "ac" // access nodes: addCandidateNode ParamAccessNodeInfoForCommittee = "i" ParamAccessNodeInfoPubKey = "ip" ParamAccessNodeInfoCertificate = "ic" ParamAccessNodeInfoAccessAPI = "ia" // access nodes: changeAccessNodes ParamChangeAccessNodesActions = "n" // public chain metadata (provided by the webapi, located by the public url) ParamMetadata = "md" // L1 metadata (stored and provided in the tangle) ParamPublicURL = "x" // state pruning ParamBlockKeepAmount = "b" // set payout AgentID ParamSetPayoutAgentID = "s" // set min SD ParamSetMinCommonAccountBalance = "ms" )
request parameters
const ( // DefaultMinBaseTokensOnCommonAccount can't harvest the minimum DefaultMinBaseTokensOnCommonAccount = uint64(3000) BlockKeepAll = -1 DefaultBlockKeepAmount = 10_000 )
contract constants
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") ViewGetAllowedStateControllerAddresses = coreutil.ViewFunc("getAllowedStateControllerAddresses") // chain owner (L1 entity that is the "owner of the chain") FuncClaimChainOwnership = coreutil.Func("claimChainOwnership") FuncDelegateChainOwnership = coreutil.Func("delegateChainOwnership") FuncSetPayoutAgentID = coreutil.Func("setPayoutAgentID") FuncSetMinCommonAccountBalance = coreutil.Func("setMinCommonAccountBalance") ViewGetPayoutAgentID = coreutil.ViewFunc("getPayoutAgentID") ViewGetMinCommonAccountBalance = coreutil.ViewFunc("getMinCommonAccountBalance") ViewGetChainOwner = coreutil.ViewFunc("getChainOwner") // gas FuncSetFeePolicy = coreutil.Func("setFeePolicy") FuncSetGasLimits = coreutil.Func("setGasLimits") ViewGetFeePolicy = coreutil.ViewFunc("getFeePolicy") ViewGetGasLimits = coreutil.ViewFunc("getGasLimits") // evm fees FuncSetEVMGasRatio = coreutil.Func("setEVMGasRatio") ViewGetEVMGasRatio = coreutil.ViewFunc("getEVMGasRatio") // chain info ViewGetChainInfo = coreutil.ViewFunc("getChainInfo") // access nodes FuncAddCandidateNode = coreutil.Func("addCandidateNode") FuncRevokeAccessNode = coreutil.Func("revokeAccessNode") FuncChangeAccessNodes = coreutil.Func("changeAccessNodes") ViewGetChainNodes = coreutil.ViewFunc("getChainNodes") // maintenance FuncStartMaintenance = coreutil.Func("startMaintenance") FuncStopMaintenance = coreutil.Func("stopMaintenance") ViewGetMaintenanceStatus = coreutil.ViewFunc("getMaintenanceStatus") // public chain metadata FuncSetMetadata = coreutil.Func("setMetadata") ViewGetMetadata = coreutil.ViewFunc("getMetadata") )
var Contract = coreutil.NewContract(coreutil.CoreContractGovernance)
Functions ¶
func AccessNodeCandidatesMap ¶ added in v1.0.3
func AccessNodeCandidatesMap(state kv.KVStore) *collections.Map
func AccessNodeCandidatesMapR ¶ added in v1.0.3
func AccessNodeCandidatesMapR(state kv.KVStoreReader) *collections.ImmutableMap
func AccessNodesMap ¶ added in v1.0.3
func AccessNodesMap(state kv.KVStore) *collections.Map
func AccessNodesMapR ¶ added in v1.0.3
func AccessNodesMapR(state kv.KVStoreReader) *collections.ImmutableMap
func GetBlockKeepAmount ¶ added in v1.0.3
func GetBlockKeepAmount(state kv.KVStoreReader) int32
func GetChainInfo ¶ added in v0.3.0
GetChainInfo returns global variables of the chain
func GetGasFeePolicy ¶ added in v0.3.0
func GetGasFeePolicy(state kv.KVStoreReader) (*gas.FeePolicy, error)
GetGasFeePolicy returns gas policy from the state
func GetGasLimits ¶ added in v1.0.3
func GetGasLimits(state kv.KVStoreReader) (*gas.Limits, error)
func GetMetadata ¶ added in v1.0.3
func GetMetadata(state kv.KVStoreReader) (*isc.PublicChainMetadata, error)
func GetPublicURL ¶ added in v1.0.3
func GetPublicURL(state kv.KVStoreReader) (string, error)
func GetRotationAddress ¶
func GetRotationAddress(state kv.KVStoreReader) iotago.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 MustGetChainInfo ¶
MustGetChainInfo return global variables of the chain
func MustGetGasFeePolicy ¶ added in v0.3.0
func MustGetGasFeePolicy(state kv.KVStoreReader) *gas.FeePolicy
func MustGetGasLimits ¶ added in v1.0.3
func MustGetGasLimits(state kv.KVStoreReader) *gas.Limits
func MustGetMetadata ¶ added in v1.0.3
func MustGetMetadata(state kv.KVStoreReader) *isc.PublicChainMetadata
func MustGetMinCommonAccountBalance ¶ added in v1.0.3
func MustGetMinCommonAccountBalance(state kv.KVStoreReader) uint64
func MustGetPayoutAgentID ¶ added in v1.0.3
func MustGetPayoutAgentID(state kv.KVStoreReader) isc.AgentID
func SetMetadata ¶ added in v1.0.3
func SetMetadata(state kv.KVStore, metadata *isc.PublicChainMetadata)
func SetPublicURL ¶ added in v1.0.3
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. 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. // contains filtered or unexported fields }
AccessNodeInfo conveys all the information that is maintained on the governance SC about a specific node.
func AccessNodeInfoFromAddCandidateNodeParams ¶ added in v1.0.3
func AccessNodeInfoFromAddCandidateNodeParams(ctx isc.Sandbox) *AccessNodeInfo
func AccessNodeInfoFromBytes ¶ added in v1.0.3
func AccessNodeInfoFromBytes(pubKey, data []byte) (*AccessNodeInfo, error)
func AccessNodeInfoFromRevokeAccessNodeParams ¶ added in v1.0.3
func AccessNodeInfoFromRevokeAccessNodeParams(ctx isc.Sandbox) *AccessNodeInfo
func (*AccessNodeInfo) AddCertificate ¶ added in v0.2.3
func (a *AccessNodeInfo) AddCertificate(nodeKeyPair *cryptolib.KeyPair, ownerAddress iotago.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() bool
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 *cryptolib.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 *cryptolib.PublicKey) *ChangeAccessNodesRequest
func (*ChangeAccessNodesRequest) Remove ¶ added in v0.2.3
func (req *ChangeAccessNodesRequest) Remove(pubKey *cryptolib.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 (*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 []*cryptolib.PublicKey // Public Keys of Access Nodes. }
GetChainNodesResponse
func GetChainNodesResponseFromDict ¶ added in v1.0.3
func GetChainNodesResponseFromDict(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 *cryptolib.KeyPair, ownerAddress iotago.Address) NodeOwnershipCertificate
func NodeOwnershipCertificateFromBytes ¶ added in v1.0.3
func NodeOwnershipCertificateFromBytes(data []byte) NodeOwnershipCertificate
func (NodeOwnershipCertificate) Bytes ¶ added in v0.2.4
func (c NodeOwnershipCertificate) Bytes() []byte
type StateAccess ¶ added in v1.0.3
type StateAccess struct {
// contains filtered or unexported fields
}
func NewStateAccess ¶ added in v1.0.3
func NewStateAccess(store kv.KVStoreReader) *StateAccess
func (*StateAccess) AccessNodes ¶ added in v1.0.3
func (sa *StateAccess) AccessNodes() []*cryptolib.PublicKey
func (*StateAccess) CandidateNodes ¶ added in v1.0.3
func (sa *StateAccess) CandidateNodes() []*AccessNodeInfo
func (*StateAccess) ChainInfo ¶ added in v1.0.3
func (sa *StateAccess) ChainInfo(chainID isc.ChainID) *isc.ChainInfo
func (*StateAccess) ChainOwnerID ¶ added in v1.0.3
func (sa *StateAccess) ChainOwnerID() isc.AgentID
func (*StateAccess) GetBlockKeepAmount ¶ added in v1.0.3
func (sa *StateAccess) GetBlockKeepAmount() int32
func (*StateAccess) MaintenanceStatus ¶ added in v1.0.3
func (sa *StateAccess) MaintenanceStatus() 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. |