Skip to content

Commit

Permalink
feat: implement ticket based F3 participation lease
Browse files Browse the repository at this point in the history
  • Loading branch information
simlecode committed Oct 11, 2024
1 parent 04aeefa commit 8f16a0b
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 3 deletions.
7 changes: 7 additions & 0 deletions app/submodule/f3/f3_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,10 @@ func (f3api *f3API) F3IsRunning(_ctx context.Context) (bool, error) {
}
return f3api.f3module.F3.IsRunning(), nil
}

func (f3api *f3API) F3GetProgress(context.Context) (gpbft.Instant, error) {
if f3api.f3module.F3 == nil {
return gpbft.Instant{}, types.ErrF3Disabled
}
return f3api.f3module.F3.Progress(), nil
}
2 changes: 1 addition & 1 deletion fixtures/networks/integrationtestnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ func IntegrationNet() *NetworkConf {
ActorDebugging: false,
F3Enabled: true,
F3BootstrapEpoch: -1,
ManifestServerID: "12D3KooWENMwUF9YxvQxar7uBWJtZkA6amvK4xWmKXfSiHUo2Qq7",
ManifestServerID: "12D3KooWHcNBkqXEBrsjoveQvj6zDF3vK5S9tAfqyYaQF1LGSJwG",
F3Consensus: true,
F3InitialPowerTableCID: cid.Undef,
},
Expand Down
1 change: 1 addition & 0 deletions venus-devtool/api-gen/example.go
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ func init() {

addExample(&manifest.Manifest{})
addExample(gpbft.NetworkName("filecoin"))
addExample(gpbft.INITIAL_PHASE)
}

func ExampleValue(method string, t, parent reflect.Type) interface{} {
Expand Down
4 changes: 3 additions & 1 deletion venus-shared/api/chain/v1/f3.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,11 @@ type IF3 interface {
F3GetECPowerTable(ctx context.Context, tsk types.TipSetKey) (gpbft.PowerEntries, error) //perm:read
// F3GetF3PowerTable returns a F3 specific power table.
F3GetF3PowerTable(ctx context.Context, tsk types.TipSetKey) (gpbft.PowerEntries, error) //perm:read
// F3GetGetManifest returns the current manifest being used for F3
// F3GetManifest returns the current manifest being used for F3
F3GetManifest(ctx context.Context) (*manifest.Manifest, error) //perm:read
// F3IsRunning returns true if the F3 instance is running, false if it's not running but
// it's enabled, and an error when disabled entirely.
F3IsRunning(ctx context.Context) (bool, error) //perm:read
// F3GetProgress returns the progress of the current F3 instance in terms of instance ID, round and phase.
F3GetProgress(ctx context.Context) (gpbft.Instant, error) //perm:read
}
20 changes: 19 additions & 1 deletion venus-shared/api/chain/v1/method.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ curl http://<ip>:<port>/rpc/v1 -X POST -H "Content-Type: application/json" -H "
* [F3GetLatestCertificate](#f3getlatestcertificate)
* [F3GetManifest](#f3getmanifest)
* [F3GetOrRenewParticipationTicket](#f3getorrenewparticipationticket)
* [F3GetProgress](#f3getprogress)
* [F3IsRunning](#f3isrunning)
* [F3Participate](#f3participate)
* [Market](#market)
Expand Down Expand Up @@ -3554,7 +3555,7 @@ Response:
```

### F3GetManifest
F3GetGetManifest returns the current manifest being used for F3
F3GetManifest returns the current manifest being used for F3


Perms: read
Expand Down Expand Up @@ -3617,6 +3618,23 @@ Inputs:

Response: `"Bw=="`

### F3GetProgress
F3GetProgress returns the progress of the current F3 instance in terms of instance ID, round and phase.


Perms: read

Inputs: `[]`

Response:
```json
{
"ID": 42,
"Round": 42,
"Phase": 0
}
```

### F3IsRunning
F3IsRunning returns true if the F3 instance is running, false if it's not running but
it's enabled, and an error when disabled entirely.
Expand Down
15 changes: 15 additions & 0 deletions venus-shared/api/chain/v1/mock/mock_fullnode.go

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

4 changes: 4 additions & 0 deletions venus-shared/api/chain/v1/proxy_gen.go

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

1 change: 1 addition & 0 deletions venus-shared/compatible-checks/api-diff.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ github.com/filecoin-project/venus/venus-shared/api/chain/v1.FullNode <> github.c
> EthTraceReplayBlockTransactions {[func(context.Context, string, []string) ([]*types.EthTraceReplayBlockTransaction, error) <> func(context.Context, string, []string) ([]*ethtypes.EthTraceReplayBlockTransaction, error)] base=func out type: #0 input; nested={[[]*types.EthTraceReplayBlockTransaction <> []*ethtypes.EthTraceReplayBlockTransaction] base=slice element; nested={[*types.EthTraceReplayBlockTransaction <> *ethtypes.EthTraceReplayBlockTransaction] base=pointed type; nested={[types.EthTraceReplayBlockTransaction <> ethtypes.EthTraceReplayBlockTransaction] base=struct field; nested={[types.EthTraceReplayBlockTransaction <> ethtypes.EthTraceReplayBlockTransaction] base=exported field name: #4 field, VMTrace != VmTrace; nested=nil}}}}}
+ F3GetManifest
+ F3GetOrRenewParticipationTicket
+ F3GetProgress
+ F3IsRunning
> F3Participate {[func(context.Context, types.F3ParticipationTicket) (types.F3ParticipationLease, error) <> func(context.Context, address.Address, time.Time, time.Time) (bool, error)] base=func in num: 2 != 4; nested=nil}
+ GasBatchEstimateMessageGas
Expand Down
1 change: 1 addition & 0 deletions venus-shared/compatible-checks/api-perm.txt
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ v1: github.com/filecoin-project/venus/venus-shared/api/chain/v1 <> github.com/fi
- EthSubscriber.EthSubscription
- IF3.F3GetManifest
- IF3.F3GetOrRenewParticipationTicket
- IF3.F3GetProgress
- IF3.F3IsRunning
- IMessagePool.GasBatchEstimateMessageGas
- IMessagePool.MpoolDeleteByAdress
Expand Down

0 comments on commit 8f16a0b

Please sign in to comment.