bvm

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: May 24, 2023 License: Apache-2.0 Imports: 22 Imported by: 1

Documentation

Index

Constants

View Source
const (
	// SuccessCode success code
	SuccessCode int32 = 200
	// MethodNotExistCode method not exist code
	MethodNotExistCode int32 = -30001
	// ParamsLenMisMatchCode params length mis match code
	ParamsLenMisMatchCode int32 = -30002
	// InvalidParamsCode invalid params code
	InvalidParamsCode int32 = -30003
	// CallErrorCode call error code
	CallErrorCode int32 = -30004
)

code of OpResult

Variables

View Source
var (
	ErrInvalidLengthProposal = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowProposal   = fmt.Errorf("proto: integer overflow")
)
View Source
var ProposalData_PType_name = map[int32]string{
	0: "CONFIG",
	1: "PERMISSION",
	2: "NODE",
	3: "CNS",
	4: "CONTRACT",
	5: "CA",
}
View Source
var ProposalData_PType_value = map[string]int32{
	"CONFIG":     0,
	"PERMISSION": 1,
	"NODE":       2,
	"CNS":        3,
	"CONTRACT":   4,
	"CA":         5,
}
View Source
var ProposalData_Status_name = map[int32]string{
	0: "CREATE",
	1: "VOTING",
	2: "REJECT",
	3: "WAITING_EXE",
	4: "CANCEL",
	5: "COMPLETED",
	6: "TIMEOUT",
}
View Source
var ProposalData_Status_value = map[string]int32{
	"CREATE":      0,
	"VOTING":      1,
	"REJECT":      2,
	"WAITING_EXE": 3,
	"CANCEL":      4,
	"COMPLETED":   5,
	"TIMEOUT":     6,
}

Functions

func DecodeProposalCode added in v1.1.0

func DecodeProposalCode(code []byte) (string, error)

DecodeProposalCode decode proposal.code Example:

a := common.Hex2Bytes(proposalHexString)
var pro ProposalData
proto.Unmarshal(a, &pro)
code, err := DecodeProposalCode(pro.Code)

func EncodeOperation

func EncodeOperation(ope Operation) []byte

EncodeOperation encode operation to payload for bvm

Types

type AccountOperationImpl

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

func (*AccountOperationImpl) Address

func (ao *AccountOperationImpl) Address() string

func (*AccountOperationImpl) Args

func (o *AccountOperationImpl) Args() []string

func (*AccountOperationImpl) Method

func (o *AccountOperationImpl) Method() ContractMethod

func (*AccountOperationImpl) SetArgs added in v1.4.0

func (o *AccountOperationImpl) SetArgs(params []string)

func (*AccountOperationImpl) SetMethod added in v1.4.0

func (o *AccountOperationImpl) SetMethod(method ContractMethod)

type AlgoSet added in v1.2.2

type AlgoSet struct {
	HashAlgo    string `json:"hash_algo"`
	EncryptAlgo string `json:"encrypt_algo"`
}

type BuiltinOperation

type BuiltinOperation interface {
	Operation
	Address() string
}

func NewAccountAbandonOperation

func NewAccountAbandonOperation(address string, sdkCert []byte) BuiltinOperation

NewAccountAbandonOperation create a new AccountAbandon operation and return

func NewAccountRegisterOperation

func NewAccountRegisterOperation(address string, cert []byte) BuiltinOperation

NewAccountRegisterOperation create a new AccountRegister operation and return

func NewCertCheckOperation

func NewCertCheckOperation(cert []byte) BuiltinOperation

NewCertCheckOperation create a new CertCheck operation and return

func NewCertFreezeOperation

func NewCertFreezeOperation(cert, priv []byte) (BuiltinOperation, error)

NewCertFreezeOperation create a new CertFreeze operation and return

func NewCertRevokeOperation

func NewCertRevokeOperation(cert, priv []byte) (BuiltinOperation, error)

NewCertRevokeOperation create a new CertRevoke operation and return

func NewCertUnfreezeOperation

func NewCertUnfreezeOperation(cert, priv []byte) (BuiltinOperation, error)

NewCertUnfreezeOperation create a new CertUnfreeze operation and return

func NewDIDSetChainIDOperation

func NewDIDSetChainIDOperation(chainID string) BuiltinOperation

NewDIDSetChainIDOperation create a setChainID operation

func NewHashChangeHashAlgo added in v1.2.2

func NewHashChangeHashAlgo(data []byte) BuiltinOperation

