commitment

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2021 License: Apache-2.0 Imports: 16 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidLengthTypes        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowTypes          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupTypes = fmt.Errorf("proto: unexpected end of group")
)

Functions

func MakeChannelStateCommitmentEntryKey

func MakeChannelStateCommitmentEntryKey(prefix exported.Prefix, portID, channelID string) string

func MakeClientStateCommitmentEntryKey

func MakeClientStateCommitmentEntryKey(
	prefix exported.Prefix,
	clientID string,
) string

func MakeConnectionStateCommitmentEntryKey

func MakeConnectionStateCommitmentEntryKey(prefix exported.Prefix, connectionID string) string

func MakeConsensusStateCommitmentEntryKey

func MakeConsensusStateCommitmentEntryKey(prefix exported.Prefix, clientID string, height exported.Height) string

func MakeCurrentSequenceKey

func MakeCurrentSequenceKey(prefix exported.Prefix) string

func MakeEntryKey

func MakeEntryKey(prefix exported.Prefix, key string) string

func MakeNextSequenceRecvEntryKey

func MakeNextSequenceRecvEntryKey(
	prefix exported.Prefix,
	portID, channelID string,
) string

func MakePacketAcknowledgementAbsenceEntryKey

func MakePacketAcknowledgementAbsenceEntryKey(
	prefix exported.Prefix,
	portID, channelID string, sequence uint64,
) string

func MakePacketAcknowledgementEntryKey

func MakePacketAcknowledgementEntryKey(
	prefix exported.Prefix,
	portID, channelID string, sequence uint64,
) string

func MakePacketCommitmentEntryKey

func MakePacketCommitmentEntryKey(
	prefix exported.Prefix,
	portID, channelID string, sequence uint64,
) string

func MakeSequenceCommitmentEntryKey

func MakeSequenceCommitmentEntryKey(seq uint64) string

func MakeSequenceKey

func MakeSequenceKey(prefix exported.Prefix, seq uint64) string

Types

type CommitmentConfig

type CommitmentConfig struct {
	MinTimeInterval  time.Duration // Minimum time interval to advance the sequence
	MaxTimestampDiff time.Duration // Difference between client and endorser
}

func DefaultConfig

func DefaultConfig() CommitmentConfig

type CommitmentEntry

type CommitmentEntry struct {
	Key   string `protobuf:"bytes,1,opt,name=key,proto3" json:"key"`
	Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value"`
}

func (*CommitmentEntry) Descriptor

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

func (*CommitmentEntry) GetKey

func (m *CommitmentEntry) GetKey() string

func (*CommitmentEntry) GetValue

func (m *CommitmentEntry) GetValue() string

func (*CommitmentEntry) Marshal

func (m *CommitmentEntry) Marshal() (dAtA []byte, err error)

func (*CommitmentEntry) MarshalTo

func (m *CommitmentEntry) MarshalTo(dAtA []byte) (int, error)

func (*CommitmentEntry) MarshalToSizedBuffer

func (m *CommitmentEntry) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*CommitmentEntry) ProtoMessage

func (*CommitmentEntry) ProtoMessage()

func (*CommitmentEntry) Reset

func (m *CommitmentEntry) Reset()

func (*CommitmentEntry) Size

func (m *CommitmentEntry) Size() (n int)

func (*CommitmentEntry) String

func (m *CommitmentEntry) String() string

func (*CommitmentEntry) Unmarshal

func (m *CommitmentEntry) Unmarshal(dAtA []byte) error

func (*CommitmentEntry) XXX_DiscardUnknown

func (m *CommitmentEntry) XXX_DiscardUnknown()

func (*CommitmentEntry) XXX_Marshal

func (m *CommitmentEntry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*CommitmentEntry) XXX_Merge

func (m *CommitmentEntry) XXX_Merge(src proto.Message)

func (*CommitmentEntry) XXX_Size

func (m *CommitmentEntry) XXX_Size() int

func (*CommitmentEntry) XXX_Unmarshal

func (m *CommitmentEntry) XXX_Unmarshal(b []byte) error

type Entry

type Entry struct {
	Key   string
	Value []byte
}

func EntryFromCommitment

func EntryFromCommitment(ce *CommitmentEntry) (*Entry, error)

func MakeChannelStateCommitmentEntry

