Skip to content
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
6ce87e1
fork choice
turuslan Sep 19, 2025
a23818b
test
turuslan Sep 19, 2025
352214f
test
turuslan Sep 19, 2025
d4eb551
test
turuslan Sep 19, 2025
7fc3609
fix gcc
turuslan Sep 19, 2025
dbbe9bf
pr comment
turuslan Sep 19, 2025
b30b5ae
pr comment
turuslan Sep 22, 2025
9ec3687
Add slot interval start events and corresponding handlers
kamilsa Sep 23, 2025
f1a01c3
Add genesis configuration support to node injector
kamilsa Sep 23, 2025
73d7f73
Add fork choice store integration in networking and module instances
kamilsa Sep 24, 2025
f59b1f0
Integrate ForkChoiceStore into various modules and update related con…
kamilsa Sep 24, 2025
d899917
Refactor Block and BlockBody to use variable size containers; impleme…
kamilsa Sep 24, 2025
e399d8e
Enhance fork choice logic: implement block production and current slo…
kamilsa Sep 26, 2025
11a5679
ForkChoiceStore constructor
kamilsa Sep 26, 2025
56210c1
Return result in produce block
kamilsa Sep 26, 2025
b91ca19
Small cleaning
kamilsa Sep 26, 2025
ee903e7
Refactor ForkChoiceStore: integrate manual clock for time management;…
kamilsa Sep 26, 2025
578bc74
Genesis interval ms const
kamilsa Sep 29, 2025
2058702
Update comment
kamilsa Sep 29, 2025
6e9125e
Refactor timeline implementation: calculate absolute intervals for sl…
kamilsa Sep 29, 2025
23297c3
Merge remote-tracking branch 'origin/feature/fork_choice_timeline' in…
kamilsa Sep 29, 2025
bc088b5
Refactor ForkChoiceStore: simplify block production logic and update …
kamilsa Sep 29, 2025
6dfb116
Refactor ForkChoiceStore: simplify block production logic and update …
kamilsa Sep 29, 2025
1495cf8
Review fixes 1
kamilsa Sep 30, 2025
f55b1bd
Fix test (autogenerate)
kamilsa Sep 30, 2025
87438b6
Fix cmake
kamilsa Sep 30, 2025
e4c378c
Fix lean node
kamilsa Sep 30, 2025
0e14bc6
Merge remote-tracking branch 'origin/master' into feature/fork_choice…
kamilsa Sep 30, 2025
0ecc5f5
Small fixes
kamilsa Sep 30, 2025
d4e2f06
Small fixes
kamilsa Sep 30, 2025
8e32159
Review fixes 2
kamilsa Sep 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions DEPRECATED.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
[Spec](https://github.com/leanEthereum/leanSpec) uses names like
`get_vote_target`,\
but they should be converted to `getVoteTarget`.\
Yes, text search doesn't work.

---

Module system uses subscriptions and messages.\
For example:

Expand Down
28 changes: 26 additions & 2 deletions src/app/impl/timeline_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ namespace lean::app {

void TimelineImpl::start() {
auto now = clock_->nowMsec();
auto next_slot = (now - config_->genesis_time) / SLOT_DURATION_MS + 1;
auto next_slot = now > config_->genesis_time // somehow now could be less
// than genesis time
? (now - config_->genesis_time) / SLOT_DURATION_MS + 1
: 1;
auto time_to_next_slot =
config_->genesis_time + SLOT_DURATION_MS * next_slot - now;
if (time_to_next_slot < SLOT_DURATION_MS / 2) {
Expand Down Expand Up @@ -82,7 +85,28 @@ namespace lean::app {
auto time_to_next_slot =
config_->genesis_time + SLOT_DURATION_MS * next_slot - now;

SL_INFO(logger_, "Next slot is {} in {}ms", msg->slot, time_to_next_slot);
SL_INFO(logger_, "Next slot is {} in {}ms", next_slot, time_to_next_slot);

auto time_to_interval_1 = SECONDS_PER_INTERVAL * 1000;
se_manager_->notifyDelayed(
std::chrono::milliseconds(time_to_interval_1),
EventTypes::SlotIntervalOneStarted,
std::make_shared<const messages::SlotIntervalOneStarted>(msg->slot,
msg->epoch));

auto time_to_interval_2 = 2 * SECONDS_PER_INTERVAL * 1000;
se_manager_->notifyDelayed(
std::chrono::milliseconds(time_to_interval_2),
EventTypes::SlotIntervalTwoStarted,
std::make_shared<const messages::SlotIntervalTwoStarted>(msg->slot,
msg->epoch));

auto time_to_interval_3 = 3 * SECONDS_PER_INTERVAL * 1000;
se_manager_->notifyDelayed(
std::chrono::milliseconds(time_to_interval_3),
EventTypes::SlotIntervalThreeStarted,
std::make_shared<const messages::SlotIntervalThreeStarted>(msg->slot,
msg->epoch));

se_manager_->notifyDelayed(
std::chrono::milliseconds(time_to_next_slot),
Expand Down
2 changes: 2 additions & 0 deletions src/blockchain/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@
#

add_library(blockchain
fork_choice.cpp
impl/block_storage_error.cpp
impl/block_storage_impl.cpp
impl/block_storage_initializer.cpp
impl/block_tree_error.cpp
impl/block_tree_impl.cpp
impl/fc_block_tree.cpp
impl/block_tree_initializer.cpp
impl/cached_tree.cpp
impl/genesis_block_header_impl.cpp
Expand Down
Loading