func NewHashGetAlgoOperation added in v1.2.2

func NewHashGetAlgoOperation() BuiltinOperation

func NewHashGetOperation

func NewHashGetOperation(key string) BuiltinOperation

NewHashGetOperation create a new HashGet operation and return

func NewHashGetSupportOperation added in v1.2.2

func NewHashGetSupportOperation() BuiltinOperation

func NewHashSetOperation

func NewHashSetOperation(key, value string) BuiltinOperation

NewHashSetOperation create a new HashSet operation and return

func NewMPCBeaconOperation added in v1.2.0

func NewMPCBeaconOperation(ptau []byte) BuiltinOperation

func NewMPCHistoryOperation added in v1.2.0

func NewMPCHistoryOperation(ct string) BuiltinOperation

func NewMPCInfoOperation added in v1.2.0

func NewMPCInfoOperation(tag, ct string) BuiltinOperation

func NewNormalAnchorOperation added in v1.2.0

func NewNormalAnchorOperation(method ContractMethod, args []string) BuiltinOperation

func NewProposalCancelOperation

func NewProposalCancelOperation(proposalID int) BuiltinOperation

NewProposalCancelOperation create a new ProposalCancel operation and return

func NewProposalCreateOperationByConfigOps

func NewProposalCreateOperationByConfigOps(ops ...ConfigOperation) BuiltinOperation

func NewProposalCreateOperationForCA added in v1.2.0

func NewProposalCreateOperationForCA(ops ...CAOperation) BuiltinOperation

NewProposalCreateOperationForCA new proposal create operation for ca mode operation

func NewProposalCreateOperationForCNS

func NewProposalCreateOperationForCNS(ops ...CNSOperation) BuiltinOperation

NewProposalCreateOperationForCNS new proposal create operation for cns operation

func NewProposalCreateOperationForConfig

func NewProposalCreateOperationForConfig(config []byte) (BuiltinOperation, error)

NewProposalCreateOperationForConfig new proposal create operation for config operation

func NewProposalCreateOperationForContract

func NewProposalCreateOperationForContract(ops ...ContractOperation) BuiltinOperation

NewProposalCreateOperationForContract new proposal create operation for contract operation

func NewProposalCreateOperationForNode

func NewProposalCreateOperationForNode(ops ...NodeOperation) BuiltinOperation

NewProposalCreateOperationForNode new proposal create operation for node operation

func NewProposalCreateOperationForPermission

func NewProposalCreateOperationForPermission(ops ...PermissionOperation) BuiltinOperation

NewProposalCreateOperationForPermission new proposal create operation for permission operation

func NewProposalDirectOperationForCA added in v1.2.0

func NewProposalDirectOperationForCA(ops ...CAOperation) BuiltinOperation

NewProposalDirectOperationForCA new proposal direct operation for ca mode operation

func NewProposalDirectOperationForNode added in v1.2.0

func NewProposalDirectOperationForNode(ops ...NodeOperation) BuiltinOperation

NewProposalDirectOperationForNode new proposal direct operation for node operation

func NewProposalExecuteOperation

func NewProposalExecuteOperation(proposalID int) BuiltinOperation

NewProposalExecuteOperation create a new ProposalExecute operation and return

func NewProposalVoteOperation

func NewProposalVoteOperation(proposalID int, vote bool) BuiltinOperation

NewProposalVoteOperation create a new ProposalVote operation and return

func NewRootCAAddOperation added in v1.2.0

func NewRootCAAddOperation(rootCA string) BuiltinOperation

func NewRootCAGetOperation added in v1.2.0

func NewRootCAGetOperation() BuiltinOperation

func NewSetGenesisInfoForHpcOperation added in v1.2.0

func NewSetGenesisInfoForHpcOperation(genesisInfo *GenesisInfo) BuiltinOperation

NewSetGenesisInfoForHpcOperation create a new HashGenesisInfo operation for hyperchain and return

func NewSystemAnchorOperation added in v1.2.0

func NewSystemAnchorOperation(method ContractMethod, args ...string) BuiltinOperation

type CAOperation added in v1.2.0

type CAOperation interface {
	ProposalContentOperation
	CAType()
}

func NewCAGetCAModeOperation added in v1.2.0

func NewCAGetCAModeOperation() CAOperation

func NewCASetCAModeOperation added in v1.2.0

func NewCASetCAModeOperation(mode string) (CAOperation, error)

