-
Notifications
You must be signed in to change notification settings - Fork 60
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
Introduce lite-mode #444
Introduce lite-mode #444
Conversation
@ivpavici I have implemented lite mode by skipping blockhash calculation here and replacing it with hash of block_number. Could you please see if the implementation is correct, I am not sure of few things like would calculating block_number before initializing header cause problem?, validity of initializing hash with Also let me know if hash calculation has to be skipped somewhere else as well, thanks. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you done any benchmarking? What is the time impact of skipping block hash calculation?
Not yet, I just implemented the functionality as per devnet-py, if its required let me know how I can do that? |
Think of something, be creative :D But one test could look like this, let's call the script #!/bin/bash
set -eu
N=$1
for _ in $(seq 1 $N); do
curl -w "\n" -sSf localhost:5050/mint --json '{
"amount": 1,
"address": "0x1"
}'
done And you could run:
Or replace 1000 with any number you wish to test. Of course, this assumes that somewhere on your computer you have Devnet running at port 5050. I'd recommend testing both |
yeah, please @lordshashank we would be very grateful for this test and report afterwards :) |
thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the table report in the PR description! How did you accumulate the times? I mean - are you reporting what you got on the first run? Or did you run it multiple times?
Also, I'm having doubts about DX and UX and if --lite-mode
is the best approach. Perhaps we should have multiple CLI options like --block-hash <REAL|DUMMY>
. We should consider what else can be skipped (other than block hash generation).
5507522
to
bb26422
Compare
Times reported are of first run only. For UX I suppose that best way could be to include @FabijanC I have implemented the nits you suggested, let me know if anything else is to be done. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@lordshashank Please, in the future, execute the tests to ensure the CI workflow passes. I will fix the failure coming from the merge of this PR. |
Really really sorry, I was thinking to do that after all the issues in pr were resolved, just forgot it at the end. Would surely keep in mind from next time. |
Usage related changes
Would implement lite node that can be used with "--lite-node" tag which would skip blockhash calculation by replacing it with block_number hashes.
Development related changes
lite_mode
option in the configuration.generate_new_block
function to skip block hash calculation whenlite_mode
is enabled.Benchmark Results
I performed benchmark testing using [mint_benchmark[(./scripts/benchmark/mint to compare the performance of the application in
lite_mode
and regular mode. Here are the results:As expected, enabling
lite_mode
improves the performance of the application.Checklist:
./scripts/format.sh
./scripts/clippy_check.sh
./scripts/check_unused_deps.sh