Skip to content

Commit

Permalink
fix this = undefined bug in reduce
Browse files Browse the repository at this point in the history
  • Loading branch information
mitschabaude committed Jan 12, 2023
1 parent f2b316a commit 5c98d33
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/lib/zkapp.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1268,16 +1268,8 @@ Use the optional \`maxTransactionsWithActions\` argument to increase this number
// also, for each action length, compute the new state and then pick the actual one
let newStates = actionss.map((actions) => {
// we generate a new witness for the state so that this doesn't break if `apply` modifies the state
let newState = Circuit.witness(stateType, () => {
// TODO: why doesn't this work without the toConstant mapping?
let { toFields, fromFields, toAuxiliary } = stateType;
return fromFields(
toFields(state).map((x) => x.toConstant()),
toAuxiliary(state)
);
// return state;
});
Circuit.assertEqual(newState, state);
let newState = Circuit.witness(stateType, () => state);
Circuit.assertEqual(stateType, newState, state);
actions.forEach((action) => {
newState = reduce(newState, action);
});
Expand Down

0 comments on commit 5c98d33

Please sign in to comment.