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

πŸ› οΈ [TASK] : Remove all dead code annotations #1721

Open
70 tasks
Tracked by #1719
stevenj opened this issue Jan 29, 2025 · 0 comments Β· May be fixed by #1734
Open
70 tasks
Tracked by #1719

πŸ› οΈ [TASK] : Remove all dead code annotations #1721

stevenj opened this issue Jan 29, 2025 · 0 comments Β· May be fixed by #1734
Assignees
Labels
requires architecture review Requires at least 1 architect to sign off on PR before merge.

Comments

@stevenj
Copy link
Collaborator

stevenj commented Jan 29, 2025

Remove the #[allow(dead_code)] annotations within cat-gateway, and list all functions/types which are really dead.

Attach the list as a series of links to the code which is really dead, for further analysis.

Also look for any modules which are not being included, or large sections of code which are commented out or disabled in any way.

Dead code often occurs in large groups, try and group them in the list if the functions, types, etc are all related, or call one another.
Try and put the highest function which is dead at the top of the group. This is because all the other functions are dead if they are only called by this top level function, so it helps analyze what dead and if it should be dead or not.

This ticket will create a draft PR with all the annotations removed, but that PR will not get merged as is, it will be expanded once the true list of dead code has been reviewed and functions are approved for removal.

List of Dead Code found

  • Example
  • These are all legacy codes inside the project: bin/src/db/event/legacy and bin/src/service/common/objects/legacy. They can be removed without any side effects. When remove this part, also consider to remove their dependency: rust_decimal.
  • bin/src/cardano/cip36_registration_obsolete: including obsolete Rust code and CDDL code
  • bin/src/cardano/mod.rs:
    • 30: MAX_BLOCKS_BATCH_LEN
  • bin/src/cardano/util.rs:
    • 9: type WitnessHash
    • 12: type WitnessPubKey
    • 15: type StakeCredentialHash
    • 18: type StakeCredentialKey
    • 42: fn parse_policy_assets
    • 56: fn parse_child_assets
    • 84: fn valid_era
    • 91: extract_stake_credentials_from_certs
    • 121: fn find_matching_stake_credential
  • bin/src/db/event/common/query_limits.rs
    • 13: QueryLimitsInner::All
    • 15: QueryLimitsInner::Limit
    • 35: QueryLimits::ALL
    • 38: QueryLimits::ONE
  • bin/src/db/event/signed_docs/full_signed_doc.rs
    • 50: fn authors
    • 56: fn metadata
    • 62: fn body
  • bin/src/db/event/signed_docs/signed_doc_body.rs
    • 49: fn authors
  • bin/src/db/index/session.rs
    • 57: CassandraSession::persistent
  • bin/src/db/index/queries/mod.rs
    • 170: type FallibleQueryResult
  • bin/src/db/index/schema/mod.rs
    • 20: const SCHEMA_VERSION
  • bin/src/service/api/cardano/registration_get.rs this file is unused (not included)
  • bin/src/service/api/cardano/sync_state_get.rs
    • 16: Responses::Ok
  • bin/src/service/api/cardano/types.rs
    • 18: fn get_credentials
    • 23: fn bytes
    • 55: type TxId
    • 58: type StakeCredential
    • 61: type PublicVotingInfo
    • 64: type PaymentAddress
    • 69: type MetadataCip36
  • bin/src/service/api/health/live_get.rs
    • 14: fn set_live
  • bin/src/service/common/auth/api_key.rs
    • 25: struct InternalApiKeyAuthorization(String) the String inside the struct
  • bin/src/service/common/objects/cardano/registration_info.rs
    • 72: fn RegistrationInfo::new
  • bin/src/service/common/objects/generic/pagination.rs
    • 9: const CURRENT_PAGE_DESCRIPTION
    • 46: fn CurrentPage::new
  • bin/src/service/common/responses/mod.rs
    • 63: TooManyRequests
    • 160: fn unauthorized
    • 170: fn forbidden
    • 188: fn rate_limit
  • bin/src/service/common/types/cardano/nonce.rs
    • 117: fn into_option
  • bin/src/service/common/types/cardano/txn_index.rs
    • 138: fn into_option
  • bin/src/service/common/types/headers/retry_after.rs
    • 20: RetryAfterHeader::Date
    • 34: RetryAfterOption::None
    • 36: RetryAfterOption::Some
  • bin/src/utils/blake2b_hash.rs
    • 43: type Blake2b224
    • 52: fn blake2b_224
    • 69: type Blake2b256
    • 79: fn blake2b_256
@stevenj stevenj changed the title Remove all #[dead-code] annotations and list all functions/types which are really dead. πŸ› οΈ [TASK] : Remove all #[dead-code] annotations Jan 29, 2025
@stevenj stevenj changed the title πŸ› οΈ [TASK] : Remove all #[dead-code] annotations πŸ› οΈ [TASK] : Remove all dead code annotations Jan 29, 2025
@stevenj stevenj moved this from New to πŸ”– Ready in Catalyst Jan 29, 2025
@stevenj stevenj added this to the Fund14 Technical Readiness milestone Jan 29, 2025
@stevenj stevenj added the requires architecture review Requires at least 1 architect to sign off on PR before merge. label Jan 29, 2025
@apskhem apskhem moved this from πŸ”– Ready to πŸ— In progress in Catalyst Jan 29, 2025
@apskhem apskhem self-assigned this Jan 29, 2025
@apskhem apskhem moved this from πŸ— In progress to πŸ‘€ In review in Catalyst Jan 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
requires architecture review Requires at least 1 architect to sign off on PR before merge.
Projects
Status: πŸ‘€ In review
2 participants