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: charge explicit gas for batch verification #1854

Closed
wants to merge 1 commit into from

Conversation

Stebalien
Copy link
Member

@Stebalien Stebalien commented Aug 22, 2023

This won't currently make a difference on mainnet because we only call this from the cron actor (in an implicit message). However, we will need this when we have the miner actor call it directly.

fixes #1852

@Stebalien Stebalien marked this pull request as draft August 22, 2023 22:42
@@ -27,6 +27,9 @@ use crate::kernel::SupportedHashes;
// https://docs.rs/wasmtime/2.0.2/wasmtime/struct.InstanceLimits.html#structfield.table_elements
const TABLE_ELEMENT_SIZE: u32 = 8;

// Parallelism for batch seal verification.
const BATCH_SEAL_PARALLELISM: usize = 8;
Copy link
Member Author

Choose a reason for hiding this comment

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

Is this right?

verify_seal_base: Gas::new(2000), // TODO revisit potential removal of this
verify_seal_batch: ScalingCost {
flat: Gas::zero(), // TODO: Determine startup overhead.
scale: Gas::new(34721049), // TODO: Maybe re-benchmark?
Copy link
Member Author

Choose a reason for hiding this comment

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

Probably need to revisit/benchmark.

.call_manager
.charge_gas(self.call_manager.price_list().on_batch_verify_seal(vis))?;

// TODO: consider optimizing for one proof (i.e., don't charge a batch overhead?)
Copy link
Member Author

Choose a reason for hiding this comment

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

This may not be necessary, it depends on the 'startup' overhead.

let out = vis
.par_iter()
.map(|seal| {
match catch_and_log_panic("verifying seals", || verify_seal(seal)) {
Copy link
Member Author

Choose a reason for hiding this comment

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

do we want to allow partial success when called directly from the miner actor?

@Stebalien Stebalien requested a review from Kubuxu August 22, 2023 22:43
@Stebalien Stebalien assigned Kubuxu and unassigned Kubuxu Aug 22, 2023
This won't currently make a difference on mainnet because we only call
this from the cron actor (in an implicit message). However, we _will_
need this when we have the miner actor call it directly.
@codecov-commenter
Copy link

codecov-commenter commented Aug 22, 2023

Codecov Report

Merging #1854 (2f87cf9) into master (dd01512) will increase coverage by 0.05%.
The diff coverage is 0.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1854      +/-   ##
==========================================
+ Coverage   75.32%   75.37%   +0.05%     
==========================================
  Files         149      149              
  Lines       14568    14560       -8     
==========================================
+ Hits        10973    10975       +2     
+ Misses       3595     3585      -10     
Files Changed Coverage Δ
fvm/src/gas/price_list.rs 76.87% <0.00%> (-1.52%) ⬇️
fvm/src/kernel/default.rs 53.12% <0.00%> (+0.99%) ⬆️

... and 3 files with indirect coverage changes

@Stebalien
Copy link
Member Author

Closing in favor of #1882.

@Stebalien Stebalien closed this Sep 21, 2023
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.

Fix gas accounting for seal proof verification
3 participants