valprotocol

package
v0.7.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2020 License: Apache-2.0 Imports: 12 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

View Source
var File_valprotocol_proto protoreflect.FileDescriptor

Functions

func BytesArrayAccumHash added in v0.6.5

func BytesArrayAccumHash(initialHash common.Hash, data []byte, valCount uint64) common.Hash

func CalculateBisectionStepCount

func CalculateBisectionStepCount(chunkIndex, segmentCount, totalSteps uint64) uint64

func CalculateNodeDeadline added in v0.6.5

func CalculateNodeDeadline(
	assertion *ExecutionAssertionStub,
	params ChainParams,
	prevDeadline common.TimeTicks,
	assertionTime common.TimeTicks,
) common.TimeTicks

func ExecutionDataHash

func ExecutionDataHash(
	numSteps uint64,
	assertion *ExecutionAssertionStub,
) common.Hash

func InboxTopChallengeDataHash

func InboxTopChallengeDataHash(
	lowerInbox common.Hash,
	upperInbox common.Hash,
	messageCount *big.Int,
) common.Hash

func MessageChallengeDataHash

func MessageChallengeDataHash(
	lowerInbox common.Hash,
	upperInbox common.Hash,
	lowerMessages common.Hash,
	upperMessages common.Hash,
	messageCount *big.Int,
) common.Hash

Types

type AssertionParams

type AssertionParams struct {
	NumSteps             uint64
	ImportedMessageCount *big.Int
}

func NewRandomAssertionParams added in v0.6.0

func NewRandomAssertionParams() *AssertionParams

func (*AssertionParams) Clone

func (ap *AssertionParams) Clone() *AssertionParams

func (*AssertionParams) Equals

func (ap *AssertionParams) Equals(o *AssertionParams) bool

func (*AssertionParams) MarshalToBuf

func (ap *AssertionParams) MarshalToBuf() *AssertionParamsBuf

func (*AssertionParams) String

func (ap *AssertionParams) String() string

type AssertionParamsBuf

type AssertionParamsBuf struct {
	NumSteps             uint64                `protobuf:"varint,1,opt,name=numSteps,proto3" json:"numSteps,omitempty"`
	ImportedMessageCount *common.BigIntegerBuf `protobuf:"bytes,2,opt,name=importedMessageCount,proto3" json:"importedMessageCount,omitempty"`
	// contains filtered or unexported fields
}

func (*AssertionParamsBuf) Descriptor deprecated

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

Deprecated: Use AssertionParamsBuf.ProtoReflect.Descriptor instead.

func (*AssertionParamsBuf) GetImportedMessageCount

func (x *AssertionParamsBuf) GetImportedMessageCount() *common.BigIntegerBuf

func (*AssertionParamsBuf) GetNumSteps

func (x *AssertionParamsBuf) GetNumSteps() uint64

func (*AssertionParamsBuf) ProtoMessage

func (*AssertionParamsBuf) ProtoMessage()

func (*AssertionParamsBuf) ProtoReflect added in v0.5.0

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

func (*AssertionParamsBuf) Reset

func (x *AssertionParamsBuf) Reset()

func (*AssertionParamsBuf) String

func (x *AssertionParamsBuf) String() string

func (*AssertionParamsBuf) Unmarshal

func (x *AssertionParamsBuf) Unmarshal() *AssertionParams

type ChainParams

type ChainParams struct {
	StakeRequirement        *big.Int
	StakeToken              common.Address
	GracePeriod             common.TimeTicks // in Ticks
	MaxExecutionSteps       uint64
	ArbGasSpeedLimitPerTick uint64 // in ArbGas per tick
}

If StakeToken is 0, stake requirement is ETH measured in Wei, otherwise stake requirement is units of stakeStoken

func NewRandomChainParams added in v0.6.0

func NewRandomChainParams() ChainParams

func (ChainParams) Equals

func (cp ChainParams) Equals(cp2 ChainParams) bool

func (ChainParams) MarshalToBuf

func (params ChainParams) MarshalToBuf() *ChainParamsBuf

func (ChainParams) WithArbGasSpeedLimitPerTick

func (cp ChainParams) WithArbGasSpeedLimitPerTick(limit uint64) ChainParams

func (ChainParams) WithGracePeriod

func (cp ChainParams) WithGracePeriod(period common.TimeTicks) ChainParams

func (ChainParams) WithGracePeriodBlocks

