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

feat: Add benchmark in replay crate #13

Closed
wants to merge 10 commits into from

Conversation

Danikim01
Copy link

closes #12
This PR implements the benchmark feature of the execution time of the blocks in memory

@Danikim01 Danikim01 linked an issue Jun 26, 2024 that may be closed by this pull request
@Danikim01 Danikim01 marked this pull request as ready for review June 28, 2024 15:29
rpc-state-reader/src/blockifier_state_reader.rs Outdated Show resolved Hide resolved
replay/src/main.rs Outdated Show resolved Hide resolved
Copy link
Member

@pefontana pefontana left a comment

Choose a reason for hiding this comment

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

@Danikim01 Also, add a description in the README.md showing how to run the bench-block-range command

rpc-state-reader/src/blockifier_state_reader.rs Outdated Show resolved Hide resolved
replay/src/main.rs Outdated Show resolved Hide resolved
rpc-state-reader/src/blockifier_state_reader.rs Outdated Show resolved Hide resolved
@Danikim01
Copy link
Author

@Danikim01 Also, add a description in the README.md showing how to run the bench-block-range command

thanks for letting me know that i had to change the readme!

@Danikim01 Danikim01 self-assigned this Jun 28, 2024
Copy link
Contributor

@JulianGCalderon JulianGCalderon left a comment

Choose a reason for hiding this comment

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

The execution speed is way faster than it should be. You can try out the other commands to get a feel of how long it should take in a normal scenario (cargo run block mainnet 648461). In my computer it takes at least 30 seconds per transaction.

You can print the result of the execution to see what is going on, this is what I got:

     Running `target/debug/replay bench-block-range 648461 648461 mainnet 10`
Filling up Cache
Executing block: 648461
Executing tx: 0x4de9a3c4c5f43e2a4b7d68a1ed2217e6df698a5a701ae59e357bb950697757b
[replay/src/main.rs:182:21] res = Err(
    TransactionPreValidationError(
        InvalidNonce {
            address: ContractAddress(
                PatriciaKey(
                    StarkFelt(
                        "0x073335cc71c93fe46c04c14e09e7cde7ca7f6147bb36c72dee7968ec3abaf70d",
                    ),
                ),
            ),
            account_nonce: Nonce(
                StarkFelt(
                    "0x0000000000000000000000000000000000000000000000000000000000003fcd",
                ),
            ),
            incoming_tx_nonce: Nonce(
                StarkFelt(
                    "0x0000000000000000000000000000000000000000000000000000000000003fcc",
                ),
            ),
        },
    ),
)

It seem that the nonce is incorrect so the transaction is never executed. What block are you using when making RPC requests? Make sure you are using the previous block (if you are replaying block 100, you must use the state from block 99)

Also, there are some formatting problems in the code, please make sure to use cargo fmt (you can configure your editor to format on save)

@JulianGCalderon JulianGCalderon mentioned this pull request Jul 1, 2024
@JulianGCalderon JulianGCalderon marked this pull request as draft July 5, 2024 21:09
@JulianGCalderon
Copy link
Contributor

superseded by #31

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.

Add benchmark feature in replay crate
3 participants