type CNSOperation

type CNSOperation interface {
	ProposalContentOperation
	CNSType()
}

CNSOperation cns operation

func NewCNSSetCNameOperation

func NewCNSSetCNameOperation(address string, cnsName string) CNSOperation

NewCNSSetCNameOperation create a new CNSSetCName operation and return

type CertOperationImpl

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

func (*CertOperationImpl) Address

func (po *CertOperationImpl) Address() string

func (*CertOperationImpl) Args

func (o *CertOperationImpl) Args() []string

func (*CertOperationImpl) Method

func (o *CertOperationImpl) Method() ContractMethod

func (*CertOperationImpl) SetArgs added in v1.4.0

func (o *CertOperationImpl) SetArgs(params []string)

func (*CertOperationImpl) SetMethod added in v1.4.0

func (o *CertOperationImpl) SetMethod(method ContractMethod)

type ConfigOperation

type ConfigOperation interface {
	ProposalContentOperation
	ConfigType()
}

func NewSetConsensusAlgo

func NewSetConsensusAlgo(algo string) ConfigOperation

func NewSetConsensusBatchSize

func NewSetConsensusBatchSize(i int) ConfigOperation

func NewSetConsensusPoolSize

func NewSetConsensusPoolSize(i int) ConfigOperation

func NewSetConsensusSetSize

func NewSetConsensusSetSize(i int) ConfigOperation

func NewSetContactVoteEnable

func NewSetContactVoteEnable(b bool) ConfigOperation

func NewSetContactVoteThreshold

func NewSetContactVoteThreshold(i int) ConfigOperation

func NewSetFilterEnable

func NewSetFilterEnable(b bool) ConfigOperation

func NewSetFilterRules

func NewSetFilterRules(rules []*NsFilterRule) ConfigOperation

func NewSetProposalThreshold

func NewSetProposalThreshold(i int) ConfigOperation

func NewSetProposalTimeout

func NewSetProposalTimeout(d time.Duration) ConfigOperation

type ContractManagerOptions

type ContractManagerOptions struct {
	VMType     string            `json:"vmType,omitempty"`
	Source     []byte            `json:"source,omitempty"`
	Bin        []byte            `json:"bin,omitempty"`
	Addr       string            `json:"addr,omitempty"`
	Name       string            `json:"name,omitempty"`
	OpCode     int               `json:"opCode,omitempty"`
	CompileOpt map[string]string `json:"compileOpt,omitempty"`
}

ContractManagerOptions contract options vmType must have value when call DeployContract, source, bin must have value yet when call UpgradeContract, source, bin, addr must have value yet when call MaintainContract, addr and opCode must have value yet

type ContractMethod

type ContractMethod string

ContractMethod bvm contract method name

