-
Notifications
You must be signed in to change notification settings - Fork 53
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: resolve issue91 to add get_max_parallel_group #96
base: dev
Are you sure you want to change the base?
feat: resolve issue91 to add get_max_parallel_group #96
Conversation
This is off to the correct start. A few things...
impl VerifiedExecutableBlock {
pub fn new(transactions: Vec<VerifiedExecutableTransaction>) -> Self {
Self(transactions)
}
pub fn get_max_parallel_groups(&self) -> VerifiedExecutableExecutionGroups {
let mut groups: Vec<Vec<VerifiedExecutableTransaction>> = Vec::new();
let mut objects_in_groups: Vec<HashSet<(ObjectID, bool)>> = Vec::new();
let mut processed_digests: HashSet<SenderSignedDataDigest> = HashSet::new();
for executable_transaction in &self.0 {
let sender_signed_data = executable_transaction.clone().into_message();
// Skip if transaction is already processed
if processed_digests.contains(&sender_signed_data.full_message_digest()) {
continue;
}
let TransactionData::V1(tx_data_v1) = sender_signed_data.transaction_data();
let shared_objects = tx_data_v1.shared_input_objects();
// Find a group where the transaction can be added without conflict
let mut group_id = 0;
while group_id < objects_in_groups.len() {
let is_conflict = shared_objects.iter().any(|obj| {
objects_in_groups[group_id].contains(&(obj.id, true)) && obj.mutable
});
if !is_conflict {
break;
}
group_id += 1;
}
// If no suitable group, create a new one
if group_id == objects_in_groups.len() {
groups.push(Vec::new());
objects_in_groups.push(HashSet::new());
}
// Add the transaction to the group
for obj in shared_objects {
objects_in_groups[group_id].insert((obj.id, obj.mutable));
}
groups[group_id].push(executable_transaction.clone());
processed_digests.insert(sender_signed_data.full_message_digest());
}
VerifiedExecutableExecutionGroups(groups)
}
}
|
Looks great. 👍
Furthermore, what about the transactions with have the same signer? Can they go in the same group? |
So, I think there's a good chance this can remain the way you've written it--i.e., using More precisely, I think the complexity we need to try and figure out is whether using the same owned What I believe this would mean is...
|
Pull Request
Description
get_max_parallel_groups
inVerifiedExecutableBlock