Skip to content

Conversation

@xDimon
Copy link
Member

@xDimon xDimon commented Sep 3, 2025

without block tree yet

Signed-off-by: Dmitriy Khaustov aka xDimon <[email protected]>
Signed-off-by: Dmitriy Khaustov aka xDimon <[email protected]>
Signed-off-by: Dmitriy Khaustov aka xDimon <[email protected]>
Signed-off-by: Dmitriy Khaustov aka xDimon <[email protected]>
BOOST_ASSERT_MSG(enc_res.has_value(),
"Header should be encoded errorless");
hash_opt.emplace(hasher.blake2b_256(enc_res.value()));
hash_opt.emplace(hasher.sha2_256(enc_res.value()));
Copy link
Contributor

Choose a reason for hiding this comment

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

leanSpec

Suggested change
hash_opt.emplace(hasher.sha2_256(enc_res.value()));
hash_opt.emplace(ssz::hash_tree_root(*this));

std::size_t operator()(const lean::BlockIndex &s) const noexcept {
std::size_t h = std::hash<lean::Slot>{}(s.slot);
for (auto b : s.hash) {
h ^= std::hash<std::uint8_t>{}(b) + 0x9e3779b97f4a7c15ULL + (h << 6)
Copy link
Contributor

Choose a reason for hiding this comment

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

boost::hash_combine?

Default = 0, ///< Default space used for general-purpose storage
LookupKey, ///< Space used for mapping lookup keys
Default = 0, ///< Default space used for general-purpose storage
SlotToHashes, ///< Space used for mapping lookup keys
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it store "best" chain (map<slot, hash>),
or would it also store unfinalized forks (map<(slot, hash), is_best>)?

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 store "one-to-multiple" records

@xDimon xDimon requested a review from kamilsa September 5, 2025 07:19
Signed-off-by: Dmitriy Khaustov aka xDimon <[email protected]>
Signed-off-by: Dmitriy Khaustov aka xDimon <[email protected]>
@kamilsa kamilsa requested review from Copilot and removed request for kamilsa September 5, 2025 07:46
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces block production capabilities to the lean Ethereum client, implementing a basic block production pipeline without the full block tree yet. The changes span multiple modules including cryptography, storage, blockchain management, and introduce a new production module.

  • Adds SHA-256 hashing support and simplifies the hasher interface by commenting out unused hash functions
  • Implements block tree structure with cached tree management for efficient block organization
  • Introduces production module with slot-based block generation and timeline management

Reviewed Changes

Copilot reviewed 80 out of 88 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/unit/blockchain/block_storage_test.cpp Updates test cases to use SHA-256 instead of blake2b and fixes storage space references
tests/mock/crypto/hasher_mock.hpp Comments out unused hash function mocks, keeping only SHA-256
src/types/* Adds new type definitions for blocks, headers, and blockchain primitives
src/crypto/hasher* Implements SHA-256 hashing and comments out unused hash functions
src/blockchain/impl/* Implements block tree, storage utilities, and cached tree management
src/modules/production/* New production module for block generation with slot-based timeline
src/app/impl/timeline_impl.* Implements timeline management for slot progression
src/storage/spaces.hpp Updates storage space names from LookupKey to SlotToHashes
Comments suppressed due to low confidence (1)

src/modules/shared/prodution_types.tmp.hpp:1

  • There's a typo in the filename. 'prodution_types' should be 'production_types'.
/**

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

#pragma once

#include <lean_types/chekpoint.hpp>
#include <types/chekpoint.hpp>
Copy link

Copilot AI Sep 5, 2025

Choose a reason for hiding this comment

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

There's a typo in the include path. 'chekpoint' should be 'checkpoint'.

Suggested change
#include <types/chekpoint.hpp>
#include <types/checkpoint.hpp>

Copilot uses AI. Check for mistakes.
BlockHeader header;
header.slot = 1;
header.parent_root = genesis_block_hash;
header.body_root = {};//ssz::hash_tree_root(body);
Copy link

Copilot AI Sep 5, 2025

Choose a reason for hiding this comment

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

The commented code should either be implemented or removed. Having commented production code reduces maintainability.

Suggested change
header.body_root = {};//ssz::hash_tree_root(body);
header.body_root = {};

Copilot uses AI. Check for mistakes.
header.slot = block.slot;
header.proposer_index = block.proposer_index;
header.parent_root = block.parent_root;
header.state_root = block.state_root;
Copy link

Copilot AI Sep 5, 2025

Choose a reason for hiding this comment

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

The commented code indicates incomplete implementation. Either implement the SSZ hash tree root calculation or add a TODO comment explaining why it's postponed.

Copilot uses AI. Check for mistakes.
logger_);

options.create_missing_column_families = true;

Copy link

Copilot AI Sep 5, 2025

Choose a reason for hiding this comment

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

The removed conditional check if (no_db_presented) means the database will always be opened, which might not be the intended behavior. Consider adding a comment explaining why this condition was removed.

Copilot uses AI. Check for mistakes.
@xDimon xDimon merged commit c9a197d into master Sep 5, 2025
2 checks passed
@xDimon xDimon deleted the feature/block_production branch September 5, 2025 09:21
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.

4 participants