const (
	// ContractDeployContract
	ContractDeployContract ContractMethod = "DeployContract"
	// ContractUpgradeContract
	ContractUpgradeContract ContractMethod = "UpgradeContract"
	// ContractMaintainContract
	ContractMaintainContract ContractMethod = "MaintainContract"

	// CNSSetCName cns contract method `SetCName`
	CNSSetCName ContractMethod = "SetCName"

	// NodeAddNode node contract method `AddNode`
	NodeAddNode ContractMethod = "AddNode"
	// NodeAddVP node contract method `AddVP`
	NodeAddVP ContractMethod = "AddVP"
	// NodeRemoveVP node contract method `RemoveVP`
	NodeRemoveVP ContractMethod = "RemoveVP"

	// PermissionCreateRole permission contract method `CreateRole`
	PermissionCreateRole ContractMethod = "CreateRole"
	// PermissionDeleteRole permission contract method `DeleteRole`
	PermissionDeleteRole ContractMethod = "DeleteRole"
	// PermissionGrant permission contract method `Grant`
	PermissionGrant ContractMethod = "Grant"
	// PermissionRevoke permission contract method `Revoke`
	PermissionRevoke ContractMethod = "Revoke"

	// CASetCAMode ca contract method `SetCAMode`
	CASetCAMode ContractMethod = "SetCAMode"
	// CAGetCAMode ca contract method `GetCAMode`
	CAGetCAMode ContractMethod = "GetCAMode"

	// ProposalCreate proposal contract method `Create`
	ProposalCreate ContractMethod = "Create"
	// ProposalDirect proposal contract method `Direct`
	ProposalDirect ContractMethod = "Direct"
	// ProposalVote proposal contract method `Vote`
	ProposalVote ContractMethod = "Vote"
	// ProposalGrant proposal contract method `Cancel`
	ProposalCancel ContractMethod = "Cancel"
	// ProposalExecute proposal contract method `Execute`
	ProposalExecute ContractMethod = "Execute"

	// HashSet hash contract method `Set`
	HashSet ContractMethod = "Set"
	// HashGet hash contract method `Get`
	HashGet ContractMethod = "Get"

	// AccountRegister account contract method `Register`
	AccountRegister ContractMethod = "Register"
	// AccountAbandon account contract method `Logout`
	AccountAbandon ContractMethod = "Abandon"

	SetchainID ContractMethod = "SetChainID"

	//CertRevoke cert contract method `CertRevoke`
	CertRevoke ContractMethod = "CertRevoke"
	//CertCheck cert contract method `CheckRevoke`
	CertCheck ContractMethod = "CertCheck"

	//CertFreeze cert contract method `CertFreeze`
	CertFreeze ContractMethod = "CertFreeze"
	//CertUnfreeze cert contract method `CertUnfreeze`
	CertUnfreeze ContractMethod = "CertUnfreeze"

	SRSInfo    ContractMethod = "GetSRSInfo"
	SRSBeacon  ContractMethod = "Beacon"
	SRSHistory ContractMethod = "GetHistory"

	AddRootCA  ContractMethod = "AddRootCA"
	GetRootCAs ContractMethod = "GetRootCAs"

	ChangeHashAlgo     ContractMethod = "ChangeHashAlgo"
	GetHashAlgo        ContractMethod = "GetHashAlgo"
	GetSupportHashAlgo ContractMethod = "GetSupportHashAlgo"

	RegisterAnchor   ContractMethod = "RegisterAnchorNode"
	UnRegisterAnchor ContractMethod = "UnregisterAnchorNode"
	ReplaceAnchor    ContractMethod = "ReplaceAnchorNode"
	ReadCrossChain   ContractMethod = "ReadCrossChainTransaction"
	ReadAnchor       ContractMethod = "ReadAnchorStatus"
	Timeout          ContractMethod = "Timeout"

	NormalAnchorAddress = "0x0000000000000000000000000000000000ffff08"

	SystemAnchorAddress = "0x0000000000000000000000000000000000ffff0a"
)

type ContractOperation

type ContractOperation interface {
	ProposalContentOperation
	ContractType()
}

func NewContractDeployContractOperation

func NewContractDeployContractOperation(source, bin []byte, vmType string, compileOpts map[string]string) ContractOperation

NewContractDeployContractOperation create a new ContractDeployContract operation and return

func NewContractMaintainContractOperation

func NewContractMaintainContractOperation(contractAddress, vmType string, opcode int) ContractOperation

NewContractMaintainContractOperation create a new ContractMaintainContract operation and return

func NewContractMaintainOperationByName

func NewContractMaintainOperationByName(contractName, vmType string, opcode int) ContractOperation

NewContractMaintainOperationByName create a new ContractMaintainContract operation by contract name and return

func NewContractUpgradeContractOperation

func NewContractUpgradeContractOperation(source, bin []byte, vmType, contractAddress string, compileOpts map[string]string) ContractOperation

NewContractUpgradeContractOperation create a new ContractUpgradeContract operation and return

func NewContractUpgradeOperationByName

func NewContractUpgradeOperationByName(source, bin []byte, vmType, contractName string, compileOpts map[string]string) ContractOperation

NewContractUpgradeOperationByName create a new ContractUpgradeContract operation by contract name and return

type DIDOperationImpl

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

DIDOperationImpl used for set chainID

func (*DIDOperationImpl) Address

func (did *DIDOperationImpl) Address() string

Address return did contract address

func (*DIDOperationImpl) Args

func (o *DIDOperationImpl) Args() []string

func (*DIDOperationImpl) Method

func (o *DIDOperationImpl) Method() ContractMethod

func (*DIDOperationImpl) SetArgs added in v1.4.0

func (o *DIDOperationImpl) SetArgs(params []string)

func (*DIDOperationImpl) SetMethod added in v1.4.0

func (o *DIDOperationImpl) SetMethod(method ContractMethod)

type GenesisInfo added in v1.2.0

type GenesisInfo struct {
	GenesisAccount map[string]string `json:"genesisAccount,omitempty"`
	GenesisNodes   []*GenesisNode    `json:"genesisNodes,omitempty"`
}

