Skip to content

Commit

Permalink
[pick #18501][GraphQL] PerEpochConfig
Browse files Browse the repository at this point in the history
## Description

Picking parts of #18501 that introduce new types for representing
per-epoch configs as a form of unchanged shared object.

## Test plan

Tested against the query in #18836.
  • Loading branch information
amnn committed Jul 30, 2024
1 parent eabd9fd commit b0fd8c7
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
2 changes: 2 additions & 0 deletions crates/sui-core/tests/staged/sui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1086,6 +1086,8 @@ UnchangedSharedKind:
Cancelled:
NEWTYPE:
TYPENAME: SequenceNumber
4:
PerEpochConfig: UNIT
UpgradeInfo:
STRUCT:
- upgraded_id:
Expand Down
40 changes: 24 additions & 16 deletions crates/sui-types/src/effects/effects_v2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}

Expand Down Expand Up @@ -587,4 +593,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,
}

0 comments on commit b0fd8c7

Please sign in to comment.