f3

package module
v0.0.0-...-7eaa6d1 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0, MIT Imports: 10 Imported by: 0

README

Go implementation of Fast Finality for Filecoin

This repository contains a Go implementation of the Filecoin finality module, F3 (WIP).

This executes an iterative GossiPBFT consensus protocol to declare tipsets as final when voted for by >2/3 of the consensus power.

Status

Work in progress.

This implementation began as a simulation during the protocol design phase. It is currently being transformed into production code, while maintaining and expanding the simulator.

Usage

Run the unit tests to exercise the GossipPBFT protocol.

$ go test ./...

There is also a main entry point to run GossiPBFT instance with honest nodes in simulation.

$ go run ./sim/cmd/f3sim -help
Usage of f3sim:
  -delta-back-off-exponent float
        exponential factor adjusting the delta value per round (default 1.3)
  -granite-delta float
        granite delta parameter (bound on message delay) (default 2)
  -iterations int
        number of simulation iterations (default 1)
  -latency-mean float
        mean network latency in seconds (default 0.5)
  -latency-seed int
        random seed for network latency (default <current time>)
  -max-rounds uint
        max rounds to allow before failing (default 10)
  -participants int
        number of participants (default 3)
  -trace int
        trace verbosity level

Integration

The code does not yet express an API for integration into a Filecoin node. Coming soon!

Structure

Modules:

  • f3: the protocol implementation
  • sim: the simulation harness
  • adversary: specific adversarial behaviors for use in tests
  • test: unit tests which execute the protocol in simulation

License

Dual-licensed under MIT + Apache 2.0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ECBackend

type ECBackend interface{}

type Logger

type Logger interface {
	Debug(args ...interface{})
	Debugf(format string, args ...interface{})
	Error(args ...interface{})
	Errorf(format string, args ...interface{})
	Fatal(args ...interface{})
	Fatalf(format string, args ...interface{})
	Info(args ...interface{})
	Infof(format string, args ...interface{})
	Panic(args ...interface{})
	Panicf(format string, args ...interface{})
	Warn(args ...interface{})
	Warnf(format string, args ...interface{})
}

type Module

type Module struct {
	NetworkName gpbft.NetworkName
	CertStore   *certs.Store
	// contains filtered or unexported fields
}

func NewModule

func NewModule(ctx context.Context, nn gpbft.NetworkName, ds datastore.Datastore, h host.Host,
	ps *pubsub.PubSub, sigs gpbft.Signer, verif gpbft.Verifier, ec ECBackend, log Logger) (*Module, error)

NewModule creates and setups new libp2p f3 module The context is used for initialization not runtime.

func (*Module) Run

func (m *Module) Run(ctx context.Context) error

Run start the module. It will exit when context is cancelled.

type TODOVerifier

type TODOVerifier struct{}

func (*TODOVerifier) Aggregate

func (v *TODOVerifier) Aggregate(sig [][]byte, aggSignature []byte) []byte

Aggregates signatures from a participant to an existing signature.

func (*TODOVerifier) Verify

func (v *TODOVerifier) Verify(pubKey gpbft.PubKey, msg []byte, sig []byte) bool

Verifies a signature for the given sender ID.

func (*TODOVerifier) VerifyAggregate

func (v *TODOVerifier) VerifyAggregate(payload []byte, aggSig []byte, signers []gpbft.PubKey) bool

VerifyAggregate verifies an aggregate signature.

Directories

Path Synopsis
sim

Jump to

Keyboard shortcuts

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