nodegraph

package
v0.7.4-0...-66d0465 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2021 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxAssertionSize = 120
)

Variables

View Source
var File_nodegraph_proto protoreflect.FileDescriptor
View Source
var ZeroBytes32 common.Hash // deliberately zeroed

Functions

Types

type Challenge

type Challenge struct {
	// contains filtered or unexported fields
}

func NewChallenge

func NewChallenge(
	blockId *common.BlockId,
	logIndex uint,
	asserter common.Address,
	challenger common.Address,
	contract common.Address,
	conflictNode *structures.Node,
) *Challenge

func NewChallengeFromEvent

func NewChallengeFromEvent(event arbbridge.ChallengeStartedEvent, challengerAncestor *structures.Node) *Challenge

func (*Challenge) Asserter

func (c *Challenge) Asserter() common.Address

func (*Challenge) BlockId

func (c *Challenge) BlockId() *common.BlockId

func (*Challenge) Challenger

func (c *Challenge) Challenger() common.Address

func (*Challenge) ConflictNode

func (c *Challenge) ConflictNode() *structures.Node

func (*Challenge) Contract

func (c *Challenge) Contract() common.Address

func (*Challenge) Equals

func (c *Challenge) Equals(s2 *Challenge) bool

func (*Challenge) LogIndex

func (c *Challenge) LogIndex() uint

func (*Challenge) MarshalToBuf

func (c *Challenge) MarshalToBuf() *ChallengeBuf

type ChallengeBuf

type ChallengeBuf struct {
	BlockId          *common.BlockIdBuf `protobuf:"bytes,1,opt,name=blockId,proto3" json:"blockId,omitempty"`
	LogIndex         uint64             `protobuf:"varint,2,opt,name=logIndex,proto3" json:"logIndex,omitempty"`
	Asserter         *common.AddressBuf `protobuf:"bytes,3,opt,name=asserter,proto3" json:"asserter,omitempty"`
	Challenger       *common.AddressBuf `protobuf:"bytes,4,opt,name=challenger,proto3" json:"challenger,omitempty"`
	Contract         *common.AddressBuf `protobuf:"bytes,5,opt,name=contract,proto3" json:"contract,omitempty"`
	ConflictNodeHash *common.HashBuf    `protobuf:"bytes,6,opt,name=conflictNodeHash,proto3" json:"conflictNodeHash,omitempty"`
	// contains filtered or unexported fields
}

func (*ChallengeBuf) Descriptor deprecated

func (*ChallengeBuf) Descriptor() ([]byte, []int)

Deprecated: Use ChallengeBuf.ProtoReflect.Descriptor instead.

func (*ChallengeBuf) GetAsserter

func (x *ChallengeBuf) GetAsserter() *common.AddressBuf

func (*ChallengeBuf) GetBlockId

func (x *ChallengeBuf) GetBlockId() *common.BlockIdBuf

func (*ChallengeBuf) GetChallenger

func (x *ChallengeBuf) GetChallenger() *common.AddressBuf

func (*ChallengeBuf) GetConflictNodeHash

func (x *ChallengeBuf) GetConflictNodeHash() *common.HashBuf

func (*ChallengeBuf) GetContract

func (x *ChallengeBuf) GetContract() *common.AddressBuf

func (*ChallengeBuf) GetLogIndex

func (x *ChallengeBuf) GetLogIndex() uint64

func (*ChallengeBuf) ProtoMessage

func (*ChallengeBuf) ProtoMessage()

func (*ChallengeBuf) ProtoReflect

func (x *ChallengeBuf) ProtoReflect() protoreflect.Message

func (*ChallengeBuf) Reset

func (x *ChallengeBuf) Reset()

func (*ChallengeBuf) String

func (x *ChallengeBuf) String() string

func (*ChallengeBuf) Unmarshal

func (m *ChallengeBuf) Unmarshal(chain *NodeGraph) *Challenge

type ChallengeOpportunity

type ChallengeOpportunity struct {
	// contains filtered or unexported fields
}

func (*ChallengeOpportunity) Asserter

func (co *ChallengeOpportunity) Asserter() common.Address

