-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
jwk #1: validator txn for publishing updates #11853
Conversation
029e686
to
d0957db
Compare
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## main #11853 +/- ##
=========================================
- Coverage 71.2% 71.2% -0.1%
=========================================
Files 795 795
Lines 182802 182968 +166
=========================================
+ Hits 130264 130282 +18
- Misses 52538 52686 +148 ☔ View full report in Codecov by Sentry. |
|
||
enum ExpectedFailure { | ||
// Move equivalent: `errors::invalid_argument(*)` | ||
IncorrectVersion = 0x010103, |
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.
what do these 0x... values mean here? does it map to some values at other places?
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.
yes, see aptos-move/framework/aptos-framework/sources/jwks.move
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.
Didn't find it. Can you share a link?
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.
aptos-core/aptos-move/framework/aptos-framework/sources/jwks.move
Lines 32 to 36 in 3d5bfea
const ENATIVE_MISSING_RESOURCE_VALIDATOR_SET: u64 = 0x0101; | |
const ENATIVE_MISSING_RESOURCE_OBSERVED_JWKS: u64 = 0x0102; | |
const ENATIVE_INCORRECT_VERSION: u64 = 0x0103; | |
const ENATIVE_MULTISIG_VERIFICATION_FAILED: u64 = 0x0104; | |
const ENATIVE_NOT_ENOUGH_VOTING_POWER: u64 = 0x0105; |
types/src/validator_txn.rs
Outdated
match self { | ||
ValidatorTransaction::DummyTopic1(_) => Topic::DUMMY1, | ||
ValidatorTransaction::DKGResult(_) => Topic::DKG, | ||
ValidatorTransaction::DummyTopic2(_) => Topic::DUMMY2, |
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.
why dummy is used outside out test?
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.
fixed, dummy has gone
match self.process_jwk_update_inner(resolver, log_context, session_id, update) { | ||
Ok((vm_status, vm_output)) => Ok((vm_status, vm_output)), | ||
Err(Expected(failure)) => { | ||
// Pretend we are inside Move, and expected failures are like Move aborts. |
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.
why do we need to simulate move abort? normal move abort is not discard too?
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.
We don't need to. But I had the impression that In the future we may want to move the checks into move.
Discarding or not is a separate question? And for vtxn we want to discard if the checks failed?
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.
Can approve once dummy vtxn is marked test-only.
fixed, dummy has gone |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
// Pretend we are inside Move, and expected failures are like Move aborts. | ||
Ok(( | ||
VMStatus::MoveAbort(AbortLocation::Script, failure as u64), | ||
VMOutput::empty_with_status(TransactionStatus::Discard(StatusCode::ABORTED)), |
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.
Move aborts are kept, so we want a Keep here?
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.
I believe what we really want is to discard (otherwise we allow malicious validators to put things in)
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.
I'm just not sure what's the best value for the 1st element of the returning tuple.
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.
Some other vmstatus variants seem to be more serious and can cause the whole block to be rejected. That's undesired behavior
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.
In this case we do not need VMOutput, and can return a VMStatus? For example, for prologue which runs Move code we do it like this: https://github.com/aptos-labs/aptos-core/blob/main/aptos-move/aptos-vm/src/errors.rs#L64 which rempas the error to status and returns just that. The caller can see Err(status) and create an empty output with a Discard?
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.
just to be clear, if the transaction is valid, we want to make changes; otherwise (expected failures), we want to discard.
Are you are suggesting change: from
fn process_jwk_update(...) -> Result<(VMStatus, VMOutput), VMStatus> {
match self.process_jwk_update_inner(...) {
//...
Err(Expected(failure)) => {
// Pretend we are inside Move, and expected failures are like Move aborts.
Ok((
VMStatus::MoveAbort(AbortLocation::Script, failure as u64),
VMOutput::empty_with_status(TransactionStatus::Discard(StatusCode::ABORTED)),
))
},
//...
}
}
to
fn process_jwk_update(...) -> Result<(VMStatus, VMOutput), VMStatus> {
match self.process_jwk_update_inner(...) {
//...
Err(Expected(failure)) => {
// Pretend we are inside Move, and expected failures are like Move aborts.
Err(VMStatus::SOMETHING)
},
//...
}
}
?
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.
we can't return errors here, that will kill the block execution. we can keep it as is but it's a bit ugly
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
✅ Forge suite
|
✅ Forge suite
|
Description
Test Plan