Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add random ContextId when calling executor.ProcessBatch #2575

Merged
merged 1 commit into from
Oct 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions proto/src/proto/executor/v1/executor.proto
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ message ProcessBatchRequest {
map<string, string> db = 13;
map<string, string> contracts_bytecode = 14; // For debug/testing purpposes only. Don't fill this on production
TraceConfig trace_config = 15;
string context_id = 16;
}

message ProcessBatchResponse {
Expand Down
6 changes: 6 additions & 0 deletions state/batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/0xPolygonHermez/zkevm-node/state/runtime/executor"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
"github.com/google/uuid"
"github.com/jackc/pgx/v4"
)

Expand Down Expand Up @@ -182,6 +183,7 @@ func (s *State) ProcessBatch(ctx context.Context, request ProcessRequest, update
UpdateMerkleTree: updateMT,
ChainId: s.cfg.ChainID,
ForkId: forkID,
ContextId: uuid.NewString(),
}
res, err := s.sendBatchRequestToExecutor(ctx, processBatchRequest, request.Caller)
if err != nil {
Expand Down Expand Up @@ -233,6 +235,7 @@ func (s *State) ExecuteBatch(ctx context.Context, batch Batch, updateMerkleTree
UpdateMerkleTree: updateMT,
ChainId: s.cfg.ChainID,
ForkId: forkId,
ContextId: uuid.NewString(),
}

// Send Batch to the Executor
Expand All @@ -247,6 +250,7 @@ func (s *State) ExecuteBatch(ctx context.Context, batch Batch, updateMerkleTree
log.Debugf("ExecuteBatch[processBatchRequest.UpdateMerkleTree]: %v", processBatchRequest.UpdateMerkleTree)
log.Debugf("ExecuteBatch[processBatchRequest.ChainId]: %v", processBatchRequest.ChainId)
log.Debugf("ExecuteBatch[processBatchRequest.ForkId]: %v", processBatchRequest.ForkId)
log.Debugf("ExecuteBatch[processBatchRequest.ContextId]: %v", processBatchRequest.ContextId)

processBatchResponse, err := s.executorClient.ProcessBatch(ctx, processBatchRequest)
if err != nil {
Expand Down Expand Up @@ -314,6 +318,7 @@ func (s *State) processBatch(ctx context.Context, batchNumber uint64, batchL2Dat
UpdateMerkleTree: cTrue,
ChainId: s.cfg.ChainID,
ForkId: forkID,
ContextId: uuid.NewString(),
}

return s.sendBatchRequestToExecutor(ctx, processBatchRequest, caller)
Expand All @@ -336,6 +341,7 @@ func (s *State) sendBatchRequestToExecutor(ctx context.Context, processBatchRequ
log.Debugf("processBatch[processBatchRequest.UpdateMerkleTree]: %v", processBatchRequest.UpdateMerkleTree)
log.Debugf("processBatch[processBatchRequest.ChainId]: %v", processBatchRequest.ChainId)
log.Debugf("processBatch[processBatchRequest.ForkId]: %v", processBatchRequest.ForkId)
log.Debugf("processBatch[processBatchRequest.ContextId]: %v", processBatchRequest.ContextId)
}
now := time.Now()
res, err := s.executorClient.ProcessBatch(ctx, processBatchRequest)
Expand Down
Loading