validator

package
v0.0.0-...-8c7b936 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Addr_Length    uint8  = 4
	Data_Length    uint8  = 4
	Process_Length uint32 = 2000
)
View Source
const (
	Type_Num                      uint8 = 7
	IntraShard_TX                 uint8 = 0
	InterShard_TX_Verify          uint8 = 1
	InterShard_TX_Execute         uint8 = 2
	InterShard_TX_Commit_sender   uint8 = 3
	InterShard_TX_Commit_receiver uint8 = 4
	InterShard_TX_Update_sender   uint8 = 5
	InterShard_TX_Update_receiver uint8 = 6
)

Variables

This section is empty.

Functions

func Deserilization

func Deserilization(tx TransactionType) (uint32, []byte)

Types

type BlockchainState

type BlockchainState struct {
	Database dbm.DB
	Size     int64
	Height   int64
	AppHash  []byte
}

func NewBlockchainState

func NewBlockchainState(name string, dir string) *BlockchainState

type ShardCrosslinkMsg

type ShardCrosslinkMsg struct {
	CL *aq.Queue // queue used to store CrossLink
}

type TransactionType

type TransactionType struct {
	From_shard uint8 // the sender's shard
	To_shard   uint8 // the receiver's shard
	Tx_type    uint8
	From       []byte
	To         []byte
	Value      uint32
	Data       []byte
	Nonce      uint32 // TODO: enable contineous tx requests by setting vary nonce
	TX_id      uint32
}

func ResolveTx

func ResolveTx(_tx []byte) (uint32, TransactionType)

func Serilization

func Serilization(tx []byte) (uint32, TransactionType)

type ValidatorInterface

type ValidatorInterface struct {
	BCState *BlockchainState

	Shard_id uint8
	Leader   bool

	Tx_set       [Process_Length]uint8
	Byzantine    uint8 // 0: honest; 1: byzantine
	Attack_shard uint8 // the attacker's shard
	Node_id      uint8 // used to construct different front-running tx
	// contains filtered or unexported fields
}

func NewValidatorInterface

func NewValidatorInterface(bcstate *BlockchainState, shard_num uint8, shard_id uint8, leader bool, in_addr hctypes.HaechiAddress, out_addrs []hctypes.HaechiAddress, attacks ...uint8) *ValidatorInterface

func (*ValidatorInterface) DeliverAttackTx

func (nw *ValidatorInterface) DeliverAttackTx(tx []byte, shardid uint8)

func (*ValidatorInterface) DeliverCommitTx

func (nw *ValidatorInterface) DeliverCommitTx(tx []byte)

func (*ValidatorInterface) DeliverExecutionTx

func (nw *ValidatorInterface) DeliverExecutionTx(tx []byte, shardid uint8)

Jump to

Keyboard shortcuts

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