func MakeChannelStateCommitmentEntry(
	prefix exported.Prefix,
	portID string,
	channelID string,
	channelBytes []byte,
) (*Entry, error)

func MakeClientStateCommitmentEntry

func MakeClientStateCommitmentEntry(
	prefix exported.Prefix,
	clientID string,
	clientStateBytes []byte,
) (*Entry, error)

func MakeConnectionStateCommitmentEntry

func MakeConnectionStateCommitmentEntry(
	prefix exported.Prefix,
	connectionID string,
	connectionBytes []byte,
) (*Entry, error)

func MakeConsensusStateCommitmentEntry

func MakeConsensusStateCommitmentEntry(
	prefix exported.Prefix,
	clientID string, height exported.Height, consensusStateBytes []byte,
) (*Entry, error)

func MakeNextSequenceRecvEntry

func MakeNextSequenceRecvEntry(
	prefix exported.Prefix,
	portID, channelID string, seq uint64,
) (*Entry, error)

func MakePacketAcknowledgementAbsenceEntry

func MakePacketAcknowledgementAbsenceEntry(
	prefix exported.Prefix,
	portID, channelID string, sequence uint64) (*Entry, error)

func MakePacketAcknowledgementEntry

func MakePacketAcknowledgementEntry(
	prefix exported.Prefix,
	portID, channelID string, sequence uint64, ackBytes []byte) (*Entry, error)

func MakePacketCommitmentEntry

func MakePacketCommitmentEntry(
	prefix exported.Prefix,
	portID, channelID string, sequence uint64, packetCommitmentBytes []byte,
) (*Entry, error)

func MakeSequenceCommitmentEntry

func MakeSequenceCommitmentEntry(
	sequence *Sequence,
) (*Entry, error)

func (Entry) ToCommitment

func (e Entry) ToCommitment() *CommitmentEntry

type Sequence

type Sequence struct {
	Value     uint64 `protobuf:"varint,1,opt,name=value,proto3" json:"value"`
	Timestamp int64  `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp"`
}

func NewSequence

func NewSequence(value uint64, tm int64) Sequence

func (*Sequence) Bytes

func (seq *Sequence) Bytes() []byte

func (*Sequence) Descriptor

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

func (*Sequence) GetTimestamp

func (m *Sequence) GetTimestamp() int64

func (*Sequence) GetValue

func (m *Sequence) GetValue() uint64

func (*Sequence) Marshal

func (m *Sequence) Marshal() (dAtA []byte, err error)

func (*Sequence) MarshalTo

func (m *Sequence) MarshalTo(dAtA []byte) (int, error)

func (*Sequence) MarshalToSizedBuffer

func (m *Sequence) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Sequence) ProtoMessage

func (*Sequence) ProtoMessage()

func (*Sequence) Reset

func (m *Sequence) Reset()

func (*Sequence) Size

func (m *Sequence) Size() (n int)

func (*Sequence) String

func (m *Sequence) String() string

func (*Sequence) Unmarshal

func (m *Sequence) Unmarshal(dAtA []byte) error

func (*Sequence) XXX_DiscardUnknown

func (m *Sequence) XXX_DiscardUnknown()

func (*Sequence) XXX_Marshal

func (m *Sequence) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Sequence) XXX_Merge

func (m *Sequence) XXX_Merge(src proto.Message)

func (*Sequence) XXX_Size

func (m *Sequence) XXX_Size() int

func (*Sequence) XXX_Unmarshal

func (m *Sequence) XXX_Unmarshal(b []byte) error

type SequenceManager

type SequenceManager interface {
	InitSequence(stub shim.ChaincodeStubInterface) (*Sequence, error)
	GetCurrentSequence(stub shim.ChaincodeStubInterface) (*Sequence, error)
	GetSequence(stub shim.ChaincodeStubInterface, seq uint64) (*Sequence, error)
	UpdateSequence(stub shim.ChaincodeStubInterface) (*Sequence, error)
	ValidateTimestamp(now time.Time, prevSec int64, next *timestamp.Timestamp) error
	SetClock(clock func() time.Time)
}

func NewDefaultSequenceManager

func NewDefaultSequenceManager() SequenceManager

func NewSequenceManager

func NewSequenceManager(config CommitmentConfig, prefix exported.Prefix) SequenceManager

Jump to

Keyboard shortcuts

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