Skip to content
Open
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions src/app/runtime_genesis_ledger/runtime_genesis_ledger.ml
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,10 @@ let main ~(constraint_constants : Genesis_constants.Constraint_constants.t)
let%bind accounts, staking_accounts_opt, next_accounts_opt =
load_config_exn config_file
in
if List.length accounts > 1 lsl constraint_constants.ledger_depth then
Copy link
Member

@cjjdespres cjjdespres Sep 10, 2025

Choose a reason for hiding this comment

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

It might be worth adding a ledger_capacity or max_address method at some point, just to formalize the fact that a ledger can hold at most 2^depth accounts.

There's code in src/lib/merkle_address/merkle_address.ml that also does this check:

let of_int_exn ~ledger_depth index =
  if Int.(index >= 1 lsl ledger_depth) then failwith "Index is too large"

But nothing dedicated to this value specifically.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but it's not obvious why we're running into this error in this context.

failwith
"Ledger depth is too small to store all accounts provided, are you \
compiling this executable with correct profile? " ;
let ledger =
load_ledger ~ignore_missing_fields ~pad_app_state ~constraint_constants
accounts
Expand Down