func (*ChallengeOpportunity) AsserterNodeHash

func (co *ChallengeOpportunity) AsserterNodeHash() common.Hash

func (*ChallengeOpportunity) AsserterNodeType

func (co *ChallengeOpportunity) AsserterNodeType() valprotocol.ChildType

func (*ChallengeOpportunity) AsserterProof

func (co *ChallengeOpportunity) AsserterProof() []common.Hash

func (*ChallengeOpportunity) AsserterVMProtoHash

func (co *ChallengeOpportunity) AsserterVMProtoHash() common.Hash

func (*ChallengeOpportunity) Challenger

func (co *ChallengeOpportunity) Challenger() common.Address

func (*ChallengeOpportunity) ChallengerDataHash

func (co *ChallengeOpportunity) ChallengerDataHash() common.Hash

func (*ChallengeOpportunity) ChallengerNodeType

func (co *ChallengeOpportunity) ChallengerNodeType() valprotocol.ChildType

func (*ChallengeOpportunity) ChallengerPeriodTicks

func (co *ChallengeOpportunity) ChallengerPeriodTicks() common.TimeTicks

func (*ChallengeOpportunity) ChallengerProof

func (co *ChallengeOpportunity) ChallengerProof() []common.Hash

func (*ChallengeOpportunity) ChallengerVMProtoHash

func (co *ChallengeOpportunity) ChallengerVMProtoHash() common.Hash

func (*ChallengeOpportunity) DeadlineTicks

func (co *ChallengeOpportunity) DeadlineTicks() common.TimeTicks

func (*ChallengeOpportunity) PrevNodeHash

func (co *ChallengeOpportunity) PrevNodeHash() common.Hash

type ChallengeSet

type ChallengeSet struct {
	// contains filtered or unexported fields
}

func NewChallengeSet

func NewChallengeSet() *ChallengeSet

func (*ChallengeSet) Add

func (cs *ChallengeSet) Add(newChallenge *Challenge)

func (*ChallengeSet) Delete

func (cs *ChallengeSet) Delete(contract common.Address)

func (*ChallengeSet) Equals

func (cs *ChallengeSet) Equals(cs2 *ChallengeSet) bool

func (*ChallengeSet) Forall

func (cs *ChallengeSet) Forall(f func(*Challenge))

func (*ChallengeSet) Get

func (cs *ChallengeSet) Get(addr common.Address) *Challenge

func (*ChallengeSet) GetSize

func (cs *ChallengeSet) GetSize() int

type LeafSet

type LeafSet struct {
	// contains filtered or unexported fields
}

func NewLeafSet

func NewLeafSet() *LeafSet

func (*LeafSet) IsLeaf

func (ll *LeafSet) IsLeaf(node *structures.Node) bool

func (*LeafSet) NumLeaves

func (ll *LeafSet) NumLeaves() int

type NodeGraph

type NodeGraph struct {
	// contains filtered or unexported fields
}

func NewNodeGraph

func NewNodeGraph(machine machine.Machine, params valprotocol.ChainParams) *NodeGraph

func (*NodeGraph) ConsiderPruningNode

func (ng *NodeGraph) ConsiderPruningNode(node *structures.Node)

func (*NodeGraph) CreateNodesOnAssert

func (ng *NodeGraph) CreateNodesOnAssert(
	prevNode *structures.Node,
	dispNode *valprotocol.DisputableNode,
	currentTime *common.TimeBlocks,
) []*structures.Node

func (*NodeGraph) DebugString

func (ng *NodeGraph) DebugString(stakers *StakerSet, prefix string, labels map[*structures.Node][]string) string

func (*NodeGraph) DebugStringForNodeRecursive

func (ng *NodeGraph) DebugStringForNodeRecursive(node *structures.Node, stakers *StakerSet, prefix string, labels map[*structures.Node][]string) string

func (*NodeGraph) DeleteLeaf

func (ng *NodeGraph) DeleteLeaf(leaf *structures.Node)

func (*NodeGraph) Equals

func (ng *NodeGraph) Equals(ng2 *NodeGraph) bool

func (*NodeGraph) GetLeaf

func (ng *NodeGraph) GetLeaf(node *structures.Node) *structures.Node

