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

Update bhsh bench #2456

Open
wants to merge 8 commits into
base: add_zk_opcodes
Choose a base branch
from
Open

Update bhsh bench #2456

wants to merge 8 commits into from

Conversation

AurelienFT
Copy link
Contributor

@AurelienFT AurelienFT commented Nov 26, 2024

Linked Issues/PRs

#2237

Description

This PR is on top of add_zk_opcodes so that the change of gas cost will be efective with the new GasCostsValueV5. The benchmark was incorrect because of

if block_height >= self.current_block_height || block_height == Default::default()
. In benches the block_height was 0. If we use the DBBench it works because the block height used is 1. However, if we want to add blocks in the db we also need the DBBench to use an higher block height. This PR solves all of this.
This PR also simplify and comment the preparation code.

Checklist

  • Breaking changes are clearly marked as such in the PR description and changelog
  • New behavior is reflected in tests
  • The specification matches the implemented behavior (link update PR if changes are needed)

Before requesting review

  • I have reviewed the code myself
  • I have created follow-up issues caused by this PR and linked them here

After merging, notify other teams

[Add or remove entries as needed]

@AurelienFT AurelienFT requested a review from a team November 26, 2024 14:39
@AurelienFT AurelienFT added the no changelog Skip the CI check of the changelog modification label Nov 26, 2024
@AurelienFT AurelienFT mentioned this pull request Nov 26, 2024
6 tasks
fn add_blocks(&mut self, nb_blocks: u32) {
for i in 1..=nb_blocks {
let block =
fuel_core::service::genesis::create_genesis_block(&Config::local_node());
Copy link
Member

Choose a reason for hiding this comment

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

qq: why are we inserting multiple genesis blocks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because this is the only helpers that we have here and it doesn't change anything for our benchmarks has we never read the value.

Copy link
Collaborator

Choose a reason for hiding this comment

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

It would be nice if the block were 256KB and we tried to get the height for one of them=)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

One block = 256KB or the total of blocks is 256KB ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because I don't understand what a bigger block will change because we just get the id field

Copy link
Collaborator

Choose a reason for hiding this comment

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

Each block 256KB. With the current implementation it changes nothing, but in the future if we change the implementation, it can be useful

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okok idk how to build blocks with a specific size but will try (if you read this and know directly tell meeee) :)

Copy link
Collaborator

Choose a reason for hiding this comment

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

You can add one transaction with very huge script data

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@@ -8,7 +8,7 @@ pub fn default_gas_costs() -> GasCostsValues {
andi: 2,
bal: 274,
bhei: 2,
bhsh: 2,
bhsh: 32,
Copy link
Contributor

Choose a reason for hiding this comment

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

how has this been calculated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With the benchmark I modified

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant what steps did you follow to get this value? Asking for knowledge sharing purposes.

Copy link
Contributor Author

@AurelienFT AurelienFT Nov 26, 2024

Choose a reason for hiding this comment

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

I found it pretty well explained here : https://github.com/FuelLabs/fuel-core/blob/master/benches/README.md

However a little trick that green told me is to comment all the other vm opcode benches to win some time (except noop that is required as a base). Maybe we should mark it in the readme.

@AurelienFT AurelienFT self-assigned this Dec 5, 2024
@rymnc rymnc requested a review from Copilot December 5, 2024 17:51

Choose a reason for hiding this comment

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no suggestions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog Skip the CI check of the changelog modification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants