Skip to content

Commit 7ea7564

Browse files
committed
fix a sneakybug
1 parent 3b2bc05 commit 7ea7564

File tree

5 files changed

+13
-18
lines changed

5 files changed

+13
-18
lines changed

protocol/lavasession/consumer_session_manager.go

-11
Original file line numberDiff line numberDiff line change
@@ -925,17 +925,6 @@ func (csm *ConsumerSessionManager) OnSessionFailure(consumerSession *SingleConsu
925925
blockProvider = true
926926
}
927927

928-
if sdkerrors.IsOf(errorReceived, BlockEndpointError) {
929-
utils.LavaFormatTrace("Got BlockEndpointError, blocking endpoint and session",
930-
utils.LogAttr("error", errorReceived),
931-
utils.LogAttr("sessionID", consumerSession.SessionId),
932-
)
933-
934-
// Block the endpoint and the consumer session from future usages
935-
consumerSession.EndpointConnection.blockListed.Store(true)
936-
consumerSession.BlockListed = true
937-
}
938-
939928
consumerSession.QoSManager.AddFailedRelay(consumerSession.epoch, consumerSession.SessionId)
940929
consumerSession.ConsecutiveErrors = append(consumerSession.ConsecutiveErrors, errorReceived)
941930
// copy consecutive errors for report.

protocol/lavasession/consumer_session_manager_test.go

+6-3
Original file line numberDiff line numberDiff line change
@@ -855,9 +855,12 @@ func TestAllProvidersEndpointsDisabled(t *testing.T) {
855855
pairingList := createPairingList("", false)
856856
err := csm.UpdateAllProviders(firstEpochHeight, pairingList) // update the providers.
857857
require.NoError(t, err)
858-
cs, err := csm.GetSessions(ctx, cuForFirstRequest, NewUsedProviders(nil), servicedBlockNumber, "", nil, common.NO_STATE, 0) // get a session
859-
require.Nil(t, cs)
860-
require.Error(t, err)
858+
usedProviders := NewUsedProviders(nil)
859+
cs, err := csm.GetSessions(ctx, cuForFirstRequest, usedProviders, servicedBlockNumber, "", nil, common.NO_STATE, 0) // get a session
860+
require.NoError(t, err)
861+
for key, _ := range cs {
862+
require.Contains(t, csm.currentlyBlockedProviderAddresses, key)
863+
}
861864
}
862865

863866
func TestUpdateAllProviders(t *testing.T) {

protocol/lavasession/consumer_types.go

+5-2
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,10 @@ type EndpointConnection struct {
9696
Client pairingtypes.RelayerClient
9797
connection *grpc.ClientConn
9898
numberOfSessionsUsingThisConnection uint64
99-
blockListed atomic.Bool
100-
lbUniqueId string
99+
// blockListed - currently unused, use it carefully as it will block this provider's endpoint until next epoch without forgiveness.
100+
// Can be used in cases of data reliability, self provider conflict etc..
101+
blockListed atomic.Bool
102+
lbUniqueId string
101103
// In case we got disconnected, we cant reconnect as we might lose stickiness
102104
// with the provider, if its using a load balancer
103105
disconnected bool
@@ -500,6 +502,7 @@ func (cswp *ConsumerSessionsWithProvider) fetchEndpointConnectionFromConsumerSes
500502
if endpointConnection.Client != nil && endpointConnection.connection != nil && !endpointConnection.disconnected {
501503
// Check if the endpoint is not blocked
502504
if endpointConnection.blockListed.Load() {
505+
utils.LavaFormatDebug("Skipping provider's endpoint as its block listed", utils.LogAttr("address", endpoint.NetworkAddress), utils.LogAttr("PublicLavaAddress", cswp.PublicLavaAddress))
503506
continue
504507
}
505508
connectionState := endpointConnection.connection.GetState()

protocol/rpcconsumer/rpcconsumer_server.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ func (rpccs *RPCConsumerServer) relayInner(ctx context.Context, singleConsumerSe
10141014

10151015
if !singleConsumerSession.VerifyProviderUniqueIdAndStoreIfFirstTime(providerUniqueId[0]) {
10161016
return reply, 0, utils.LavaFormatError("provider unique id mismatch",
1017-
errors.Join(lavasession.SessionOutOfSyncError, lavasession.BlockEndpointError),
1017+
lavasession.SessionOutOfSyncError,
10181018
utils.LogAttr("GUID", ctx),
10191019
utils.LogAttr("sessionId", relayRequest.RelaySession.SessionId),
10201020
utils.LogAttr("provider", relayRequest.RelaySession.Provider),

scripts/init_chain.sh

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ else
5959
| jq '.app_state.downtime.params.downtime_duration = "6s"' \
6060
| jq '.app_state.downtime.params.epoch_duration = "10s"' \
6161
| jq '.app_state.epochstorage.params.epochsToSave = "8"' \
62-
| jq '.app_state.epochstorage.params.epochBlocks = "20"' \
62+
| jq '.app_state.epochstorage.params.epochBlocks = "240"' \
6363
| jq '.app_state.pairing.params.recommendedEpochNumToCollectPayment = "2"' \
6464
)
6565
fi

0 commit comments

Comments
 (0)