Skip to content
Open
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 storage-proto/proto/transaction_by_addr.proto
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ enum TransactionErrorType {
PROGRAM_EXECUTION_TEMPORARILY_RESTRICTED = 35;
UNBALANCED_TRANSACTION = 36;
PROGRAM_CACHE_HIT_MAX_LIMIT = 37;
COMMIT_CANCELLED = 38;
}

message InstructionError {
Expand Down
3 changes: 2 additions & 1 deletion storage-proto/src/convert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -913,6 +913,7 @@ impl TryFrom<tx_by_addr::TransactionError> for TransactionError {
34 => TransactionError::ResanitizationNeeded,
36 => TransactionError::UnbalancedTransaction,
37 => TransactionError::ProgramCacheHitMaxLimit,
38 => TransactionError::CommitCancelled,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Add COMMIT_CANCELLED to the proto enum before using it here.

tx_by_addr::TransactionErrorType is generated from storage-proto/proto/transaction_by_addr.proto, and that enum currently stops at PROGRAM_CACHE_HIT_MAX_LIMIT = 37. Until the schema adds COMMIT_CANCELLED = 38 and codegen is regenerated, Line 1036 references a generated Rust variant that does not exist, so this change will not compile; Line 916 also starts accepting a wire discriminant the proto does not define.

Suggested schema addition
 enum TransactionErrorType {
     UNBALANCED_TRANSACTION = 36;
     PROGRAM_CACHE_HIT_MAX_LIMIT = 37;
+    COMMIT_CANCELLED = 38;
 }

Also applies to: 1035-1036

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@storage-proto/src/convert.rs` at line 916, The proto enum used to generate
tx_by_addr::TransactionErrorType is missing the COMMIT_CANCELLED = 38 variant,
so convert.rs references (e.g., TransactionError::CommitCancelled and matching
on wire discriminant 38) will not compile; update
storage-proto/proto/transaction_by_addr.proto to add COMMIT_CANCELLED = 38 to
the TransactionErrorType enum, re-run the proto codegen to regenerate
tx_by_addr::TransactionErrorType, and then keep the match arm mapping 38 =>
TransactionError::CommitCancelled (and the corresponding use at
TransactionError::CommitCancelled) in convert.rs.

_ => return Err("Invalid TransactionError"),
})
}
Expand Down Expand Up @@ -1032,7 +1033,7 @@ impl From<TransactionError> for tx_by_addr::TransactionError {
tx_by_addr::TransactionErrorType::UnbalancedTransaction
}
TransactionError::CommitCancelled => {
todo!()
tx_by_addr::TransactionErrorType::CommitCancelled
}
TransactionError::ProgramCacheHitMaxLimit => {
tx_by_addr::TransactionErrorType::ProgramCacheHitMaxLimit
Expand Down