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

Publish correct tally completion event values #441

Merged
merged 1 commit into from
Dec 12, 2024
Merged
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
14 changes: 6 additions & 8 deletions x/tally/keeper/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ func (k Keeper) ProcessTallies(ctx sdk.Context, coreContract sdk.AccAddress) err
SedaPayload: req.SedaPayload,
}

var result TallyResult
switch {
case len(req.Commits) < int(req.ReplicationFactor):
dataResults[i].Result = []byte(fmt.Sprintf("need %d commits; received %d", req.ReplicationFactor, len(req.Commits)))
Expand All @@ -104,28 +103,27 @@ func (k Keeper) ProcessTallies(ctx sdk.Context, coreContract sdk.AccAddress) err
dataResults[i].ExitCode = batchingtypes.TallyExitCodeNotEnoughReveals
k.Logger(ctx).Info("data request's number of reveals did not meet replication factor", "request_id", req.ID)
default:
result, err := k.FilterAndTally(ctx, req)
tallyResults[i], err = k.FilterAndTally(ctx, req)
if err != nil {
dataResults[i].ExitCode = batchingtypes.TallyExitCodeFailedToExecute
dataResults[i].Result = []byte(err.Error())
} else {
//nolint:gosec // G115: We shouldn't get negative exit code anyway.
dataResults[i].ExitCode = uint32(result.exitInfo.ExitCode)
dataResults[i].Result = result.result
dataResults[i].ExitCode = uint32(tallyResults[i].exitInfo.ExitCode)
dataResults[i].Result = tallyResults[i].result
}
dataResults[i].Consensus = result.consensus
dataResults[i].GasUsed = result.execGasUsed + result.tallyGasUsed
dataResults[i].Consensus = tallyResults[i].consensus
dataResults[i].GasUsed = tallyResults[i].execGasUsed + tallyResults[i].tallyGasUsed

k.Logger(ctx).Info("completed tally execution", "request_id", req.ID)
k.Logger(ctx).Debug("tally execution result", "request_id", req.ID, "tally_result", result)
k.Logger(ctx).Debug("tally execution result", "request_id", req.ID, "tally_result", tallyResults[i])
}

dataResults[i].Id, err = dataResults[i].TryHash()
if err != nil {
return err
}
sudoMsgs[i] = types.SudoRemoveDataRequest{ID: req.ID}
tallyResults[i] = result
}

// Notify the Core Contract of tally completion.
Expand Down
Loading