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

Add reducer API production warning #1728

Merged
merged 19 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
6e8d431
docs(reducer-composite.ts): add warning comment about actions and red…
ymekuria Jun 27, 2024
0707bee
docs(map.ts): add warning message about the development status of Act…
ymekuria Jun 27, 2024
e9260ea
feat(reducer-composite): update production warning
ymekuria Jun 27, 2024
616f316
docs(actions-as-merkle-list-iterator.ts): add warning about actions a…
ymekuria Jun 27, 2024
281923f
docs(actions-as-merkle-list.ts): add warning about actions and reduce…
ymekuria Jun 28, 2024
b32799f
docs(reducer.ts): add warning message to reducer doc comments about t…
ymekuria Jul 8, 2024
7e427a9
docs(actions-as-merkle-list-iterator.ts): update warning message abou…
ymekuria Jul 8, 2024
3b871a2
docs(actions-as-merkle-list.ts): update warning message to reflect cu…
ymekuria Jul 8, 2024
6bd9f2a
docs(map.ts): update warning message to provide more specific informa…
ymekuria Jul 8, 2024
ce429b6
refactor(reducer): format warning messages to mention.
ymekuria Jul 8, 2024
d780e3e
docs(dex-with-actions.ts): add warning about reducer API limitation i…
ymekuria Jul 8, 2024
626300e
docs(voting/demo.ts): update comments to provide a warning about the …
ymekuria Jul 9, 2024
a78d4f1
docs(zkapps): update warning messages in dex and voting examples to m…
ymekuria Jul 9, 2024
4077d3a
docs(voting.ts): add warning comment about the current limitations of…
ymekuria Jul 9, 2024
bc50f5f
refactor(map.ts): format warning message
ymekuria Jul 9, 2024
958f95b
Revert "refactor(map.ts): format warning message"
ymekuria Jul 9, 2024
467db24
Merge branch 'main' into feature/actions-reducers-warning
ymekuria Jul 9, 2024
1c762cf
chore(CHANGELOG): update changelog
ymekuria Jul 9, 2024
1c736ad
chore(CHANGELOG.md): update changelog
ymekuria Jul 9, 2024
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
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm

### Added

- A warning about the current reducer API limitations, as well as a mention of active work to mitigate them was added to doc comments and examples https://github.com/o1-labs/o1js/pull/1728

- `ForeignField`-based representation of scalars via `ScalarField` https://github.com/o1-labs/o1js/pull/1705
- Introduced new V2 methods for nullifier operations: `isUnusedV2()`, `assertUnusedV2()`, and `setUsedV2()` https://github.com/o1-labs/o1js/pull/1715

Expand Down
6 changes: 5 additions & 1 deletion src/examples/zkapps/dex/dex-with-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
* This DEX implementation differs from ./dex.ts in two ways:
* - More minimal & realistic; stuff designed only for testing protocol features was removed
* - Uses an async pattern with actions that lets users claim funds later and reduces account updates
*/
*
* Warning: The reducer API in o1js is currently not safe to use in production applications. The `reduce()`
* method breaks if more than the hard-coded number (default: 32) of actions are pending. Work is actively
* in progress to mitigate this limitation.
*/
import {
Account,
AccountUpdate,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
*
* This is mainly intended as an example for using `Iterator` and `MerkleList`, but it might also be useful as
* a blueprint for processing actions in a custom and more explicit way.
*/
*
* Warning: The reducer API in o1js is currently not safe to use in production applications. The `reduce()`
* method breaks if more than the hard-coded number (default: 32) of actions are pending. Work is actively
* in progress to mitigate this limitation.
*/
import {
Field,
Mina,
Expand Down
6 changes: 5 additions & 1 deletion src/examples/zkapps/reducer/actions-as-merkle-list.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@
*
* This is mainly intended as an example for using `MerkleList`, but it might also be useful as
* a blueprint for processing actions in a custom and more explicit way.
*/
*
* Warning: The reducer API in o1js is currently not safe to use in production applications. The `reduce()`
* method breaks if more than the hard-coded number (default: 32) of actions are pending. Work is actively
* in progress to mitigate this limitation.
*/
import {
Bool,
Mina,
Expand Down
4 changes: 4 additions & 0 deletions src/examples/zkapps/reducer/map.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ In this example, the keys are public keys, and the values are arbitrary field el

This utilizes the `Reducer` as an append online list of actions, which are then looked at to find the value corresponding to a specific key.

Warning: The reducer API in o1js is currently not safe to use in production applications. The reduce()
method breaks if more than the hard-coded number (default: 32) of actions are pending. Work is actively
in progress to mitigate this limitation.


```ts
// js
Expand Down
8 changes: 8 additions & 0 deletions src/examples/zkapps/reducer/reducer-composite.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
/**
* This example demonstrates a pattern to use actions for concurrent state updates.
*
* Warning: The reducer API in o1js is currently not safe to use in production applications. The `reduce()`
* method breaks if more than the hard-coded number (default: 32) of actions are pending. Work is actively
* in progress to mitigate this limitation.
*/

import {
Field,
state,
Expand Down
11 changes: 9 additions & 2 deletions src/examples/zkapps/voting/demo.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
// used to do a dry run, without tests
// ./run ./src/examples/zkapps/voting/demo.ts

/*
* used to do a dry run, without tests
* ./run ./src/examples/zkapps/voting/demo.ts
*
* Warning: The reducer API in o1js is currently not safe to use in production applications. The `reduce()`
* method breaks if more than the hard-coded number (default: 32) of actions are pending. Work is actively
* in progress to mitigate this limitation.
*/

import { Mina, AccountUpdate, PrivateKey, UInt64, Reducer, Bool } from 'o1js';
import { VotingApp, VotingAppParams } from './factory.js';
Expand Down
5 changes: 5 additions & 0 deletions src/examples/zkapps/voting/membership.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* Warning: The reducer API in o1js is currently not safe to use in production applications. The `reduce()`
* method breaks if more than the hard-coded number (default: 32) of actions are pending. Work is actively
* in progress to mitigate this limitation.
*/
import {
Field,
SmartContract,
Expand Down
5 changes: 5 additions & 0 deletions src/examples/zkapps/voting/voting.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/*
* Warning: The reducer API in o1js is currently not safe to use in production applications. The `reduce()`
* method breaks if more than the hard-coded number (default: 32) of actions are pending. Work is actively
* in progress to mitigate this limitation.
*/
import {
Field,
SmartContract,
Expand Down
3 changes: 3 additions & 0 deletions src/lib/mina/actions/reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ type ReducerReturn<Action> = {
* );
* ```
*
* Warning: The reducer API in o1js is currently not safe to use in production applications. The `reduce()`
* method breaks if more than the hard-coded number (default: 32) of actions are pending. Work is actively
* in progress to mitigate this limitation.
*/
reduce<State>(
actions: MerkleList<MerkleList<Action>>,
Expand Down
Loading