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

Blockchain: add alt-block handling #260

Merged
merged 33 commits into from
Sep 19, 2024
Merged

Blockchain: add alt-block handling #260

merged 33 commits into from
Sep 19, 2024

Conversation

Boog900
Copy link
Member

@Boog900 Boog900 commented Aug 29, 2024

What

Adds alt block handling to the blockchain storage.

How

Follows #194

@github-actions github-actions bot added A-storage Related to storage. A-types Related to types. labels Aug 29, 2024
@Boog900 Boog900 force-pushed the storage-alt-blocks branch from 329a38b to e1ae848 Compare August 30, 2024 02:02
@github-actions github-actions bot added A-dependency Related to dependencies, or changes to a Cargo.{toml,lock} file. A-workspace Changes to a root workspace file or general repo file. labels Sep 5, 2024
@github-actions github-actions bot added A-test-utils Related to test-utils. A-helper Related to cuprate-helper. labels Sep 8, 2024
@Boog900 Boog900 marked this pull request as ready for review September 8, 2024 15:16
helper/src/tx_utils.rs Outdated Show resolved Hide resolved
storage/blockchain/src/ops/alt_block/mod.rs Outdated Show resolved Hide resolved
storage/blockchain/src/ops/block.rs Show resolved Hide resolved
storage/blockchain/src/ops/block.rs Show resolved Hide resolved
@Boog900 Boog900 requested a review from hinto-janai September 8, 2024 17:42
Copy link
Contributor

@hinto-janai hinto-janai left a comment

Choose a reason for hiding this comment

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

Will review again.

helper/Cargo.toml Outdated Show resolved Hide resolved
types/src/blockchain.rs Outdated Show resolved Hide resolved
types/src/blockchain.rs Outdated Show resolved Hide resolved
types/src/blockchain.rs Show resolved Hide resolved
types/src/blockchain.rs Show resolved Hide resolved
storage/blockchain/src/service/write.rs Outdated Show resolved Hide resolved
storage/blockchain/src/service/write.rs Outdated Show resolved Hide resolved
storage/blockchain/src/service/write.rs Outdated Show resolved Hide resolved
storage/blockchain/src/tables.rs Outdated Show resolved Hide resolved
storage/blockchain/src/types.rs Outdated Show resolved Hide resolved
@Boog900 Boog900 requested a review from hinto-janai September 16, 2024 02:12
storage/blockchain/src/ops/alt_block/mod.rs Outdated Show resolved Hide resolved
storage/blockchain/src/ops/alt_block/mod.rs Outdated Show resolved Hide resolved
helper/Cargo.toml Outdated Show resolved Hide resolved
helper/src/lib.rs Outdated Show resolved Hide resolved
helper/src/tx.rs Show resolved Hide resolved
storage/blockchain/src/service/write.rs Outdated Show resolved Hide resolved
storage/blockchain/src/service/write.rs Outdated Show resolved Hide resolved
storage/blockchain/src/service/write.rs Outdated Show resolved Hide resolved
Comment on lines -190 to +192
pub weight: u64,
pub weight: usize,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there a reason things are mostly usize instead of u64? Here but also across the codebase in general, e.g. DB service messages.

They are required to be u64 elsewhere (especially in RPC) and these usizes permeate and cause usize_to_u64() to be everywhere. I understand indices but these aren't that. Can we start using u64 instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a trade of between what type is needed more, I used to use u64s everywhere but I changed it here: #201 and I do remember there being an improvement.

This is a weight which is often calculated by getting the size of a Vec, which is given in a usize. Plus you could change the JSON types to be usizes right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Changing this actually removed multiple conversions in the DB

Copy link
Contributor

Choose a reason for hiding this comment

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

The types are defined as 64-bit in monerod, I don't think defining public fields within public RPC types as usize is a good tradeoff. Probably won't affect many machines but not worth it IMO. I'm okay with using the cast functions if these need to be usize elsewhere.

test-utils/Cargo.toml Outdated Show resolved Hide resolved
@Boog900 Boog900 requested a review from hinto-janai September 18, 2024 22:10
storage/blockchain/src/service/write.rs Outdated Show resolved Hide resolved
@Boog900 Boog900 merged commit 4169c45 into main Sep 19, 2024
6 checks passed
@Boog900 Boog900 deleted the storage-alt-blocks branch September 19, 2024 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-dependency Related to dependencies, or changes to a Cargo.{toml,lock} file. A-helper Related to cuprate-helper. A-storage Related to storage. A-test-utils Related to test-utils. A-types Related to types. A-workspace Changes to a root workspace file or general repo file.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants