IntersectMBO / IntersectMBO/ouroboros-consensus
TxId in ShelleyTx is redundant
- Dominant language
- Haskell
- Stars
- 67
- Forks
- 43
- Avg merge
- 5d 13h
- Merged PRs (30d)
- 43
Description
This type family could be turned into a `newtype` instead of data, since `Tx era` already stores memoized version of `TxId`, which is what `txIdTx` actually extracts [`mkShelleyTx`](https://github.com/IntersectMBO/ouroboros-consensus/blob/62ede713d5e56633e575bc7e18dac2ef5c56771e/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Mempool.hs#L189-L190)
https://github.com/IntersectMBO/ouroboros-consensus/blob/62ede713d5e56633e575bc7e18dac2ef5c56771e/ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Mempool.hs#L115-L116
In other words calling `txIdTx` does not recompute the hash, so there is no reason to store it twice.
Same applies to `ShelleyValidatedTx`
Contributor guide
Research direction
Start in ouroboros-consensus-cardano/src/shelley/Ouroboros/Consensus/Shelley/Ledger/Mempool.hs, especially mkShelleyTx and txIdTx. Inspect ShelleyTx and ShelleyValidatedTx to confirm where TxId is stored and extracted; done means both types no longer store the redundant value while their existing behavior remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- blockchain
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100