diff --git a/app/node/node.go b/app/node/node.go index a1582e8401..8fb4a6dda5 100644 --- a/app/node/node.go +++ b/app/node/node.go @@ -252,9 +252,9 @@ func (node *Node) Stop(ctx context.Context) { node.Wallet().WalletGateway.Close() - if err := node.f3.Stop(ctx); err != nil { - log.Warnf("error closing f3: %w", err) - } + // if err := node.f3.Stop(ctx); err != nil { + // log.Warnf("error closing f3: %w", err) + // } } // RunRPCAndWait start rpc server and listen to signal to exit diff --git a/app/submodule/f3/f3_api.go b/app/submodule/f3/f3_api.go index ea2b3ae41e..f433379ae0 100644 --- a/app/submodule/f3/f3_api.go +++ b/app/submodule/f3/f3_api.go @@ -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 +} diff --git a/fixtures/networks/integrationtestnet.go b/fixtures/networks/integrationtestnet.go index c6729a991a..406bd16a3a 100644 --- a/fixtures/networks/integrationtestnet.go +++ b/fixtures/networks/integrationtestnet.go @@ -66,7 +66,7 @@ func IntegrationNet() *NetworkConf { ActorDebugging: false, F3Enabled: true, F3BootstrapEpoch: -1, - ManifestServerID: "12D3KooWENMwUF9YxvQxar7uBWJtZkA6amvK4xWmKXfSiHUo2Qq7", + ManifestServerID: "12D3KooWHcNBkqXEBrsjoveQvj6zDF3vK5S9tAfqyYaQF1LGSJwG", F3Consensus: true, F3InitialPowerTableCID: cid.Undef, }, diff --git a/venus-devtool/api-gen/example.go b/venus-devtool/api-gen/example.go index fb4e5bd1a0..8a54d6e601 100644 --- a/venus-devtool/api-gen/example.go +++ b/venus-devtool/api-gen/example.go @@ -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{} { diff --git a/venus-shared/api/chain/v1/f3.go b/venus-shared/api/chain/v1/f3.go index 96a3e3b523..a3d7b3664a 100644 --- a/venus-shared/api/chain/v1/f3.go +++ b/venus-shared/api/chain/v1/f3.go @@ -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 } diff --git a/venus-shared/api/chain/v1/method.md b/venus-shared/api/chain/v1/method.md index a3cf37721f..ca6500187d 100644 --- a/venus-shared/api/chain/v1/method.md +++ b/venus-shared/api/chain/v1/method.md @@ -121,6 +121,7 @@ curl http://:/rpc/v1 -X POST -H "Content-Type: application/json" -H " * [F3GetLatestCertificate](#f3getlatestcertificate) * [F3GetManifest](#f3getmanifest) * [F3GetOrRenewParticipationTicket](#f3getorrenewparticipationticket) + * [F3GetProgress](#f3getprogress) * [F3IsRunning](#f3isrunning) * [F3Participate](#f3participate) * [Market](#market) @@ -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 @@ -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. diff --git a/venus-shared/api/chain/v1/mock/mock_fullnode.go b/venus-shared/api/chain/v1/mock/mock_fullnode.go index b19f5cece0..7dc3d3a0c6 100644 --- a/venus-shared/api/chain/v1/mock/mock_fullnode.go +++ b/venus-shared/api/chain/v1/mock/mock_fullnode.go @@ -1149,6 +1149,21 @@ func (mr *MockFullNodeMockRecorder) F3GetOrRenewParticipationTicket(arg0, arg1, return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "F3GetOrRenewParticipationTicket", reflect.TypeOf((*MockFullNode)(nil).F3GetOrRenewParticipationTicket), arg0, arg1, arg2, arg3) } +// F3GetProgress mocks base method. +func (m *MockFullNode) F3GetProgress(arg0 context.Context) (gpbft.Instant, error) { + m.ctrl.T.Helper() + ret := m.ctrl.Call(m, "F3GetProgress", arg0) + ret0, _ := ret[0].(gpbft.Instant) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// F3GetProgress indicates an expected call of F3GetProgress. +func (mr *MockFullNodeMockRecorder) F3GetProgress(arg0 interface{}) *gomock.Call { + mr.mock.ctrl.T.Helper() + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "F3GetProgress", reflect.TypeOf((*MockFullNode)(nil).F3GetProgress), arg0) +} + // F3IsRunning mocks base method. func (m *MockFullNode) F3IsRunning(arg0 context.Context) (bool, error) { m.ctrl.T.Helper() diff --git a/venus-shared/api/chain/v1/proxy_gen.go b/venus-shared/api/chain/v1/proxy_gen.go index 7d588b2818..c017362867 100644 --- a/venus-shared/api/chain/v1/proxy_gen.go +++ b/venus-shared/api/chain/v1/proxy_gen.go @@ -1081,6 +1081,7 @@ type IF3Struct struct { F3GetLatestCertificate func(ctx context.Context) (*certs.FinalityCertificate, error) `perm:"read"` F3GetManifest func(ctx context.Context) (*manifest.Manifest, error) `perm:"read"` F3GetOrRenewParticipationTicket func(ctx context.Context, minerID address.Address, previous types.F3ParticipationTicket, instances uint64) (types.F3ParticipationTicket, error) `perm:"sign"` + F3GetProgress func(ctx context.Context) (gpbft.Instant, error) `perm:"read"` F3IsRunning func(ctx context.Context) (bool, error) `perm:"read"` F3Participate func(ctx context.Context, ticket types.F3ParticipationTicket) (types.F3ParticipationLease, error) `perm:"sign"` } @@ -1104,6 +1105,9 @@ func (s *IF3Struct) F3GetManifest(p0 context.Context) (*manifest.Manifest, error func (s *IF3Struct) F3GetOrRenewParticipationTicket(p0 context.Context, p1 address.Address, p2 types.F3ParticipationTicket, p3 uint64) (types.F3ParticipationTicket, error) { return s.Internal.F3GetOrRenewParticipationTicket(p0, p1, p2, p3) } +func (s *IF3Struct) F3GetProgress(p0 context.Context) (gpbft.Instant, error) { + return s.Internal.F3GetProgress(p0) +} func (s *IF3Struct) F3IsRunning(p0 context.Context) (bool, error) { return s.Internal.F3IsRunning(p0) } func (s *IF3Struct) F3Participate(p0 context.Context, p1 types.F3ParticipationTicket) (types.F3ParticipationLease, error) { return s.Internal.F3Participate(p0, p1) diff --git a/venus-shared/compatible-checks/api-diff.txt b/venus-shared/compatible-checks/api-diff.txt index 8f032565eb..2461ee94d3 100644 --- a/venus-shared/compatible-checks/api-diff.txt +++ b/venus-shared/compatible-checks/api-diff.txt @@ -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 diff --git a/venus-shared/compatible-checks/api-perm.txt b/venus-shared/compatible-checks/api-perm.txt index 4771487ecd..e486477183 100644 --- a/venus-shared/compatible-checks/api-perm.txt +++ b/venus-shared/compatible-checks/api-perm.txt @@ -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