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

test(mempool): enable l2 gas resource for mempool-test #544

Merged
merged 1 commit into from
Aug 21, 2024

Conversation

MohammadNassar1
Copy link
Contributor

@MohammadNassar1 MohammadNassar1 commented Aug 20, 2024

This change is Reviewable

@MohammadNassar1 MohammadNassar1 force-pushed the mohammad/mempool-test/enable-l2-resource branch from b8fa578 to 2e76774 Compare August 20, 2024 18:57
@MohammadNassar1 MohammadNassar1 changed the base branch from main to mohammad/transaction-queue/add-pending-transaction-type August 20, 2024 19:02
@MohammadNassar1 MohammadNassar1 force-pushed the mohammad/mempool-test/enable-l2-resource branch from 2e76774 to 1694f23 Compare August 20, 2024 19:04
Copy link
Contributor Author

@MohammadNassar1 MohammadNassar1 left a comment

Choose a reason for hiding this comment

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

This PR adds l2_gas_resource to add_tx macro.
It's essential to enable gap_price_threshold in mempool testing.

Reviewable status: 0 of 4 files reviewed, all discussions resolved

@MohammadNassar1 MohammadNassar1 force-pushed the mohammad/mempool-test/enable-l2-resource branch from 1694f23 to eb9df81 Compare August 20, 2024 19:52
Copy link
Collaborator

@elintul elintul left a comment

Choose a reason for hiding this comment

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

Reviewed 5 of 5 files at r1, all commit messages.
Reviewable status: all files reviewed, 4 unresolved discussions (waiting on @ayeletstarkware, @giladchase, and @MohammadNassar1)


crates/gateway/src/stateful_transaction_validator_test.rs line 71 at r1 (raw file):

    invoke_tx(CairoVersion::Cairo1),
    Ok(ValidateInfo{
        tx_hash: TransactionHash(felt!(

What happened here? Why is this test fragile?


crates/mempool/src/mempool_test.rs line 173 at r1 (raw file):

    (tip: $tip:expr, tx_hash: $tx_hash:expr, sender_address: $sender_address:expr,
        tx_nonce: $tx_nonce:expr, account_nonce: $account_nonce:expr) => {{
            add_tx_input!(tip: $tip, tx_hash: $tx_hash, sender_address: $sender_address, tx_nonce: $tx_nonce, account_nonce: $account_nonce, resource_bounds: executable_resource_bounds_mapping().into())

Unclear from the name what it returns.

Code quote:

executable_resource_bounds_mapping

crates/mempool_test_utils/src/starknet_api_test_utils.rs line 28 at r1 (raw file):

    PaymasterData,
    ResourceBounds,
    ResourceBoundsMapping as ExecutableResourceBoundsMapping,

Why this alias?

Code quote:

ResourceBoundsMapping as ExecutableResourceBoundsMapping,

crates/starknet_api/src/executable_transaction.rs line 117 at r1 (raw file):

                    tip: *rpc_tx.tip(),
                    nonce: *rpc_tx.nonce(),
                    resource_bounds: rpc_tx.resource_bounds().clone().into(),

Isn't it the same type?
Why cloneing and not * like for tip and nonce?
(Same Q for gateway_test.rs)

Code quote:

.into()

@MohammadNassar1 MohammadNassar1 force-pushed the mohammad/transaction-queue/add-pending-transaction-type branch from 053ae9a to 9048645 Compare August 21, 2024 05:10
@MohammadNassar1 MohammadNassar1 force-pushed the mohammad/mempool-test/enable-l2-resource branch from eb9df81 to 4286137 Compare August 21, 2024 05:22
Copy link
Contributor Author

@MohammadNassar1 MohammadNassar1 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, 4 unresolved discussions (waiting on @ayeletstarkware, @elintul, and @giladchase)


crates/gateway/src/stateful_transaction_validator_test.rs line 71 at r1 (raw file):

Previously, elintul (Elin) wrote…

What happened here? Why is this test fragile?

resource bounds was changed -> expected tx hash changed.


crates/mempool/src/mempool_test.rs line 173 at r1 (raw file):

Previously, elintul (Elin) wrote…

Unclear from the name what it returns.

Changed to test_resource_bounds_mapping, as it's a resource mapping for testing.


crates/mempool_test_utils/src/starknet_api_test_utils.rs line 28 at r1 (raw file):

Previously, elintul (Elin) wrote…

Why this alias?

Because there is another ResourceBoundsMapping, the rpc mapping.


crates/starknet_api/src/executable_transaction.rs line 117 at r1 (raw file):

Previously, elintul (Elin) wrote…

Isn't it the same type?
Why cloneing and not * like for tip and nonce?
(Same Q for gateway_test.rs)

Resource bounds doesn't imply Copy, so it cannot deref.
The same answer for gateway_test .rscode.

@MohammadNassar1 MohammadNassar1 changed the base branch from mohammad/transaction-queue/add-pending-transaction-type to main August 21, 2024 08:07
Copy link
Collaborator

@elintul elintul 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 r2, all commit messages.
Reviewable status: all files reviewed, 2 unresolved discussions (waiting on @ayeletstarkware, @giladchase, and @MohammadNassar1)


crates/gateway/src/stateful_transaction_validator_test.rs line 71 at r1 (raw file):

Previously, MohammadNassar1 (mohammad-starkware) wrote…

resource bounds was changed -> expected tx hash changed.

This framework should be refactored.


crates/mempool/src/mempool_test.rs line 173 at r1 (raw file):

Previously, MohammadNassar1 (mohammad-starkware) wrote…

Changed to test_resource_bounds_mapping, as it's a resource mapping for testing.

But what's its value? Default?

Copy link
Collaborator

@elintul elintul 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: all files reviewed, 1 unresolved discussion (waiting on @ayeletstarkware, @giladchase, and @MohammadNassar1)

@MohammadNassar1 MohammadNassar1 force-pushed the mohammad/mempool-test/enable-l2-resource branch from 4286137 to 83b0a16 Compare August 21, 2024 09:11
Copy link
Collaborator

@elintul elintul 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: :shipit: complete! all files reviewed, all discussions resolved (waiting on @ayeletstarkware and @giladchase)

@MohammadNassar1 MohammadNassar1 merged commit e57df3a into main Aug 21, 2024
10 checks passed
@MohammadNassar1 MohammadNassar1 deleted the mohammad/mempool-test/enable-l2-resource branch August 21, 2024 13:43
@MohammadNassar1 MohammadNassar1 restored the mohammad/mempool-test/enable-l2-resource branch August 21, 2024 13:44
@MohammadNassar1 MohammadNassar1 deleted the mohammad/mempool-test/enable-l2-resource branch August 21, 2024 13:45
@github-actions github-actions bot locked and limited conversation to collaborators Aug 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants