-
Notifications
You must be signed in to change notification settings - Fork 11.3k
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
Use existing authority follower system (including local execution) for full node. #2106
Conversation
Fixes #1998 |
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.
Awesome!
tokio::select! { | ||
_ = &mut timeout => panic!("wait_for_tx timed out"), |
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.
Instead of using this paradigm would it be possible to use https://docs.rs/tokio/latest/tokio/time/fn.timeout.html instead?
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.
if not, don't worry
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 don't quite understand how to use that in a select! block, maybe you can show me next week.
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.
Yeah course. My hope for using the timeout type itself is to eliminate the select block. Because it seems like you're only selecting between the stream and the timeout
…urce_to_destination
5033c91
to
2c8cae2
Compare
match self.database.get_latest_parent_entry(*object_id)? { | ||
None => Ok(ObjectRead::NotExists(*object_id)), | ||
Some((obj_ref, _)) => { | ||
if obj_ref.2.is_alive() { | ||
match self.database.get_object_version(object_id, obj_ref.1)? { | ||
None => { | ||
error!("Object with in parent_entry is missing from object store, datastore is inconsistent"); | ||
Err(SuiError::ObjectNotFound { | ||
object_id: *object_id, | ||
}) | ||
} | ||
Some(object) => { |
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 think you can call database.get_object
to replace this part
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.
handle_object_info_request
has some redundant code. See if there is opportunity to merge code.
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 think you can call
database.get_object
to replace this part
Not easily - the object could have been deleted after the get_latest_parent_entry call, in which case a call to get_object()
would return None.
I spent 20 or 30 minutes trying to factor these functions, and didn't get anywhere. They do a lot of the same things, but they are different enough that its hard to share any code without adding tons of bool parameters or other complication.
self.database.get_account_objects(account_addr) | ||
} | ||
|
||
pub fn get_total_transaction_number(&self) -> Result<u64, anyhow::Error> { |
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.
From line 848 to 914 are all directly operating on the database. If you move all these functions to the Store, then authority and gateway can share the API and remove redundant code.
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.
It wasn't super feasible to move them into the store, but I've moved them into a separate module to reduce the duplication.
@@ -862,14 +1010,30 @@ impl AuthorityState { | |||
signed_effects: &SignedTransactionEffects, | |||
) -> SuiResult { | |||
let notifier_ticket = self.batch_notifier.ticket()?; | |||
let seq = notifier_ticket.seq(); | |||
|
|||
if let Some(indexes) = &self.indexes { |
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 think it's safer to update indexes after calling database.update_state
.
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.
done
@@ -307,6 +307,14 @@ impl< | |||
.collect()) | |||
} | |||
|
|||
pub fn get_object_version( |
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.
get_object_by_key
is probably a better name
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.
done
self.get_transactions_in_range(start, end) | ||
} | ||
|
||
pub async fn get_transaction( |
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.
Actually, this one probably can be replaced with make_transaction_info.
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.
It can, but it doesn't really reduce the amount of code because of all the Option handling you have to do.
Fixes: #1998