Skip to content

Commit

Permalink
fix protocol config guarding of new canceled tx variant
Browse files Browse the repository at this point in the history
  • Loading branch information
aschran committed Dec 16, 2024
1 parent 6c18b0b commit 2b6da9a
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 4 deletions.
1 change: 0 additions & 1 deletion crates/sui-core/src/authority/authority_per_epoch_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3166,7 +3166,6 @@ impl AuthorityPerEpochStore {

let transaction = consensus_commit_info.create_consensus_commit_prologue_transaction(
self.epoch(),
self.epoch_start_config(),
self.protocol_config(),
version_assignment,
);
Expand Down
5 changes: 2 additions & 3 deletions crates/sui-core/src/consensus_handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ use crate::{
ExecutionIndicesWithStats,
},
backpressure::{BackpressureManager, BackpressureSubscriber},
epoch_start_configuration::{EpochStartConfigTrait, EpochStartConfiguration},
epoch_start_configuration::EpochStartConfigTrait,
AuthorityMetrics, AuthorityState,
},
checkpoints::{CheckpointService, CheckpointServiceNotify},
Expand Down Expand Up @@ -860,14 +860,13 @@ impl ConsensusCommitInfo {
pub fn create_consensus_commit_prologue_transaction(
&self,
epoch: u64,
epoch_start_config: &EpochStartConfiguration,
protocol_config: &ProtocolConfig,
cancelled_txn_version_assignment: Vec<(
TransactionDigest,
Vec<(ConsensusObjectSequenceKey, SequenceNumber)>,
)>,
) -> VerifiedExecutableTransaction {
if epoch_start_config.use_version_assignment_tables_v3() {
if protocol_config.record_consensus_determined_version_assignments_in_prologue_v2() {
self.consensus_commit_prologue_v3_transaction(
epoch,
ConsensusDeterminedVersionAssignments::CancelledTransactionsV2(
Expand Down
4 changes: 4 additions & 0 deletions crates/sui-core/src/generate_format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ use sui_types::execution_status::{
};
use sui_types::full_checkpoint_content::{CheckpointData, CheckpointTransaction};
use sui_types::messages_checkpoint::CertifiedCheckpointSummary;
use sui_types::messages_consensus::ConsensusDeterminedVersionAssignments;
use sui_types::messages_grpc::ObjectInfoRequestKind;
use sui_types::move_package::TypeOrigin;
use sui_types::object::Object;
Expand Down Expand Up @@ -204,6 +205,9 @@ fn get_registry() -> Result<Registry> {
.trace_type::<ObjectInfoRequestKind>(&samples)
.unwrap();
tracer.trace_type::<TransactionKind>(&samples).unwrap();
tracer
.trace_type::<ConsensusDeterminedVersionAssignments>(&samples)
.unwrap();
tracer.trace_type::<MoveObjectType>(&samples).unwrap();
tracer.trace_type::<MoveObjectType_>(&samples).unwrap();
tracer
Expand Down
12 changes: 12 additions & 0 deletions crates/sui-core/tests/staged/sui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,18 @@ ConsensusDeterminedVersionAssignments:
TUPLE:
- TYPENAME: ObjectID
- TYPENAME: SequenceNumber
1:
CancelledTransactionsV2:
NEWTYPE:
SEQ:
TUPLE:
- TYPENAME: TransactionDigest
- SEQ:
TUPLE:
- TUPLE:
- TYPENAME: ObjectID
- TYPENAME: SequenceNumber
- TYPENAME: SequenceNumber
Data:
ENUM:
0:
Expand Down
49 changes: 49 additions & 0 deletions crates/sui-open-rpc/spec/openrpc.json
Original file line number Diff line number Diff line change
Expand Up @@ -1346,6 +1346,7 @@
"receive_objects": false,
"recompute_has_public_transfer_in_execution": false,
"record_consensus_determined_version_assignments_in_prologue": false,
"record_consensus_determined_version_assignments_in_prologue_v2": false,
"reject_mutable_random_on_entry_functions": false,
"relocate_event_module": false,
"reshare_at_same_initial_version": false,
Expand Down Expand Up @@ -5680,6 +5681,54 @@
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"CancelledTransactionsV2"
],
"properties": {
"CancelledTransactionsV2": {
"type": "array",
"items": {
"type": "array",
"items": [
{
"$ref": "#/components/schemas/TransactionDigest"
},
{
"type": "array",
"items": {
"type": "array",
"items": [
{
"type": "array",
"items": [
{
"$ref": "#/components/schemas/ObjectID"
},
{
"$ref": "#/components/schemas/SequenceNumber2"
}
],
"maxItems": 2,
"minItems": 2
},
{
"$ref": "#/components/schemas/SequenceNumber2"
}
],
"maxItems": 2,
"minItems": 2
}
}
],
"maxItems": 2,
"minItems": 2
}
}
},
"additionalProperties": false
}
]
},
Expand Down
8 changes: 8 additions & 0 deletions crates/sui-protocol-config/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,8 +505,11 @@ struct FeatureFlags {
// Controls whether consensus handler should record consensus determined shared object version
// assignments in consensus commit prologue transaction.
// The purpose of doing this is to enable replaying transaction without transaction effects.
// V2 also records initial shared versions for consensus objects.
#[serde(skip_serializing_if = "is_false")]
record_consensus_determined_version_assignments_in_prologue: bool,
#[serde(skip_serializing_if = "is_false")]
record_consensus_determined_version_assignments_in_prologue_v2: bool,

// Run verification of framework upgrades using a new/fresh VM.
#[serde(skip_serializing_if = "is_false")]
Expand Down Expand Up @@ -1556,6 +1559,11 @@ impl ProtocolConfig {
.record_consensus_determined_version_assignments_in_prologue
}

pub fn record_consensus_determined_version_assignments_in_prologue_v2(&self) -> bool {
self.feature_flags
.record_consensus_determined_version_assignments_in_prologue_v2
}

pub fn prepend_prologue_tx_in_consensus_commit_in_checkpoints(&self) -> bool {
self.feature_flags
.prepend_prologue_tx_in_consensus_commit_in_checkpoints
Expand Down

0 comments on commit 2b6da9a

Please sign in to comment.