Documentation ¶
Overview ¶
Package wavelet is a generated protocol buffer package.
It is generated from these files:
src/rpc.proto
It has these top-level messages:
QueryRequest QueryResponse OutOfSyncRequest OutOfSyncResponse SyncInfo SyncRequest SyncResponse DownloadTxRequest DownloadMissingTxRequest DownloadTxResponse Transactions Empty
Index ¶
- Constants
- Variables
- func AcquireQueue() *queue.Queue
- func ApplyTransaction(tree *avl.Tree, round *Round, tx *Transaction) error
- func CloneVM(vm *exec.VirtualMachine, gasPolicy compiler.GasPolicy, ...) (*exec.VirtualMachine, error)
- func CollectVotesForFinalization(accounts *Accounts, snowball *Snowball, voteChan <-chan finalizationVote, ...)
- func CollectVotesForSync(accounts *Accounts, snowball *Snowball, voteChan <-chan syncVote, ...)
- func ExportGraphDOT(round *Round, graph *Graph)
- func LoadContractGlobals(snapshot *avl.Tree, id AccountID) ([]int64, bool)
- func LoadContractMemorySnapshot(snapshot *avl.Tree, id AccountID) []byte
- func ParseJSON(data []byte, tag string) ([]byte, error)
- func ReadAccountBalance(tree *avl.Tree, id AccountID) (uint64, bool)
- func ReadAccountContractCode(tree *avl.Tree, id TransactionID) ([]byte, bool)
- func ReadAccountContractGasBalance(tree *avl.Tree, id TransactionID) (uint64, bool)
- func ReadAccountContractGlobals(tree *avl.Tree, id TransactionID) ([]byte, bool)
- func ReadAccountContractNumPages(tree *avl.Tree, id TransactionID) (uint64, bool)
- func ReadAccountContractPage(tree *avl.Tree, id TransactionID, idx uint64) ([]byte, bool)
- func ReadAccountNonce(tree *avl.Tree, id AccountID) (uint64, bool)
- func ReadAccountReward(tree *avl.Tree, id AccountID) (uint64, bool)
- func ReadAccountStake(tree *avl.Tree, id AccountID) (uint64, bool)
- func ReadAccountsLen(tree *avl.Tree) uint64
- func RegisterWaveletServer(s *grpc.Server, srv WaveletServer)
- func ReleaseQueue(q *queue.Queue)
- func SaveContractGlobals(snapshot *avl.Tree, id AccountID, globals []int64)
- func SaveContractMemorySnapshot(snapshot *avl.Tree, id AccountID, mem []byte)
- func SelectPeers(peers []*grpc.ClientConn, amount int) ([]*grpc.ClientConn, error)
- func SetGenesisByNetwork(name string) error
- func StoreRewardWithdrawalRequest(tree *avl.Tree, rw RewardWithdrawalRequest)
- func StoreRound(kv store.KV, round Round, currentIx, oldestIx uint32, storedCount uint8) error
- func WriteAccountBalance(tree *avl.Tree, id AccountID, balance uint64)
- func WriteAccountContractCode(tree *avl.Tree, id TransactionID, code []byte)
- func WriteAccountContractGasBalance(tree *avl.Tree, id TransactionID, gasBalance uint64)
- func WriteAccountContractGlobals(tree *avl.Tree, id TransactionID, globals []byte)
- func WriteAccountContractNumPages(tree *avl.Tree, id TransactionID, numPages uint64)
- func WriteAccountContractPage(tree *avl.Tree, id TransactionID, idx uint64, page []byte)
- func WriteAccountNonce(tree *avl.Tree, id AccountID, nonce uint64)
- func WriteAccountReward(tree *avl.Tree, id AccountID, reward uint64)
- func WriteAccountStake(tree *avl.Tree, id AccountID, stake uint64)
- func WriteAccountsLen(tree *avl.Tree, size uint64)
- type AccountID
- type Accounts
- type Batch
- type CollapseContext
- func (c *CollapseContext) ApplyTransaction(round *Round, tx *Transaction) error
- func (c *CollapseContext) Flush() error
- func (c *CollapseContext) GetContractState(id AccountID) (*VMState, bool)
- func (c *CollapseContext) ReadAccountBalance(id AccountID) (uint64, bool)
- func (c *CollapseContext) ReadAccountContractCode(id TransactionID) ([]byte, bool)
- func (c *CollapseContext) ReadAccountContractGasBalance(id TransactionID) (uint64, bool)
- func (c *CollapseContext) ReadAccountNonce(id AccountID) (uint64, bool)
- func (c *CollapseContext) ReadAccountReward(id AccountID) (uint64, bool)
- func (c *CollapseContext) ReadAccountStake(id AccountID) (uint64, bool)
- func (c *CollapseContext) ReadAccountsLen() uint64
- func (c *CollapseContext) SetContractState(id AccountID, state *VMState)
- func (c *CollapseContext) StoreRewardWithdrawalRequest(rw RewardWithdrawalRequest)
- func (c *CollapseContext) WriteAccountBalance(id AccountID, balance uint64)
- func (c *CollapseContext) WriteAccountContractCode(id TransactionID, code []byte)
- func (c *CollapseContext) WriteAccountContractGasBalance(id TransactionID, gasBalance uint64)
- func (c *CollapseContext) WriteAccountNonce(id AccountID, nonce uint64)
- func (c *CollapseContext) WriteAccountReward(id AccountID, reward uint64)
- func (c *CollapseContext) WriteAccountStake(id AccountID, stake uint64)
- func (c *CollapseContext) WriteAccountsLen(size uint64)
- type CollapseState
- type Contract
- type ContractExecutor
- func (e *ContractExecutor) Execute(id AccountID, round *Round, tx *Transaction, amount, gasLimit uint64, ...) (*VMState, error)
- func (e *ContractExecutor) GetCost(key string) int64
- func (e *ContractExecutor) ResolveFunc(module, field string) exec.FunctionImport
- func (e *ContractExecutor) ResolveGlobal(module, field string) int64
- type DownloadMissingTxRequest
- func (*DownloadMissingTxRequest) Descriptor() ([]byte, []int)
- func (m *DownloadMissingTxRequest) GetIds() [][]byte
- func (m *DownloadMissingTxRequest) Marshal() (dAtA []byte, err error)
- func (m *DownloadMissingTxRequest) MarshalTo(dAtA []byte) (int, error)
- func (*DownloadMissingTxRequest) ProtoMessage()
- func (m *DownloadMissingTxRequest) Reset()
- func (m *DownloadMissingTxRequest) Size() (n int)
- func (m *DownloadMissingTxRequest) String() string
- func (m *DownloadMissingTxRequest) Unmarshal(dAtA []byte) error
- type DownloadTxRequest
- func (*DownloadTxRequest) Descriptor() ([]byte, []int)
- func (m *DownloadTxRequest) GetDepth() uint64
- func (m *DownloadTxRequest) GetSkipIds() [][]byte
- func (m *DownloadTxRequest) Marshal() (dAtA []byte, err error)
- func (m *DownloadTxRequest) MarshalTo(dAtA []byte) (int, error)
- func (*DownloadTxRequest) ProtoMessage()
- func (m *DownloadTxRequest) Reset()
- func (m *DownloadTxRequest) Size() (n int)
- func (m *DownloadTxRequest) String() string
- func (m *DownloadTxRequest) Unmarshal(dAtA []byte) error
- type DownloadTxResponse
- func (*DownloadTxResponse) Descriptor() ([]byte, []int)
- func (m *DownloadTxResponse) GetTransactions() [][]byte
- func (m *DownloadTxResponse) Marshal() (dAtA []byte, err error)
- func (m *DownloadTxResponse) MarshalTo(dAtA []byte) (int, error)
- func (*DownloadTxResponse) ProtoMessage()
- func (m *DownloadTxResponse) Reset()
- func (m *DownloadTxResponse) Size() (n int)
- func (m *DownloadTxResponse) String() string
- func (m *DownloadTxResponse) Unmarshal(dAtA []byte) error
- type Empty
- func (*Empty) Descriptor() ([]byte, []int)
- func (m *Empty) Marshal() (dAtA []byte, err error)
- func (m *Empty) MarshalTo(dAtA []byte) (int, error)
- func (*Empty) ProtoMessage()
- func (m *Empty) Reset()
- func (m *Empty) Size() (n int)
- func (m *Empty) String() string
- func (m *Empty) Unmarshal(dAtA []byte) error
- type Gossiper
- type Graph
- func (g *Graph) AddTransaction(tx Transaction) error
- func (g *Graph) DepthLen(start *uint64, end *uint64) int
- func (g *Graph) FindEligibleCritical(difficulty byte) *Transaction
- func (g *Graph) FindEligibleParents() []*Transaction
- func (g *Graph) FindTransaction(id TransactionID) *Transaction
- func (g *Graph) GetTransactionsByDepth(start *uint64, end *uint64) []*Transaction
- func (g *Graph) Height() uint64
- func (g *Graph) IncompleteLen() int
- func (g *Graph) Len() int
- func (g *Graph) ListTransactions(offset, limit uint64, sender, creator AccountID) (transactions []*Transaction)
- func (g *Graph) MarkTransactionAsMissing(id TransactionID, depth uint64)
- func (g *Graph) Missing() []TransactionID
- func (g *Graph) MissingLen() int
- func (g *Graph) PruneBelowDepth(targetDepth uint64) int
- func (g *Graph) RootDepth() uint64
- func (g *Graph) UpdateRoot(root Transaction)
- func (g *Graph) UpdateRootDepth(rootDepth uint64)
- type GraphOption
- type Identifiable
- type Indexer
- type Ledger
- func (l *Ledger) AddTransaction(tx Transaction) error
- func (l *Ledger) BroadcastNop() *Transaction
- func (l *Ledger) BroadcastingNop() bool
- func (l *Ledger) Close()
- func (l *Ledger) FinalizeRounds()
- func (l *Ledger) Finalizer() *Snowball
- func (l *Ledger) Find(query string, max int) (results []string)
- func (l *Ledger) Graph() *Graph
- func (l *Ledger) LogChanges(snapshot *avl.Tree, lastRound uint64)
- func (l *Ledger) PerformConsensus()
- func (l *Ledger) Protocol() *Protocol
- func (l *Ledger) PullMissingTransactions()
- func (l *Ledger) PushSendQuota()
- func (l *Ledger) Restart() error
- func (l *Ledger) Rounds() *Rounds
- func (l *Ledger) Snapshot() *avl.Tree
- func (l *Ledger) SyncStatus() string
- func (l *Ledger) SyncToLatestRound()
- func (l *Ledger) SyncTransactions()
- func (l *Ledger) TakeSendQuota() bool
- type MerkleNodeID
- type Metrics
- type Option
- type OutOfSyncRequest
- func (*OutOfSyncRequest) Descriptor() ([]byte, []int)
- func (m *OutOfSyncRequest) GetRoundIndex() uint64
- func (m *OutOfSyncRequest) Marshal() (dAtA []byte, err error)
- func (m *OutOfSyncRequest) MarshalTo(dAtA []byte) (int, error)
- func (*OutOfSyncRequest) ProtoMessage()
- func (m *OutOfSyncRequest) Reset()
- func (m *OutOfSyncRequest) Size() (n int)
- func (m *OutOfSyncRequest) String() string
- func (m *OutOfSyncRequest) Unmarshal(dAtA []byte) error
- type OutOfSyncResponse
- func (*OutOfSyncResponse) Descriptor() ([]byte, []int)
- func (m *OutOfSyncResponse) GetOutOfSync() bool
- func (m *OutOfSyncResponse) Marshal() (dAtA []byte, err error)
- func (m *OutOfSyncResponse) MarshalTo(dAtA []byte) (int, error)
- func (*OutOfSyncResponse) ProtoMessage()
- func (m *OutOfSyncResponse) Reset()
- func (m *OutOfSyncResponse) Size() (n int)
- func (m *OutOfSyncResponse) String() string
- func (m *OutOfSyncResponse) Unmarshal(dAtA []byte) error
- type Protocol
- func (p *Protocol) CheckOutOfSync(ctx context.Context, req *OutOfSyncRequest) (*OutOfSyncResponse, error)
- func (p *Protocol) DownloadMissingTx(ctx context.Context, req *DownloadMissingTxRequest) (*DownloadTxResponse, error)
- func (p *Protocol) DownloadTx(ctx context.Context, req *DownloadTxRequest) (*DownloadTxResponse, error)
- func (p *Protocol) Gossip(stream Wavelet_GossipServer) error
- func (p *Protocol) Query(ctx context.Context, req *QueryRequest) (*QueryResponse, error)
- func (p *Protocol) Sync(stream Wavelet_SyncServer) error
- type QueryRequest
- func (*QueryRequest) Descriptor() ([]byte, []int)
- func (m *QueryRequest) GetRoundIndex() uint64
- func (m *QueryRequest) Marshal() (dAtA []byte, err error)
- func (m *QueryRequest) MarshalTo(dAtA []byte) (int, error)
- func (*QueryRequest) ProtoMessage()
- func (m *QueryRequest) Reset()
- func (m *QueryRequest) Size() (n int)
- func (m *QueryRequest) String() string
- func (m *QueryRequest) Unmarshal(dAtA []byte) error
- type QueryResponse
- func (*QueryResponse) Descriptor() ([]byte, []int)
- func (m *QueryResponse) GetRound() []byte
- func (m *QueryResponse) Marshal() (dAtA []byte, err error)
- func (m *QueryResponse) MarshalTo(dAtA []byte) (int, error)
- func (*QueryResponse) ProtoMessage()
- func (m *QueryResponse) Reset()
- func (m *QueryResponse) Size() (n int)
- func (m *QueryResponse) String() string
- func (m *QueryResponse) Unmarshal(dAtA []byte) error
- type RewardWithdrawalRequest
- type Round
- type RoundID
- type Rounds
- type Signature
- type Snowball
- type SnowballOption
- type Stake
- type StallDetector
- type StallDetectorConfig
- type StallDetectorDelegate
- type SyncInfo
- func (*SyncInfo) Descriptor() ([]byte, []int)
- func (m *SyncInfo) GetChecksums() [][]byte
- func (m *SyncInfo) GetLatestRound() []byte
- func (m *SyncInfo) Marshal() (dAtA []byte, err error)
- func (m *SyncInfo) MarshalTo(dAtA []byte) (int, error)
- func (*SyncInfo) ProtoMessage()
- func (m *SyncInfo) Reset()
- func (m *SyncInfo) Size() (n int)
- func (m *SyncInfo) String() string
- func (m *SyncInfo) Unmarshal(dAtA []byte) error
- type SyncRequest
- func (*SyncRequest) Descriptor() ([]byte, []int)
- func (m *SyncRequest) GetChecksum() []byte
- func (m *SyncRequest) GetData() isSyncRequest_Data
- func (m *SyncRequest) GetRoundId() uint64
- func (m *SyncRequest) Marshal() (dAtA []byte, err error)
- func (m *SyncRequest) MarshalTo(dAtA []byte) (int, error)
- func (*SyncRequest) ProtoMessage()
- func (m *SyncRequest) Reset()
- func (m *SyncRequest) Size() (n int)
- func (m *SyncRequest) String() string
- func (m *SyncRequest) Unmarshal(dAtA []byte) error
- func (*SyncRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, ...)
- type SyncRequest_Checksum
- type SyncRequest_RoundId
- type SyncResponse
- func (*SyncResponse) Descriptor() ([]byte, []int)
- func (m *SyncResponse) GetChunk() []byte
- func (m *SyncResponse) GetData() isSyncResponse_Data
- func (m *SyncResponse) GetHeader() *SyncInfo
- func (m *SyncResponse) Marshal() (dAtA []byte, err error)
- func (m *SyncResponse) MarshalTo(dAtA []byte) (int, error)
- func (*SyncResponse) ProtoMessage()
- func (m *SyncResponse) Reset()
- func (m *SyncResponse) Size() (n int)
- func (m *SyncResponse) String() string
- func (m *SyncResponse) Unmarshal(dAtA []byte) error
- func (*SyncResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, ...)
- type SyncResponse_Chunk
- type SyncResponse_Header
- type TestLedger
- func (l *TestLedger) Addr() string
- func (l *TestLedger) Applied(tx Transaction) bool
- func (l *TestLedger) Balance() uint64
- func (l *TestLedger) BalanceOfAccount(node *TestLedger) uint64
- func (l *TestLedger) BalanceWithPublicKey(key AccountID) uint64
- func (l *TestLedger) Benchmark(batchSize int) (Transaction, error)
- func (l *TestLedger) CallContract(id [32]byte, amount uint64, gasLimit uint64, funcName string, params []byte) (Transaction, error)
- func (l *TestLedger) Cleanup()
- func (l *TestLedger) Client() *skademlia.Client
- func (l *TestLedger) DBPath() string
- func (l *TestLedger) DepositGas(id [32]byte, gasDeposit uint64) (Transaction, error)
- func (l *TestLedger) FindTransaction(t testing.TB, id TransactionID) *Transaction
- func (l *TestLedger) GasBalanceOfAddress(address [32]byte) uint64
- func (l *TestLedger) Leave()
- func (l *TestLedger) Ledger() *Ledger
- func (l *TestLedger) Nop() (Transaction, error)
- func (l *TestLedger) Pay(to *TestLedger, amount uint64) (Transaction, error)
- func (l *TestLedger) PlaceStake(amount uint64) (Transaction, error)
- func (l *TestLedger) PrivateKey() edwards25519.PrivateKey
- func (l *TestLedger) PublicKey() AccountID
- func (l *TestLedger) Reward() uint64
- func (l *TestLedger) RewardWithPublicKey(key AccountID) uint64
- func (l *TestLedger) RoundIndex() uint64
- func (l *TestLedger) SpawnContract(contractPath string, gasLimit uint64, params []byte) (Transaction, error)
- func (l *TestLedger) Stake() uint64
- func (l *TestLedger) StakeOfAccount(node *TestLedger) uint64
- func (l *TestLedger) StakeWithPublicKey(key AccountID) uint64
- func (l *TestLedger) WaitForConsensus() <-chan bool
- func (l *TestLedger) WaitForRound(index uint64) <-chan uint64
- func (l *TestLedger) WaitForSync() <-chan bool
- func (l *TestLedger) WaitUntilBalance(t testing.TB, balance uint64)
- func (l *TestLedger) WaitUntilConsensus(t testing.TB)
- func (l *TestLedger) WaitUntilRound(t testing.TB, round uint64)
- func (l *TestLedger) WaitUntilStake(t testing.TB, stake uint64)
- func (l *TestLedger) WithdrawReward(amount uint64) (Transaction, error)
- func (l *TestLedger) WithdrawStake(amount uint64) (Transaction, error)
- type TestLedgerConfig
- type TestLedgerOption
- type TestNetwork
- func (n *TestNetwork) AddNode(t testing.TB, opts ...TestLedgerOption) *TestLedger
- func (n *TestNetwork) Cleanup()
- func (n *TestNetwork) Faucet() *TestLedger
- func (n *TestNetwork) Nodes() []*TestLedger
- func (n *TestNetwork) SetFaucet(node *TestLedger)
- func (n *TestNetwork) WaitForConsensus(t testing.TB)
- func (n *TestNetwork) WaitForRound(t testing.TB, round uint64)
- func (n *TestNetwork) WaitForSync(t testing.TB)
- type TestNetworkConfig
- type TestNetworkOption
- type Transaction
- type TransactionID
- type TransactionSeed
- type Transactions
- func (*Transactions) Descriptor() ([]byte, []int)
- func (m *Transactions) GetTransactions() [][]byte
- func (m *Transactions) Marshal() (dAtA []byte, err error)
- func (m *Transactions) MarshalTo(dAtA []byte) (int, error)
- func (*Transactions) ProtoMessage()
- func (m *Transactions) Reset()
- func (m *Transactions) Size() (n int)
- func (m *Transactions) String() string
- func (m *Transactions) Unmarshal(dAtA []byte) error
- type Transfer
- type VMState
- type WaveletClient
- type WaveletServer
- type Wavelet_GossipClient
- type Wavelet_GossipServer
- type Wavelet_SyncClient
- type Wavelet_SyncServer
Constants ¶
const ( SizeTransactionID = blake2b.Size256 SizeTransactionSeed = blake2b.Size256 SizeRoundID = blake2b.Size256 SizeMerkleNodeID = md5.Size SizeAccountID = 32 SizeSignature = 64 )
const ( // PayloadParamNameRecipient defines a string representation of the recipient payload param. PayloadParamNameRecipient = "recipient" // PayloadParamNameAmount defines a string representation of the amount payload param. PayloadParamNameAmount = "amount" // PayloadParamNameGasLimit defines a string representation of the gas_limit payload param. PayloadParamNameGasLimit = "gas_limit" // PayloadParamNameGasDeposit defines a string representation of the gas_deposit payload param. PayloadParamNameGasDeposit = "gas_deposit" // PayloadParamNameFuncName defines a string representation of the fn_name payload param. PayloadParamNameFuncName = "fn_name" // PayloadParamNameFuncPayload defines a string representation of the fn_payload payload param. PayloadParamNameFuncPayload = "fn_payload" // PayloadParamNameOperation defines a string representation of the operation payload param. PayloadParamNameOperation = "operation" // PayloadParamNameContractCode defines a string representation of the contract_code payload param. PayloadParamNameContractCode = "contract_code" )
const (
PageSize = 65536
)
Variables ¶
var ( ZeroTransactionID TransactionID ZeroRoundID RoundID ZeroMerkleNodeID MerkleNodeID ZeroAccountID AccountID ZeroSignature Signature ZeroRoundPtr = &Round{} ZeroPage = make([]byte, PageSize) )
var ( ErrMissingParents = errors.New("parents for transaction are not in graph") ErrAlreadyExists = errors.New("transaction already exists in the graph") ErrDepthTooLow = errors.New("transaction depth is too low") ErrParentDepthLimitExceeded = errors.New("transactions parents exceed depth limit") )
var ( ErrInvalidLengthRpc = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflowRpc = fmt.Errorf("proto: integer overflow") )
var ( // ErrNoTag defines an error describing an empty Tag. ErrNoTag = errors.New("no tag specified") // ErrInvalidTag defines an error describing an invalid TransactionTag. ErrInvalidTag = errors.New("tag is invalid") // ErrCouldNotParse defines an error describing the inability to parse a given payload. ErrCouldNotParse = errors.New("could not parse the given payload") // ErrNilField defines an error describing a field value equal to nil. ErrNilField = errors.New("field is nil") // ErrInvalidOperation defines an error describing an invalid operation value. ErrInvalidOperation = errors.New("operation is invalid") // ErrInvalidAccountIDSize defines an error describing an invalid account ID size. ErrInvalidAccountIDSize = errors.New("account ID is of an invalid size") )
var (
ErrContractFunctionNotFound = errors.New("contract: smart contract func not found")
)
var (
ErrOutOfSync = errors.New("Node is currently ouf of sync. Please try again later.")
)
var (
FaucetWallet = "" /* 128-byte string literal not displayed */
)
Functions ¶
func AcquireQueue ¶
func ApplyTransaction ¶ added in v0.1.0
func ApplyTransaction(tree *avl.Tree, round *Round, tx *Transaction) error
Apply the transaction and immediately write the states into the tree. If you have many transactions to apply, consider using CollapseContext.
func CloneVM ¶ added in v0.2.0
func CloneVM(vm *exec.VirtualMachine, gasPolicy compiler.GasPolicy, importResolver exec.ImportResolver) (*exec.VirtualMachine, error)
func CollectVotesForFinalization ¶ added in v0.2.0
func CollectVotesForSync ¶ added in v0.2.0
func ExportGraphDOT ¶
func LoadContractGlobals ¶ added in v0.1.1
func ReadAccountContractCode ¶
func ReadAccountContractCode(tree *avl.Tree, id TransactionID) ([]byte, bool)
func ReadAccountContractGasBalance ¶ added in v0.1.0
func ReadAccountContractGasBalance(tree *avl.Tree, id TransactionID) (uint64, bool)
func ReadAccountContractGlobals ¶ added in v0.1.1
func ReadAccountContractGlobals(tree *avl.Tree, id TransactionID) ([]byte, bool)
func ReadAccountContractNumPages ¶
func ReadAccountContractNumPages(tree *avl.Tree, id TransactionID) (uint64, bool)
func ReadAccountContractPage ¶
func ReadAccountsLen ¶
func RegisterWaveletServer ¶
func RegisterWaveletServer(s *grpc.Server, srv WaveletServer)
func ReleaseQueue ¶
func SaveContractGlobals ¶ added in v0.1.1
func SelectPeers ¶
func SelectPeers(peers []*grpc.ClientConn, amount int) ([]*grpc.ClientConn, error)
func SetGenesisByNetwork ¶ added in v0.2.0
func StoreRewardWithdrawalRequest ¶
func StoreRewardWithdrawalRequest(tree *avl.Tree, rw RewardWithdrawalRequest)
func StoreRound ¶
func WriteAccountContractCode ¶
func WriteAccountContractCode(tree *avl.Tree, id TransactionID, code []byte)
func WriteAccountContractGasBalance ¶ added in v0.1.0
func WriteAccountContractGasBalance(tree *avl.Tree, id TransactionID, gasBalance uint64)
func WriteAccountContractGlobals ¶ added in v0.1.1
func WriteAccountContractGlobals(tree *avl.Tree, id TransactionID, globals []byte)
func WriteAccountContractNumPages ¶
func WriteAccountContractNumPages(tree *avl.Tree, id TransactionID, numPages uint64)
func WriteAccountContractPage ¶
func WriteAccountContractPage(tree *avl.Tree, id TransactionID, idx uint64, page []byte)
func WriteAccountsLen ¶
Types ¶
type AccountID ¶
type AccountID = [SizeAccountID]byte
type Accounts ¶
func NewAccounts ¶
type Batch ¶
func ParseBatch ¶ added in v0.1.0
ParseBatch parses and performs sanity checks on the payload of a batch transaction.
func (*Batch) AddContract ¶ added in v0.1.0
AddContract adds a Contract payload into a batch.
func (*Batch) AddTransfer ¶ added in v0.1.0
AddTransfer adds a Transfer payload into a batch.
type CollapseContext ¶ added in v0.2.0
WARNING: While using this, the tree must not be modified.
func NewCollapseContext ¶ added in v0.2.0
func NewCollapseContext(tree *avl.Tree) *CollapseContext
func (*CollapseContext) ApplyTransaction ¶ added in v0.2.0
func (c *CollapseContext) ApplyTransaction(round *Round, tx *Transaction) error
Apply a transaction by writing the states into memory. After you've finished, you MUST call CollapseContext.Flush() to actually write the states into the tree.
func (*CollapseContext) Flush ¶ added in v0.2.0
func (c *CollapseContext) Flush() error
Write the changes into the tree.
func (*CollapseContext) GetContractState ¶ added in v0.2.0
func (c *CollapseContext) GetContractState(id AccountID) (*VMState, bool)
func (*CollapseContext) ReadAccountBalance ¶ added in v0.2.0
func (c *CollapseContext) ReadAccountBalance(id AccountID) (uint64, bool)
func (*CollapseContext) ReadAccountContractCode ¶ added in v0.2.0
func (c *CollapseContext) ReadAccountContractCode(id TransactionID) ([]byte, bool)
func (*CollapseContext) ReadAccountContractGasBalance ¶ added in v0.2.0
func (c *CollapseContext) ReadAccountContractGasBalance(id TransactionID) (uint64, bool)
func (*CollapseContext) ReadAccountNonce ¶ added in v0.2.0
func (c *CollapseContext) ReadAccountNonce(id AccountID) (uint64, bool)
func (*CollapseContext) ReadAccountReward ¶ added in v0.2.0
func (c *CollapseContext) ReadAccountReward(id AccountID) (uint64, bool)
func (*CollapseContext) ReadAccountStake ¶ added in v0.2.0
func (c *CollapseContext) ReadAccountStake(id AccountID) (uint64, bool)
func (*CollapseContext) ReadAccountsLen ¶ added in v0.2.0
func (c *CollapseContext) ReadAccountsLen() uint64
func (*CollapseContext) SetContractState ¶ added in v0.2.0
func (c *CollapseContext) SetContractState(id AccountID, state *VMState)
func (*CollapseContext) StoreRewardWithdrawalRequest ¶ added in v0.2.0
func (c *CollapseContext) StoreRewardWithdrawalRequest(rw RewardWithdrawalRequest)
func (*CollapseContext) WriteAccountBalance ¶ added in v0.2.0
func (c *CollapseContext) WriteAccountBalance(id AccountID, balance uint64)
func (*CollapseContext) WriteAccountContractCode ¶ added in v0.2.0
func (c *CollapseContext) WriteAccountContractCode(id TransactionID, code []byte)
func (*CollapseContext) WriteAccountContractGasBalance ¶ added in v0.2.0
func (c *CollapseContext) WriteAccountContractGasBalance(id TransactionID, gasBalance uint64)
func (*CollapseContext) WriteAccountNonce ¶ added in v0.2.0
func (c *CollapseContext) WriteAccountNonce(id AccountID, nonce uint64)
func (*CollapseContext) WriteAccountReward ¶ added in v0.2.0
func (c *CollapseContext) WriteAccountReward(id AccountID, reward uint64)
func (*CollapseContext) WriteAccountStake ¶ added in v0.2.0
func (c *CollapseContext) WriteAccountStake(id AccountID, stake uint64)
func (*CollapseContext) WriteAccountsLen ¶ added in v0.2.0
func (c *CollapseContext) WriteAccountsLen(size uint64)
type CollapseState ¶ added in v0.2.0
type CollapseState struct {
// contains filtered or unexported fields
}
type Contract ¶
func ParseContract ¶ added in v0.1.0
ParseContract parses and performs sanity checks on the payload of a contract transaction.
type ContractExecutor ¶
type ContractExecutor struct { ID AccountID Gas uint64 GasLimitExceeded bool Payload []byte Error []byte Queue []*Transaction }
func (*ContractExecutor) Execute ¶
func (e *ContractExecutor) Execute(id AccountID, round *Round, tx *Transaction, amount, gasLimit uint64, name string, params, code []byte, tree *avl.Tree, vmCache *lru.LRU, contractState *VMState) (*VMState, error)
contractState is an optional parameter that is used to pass the VMState of the contract. If you cache the VMState, you can pass it. If it's nil, we'll try to load the state from the tree.
This function MUST NOT write into the tree. The new or updated VM State must be returned.
func (*ContractExecutor) GetCost ¶
func (e *ContractExecutor) GetCost(key string) int64
func (*ContractExecutor) ResolveFunc ¶
func (e *ContractExecutor) ResolveFunc(module, field string) exec.FunctionImport
func (*ContractExecutor) ResolveGlobal ¶
func (e *ContractExecutor) ResolveGlobal(module, field string) int64
type DownloadMissingTxRequest ¶ added in v0.2.0
type DownloadMissingTxRequest struct {
Ids [][]byte `protobuf:"bytes,1,rep,name=ids" json:"ids,omitempty"`
}
func (*DownloadMissingTxRequest) Descriptor ¶ added in v0.2.0
func (*DownloadMissingTxRequest) Descriptor() ([]byte, []int)
func (*DownloadMissingTxRequest) GetIds ¶ added in v0.2.0
func (m *DownloadMissingTxRequest) GetIds() [][]byte
func (*DownloadMissingTxRequest) Marshal ¶ added in v0.2.0
func (m *DownloadMissingTxRequest) Marshal() (dAtA []byte, err error)
func (*DownloadMissingTxRequest) MarshalTo ¶ added in v0.2.0
func (m *DownloadMissingTxRequest) MarshalTo(dAtA []byte) (int, error)
func (*DownloadMissingTxRequest) ProtoMessage ¶ added in v0.2.0
func (*DownloadMissingTxRequest) ProtoMessage()
func (*DownloadMissingTxRequest) Reset ¶ added in v0.2.0
func (m *DownloadMissingTxRequest) Reset()
func (*DownloadMissingTxRequest) Size ¶ added in v0.2.0
func (m *DownloadMissingTxRequest) Size() (n int)
func (*DownloadMissingTxRequest) String ¶ added in v0.2.0
func (m *DownloadMissingTxRequest) String() string
func (*DownloadMissingTxRequest) Unmarshal ¶ added in v0.2.0
func (m *DownloadMissingTxRequest) Unmarshal(dAtA []byte) error
type DownloadTxRequest ¶
type DownloadTxRequest struct { SkipIds [][]byte `protobuf:"bytes,1,rep,name=skip_ids,json=skipIds" json:"skip_ids,omitempty"` Depth uint64 `protobuf:"varint,2,opt,name=depth,proto3" json:"depth,omitempty"` }
func (*DownloadTxRequest) Descriptor ¶
func (*DownloadTxRequest) Descriptor() ([]byte, []int)
func (*DownloadTxRequest) GetDepth ¶ added in v0.2.0
func (m *DownloadTxRequest) GetDepth() uint64
func (*DownloadTxRequest) GetSkipIds ¶ added in v0.2.0
func (m *DownloadTxRequest) GetSkipIds() [][]byte
func (*DownloadTxRequest) Marshal ¶
func (m *DownloadTxRequest) Marshal() (dAtA []byte, err error)
func (*DownloadTxRequest) MarshalTo ¶
func (m *DownloadTxRequest) MarshalTo(dAtA []byte) (int, error)
func (*DownloadTxRequest) ProtoMessage ¶
func (*DownloadTxRequest) ProtoMessage()
func (*DownloadTxRequest) Reset ¶
func (m *DownloadTxRequest) Reset()
func (*DownloadTxRequest) Size ¶
func (m *DownloadTxRequest) Size() (n int)
func (*DownloadTxRequest) String ¶
func (m *DownloadTxRequest) String() string
func (*DownloadTxRequest) Unmarshal ¶
func (m *DownloadTxRequest) Unmarshal(dAtA []byte) error
type DownloadTxResponse ¶
type DownloadTxResponse struct {
Transactions [][]byte `protobuf:"bytes,1,rep,name=transactions" json:"transactions,omitempty"`
}
func (*DownloadTxResponse) Descriptor ¶
func (*DownloadTxResponse) Descriptor() ([]byte, []int)
func (*DownloadTxResponse) GetTransactions ¶
func (m *DownloadTxResponse) GetTransactions() [][]byte
func (*DownloadTxResponse) Marshal ¶
func (m *DownloadTxResponse) Marshal() (dAtA []byte, err error)
func (*DownloadTxResponse) MarshalTo ¶
func (m *DownloadTxResponse) MarshalTo(dAtA []byte) (int, error)
func (*DownloadTxResponse) ProtoMessage ¶
func (*DownloadTxResponse) ProtoMessage()
func (*DownloadTxResponse) Reset ¶
func (m *DownloadTxResponse) Reset()
func (*DownloadTxResponse) Size ¶
func (m *DownloadTxResponse) Size() (n int)
func (*DownloadTxResponse) String ¶
func (m *DownloadTxResponse) String() string
func (*DownloadTxResponse) Unmarshal ¶
func (m *DownloadTxResponse) Unmarshal(dAtA []byte) error
type Empty ¶
type Empty struct { }
func (*Empty) Descriptor ¶
func (*Empty) ProtoMessage ¶
func (*Empty) ProtoMessage()
type Gossiper ¶
type Gossiper struct {
// contains filtered or unexported fields
}
func NewGossiper ¶
func (*Gossiper) Push ¶
func (g *Gossiper) Push(tx Transaction)
type Graph ¶
func NewGraph ¶
func NewGraph(opts ...GraphOption) *Graph
func (*Graph) AddTransaction ¶
func (g *Graph) AddTransaction(tx Transaction) error
AddTransaction adds sufficiently valid transactions with a strongly connected ancestry to the graph, and otherwise buffers incomplete transactions, or otherwise rejects invalid transactions.
func (*Graph) DepthLen ¶
GetTransactionsByDepth returns the number of transactions in graph whose depth is between [start, end].
func (*Graph) FindEligibleCritical ¶
func (g *Graph) FindEligibleCritical(difficulty byte) *Transaction
FindEligibleCritical looks through all transactions in the current round, and returns any one whose number of zero bits prefixed of its seed is >= difficulty.
func (*Graph) FindEligibleParents ¶
func (g *Graph) FindEligibleParents() []*Transaction
FindEligibleParents provides a set of transactions suited to be eligible parents. We consider eligible parents to be transactions closest to the graphs frontier by DEPTH_DIFF that have no children, such that they are leaf nodes of the graph.
func (*Graph) FindTransaction ¶
func (g *Graph) FindTransaction(id TransactionID) *Transaction
FindTransaction returns transaction with id from graph, and nil otherwise.
func (*Graph) GetTransactionsByDepth ¶
func (g *Graph) GetTransactionsByDepth(start *uint64, end *uint64) []*Transaction
GetTransactionsByDepth returns all transactions in graph whose depth is between [start, end].
func (*Graph) IncompleteLen ¶ added in v0.2.0
func (*Graph) ListTransactions ¶
func (g *Graph) ListTransactions(offset, limit uint64, sender, creator AccountID) (transactions []*Transaction)
func (*Graph) MarkTransactionAsMissing ¶
func (g *Graph) MarkTransactionAsMissing(id TransactionID, depth uint64)
MarkTransactionAsMissing marks a transaction at some given depth to be missing.
func (*Graph) Missing ¶
func (g *Graph) Missing() []TransactionID
func (*Graph) MissingLen ¶
MissingLen returns the number of known missing transactions of the graph.
func (*Graph) PruneBelowDepth ¶
PruneBelowDepth prunes all transactions and their indices that has a depth equal to or less than targetDepth.
func (*Graph) UpdateRoot ¶
func (g *Graph) UpdateRoot(root Transaction)
UpdateRoot forcefully adds a root transaction to the graph, and updates all relevant graph indices as a result of setting a new root with its new depth.
func (*Graph) UpdateRootDepth ¶
UpdateRootDepth updates the root depth of the graph to disallow new transactions from being added to the graph whose depth is less than root depth by at most DEPTH_DIFF. It additionally clears away any missing transactions that are at a depth below the root depth by more than DEPTH_DIFF.
type GraphOption ¶
type GraphOption func(*Graph)
func VerifySignatures ¶
func VerifySignatures() GraphOption
func WithIndexer ¶ added in v0.1.0
func WithIndexer(indexer *Indexer) GraphOption
func WithMetrics ¶
func WithMetrics(metrics *Metrics) GraphOption
func WithRoot ¶
func WithRoot(root Transaction) GraphOption
type Identifiable ¶ added in v0.2.0
type Identifiable interface {
GetID() string
}
type Indexer ¶ added in v0.1.0
type Indexer struct {
*radix.Tree
}
Indexer indexes all transaction IDs into a single trie for the purposes of suiting the needs of implementing autocomplete related components.
func NewIndexer ¶ added in v0.1.0
func NewIndexer() *Indexer
NewIndexer instantiates trie indices for indexing complete transactions by their ID.
func (*Indexer) Find ¶ added in v0.1.0
Find searches through complete transaction indices for a specified query string. All indices that queried are in the form of tries.
type Ledger ¶
type Ledger struct {
// contains filtered or unexported fields
}
func (*Ledger) AddTransaction ¶
func (l *Ledger) AddTransaction(tx Transaction) error
AddTransaction adds a transaction to the ledger. If the transaction has never been added in the ledgers graph before, it is pushed to the gossip mechanism to then be gossiped to this nodes peers. If the transaction is invalid or fails any validation checks, an error is returned. No error is returned if the transaction has already existed int he ledgers graph beforehand.
func (*Ledger) BroadcastNop ¶
func (l *Ledger) BroadcastNop() *Transaction
BroadcastNop has the node send a nop transaction should they have sufficient balance available. They are broadcasted if no other transaction that is not a nop transaction is not broadcasted by the node after 500 milliseconds. These conditions only apply so long as at least one transaction gets broadcasted by the node within the current round. Once a round is tentatively being finalized, a node will stop broadcasting nops.
func (*Ledger) BroadcastingNop ¶ added in v0.1.1
BroadcastingNop returns true if the node is supposed to broadcast nop transaction.
func (*Ledger) Close ¶ added in v0.2.0
func (l *Ledger) Close()
Close stops all goroutines and waits for them to complete.
func (*Ledger) FinalizeRounds ¶
func (l *Ledger) FinalizeRounds()
FinalizeRounds periodically attempts to find an eligible critical transaction suited for the current round. If it finds one, it will then proceed to perform snowball sampling over its peers to decide on a single critical transaction that serves as an ending point for the current consensus round. The round is finalized, transactions of the finalized round are applied to the current ledger state, and the graph is updated to cleanup artifacts from the old round.
func (*Ledger) Finalizer ¶
Finalizer returns the Snowball finalizer which finalizes the contents of individual consensus rounds.
func (*Ledger) Find ¶ added in v0.1.0
Find searches through complete transaction and account indices for a specified query string. All indices that queried are in the form of tries. It is safe to call this method concurrently.
func (*Ledger) Graph ¶
Graph returns the directed-acyclic-graph of transactions accompanying the ledger.
func (*Ledger) LogChanges ¶
LogChanges logs all changes made to an AVL tree state snapshot for the purposes of logging out changes to account state to Wavelet's HTTP API.
func (*Ledger) PerformConsensus ¶
func (l *Ledger) PerformConsensus()
PerformConsensus spawns workers related to performing consensus, such as pulling missing transactions and incrementally finalizing intervals of transactions in the ledgers graph.
func (*Ledger) Protocol ¶
Protocol returns an implementation of WaveletServer to handle incoming RPC and streams for the ledger. The protocol is agnostic to whatever choice of network stack is used with Wavelet, though by default it is intended to be used with gRPC and Noise.
func (*Ledger) PullMissingTransactions ¶
func (l *Ledger) PullMissingTransactions()
PullMissingTransactions is an infinite loop continually sending RPC requests to pull any transactions identified to be missing by the ledger. It periodically samples a random peer from the network, and requests the peer for the contents of all missing transactions by their respective IDs. When the ledger is in amidst synchronizing/teleporting ahead to a new round, the infinite loop will be cleaned up. It is intended to call PullMissingTransactions() in a new goroutine.
func (*Ledger) PushSendQuota ¶ added in v0.1.0
func (l *Ledger) PushSendQuota()
PushSendQuota permits one token into this nodes send quota bucket every millisecond such that the node may add one single transaction into its graph.
func (*Ledger) Restart ¶ added in v0.2.0
Restart restart wavelet process by means of stall detector (approach is platform dependent)
func (*Ledger) SyncStatus ¶ added in v0.2.0
func (*Ledger) SyncToLatestRound ¶
func (l *Ledger) SyncToLatestRound()
func (*Ledger) SyncTransactions ¶ added in v0.2.0
func (l *Ledger) SyncTransactions()
func (*Ledger) TakeSendQuota ¶ added in v0.1.0
TakeSendQuota removes one token from this nodes send quota bucket to signal that the node has added one single transaction into its graph.
type MerkleNodeID ¶
type MerkleNodeID = [SizeMerkleNodeID]byte
type Option ¶ added in v0.1.1
type Option func(cfg *config)
func WithGenesis ¶ added in v0.1.1
func WithMaxMemoryMB ¶ added in v0.2.0
type OutOfSyncRequest ¶
type OutOfSyncRequest struct {
RoundIndex uint64 `protobuf:"varint,1,opt,name=round_index,json=roundIndex,proto3" json:"round_index,omitempty"`
}
func (*OutOfSyncRequest) Descriptor ¶
func (*OutOfSyncRequest) Descriptor() ([]byte, []int)
func (*OutOfSyncRequest) GetRoundIndex ¶ added in v0.2.0
func (m *OutOfSyncRequest) GetRoundIndex() uint64
func (*OutOfSyncRequest) Marshal ¶
func (m *OutOfSyncRequest) Marshal() (dAtA []byte, err error)
func (*OutOfSyncRequest) ProtoMessage ¶
func (*OutOfSyncRequest) ProtoMessage()
func (*OutOfSyncRequest) Reset ¶
func (m *OutOfSyncRequest) Reset()
func (*OutOfSyncRequest) Size ¶
func (m *OutOfSyncRequest) Size() (n int)
func (*OutOfSyncRequest) String ¶
func (m *OutOfSyncRequest) String() string
func (*OutOfSyncRequest) Unmarshal ¶
func (m *OutOfSyncRequest) Unmarshal(dAtA []byte) error
type OutOfSyncResponse ¶
type OutOfSyncResponse struct {
OutOfSync bool `protobuf:"varint,1,opt,name=out_of_sync,json=outOfSync,proto3" json:"out_of_sync,omitempty"`
}
func (*OutOfSyncResponse) Descriptor ¶
func (*OutOfSyncResponse) Descriptor() ([]byte, []int)
func (*OutOfSyncResponse) GetOutOfSync ¶ added in v0.2.0
func (m *OutOfSyncResponse) GetOutOfSync() bool
func (*OutOfSyncResponse) Marshal ¶
func (m *OutOfSyncResponse) Marshal() (dAtA []byte, err error)
func (*OutOfSyncResponse) MarshalTo ¶
func (m *OutOfSyncResponse) MarshalTo(dAtA []byte) (int, error)
func (*OutOfSyncResponse) ProtoMessage ¶
func (*OutOfSyncResponse) ProtoMessage()
func (*OutOfSyncResponse) Reset ¶
func (m *OutOfSyncResponse) Reset()
func (*OutOfSyncResponse) Size ¶
func (m *OutOfSyncResponse) Size() (n int)
func (*OutOfSyncResponse) String ¶
func (m *OutOfSyncResponse) String() string
func (*OutOfSyncResponse) Unmarshal ¶
func (m *OutOfSyncResponse) Unmarshal(dAtA []byte) error
type Protocol ¶
type Protocol struct {
// contains filtered or unexported fields
}
func (*Protocol) CheckOutOfSync ¶
func (p *Protocol) CheckOutOfSync(ctx context.Context, req *OutOfSyncRequest) (*OutOfSyncResponse, error)
func (*Protocol) DownloadMissingTx ¶ added in v0.2.0
func (p *Protocol) DownloadMissingTx(ctx context.Context, req *DownloadMissingTxRequest) (*DownloadTxResponse, error)
func (*Protocol) DownloadTx ¶
func (p *Protocol) DownloadTx(ctx context.Context, req *DownloadTxRequest) (*DownloadTxResponse, error)
func (*Protocol) Gossip ¶
func (p *Protocol) Gossip(stream Wavelet_GossipServer) error
func (*Protocol) Query ¶
func (p *Protocol) Query(ctx context.Context, req *QueryRequest) (*QueryResponse, error)
func (*Protocol) Sync ¶
func (p *Protocol) Sync(stream Wavelet_SyncServer) error
type QueryRequest ¶
type QueryRequest struct {
RoundIndex uint64 `protobuf:"varint,1,opt,name=round_index,json=roundIndex,proto3" json:"round_index,omitempty"`
}
func (*QueryRequest) Descriptor ¶
func (*QueryRequest) Descriptor() ([]byte, []int)
func (*QueryRequest) GetRoundIndex ¶
func (m *QueryRequest) GetRoundIndex() uint64
func (*QueryRequest) Marshal ¶
func (m *QueryRequest) Marshal() (dAtA []byte, err error)
func (*QueryRequest) ProtoMessage ¶
func (*QueryRequest) ProtoMessage()
func (*QueryRequest) Reset ¶
func (m *QueryRequest) Reset()
func (*QueryRequest) Size ¶
func (m *QueryRequest) Size() (n int)
func (*QueryRequest) String ¶
func (m *QueryRequest) String() string
func (*QueryRequest) Unmarshal ¶
func (m *QueryRequest) Unmarshal(dAtA []byte) error
type QueryResponse ¶
type QueryResponse struct {
Round []byte `protobuf:"bytes,1,opt,name=round,proto3" json:"round,omitempty"`
}
func (*QueryResponse) Descriptor ¶
func (*QueryResponse) Descriptor() ([]byte, []int)
func (*QueryResponse) GetRound ¶
func (m *QueryResponse) GetRound() []byte
func (*QueryResponse) Marshal ¶
func (m *QueryResponse) Marshal() (dAtA []byte, err error)
func (*QueryResponse) ProtoMessage ¶
func (*QueryResponse) ProtoMessage()
func (*QueryResponse) Reset ¶
func (m *QueryResponse) Reset()
func (*QueryResponse) Size ¶
func (m *QueryResponse) Size() (n int)
func (*QueryResponse) String ¶
func (m *QueryResponse) String() string
func (*QueryResponse) Unmarshal ¶
func (m *QueryResponse) Unmarshal(dAtA []byte) error
type RewardWithdrawalRequest ¶
type RewardWithdrawalRequest struct {
// contains filtered or unexported fields
}
func GetRewardWithdrawalRequests ¶
func GetRewardWithdrawalRequests(tree *avl.Tree, roundLimit uint64) []RewardWithdrawalRequest
func UnmarshalRewardWithdrawalRequest ¶
func UnmarshalRewardWithdrawalRequest(r io.Reader) (RewardWithdrawalRequest, error)
func (RewardWithdrawalRequest) Key ¶
func (rw RewardWithdrawalRequest) Key() []byte
func (RewardWithdrawalRequest) Marshal ¶
func (rw RewardWithdrawalRequest) Marshal() []byte
type Round ¶
type Round struct { ID RoundID Index uint64 Merkle MerkleNodeID Transactions uint32 Start Transaction End Transaction }
Round represents a network-wide finalized non-overlapping graph depth interval that is denoted by both a critical starting point transaction, and a critical ending point transaction. They contain the expected Merkle root of the ledgers state. They are denoted by either their index or ID, which is the checksum of applying BLAKE2b over its contents.
func NewRound ¶
func NewRound(index uint64, merkle MerkleNodeID, transactions uint32, start, end Transaction) Round
type RoundID ¶
type RoundID = [SizeRoundID]byte
type Signature ¶
type Signature = [SizeSignature]byte
type Snowball ¶
func NewSnowball ¶
func NewSnowball(opts ...SnowballOption) *Snowball
func (*Snowball) Prefer ¶
func (s *Snowball) Prefer(v Identifiable)
func (*Snowball) Preferred ¶
func (s *Snowball) Preferred() Identifiable
func (*Snowball) Tick ¶
func (s *Snowball) Tick(v Identifiable)
type SnowballOption ¶
type SnowballOption func(*Snowball)
func WithName ¶ added in v0.1.0
func WithName(name string) SnowballOption
type Stake ¶
func ParseStake ¶ added in v0.1.0
ParseStake parses and performs sanity checks on the payload of a stake transaction.
type StallDetector ¶ added in v0.2.0
type StallDetector struct {
// contains filtered or unexported fields
}
func NewStallDetector ¶ added in v0.2.0
func NewStallDetector(stop <-chan struct{}, config StallDetectorConfig, delegate StallDetectorDelegate) *StallDetector
func (*StallDetector) Run ¶ added in v0.2.0
func (d *StallDetector) Run(wg *sync.WaitGroup)
type StallDetectorConfig ¶ added in v0.2.0
type StallDetectorConfig struct {
MaxMemoryMB uint64
}
type StallDetectorDelegate ¶ added in v0.2.0
type StallDetectorDelegate struct {
PrepareShutdown func(error)
}
type SyncInfo ¶
type SyncInfo struct { LatestRound []byte `protobuf:"bytes,1,opt,name=latest_round,json=latestRound,proto3" json:"latest_round,omitempty"` Checksums [][]byte `protobuf:"bytes,2,rep,name=checksums" json:"checksums,omitempty"` }
func (*SyncInfo) Descriptor ¶
func (*SyncInfo) GetChecksums ¶
func (*SyncInfo) GetLatestRound ¶
func (*SyncInfo) ProtoMessage ¶
func (*SyncInfo) ProtoMessage()
type SyncRequest ¶
type SyncRequest struct { // Types that are valid to be assigned to Data: // *SyncRequest_RoundId // *SyncRequest_Checksum Data isSyncRequest_Data `protobuf_oneof:"Data"` }
func (*SyncRequest) Descriptor ¶
func (*SyncRequest) Descriptor() ([]byte, []int)
func (*SyncRequest) GetChecksum ¶
func (m *SyncRequest) GetChecksum() []byte
func (*SyncRequest) GetData ¶
func (m *SyncRequest) GetData() isSyncRequest_Data
func (*SyncRequest) GetRoundId ¶
func (m *SyncRequest) GetRoundId() uint64
func (*SyncRequest) Marshal ¶
func (m *SyncRequest) Marshal() (dAtA []byte, err error)
func (*SyncRequest) ProtoMessage ¶
func (*SyncRequest) ProtoMessage()
func (*SyncRequest) Reset ¶
func (m *SyncRequest) Reset()
func (*SyncRequest) Size ¶
func (m *SyncRequest) Size() (n int)
func (*SyncRequest) String ¶
func (m *SyncRequest) String() string
func (*SyncRequest) Unmarshal ¶
func (m *SyncRequest) Unmarshal(dAtA []byte) error
func (*SyncRequest) XXX_OneofFuncs ¶
func (*SyncRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})
XXX_OneofFuncs is for the internal use of the proto package.
type SyncRequest_Checksum ¶
type SyncRequest_Checksum struct {
Checksum []byte `protobuf:"bytes,2,opt,name=checksum,proto3,oneof"`
}
func (*SyncRequest_Checksum) MarshalTo ¶
func (m *SyncRequest_Checksum) MarshalTo(dAtA []byte) (int, error)
func (*SyncRequest_Checksum) Size ¶
func (m *SyncRequest_Checksum) Size() (n int)
type SyncRequest_RoundId ¶
type SyncRequest_RoundId struct {
RoundId uint64 `protobuf:"varint,1,opt,name=round_id,json=roundId,proto3,oneof"`
}
func (*SyncRequest_RoundId) MarshalTo ¶
func (m *SyncRequest_RoundId) MarshalTo(dAtA []byte) (int, error)
func (*SyncRequest_RoundId) Size ¶
func (m *SyncRequest_RoundId) Size() (n int)
type SyncResponse ¶
type SyncResponse struct { // Types that are valid to be assigned to Data: // *SyncResponse_Header // *SyncResponse_Chunk Data isSyncResponse_Data `protobuf_oneof:"Data"` }
func (*SyncResponse) Descriptor ¶
func (*SyncResponse) Descriptor() ([]byte, []int)
func (*SyncResponse) GetChunk ¶
func (m *SyncResponse) GetChunk() []byte
func (*SyncResponse) GetData ¶
func (m *SyncResponse) GetData() isSyncResponse_Data
func (*SyncResponse) GetHeader ¶
func (m *SyncResponse) GetHeader() *SyncInfo
func (*SyncResponse) Marshal ¶
func (m *SyncResponse) Marshal() (dAtA []byte, err error)
func (*SyncResponse) ProtoMessage ¶
func (*SyncResponse) ProtoMessage()
func (*SyncResponse) Reset ¶
func (m *SyncResponse) Reset()
func (*SyncResponse) Size ¶
func (m *SyncResponse) Size() (n int)
func (*SyncResponse) String ¶
func (m *SyncResponse) String() string
func (*SyncResponse) Unmarshal ¶
func (m *SyncResponse) Unmarshal(dAtA []byte) error
func (*SyncResponse) XXX_OneofFuncs ¶
func (*SyncResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{})
XXX_OneofFuncs is for the internal use of the proto package.
type SyncResponse_Chunk ¶
type SyncResponse_Chunk struct {
Chunk []byte `protobuf:"bytes,2,opt,name=chunk,proto3,oneof"`
}
func (*SyncResponse_Chunk) MarshalTo ¶
func (m *SyncResponse_Chunk) MarshalTo(dAtA []byte) (int, error)
func (*SyncResponse_Chunk) Size ¶
func (m *SyncResponse_Chunk) Size() (n int)
type SyncResponse_Header ¶
type SyncResponse_Header struct {
Header *SyncInfo `protobuf:"bytes,1,opt,name=header,oneof"`
}
func (*SyncResponse_Header) MarshalTo ¶
func (m *SyncResponse_Header) MarshalTo(dAtA []byte) (int, error)
func (*SyncResponse_Header) Size ¶
func (m *SyncResponse_Header) Size() (n int)
type TestLedger ¶ added in v0.1.1
type TestLedger struct {
// contains filtered or unexported fields
}
func NewTestLedger ¶ added in v0.1.1
func NewTestLedger(t testing.TB, cfg TestLedgerConfig) *TestLedger
func (*TestLedger) Addr ¶ added in v0.1.1
func (l *TestLedger) Addr() string
func (*TestLedger) Applied ¶ added in v0.1.1
func (l *TestLedger) Applied(tx Transaction) bool
func (*TestLedger) Balance ¶ added in v0.1.1
func (l *TestLedger) Balance() uint64
func (*TestLedger) BalanceOfAccount ¶ added in v0.1.1
func (l *TestLedger) BalanceOfAccount(node *TestLedger) uint64
func (*TestLedger) BalanceWithPublicKey ¶ added in v0.2.0
func (l *TestLedger) BalanceWithPublicKey(key AccountID) uint64
func (*TestLedger) Benchmark ¶ added in v0.2.0
func (l *TestLedger) Benchmark(batchSize int) (Transaction, error)
func (*TestLedger) CallContract ¶ added in v0.2.0
func (l *TestLedger) CallContract(id [32]byte, amount uint64, gasLimit uint64, funcName string, params []byte) (Transaction, error)
func (*TestLedger) Cleanup ¶ added in v0.1.1
func (l *TestLedger) Cleanup()
func (*TestLedger) Client ¶ added in v0.2.0
func (l *TestLedger) Client() *skademlia.Client
func (*TestLedger) DBPath ¶ added in v0.2.0
func (l *TestLedger) DBPath() string
func (*TestLedger) DepositGas ¶ added in v0.2.0
func (l *TestLedger) DepositGas(id [32]byte, gasDeposit uint64) (Transaction, error)
func (*TestLedger) FindTransaction ¶ added in v0.1.1
func (l *TestLedger) FindTransaction(t testing.TB, id TransactionID) *Transaction
func (*TestLedger) GasBalanceOfAddress ¶ added in v0.2.0
func (l *TestLedger) GasBalanceOfAddress(address [32]byte) uint64
func (*TestLedger) Leave ¶ added in v0.2.0
func (l *TestLedger) Leave()
func (*TestLedger) Ledger ¶ added in v0.2.0
func (l *TestLedger) Ledger() *Ledger
func (*TestLedger) Nop ¶ added in v0.1.1
func (l *TestLedger) Nop() (Transaction, error)
func (*TestLedger) Pay ¶ added in v0.1.1
func (l *TestLedger) Pay(to *TestLedger, amount uint64) (Transaction, error)
func (*TestLedger) PlaceStake ¶ added in v0.1.1
func (l *TestLedger) PlaceStake(amount uint64) (Transaction, error)
func (*TestLedger) PrivateKey ¶ added in v0.2.0
func (l *TestLedger) PrivateKey() edwards25519.PrivateKey
func (*TestLedger) PublicKey ¶ added in v0.1.1
func (l *TestLedger) PublicKey() AccountID
func (*TestLedger) Reward ¶ added in v0.1.1
func (l *TestLedger) Reward() uint64
func (*TestLedger) RewardWithPublicKey ¶ added in v0.2.0
func (l *TestLedger) RewardWithPublicKey(key AccountID) uint64
func (*TestLedger) RoundIndex ¶ added in v0.2.0
func (l *TestLedger) RoundIndex() uint64
func (*TestLedger) SpawnContract ¶ added in v0.2.0
func (l *TestLedger) SpawnContract(contractPath string, gasLimit uint64, params []byte) (Transaction, error)
func (*TestLedger) Stake ¶ added in v0.1.1
func (l *TestLedger) Stake() uint64
func (*TestLedger) StakeOfAccount ¶ added in v0.1.1
func (l *TestLedger) StakeOfAccount(node *TestLedger) uint64
func (*TestLedger) StakeWithPublicKey ¶ added in v0.2.0
func (l *TestLedger) StakeWithPublicKey(key AccountID) uint64
func (*TestLedger) WaitForConsensus ¶ added in v0.1.1
func (l *TestLedger) WaitForConsensus() <-chan bool
func (*TestLedger) WaitForRound ¶ added in v0.2.0
func (l *TestLedger) WaitForRound(index uint64) <-chan uint64
func (*TestLedger) WaitForSync ¶ added in v0.2.0
func (l *TestLedger) WaitForSync() <-chan bool
func (*TestLedger) WaitUntilBalance ¶ added in v0.2.0
func (l *TestLedger) WaitUntilBalance(t testing.TB, balance uint64)
WaitUntilBalance should be used to ensure that the ledger's balance is of a specific value before continuing.
func (*TestLedger) WaitUntilConsensus ¶ added in v0.2.0
func (l *TestLedger) WaitUntilConsensus(t testing.TB)
func (*TestLedger) WaitUntilRound ¶ added in v0.2.0
func (l *TestLedger) WaitUntilRound(t testing.TB, round uint64)
func (*TestLedger) WaitUntilStake ¶ added in v0.2.0
func (l *TestLedger) WaitUntilStake(t testing.TB, stake uint64)
func (*TestLedger) WithdrawReward ¶ added in v0.1.1
func (l *TestLedger) WithdrawReward(amount uint64) (Transaction, error)
func (*TestLedger) WithdrawStake ¶ added in v0.1.1
func (l *TestLedger) WithdrawStake(amount uint64) (Transaction, error)
type TestLedgerConfig ¶ added in v0.1.1
type TestLedgerOption ¶ added in v0.2.0
type TestLedgerOption func(cfg *TestLedgerConfig)
func WithDBPath ¶ added in v0.2.0
func WithDBPath(path string) TestLedgerOption
func WithKeepExistingDB ¶ added in v0.2.0
func WithKeepExistingDB() TestLedgerOption
func WithPeers ¶ added in v0.2.0
func WithPeers(peers ...string) TestLedgerOption
func WithWallet ¶ added in v0.2.0
func WithWallet(wallet string) TestLedgerOption
type TestNetwork ¶ added in v0.1.1
type TestNetwork struct {
// contains filtered or unexported fields
}
func NewTestNetwork ¶ added in v0.1.1
func NewTestNetwork(t testing.TB, opts ...TestNetworkOption) *TestNetwork
func (*TestNetwork) AddNode ¶ added in v0.1.1
func (n *TestNetwork) AddNode(t testing.TB, opts ...TestLedgerOption) *TestLedger
func (*TestNetwork) Cleanup ¶ added in v0.1.1
func (n *TestNetwork) Cleanup()
func (*TestNetwork) Faucet ¶ added in v0.2.0
func (n *TestNetwork) Faucet() *TestLedger
func (*TestNetwork) Nodes ¶ added in v0.2.0
func (n *TestNetwork) Nodes() []*TestLedger
func (*TestNetwork) SetFaucet ¶ added in v0.2.0
func (n *TestNetwork) SetFaucet(node *TestLedger)
func (*TestNetwork) WaitForConsensus ¶ added in v0.1.1
func (n *TestNetwork) WaitForConsensus(t testing.TB)
func (*TestNetwork) WaitForRound ¶ added in v0.2.0
func (n *TestNetwork) WaitForRound(t testing.TB, round uint64)
WaitForRound waits for all the nodes in the network to reach the specified round.
func (*TestNetwork) WaitForSync ¶ added in v0.2.0
func (n *TestNetwork) WaitForSync(t testing.TB)
type TestNetworkConfig ¶ added in v0.2.0
type TestNetworkConfig struct {
AddFaucet bool
}
type TestNetworkOption ¶ added in v0.2.0
type TestNetworkOption func(cfg *TestNetworkConfig)
func WithoutFaucet ¶ added in v0.2.0
func WithoutFaucet() TestNetworkOption
type Transaction ¶
type Transaction struct { Sender AccountID // Transaction sender. Creator AccountID // Transaction creator. Nonce uint64 ParentIDs []TransactionID // Transactions parents. ParentSeeds []TransactionSeed Depth uint64 // Graph depth. Tag sys.Tag Payload []byte SenderSignature Signature CreatorSignature Signature ID TransactionID // BLAKE2b(*). Seed TransactionSeed // BLAKE2b(Sender || ParentIDs) SeedLen byte // Number of prefixed zeroes of BLAKE2b(Sender || ParentIDs). }
func AttachSenderToTransaction ¶
func AttachSenderToTransaction(sender *skademlia.Keypair, tx Transaction, parents ...*Transaction) Transaction
AttachSenderToTransaction immutably attaches sender to a transaction without modifying it in-place.
func NewTransaction ¶
func UnmarshalTransaction ¶
func UnmarshalTransaction(r io.Reader) (t Transaction, err error)
func (Transaction) ComputeSize ¶ added in v0.2.0
func (tx Transaction) ComputeSize() int
func (Transaction) Fee ¶ added in v0.2.0
func (tx Transaction) Fee() uint64
func (Transaction) IsCritical ¶
func (tx Transaction) IsCritical(difficulty byte) bool
func (Transaction) LogicalUnits ¶
func (tx Transaction) LogicalUnits() int
LogicalUnits counts the total number of atomic logical units of changes the specified tx comprises of.
func (Transaction) Marshal ¶
func (tx Transaction) Marshal() []byte
func (Transaction) String ¶
func (tx Transaction) String() string
type TransactionID ¶
type TransactionID = [SizeTransactionID]byte
type TransactionSeed ¶ added in v0.1.0
type TransactionSeed = [SizeTransactionSeed]byte
type Transactions ¶
type Transactions struct {
Transactions [][]byte `protobuf:"bytes,1,rep,name=transactions" json:"transactions,omitempty"`
}
func (*Transactions) Descriptor ¶
func (*Transactions) Descriptor() ([]byte, []int)
func (*Transactions) GetTransactions ¶
func (m *Transactions) GetTransactions() [][]byte
func (*Transactions) Marshal ¶
func (m *Transactions) Marshal() (dAtA []byte, err error)
func (*Transactions) ProtoMessage ¶
func (*Transactions) ProtoMessage()
func (*Transactions) Reset ¶
func (m *Transactions) Reset()
func (*Transactions) Size ¶
func (m *Transactions) Size() (n int)
func (*Transactions) String ¶
func (m *Transactions) String() string
func (*Transactions) Unmarshal ¶
func (m *Transactions) Unmarshal(dAtA []byte) error
type Transfer ¶
type Transfer struct { Recipient AccountID Amount uint64 GasLimit uint64 GasDeposit uint64 FuncName []byte FuncParams []byte }
func ParseTransfer ¶ added in v0.1.0
ParseTransfer parses and performs sanity checks on the payload of a transfer transaction.
type VMState ¶ added in v0.2.0
func SnapshotVMState ¶ added in v0.2.0
func SnapshotVMState(vm *exec.VirtualMachine) VMState
func (VMState) Apply ¶ added in v0.2.0
func (state VMState) Apply(vm *exec.VirtualMachine, gasPolicy compiler.GasPolicy, importResolver exec.ImportResolver, move bool) (*exec.VirtualMachine, error)
type WaveletClient ¶
type WaveletClient interface { Gossip(ctx context.Context, opts ...grpc.CallOption) (Wavelet_GossipClient, error) Query(ctx context.Context, in *QueryRequest, opts ...grpc.CallOption) (*QueryResponse, error) CheckOutOfSync(ctx context.Context, in *OutOfSyncRequest, opts ...grpc.CallOption) (*OutOfSyncResponse, error) Sync(ctx context.Context, opts ...grpc.CallOption) (Wavelet_SyncClient, error) DownloadTx(ctx context.Context, in *DownloadTxRequest, opts ...grpc.CallOption) (*DownloadTxResponse, error) DownloadMissingTx(ctx context.Context, in *DownloadMissingTxRequest, opts ...grpc.CallOption) (*DownloadTxResponse, error) }
func NewWaveletClient ¶
func NewWaveletClient(cc *grpc.ClientConn) WaveletClient
type WaveletServer ¶
type WaveletServer interface { Gossip(Wavelet_GossipServer) error Query(context.Context, *QueryRequest) (*QueryResponse, error) CheckOutOfSync(context.Context, *OutOfSyncRequest) (*OutOfSyncResponse, error) Sync(Wavelet_SyncServer) error DownloadTx(context.Context, *DownloadTxRequest) (*DownloadTxResponse, error) DownloadMissingTx(context.Context, *DownloadMissingTxRequest) (*DownloadTxResponse, error) }
type Wavelet_GossipClient ¶
type Wavelet_GossipClient interface { Send(*Transactions) error CloseAndRecv() (*Empty, error) grpc.ClientStream }
type Wavelet_GossipServer ¶
type Wavelet_GossipServer interface { SendAndClose(*Empty) error Recv() (*Transactions, error) grpc.ServerStream }
type Wavelet_SyncClient ¶
type Wavelet_SyncClient interface { Send(*SyncRequest) error Recv() (*SyncResponse, error) grpc.ClientStream }
type Wavelet_SyncServer ¶
type Wavelet_SyncServer interface { Send(*SyncResponse) error Recv() (*SyncRequest, error) grpc.ServerStream }