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

Fix: this === undefined in Struct static methods #689

Merged
merged 2 commits into from
Jan 12, 2023

Conversation

mitschabaude
Copy link
Collaborator

@mitschabaude mitschabaude commented Jan 12, 2023

fixes a bug reported by community member

@@ -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;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

the problem here was that pulling those static members out of the class is not compatible with using this in those static methods. js rookie mistake

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

and it turns out wee don't need that toConstant logic anymore, at all, because Circuit.witness does that under the hood anyway

@mitschabaude mitschabaude merged commit f4b6aa7 into main Jan 12, 2023
@mitschabaude mitschabaude deleted the fix/reducer-struct branch January 12, 2023 14:49
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.

2 participants