From 4c6a0e56bca87e1984d3ce35c3565108ddaae2f3 Mon Sep 17 00:00:00 2001 From: simlecode <69969590+simlecode@users.noreply.github.com> Date: Thu, 7 Jul 2022 00:08:13 +0800 Subject: [PATCH] feat: add GasOverPremium for gas estimate --- pkg/messagepool/gas.go | 15 +++++- venus-shared/api/chain/v0/method.md | 12 +++-- venus-shared/api/chain/v1/method.md | 12 +++-- venus-shared/api/market/client/method.md | 3 +- venus-shared/api/market/method.md | 3 +- venus-shared/api/messager/api.go | 22 ++++----- venus-shared/api/messager/method.md | 47 +++++++++++++------ .../api/messager/mock/mock_imessager.go | 8 ++-- venus-shared/api/messager/proxy_gen.go | 6 +-- venus-shared/compatible-checks/api-diff.txt | 12 ++--- venus-shared/types/api_types.go | 1 + venus-shared/types/messager/address.go | 1 + venus-shared/types/messager/spec.go | 3 ++ 13 files changed, 96 insertions(+), 49 deletions(-) diff --git a/pkg/messagepool/gas.go b/pkg/messagepool/gas.go index 4b5a5f1c4b..46e528158a 100644 --- a/pkg/messagepool/gas.go +++ b/pkg/messagepool/gas.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "math" + stdbig "math/big" "math/rand" "sort" @@ -312,6 +313,7 @@ func (mp *MessagePool) GasEstimateMessageGas(ctx context.Context, estimateMessag if estimateMessage == nil || estimateMessage.Msg == nil { return nil, fmt.Errorf("estimate message is nil") } + log.Debugf("call GasEstimateMessageGas %v, send spec: %v", estimateMessage.Msg, estimateMessage.Spec) if estimateMessage.Msg.GasLimit == 0 { gasLimit, err := mp.GasEstimateGasLimit(ctx, estimateMessage.Msg, types.TipSetKey{}) if err != nil { @@ -321,7 +323,6 @@ func (mp *MessagePool) GasEstimateMessageGas(ctx context.Context, estimateMessag if estimateMessage.Spec != nil && estimateMessage.Spec.GasOverEstimation > 0 { gasLimitOverestimation = estimateMessage.Spec.GasOverEstimation } - log.Debugf("call GasEstimateMessageGas %v, spec: %v, config gasLimitOverestimation: %v", estimateMessage.Msg, estimateMessage.Spec, mp.GetConfig().GasLimitOverestimation) estimateMessage.Msg.GasLimit = int64(float64(gasLimit) * gasLimitOverestimation) } @@ -330,6 +331,12 @@ func (mp *MessagePool) GasEstimateMessageGas(ctx context.Context, estimateMessag if err != nil { return nil, fmt.Errorf("estimating gas price: %w", err) } + if estimateMessage.Spec != nil && estimateMessage.Spec.GasOverPremium > 0 { + olgGasPremium := gasPremium + newGasPremium, _ := new(stdbig.Float).Mul(new(stdbig.Float).SetInt(stdbig.NewInt(gasPremium.Int64())), stdbig.NewFloat(estimateMessage.Spec.GasOverPremium)).Int(nil) + gasPremium = big.NewFromGo(newGasPremium) + log.Debugf("call GasEstimateMessageGas old premium %v, new premium %v, premium ration %f", olgGasPremium, newGasPremium, estimateMessage.Spec.GasOverPremium) + } estimateMessage.Msg.GasPremium = gasPremium } @@ -398,6 +405,12 @@ func (mp *MessagePool) GasBatchEstimateMessageGas(ctx context.Context, estimateM }) continue } + if estimateMessage.Spec != nil && estimateMessage.Spec.GasOverPremium > 0 { + olgGasPremium := gasPremium + newGasPremium, _ := new(stdbig.Float).Mul(new(stdbig.Float).SetInt(stdbig.NewInt(gasPremium.Int64())), stdbig.NewFloat(estimateMessage.Spec.GasOverPremium)).Int(nil) + gasPremium = big.NewFromGo(newGasPremium) + log.Debugf("call GasBatchEstimateMessageGas old premium %v, new premium %v, premium ration %f", olgGasPremium, newGasPremium, estimateMessage.Spec.GasOverPremium) + } estimateMsg.GasPremium = gasPremium } diff --git a/venus-shared/api/chain/v0/method.md b/venus-shared/api/chain/v0/method.md index b7102f6a6c..5335d24224 100644 --- a/venus-shared/api/chain/v0/method.md +++ b/venus-shared/api/chain/v0/method.md @@ -1662,7 +1662,8 @@ Inputs: }, "Spec": { "MaxFee": "0", - "GasOverEstimation": 12.3 + "GasOverEstimation": 12.3, + "GasOverPremium": 12.3 } } ], @@ -1824,7 +1825,8 @@ Inputs: }, { "MaxFee": "0", - "GasOverEstimation": 12.3 + "GasOverEstimation": 12.3, + "GasOverPremium": 12.3 }, [ { @@ -1929,7 +1931,8 @@ Inputs: ], { "MaxFee": "0", - "GasOverEstimation": 12.3 + "GasOverEstimation": 12.3, + "GasOverPremium": 12.3 } ] ``` @@ -2240,7 +2243,8 @@ Inputs: }, { "MaxFee": "0", - "GasOverEstimation": 12.3 + "GasOverEstimation": 12.3, + "GasOverPremium": 12.3 } ] ``` diff --git a/venus-shared/api/chain/v1/method.md b/venus-shared/api/chain/v1/method.md index 69ec0e9347..dadbce3916 100644 --- a/venus-shared/api/chain/v1/method.md +++ b/venus-shared/api/chain/v1/method.md @@ -1707,7 +1707,8 @@ Inputs: }, "Spec": { "MaxFee": "0", - "GasOverEstimation": 12.3 + "GasOverEstimation": 12.3, + "GasOverPremium": 12.3 } } ], @@ -1869,7 +1870,8 @@ Inputs: }, { "MaxFee": "0", - "GasOverEstimation": 12.3 + "GasOverEstimation": 12.3, + "GasOverPremium": 12.3 }, [ { @@ -1974,7 +1976,8 @@ Inputs: ], { "MaxFee": "0", - "GasOverEstimation": 12.3 + "GasOverEstimation": 12.3, + "GasOverPremium": 12.3 } ] ``` @@ -2416,7 +2419,8 @@ Inputs: }, { "MaxFee": "0", - "GasOverEstimation": 12.3 + "GasOverEstimation": 12.3, + "GasOverPremium": 12.3 } ] ``` diff --git a/venus-shared/api/market/client/method.md b/venus-shared/api/market/client/method.md index 2c875b635e..72e2762eba 100644 --- a/venus-shared/api/market/client/method.md +++ b/venus-shared/api/market/client/method.md @@ -1195,7 +1195,8 @@ Inputs: }, { "MaxFee": "0", - "GasOverEstimation": 12.3 + "GasOverEstimation": 12.3, + "GasOverPremium": 12.3 } ] ``` diff --git a/venus-shared/api/market/method.md b/venus-shared/api/market/method.md index e18580fac1..da4fae5b7d 100644 --- a/venus-shared/api/market/method.md +++ b/venus-shared/api/market/method.md @@ -1556,7 +1556,8 @@ Inputs: }, { "MaxFee": "0", - "GasOverEstimation": 12.3 + "GasOverEstimation": 12.3, + "GasOverPremium": 12.3 } ] ``` diff --git a/venus-shared/api/messager/api.go b/venus-shared/api/messager/api.go index 93588a3983..148c739902 100644 --- a/venus-shared/api/messager/api.go +++ b/venus-shared/api/messager/api.go @@ -35,17 +35,17 @@ type IMessager interface { MarkBadMessage(ctx context.Context, id string) error //perm:admin RecoverFailedMsg(ctx context.Context, addr address.Address) ([]string, error) //perm:admin - GetAddress(ctx context.Context, addr address.Address) (*types.Address, error) //perm:admin - HasAddress(ctx context.Context, addr address.Address) (bool, error) //perm:read - WalletHas(ctx context.Context, addr address.Address) (bool, error) //perm:read - ListAddress(ctx context.Context) ([]*types.Address, error) //perm:admin - UpdateNonce(ctx context.Context, addr address.Address, nonce uint64) error //perm:admin - DeleteAddress(ctx context.Context, addr address.Address) error //perm:admin - ForbiddenAddress(ctx context.Context, addr address.Address) error //perm:admin - ActiveAddress(ctx context.Context, addr address.Address) error //perm:admin - SetSelectMsgNum(ctx context.Context, addr address.Address, num uint64) error //perm:admin - SetFeeParams(ctx context.Context, addr address.Address, gasOverEstimation float64, maxFee, maxFeeCap string) error //perm:admin - ClearUnFillMessage(ctx context.Context, addr address.Address) (int, error) //perm:admin + GetAddress(ctx context.Context, addr address.Address) (*types.Address, error) //perm:admin + HasAddress(ctx context.Context, addr address.Address) (bool, error) //perm:read + WalletHas(ctx context.Context, addr address.Address) (bool, error) //perm:read + ListAddress(ctx context.Context) ([]*types.Address, error) //perm:admin + UpdateNonce(ctx context.Context, addr address.Address, nonce uint64) error //perm:admin + DeleteAddress(ctx context.Context, addr address.Address) error //perm:admin + ForbiddenAddress(ctx context.Context, addr address.Address) error //perm:admin + ActiveAddress(ctx context.Context, addr address.Address) error //perm:admin + SetSelectMsgNum(ctx context.Context, addr address.Address, num uint64) error //perm:admin + SetFeeParams(ctx context.Context, addr address.Address, gasOverEstimation, gasOverPremium float64, maxFee, maxFeeCap string) error //perm:admin + ClearUnFillMessage(ctx context.Context, addr address.Address) (int, error) //perm:admin GetSharedParams(ctx context.Context) (*types.SharedSpec, error) //perm:admin SetSharedParams(ctx context.Context, params *types.SharedSpec) error //perm:admin diff --git a/venus-shared/api/messager/method.md b/venus-shared/api/messager/method.md index eed5197e81..45de62fa24 100644 --- a/venus-shared/api/messager/method.md +++ b/venus-shared/api/messager/method.md @@ -145,7 +145,8 @@ Inputs: "expireEpoch": 10101, "gasOverEstimation": 12.3, "maxFee": "0", - "maxFeeCap": "0" + "maxFeeCap": "0", + "gasOverPremium": 12.3 } ] ``` @@ -181,7 +182,8 @@ Inputs: "expireEpoch": 10101, "gasOverEstimation": 12.3, "maxFee": "0", - "maxFeeCap": "0" + "maxFeeCap": "0", + "gasOverPremium": 12.3 } ] ``` @@ -212,6 +214,7 @@ Response: "gasOverEstimation": 12.3, "maxFee": "0", "maxFeeCap": "0", + "gasOverPremium": 12.3, "isDeleted": 123, "createAt": "0001-01-01T00:00:00Z", "updateAt": "0001-01-01T00:00:00Z" @@ -274,7 +277,8 @@ Response: "expireEpoch": 10101, "gasOverEstimation": 12.3, "maxFee": "0", - "maxFeeCap": "0" + "maxFeeCap": "0", + "gasOverPremium": 12.3 }, "WalletName": "test", "FromUser": "test", @@ -341,7 +345,8 @@ Response: "expireEpoch": 10101, "gasOverEstimation": 12.3, "maxFee": "0", - "maxFeeCap": "0" + "maxFeeCap": "0", + "gasOverPremium": 12.3 }, "WalletName": "test", "FromUser": "test", @@ -406,7 +411,8 @@ Response: "expireEpoch": 10101, "gasOverEstimation": 12.3, "maxFee": "0", - "maxFeeCap": "0" + "maxFeeCap": "0", + "gasOverPremium": 12.3 }, "WalletName": "test", "FromUser": "test", @@ -473,7 +479,8 @@ Response: "expireEpoch": 10101, "gasOverEstimation": 12.3, "maxFee": "0", - "maxFeeCap": "0" + "maxFeeCap": "0", + "gasOverPremium": 12.3 }, "WalletName": "test", "FromUser": "test", @@ -520,6 +527,7 @@ Response: "gasOverEstimation": 12.3, "maxFee": "0", "maxFeeCap": "0", + "gasOverPremium": 12.3, "selMsgNum": 42 } ``` @@ -586,6 +594,7 @@ Response: "gasOverEstimation": 12.3, "maxFee": "0", "maxFeeCap": "0", + "gasOverPremium": 12.3, "isDeleted": 123, "createAt": "0001-01-01T00:00:00Z", "updateAt": "0001-01-01T00:00:00Z" @@ -650,7 +659,8 @@ Response: "expireEpoch": 10101, "gasOverEstimation": 12.3, "maxFee": "0", - "maxFeeCap": "0" + "maxFeeCap": "0", + "gasOverPremium": 12.3 }, "WalletName": "test", "FromUser": "test", @@ -712,7 +722,8 @@ Response: "expireEpoch": 10101, "gasOverEstimation": 12.3, "maxFee": "0", - "maxFeeCap": "0" + "maxFeeCap": "0", + "gasOverPremium": 12.3 }, "WalletName": "test", "FromUser": "test", @@ -774,7 +785,8 @@ Response: "expireEpoch": 10101, "gasOverEstimation": 12.3, "maxFee": "0", - "maxFeeCap": "0" + "maxFeeCap": "0", + "gasOverPremium": 12.3 }, "WalletName": "test", "FromUser": "test", @@ -841,7 +853,8 @@ Response: "expireEpoch": 10101, "gasOverEstimation": 12.3, "maxFee": "0", - "maxFeeCap": "0" + "maxFeeCap": "0", + "gasOverPremium": 12.3 }, "WalletName": "test", "FromUser": "test", @@ -912,7 +925,8 @@ Response: "expireEpoch": 10101, "gasOverEstimation": 12.3, "maxFee": "0", - "maxFeeCap": "0" + "maxFeeCap": "0", + "gasOverPremium": 12.3 }, "WalletName": "test", "FromUser": "test", @@ -984,7 +998,8 @@ Inputs: "expireEpoch": 10101, "gasOverEstimation": 12.3, "maxFee": "0", - "maxFeeCap": "0" + "maxFeeCap": "0", + "gasOverPremium": 12.3 } ] ``` @@ -1019,7 +1034,8 @@ Inputs: "expireEpoch": 10101, "gasOverEstimation": 12.3, "maxFee": "0", - "maxFeeCap": "0" + "maxFeeCap": "0", + "gasOverPremium": 12.3 } ] ``` @@ -1147,6 +1163,7 @@ Inputs: [ "f01234", 12.3, + 12.3, "string value", "string value" ] @@ -1196,6 +1213,7 @@ Inputs: "gasOverEstimation": 12.3, "maxFee": "0", "maxFeeCap": "0", + "gasOverPremium": 12.3, "selMsgNum": 42 } ] @@ -1312,7 +1330,8 @@ Response: "expireEpoch": 10101, "gasOverEstimation": 12.3, "maxFee": "0", - "maxFeeCap": "0" + "maxFeeCap": "0", + "gasOverPremium": 12.3 }, "WalletName": "test", "FromUser": "test", diff --git a/venus-shared/api/messager/mock/mock_imessager.go b/venus-shared/api/messager/mock/mock_imessager.go index a9af7049e6..746515062e 100644 --- a/venus-shared/api/messager/mock/mock_imessager.go +++ b/venus-shared/api/messager/mock/mock_imessager.go @@ -527,17 +527,17 @@ func (mr *MockIMessagerMockRecorder) Send(arg0, arg1 interface{}) *gomock.Call { } // SetFeeParams mocks base method. -func (m *MockIMessager) SetFeeParams(arg0 context.Context, arg1 address.Address, arg2 float64, arg3, arg4 string) error { +func (m *MockIMessager) SetFeeParams(arg0 context.Context, arg1 address.Address, arg2, arg3 float64, arg4, arg5 string) error { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "SetFeeParams", arg0, arg1, arg2, arg3, arg4) + ret := m.ctrl.Call(m, "SetFeeParams", arg0, arg1, arg2, arg3, arg4, arg5) ret0, _ := ret[0].(error) return ret0 } // SetFeeParams indicates an expected call of SetFeeParams. -func (mr *MockIMessagerMockRecorder) SetFeeParams(arg0, arg1, arg2, arg3, arg4 interface{}) *gomock.Call { +func (mr *MockIMessagerMockRecorder) SetFeeParams(arg0, arg1, arg2, arg3, arg4, arg5 interface{}) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetFeeParams", reflect.TypeOf((*MockIMessager)(nil).SetFeeParams), arg0, arg1, arg2, arg3, arg4) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "SetFeeParams", reflect.TypeOf((*MockIMessager)(nil).SetFeeParams), arg0, arg1, arg2, arg3, arg4, arg5) } // SetLogLevel mocks base method. diff --git a/venus-shared/api/messager/proxy_gen.go b/venus-shared/api/messager/proxy_gen.go index 35519cacd1..28658a6f0c 100644 --- a/venus-shared/api/messager/proxy_gen.go +++ b/venus-shared/api/messager/proxy_gen.go @@ -47,7 +47,7 @@ type IMessagerStruct struct { RepublishMessage func(ctx context.Context, id string) error `perm:"admin"` SaveNode func(ctx context.Context, node *types.Node) error `perm:"admin"` Send func(ctx context.Context, params types.QuickSendParams) (string, error) `perm:"admin"` - SetFeeParams func(ctx context.Context, addr address.Address, gasOverEstimation float64, maxFee, maxFeeCap string) error `perm:"admin"` + SetFeeParams func(ctx context.Context, addr address.Address, gasOverEstimation, gasOverPremium float64, maxFee, maxFeeCap string) error `perm:"admin"` SetLogLevel func(ctx context.Context, level string) error `perm:"admin"` SetSelectMsgNum func(ctx context.Context, addr address.Address, num uint64) error `perm:"admin"` SetSharedParams func(ctx context.Context, params *types.SharedSpec) error `perm:"admin"` @@ -159,8 +159,8 @@ func (s *IMessagerStruct) SaveNode(p0 context.Context, p1 *types.Node) error { func (s *IMessagerStruct) Send(p0 context.Context, p1 types.QuickSendParams) (string, error) { return s.Internal.Send(p0, p1) } -func (s *IMessagerStruct) SetFeeParams(p0 context.Context, p1 address.Address, p2 float64, p3, p4 string) error { - return s.Internal.SetFeeParams(p0, p1, p2, p3, p4) +func (s *IMessagerStruct) SetFeeParams(p0 context.Context, p1 address.Address, p2, p3 float64, p4, p5 string) error { + return s.Internal.SetFeeParams(p0, p1, p2, p3, p4, p5) } func (s *IMessagerStruct) SetLogLevel(p0 context.Context, p1 string) error { return s.Internal.SetLogLevel(p0, p1) diff --git a/venus-shared/compatible-checks/api-diff.txt b/venus-shared/compatible-checks/api-diff.txt index d9ff4007ec..e57c22a569 100644 --- a/venus-shared/compatible-checks/api-diff.txt +++ b/venus-shared/compatible-checks/api-diff.txt @@ -51,7 +51,7 @@ github.com/filecoin-project/venus/venus-shared/api/chain/v0.FullNode <> github.c > GasEstimateFeeCap {[func(context.Context, *internal.Message, int64, types.TipSetKey) (big.Int, error) <> func(context.Context, *types.Message, int64, types.TipSetKey) (big.Int, error)] base=func in type: #3 input; nested={[types.TipSetKey <> types.TipSetKey] base=codec marshaler implementations for codec Cbor: true != false; nested=nil}} > GasEstimateGasLimit {[func(context.Context, *internal.Message, types.TipSetKey) (int64, error) <> func(context.Context, *types.Message, types.TipSetKey) (int64, error)] base=func in type: #2 input; nested={[types.TipSetKey <> types.TipSetKey] base=codec marshaler implementations for codec Cbor: true != false; nested=nil}} > GasEstimateGasPremium {[func(context.Context, uint64, address.Address, int64, types.TipSetKey) (big.Int, error) <> func(context.Context, uint64, address.Address, int64, types.TipSetKey) (big.Int, error)] base=func in type: #4 input; nested={[types.TipSetKey <> types.TipSetKey] base=codec marshaler implementations for codec Cbor: true != false; nested=nil}} - > GasEstimateMessageGas {[func(context.Context, *internal.Message, *types.MessageSendSpec, types.TipSetKey) (*internal.Message, error) <> func(context.Context, *types.Message, *api.MessageSendSpec, types.TipSetKey) (*types.Message, error)] base=func in type: #2 input; nested={[*types.MessageSendSpec <> *api.MessageSendSpec] base=pointed type; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=struct field; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=exported fields count: 2 != 1; nested=nil}}}} + > GasEstimateMessageGas {[func(context.Context, *internal.Message, *types.MessageSendSpec, types.TipSetKey) (*internal.Message, error) <> func(context.Context, *types.Message, *api.MessageSendSpec, types.TipSetKey) (*types.Message, error)] base=func in type: #2 input; nested={[*types.MessageSendSpec <> *api.MessageSendSpec] base=pointed type; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=struct field; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=exported fields count: 3 != 1; nested=nil}}}} + GetActor + GetEntry + GetFullBlock @@ -71,12 +71,12 @@ github.com/filecoin-project/venus/venus-shared/api/chain/v0.FullNode <> github.c + MessageWait > MinerCreateBlock {[func(context.Context, *types.BlockTemplate) (*types.BlockMsg, error) <> func(context.Context, *api.BlockTemplate) (*types.BlockMsg, error)] base=func in type: #1 input; nested={[*types.BlockTemplate <> *api.BlockTemplate] base=pointed type; nested={[types.BlockTemplate <> api.BlockTemplate] base=struct field; nested={[types.BlockTemplate <> api.BlockTemplate] base=exported field type: #1 field named Parents; nested={[types.TipSetKey <> types.TipSetKey] base=codec marshaler implementations for codec Cbor: true != false; nested=nil}}}}} > MinerGetBaseInfo {[func(context.Context, address.Address, abi.ChainEpoch, types.TipSetKey) (*types.MiningBaseInfo, error) <> func(context.Context, address.Address, abi.ChainEpoch, types.TipSetKey) (*api.MiningBaseInfo, error)] base=func in type: #3 input; nested={[types.TipSetKey <> types.TipSetKey] base=codec marshaler implementations for codec Cbor: true != false; nested=nil}} - > MpoolBatchPushMessage {[func(context.Context, []*internal.Message, *types.MessageSendSpec) ([]*types.SignedMessage, error) <> func(context.Context, []*types.Message, *api.MessageSendSpec) ([]*types.SignedMessage, error)] base=func in type: #2 input; nested={[*types.MessageSendSpec <> *api.MessageSendSpec] base=pointed type; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=struct field; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=exported fields count: 2 != 1; nested=nil}}}} + > MpoolBatchPushMessage {[func(context.Context, []*internal.Message, *types.MessageSendSpec) ([]*types.SignedMessage, error) <> func(context.Context, []*types.Message, *api.MessageSendSpec) ([]*types.SignedMessage, error)] base=func in type: #2 input; nested={[*types.MessageSendSpec <> *api.MessageSendSpec] base=pointed type; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=struct field; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=exported fields count: 3 != 1; nested=nil}}}} + MpoolDeleteByAdress > MpoolPending {[func(context.Context, types.TipSetKey) ([]*types.SignedMessage, error) <> func(context.Context, types.TipSetKey) ([]*types.SignedMessage, error)] base=func in type: #1 input; nested={[types.TipSetKey <> types.TipSetKey] base=codec marshaler implementations for codec Cbor: true != false; nested=nil}} + MpoolPublishByAddr + MpoolPublishMessage - > MpoolPushMessage {[func(context.Context, *internal.Message, *types.MessageSendSpec) (*types.SignedMessage, error) <> func(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error)] base=func in type: #2 input; nested={[*types.MessageSendSpec <> *api.MessageSendSpec] base=pointed type; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=struct field; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=exported fields count: 2 != 1; nested=nil}}}} + > MpoolPushMessage {[func(context.Context, *internal.Message, *types.MessageSendSpec) (*types.SignedMessage, error) <> func(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error)] base=func in type: #2 input; nested={[*types.MessageSendSpec <> *api.MessageSendSpec] base=pointed type; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=struct field; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=exported fields count: 3 != 1; nested=nil}}}} > MpoolSelect {[func(context.Context, types.TipSetKey, float64) ([]*types.SignedMessage, error) <> func(context.Context, types.TipSetKey, float64) ([]*types.SignedMessage, error)] base=func in type: #1 input; nested={[types.TipSetKey <> types.TipSetKey] base=codec marshaler implementations for codec Cbor: true != false; nested=nil}} + MpoolSelects > MsigCancel {[func(context.Context, address.Address, uint64, address.Address) (cid.Cid, error) <> func(context.Context, address.Address, uint64, address.Address, big.Int, address.Address, uint64, []uint8) (cid.Cid, error)] base=func in num: 4 != 8; nested=nil} @@ -253,7 +253,7 @@ github.com/filecoin-project/venus/venus-shared/api/chain/v1.FullNode <> github.c > GasEstimateFeeCap {[func(context.Context, *internal.Message, int64, types.TipSetKey) (big.Int, error) <> func(context.Context, *types.Message, int64, types.TipSetKey) (big.Int, error)] base=func in type: #3 input; nested={[types.TipSetKey <> types.TipSetKey] base=codec marshaler implementations for codec Cbor: true != false; nested=nil}} > GasEstimateGasLimit {[func(context.Context, *internal.Message, types.TipSetKey) (int64, error) <> func(context.Context, *types.Message, types.TipSetKey) (int64, error)] base=func in type: #2 input; nested={[types.TipSetKey <> types.TipSetKey] base=codec marshaler implementations for codec Cbor: true != false; nested=nil}} > GasEstimateGasPremium {[func(context.Context, uint64, address.Address, int64, types.TipSetKey) (big.Int, error) <> func(context.Context, uint64, address.Address, int64, types.TipSetKey) (big.Int, error)] base=func in type: #4 input; nested={[types.TipSetKey <> types.TipSetKey] base=codec marshaler implementations for codec Cbor: true != false; nested=nil}} - > GasEstimateMessageGas {[func(context.Context, *internal.Message, *types.MessageSendSpec, types.TipSetKey) (*internal.Message, error) <> func(context.Context, *types.Message, *api.MessageSendSpec, types.TipSetKey) (*types.Message, error)] base=func in type: #2 input; nested={[*types.MessageSendSpec <> *api.MessageSendSpec] base=pointed type; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=struct field; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=exported fields count: 2 != 1; nested=nil}}}} + > GasEstimateMessageGas {[func(context.Context, *internal.Message, *types.MessageSendSpec, types.TipSetKey) (*internal.Message, error) <> func(context.Context, *types.Message, *api.MessageSendSpec, types.TipSetKey) (*types.Message, error)] base=func in type: #2 input; nested={[*types.MessageSendSpec <> *api.MessageSendSpec] base=pointed type; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=struct field; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=exported fields count: 3 != 1; nested=nil}}}} + GetActor + GetEntry + GetFullBlock @@ -273,12 +273,12 @@ github.com/filecoin-project/venus/venus-shared/api/chain/v1.FullNode <> github.c + MessageWait > MinerCreateBlock {[func(context.Context, *types.BlockTemplate) (*types.BlockMsg, error) <> func(context.Context, *api.BlockTemplate) (*types.BlockMsg, error)] base=func in type: #1 input; nested={[*types.BlockTemplate <> *api.BlockTemplate] base=pointed type; nested={[types.BlockTemplate <> api.BlockTemplate] base=struct field; nested={[types.BlockTemplate <> api.BlockTemplate] base=exported field type: #1 field named Parents; nested={[types.TipSetKey <> types.TipSetKey] base=codec marshaler implementations for codec Cbor: true != false; nested=nil}}}}} > MinerGetBaseInfo {[func(context.Context, address.Address, abi.ChainEpoch, types.TipSetKey) (*types.MiningBaseInfo, error) <> func(context.Context, address.Address, abi.ChainEpoch, types.TipSetKey) (*api.MiningBaseInfo, error)] base=func in type: #3 input; nested={[types.TipSetKey <> types.TipSetKey] base=codec marshaler implementations for codec Cbor: true != false; nested=nil}} - > MpoolBatchPushMessage {[func(context.Context, []*internal.Message, *types.MessageSendSpec) ([]*types.SignedMessage, error) <> func(context.Context, []*types.Message, *api.MessageSendSpec) ([]*types.SignedMessage, error)] base=func in type: #2 input; nested={[*types.MessageSendSpec <> *api.MessageSendSpec] base=pointed type; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=struct field; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=exported fields count: 2 != 1; nested=nil}}}} + > MpoolBatchPushMessage {[func(context.Context, []*internal.Message, *types.MessageSendSpec) ([]*types.SignedMessage, error) <> func(context.Context, []*types.Message, *api.MessageSendSpec) ([]*types.SignedMessage, error)] base=func in type: #2 input; nested={[*types.MessageSendSpec <> *api.MessageSendSpec] base=pointed type; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=struct field; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=exported fields count: 3 != 1; nested=nil}}}} + MpoolDeleteByAdress > MpoolPending {[func(context.Context, types.TipSetKey) ([]*types.SignedMessage, error) <> func(context.Context, types.TipSetKey) ([]*types.SignedMessage, error)] base=func in type: #1 input; nested={[types.TipSetKey <> types.TipSetKey] base=codec marshaler implementations for codec Cbor: true != false; nested=nil}} + MpoolPublishByAddr + MpoolPublishMessage - > MpoolPushMessage {[func(context.Context, *internal.Message, *types.MessageSendSpec) (*types.SignedMessage, error) <> func(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error)] base=func in type: #2 input; nested={[*types.MessageSendSpec <> *api.MessageSendSpec] base=pointed type; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=struct field; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=exported fields count: 2 != 1; nested=nil}}}} + > MpoolPushMessage {[func(context.Context, *internal.Message, *types.MessageSendSpec) (*types.SignedMessage, error) <> func(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error)] base=func in type: #2 input; nested={[*types.MessageSendSpec <> *api.MessageSendSpec] base=pointed type; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=struct field; nested={[types.MessageSendSpec <> api.MessageSendSpec] base=exported fields count: 3 != 1; nested=nil}}}} > MpoolSelect {[func(context.Context, types.TipSetKey, float64) ([]*types.SignedMessage, error) <> func(context.Context, types.TipSetKey, float64) ([]*types.SignedMessage, error)] base=func in type: #1 input; nested={[types.TipSetKey <> types.TipSetKey] base=codec marshaler implementations for codec Cbor: true != false; nested=nil}} + MpoolSelects - MsigGetAvailableBalance diff --git a/venus-shared/types/api_types.go b/venus-shared/types/api_types.go index 3b7262522c..3d5129f038 100644 --- a/venus-shared/types/api_types.go +++ b/venus-shared/types/api_types.go @@ -185,6 +185,7 @@ type EstimateResult struct { type MessageSendSpec struct { MaxFee abi.TokenAmount GasOverEstimation float64 + GasOverPremium float64 } // Version provides various build-time information diff --git a/venus-shared/types/messager/address.go b/venus-shared/types/messager/address.go index 44bf3d2a19..29910e246f 100644 --- a/venus-shared/types/messager/address.go +++ b/venus-shared/types/messager/address.go @@ -51,6 +51,7 @@ type Address struct { GasOverEstimation float64 `json:"gasOverEstimation"` MaxFee big.Int `json:"maxFee,omitempty"` MaxFeeCap big.Int `json:"maxFeeCap"` + GasOverPremium float64 `json:"gasOverPremium"` IsDeleted int `json:"isDeleted"` // 是否删除 1:是 -1:否 CreatedAt time.Time `json:"createAt"` // 创建时间 diff --git a/venus-shared/types/messager/spec.go b/venus-shared/types/messager/spec.go index 63e7e55992..f970d87708 100644 --- a/venus-shared/types/messager/spec.go +++ b/venus-shared/types/messager/spec.go @@ -10,6 +10,7 @@ type SendSpec struct { GasOverEstimation float64 `json:"gasOverEstimation"` MaxFee big.Int `json:"maxFee,omitempty"` MaxFeeCap big.Int `json:"maxFeeCap"` + GasOverPremium float64 `json:"gasOverPremium"` } type SharedSpec struct { @@ -18,6 +19,7 @@ type SharedSpec struct { GasOverEstimation float64 `json:"gasOverEstimation"` MaxFee big.Int `json:"maxFee,omitempty"` MaxFeeCap big.Int `json:"maxFeeCap"` + GasOverPremium float64 `json:"gasOverPremium"` SelMsgNum uint64 `json:"selMsgNum"` } @@ -31,5 +33,6 @@ func (ss *SharedSpec) GetSendSpec() *SendSpec { GasOverEstimation: ss.GasOverEstimation, MaxFee: ss.MaxFee, MaxFeeCap: ss.MaxFeeCap, + GasOverPremium: ss.GasOverPremium, } }