func (cp ChainParams) WithGracePeriodBlocks(period common.TimeBlocks) ChainParams

func (ChainParams) WithMaxExecutionSteps

func (cp ChainParams) WithMaxExecutionSteps(steps uint64) ChainParams

func (ChainParams) WithStakeRequirement

func (cp ChainParams) WithStakeRequirement(amount *big.Int) ChainParams

func (ChainParams) WithStakeToken added in v0.7.0

func (cp ChainParams) WithStakeToken(address common.Address) ChainParams

type ChainParamsBuf

type ChainParamsBuf struct {
	StakeRequirement        *common.BigIntegerBuf `protobuf:"bytes,1,opt,name=stakeRequirement,proto3" json:"stakeRequirement,omitempty"`
	StakeToken              *common.AddressBuf    `protobuf:"bytes,2,opt,name=stakeToken,proto3" json:"stakeToken,omitempty"`
	GracePeriod             *common.TimeTicksBuf  `protobuf:"bytes,3,opt,name=gracePeriod,proto3" json:"gracePeriod,omitempty"`
	MaxExecutionSteps       uint64                `protobuf:"varint,4,opt,name=maxExecutionSteps,proto3" json:"maxExecutionSteps,omitempty"`
	ArbGasSpeedLimitPerTick uint64                `protobuf:"varint,5,opt,name=ArbGasSpeedLimitPerTick,proto3" json:"ArbGasSpeedLimitPerTick,omitempty"`
	// contains filtered or unexported fields
}

func (*ChainParamsBuf) Descriptor deprecated

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

Deprecated: Use ChainParamsBuf.ProtoReflect.Descriptor instead.

func (*ChainParamsBuf) GetArbGasSpeedLimitPerTick

func (x *ChainParamsBuf) GetArbGasSpeedLimitPerTick() uint64

func (*ChainParamsBuf) GetGracePeriod

func (x *ChainParamsBuf) GetGracePeriod() *common.TimeTicksBuf

func (*ChainParamsBuf) GetMaxExecutionSteps

func (x *ChainParamsBuf) GetMaxExecutionSteps() uint64

func (*ChainParamsBuf) GetStakeRequirement

func (x *ChainParamsBuf) GetStakeRequirement() *common.BigIntegerBuf

func (*ChainParamsBuf) GetStakeToken added in v0.7.0

func (x *ChainParamsBuf) GetStakeToken() *common.AddressBuf

func (*ChainParamsBuf) ProtoMessage

func (*ChainParamsBuf) ProtoMessage()

func (*ChainParamsBuf) ProtoReflect added in v0.5.0

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

func (*ChainParamsBuf) Reset

func (x *ChainParamsBuf) Reset()

func (*ChainParamsBuf) String

func (x *ChainParamsBuf) String() string

func (*ChainParamsBuf) Unmarshal

func (m *ChainParamsBuf) Unmarshal() ChainParams

type ChildType

type ChildType uint
const (
	InvalidInboxTopChildType  ChildType = 0
	InvalidExecutionChildType ChildType = 1
	ValidChildType            ChildType = 2

	MinChildType        ChildType = 0
	MaxInvalidChildType ChildType = 1
	MaxChildType        ChildType = 2
)

type ConfirmInvalidOpportunity

type ConfirmInvalidOpportunity struct {
	*ConfirmNodeOpportunityCore
	ChallengeNodeData common.Hash
}

func (ConfirmInvalidOpportunity) Clone

func (ConfirmInvalidOpportunity) CoreOpp added in v0.7.0

func (ConfirmInvalidOpportunity) ProofSize

func (opp ConfirmInvalidOpportunity) ProofSize() int

type ConfirmNodeOpportunity

type ConfirmNodeOpportunity interface {
	Clone() ConfirmNodeOpportunity
	CoreOpp() *ConfirmNodeOpportunityCore
	ProofSize() int
}

type ConfirmNodeOpportunityCore added in v0.7.0

type ConfirmNodeOpportunityCore struct {
	Branch           ChildType
	DeadlineTicks    common.TimeTicks
	PrevVMProtoState *VMProtoData
	VMProtoState     *VMProtoData
}

func (*ConfirmNodeOpportunityCore) Clone added in v0.7.0

type ConfirmOpportunity

