Documentation ¶
Overview ¶
Package vochain provides all the functions for creating and managing a vocdoni voting blockchain
Index ¶
- Constants
- Variables
- func AddTx(vtx *models.Tx, txBytes, signature []byte, state *State, txID [32]byte, ...) ([]byte, error)
- func AdminTxCheck(vtx *models.Tx, txBytes, signature []byte, state *State) error
- func AminoKeys(key crypto25519.PrivKey) (private, public []byte, err error)
- func CheckProof(proof *models.Proof, censusOrigin models.CensusOrigin, ...) (bool, *big.Int, error)
- func GenerateNullifier(address ethcommon.Address, processID []byte) []byte
- func NewGenesis(cfg *config.VochainCfg, chainID string, consensusParams *types.ConsensusParams, ...) ([]byte, error)
- func NewNodeKey(tmPrivKey string, tconfig *cfg.Config) (*p2p.NodeKey, error)
- func NewPrivateValidator(tmPrivKey string, tconfig *cfg.Config) (*privval.FilePV, error)
- func NewProcessTxCheck(vtx *models.Tx, txBytes, signature []byte, state *State) (*models.Process, error)
- func SetProcessTxCheck(vtx *models.Tx, txBytes, signature []byte, state *State) error
- func TxKey(tx tmtypes.Tx) [32]byte
- func UnmarshalTx(content []byte) (*models.Tx, []byte, []byte, error)
- func VoteTxCheck(vtx *models.Tx, txBytes, signature []byte, state *State, txID [32]byte, ...) (*models.Vote, error)
- type BaseApplication
- func (app *BaseApplication) ApplySnapshotChunk(req abcitypes.RequestApplySnapshotChunk) abcitypes.ResponseApplySnapshotChunk
- func (app *BaseApplication) BeginBlock(req abcitypes.RequestBeginBlock) abcitypes.ResponseBeginBlock
- func (app *BaseApplication) CheckTx(req abcitypes.RequestCheckTx) abcitypes.ResponseCheckTx
- func (app *BaseApplication) Commit() abcitypes.ResponseCommit
- func (app *BaseApplication) DeliverTx(req abcitypes.RequestDeliverTx) abcitypes.ResponseDeliverTx
- func (app *BaseApplication) EndBlock(req abcitypes.RequestEndBlock) abcitypes.ResponseEndBlock
- func (app *BaseApplication) Info(req abcitypes.RequestInfo) abcitypes.ResponseInfo
- func (app *BaseApplication) InitChain(req abcitypes.RequestInitChain) abcitypes.ResponseInitChain
- func (app *BaseApplication) ListSnapshots(req abcitypes.RequestListSnapshots) abcitypes.ResponseListSnapshots
- func (app *BaseApplication) LoadSnapshotChunk(req abcitypes.RequestLoadSnapshotChunk) abcitypes.ResponseLoadSnapshotChunk
- func (app *BaseApplication) OfferSnapshot(req abcitypes.RequestOfferSnapshot) abcitypes.ResponseOfferSnapshot
- func (app *BaseApplication) Query(req abcitypes.RequestQuery) abcitypes.ResponseQuery
- func (app *BaseApplication) SendTX(tx []byte) (*ctypes.ResultBroadcastTx, error)
- func (BaseApplication) SetOption(req abcitypes.RequestSetOption) abcitypes.ResponseSetOption
- type EventListener
- type ImmutableState
- type State
- func (v *State) AddEventListener(l EventListener)
- func (v *State) AddOracle(address common.Address) error
- func (v *State) AddProcess(p *models.Process) error
- func (v *State) AddProcessKeys(tx *models.AdminTx) error
- func (v *State) AddValidator(validator *models.Validator) error
- func (v *State) AddVote(vote *models.Vote) error
- func (v *State) AppHash(isQuery bool) []byte
- func (v *State) CacheAdd(id [32]byte, vc *types.CacheTx)
- func (v *State) CacheDel(id [32]byte)
- func (v *State) CacheGet(id [32]byte) *types.CacheTx
- func (v *State) CachePurge(height int64)
- func (v *State) CacheSize() int
- func (v *State) CancelProcess(pid []byte) error
- func (v *State) CountProcesses(isQuery bool) int64
- func (v *State) CountVotes(processID []byte, isQuery bool) uint32
- func (v *State) Envelope(processID, nullifier []byte, isQuery bool) (_ *models.Vote, err error)
- func (v *State) EnvelopeExists(processID, nullifier []byte, isQuery bool) bool
- func (v *State) EnvelopeList(processID []byte, from, listSize int, isQuery bool) (nullifiers [][]byte)
- func (v *State) Header(isQuery bool) *models.TendermintHeader
- func (v *State) Oracles(isQuery bool) ([]common.Address, error)
- func (v *State) Process(pid []byte, isQuery bool) (*models.Process, error)
- func (v *State) RemoveOracle(address common.Address) error
- func (v *State) RemoveValidator(address []byte) error
- func (v *State) RevealProcessKeys(tx *models.AdminTx) error
- func (v *State) Rollback()
- func (v *State) Save() []byte
- func (v *State) SetProcessCensus(pid, censusRoot []byte, censusURI string, commit bool) error
- func (v *State) SetProcessResults(pid []byte, result *models.ProcessResult, commit bool) error
- func (v *State) SetProcessStatus(pid []byte, newstatus models.ProcessStatus, commit bool) error
- func (v *State) Validators(isQuery bool) ([]*models.Validator, error)
- func (v *State) WorkingHash() []byte
- type TenderLogger
- type VochainGenesis
Constants ¶
const ( // db names AppTree = "app" ProcessTree = "process" VoteTree = "vote" )
Variables ¶
var (
ErrProcessNotFound = fmt.Errorf("process not found")
)
var Genesis = map[string]VochainGenesis{ "main": { AutoUpdateGenesis: false, SeedNodes: []string{"121e65eb5994874d9c05cd8d584a54669d23f294@seed.vocdoni.net:26656"}, Genesis: ` { "genesis_time":"2021-03-16T15:38:33.672114557Z", "chain_id":"vocdoni-release-1.0", "consensus_params":{ "block":{ "max_bytes":"10485760", "max_gas":"-1", "time_iota_ms":"10000" }, "evidence":{ "max_age_num_blocks":"100000", "max_age_duration":"10000" }, "validator":{ "pub_key_types":[ "ed25519" ] } }, "validators":[ { "address":"6DB4FEE1D370907B31196B493714FC0F45C62DED", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"R7U+HxyTrvlXccEm1sc80ww83Fpp4xg247nmpjmkYTc=" }, "power":"10", "name":"miner1" }, { "address":"71AA2FEFA96447BC5AEF9FD928F3F8ED57E695CF", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"ixI91P+MP1jiVIy1JwQqwRdZIZxsVI0WrytAzohMGCk=" }, "power":"10", "name":"miner2" }, { "address":"AA9CC01B46BDD1AC9E2197BB9B84993CCDF880B2", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"H6oEMFrNFeQemr9Kgxjq/wVk1kZQ1VE/J1wVnVJ+K9I=" }, "power":"10", "name":"miner3" }, { "address":"314D17BBE991FBD3D234E5C62CFD5D0717123C95", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"FLEg/pgdF4dZ060mved/z99p/EJePu9kSsyLnrsRNC0=" }, "power":"10", "name":"miner4" }, { "address":"34B048A4A720E6B3918CF8B75CF12555080465E5", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"aF/+WaNs5tknRMRpTPO49TJZLmDctO+JH8uckE5fTNU=" }, "power":"10", "name":"miner5" } ], "app_hash":"", "app_state":{ "validators":[ { "address":"6DB4FEE1D370907B31196B493714FC0F45C62DED", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"R7U+HxyTrvlXccEm1sc80ww83Fpp4xg247nmpjmkYTc=" }, "power":"10", "name":"miner1" }, { "address":"71AA2FEFA96447BC5AEF9FD928F3F8ED57E695CF", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"ixI91P+MP1jiVIy1JwQqwRdZIZxsVI0WrytAzohMGCk=" }, "power":"10", "name":"miner2" }, { "address":"AA9CC01B46BDD1AC9E2197BB9B84993CCDF880B2", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"H6oEMFrNFeQemr9Kgxjq/wVk1kZQ1VE/J1wVnVJ+K9I=" }, "power":"10", "name":"miner3" }, { "address":"314D17BBE991FBD3D234E5C62CFD5D0717123C95", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"FLEg/pgdF4dZ060mved/z99p/EJePu9kSsyLnrsRNC0=" }, "power":"10", "name":"miner4" }, { "address":"34B048A4A720E6B3918CF8B75CF12555080465E5", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"aF/+WaNs5tknRMRpTPO49TJZLmDctO+JH8uckE5fTNU=" }, "power":"10", "name":"miner5" } ], "oracles":[ "0xc2e396d6e6ae9b12551f0c6111f9766bec926bfe", "0x1a361c26e04a33effbf3bd8617b1e3e0aa6b704f" ] } } `}, "dev": { AutoUpdateGenesis: true, SeedNodes: []string{"7440a5b086e16620ce7b13198479016aa2b07988@seed.dev.vocdoni.net:26656"}, Genesis: ` { "genesis_time":"2021-03-08T10:52:28.668436552Z", "chain_id":"vocdoni-development-37", "consensus_params":{ "block":{ "max_bytes":"10485760", "max_gas":"-1", "time_iota_ms":"10000" }, "evidence":{ "max_age_num_blocks":"100000", "max_age_duration":"10000" }, "validator":{ "pub_key_types":[ "ed25519" ] } }, "validators":[ { "address":"5C69093136E0CB84E5CFA8E958DADB33C0D0CCCF", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"mXc5xXTKgDSYcy1lBCT1Ag7Lh1nPWHMa/p80XZPzAPY=" }, "power":"10", "name":"miner0" }, { "address":"2E1B244B84E223747126EF621C022D5CEFC56F69", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"gaf2ZfdxpoielRXDXyBcMxkdzywcE10WsvLMe1K62UY=" }, "power":"10", "name":"miner1" }, { "address":"4EF00A8C18BD472167E67F28694F31451A195581", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"dZXMBiQl4s0/YplfX9iMnCWonJp2gjrFHHXaIwqqtmc=" }, "power":"10", "name":"miner2" }, { "address":"ECCC09A0DF8F4E5554A9C58F634E9D6AFD5F1598", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"BebelLYe4GZKwy9IuXCyBTySxQCNRrRoi1DSvAf6QxE=" }, "power":"10", "name":"miner3" } ], "app_hash":"", "app_state":{ "validators":[ { "address":"5C69093136E0CB84E5CFA8E958DADB33C0D0CCCF", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"mXc5xXTKgDSYcy1lBCT1Ag7Lh1nPWHMa/p80XZPzAPY=" }, "power":"10", "name":"miner0" }, { "address":"2E1B244B84E223747126EF621C022D5CEFC56F69", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"gaf2ZfdxpoielRXDXyBcMxkdzywcE10WsvLMe1K62UY=" }, "power":"10", "name":"miner1" }, { "address":"4EF00A8C18BD472167E67F28694F31451A195581", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"dZXMBiQl4s0/YplfX9iMnCWonJp2gjrFHHXaIwqqtmc=" }, "power":"10", "name":"miner2" }, { "address":"ECCC09A0DF8F4E5554A9C58F634E9D6AFD5F1598", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"BebelLYe4GZKwy9IuXCyBTySxQCNRrRoi1DSvAf6QxE=" }, "power":"10", "name":"miner3" } ], "oracles":[ "0xb926be24A9ca606B515a835E91298C7cF0f2846f", "0x2f4ed2773dcf7ad0ec15eb84ec896f4eebe0e08a" ] } } `}, "stage": { AutoUpdateGenesis: true, SeedNodes: []string{"588133b8309363a2a852e853424251cd6e8c5330@seed.stg.vocdoni.net:26656"}, Genesis: ` { "genesis_time":"2021-02-09T17:41:19.055210151Z", "chain_id":"vocdoni-stage-7", "consensus_params":{ "block":{ "max_bytes":"22020096", "max_gas":"-1", "time_iota_ms":"10000" }, "evidence":{ "max_age_num_blocks":"100000", "max_age_duration":"10000" }, "validator":{ "pub_key_types":[ "ed25519" ] } }, "validators":[ { "address":"B04F5541E932BB754B566969A3CD1F8E4193EFE8", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"JgZaEoVxLyv7jcMDikidK2HEbChqljSrZwN+humPh34=" }, "power":"10", "name":"miner1" }, { "address":"2DECD25EBDD6E3FAB2F06AC0EE391C16C292DBAD", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"HfZWmadJhz647Gx8zpRsSz8FACcWVpU2z6jYwUwComA=" }, "power":"10", "name":"miner2" }, { "address":"3C6FF3D424901733818B954AA3AB3BC2E3695332", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"sAsec4Da5SZrRAOmeIWDKKbwieDF5EwT28bjxtbPlpk=" }, "power":"10", "name":"miner3" }, { "address":"92C9A63172DFB4E9637309DFBFE20B1D11EDC4E7", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"SeRU76Jq8DRKrjtSpPLR/W69khkbeQBeNLr8CMXiht8=" }, "power":"10", "name":"miner4" } ], "app_hash":"", "app_state":{ "validators":[ { "address":"B04F5541E932BB754B566969A3CD1F8E4193EFE8", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"JgZaEoVxLyv7jcMDikidK2HEbChqljSrZwN+humPh34=" }, "power":"10", "name":"miner1" }, { "address":"2DECD25EBDD6E3FAB2F06AC0EE391C16C292DBAD", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"HfZWmadJhz647Gx8zpRsSz8FACcWVpU2z6jYwUwComA=" }, "power":"10", "name":"miner2" }, { "address":"3C6FF3D424901733818B954AA3AB3BC2E3695332", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"sAsec4Da5SZrRAOmeIWDKKbwieDF5EwT28bjxtbPlpk=" }, "power":"10", "name":"miner3" }, { "address":"92C9A63172DFB4E9637309DFBFE20B1D11EDC4E7", "pub_key":{ "type":"tendermint/PubKeyEd25519", "value":"SeRU76Jq8DRKrjtSpPLR/W69khkbeQBeNLr8CMXiht8=" }, "power":"10", "name":"miner4" } ], "oracles":[ "0x81ff945dda4b94690a13f49fdc8f0819970b2db0", "0xcf83836eab1a4697bb9f9d07d7fb82aed707d918", "0x949a4b6b5dc64cdc2518c15c8dfdead4ebd07df0" ] } } `}, }
Genesis is a map containing the defaut Genesis details
var PrefixDBCacheSize = 0
PrefixDBCacheSize is the size of the cache for the MutableTree IAVL databases
Functions ¶
func AddTx ¶
func AddTx(vtx *models.Tx, txBytes, signature []byte, state *State, txID [32]byte, commit bool) ([]byte, error)
AddTx check the validity of a transaction and adds it to the state if commit=true
func AdminTxCheck ¶
AdminTxCheck is an abstraction of ABCI checkTx for an admin transaction
func AminoKeys ¶
func AminoKeys(key crypto25519.PrivKey) (private, public []byte, err error)
AminoKeys is a helper function that transforms a standard EDDSA key into Tendermint like amino format useful for creating genesis files.
func CheckProof ¶
func CheckProof(proof *models.Proof, censusOrigin models.CensusOrigin, censusRoot, processID, key []byte) (bool, *big.Int, error)
CheckProof checks the validity of a census proof (depending on the origin). key is the data to be proof in behalf the censusRoot. In case of weighted proof, this function will return the weight as second parameter.
func GenerateNullifier ¶
GenerateNullifier generates the nullifier of a vote (hash(address+processId))
func NewGenesis ¶
func NewGenesis(cfg *config.VochainCfg, chainID string, consensusParams *types.ConsensusParams, validators []privval.FilePV, oracles []string) ([]byte, error)
NewGenesis creates a new genesis and return its bytes
func NewNodeKey ¶
NewNodeKey returns and saves to the disk storage a tendermint node key
func NewPrivateValidator ¶
NewPrivateValidator returns a tendermint file private validator (key and state) if tmPrivKey not specified, uses the existing one or generates a new one
func NewProcessTxCheck ¶
func NewProcessTxCheck(vtx *models.Tx, txBytes, signature []byte, state *State) (*models.Process, error)
NewProcessTxCheck is an abstraction of ABCI checkTx for creating a new process
func SetProcessTxCheck ¶
SetProcessTxCheck is an abstraction of ABCI checkTx for canceling an existing process
func UnmarshalTx ¶
UnmarshalTx unarshal the content of a bytes serialized transaction. Returns the transaction struct, the original bytes and the signature of those bytes.
Types ¶
type BaseApplication ¶
BaseApplication reflects the ABCI application implementation.
func NewBaseApplication ¶
func NewBaseApplication(dbpath string) (*BaseApplication, error)
NewBaseApplication creates a new BaseApplication given a name an a DB backend
func NewVochain ¶
func NewVochain(vochaincfg *config.VochainCfg, genesis []byte) *BaseApplication
NewVochain starts a node with an ABCI application
func (*BaseApplication) ApplySnapshotChunk ¶
func (app *BaseApplication) ApplySnapshotChunk(req abcitypes.RequestApplySnapshotChunk) abcitypes.ResponseApplySnapshotChunk
func (*BaseApplication) BeginBlock ¶
func (app *BaseApplication) BeginBlock(req abcitypes.RequestBeginBlock) abcitypes.ResponseBeginBlock
BeginBlock signals the beginning of a new block. Called prior to any DeliverTxs. The header contains the height, timestamp, and more - it exactly matches the Tendermint block header. The LastCommitInfo and ByzantineValidators can be used to determine rewards and punishments for the validators.
func (*BaseApplication) CheckTx ¶
func (app *BaseApplication) CheckTx(req abcitypes.RequestCheckTx) abcitypes.ResponseCheckTx
func (*BaseApplication) Commit ¶
func (app *BaseApplication) Commit() abcitypes.ResponseCommit
func (*BaseApplication) DeliverTx ¶
func (app *BaseApplication) DeliverTx(req abcitypes.RequestDeliverTx) abcitypes.ResponseDeliverTx
func (*BaseApplication) EndBlock ¶
func (app *BaseApplication) EndBlock(req abcitypes.RequestEndBlock) abcitypes.ResponseEndBlock
func (*BaseApplication) Info ¶
func (app *BaseApplication) Info(req abcitypes.RequestInfo) abcitypes.ResponseInfo
Info Return information about the application state. Used to sync Tendermint with the application during a handshake that happens on startup. The returned AppVersion will be included in the Header of every block. Tendermint expects LastBlockAppHash and LastBlockHeight to be updated during Commit, ensuring that Commit is never called twice for the same block height.
func (*BaseApplication) InitChain ¶
func (app *BaseApplication) InitChain(req abcitypes.RequestInitChain) abcitypes.ResponseInitChain
InitChain called once upon genesis ResponseInitChain can return a list of validators. If the list is empty, Tendermint will use the validators loaded in the genesis file.
func (*BaseApplication) ListSnapshots ¶
func (app *BaseApplication) ListSnapshots(req abcitypes.RequestListSnapshots) abcitypes.ResponseListSnapshots
func (*BaseApplication) LoadSnapshotChunk ¶
func (app *BaseApplication) LoadSnapshotChunk(req abcitypes.RequestLoadSnapshotChunk) abcitypes.ResponseLoadSnapshotChunk
func (*BaseApplication) OfferSnapshot ¶
func (app *BaseApplication) OfferSnapshot(req abcitypes.RequestOfferSnapshot) abcitypes.ResponseOfferSnapshot
func (*BaseApplication) Query ¶
func (app *BaseApplication) Query(req abcitypes.RequestQuery) abcitypes.ResponseQuery
func (*BaseApplication) SendTX ¶
func (app *BaseApplication) SendTX(tx []byte) (*ctypes.ResultBroadcastTx, error)
SendTX sends a transaction to the mempool (sync)
func (BaseApplication) SetOption ¶
func (BaseApplication) SetOption(req abcitypes.RequestSetOption) abcitypes.ResponseSetOption
type EventListener ¶
type EventListener interface { OnVote(*models.Vote) OnProcess(pid, eid []byte, censusRoot, censusURI string) OnProcessStatusChange(pid []byte, status models.ProcessStatus) OnCancel(pid []byte) OnProcessKeys(pid []byte, encryptionPub, commitment string) OnRevealKeys(pid []byte, encryptionPriv, reveal string) Commit(height int64) Rollback() }
EventListener is an interface used for executing custom functions during the events of the block creation process. The order in which events are executed is: Rollback, OnVote or OnProcess, Commit. The process is concurrency safe, meaning that there cannot be two sequences happening in parallel.
type ImmutableState ¶
type ImmutableState struct { // Note that the mutex locks the entirety of the three IAVL trees, both // their mutable and immutable components. An immutable tree is not safe // for concurrent use with its parent mutable tree. sync.RWMutex }
ImmutableState holds the latest trees version saved on disk
type State ¶
type State struct { Store statedb.StateDB ImmutableState MemPoolRemoveTxKey func([32]byte, bool) // contains filtered or unexported fields }
State represents the state of the vochain application
func (*State) AddEventListener ¶
func (v *State) AddEventListener(l EventListener)
AddEventListener adds a new event listener, to receive method calls on block events as documented in EventListener.
func (*State) AddProcess ¶
AddProcess adds or overides a new process to vochain
func (*State) AddProcessKeys ¶
AddProcessKeys adds the keys to the process
func (*State) AddValidator ¶
AddValidator adds a tendemint validator if it is not already added
func (*State) AddVote ¶
AddVote adds a new vote to a process if the process exists and the vote is not already submmited
func (*State) CachePurge ¶
CachePurge removes the old cache saved votes
func (*State) CancelProcess ¶
CancelProcess sets the process canceled attribute to true
func (*State) CountProcesses ¶
CountProcesses returns the overall number of processes the vochain has
func (*State) CountVotes ¶
CountVotes returns the number of votes registered for a given process id
func (*State) Envelope ¶
Envelope returns the info of a vote if already exists. voteID must be equals to processID_Nullifier
func (*State) EnvelopeExists ¶
EnvelopeExists returns true if the envelope identified with voteID exists
func (*State) EnvelopeList ¶
func (v *State) EnvelopeList(processID []byte, from, listSize int, isQuery bool) (nullifiers [][]byte)
EnvelopeList returns a list of registered envelopes nullifiers given a processId
func (*State) Header ¶
func (v *State) Header(isQuery bool) *models.TendermintHeader
Header returns the blockchain last block committed height
func (*State) RemoveOracle ¶
RemoveOracle removes a trusted oracle given its address if exists
func (*State) RemoveValidator ¶
RemoveValidator removes a tendermint validator identified by its address
func (*State) RevealProcessKeys ¶
RevealProcessKeys reveals the keys of a process
func (*State) Rollback ¶
func (v *State) Rollback()
Rollback rollbacks to the last persistent db data version
func (*State) SetProcessCensus ¶
func (*State) SetProcessResults ¶
SetProcessResults sets the results for a given process. Only if the process status allows and the format of the results allows to do so TODO: allow result confirm with another Tx (in order to have N/M oracle signatures)
func (*State) SetProcessStatus ¶
SetProcessStatus changes the process status to the one provided. One of ready, ended, canceled, paused, results. Transition checks are handled inside this function, so the caller does not need to worry about it.
func (*State) Validators ¶
Validators returns a list of the validators saved on persistent storage
func (*State) WorkingHash ¶
WorkingHash returns the hash of the vochain trees censusRoots hash(appTree+processTree+voteTree)
type TenderLogger ¶
type TenderLogger struct { Artifact string Disabled bool // contains filtered or unexported fields }
TenderLogger implements tendermint's Logger interface, with a couple of modifications.
First, it routes the logs to go-dvote's logger, so that we don't end up with two loggers writing directly to stdout or stderr.
Second, because we generally don't care about tendermint errors such as failures to connect to peers, we route all log levels to our debug level. They will only surface if dvote's log level is "debug".
func NewTenderLogger ¶
func NewTenderLogger(artifact string, disabled bool) *TenderLogger
NewTenderLogger creates a Tenderming compatible logger for specified artifact
func (*TenderLogger) Debug ¶
func (l *TenderLogger) Debug(msg string, keyvals ...interface{})
func (*TenderLogger) Error ¶
func (l *TenderLogger) Error(msg string, keyvals ...interface{})
func (*TenderLogger) Info ¶
func (l *TenderLogger) Info(msg string, keyvals ...interface{})
func (*TenderLogger) With ¶
func (l *TenderLogger) With(keyvals ...interface{}) tmlog.Logger