-
Notifications
You must be signed in to change notification settings - Fork 11.1k
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
Commit per epoch config load to effects v2 #18501
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,9 +16,9 @@ use crate::gas::GasCostSummary; | |
use crate::is_system_package; | ||
use crate::object::{Owner, OBJECT_START_VERSION}; | ||
use serde::{Deserialize, Serialize}; | ||
use std::collections::BTreeMap; | ||
#[cfg(debug_assertions)] | ||
use std::collections::HashSet; | ||
use std::collections::{BTreeMap, BTreeSet}; | ||
|
||
/// The response from processing a transaction or a certified transaction | ||
#[derive(Eq, PartialEq, Clone, Debug, Serialize, Deserialize)] | ||
|
@@ -107,22 +107,28 @@ impl TransactionEffectsAPI for TransactionEffectsV2 { | |
} | ||
_ => None, | ||
}) | ||
.chain(self.unchanged_shared_objects.iter().map( | ||
|(id, change_kind)| match change_kind { | ||
UnchangedSharedKind::ReadOnlyRoot((version, digest)) => { | ||
InputSharedObject::ReadOnly((*id, *version, *digest)) | ||
} | ||
UnchangedSharedKind::MutateDeleted(seqno) => { | ||
InputSharedObject::MutateDeleted(*id, *seqno) | ||
} | ||
UnchangedSharedKind::ReadDeleted(seqno) => { | ||
InputSharedObject::ReadDeleted(*id, *seqno) | ||
} | ||
UnchangedSharedKind::Cancelled(seqno) => { | ||
InputSharedObject::Cancelled(*id, *seqno) | ||
} | ||
}, | ||
)) | ||
.chain( | ||
self.unchanged_shared_objects | ||
.iter() | ||
.filter_map(|(id, change_kind)| match change_kind { | ||
UnchangedSharedKind::ReadOnlyRoot((version, digest)) => { | ||
Some(InputSharedObject::ReadOnly((*id, *version, *digest))) | ||
} | ||
UnchangedSharedKind::MutateDeleted(seqno) => { | ||
Some(InputSharedObject::MutateDeleted(*id, *seqno)) | ||
} | ||
UnchangedSharedKind::ReadDeleted(seqno) => { | ||
Some(InputSharedObject::ReadDeleted(*id, *seqno)) | ||
} | ||
UnchangedSharedKind::Cancelled(seqno) => { | ||
Some(InputSharedObject::Cancelled(*id, *seqno)) | ||
} | ||
// We can not expose the per epoch config object as input shared object, | ||
// since it does not require sequencing, and hence shall not be considered | ||
// as a normal input shared object. | ||
UnchangedSharedKind::PerEpochConfig => None, | ||
}), | ||
) | ||
.collect() | ||
} | ||
|
||
|
@@ -405,6 +411,7 @@ impl TransactionEffectsV2 { | |
executed_epoch: EpochId, | ||
gas_used: GasCostSummary, | ||
shared_objects: Vec<SharedInput>, | ||
loaded_per_epoch_config_objects: BTreeSet<ObjectID>, | ||
transaction_digest: TransactionDigest, | ||
lamport_version: SequenceNumber, | ||
changed_objects: BTreeMap<ObjectID, EffectsObjectChange>, | ||
|
@@ -435,6 +442,11 @@ impl TransactionEffectsV2 { | |
Some((id, UnchangedSharedKind::Cancelled(version))) | ||
} | ||
}) | ||
.chain( | ||
loaded_per_epoch_config_objects | ||
.into_iter() | ||
.map(|id| (id, UnchangedSharedKind::PerEpochConfig)), | ||
) | ||
.collect(); | ||
let changed_objects: Vec<_> = changed_objects.into_iter().collect(); | ||
|
||
|
@@ -595,4 +607,6 @@ pub enum UnchangedSharedKind { | |
ReadDeleted(SequenceNumber), | ||
/// Shared objects in cancelled transaction. The sequence number embed cancellation reason. | ||
Cancelled(SequenceNumber), | ||
/// Read of a per-epoch config object that should remain the same during an epoch. | ||
PerEpochConfig, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this requires a new protocol version, right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The per epoch config object is only checked when coin deny list v2 is enabled, and hence is already behind a new protocol version. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. got it |
||
} |
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 is this incremented here, instead of after line 149?
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 could, but then we would need to add the size of the owners there. This is a lot simpler.