func (*NodeGraph) GetSuccessor

func (ng *NodeGraph) GetSuccessor(node *structures.Node, kind valprotocol.ChildType) *structures.Node

func (*NodeGraph) HasReference

func (ng *NodeGraph) HasReference(node *structures.Node) bool

func (*NodeGraph) LatestConfirmed

func (ng *NodeGraph) LatestConfirmed() *structures.Node

func (*NodeGraph) Leaves

func (ng *NodeGraph) Leaves() *LeafSet

func (*NodeGraph) MarshalForCheckpoint

func (ng *NodeGraph) MarshalForCheckpoint(ctx *ckptcontext.CheckpointContext) *NodeGraphBuf

func (*NodeGraph) NodeFromHash

func (ng *NodeGraph) NodeFromHash(hash common.Hash) *structures.Node

func (*NodeGraph) OldestNode

func (ng *NodeGraph) OldestNode() *structures.Node

func (*NodeGraph) Params

func (ng *NodeGraph) Params() valprotocol.ChainParams

func (*NodeGraph) PruneNodeByHash

func (ng *NodeGraph) PruneNodeByHash(nodeHash common.Hash)

func (*NodeGraph) PruneOldestNode

func (ng *NodeGraph) PruneOldestNode(oldest *structures.Node)

func (*NodeGraph) UpdateLatestConfirmed

func (ng *NodeGraph) UpdateLatestConfirmed(node *structures.Node)

func (*NodeGraph) UpdateOldestNode

func (ng *NodeGraph) UpdateOldestNode(node *structures.Node)

type NodeGraphBuf

type NodeGraphBuf struct {
	Nodes               []*structures.NodeBuf       `protobuf:"bytes,1,rep,name=nodes,proto3" json:"nodes,omitempty"`
	OldestNodeHash      *common.HashBuf             `protobuf:"bytes,2,opt,name=oldestNodeHash,proto3" json:"oldestNodeHash,omitempty"`
	LatestConfirmedHash *common.HashBuf             `protobuf:"bytes,3,opt,name=latestConfirmedHash,proto3" json:"latestConfirmedHash,omitempty"`
	LeafHashes          []*common.HashBuf           `protobuf:"bytes,4,rep,name=leafHashes,proto3" json:"leafHashes,omitempty"`
	Params              *valprotocol.ChainParamsBuf `protobuf:"bytes,5,opt,name=params,proto3" json:"params,omitempty"`
	// contains filtered or unexported fields
}

func (*NodeGraphBuf) Descriptor deprecated

func (*NodeGraphBuf) Descriptor() ([]byte, []int)

Deprecated: Use NodeGraphBuf.ProtoReflect.Descriptor instead.

func (*NodeGraphBuf) GetLatestConfirmedHash

func (x *NodeGraphBuf) GetLatestConfirmedHash() *common.HashBuf

func (*NodeGraphBuf) GetLeafHashes

func (x *NodeGraphBuf) GetLeafHashes() []*common.HashBuf

func (*NodeGraphBuf) GetNodes

func (x *NodeGraphBuf) GetNodes() []*structures.NodeBuf

func (*NodeGraphBuf) GetOldestNodeHash

func (x *NodeGraphBuf) GetOldestNodeHash() *common.HashBuf

func (*NodeGraphBuf) GetParams

func (x *NodeGraphBuf) GetParams() *valprotocol.ChainParamsBuf

func (*NodeGraphBuf) ProtoMessage

func (*NodeGraphBuf) ProtoMessage()

func (*NodeGraphBuf) ProtoReflect

func (x *NodeGraphBuf) ProtoReflect() protoreflect.Message

func (*NodeGraphBuf) Reset

func (x *NodeGraphBuf) Reset()

func (*NodeGraphBuf) String

func (x *NodeGraphBuf) String() string

func (*NodeGraphBuf) UnmarshalFromCheckpoint

func (x *NodeGraphBuf) UnmarshalFromCheckpoint(ctx ckptcontext.RestoreContext) (*NodeGraph, error)

type RecoverStakeMootedParams

