Skip to content

Commit

Permalink
runtime: store NULL error module/code when no error
Browse files Browse the repository at this point in the history
  • Loading branch information
pro-wh committed Sep 3, 2024
1 parent 0d66997 commit 159db20
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
1 change: 1 addition & 0 deletions .changelog/748.feature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
runtime: store NULL error module/code when no error
24 changes: 12 additions & 12 deletions analyzer/runtime/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -298,15 +298,15 @@ func (m *processor) queueDbUpdates(batch *storage.QueryBatch, data *BlockData) {
evmEncryptedResultNonce = &transactionData.EVMEncrypted.ResultNonce
evmEncryptedResultData = &transactionData.EVMEncrypted.ResultData
}
var error_module string
var error_code uint32
var error_message *string
var error_message_raw *string
var errorModule *string
var errorCode *uint32
var errorMessage *string
var errorMessageRaw *string
if transactionData.Error != nil {
error_module = transactionData.Error.Module
error_code = transactionData.Error.Code
error_message = transactionData.Error.Message
error_message_raw = transactionData.Error.RawMessage
errorModule = &transactionData.Error.Module
errorCode = &transactionData.Error.Code
errorMessage = transactionData.Error.Message
errorMessageRaw = transactionData.Error.RawMessage
}
batch.Queue(
queries.RuntimeTransactionInsert,
Expand Down Expand Up @@ -335,10 +335,10 @@ func (m *processor) queueDbUpdates(batch *storage.QueryBatch, data *BlockData) {
evmEncryptedResultNonce,
evmEncryptedResultData,
transactionData.Success,
error_module,
error_code,
error_message_raw,
error_message,
errorModule,
errorCode,
errorMessageRaw,
errorMessage,
)

if transactionData.ContractCandidate != nil {
Expand Down
7 changes: 6 additions & 1 deletion storage/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1488,6 +1488,7 @@ func (c *StorageClient) RuntimeTransactions(ctx context.Context, p apiTypes.GetR
var toPreimageContextIdentifier *string
var toPreimageContextVersion *int
var toPreimageData []byte
var errorCode *uint32
if err := res.rows.Scan(
&t.Round,
&t.Index,
Expand Down Expand Up @@ -1525,7 +1526,7 @@ func (c *StorageClient) RuntimeTransactions(ctx context.Context, p apiTypes.GetR
&t.EvmFnName,
&t.EvmFnParams,
&t.Error.Module,
&t.Error.Code,
&errorCode,
&t.Error.Message,
&t.Error.RevertParams,
); err != nil {
Expand All @@ -1537,6 +1538,10 @@ func (c *StorageClient) RuntimeTransactions(ctx context.Context, p apiTypes.GetR
// information, so empty this stuff out.
if t.Success == nil || *t.Success {
t.Error = nil
} else {
if errorCode != nil {
t.Error.Code = *errorCode
}
}
if encryptionEnvelopeFormat != nil { // a rudimentary check to determine if the tx was encrypted
encryptionEnvelope.Format = *encryptionEnvelopeFormat
Expand Down

0 comments on commit 159db20

Please sign in to comment.