type ConfirmOpportunity struct {
	Nodes                  []ConfirmNodeOpportunity
	CurrentLatestConfirmed common.Hash
	StakerAddresses        []common.Address
	StakerProofs           [][]common.Hash
}

func (*ConfirmOpportunity) Clone

func (opp *ConfirmOpportunity) Clone() *ConfirmOpportunity

func (*ConfirmOpportunity) PrepareProof added in v0.6.5

func (opp *ConfirmOpportunity) PrepareProof() ConfirmProof

type ConfirmProof added in v0.6.5

type ConfirmProof struct {
	InitalProtoStateHash common.Hash
	BeforeSendCount      *big.Int
	BranchesNums         []*big.Int
	DeadlineTicks        []*big.Int
	ChallengeNodeData    [][32]byte
	LogsAcc              [][32]byte
	VMProtoStateHashes   [][32]byte
	MessageCounts        []*big.Int
	Messages             []byte
	CombinedProofs       [][32]byte
	StakerProofOffsets   []*big.Int
}

type ConfirmValidOpportunity

type ConfirmValidOpportunity struct {
	*ConfirmNodeOpportunityCore
	MessagesData []byte
	MessageCount uint64
	LogsAcc      common.Hash
}

func (ConfirmValidOpportunity) Clone

func (ConfirmValidOpportunity) CoreOpp added in v0.7.0

func (ConfirmValidOpportunity) ProofSize

func (opp ConfirmValidOpportunity) ProofSize() int

type DisputableNode

type DisputableNode struct {
	AssertionParams *AssertionParams
	Assertion       *ExecutionAssertionStub
	MaxInboxTop     common.Hash
	MaxInboxCount   *big.Int
}

func NewDisputableNode

func NewDisputableNode(
	assertionParams *AssertionParams,
	assertion *ExecutionAssertionStub,
	maxInboxTop common.Hash,
	maxInboxCount *big.Int,
) *DisputableNode

func NewRandomDisputableNode added in v0.6.0

func NewRandomDisputableNode(assertion *ExecutionAssertionStub) *DisputableNode

func (*DisputableNode) MarshalToBuf

func (dn *DisputableNode) MarshalToBuf() *DisputableNodeBuf

func (*DisputableNode) ValidAfterVMProtoData

func (dn *DisputableNode) ValidAfterVMProtoData(prevState *VMProtoData) *VMProtoData

type DisputableNodeBuf

type DisputableNodeBuf struct {
	AssertionParams *AssertionParamsBuf        `protobuf:"bytes,1,opt,name=assertionParams,proto3" json:"assertionParams,omitempty"`
	Assertion       *ExecutionAssertionStubBuf `protobuf:"bytes,2,opt,name=assertion,proto3" json:"assertion,omitempty"`
	MaxInboxTop     *common.HashBuf            `protobuf:"bytes,3,opt,name=maxInboxTop,proto3" json:"maxInboxTop,omitempty"`
	MaxInboxCount   *common.BigIntegerBuf      `protobuf:"bytes,4,opt,name=maxInboxCount,proto3" json:"maxInboxCount,omitempty"`
	// contains filtered or unexported fields
}

func (*DisputableNodeBuf) Descriptor deprecated

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

Deprecated: Use DisputableNodeBuf.ProtoReflect.Descriptor instead.

func (*DisputableNodeBuf) GetAssertion added in v0.7.0

func (x *DisputableNodeBuf) GetAssertion() *ExecutionAssertionStubBuf

func (*DisputableNodeBuf) GetAssertionParams

func (x *DisputableNodeBuf) GetAssertionParams() *AssertionParamsBuf

func (*DisputableNodeBuf) GetMaxInboxCount

func (x *DisputableNodeBuf) GetMaxInboxCount() *common.BigIntegerBuf

func (*DisputableNodeBuf) GetMaxInboxTop

func (x *DisputableNodeBuf) GetMaxInboxTop() *common.HashBuf

func (*DisputableNodeBuf) ProtoMessage

func (*DisputableNodeBuf) ProtoMessage()

func (*DisputableNodeBuf) ProtoReflect added in v0.5.0

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

func (*DisputableNodeBuf) Reset

func (x *DisputableNodeBuf) Reset()

func (*DisputableNodeBuf) String

func (x *DisputableNodeBuf) String() string

func (*DisputableNodeBuf) Unmarshal

func (x *DisputableNodeBuf) Unmarshal() *DisputableNode

type ExecutionAssertionStub

