package viewchange
import "go.dedis.ch/dela/core/ordering/cosipbft/contracts/viewchange"
Package viewchange implements a native smart contract to update the roster of a chain.
Documentation Last Review: 08.10.2020
Index ¶
- Constants
- func GetRosterKey() []byte
- func NewCreds() access.Credential
- func RegisterContract(exec *native.Service, c Contract)
- type Contract
- func NewContract(rFac authority.Factory, srvc access.Service) Contract
- func (c Contract) Execute(snap store.Snapshot, step execution.Step) error
- func (c Contract) UID() string
- type Manager
Constants ¶
const ( // ContractUID is the unique (4-bytes) identifier of the contract, it is // used to prefix keys in the K/V store and by DARCs for access control. ContractUID = "COSI" // ContractName is the name of the contract. ContractName = "go.dedis.ch/dela.ViewChange" // AuthorityArg is the key of the argument for the new authority. AuthorityArg = "viewchange:authority" )
Functions ¶
func GetRosterKey ¶
func GetRosterKey() []byte
GetRosterKey returns the key used to store the roster in the K/V storage. It is formatted like ContractUID + roster key.
func NewCreds ¶
func NewCreds() access.Credential
NewCreds creates new credentials for a view change contract execution.
func RegisterContract ¶
RegisterContract registers the view change contract to the given execution service.
Types ¶
type Contract ¶
type Contract struct {
// contains filtered or unexported fields
}
Contract is a contract to update the roster at a given key in the storage. It only allows one member change per transaction.
- implements native.Contract
func NewContract ¶
NewContract creates a new viewchange contract.
func (Contract) Execute ¶
Execute implements native.Contract. It looks for the roster in the transaction and updates the storage if there is at most one membership change.
func (Contract) UID ¶
UID returns the unique 4-bytes contract identifier.
- implements native.Contract
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is an extension of a normal transaction manager to help creating view change ones.
func NewManager ¶
NewManager returns a view change manager from the transaction manager.
func (Manager) Make ¶
Make creates a new transaction using the provided manager. It contains the new roster that the transaction should apply.
Source Files ¶
viewchange.go
- Version
- v0.1.0 (latest)
- Published
- Apr 10, 2024
- Platform
- linux/amd64
- Imports
- 10 packages
- Last checked
- 1 month ago –
Tools for package owners.