Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bring V2 up to date #296

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
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
11 changes: 10 additions & 1 deletion lib/provable-generic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,17 @@ function createDerivers<Field>(): {

if (hasProvable(typeObj)) return typeObj.provable.toFields(obj);

if (Array.isArray(typeObj))
if (Array.isArray(typeObj)) {
if (!Array.isArray(obj)) {
throw Error(`Expected an array for type, but got ${typeof obj}`);
}
if (typeObj.length !== obj.length) {
throw Error(
`Expected array length ${typeObj.length}, but got ${obj.length}`
);
}
return typeObj.map((t, i) => toFields(t, obj[i])).flat();
}

if (isProvable(typeObj)) return typeObj.toFields(obj);

Expand Down
2 changes: 1 addition & 1 deletion ocaml/lib/local_ledger.ml
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ let account_to_json =
lazy (Mina_base.Account.deriver @@ Fields_derivers_zkapps.o ())
in
let to_json (account : Mina_base.Account.t) : Js.Unsafe.any =
account
Mina_base.Account.to_poly account
|> Fields_derivers_zkapps.to_json (Lazy.force deriver)
|> Yojson.Safe.to_string |> Js.string |> Util.json_parse
in
Expand Down
Loading