type ExecutionAssertionStub struct {
	NumGas            uint64
	BeforeMachineHash common.Hash
	AfterMachineHash  common.Hash
	BeforeInboxHash   common.Hash
	AfterInboxHash    common.Hash
	FirstMessageHash  common.Hash
	LastMessageHash   common.Hash
	MessageCount      uint64
	FirstLogHash      common.Hash
	LastLogHash       common.Hash
	LogCount          uint64
}

func (*ExecutionAssertionStub) CheckTime added in v0.6.5

func (dn *ExecutionAssertionStub) CheckTime(params ChainParams) common.TimeTicks

func (*ExecutionAssertionStub) Clone

func (*ExecutionAssertionStub) Equals

func (*ExecutionAssertionStub) MarshalToBuf

func (*ExecutionAssertionStub) String

func (a *ExecutionAssertionStub) String() string

type ExecutionAssertionStubBuf

type ExecutionAssertionStubBuf struct {
	NumGas            uint64          `protobuf:"varint,1,opt,name=numGas,proto3" json:"numGas,omitempty"`
	BeforeMachineHash *common.HashBuf `protobuf:"bytes,2,opt,name=beforeMachineHash,proto3" json:"beforeMachineHash,omitempty"`
	AfterMachineHash  *common.HashBuf `protobuf:"bytes,3,opt,name=afterMachineHash,proto3" json:"afterMachineHash,omitempty"`
	BeforeInboxHash   *common.HashBuf `protobuf:"bytes,4,opt,name=beforeInboxHash,proto3" json:"beforeInboxHash,omitempty"`
	AfterInboxHash    *common.HashBuf `protobuf:"bytes,5,opt,name=afterInboxHash,proto3" json:"afterInboxHash,omitempty"`
	FirstMessageHash  *common.HashBuf `protobuf:"bytes,6,opt,name=firstMessageHash,proto3" json:"firstMessageHash,omitempty"`
	LastMessageHash   *common.HashBuf `protobuf:"bytes,7,opt,name=lastMessageHash,proto3" json:"lastMessageHash,omitempty"`
	MessageCount      uint64          `protobuf:"varint,8,opt,name=messageCount,proto3" json:"messageCount,omitempty"`
	FirstLogHash      *common.HashBuf `protobuf:"bytes,9,opt,name=firstLogHash,proto3" json:"firstLogHash,omitempty"`
	LastLogHash       *common.HashBuf `protobuf:"bytes,10,opt,name=lastLogHash,proto3" json:"lastLogHash,omitempty"`
	LogCount          uint64          `protobuf:"varint,11,opt,name=logCount,proto3" json:"logCount,omitempty"`
	// contains filtered or unexported fields
}

func (*ExecutionAssertionStubBuf) Descriptor deprecated

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

Deprecated: Use ExecutionAssertionStubBuf.ProtoReflect.Descriptor instead.

func (*ExecutionAssertionStubBuf) GetAfterInboxHash added in v0.7.0

func (x *ExecutionAssertionStubBuf) GetAfterInboxHash() *common.HashBuf

func (*ExecutionAssertionStubBuf) GetAfterMachineHash added in v0.7.0

func (x *ExecutionAssertionStubBuf) GetAfterMachineHash() *common.HashBuf

func (*ExecutionAssertionStubBuf) GetBeforeInboxHash added in v0.7.0

func (x *ExecutionAssertionStubBuf) GetBeforeInboxHash() *common.HashBuf

func (*ExecutionAssertionStubBuf) GetBeforeMachineHash added in v0.7.0

func (x *ExecutionAssertionStubBuf) GetBeforeMachineHash() *common.HashBuf

func (*ExecutionAssertionStubBuf) GetFirstLogHash

func (x *ExecutionAssertionStubBuf) GetFirstLogHash() *common.HashBuf

func (*ExecutionAssertionStubBuf) GetFirstMessageHash

func (x *ExecutionAssertionStubBuf) GetFirstMessageHash() *common.HashBuf

func (*ExecutionAssertionStubBuf) GetLastLogHash

func (x *ExecutionAssertionStubBuf) GetLastLogHash() *common.HashBuf

func (*ExecutionAssertionStubBuf) GetLastMessageHash

func (x *ExecutionAssertionStubBuf) GetLastMessageHash() *common.HashBuf

func (*ExecutionAssertionStubBuf) GetLogCount added in v0.7.0

