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

[move] Rewrite verifier metering #19036

Merged
merged 23 commits into from
Aug 22, 2024
Merged

Conversation

tnowacki
Copy link
Contributor

@tnowacki tnowacki commented Aug 19, 2024

Description

  • Added ability cache for verifier ability queries
  • Redid metering for typing, local safety, and reference safety

Test plan

  • calibrated constants

Release notes

Check each box that your changes affect. If none of the boxes relate to your changes, release notes aren't required.

For each box you select, include information after the relevant heading that describes the impact of your changes that a user might notice and any actions they must take to implement updates.

  • Protocol:
  • Nodes (Validators and Full nodes):
  • Indexer:
  • JSON-RPC:
  • GraphQL:
  • CLI:
  • Rust SDK:
  • REST API:

Copy link

vercel bot commented Aug 19, 2024

@tnowacki is attempting to deploy a commit to the Mysten Labs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

vercel bot commented Aug 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 21, 2024 11:39pm

Copy link
Contributor

@tzakian tzakian left a comment

Choose a reason for hiding this comment

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

Overall looks good to me, just a couple (mainly smaller) comments.

@@ -161,8 +161,10 @@ macro_rules! safe_unwrap {
match $e {
Some(x) => x,
None => {
let err = PartialVMError::new(StatusCode::UNKNOWN_INVARIANT_VIOLATION_ERROR)
.with_message(format!("{}:{} (none)", file!(), line!()));
let err = move_binary_format::errors::PartialVMError::new(
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: consider importing these modules instead of fully qualifying 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.

This is in a macro declaration. I feel like maybe the fully qualified paths are more clear?

Copy link
Contributor

Choose a reason for hiding this comment

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

ah! didn't realize that. Makes sense to keep as-is then.

pub(crate) const RET_PER_LOCAL_COST: u128 = 30;
pub(crate) const JOIN_BASE_COST: u128 = 10;
pub(crate) const JOIN_PER_LOCAL_COST: u128 = 5;
use crate::ability_cache::AbilityCache;
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: move use up to the other use statements?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Remember what we were discussing about autoimports in the IDE... yeah this is why its hard

function_context: &FunctionContext,
ability_ache: &mut AbilityCache,
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: spelling

Comment on lines 29 to 30
module_ability_cache: RefCell<&'a mut AbilityCache<'env>>,
meter: RefCell<&'b mut M>,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a particular reason for these RefCells? Would be nice if they weren't needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

laziness, fixed

Copy link
Contributor

@tzakian tzakian left a comment

Choose a reason for hiding this comment

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

Looks great!

@tnowacki tnowacki enabled auto-merge (squash) August 21, 2024 23:57
@tnowacki tnowacki merged commit 22aa24d into MystenLabs:main Aug 22, 2024
41 of 44 checks passed
@tnowacki tnowacki deleted the verifier-rewrite branch August 22, 2024 20:10
tx-tomcat pushed a commit to tx-tomcat/sui-network that referenced this pull request Aug 27, 2024
## Description 

- Added ability cache for verifier ability queries
- Redid metering for typing, local safety, and reference safety 

## Test plan 

- calibrated constants

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
suiwombat pushed a commit that referenced this pull request Sep 16, 2024
## Description 

- Added ability cache for verifier ability queries
- Redid metering for typing, local safety, and reference safety 

## Test plan 

- calibrated constants

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:
- [ ] REST API:
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.

2 participants