Skip to content

Commit

Permalink
feat: F3: Update go-f3, change the style of participation call (#12196)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kubuxu authored and rjan90 committed Jul 22, 2024
1 parent 21f8f95 commit d04884b
Show file tree
Hide file tree
Showing 19 changed files with 1,047 additions and 596 deletions.
23 changes: 16 additions & 7 deletions api/api_full.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
"github.com/filecoin-project/go-f3/certs"
"github.com/filecoin-project/go-f3/gpbft"
"github.com/filecoin-project/go-jsonrpc"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
Expand Down Expand Up @@ -861,17 +862,25 @@ type FullNode interface {
// This is an EXPERIMENTAL API and may be subject to change.
SubscribeActorEventsRaw(ctx context.Context, filter *types.ActorEventFilter) (<-chan *types.ActorEvent, error) //perm:read

// F3Participate should be called by a miner node to participate in signing F3 consensus.
// The address should be of type ID
// The returned channel will never be closed by the F3
// If it is closed without the context being cancelled, the caller should retry.
// The values returned on the channel will inform the caller about participation
// Empty strings will be sent if participation succeeded, non-empty strings explain possible errors.
F3Participate(ctx context.Context, minerID address.Address) (<-chan string, error) //perm:admin
// F3Participate should be called by a storage provider to participate in signing F3 consensus.
// Calling this API gives the lotus node a lease to sign in F3 on behalf of given SP.
// The lease should be active only on one node. The lease will expire at the newLeaseExpiration.
// To continue participating in F3 with the given node, call F3Participate again before
// the newLeaseExpiration time.
// newLeaseExpiration cannot be further than 5 minutes in the future.
// It is recommended to call F3Participate every 60 seconds
// with newLeaseExpiration set 2min into the future.
// The oldLeaseExpiration has to be set to newLeaseExpiration of the last successfull call.
// For the first call to F3Participate, set the oldLeaseExpiration to zero value/time in the past.
// F3Participate will return true if the lease was accepted.
// The minerID has to be the ID address of the miner.
F3Participate(ctx context.Context, minerID address.Address, newLeaseExpiration time.Time, oldLeaseExpiration time.Time) (bool, error) //perm:sign
// F3GetCertificate returns a finality certificate at given instance number
F3GetCertificate(ctx context.Context, instance uint64) (*certs.FinalityCertificate, error) //perm:read
// F3GetLatestCertificate returns the latest finality certificate
F3GetLatestCertificate(ctx context.Context) (*certs.FinalityCertificate, error) //perm:read
// F3GetPowerTable returns a F3 specific power table for use in standalone F3 nodes.
F3GetPowerTable(ctx context.Context, tsk types.TipSetKey) (gpbft.PowerEntries, error) //perm:read
}

// reverse interface to the client, called after EthSubscribe
Expand Down
2 changes: 2 additions & 0 deletions api/docgen/docgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
"github.com/filecoin-project/go-f3/certs"
"github.com/filecoin-project/go-f3/gpbft"
"github.com/filecoin-project/go-jsonrpc/auth"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
Expand Down Expand Up @@ -401,6 +402,7 @@ func init() {
ToHeight: epochPtr(1020),
})
addExample(&certs.FinalityCertificate{})
addExample(gpbft.ActorID(1000))
}

func GetAPIType(name, pkg string) (i interface{}, t reflect.Type, permStruct []reflect.Type) {
Expand Down
26 changes: 21 additions & 5 deletions api/mocks/mock_full.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 20 additions & 6 deletions api/proxy_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit d04884b

Please sign in to comment.