func (x *ExecutionAssertionStubBuf) GetLogCount() uint64

func (*ExecutionAssertionStubBuf) GetMessageCount added in v0.7.0

func (x *ExecutionAssertionStubBuf) GetMessageCount() uint64

func (*ExecutionAssertionStubBuf) GetNumGas

func (x *ExecutionAssertionStubBuf) GetNumGas() uint64

func (*ExecutionAssertionStubBuf) ProtoMessage

func (*ExecutionAssertionStubBuf) ProtoMessage()

func (*ExecutionAssertionStubBuf) ProtoReflect added in v0.5.0

func (*ExecutionAssertionStubBuf) Reset

func (x *ExecutionAssertionStubBuf) Reset()

func (*ExecutionAssertionStubBuf) String

func (x *ExecutionAssertionStubBuf) String() string

func (*ExecutionAssertionStubBuf) Unmarshal

type PruneParams

type PruneParams struct {
	LeafHash     common.Hash
	AncestorHash common.Hash
	LeafProof    []common.Hash
	AncProof     []common.Hash
}

func (PruneParams) Clone

func (pp PruneParams) Clone() PruneParams

type VMProtoData

type VMProtoData struct {
	MachineHash  common.Hash
	InboxTop     common.Hash
	InboxCount   *big.Int
	MessageCount *big.Int
	LogCount     *big.Int
}

func NewVMProtoData

func NewVMProtoData(
	machineHash common.Hash,
	inboxTop common.Hash,
	inboxCount *big.Int,
	messageCount *big.Int,
	logCount *big.Int,
) *VMProtoData

func (*VMProtoData) Clone

func (d *VMProtoData) Clone() *VMProtoData

func (*VMProtoData) Equals

func (d *VMProtoData) Equals(o *VMProtoData) bool

func (*VMProtoData) Hash

func (d *VMProtoData) Hash() common.Hash

func (*VMProtoData) MarshalToBuf

func (d *VMProtoData) MarshalToBuf() *VMProtoDataBuf

func (*VMProtoData) String

func (d *VMProtoData) String() string

type VMProtoDataBuf

type VMProtoDataBuf struct {
	MachineHash  *common.HashBuf       `protobuf:"bytes,1,opt,name=machineHash,proto3" json:"machineHash,omitempty"`
	InboxTop     *common.HashBuf       `protobuf:"bytes,2,opt,name=inboxTop,proto3" json:"inboxTop,omitempty"`
	InboxCount   *common.BigIntegerBuf `protobuf:"bytes,3,opt,name=inboxCount,proto3" json:"inboxCount,omitempty"`
	MessageCount *common.BigIntegerBuf `protobuf:"bytes,4,opt,name=messageCount,proto3" json:"messageCount,omitempty"`
	LogCount     *common.BigIntegerBuf `protobuf:"bytes,5,opt,name=logCount,proto3" json:"logCount,omitempty"`
	// contains filtered or unexported fields
}

func (*VMProtoDataBuf) Descriptor deprecated

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

Deprecated: Use VMProtoDataBuf.ProtoReflect.Descriptor instead.

func (*VMProtoDataBuf) GetInboxCount

func (x *VMProtoDataBuf) GetInboxCount() *common.BigIntegerBuf

func (*VMProtoDataBuf) GetInboxTop

func (x *VMProtoDataBuf) GetInboxTop() *common.HashBuf

func (*VMProtoDataBuf) GetLogCount added in v0.7.0

func (x *VMProtoDataBuf) GetLogCount() *common.BigIntegerBuf

func (*VMProtoDataBuf) GetMachineHash

func (x *VMProtoDataBuf) GetMachineHash() *common.HashBuf

func (*VMProtoDataBuf) GetMessageCount added in v0.7.0

func (x *VMProtoDataBuf) GetMessageCount() *common.BigIntegerBuf

func (*VMProtoDataBuf) ProtoMessage

func (*VMProtoDataBuf) ProtoMessage()

func (*VMProtoDataBuf) ProtoReflect added in v0.5.0

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

func (*VMProtoDataBuf) Reset

func (x *VMProtoDataBuf) Reset()

func (*VMProtoDataBuf) String

func (x *VMProtoDataBuf) String() string

func (*VMProtoDataBuf) Unmarshal

func (x *VMProtoDataBuf) Unmarshal() *VMProtoData

Jump to

Keyboard shortcuts

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