Skip to content

Conversation

glyh
Copy link
Member

@glyh glyh commented Sep 5, 2025

Added a helpful error message, telling user they might be using a wrong build profile if situation occurs.

@glyh glyh requested a review from a team as a code owner September 5, 2025 07:34
@glyh glyh added the enhancement Not big enough to be a feature, but is a smaller improvement label Sep 5, 2025
@cjjdespres
Copy link
Member

Has this error been seen in practice at all? Just out of curiosity.

@@ -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.

@glyh
Copy link
Member Author

glyh commented Sep 11, 2025

Has this error been seen in practice at all? Just out of curiosity.

I run into this when using a wrong profile on this executable. It's kinda silly yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Not big enough to be a feature, but is a smaller improvement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants