Skip to content

Conversation

@glyh
Copy link
Member

@glyh glyh commented Dec 8, 2025

This is a request from @Trivo25, having a function exposing the account conversion phase that o1js could refer to, for testing purpose.

Context: https://o1-labs.slack.com/archives/C02BFPS6BA4/p1765170746704759

I also discovered there's a bug when doing this: chunked migration doesn't have vesting param update in it.

@glyh glyh requested a review from a team as a code owner December 8, 2025 06:41

let of_stable (account : Stable.Latest.t) : t =
(* This function converts Berkeley account to Mesa account *)
let of_stable ~hardfork_slot (account : Stable.Latest.t) : t =
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the function we expect to expose to o1js's end. hardfork_slot is the slot where HF happen.

hardfork_slot is the slot when HF happen, in Mesa the slot time is different before/after this slot. This is needed only to patch vesting params. Which could be less relevant for testing zkApps. @Trivo25

List.mapi stable_locations_and_accounts ~f:(fun i acct ->
( Ledger.Hardfork_db.Addr.of_int_exn ~ledger_depth i
, Account.Hardfork.of_stable acct ) )
, Account.Hardfork.of_stable ~hardfork_slot acct ) )
Copy link
Member Author

Choose a reason for hiding this comment

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

This was a bug.

assert (Ledger_hash.equal start_hash (merkle_root ledger)) ;
(merkle_path ledger new_loc, Account.empty)

module Converting_for_tests = struct
Copy link
Member Author

@glyh glyh Dec 8, 2025

Choose a reason for hiding this comment

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

I moved some converting ledger funcs here. This is because with hardfork slot is not known here, and it's not used in anything other than tests.

new_accounts )
|> List.concat

let convert_and_apply_all_masks_to_ledger ~hardfork_db ({ ledger; _ } : t) =
Copy link
Member Author

Choose a reason for hiding this comment

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

removed as not used & requires hf slot present.

@glyh glyh requested a review from cjjdespres December 8, 2025 06:48
@glyh
Copy link
Member Author

glyh commented Dec 8, 2025

!ci-build-me

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.

3 participants