Skip to content

Commit c101a58

Browse files
authored
chore(core-node)!: remove deprecated db tables (#3142)
* !chore(core-node): remove deprecated tables in `AuthorityEpochTables` * !chore(core-node): remove deprecated tables in `IndexStoreTables` * chore(scripts): add `target` to ignored_dirs
1 parent 2a63305 commit c101a58

File tree

6 files changed

+25
-200
lines changed

6 files changed

+25
-200
lines changed

crates/iota-core/src/authority.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2132,12 +2132,6 @@ impl AuthorityState {
21322132
indexes
21332133
.index_tx(
21342134
cert.data().intent_message().value.sender(),
2135-
cert.data()
2136-
.intent_message()
2137-
.value
2138-
.input_objects()?
2139-
.iter()
2140-
.map(|o| o.object_id()),
21412135
effects
21422136
.all_changed_objects()
21432137
.into_iter()

crates/iota-core/src/authority/authority_per_epoch_store.rs

Lines changed: 16 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -483,10 +483,6 @@ pub struct AuthorityEpochTables {
483483
#[default_options_override_fn = "pending_consensus_transactions_table_default_config"]
484484
pending_consensus_transactions: DBMap<ConsensusTransactionKey, ConsensusTransaction>,
485485

486-
/// this table is not used
487-
#[allow(dead_code)]
488-
consensus_message_order: DBMap<ExecutionIndices, TransactionDigest>,
489-
490486
/// The following table is used to store a single value (the corresponding
491487
/// key is a constant). The value represents the index of the latest
492488
/// consensus message this authority processed. This field is written by
@@ -502,21 +498,13 @@ pub struct AuthorityEpochTables {
502498
/// This field is written by a single process (consensus handler).
503499
last_consensus_stats: DBMap<u64, ExecutionIndicesWithStats>,
504500

505-
/// this table is not used
506-
#[allow(dead_code)]
507-
checkpoint_boundary: DBMap<u64, u64>,
508-
509501
/// This table contains current reconfiguration state for validator for
510502
/// current epoch
511503
reconfig_state: DBMap<u64, ReconfigState>,
512504

513505
/// Validators that have sent EndOfPublish message in this epoch
514506
end_of_publish: DBMap<AuthorityName, ()>,
515507

516-
// TODO: Unused. Remove when removal of DBMap tables is supported.
517-
#[allow(dead_code)]
518-
final_epoch_checkpoint: DBMap<u64, u64>,
519-
520508
/// This table has information for the checkpoints for which we constructed
521509
/// all the data from consensus, but not yet constructed actual
522510
/// checkpoint.
@@ -552,12 +540,9 @@ pub struct AuthorityEpochTables {
552540
/// checkpoint later.
553541
user_signatures_for_checkpoints: DBMap<TransactionDigest, Vec<GenericSignature>>,
554542

555-
/// This table is not used
556-
#[allow(dead_code)]
557-
builder_checkpoint_summary: DBMap<CheckpointSequenceNumber, CheckpointSummary>,
558543
/// Maps sequence number to checkpoint summary, used by CheckpointBuilder to
559544
/// build checkpoint within epoch
560-
builder_checkpoint_summary_v2: DBMap<CheckpointSequenceNumber, BuilderCheckpointSummary>,
545+
builder_checkpoint_summary: DBMap<CheckpointSequenceNumber, BuilderCheckpointSummary>,
561546

562547
// Maps checkpoint sequence number to an accumulator with accumulated state
563548
// only for the checkpoint that the key references. Append-only, i.e.,
@@ -583,11 +568,6 @@ pub struct AuthorityEpochTables {
583568
pub(crate) executed_transactions_to_checkpoint:
584569
DBMap<TransactionDigest, CheckpointSequenceNumber>,
585570

586-
/// This table is no longer used (can be removed when DBMap supports
587-
/// removing tables)
588-
#[allow(dead_code)]
589-
oauth_provider_jwk: DBMap<JwkId, JWK>,
590-
591571
/// JWKs that have been voted for by one or more authorities but are not yet
592572
/// active.
593573
pending_jwks: DBMap<(AuthorityName, JwkId, JWK), ()>,
@@ -601,51 +581,31 @@ pub struct AuthorityEpochTables {
601581
/// Transactions that are being deferred until some future time
602582
deferred_transactions: DBMap<DeferralKey, Vec<VerifiedSequencedConsensusTransaction>>,
603583

604-
/// This table is no longer used (can be removed when DBMap supports
605-
/// removing tables)
606-
#[allow(dead_code)]
607-
randomness_rounds_written: DBMap<narwhal_types::RandomnessRound, ()>,
608-
609584
/// Tables for recording state for RandomnessManager.
610585
611586
/// Records messages processed from other nodes. Updated when receiving a
612587
/// new dkg::Message via consensus.
613-
pub(crate) dkg_processed_messages_v2: DBMap<PartyId, VersionedProcessedMessage>,
614-
/// This table is no longer used (can be removed when DBMap supports
615-
/// removing tables)
616-
#[allow(dead_code)]
617-
#[deprecated]
618-
pub(crate) dkg_processed_messages: DBMap<PartyId, Vec<u8>>,
588+
pub(crate) dkg_processed_messages: DBMap<PartyId, VersionedProcessedMessage>,
619589

620590
/// Records messages used to generate a DKG confirmation. Updated when
621591
/// enough DKG messages are received to progress to the next phase.
622-
pub(crate) dkg_used_messages_v2: DBMap<u64, VersionedUsedProcessedMessages>,
623-
/// This table is no longer used (can be removed when DBMap supports
624-
/// removing tables)
625-
#[allow(dead_code)]
626-
#[deprecated]
627-
pub(crate) dkg_used_messages: DBMap<u64, Vec<u8>>,
592+
pub(crate) dkg_used_messages: DBMap<u64, VersionedUsedProcessedMessages>,
628593

629594
/// Records confirmations received from other nodes. Updated when receiving
630595
/// a new dkg::Confirmation via consensus.
631-
pub(crate) dkg_confirmations_v2: DBMap<PartyId, VersionedDkgConfirmation>,
632-
/// This table is no longer used (can be removed when DBMap supports
633-
/// removing tables)
634-
#[allow(dead_code)]
635-
#[deprecated]
636-
pub(crate) dkg_confirmations: DBMap<PartyId, Vec<u8>>,
596+
pub(crate) dkg_confirmations: DBMap<PartyId, VersionedDkgConfirmation>,
597+
637598
/// Records the final output of DKG after completion, including the public
638599
/// VSS key and any local private shares.
639600
pub(crate) dkg_output: DBMap<u64, dkg::Output<PkG, EncG>>,
640-
/// This table is no longer used (can be removed when DBMap supports
641-
/// removing tables)
642-
#[allow(dead_code)]
643-
randomness_rounds_pending: DBMap<RandomnessRound, ()>,
601+
644602
/// Holds the value of the next RandomnessRound to be generated.
645603
pub(crate) randomness_next_round: DBMap<u64, RandomnessRound>,
604+
646605
/// Holds the value of the highest completed RandomnessRound (as reported to
647606
/// RandomnessReporter).
648607
pub(crate) randomness_highest_completed_round: DBMap<u64, RandomnessRound>,
608+
649609
/// Holds the timestamp of the most recently generated round of randomness.
650610
pub(crate) randomness_last_round_timestamp: DBMap<u64, TimestampMs>,
651611
}
@@ -3861,7 +3821,7 @@ impl AuthorityPerEpochStore {
38613821
checkpoint_height: Some(commit_height),
38623822
position_in_commit,
38633823
};
3864-
batch.insert_batch(&self.tables()?.builder_checkpoint_summary_v2, [(
3824+
batch.insert_batch(&self.tables()?.builder_checkpoint_summary, [(
38653825
&sequence_number,
38663826
summary,
38673827
)])?;
@@ -3899,7 +3859,7 @@ impl AuthorityPerEpochStore {
38993859
position_in_commit: 0,
39003860
};
39013861
self.tables()?
3902-
.builder_checkpoint_summary_v2
3862+
.builder_checkpoint_summary
39033863
.insert(summary.sequence_number(), &builder_summary)?;
39043864
Ok(())
39053865
}
@@ -3909,7 +3869,7 @@ impl AuthorityPerEpochStore {
39093869
) -> IotaResult<Option<BuilderCheckpointSummary>> {
39103870
Ok(self
39113871
.tables()?
3912-
.builder_checkpoint_summary_v2
3872+
.builder_checkpoint_summary
39133873
.unbounded_iter()
39143874
.skip_to_last()
39153875
.next()
@@ -3921,7 +3881,7 @@ impl AuthorityPerEpochStore {
39213881
) -> IotaResult<Option<(CheckpointSequenceNumber, CheckpointSummary)>> {
39223882
Ok(self
39233883
.tables()?
3924-
.builder_checkpoint_summary_v2
3884+
.builder_checkpoint_summary
39253885
.unbounded_iter()
39263886
.skip_to_last()
39273887
.next()
@@ -3934,7 +3894,7 @@ impl AuthorityPerEpochStore {
39343894
) -> IotaResult<Option<CheckpointSummary>> {
39353895
Ok(self
39363896
.tables()?
3937-
.builder_checkpoint_summary_v2
3897+
.builder_checkpoint_summary
39383898
.get(&sequence)?
39393899
.map(|s| s.summary))
39403900
}
@@ -4324,13 +4284,10 @@ impl ConsensusCommitOutput {
43244284
)])?;
43254285
}
43264286

4327-
batch.insert_batch(&tables.dkg_confirmations_v2, self.dkg_confirmations)?;
4328-
batch.insert_batch(
4329-
&tables.dkg_processed_messages_v2,
4330-
self.dkg_processed_messages,
4331-
)?;
4287+
batch.insert_batch(&tables.dkg_confirmations, self.dkg_confirmations)?;
4288+
batch.insert_batch(&tables.dkg_processed_messages, self.dkg_processed_messages)?;
43324289
batch.insert_batch(
4333-
&tables.dkg_used_messages_v2,
4290+
&tables.dkg_used_messages,
43344291
// using Option as iter
43354292
self.dkg_used_message
43364293
.into_iter()

crates/iota-core/src/epoch/randomness.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -352,12 +352,12 @@ impl RandomnessManager {
352352
);
353353
rm.processed_messages.extend(
354354
tables
355-
.dkg_processed_messages_v2
355+
.dkg_processed_messages
356356
.safe_iter()
357357
.map(|result| result.expect("typed_store should not fail")),
358358
);
359359
if let Some(used_messages) = tables
360-
.dkg_used_messages_v2
360+
.dkg_used_messages
361361
.get(&SINGLETON_KEY)
362362
.expect("typed_store should not fail")
363363
{
@@ -367,7 +367,7 @@ impl RandomnessManager {
367367
}
368368
rm.confirmations.extend(
369369
tables
370-
.dkg_confirmations_v2
370+
.dkg_confirmations
371371
.safe_iter()
372372
.map(|result| result.expect("typed_store should not fail")),
373373
);

crates/iota-storage/src/indexes.rs

Lines changed: 5 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -160,33 +160,12 @@ pub struct IndexStoreTables {
160160
#[default_options_override_fn = "transactions_to_addr_table_default_config"]
161161
transactions_to_addr: DBMap<(IotaAddress, TxSequenceNumber), TransactionDigest>,
162162

163-
/// Index from object id to transactions that used that object id as input.
164-
#[deprecated]
165-
transactions_by_input_object_id: DBMap<(ObjectID, TxSequenceNumber), TransactionDigest>,
166-
167-
/// Index from object id to transactions that modified/created that object
168-
/// id.
169-
#[deprecated]
170-
transactions_by_mutated_object_id: DBMap<(ObjectID, TxSequenceNumber), TransactionDigest>,
171-
172163
/// Index from package id, module and function identifier to transactions
173164
/// that used that moce function call as input.
174165
#[default_options_override_fn = "transactions_by_move_function_table_default_config"]
175166
transactions_by_move_function:
176167
DBMap<(ObjectID, String, String, TxSequenceNumber), TransactionDigest>,
177168

178-
/// This is a map between the transaction digest and its timestamp (UTC
179-
/// timestamp in **milliseconds** since epoch 1/1/1970). A transaction
180-
/// digest is subjectively time stamped on a node according to the local
181-
/// machine time, so it varies across nodes. The timestamping happens
182-
/// when the node sees a txn certificate for the first time.
183-
///
184-
/// DEPRECATED. DO NOT USE
185-
#[allow(dead_code)]
186-
#[default_options_override_fn = "timestamps_table_default_config"]
187-
#[deprecated]
188-
timestamps: DBMap<TransactionDigest, u64>,
189-
190169
/// Ordering of all indexed transactions.
191170
#[default_options_override_fn = "transactions_order_table_default_config"]
192171
transaction_order: DBMap<TxSequenceNumber, TransactionDigest>,
@@ -214,20 +193,21 @@ pub struct IndexStoreTables {
214193
#[default_options_override_fn = "dynamic_field_index_table_default_config"]
215194
dynamic_field_index: DBMap<DynamicFieldKey, DynamicFieldInfo>,
216195

217-
/// This is an index of all the versions of loaded child objects
218-
#[deprecated]
219-
loaded_child_object_versions: DBMap<TransactionDigest, Vec<(ObjectID, SequenceNumber)>>,
220-
221196
#[default_options_override_fn = "index_table_default_config"]
222197
event_order: DBMap<EventId, EventIndex>,
198+
223199
#[default_options_override_fn = "index_table_default_config"]
224200
event_by_move_module: DBMap<(ModuleId, EventId), EventIndex>,
201+
225202
#[default_options_override_fn = "index_table_default_config"]
226203
event_by_move_event: DBMap<(StructTag, EventId), EventIndex>,
204+
227205
#[default_options_override_fn = "index_table_default_config"]
228206
event_by_event_module: DBMap<(ModuleId, EventId), EventIndex>,
207+
229208
#[default_options_override_fn = "index_table_default_config"]
230209
event_by_sender: DBMap<(IotaAddress, EventId), EventIndex>,
210+
231211
#[default_options_override_fn = "index_table_default_config"]
232212
event_by_time: DBMap<(u64, EventId), EventIndex>,
233213
}
@@ -270,11 +250,6 @@ fn transactions_to_addr_table_default_config() -> DBOptions {
270250
fn transactions_by_move_function_table_default_config() -> DBOptions {
271251
default_db_options().disable_write_throttling()
272252
}
273-
fn timestamps_table_default_config() -> DBOptions {
274-
default_db_options()
275-
.optimize_for_point_lookup(64)
276-
.disable_write_throttling()
277-
}
278253
fn owner_index_table_default_config() -> DBOptions {
279254
default_db_options().disable_write_throttling()
280255
}
@@ -483,7 +458,6 @@ impl IndexStore {
483458
pub async fn index_tx(
484459
&self,
485460
sender: IotaAddress,
486-
active_inputs: impl Iterator<Item = ObjectID>,
487461
mutated_objects: impl Iterator<Item = (ObjectRef, Owner)> + Clone,
488462
move_functions: impl Iterator<Item = (ObjectID, Identifier, Identifier)> + Clone,
489463
events: &TransactionEvents,
@@ -510,21 +484,6 @@ impl IndexStore {
510484
std::iter::once(((sender, sequence), *digest)),
511485
)?;
512486

513-
#[allow(deprecated)]
514-
if !self.remove_deprecated_tables {
515-
batch.insert_batch(
516-
&self.tables.transactions_by_input_object_id,
517-
active_inputs.map(|id| ((id, sequence), *digest)),
518-
)?;
519-
520-
batch.insert_batch(
521-
&self.tables.transactions_by_mutated_object_id,
522-
mutated_objects
523-
.clone()
524-
.map(|(obj_ref, _)| ((obj_ref.0, sequence), *digest)),
525-
)?;
526-
}
527-
528487
batch.insert_batch(
529488
&self.tables.transactions_by_move_function,
530489
move_functions.map(|(obj_id, module, function)| {
@@ -698,12 +657,6 @@ impl IndexStore {
698657
}) => Ok(self.get_transactions_by_move_function(
699658
package, module, function, cursor, limit, reverse,
700659
)?),
701-
Some(TransactionFilter::InputObject(object_id)) => {
702-
Ok(self.get_transactions_by_input_object(object_id, cursor, limit, reverse)?)
703-
}
704-
Some(TransactionFilter::ChangedObject(object_id)) => {
705-
Ok(self.get_transactions_by_mutated_object(object_id, cursor, limit, reverse)?)
706-
}
707660
Some(TransactionFilter::FromAddress(address)) => {
708661
Ok(self.get_transactions_from_addr(address, cursor, limit, reverse)?)
709662
}
@@ -781,46 +734,6 @@ impl IndexStore {
781734
})
782735
}
783736

784-
pub fn get_transactions_by_input_object(
785-
&self,
786-
input_object: ObjectID,
787-
cursor: Option<TxSequenceNumber>,
788-
limit: Option<usize>,
789-
reverse: bool,
790-
) -> IotaResult<Vec<TransactionDigest>> {
791-
if self.remove_deprecated_tables {
792-
return Ok(vec![]);
793-
}
794-
#[allow(deprecated)]
795-
Self::get_transactions_from_index(
796-
&self.tables.transactions_by_input_object_id,
797-
input_object,
798-
cursor,
799-
limit,
800-
reverse,
801-
)
802-
}
803-
804-
pub fn get_transactions_by_mutated_object(
805-
&self,
806-
mutated_object: ObjectID,
807-
cursor: Option<TxSequenceNumber>,
808-
limit: Option<usize>,
809-
reverse: bool,
810-
) -> IotaResult<Vec<TransactionDigest>> {
811-
if self.remove_deprecated_tables {
812-
return Ok(vec![]);
813-
}
814-
#[allow(deprecated)]
815-
Self::get_transactions_from_index(
816-
&self.tables.transactions_by_mutated_object_id,
817-
mutated_object,
818-
cursor,
819-
limit,
820-
reverse,
821-
)
822-
}
823-
824737
pub fn get_transactions_from_addr(
825738
&self,
826739
addr: IotaAddress,
@@ -1655,7 +1568,6 @@ mod tests {
16551568
address,
16561569
vec![].into_iter(),
16571570
vec![].into_iter(),
1658-
vec![].into_iter(),
16591571
&TransactionEvents { data: vec![] },
16601572
object_index_changes,
16611573
&TransactionDigest::random(),
@@ -1699,7 +1611,6 @@ mod tests {
16991611
address,
17001612
vec![].into_iter(),
17011613
vec![].into_iter(),
1702-
vec![].into_iter(),
17031614
&TransactionEvents { data: vec![] },
17041615
object_index_changes,
17051616
&TransactionDigest::random(),

0 commit comments

Comments
 (0)