From 78876947a4ea0efc7f7a99e3806e1b8eb5aba9bf Mon Sep 17 00:00:00 2001 From: vyzo Date: Wed, 26 Aug 2020 15:03:13 +0300 Subject: [PATCH] ErrBroadcastAnyway is now ErrValidationFailure --- chain/messagepool/messagepool.go | 12 ++++++------ chain/sub/incoming.go | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/chain/messagepool/messagepool.go b/chain/messagepool/messagepool.go index 40b9b86eb..3013e5e93 100644 --- a/chain/messagepool/messagepool.go +++ b/chain/messagepool/messagepool.go @@ -59,8 +59,8 @@ var ( ErrInvalidToAddr = errors.New("message had invalid to address") - ErrBroadcastAnyway = errors.New("validation failure") - ErrRBFTooLowPremium = errors.New("replace by fee has too low GasPremium") + ErrValidationFailure = errors.New("validation failure") + ErrRBFTooLowPremium = errors.New("replace by fee has too low GasPremium") ErrTryAgain = errors.New("state inconsistency while pushing message; please try again") ) @@ -414,7 +414,7 @@ func (mp *MessagePool) VerifyMsgSig(m *types.SignedMessage) error { func (mp *MessagePool) checkBalance(m *types.SignedMessage, curTs *types.TipSet) error { balance, err := mp.getStateBalance(m.Message.From, curTs) if err != nil { - return xerrors.Errorf("failed to check sender balance: %s: %w", err, ErrBroadcastAnyway) + return xerrors.Errorf("failed to check sender balance: %s: %w", err, ErrValidationFailure) } requiredFunds := types.BigAdd(m.Message.RequiredFunds(), m.Message.Value) @@ -426,9 +426,9 @@ func (mp *MessagePool) checkBalance(m *types.SignedMessage, curTs *types.TipSet) if ok { requiredFunds = types.BigAdd(requiredFunds, types.BigInt{Int: mset.requiredFunds}) if balance.LessThan(requiredFunds) { - // Note: we fail here for ErrBroadcastAnyway to signal a soft failure because we might + // Note: we fail here for ErrValidationFailure to signal a soft failure because we might // be out of sync. - return xerrors.Errorf("not enough funds (required: %s, balance: %s): %w", types.FIL(requiredFunds), types.FIL(balance), ErrBroadcastAnyway) + return xerrors.Errorf("not enough funds including pending messages (required: %s, balance: %s): %w", types.FIL(requiredFunds), types.FIL(balance), ErrValidationFailure) } } @@ -438,7 +438,7 @@ func (mp *MessagePool) checkBalance(m *types.SignedMessage, curTs *types.TipSet) func (mp *MessagePool) addTs(m *types.SignedMessage, curTs *types.TipSet) error { snonce, err := mp.getStateNonce(m.Message.From, curTs) if err != nil { - return xerrors.Errorf("failed to look up actor state nonce: %s: %w", err, ErrBroadcastAnyway) + return xerrors.Errorf("failed to look up actor state nonce: %s: %w", err, ErrValidationFailure) } if snonce > m.Message.Nonce { diff --git a/chain/sub/incoming.go b/chain/sub/incoming.go index c036bf1f6..9edbb64a2 100644 --- a/chain/sub/incoming.go +++ b/chain/sub/incoming.go @@ -545,7 +545,7 @@ func (mv *MessageValidator) Validate(ctx context.Context, pid peer.ID, msg *pubs ) stats.Record(ctx, metrics.MessageValidationFailure.M(1)) switch { - case xerrors.Is(err, messagepool.ErrBroadcastAnyway): + case xerrors.Is(err, messagepool.ErrValidationFailure): fallthrough case xerrors.Is(err, messagepool.ErrRBFTooLowPremium): fallthrough