-
Notifications
You must be signed in to change notification settings - Fork 140
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
Conversation
@@ -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; |
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.
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? |
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.
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?) |
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.
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)) { |
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.
do we want to allow partial success when called directly from the miner actor?
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.
3941f00
to
2f87cf9
Compare
Codecov Report
Additional details and impacted files@@ 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
|
Closing in favor of #1882. |
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