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

[authority] Refactor shared object authority logic #727

Merged
merged 3 commits into from
Mar 11, 2022

Conversation

gdanezis
Copy link
Collaborator

@gdanezis gdanezis commented Mar 10, 2022

Refactored the authority logic:

  • Use multi-get when possible to read locks and objects.
  • Moved shared locks checks to its own function.
  • Removed duplicate test for idempotency

A few questions for @asonnino below.

sui_core/src/authority.rs Outdated Show resolved Hide resolved
Copy link
Contributor

@asonnino asonnino left a comment

Choose a reason for hiding this comment

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

Is it the case that the execution engine will execute no-op in case a shared object does not exist?

sui_core/src/authority.rs Outdated Show resolved Hide resolved
sui_core/src/authority.rs Outdated Show resolved Hide resolved
Comment on lines +530 to +551
if !transaction.contains_shared_object() {
// TODO: Maybe add a warning here, no respectable authority should
// have sequenced this.
return Ok(());
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure. A bad authority may input whatever it likes into consensus (because we want to use consensus as a black box).

Copy link
Contributor

@asonnino asonnino Mar 10, 2022

Choose a reason for hiding this comment

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

Not sure. A bad authority may input whatever it likes into consensus (because we want to use consensus as a black box).
@gdanezis

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, but at this point the consensus may be giving us a hint about which authority sequenced a non-shared object transaction, and we could log this as a byzantine error?

@asonnino asonnino self-requested a review March 10, 2022 17:44
Copy link
Contributor

@asonnino asonnino left a comment

Choose a reason for hiding this comment

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

Just have two (minor) remaining comments

match (lock, object) {
(Some(seq), Some(object)) => {
if object.version() != seq {
warn!(object_version =? object.version(),
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we sure we want to print 'warn' when the users do something bad? Shouldn't it be 'debug'?

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is the same code as before. I have no feelings about the type of log to produce here. Maybe @velvia has a view about this?

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I wasn't sure of the level of logging needed as it seemed like this is something that shouldn't happen, maybe someone can shed a bit more light here?

Comment on lines +530 to +551
if !transaction.contains_shared_object() {
// TODO: Maybe add a warning here, no respectable authority should
// have sequenced this.
return Ok(());
}
Copy link
Contributor

@asonnino asonnino Mar 10, 2022

Choose a reason for hiding this comment

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

Not sure. A bad authority may input whatever it likes into consensus (because we want to use consensus as a black box).
@gdanezis

@gdanezis gdanezis force-pushed the authority-refactor-shared branch from 36d9aaa to 8658396 Compare March 11, 2022 12:01
@@ -193,7 +193,10 @@ impl AuthorityState {
}
};
}
InputObjectKind::SharedMoveObject(..) => (),
InputObjectKind::SharedMoveObject(..) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@asonnino I added this check. However this treats immutable & shared objects uniformly, and that worries me.

}

/// Read a lock for a specific (transaction, shared object) pair.
pub fn all_shared_locks(
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@alberto This is how you get a sequence using the first element of a compound index.

@gdanezis gdanezis merged commit f7c2b3e into main Mar 11, 2022
@gdanezis gdanezis deleted the authority-refactor-shared branch March 11, 2022 15:46
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.

3 participants