From 5736197b4ea0b30f89ea8fb3df8aa6376b952f22 Mon Sep 17 00:00:00 2001 From: simlecode <69969590+simlecode@users.noreply.github.com> Date: Wed, 22 Jun 2022 17:58:11 +0800 Subject: [PATCH] fix: deprecate three functions --- app/submodule/chain/chaininfo_api.go | 3 +++ pkg/messagepool/gas.go | 2 +- tools/conformance/rand_record.go | 6 +++--- venus-shared/api/chain/v1/chain.go | 19 +++++++++++-------- venus-shared/api/chain/v1/method.md | 3 +++ 5 files changed, 21 insertions(+), 12 deletions(-) diff --git a/app/submodule/chain/chaininfo_api.go b/app/submodule/chain/chaininfo_api.go index dcbb983f09..d129ba78d9 100644 --- a/app/submodule/chain/chaininfo_api.go +++ b/app/submodule/chain/chaininfo_api.go @@ -341,6 +341,7 @@ func (cia *chainInfoAPI) VerifyEntry(parent, child *types.BeaconEntry, height ab // BeaconGetEntry returns the beacon entry for the given filecoin epoch. If // the entry has not yet been produced, the call will block until the entry // becomes available +// Deprecated: Use StateGetBeaconEntry instead. func (cia *chainInfoAPI) BeaconGetEntry(ctx context.Context, epoch abi.ChainEpoch) (*types.BeaconEntry, error) { return cia.StateGetBeaconEntry(ctx, epoch) } @@ -385,11 +386,13 @@ func (cia *chainInfoAPI) getNetworkName(ctx context.Context) (string, error) { } // ChainGetRandomnessFromBeacon is used to sample the beacon for randomness. +// Deprecated: Use StateGetRandomnessFromBeacon instead. func (cia *chainInfoAPI) ChainGetRandomnessFromBeacon(ctx context.Context, key types.TipSetKey, personalization acrypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error) { return cia.StateGetRandomnessFromBeacon(ctx, personalization, randEpoch, entropy, key) } // ChainGetRandomnessFromTickets is used to sample the chain for randomness. +// Deprecated: Use StateGetRandomnessFromTickets instead. func (cia *chainInfoAPI) ChainGetRandomnessFromTickets(ctx context.Context, tsk types.TipSetKey, personalization acrypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error) { return cia.StateGetRandomnessFromTickets(ctx, personalization, randEpoch, entropy, tsk) } diff --git a/pkg/messagepool/gas.go b/pkg/messagepool/gas.go index 43ed09643d..4b5a5f1c4b 100644 --- a/pkg/messagepool/gas.go +++ b/pkg/messagepool/gas.go @@ -289,7 +289,7 @@ func (mp *MessagePool) evalMessageGasLimit(ctx context.Context, msgIn *types.Mes // skip storage market, 80th percentie for everything ~1.9, leave it at 2.0 }() - log.Infof("overestimate gas around the upgrade %v", transitionalMulti) + log.Infof("overestimate gas around the upgrade msg: %v, transitional multi: %v", msg, transitionalMulti) } ret = (ret * int64(transitionalMulti*1024)) >> 10 diff --git a/tools/conformance/rand_record.go b/tools/conformance/rand_record.go index 59c798d2c1..4f46e3ab47 100644 --- a/tools/conformance/rand_record.go +++ b/tools/conformance/rand_record.go @@ -62,8 +62,8 @@ func (r *RecordingRand) GetChainRandomnessV1(ctx context.Context, pers crypto.Do func (r *RecordingRand) getChainRandomness(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) { r.once.Do(r.loadHead) - // FullNode's ChainGetRandomnessFromTickets handles whether we should be looking forward or back - ret, err := r.api.ChainGetRandomnessFromTickets(ctx, r.head, pers, round, entropy) + // FullNode's StateGetRandomnessFromTickets handles whether we should be looking forward or back + ret, err := r.api.StateGetRandomnessFromTickets(ctx, pers, round, entropy, r.head) if err != nil { return ret, err } @@ -100,7 +100,7 @@ func (r *RecordingRand) GetBeaconRandomnessV2(ctx context.Context, pers crypto.D func (r *RecordingRand) getBeaconRandomness(ctx context.Context, pers crypto.DomainSeparationTag, round abi.ChainEpoch, entropy []byte) ([]byte, error) { r.once.Do(r.loadHead) - ret, err := r.api.ChainGetRandomnessFromBeacon(ctx, r.head, pers, round, entropy) + ret, err := r.api.StateGetRandomnessFromBeacon(ctx, pers, round, entropy, r.head) if err != nil { return ret, err } diff --git a/venus-shared/api/chain/v1/chain.go b/venus-shared/api/chain/v1/chain.go index b69e78a47c..20b5e0ad66 100644 --- a/venus-shared/api/chain/v1/chain.go +++ b/venus-shared/api/chain/v1/chain.go @@ -36,18 +36,21 @@ type IActor interface { } type IBeacon interface { + // Deprecated: Use StateGetBeaconEntry instead. BeaconGetEntry(ctx context.Context, epoch abi.ChainEpoch) (*types.BeaconEntry, error) //perm:read } type IChainInfo interface { - BlockTime(ctx context.Context) time.Duration //perm:read - ChainList(ctx context.Context, tsKey types.TipSetKey, count int) ([]types.TipSetKey, error) //perm:read - ChainHead(ctx context.Context) (*types.TipSet, error) //perm:read - ChainSetHead(ctx context.Context, key types.TipSetKey) error //perm:admin - ChainGetTipSet(ctx context.Context, key types.TipSetKey) (*types.TipSet, error) //perm:read - ChainGetTipSetByHeight(ctx context.Context, height abi.ChainEpoch, tsk types.TipSetKey) (*types.TipSet, error) //perm:read - ChainGetTipSetAfterHeight(ctx context.Context, height abi.ChainEpoch, tsk types.TipSetKey) (*types.TipSet, error) //perm:read - ChainGetRandomnessFromBeacon(ctx context.Context, key types.TipSetKey, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error) //perm:read + BlockTime(ctx context.Context) time.Duration //perm:read + ChainList(ctx context.Context, tsKey types.TipSetKey, count int) ([]types.TipSetKey, error) //perm:read + ChainHead(ctx context.Context) (*types.TipSet, error) //perm:read + ChainSetHead(ctx context.Context, key types.TipSetKey) error //perm:admin + ChainGetTipSet(ctx context.Context, key types.TipSetKey) (*types.TipSet, error) //perm:read + ChainGetTipSetByHeight(ctx context.Context, height abi.ChainEpoch, tsk types.TipSetKey) (*types.TipSet, error) //perm:read + ChainGetTipSetAfterHeight(ctx context.Context, height abi.ChainEpoch, tsk types.TipSetKey) (*types.TipSet, error) //perm:read + // Deprecated: Use StateGetRandomnessFromBeacon instead. + ChainGetRandomnessFromBeacon(ctx context.Context, key types.TipSetKey, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error) //perm:read + // Deprecated: Use StateGetRandomnessFromTickets instead. ChainGetRandomnessFromTickets(ctx context.Context, tsk types.TipSetKey, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte) (abi.Randomness, error) //perm:read StateGetRandomnessFromTickets(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tsk types.TipSetKey) (abi.Randomness, error) //perm:read StateGetRandomnessFromBeacon(ctx context.Context, personalization crypto.DomainSeparationTag, randEpoch abi.ChainEpoch, entropy []byte, tsk types.TipSetKey) (abi.Randomness, error) //perm:read diff --git a/venus-shared/api/chain/v1/method.md b/venus-shared/api/chain/v1/method.md index 6f3132a1ee..e1264868a2 100644 --- a/venus-shared/api/chain/v1/method.md +++ b/venus-shared/api/chain/v1/method.md @@ -256,6 +256,7 @@ Response: ## Beacon ### BeaconGetEntry +Deprecated: Use StateGetBeaconEntry instead. Perms: read @@ -704,6 +705,7 @@ Response: ``` ### ChainGetRandomnessFromBeacon +Deprecated: Use StateGetRandomnessFromBeacon instead. Perms: read @@ -728,6 +730,7 @@ Inputs: Response: `"Bw=="` ### ChainGetRandomnessFromTickets +Deprecated: Use StateGetRandomnessFromTickets instead. Perms: read