fuzz

package
v0.0.0-...-5953c49 Latest Latest
Warning

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

Go to latest
Published: May 29, 2026 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotImpl            = errors.New("not implemented")
	ErrInvalidVersion     = errors.New("invalid version string")
	ErrInvalidMessageType = errors.New("invalid message type")
	ErrInvalidPayloadType = errors.New("invalid payload type")
)

Functions

This section is empty.

Types

type ErrorMessage

type ErrorMessage struct {
	Error string
}

func (*ErrorMessage) MarshalBinary

func (m *ErrorMessage) MarshalBinary() ([]byte, error)

func (*ErrorMessage) UnmarshalBinary

func (m *ErrorMessage) UnmarshalBinary(data []byte) error

type Features

type Features uint32

func (*Features) MarshalBinary

func (m *Features) MarshalBinary() ([]byte, error)

func (*Features) UnmarshalBinary

func (m *Features) UnmarshalBinary(data []byte) error

type FuzzClient

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

func NewFuzzClient

func NewFuzzClient(network, address string) (*FuzzClient, error)

func (*FuzzClient) Close

func (c *FuzzClient) Close() error

func (*FuzzClient) GetState

func (c *FuzzClient) GetState(hash types.HeaderHash) (types.StateKeyVals, error)

func (*FuzzClient) Handshake

func (c *FuzzClient) Handshake(peerInfo PeerInfo) (PeerInfo, error)

func (*FuzzClient) ImportBlock

func (c *FuzzClient) ImportBlock(block types.Block, priorStateRoot types.StateRoot) (types.StateRoot, *ErrorMessage, error)

func (*FuzzClient) SetState

func (c *FuzzClient) SetState(header types.Header, state types.StateKeyVals, ancestry types.Ancestry) (types.StateRoot, error)

type FuzzServer

type FuzzServer struct {
	Listener net.Listener
	Service  FuzzService
}

TODO

func NewFuzzServer

func NewFuzzServer(network, address string) (*FuzzServer, error)

func (*FuzzServer) ListenAndServe

func (s *FuzzServer) ListenAndServe(ctx context.Context) error

blocks until terminated

type FuzzService

type FuzzService interface {
	Handshake(PeerInfo) (PeerInfo, error)
	ImportBlock(types.Block) (types.StateRoot, error)
	SetState(types.Header, types.StateKeyVals, types.Ancestry) (types.StateRoot, error)
	GetState(types.HeaderHash) (types.StateKeyVals, error)
}

type FuzzServiceStub

type FuzzServiceStub struct{}

func (*FuzzServiceStub) GetState

func (s *FuzzServiceStub) GetState(headerHash types.HeaderHash) (types.StateKeyVals, error)

func (*FuzzServiceStub) Handshake

func (s *FuzzServiceStub) Handshake(peerInfo PeerInfo) (PeerInfo, error)

func (*FuzzServiceStub) ImportBlock

func (s *FuzzServiceStub) ImportBlock(block types.Block) (types.StateRoot, error)

ImportBlock receives a block and determines if the block is valid or mutant(fork) in mutant case, fallback to target state by identifying parent block

func (*FuzzServiceStub) SetState

func (s *FuzzServiceStub) SetState(header types.Header, stateKeyVals types.StateKeyVals, ancestry types.Ancestry) (types.StateRoot, error)

type GetState

type GetState types.HeaderHash

func (*GetState) MarshalBinary

func (m *GetState) MarshalBinary() ([]byte, error)

func (*GetState) UnmarshalBinary

func (m *GetState) UnmarshalBinary(data []byte) error

type ImportBlock

type ImportBlock types.Block

func (*ImportBlock) MarshalBinary

func (m *ImportBlock) MarshalBinary() ([]byte, error)

func (*ImportBlock) UnmarshalBinary

func (m *ImportBlock) UnmarshalBinary(data []byte) error

type Message

type Message struct {
	Type MessageType

	PeerInfo    *PeerInfo
	ImportBlock *ImportBlock
	SetState    *SetState
	GetState    *GetState
	StateRoot   *StateRoot
	State       *State

	// For ImportBlock
	Error *ErrorMessage
}

func (*Message) MarshalBinary

func (m *Message) MarshalBinary() ([]byte, error)

func (*Message) ReadFrom

func (m *Message) ReadFrom(reader io.Reader) (int64, error)

type MessageType

type MessageType uint8
const (
	MessageType_PeerInfo     MessageType = 0
	MessageType_SetState     MessageType = 1
	MessageType_StateRoot    MessageType = 2
	MessageType_ImportBlock  MessageType = 3
	MessageType_GetState     MessageType = 4
	MessageType_State        MessageType = 5
	MessageType_ErrorMessage MessageType = 255
)

type PeerInfo

type PeerInfo struct {
	FuzzVersion  uint8    `json:"fuzz_version"`
	FuzzFeatures Features `json:"fuzz_features"`
	JamVersion   Version  `json:"jam_version"`
	AppVersion   Version  `json:"app_version"`
	AppName      string   `json:"app_name"`
}

func (*PeerInfo) FromConfig

func (m *PeerInfo) FromConfig() error

func (*PeerInfo) FromValues

func (m *PeerInfo) FromValues(name, strAppVersion, strJamVersion string, fuzzVersion uint8, fuzzFeatures uint32) error

func (*PeerInfo) MarshalBinary

func (m *PeerInfo) MarshalBinary() ([]byte, error)

func (*PeerInfo) UnmarshalBinary

func (m *PeerInfo) UnmarshalBinary(data []byte) error

type SetState

type SetState struct {
	Header   types.Header
	State    types.StateKeyVals
	Ancestry types.Ancestry
}

func (*SetState) Decode

func (m *SetState) Decode(d *types.Decoder) error

func (*SetState) Encode

func (m *SetState) Encode(e *types.Encoder) error

func (*SetState) MarshalBinary

func (m *SetState) MarshalBinary() ([]byte, error)

func (*SetState) UnmarshalBinary

func (m *SetState) UnmarshalBinary(data []byte) error

type State

type State types.StateKeyVals

func (*State) MarshalBinary

func (m *State) MarshalBinary() ([]byte, error)

func (*State) UnmarshalBinary

func (m *State) UnmarshalBinary(data []byte) error

type StateRoot

type StateRoot types.StateRoot

func (*StateRoot) MarshalBinary

func (m *StateRoot) MarshalBinary() ([]byte, error)

func (*StateRoot) UnmarshalBinary

func (m *StateRoot) UnmarshalBinary(data []byte) error

type Version

type Version struct {
	Major uint8 `json:"major"`
	Minor uint8 `json:"minor"`
	Patch uint8 `json:"patch"`
}

func (*Version) AppendBinary

func (v *Version) AppendBinary(data []byte) ([]byte, error)

func (*Version) FromString

func (v *Version) FromString(s string) error

func (*Version) ReadFrom

func (v *Version) ReadFrom(reader io.Reader) (int64, error)

func (Version) String

func (v Version) String() string

Jump to

Keyboard shortcuts

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