don't check baseFee lower bound for local messages
This commit is contained in:
parent
1c0e6d76f0
commit
f9492691a6
@ -355,7 +355,7 @@ func (mp *MessagePool) addLocal(m *types.SignedMessage, msgb []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mp *MessagePool) verifyMsgBeforeAdd(m *types.SignedMessage, curTs *types.TipSet) error {
|
func (mp *MessagePool) verifyMsgBeforeAdd(m *types.SignedMessage, curTs *types.TipSet, local bool) error {
|
||||||
epoch := curTs.Height()
|
epoch := curTs.Height()
|
||||||
minGas := vm.PricelistByEpoch(epoch).OnChainMessage(m.ChainLength())
|
minGas := vm.PricelistByEpoch(epoch).OnChainMessage(m.ChainLength())
|
||||||
|
|
||||||
@ -368,6 +368,9 @@ func (mp *MessagePool) verifyMsgBeforeAdd(m *types.SignedMessage, curTs *types.T
|
|||||||
// on republish to push it through later, if the baseFee has fallen.
|
// on republish to push it through later, if the baseFee has fallen.
|
||||||
// this is a defensive check that stops minimum baseFee spam attacks from overloading validation
|
// this is a defensive check that stops minimum baseFee spam attacks from overloading validation
|
||||||
// queues.
|
// queues.
|
||||||
|
// Note that we don't do that for local messages, so that they can be accepted and republished
|
||||||
|
// automatically
|
||||||
|
if !local {
|
||||||
baseFee, err := mp.api.ChainComputeBaseFee(context.TODO(), curTs)
|
baseFee, err := mp.api.ChainComputeBaseFee(context.TODO(), curTs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("error computing base fee: %w", err)
|
return xerrors.Errorf("error computing base fee: %w", err)
|
||||||
@ -378,6 +381,7 @@ func (mp *MessagePool) verifyMsgBeforeAdd(m *types.SignedMessage, curTs *types.T
|
|||||||
return xerrors.Errorf("GasFeeCap doesn't meet base fee lower bound for inclusion in the next 20 blocks (GasFeeCap: %s, baseFeeLowerBound: %s): %w",
|
return xerrors.Errorf("GasFeeCap doesn't meet base fee lower bound for inclusion in the next 20 blocks (GasFeeCap: %s, baseFeeLowerBound: %s): %w",
|
||||||
m.Message.GasFeeCap, baseFeeLowerBound, ErrSoftValidationFailure)
|
m.Message.GasFeeCap, baseFeeLowerBound, ErrSoftValidationFailure)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@ -400,7 +404,7 @@ func (mp *MessagePool) Push(m *types.SignedMessage) (cid.Cid, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mp.curTsLk.Lock()
|
mp.curTsLk.Lock()
|
||||||
if err := mp.addTs(m, mp.curTs); err != nil {
|
if err := mp.addTs(m, mp.curTs, true); err != nil {
|
||||||
mp.curTsLk.Unlock()
|
mp.curTsLk.Unlock()
|
||||||
return cid.Undef, err
|
return cid.Undef, err
|
||||||
}
|
}
|
||||||
@ -461,7 +465,7 @@ func (mp *MessagePool) Add(m *types.SignedMessage) error {
|
|||||||
|
|
||||||
mp.curTsLk.Lock()
|
mp.curTsLk.Lock()
|
||||||
defer mp.curTsLk.Unlock()
|
defer mp.curTsLk.Unlock()
|
||||||
return mp.addTs(m, mp.curTs)
|
return mp.addTs(m, mp.curTs, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
func sigCacheKey(m *types.SignedMessage) (string, error) {
|
func sigCacheKey(m *types.SignedMessage) (string, error) {
|
||||||
@ -528,7 +532,7 @@ func (mp *MessagePool) checkBalance(m *types.SignedMessage, curTs *types.TipSet)
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mp *MessagePool) addTs(m *types.SignedMessage, curTs *types.TipSet) error {
|
func (mp *MessagePool) addTs(m *types.SignedMessage, curTs *types.TipSet, local bool) error {
|
||||||
snonce, err := mp.getStateNonce(m.Message.From, curTs)
|
snonce, err := mp.getStateNonce(m.Message.From, curTs)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("failed to look up actor state nonce: %s: %w", err, ErrSoftValidationFailure)
|
return xerrors.Errorf("failed to look up actor state nonce: %s: %w", err, ErrSoftValidationFailure)
|
||||||
@ -541,7 +545,7 @@ func (mp *MessagePool) addTs(m *types.SignedMessage, curTs *types.TipSet) error
|
|||||||
mp.lk.Lock()
|
mp.lk.Lock()
|
||||||
defer mp.lk.Unlock()
|
defer mp.lk.Unlock()
|
||||||
|
|
||||||
if err := mp.verifyMsgBeforeAdd(m, curTs); err != nil {
|
if err := mp.verifyMsgBeforeAdd(m, curTs, local); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -575,7 +579,7 @@ func (mp *MessagePool) addLoaded(m *types.SignedMessage) error {
|
|||||||
mp.lk.Lock()
|
mp.lk.Lock()
|
||||||
defer mp.lk.Unlock()
|
defer mp.lk.Unlock()
|
||||||
|
|
||||||
if err := mp.verifyMsgBeforeAdd(m, curTs); err != nil {
|
if err := mp.verifyMsgBeforeAdd(m, curTs, true); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -761,7 +765,7 @@ func (mp *MessagePool) PushWithNonce(ctx context.Context, addr address.Address,
|
|||||||
return nil, ErrTryAgain
|
return nil, ErrTryAgain
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := mp.verifyMsgBeforeAdd(msg, curTs); err != nil {
|
if err := mp.verifyMsgBeforeAdd(msg, curTs, true); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user