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

chore(starknet_batcher): fix error message on transaction provider error on l1 validation #4187

Conversation

ArniStarkware
Copy link
Contributor

@ArniStarkware ArniStarkware commented Feb 17, 2025

The new error message prints as:

L1Handler transaction validation failed for tx with hash 0x11faf080dfd62a9505a328e1f86c7e9e60e9752d9e18ddea5af46f8debf5205 status ConsumedOnL1OrUnknown

@reviewable-StarkWare
Copy link

This change is Reviewable

Copy link
Contributor Author

ArniStarkware commented Feb 17, 2025

@ArniStarkware ArniStarkware marked this pull request as ready for review February 17, 2025 08:42
@ArniStarkware ArniStarkware force-pushed the arni/l1_validation_status/transaction_provider_error_message branch from 18e1709 to f651936 Compare February 17, 2025 08:44
Copy link
Contributor Author

@ArniStarkware ArniStarkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 0 of 2 files reviewed, 1 unresolved discussion (waiting on @alonh5 and @yair-starkware)


crates/starknet_batcher/src/transaction_provider.rs line 25 at r2 (raw file):

        tx_hash.0.to_hex_string(),
        validation_status
    )]

Note the to_hex_string() is necessary; otherwise, it is printed as:

L1Handler transaction validation failed for tx with hash 508293130354954486128899687620408279632791738070753331087816184264451379717 status ConsumedOnL1OrUnknown.

i.e., the hash is presented as decimal instead of as hexadecimal.

Code quote:

    #[error(
        "L1Handler transaction validation failed for tx with hash {} status {:?}.",
        tx_hash.0.to_hex_string(),
        validation_status
    )]

@ArniStarkware ArniStarkware force-pushed the arni/l1_validation_status/fix_typo branch from be1749d to a0f83d3 Compare February 17, 2025 08:54
@ArniStarkware ArniStarkware force-pushed the arni/l1_validation_status/transaction_provider_error_message branch from f651936 to 60a14dc Compare February 17, 2025 08:54
Copy link
Contributor

@yair-starkware yair-starkware left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 2 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @alonh5)

Copy link
Collaborator

@alonh5 alonh5 left a comment

Choose a reason for hiding this comment

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

Reviewed 1 of 2 files at r1, 1 of 1 files at r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @yair-starkware)


crates/starknet_batcher/src/transaction_provider_test.rs line 221 at r2 (raw file):

    assert_matches!(
        result,
        Err(TransactionProviderError::L1HandlerTransactionValidationFailed { .. })

Why? Let's check the values as well. When you're using .. it only matches the pattern

@ArniStarkware ArniStarkware changed the base branch from arni/l1_validation_status/fix_typo to graphite-base/4187 February 18, 2025 18:54
@ArniStarkware ArniStarkware force-pushed the arni/l1_validation_status/transaction_provider_error_message branch from 13c043d to f03eeee Compare February 18, 2025 18:54
@ArniStarkware ArniStarkware changed the base branch from graphite-base/4187 to main February 18, 2025 18:54
Copy link
Contributor Author

@ArniStarkware ArniStarkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 1 of 3 files reviewed, 2 unresolved discussions (waiting on @alonh5 and @yair-starkware)


crates/starknet_batcher/src/transaction_provider_test.rs line 221 at r2 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

Why? Let's check the values as well. When you're using .. it only matches the pattern

Done.
This does revel an issue with the structure of the enum L1ValidationStatus. It has too many variants that act too diferently. What would happen if a new variant of status will be added? What if it is considered valid? or invalid?

Added a todo (For post 0.14.0).

Copy link
Contributor Author

@ArniStarkware ArniStarkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: 1 of 3 files reviewed, 2 unresolved discussions (waiting on @alonh5 and @yair-starkware)


crates/starknet_l1_provider_types/src/lib.rs line 26 at r3 (raw file):

// TODO(Arni): Consider splitting this enum into valid and invalid status where the invalid status
// holds the flavor of the invalidity. Propagate this change to
// [TransactionProviderError::L1HandlerTransactionValidationFailed].

This TODO is handled in #4256.

Code quote:

// TODO(Arni): Consider splitting this enum into valid and invalid status where the invalid status
// holds the flavor of the invalidity. Propagate this change to
// [TransactionProviderError::L1HandlerTransactionValidationFailed].

Copy link
Collaborator

@alonh5 alonh5 left a comment

Choose a reason for hiding this comment

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

Reviewed 2 of 2 files at r3, all commit messages.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @ArniStarkware and @yair-starkware)


crates/starknet_batcher/src/transaction_provider_test.rs line 221 at r2 (raw file):

Previously, ArniStarkware (Arnon Hod) wrote…

Done.
This does revel an issue with the structure of the enum L1ValidationStatus. It has too many variants that act too diferently. What would happen if a new variant of status will be added? What if it is considered valid? or invalid?

Added a todo (For post 0.14.0).

You don't need to test all the validation statuses, I just meant keep the tx hash and add the validation status to the assert matches.

@ArniStarkware ArniStarkware requested a review from alonh5 February 19, 2025 14:04
Copy link
Contributor Author

@ArniStarkware ArniStarkware left a comment

Choose a reason for hiding this comment

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

Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @alonh5 and @yair-starkware)


crates/starknet_batcher/src/transaction_provider_test.rs line 221 at r2 (raw file):

Previously, alonh5 (Alon Haramati) wrote…

You don't need to test all the validation statuses, I just meant keep the tx hash and add the validation status to the assert matches.

Discussed F2F.

Copy link
Collaborator

@alonh5 alonh5 left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @alonh5 and @yair-starkware)

@ArniStarkware ArniStarkware added this pull request to the merge queue Feb 19, 2025
Merged via the queue into main with commit 0283232 Feb 19, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants