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

miscelaneous small changes #2087

Merged
merged 9 commits into from
Jan 3, 2025
Merged

miscelaneous small changes #2087

merged 9 commits into from
Jan 3, 2025

Conversation

larskuhtz
Copy link
Contributor

@larskuhtz larskuhtz commented Dec 23, 2024

A number of small unrelated changes. It is easiest to review on a per commit basis.

Comment on lines +274 to +275
-- TODO: Shouldn't this type guarantee that the map is total, i.e. that there
-- exists a value for each chain?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmmmmm... maybe we can do this, yes. Please leave this comment here.

Comment on lines +314 to +319

type instance Index (ChainMap a) = ChainId
type instance IxValue (ChainMap a) = a

instance IxedGet (ChainMap a) where
ixg i = atChain i
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably even have an Ixed instance.

@@ -29,7 +29,6 @@ module Chainweb.BlockHeaderDB.Internal
(
-- * Internal Types
RankedBlockHeader(..)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need RankedBlockHeader with the Ranked newtype? I suppose if we make it wrap a Ranked BlockHeader, that will waste some memory by duplicating the height.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, that's the reasoning for not using Ranked with BlockHeader.

edmundnoble
edmundnoble previously approved these changes Jan 3, 2025
Copy link
Contributor

@edmundnoble edmundnoble left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see that this:

  • adds a Ranked type, which should be able to replace a couple newtypes like for RankedBlockHash.
  • adds some extra instances for ChainMap and a salient comment.
  • splits BlockPayloadHash into its own file - of course this is required by EVM.
  • adds some other utilities and missing instances.

Co-authored-by: chessai <[email protected]>
Co-authored-by: Edmund Noble <[email protected]>
@larskuhtz larskuhtz enabled auto-merge January 3, 2025 22:12
@larskuhtz larskuhtz disabled auto-merge January 3, 2025 23:05
@larskuhtz larskuhtz merged commit b93a15b into master Jan 3, 2025
10 checks passed
@larskuhtz larskuhtz deleted the lars/misc branch January 3, 2025 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants