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

Skip error logs for FGW responses with NOT_RECEIVED status #2303

Merged
merged 3 commits into from
Dec 10, 2024
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
9 changes: 7 additions & 2 deletions rpc/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -565,6 +565,8 @@
}, nil
}

var errTransactionNotFound = fmt.Errorf("transaction not found")

func (h *Handler) TransactionStatus(ctx context.Context, hash felt.Felt) (*TransactionStatus, *jsonrpc.Error) {
receipt, txErr := h.TransactionReceiptByHash(hash)
switch txErr {
Expand All @@ -585,10 +587,11 @@

status, err := adaptTransactionStatus(txStatus)
if err != nil {
h.log.Errorw("Failed to adapt transaction status", "err", err)
if !errors.Is(err, errTransactionNotFound) {
h.log.Errorw("Failed to adapt transaction status", "err", err)
}

Check warning on line 592 in rpc/transaction.go

View check run for this annotation

Codecov / codecov/patch

rpc/transaction.go#L591-L592

Added lines #L591 - L592 were not covered by tests
return nil, ErrTxnHashNotFound
}

return status, nil
}
return nil, txErr
Expand Down Expand Up @@ -751,6 +754,8 @@
status.Finality = TxnStatusAcceptedOnL2
case starknet.Received:
status.Finality = TxnStatusReceived
case starknet.NotReceived:
return nil, errTransactionNotFound
default:
return nil, fmt.Errorf("unknown finality status: %v", finalityStatus)
}
Expand Down
15 changes: 11 additions & 4 deletions starknet/compiler/rust/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
use cairo_lang_starknet_classes::casm_contract_class::{CasmContractClass, StarknetSierraCompilationError};
use cairo_lang_starknet_classes::casm_contract_class::{
CasmContractClass, StarknetSierraCompilationError,
};
use std::ffi::{c_char, CStr, CString};
use std::panic::{self,AssertUnwindSafe};
use std::panic::{self, AssertUnwindSafe};

#[no_mangle]
#[allow(clippy::not_unsafe_ptr_arg_deref)]
Expand All @@ -25,9 +27,14 @@ pub extern "C" fn compileSierraToCasm(sierra_json: *const c_char, result: *mut *
}
};

let mut casm_class_result: Option<Result<CasmContractClass, StarknetSierraCompilationError>> = None;
let mut casm_class_result: Option<Result<CasmContractClass, StarknetSierraCompilationError>> =
None;
let compilation_result = panic::catch_unwind(AssertUnwindSafe(|| {
casm_class_result = Some(CasmContractClass::from_contract_class(sierra_class, true, usize::MAX));
casm_class_result = Some(CasmContractClass::from_contract_class(
sierra_class,
true,
usize::MAX,
));
}));
if let Err(_) = compilation_result {
unsafe {
Expand Down
Loading