Skip to content
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

refactor(iota-storage): Remove deprecated_get_transaction_checkpoint #3775

Closed
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions crates/iota-core/src/authority.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4986,15 +4986,6 @@ impl TransactionKeyValueStoreTrait for AuthorityState {
Ok((summaries, contents, summaries_by_digest, contents_by_digest))
}

async fn deprecated_get_transaction_checkpoint(
&self,
digest: TransactionDigest,
) -> IotaResult<Option<CheckpointSequenceNumber>> {
self.get_checkpoint_cache()
.deprecated_get_transaction_checkpoint(&digest)
.map(|res| res.map(|(_epoch, checkpoint)| checkpoint))
}

async fn get_object(
&self,
object_id: ObjectID,
Expand Down
5 changes: 0 additions & 5 deletions crates/iota-json-rpc/src/coin_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -466,11 +466,6 @@ mod tests {
checkpoint_contents_by_digest: &[CheckpointContentsDigest],
) -> IotaResult<KVStoreCheckpointData>;

async fn deprecated_get_transaction_checkpoint(
&self,
digest: TransactionDigest,
) -> IotaResult<Option<CheckpointSequenceNumber>>;

async fn get_object(&self, object_id: ObjectID, version: SequenceNumber) -> IotaResult<Option<Object>>;

async fn multi_get_transaction_checkpoint(
Expand Down
10 changes: 7 additions & 3 deletions crates/iota-json-rpc/src/read_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -788,11 +788,15 @@ impl ReadApiServer for ReadApi {

temp_response.checkpoint_seq = self
.transaction_kv_store
.deprecated_get_transaction_checkpoint(digest)
.multi_get_transaction_checkpoint(&Vec::from([digest]))
.await
.map_err(|e| {
.tap_err(|e| {
error!("Failed to retrieve checkpoint sequence for transaction {digest:?} with error: {e:?}");
Error::from(e)
})?
.pop()
.ok_or_else(|| {
error!("No checkpoint sequence found for transaction {digest:?}");
Error::new("No checkpoint sequence found for transaction")
})?;

if let Some(checkpoint_seq) = &temp_response.checkpoint_seq {
Expand Down
11 changes: 0 additions & 11 deletions crates/iota-storage/src/http_key_value_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -411,17 +411,6 @@ impl TransactionKeyValueStoreTrait for HttpKVStore {
))
}

#[instrument(level = "trace", skip_all)]
async fn deprecated_get_transaction_checkpoint(
&self,
digest: TransactionDigest,
) -> IotaResult<Option<CheckpointSequenceNumber>> {
let key = Key::TxToCheckpoint(digest);
self.fetch(key).await.map(|maybe| {
maybe.and_then(|bytes| deser::<_, CheckpointSequenceNumber>(&key, bytes.as_ref()))
})
}

#[instrument(level = "trace", skip_all)]
async fn get_object(
&self,
Expand Down
32 changes: 0 additions & 32 deletions crates/iota-storage/src/key_value_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -403,15 +403,6 @@ impl TransactionKeyValueStore {
})
}

pub async fn deprecated_get_transaction_checkpoint(
&self,
digest: TransactionDigest,
) -> IotaResult<Option<CheckpointSequenceNumber>> {
self.inner
.deprecated_get_transaction_checkpoint(digest)
.await
}

pub async fn get_object(
&self,
object_id: ObjectID,
Expand Down Expand Up @@ -452,11 +443,6 @@ pub trait TransactionKeyValueStoreTrait {
checkpoint_contents_by_digest: &[CheckpointContentsDigest],
) -> IotaResult<KVStoreCheckpointData>;

async fn deprecated_get_transaction_checkpoint(
&self,
digest: TransactionDigest,
) -> IotaResult<Option<CheckpointSequenceNumber>>;

async fn get_object(
&self,
object_id: ObjectID,
Expand Down Expand Up @@ -588,24 +574,6 @@ impl TransactionKeyValueStoreTrait for FallbackTransactionKVStore {
Ok((res.0, res.1, res.2, res.3))
}

#[instrument(level = "trace", skip_all)]
async fn deprecated_get_transaction_checkpoint(
&self,
digest: TransactionDigest,
) -> IotaResult<Option<CheckpointSequenceNumber>> {
let mut res = self
.primary
.deprecated_get_transaction_checkpoint(digest)
.await?;
if res.is_none() {
res = self
.fallback
.deprecated_get_transaction_checkpoint(digest)
.await?;
}
Ok(res)
}

#[instrument(level = "trace", skip_all)]
async fn get_object(
&self,
Expand Down
7 changes: 0 additions & 7 deletions crates/iota-storage/tests/key_value_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,6 @@ impl TransactionKeyValueStoreTrait for MockTxStore {
Ok((summaries, contents, summaries_by_digest, contents_by_digest))
}

async fn deprecated_get_transaction_checkpoint(
&self,
digest: TransactionDigest,
) -> IotaResult<Option<CheckpointSequenceNumber>> {
Ok(self.tx_to_checkpoint.get(&digest).cloned())
}

async fn get_object(
&self,
object_id: ObjectID,
Expand Down
Loading