type RecoverStakeMootedParams struct {
	Addr         common.Address
	AncestorHash common.Hash
	LcProof      []common.Hash
	StProof      []common.Hash
}

type RecoverStakeOldParams

type RecoverStakeOldParams struct {
	Addr  common.Address
	Proof []common.Hash
}

type SortableAddressList

type SortableAddressList []common.Address

func (SortableAddressList) Len

func (sa SortableAddressList) Len() int

func (SortableAddressList) Less

func (sa SortableAddressList) Less(i, j int) bool

func (SortableAddressList) Swap

func (sa SortableAddressList) Swap(i, j int)

type StakedNodeGraph

type StakedNodeGraph struct {
	*NodeGraph

	Challenges *ChallengeSet
	// contains filtered or unexported fields
}

func NewStakedNodeGraph

func NewStakedNodeGraph(machine machine.Machine, params valprotocol.ChainParams) *StakedNodeGraph

func (*StakedNodeGraph) ChallengeResolved

func (sng *StakedNodeGraph) ChallengeResolved(contract, winner, loser common.Address)

func (*StakedNodeGraph) CheckChallengeOpportunityAny

func (sng *StakedNodeGraph) CheckChallengeOpportunityAny(staker *Staker) *ChallengeOpportunity

func (*StakedNodeGraph) CheckChallengeOpportunityPair

func (sng *StakedNodeGraph) CheckChallengeOpportunityPair(staker1, staker2 *Staker) *ChallengeOpportunity

func (*StakedNodeGraph) CreateStake

func (sng *StakedNodeGraph) CreateStake(ev arbbridge.StakeCreatedEvent)

func (*StakedNodeGraph) DebugString

func (sng *StakedNodeGraph) DebugString(prefix string, labels map[*structures.Node][]string) string

func (*StakedNodeGraph) Equals

func (sng *StakedNodeGraph) Equals(s2 *StakedNodeGraph) bool

func (*StakedNodeGraph) GenerateNextConfProof

func (sng *StakedNodeGraph) GenerateNextConfProof(currentTime common.TimeTicks) (*valprotocol.ConfirmOpportunity, []*structures.Node)

func (*StakedNodeGraph) GenerateNodePruneInfo

func (sng *StakedNodeGraph) GenerateNodePruneInfo() []valprotocol.PruneParams

func (*StakedNodeGraph) GenerateStakerPruneInfo

func (sng *StakedNodeGraph) GenerateStakerPruneInfo() ([]RecoverStakeMootedParams, []RecoverStakeOldParams)

func (*StakedNodeGraph) MarshalForCheckpoint

func (sng *StakedNodeGraph) MarshalForCheckpoint(ctx *ckptcontext.CheckpointContext) *StakedNodeGraphBuf

func (*StakedNodeGraph) MoveStake

func (sng *StakedNodeGraph) MoveStake(stakerAddr common.Address, nodeHash common.Hash)

func (*StakedNodeGraph) NewChallenge

func (sng *StakedNodeGraph) NewChallenge(chal *Challenge)

func (*StakedNodeGraph) RemoveStake

func (sng *StakedNodeGraph) RemoveStake(stakerAddr common.Address)

func (*StakedNodeGraph) Stakers

func (sng *StakedNodeGraph) Stakers() *StakerSet

type StakedNodeGraphBuf

type StakedNodeGraphBuf struct {
	NodeGraph  *NodeGraphBuf   `protobuf:"bytes,1,opt,name=nodeGraph,proto3" json:"nodeGraph,omitempty"`
	Stakers    []*StakerBuf    `protobuf:"bytes,2,rep,name=stakers,proto3" json:"stakers,omitempty"`
	Challenges []*ChallengeBuf `protobuf:"bytes,3,rep,name=challenges,proto3" json:"challenges,omitempty"`
	// contains filtered or unexported fields
}

func (*StakedNodeGraphBuf) Descriptor deprecated

func (*StakedNodeGraphBuf) Descriptor() ([]byte, []int)

Deprecated: Use StakedNodeGraphBuf.ProtoReflect.Descriptor instead.

func (*StakedNodeGraphBuf) GetChallenges

func (x *StakedNodeGraphBuf) GetChallenges() []*ChallengeBuf