GenesisInfo define the filed in genesis info.

type GenesisNode added in v1.2.0

type GenesisNode struct {
	Hostname    string `json:"genesisNode" mapstructure:"genesisNode"`
	CertContent string `json:"certContent" mapstructure:"certContent"`
}

GenesisNode define the filed for genesis node.

type HashAlgoOperationImpl added in v1.2.2

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

func (*HashAlgoOperationImpl) Address added in v1.2.2

func (mo *HashAlgoOperationImpl) Address() string

func (*HashAlgoOperationImpl) Args added in v1.2.2

func (o *HashAlgoOperationImpl) Args() []string

func (*HashAlgoOperationImpl) Method added in v1.2.2

func (o *HashAlgoOperationImpl) Method() ContractMethod

func (*HashAlgoOperationImpl) SetArgs added in v1.4.0

func (o *HashAlgoOperationImpl) SetArgs(params []string)

func (*HashAlgoOperationImpl) SetMethod added in v1.4.0

func (o *HashAlgoOperationImpl) SetMethod(method ContractMethod)

type HashOperationImpl

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

func (*HashOperationImpl) Address

func (po *HashOperationImpl) Address() string

func (*HashOperationImpl) Args

func (o *HashOperationImpl) Args() []string

func (*HashOperationImpl) Method

func (o *HashOperationImpl) Method() ContractMethod

func (*HashOperationImpl) SetArgs added in v1.4.0

func (o *HashOperationImpl) SetArgs(params []string)

func (*HashOperationImpl) SetMethod added in v1.4.0

func (o *HashOperationImpl) SetMethod(method ContractMethod)

type KeyPair

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

KeyPair privateKey(ecdsa.PrivateKey or guomi.PrivateKey) and publicKey string

func NewKeyPair

func NewKeyPair(privFilePath string) (*KeyPair, error)

NewKeyPair create a new KeyPair(ecdsa or sm2)

func ParsePriv

func ParsePriv(k []byte) (*KeyPair, error)

ParsePriv parse key pair by file path

func (*KeyPair) Sign

func (key *KeyPair) Sign(msg []byte) ([]byte, error)

Sign sign the message by privateKey

type MPCOperationImpl added in v1.2.0

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

func (*MPCOperationImpl) Address added in v1.2.0

func (mo *MPCOperationImpl) Address() string

func (*MPCOperationImpl) Args added in v1.2.0

func (o *MPCOperationImpl) Args() []string

func (*MPCOperationImpl) Method added in v1.2.0

func (o *MPCOperationImpl) Method() ContractMethod

func (*MPCOperationImpl) SetArgs added in v1.4.0

func (o *MPCOperationImpl) SetArgs(params []string)

func (*MPCOperationImpl) SetMethod added in v1.4.0

func (o *MPCOperationImpl) SetMethod(method ContractMethod)

type NodeOperation

type NodeOperation interface {
	ProposalContentOperation
	NodeType()
}

func NewNodeAddNodeOperation

func NewNodeAddNodeOperation(pub []byte, hostname, role, namespace string) NodeOperation

NewNodeAddNodeOperation create a new NodeAddNode operation and return

func NewNodeAddVPOperation

func NewNodeAddVPOperation(hostname, namespace string) NodeOperation

NewNodeAddVPOperation create a new NodeAddVP operation and return

func NewNodeRemoveVPOperation

func NewNodeRemoveVPOperation(hostname, namespace string) NodeOperation

NewNodeRemoveVPOperation create a new NodeRemoveVP operation and return

type NormalAnchorOperationImpl added in v1.2.0

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

func (*NormalAnchorOperationImpl) Address added in v1.2.0

func (no *NormalAnchorOperationImpl) Address() string

func (*NormalAnchorOperationImpl) Args added in v1.2.0

func (o *NormalAnchorOperationImpl) Args() []string

func (*NormalAnchorOperationImpl) Method added in v1.2.0

func (o *NormalAnchorOperationImpl) Method() ContractMethod

func (*NormalAnchorOperationImpl) SetArgs added in v1.4.0

func (o *NormalAnchorOperationImpl) SetArgs(params []string)

func (*NormalAnchorOperationImpl) SetMethod added in v1.4.0

func (o *NormalAnchorOperationImpl) SetMethod(method ContractMethod)

type NsFilterRule

