From 474a01a61d9bf962820f2623ba21dbac1bd50192 Mon Sep 17 00:00:00 2001 From: goshawk Date: Thu, 3 Mar 2022 16:16:05 +0200 Subject: [PATCH] Remove Deadline context for Accept, Finalize and Persist rusk grpc calls --- pkg/core/data/ipc/transactions/provider.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/pkg/core/data/ipc/transactions/provider.go b/pkg/core/data/ipc/transactions/provider.go index a59475718..12c32ce17 100644 --- a/pkg/core/data/ipc/transactions/provider.go +++ b/pkg/core/data/ipc/transactions/provider.go @@ -164,9 +164,9 @@ func (e *executor) Finalize(ctx context.Context, calls []ContractCall, stateRoot vstr.Txs[i] = tx } - ctx, cancel := context.WithDeadline(ctx, time.Now().Add(e.txTimeout)) - defer cancel() - + // No deadline grpc call. It's all or nothing. This is to avoid a scenario + // where grpc call returns DeadlineExceeded error which may end up into an + // inconsistency between rusk and dusk service states. res, err := e.stateClient.Finalize(ctx, vstr) if err != nil { return nil, user.Provisioners{}, nil, err @@ -212,9 +212,9 @@ func (e *executor) Accept(ctx context.Context, calls []ContractCall, stateRoot [ vstr.Txs[i] = tx } - ctx, cancel := context.WithDeadline(ctx, time.Now().Add(e.txTimeout)) - defer cancel() - + // No deadline grpc call. It's all or nothing. This is to avoid a scenario + // where grpc call returns DeadlineExceeded error which may end up into an + // inconsistency between rusk and dusk service states. res, err := e.stateClient.Accept(ctx, vstr) if err != nil { return nil, user.Provisioners{}, nil, err @@ -343,11 +343,11 @@ func (e *executor) GetStateRoot(ctx context.Context) ([]byte, error) { // Persist proxy call to state.Persist grpc. func (e *executor) Persist(ctx context.Context, stateRoot []byte) error { - ctx, cancel := context.WithDeadline(ctx, time.Now().Add(e.txTimeout)) - defer cancel() - req := &rusk.PersistRequest{StateRoot: stateRoot} + // No deadline grpc call. It's all or nothing. This is to avoid a scenario + // where grpc call returns DeadlineExceeded error which may end up into an + // inconsistency between rusk and dusk service states. _, err := e.stateClient.Persist(ctx, req) if err != nil { return err