func (*StakedNodeGraphBuf) GetNodeGraph

func (x *StakedNodeGraphBuf) GetNodeGraph() *NodeGraphBuf

func (*StakedNodeGraphBuf) GetStakers

func (x *StakedNodeGraphBuf) GetStakers() []*StakerBuf

func (*StakedNodeGraphBuf) ProtoMessage

func (*StakedNodeGraphBuf) ProtoMessage()

func (*StakedNodeGraphBuf) ProtoReflect

func (x *StakedNodeGraphBuf) ProtoReflect() protoreflect.Message

func (*StakedNodeGraphBuf) Reset

func (x *StakedNodeGraphBuf) Reset()

func (*StakedNodeGraphBuf) String

func (x *StakedNodeGraphBuf) String() string

func (*StakedNodeGraphBuf) UnmarshalFromCheckpoint

func (x *StakedNodeGraphBuf) UnmarshalFromCheckpoint(ctx ckptcontext.RestoreContext) (*StakedNodeGraph, error)

type Staker

type Staker struct {
	// contains filtered or unexported fields
}

func (*Staker) Address

func (staker *Staker) Address() common.Address

func (*Staker) Challenge

func (staker *Staker) Challenge() common.Address

func (*Staker) CreationTime

func (staker *Staker) CreationTime() common.TimeTicks

func (*Staker) DebugString

func (s *Staker) DebugString(prefix string) string

func (*Staker) Equals

func (s *Staker) Equals(s2 *Staker) bool

func (*Staker) Location

func (staker *Staker) Location() *structures.Node

func (*Staker) MarshalToBuf

func (staker *Staker) MarshalToBuf() *StakerBuf

type StakerBuf

type StakerBuf struct {
	Address       *common.AddressBuf   `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	Location      *common.HashBuf      `protobuf:"bytes,2,opt,name=location,proto3" json:"location,omitempty"`
	CreationTime  *common.TimeTicksBuf `protobuf:"bytes,3,opt,name=creationTime,proto3" json:"creationTime,omitempty"`
	ChallengeAddr *common.AddressBuf   `protobuf:"bytes,4,opt,name=challengeAddr,proto3" json:"challengeAddr,omitempty"`
	// contains filtered or unexported fields
}

func (*StakerBuf) Descriptor deprecated

func (*StakerBuf) Descriptor() ([]byte, []int)

Deprecated: Use StakerBuf.ProtoReflect.Descriptor instead.

func (*StakerBuf) GetAddress

func (x *StakerBuf) GetAddress() *common.AddressBuf

func (*StakerBuf) GetChallengeAddr

func (x *StakerBuf) GetChallengeAddr() *common.AddressBuf

func (*StakerBuf) GetCreationTime

func (x *StakerBuf) GetCreationTime() *common.TimeTicksBuf

func (*StakerBuf) GetLocation

func (x *StakerBuf) GetLocation() *common.HashBuf

func (*StakerBuf) ProtoMessage

func (*StakerBuf) ProtoMessage()

func (*StakerBuf) ProtoReflect

func (x *StakerBuf) ProtoReflect() protoreflect.Message

func (*StakerBuf) Reset

func (x *StakerBuf) Reset()

func (*StakerBuf) String

func (x *StakerBuf) String() string

func (*StakerBuf) Unmarshal

func (buf *StakerBuf) Unmarshal(chain *NodeGraph) *Staker

type StakerSet

type StakerSet struct {
	// contains filtered or unexported fields
}

func NewStakerSet

func NewStakerSet() *StakerSet

func (*StakerSet) Add

func (sl *StakerSet) Add(newStaker *Staker)

func (*StakerSet) DebugString

func (ss *StakerSet) DebugString(prefix string) string

func (*StakerSet) Delete

func (sl *StakerSet) Delete(staker *Staker)

func (*StakerSet) Equals

func (ss *StakerSet) Equals(ss2 *StakerSet) bool

func (*StakerSet) Get

func (sl *StakerSet) Get(addr common.Address) *Staker

func (*StakerSet) GetSize

func (sl *StakerSet) GetSize() int

Jump to

Keyboard shortcuts

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