type NsFilterRule struct {
	// AllowAnyone determines whether the resources can be accessed freely by anyone
	AllowAnyone bool `json:"allow_anyone" mapstructure:"allow_anyone"`

	// AuthorizedRoles determine who can access the resource if the resources can not be accessed freely
	AuthorizedRoles []string `json:"authorized_roles" mapstructure:"authorized_roles"`

	// ForbiddenRoles determine who can not access the resources though he has the authorized roles
	ForbiddenRoles []string `json:"forbidden_roles" mapstructure:"forbidden_roles"`

	// ID is the identity sequence number for priority
	ID int `json:"id" mapstructure:"id"`

	// Name is the identity string for reading
	Name string `json:"name" mapstructure:"name"`

	// To is  the `to` address used to define resources of tx api
	To []string `json:"to" mapstructure:"to"`

	// VM is the `vmType` used to define resources of tx api
	VM []string `json:"vm" mapstructure:"vm"`
}

NsFilterRule is the rule of tx api filter

type OpResult

type OpResult struct {
	Code int32  `json:"code"`
	Msg  string `json:"msg,omitempty"`
}

OpResult is the result of operation

type Operation

type Operation interface {
	// Method return method name
	Method() ContractMethod

	// Args return args for call method
	Args() []string

	SetMethod(ContractMethod)

	SetArgs([]string)
}

Operation define the operation for proposal

func DecodePayload added in v1.4.0

func DecodePayload(payloadBytes []byte) (Operation, error)

DecodePayload payload struct as below methodName length(4 bytes) | methodName | params count(4 bytes) | (paramX length(4 bytes) | paramX)...

func NewOperation added in v1.4.0

func NewOperation() Operation

type PermissionOperation

type PermissionOperation interface {
	ProposalContentOperation
	PermissionType()
}

func NewPermissionCreateRoleOperation

func NewPermissionCreateRoleOperation(role string) PermissionOperation

NewPermissionCreateRoleOperation create a new PermissionCreateRole operation and return

func NewPermissionDeleteRoleOperation

func NewPermissionDeleteRoleOperation(role string) PermissionOperation

NewPermissionDeleteRoleOperation create a new PermissionDeleteRole operation and return

func NewPermissionGrantOperation

func NewPermissionGrantOperation(role string, address string) PermissionOperation

NewPermissionDeleteRoleOperation create a new PermissionGrant operation and return

func NewPermissionRevokeOperation

func NewPermissionRevokeOperation(role string, address string) PermissionOperation

NewPermissionRevokeOperation create a new PermissionRevoke operation and return

type ProposalCode added in v1.1.0

type ProposalCode struct {
	MethodName string
	Params     []string
}

type ProposalContentOperation

type ProposalContentOperation interface {
	Operation
	ProposalType()
}

type ProposalData

