Skip to content

Commit

Permalink
Merge pull request #3499 from iotaledger/core-node/feat/remove-multip…
Browse files Browse the repository at this point in the history
…le-types

feat(node): Remove multiple versions of types
  • Loading branch information
miker83z authored Oct 25, 2024
2 parents 0f7d5ec + d5fdd6e commit 2204491
Show file tree
Hide file tree
Showing 159 changed files with 3,040 additions and 4,283 deletions.
2 changes: 1 addition & 1 deletion crates/iota-benchmark/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ impl ValidatorProxy for LocalValidatorAggregatorProxy {
let ticket = self
.qd
.submit_transaction(
iota_types::quorum_driver_types::ExecuteTransactionRequestV3 {
iota_types::quorum_driver_types::ExecuteTransactionRequestV1 {
transaction: tx.clone(),
include_events: true,
include_input_objects: false,
Expand Down
2 changes: 1 addition & 1 deletion crates/iota-benchmark/tests/simtest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ mod test {
..Default::default()
})
.with_submit_delay_step_override_millis(3000)
.with_state_accumulator_v2_enabled_callback(Arc::new(|idx| idx % 2 == 0))
.with_state_accumulator_callback(Arc::new(|idx| idx % 2 == 0))
.build()
.await
.into();
Expand Down
5 changes: 0 additions & 5 deletions crates/iota-config/src/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,6 @@ pub struct NodeConfig {
#[serde(default)]
pub execution_cache: ExecutionCacheConfig,

// step 1 in removing the old state accumulator
#[serde(skip)]
#[serde(default = "bool_true")]
pub state_accumulator_v2: bool,

#[serde(default = "bool_true")]
pub enable_validator_tx_finalizer: bool,
}
Expand Down
42 changes: 6 additions & 36 deletions crates/iota-core/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ use iota_types::{
TransactionEvents, VerifiedCertifiedTransactionEffects, VerifiedSignedTransactionEffects,
},
error::{ExecutionError, IotaError, IotaResult, UserInputError},
event::{Event, EventID, SystemEpochInfoEvent},
event::{Event, EventID, SystemEpochInfoEventV1},
executable_transaction::VerifiedExecutableTransaction,
execution_config_utils::to_binary_config,
execution_status::ExecutionStatus,
Expand Down Expand Up @@ -1395,7 +1395,7 @@ impl AuthorityState {
)
.await?;

if let TransactionKind::AuthenticatorStateUpdate(auth_state) =
if let TransactionKind::AuthenticatorStateUpdateV1(auth_state) =
certificate.data().transaction_data().kind()
{
if let Some(err) = &execution_error_opt {
Expand Down Expand Up @@ -1459,25 +1459,6 @@ impl AuthorityState {

let output_keys = inner_temporary_store.get_output_keys(effects);

// Only need to sign effects if we are a validator, and if the
// executed_in_epoch_table is not yet enabled. TODO: once
// executed_in_epoch_table is enabled everywhere, we can remove the code below
// entirely.
let should_sign_effects =
self.is_validator(epoch_store) && !epoch_store.executed_in_epoch_table_enabled();

let effects_sig = if should_sign_effects {
Some(AuthoritySignInfo::new(
epoch_store.epoch(),
effects,
Intent::iota_app(IntentScope::TransactionEffects),
self.name,
&*self.secret,
))
} else {
None
};

// index certificate
let _ = self
.post_process_one_tx(certificate, effects, &inner_temporary_store, epoch_store)
Expand All @@ -1490,12 +1471,7 @@ impl AuthorityState {
// The insertion to epoch_store is not atomic with the insertion to the
// perpetual store. This is OK because we insert to the epoch store
// first. And during lookups we always look up in the perpetual store first.
epoch_store.insert_tx_key_and_effects_signature(
&tx_key,
tx_digest,
&effects.digest(),
effects_sig.as_ref(),
)?;
epoch_store.insert_tx_key_and_digest(&tx_key, tx_digest)?;

// Allow testing what happens if we crash here.
fail_point_async!("crash");
Expand Down Expand Up @@ -2120,12 +2096,6 @@ impl AuthorityState {
indexes
.index_tx(
cert.data().intent_message().value.sender(),
cert.data()
.intent_message()
.value
.input_objects()?
.iter()
.map(|o| o.object_id()),
effects
.all_changed_objects()
.into_iter()
Expand Down Expand Up @@ -4673,7 +4643,7 @@ impl AuthorityState {
gas_cost_summary: &GasCostSummary,
checkpoint: CheckpointSequenceNumber,
epoch_start_timestamp_ms: CheckpointTimestamp,
) -> anyhow::Result<(IotaSystemState, SystemEpochInfoEvent, TransactionEffects)> {
) -> anyhow::Result<(IotaSystemState, SystemEpochInfoEventV1, TransactionEffects)> {
let mut txns = Vec::new();

if let Some(tx) = self.create_authenticator_state_tx(epoch_store) {
Expand Down Expand Up @@ -4808,14 +4778,14 @@ impl AuthorityState {
self.prepare_certificate(&execution_guard, &executable_tx, input_objects, epoch_store)?;
let system_obj = get_iota_system_state(&temporary_store.written)
.expect("change epoch tx must write to system object");
// Find the SystemEpochInfoEvent emitted by the advance_epoch transaction.
// Find the SystemEpochInfoEventV1 emitted by the advance_epoch transaction.
let system_epoch_info_event = temporary_store
.events
.data
.iter()
.find(|event| event.is_system_epoch_info_event())
.expect("end of epoch tx must emit system epoch info event");
let system_epoch_info_event = bcs::from_bytes::<SystemEpochInfoEvent>(
let system_epoch_info_event = bcs::from_bytes::<SystemEpochInfoEventV1>(
&system_epoch_info_event.contents,
)
.expect("deserialization should succeed since we asserted that the event is of this type");
Expand Down
Loading

0 comments on commit 2204491

Please sign in to comment.