viewchange

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: BSD-3-Clause Imports: 10 Imported by: 1

Documentation

Overview

Package viewchange implements a native smart contract to update the roster of a chain.

Documentation Last Review: 08.10.2020

Index

Constants

View Source
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"
)

Variables

This section is empty.

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

func RegisterContract(exec *native.Service, c Contract)

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

func NewContract(rFac authority.Factory, srvc access.Service) Contract

NewContract creates a new viewchange contract.

func (Contract) Execute

func (c Contract) Execute(snap store.Snapshot, step execution.Step) error

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

func (c Contract) UID() string

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

func NewManager(mgr txn.Manager) Manager

NewManager returns a view change manager from the transaction manager.

func (Manager) Make

func (mgr Manager) Make(roster authority.Authority) (txn.Transaction, error)

Make creates a new transaction using the provided manager. It contains the new roster that the transaction should apply.

Jump to

Keyboard shortcuts

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