type ProposalData struct {
	Id        uint64              `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"`
	Code      []byte              `protobuf:"bytes,2,opt,name=code,proto3" json:"code,omitempty"`
	Timestamp int64               `protobuf:"varint,3,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	Timeout   int64               `protobuf:"varint,4,opt,name=timeout,proto3" json:"timeout,omitempty"`
	Status    ProposalData_Status `protobuf:"varint,5,opt,name=status,proto3,enum=bvm.ProposalData_Status" json:"status,omitempty"`
	Assentor  []*VoteInfo         `protobuf:"bytes,6,rep,name=assentor,proto3" json:"assentor,omitempty"`
	Objector  []*VoteInfo         `protobuf:"bytes,7,rep,name=objector,proto3" json:"objector,omitempty"`
	Threshold uint32              `protobuf:"varint,8,opt,name=threshold,proto3" json:"threshold,omitempty"`
	Score     uint32              `protobuf:"varint,9,opt,name=score,proto3" json:"score,omitempty"`
	Creator   string              `protobuf:"bytes,10,opt,name=creator,proto3" json:"creator,omitempty"`
	Version   string              `protobuf:"bytes,11,opt,name=version,proto3" json:"version,omitempty"`
	Type      ProposalData_PType  `protobuf:"varint,12,opt,name=type,proto3,enum=bvm.ProposalData_PType" json:"type,omitempty"`
	Completed []byte              `protobuf:"bytes,13,opt,name=completed,proto3" json:"completed,omitempty"`
	Cancel    []byte              `protobuf:"bytes,14,opt,name=cancel,proto3" json:"cancel,omitempty"`
}

func (*ProposalData) Descriptor

func (*ProposalData) Descriptor() ([]byte, []int)

func (*ProposalData) GetAssentor

func (m *ProposalData) GetAssentor() []*VoteInfo

func (*ProposalData) GetCancel

func (m *ProposalData) GetCancel() []byte

func (*ProposalData) GetCode

func (m *ProposalData) GetCode() []byte

func (*ProposalData) GetCompleted

func (m *ProposalData) GetCompleted() []byte

func (*ProposalData) GetCreator

func (m *ProposalData) GetCreator() string

func (*ProposalData) GetId

func (m *ProposalData) GetId() uint64

func (*ProposalData) GetObjector

func (m *ProposalData) GetObjector() []*VoteInfo

func (*ProposalData) GetScore

func (m *ProposalData) GetScore() uint32

func (*ProposalData) GetStatus

func (m *ProposalData) GetStatus() ProposalData_Status

func (*ProposalData) GetThreshold

func (m *ProposalData) GetThreshold() uint32

func (*ProposalData) GetTimeout

func (m *ProposalData) GetTimeout() int64

func (*ProposalData) GetTimestamp

func (m *ProposalData) GetTimestamp() int64

func (*ProposalData) GetType

func (m *ProposalData) GetType() ProposalData_PType

func (*ProposalData) GetVersion

func (m *ProposalData) GetVersion() string

func (*ProposalData) Marshal added in v1.1.0

func (m *ProposalData) Marshal() (dAtA []byte, err error)

func (*ProposalData) MarshalTo added in v1.1.0

func (m *ProposalData) MarshalTo(dAtA []byte) (int, error)

func (*ProposalData) ProtoMessage

func (*ProposalData) ProtoMessage()

func (*ProposalData) Reset

func (m *ProposalData) Reset()

func (*ProposalData) Size added in v1.1.0

func (m *ProposalData) Size() (n int)

func (*ProposalData) String

func (m *ProposalData) String() string

func (*ProposalData) Unmarshal added in v1.1.0

func (m *ProposalData) Unmarshal(dAtA []byte) error

func (*ProposalData) XXX_DiscardUnknown

func (m *ProposalData) XXX_DiscardUnknown()

func (*ProposalData) XXX_Marshal

func (m *ProposalData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ProposalData) XXX_Merge

func (m *ProposalData) XXX_Merge(src proto.Message)

func (*ProposalData) XXX_Size

func (m *ProposalData) XXX_Size() int

func (*ProposalData) XXX_Unmarshal

func (m *ProposalData) XXX_Unmarshal(b []byte) error

type ProposalData_PType

type ProposalData_PType int32
const (
	ProposalData_CONFIG     ProposalData_PType = 0
	ProposalData_PERMISSION ProposalData_PType = 1
	ProposalData_NODE       ProposalData_PType = 2
	ProposalData_CNS        ProposalData_PType = 3
	ProposalData_CONTRACT   ProposalData_PType = 4
	ProposalData_CA         ProposalData_PType = 5
)

func (ProposalData_PType) EnumDescriptor

func (ProposalData_PType) EnumDescriptor() ([]byte, []int)

func (ProposalData_PType) String

func (x ProposalData_PType) String() string

type ProposalData_Status

type ProposalData_Status int32
const (
	ProposalData_CREATE      ProposalData_Status = 0
	ProposalData_VOTING      ProposalData_Status = 1
	ProposalData_REJECT      ProposalData_Status = 2
	ProposalData_WAITING_EXE ProposalData_Status = 3
	ProposalData_CANCEL      ProposalData_Status = 4
	ProposalData_COMPLETED   ProposalData_Status = 5
	ProposalData_TIMEOUT     ProposalData_Status = 6
)

func (ProposalData_Status) EnumDescriptor

func (ProposalData_Status) EnumDescriptor() ([]byte, []int)

func (ProposalData_Status) String

func (x ProposalData_Status) String() string

type ProposalOperationImpl

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

func (*ProposalOperationImpl) Address

func (po *ProposalOperationImpl) Address() string

func (*ProposalOperationImpl) Args

func (o *ProposalOperationImpl) Args() []string

func (*ProposalOperationImpl) Method

func (o *ProposalOperationImpl) Method() ContractMethod

func (*ProposalOperationImpl) SetArgs added in v1.4.0

func (o *ProposalOperationImpl) SetArgs(params []string)

func (*ProposalOperationImpl) SetMethod added in v1.4.0

func (o *ProposalOperationImpl) SetMethod(method ContractMethod)

type ProposalType

type ProposalType int

ProposalType proposal type

const (
	// ProposalTypeConfig proposal of config type
	ProposalTypeConfig ProposalType = iota
	// ProposalTypePermission proposal of permission type
	ProposalTypePermission
	// ProposalTypeNode proposal of node type
	ProposalTypeNode
	// ProposalTypeCNS proposal of cns type
	ProposalTypeCNS
	// ProposalTypeContract proposal of contract type
	ProposalTypeContract
	// ProposalTypeCA proposal of ca type
	ProposalTypeCA
)

func (ProposalType) String

func (pt ProposalType) String() string

type Result

type Result struct {
	Success bool
	Ret     []byte
	Err     string
}

Result represent the execute result of BVM

func Decode

func Decode(ret string) *Result

Decode decode ret to result

func (*Result) String

func (r *Result) String() string

type RootCAOperationImpl added in v1.2.0

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

func (*RootCAOperationImpl) Address added in v1.2.0

func (ro *RootCAOperationImpl) Address() string

func (*RootCAOperationImpl) Args added in v1.2.0

func (o *RootCAOperationImpl) Args() []string

func (*RootCAOperationImpl) Method added in v1.2.0

func (o *RootCAOperationImpl) Method() ContractMethod

func (*RootCAOperationImpl) SetArgs added in v1.4.0

func (o *RootCAOperationImpl) SetArgs(params []string)

func (*RootCAOperationImpl) SetMethod added in v1.4.0

func (o *RootCAOperationImpl) SetMethod(method ContractMethod)

type SystemAnchorOperationImpl added in v1.2.0

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

func (*SystemAnchorOperationImpl) Address added in v1.2.0

func (ao *SystemAnchorOperationImpl) Address() string

func (*SystemAnchorOperationImpl) Args added in v1.2.0

func (o *SystemAnchorOperationImpl) Args() []string

func (*SystemAnchorOperationImpl) Method added in v1.2.0

func (o *SystemAnchorOperationImpl) Method() ContractMethod

func (*SystemAnchorOperationImpl) SetArgs added in v1.4.0

func (o *SystemAnchorOperationImpl) SetArgs(params []string)

func (*SystemAnchorOperationImpl) SetMethod added in v1.4.0

func (o *SystemAnchorOperationImpl) SetMethod(method ContractMethod)

type VoteInfo

type VoteInfo struct {
	Addr   string `protobuf:"bytes,1,opt,name=addr,proto3" json:"addr,omitempty"`
	TxHash string `protobuf:"bytes,2,opt,name=txHash,proto3" json:"txHash,omitempty"`
	Weight uint32 `protobuf:"varint,3,opt,name=weight,proto3" json:"weight,omitempty"`
}

func (*VoteInfo) Descriptor

func (*VoteInfo) Descriptor() ([]byte, []int)

func (*VoteInfo) GetAddr

func (m *VoteInfo) GetAddr() string

func (*VoteInfo) GetTxHash

func (m *VoteInfo) GetTxHash() string

func (*VoteInfo) GetWeight added in v1.1.0

func (m *VoteInfo) GetWeight() uint32

func (*VoteInfo) Marshal added in v1.1.0

func (m *VoteInfo) Marshal() (dAtA []byte, err error)

func (*VoteInfo) MarshalTo added in v1.1.0

func (m *VoteInfo) MarshalTo(dAtA []byte) (int, error)

func (*VoteInfo) ProtoMessage

func (*VoteInfo) ProtoMessage()

func (*VoteInfo) Reset

func (m *VoteInfo) Reset()

func (*VoteInfo) Size added in v1.1.0

func (m *VoteInfo) Size() (n int)

func (*VoteInfo) String

func (m *VoteInfo) String() string

func (*VoteInfo) Unmarshal added in v1.1.0

func (m *VoteInfo) Unmarshal(dAtA []byte) error

func (*VoteInfo) XXX_DiscardUnknown

func (m *VoteInfo) XXX_DiscardUnknown()

func (*VoteInfo) XXX_Marshal

func (m *VoteInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*VoteInfo) XXX_Merge

func (m *VoteInfo) XXX_Merge(src proto.Message)

func (*VoteInfo) XXX_Size

func (m *VoteInfo) XXX_Size() int

func (*VoteInfo) XXX_Unmarshal

func (m *VoteInfo) XXX_Unmarshal(b []byte) error

Jump to

Keyboard shortcuts

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