starter-kit icon indicating copy to clipboard operation
starter-kit copied to clipboard

smart contract data: reset on encountering errors

Open laciferin2024 opened this issue 1 year ago • 2 comments

Reproducer

https://github.com/metafountain/minafountain/blob/38231e5c56eaa9b854f144e7b4ae70c6a5073df8/packages/chain/test/runtime/modules/Sudoku.test.ts#L100

pnpm env:inmemory dev
cd packages/chains 

pnpm run test Sudoku

My Debug


> [email protected] test /home/ubuntu/mc/packages/chain
> node --experimental-vm-modules ./node_modules/jest/bin/jest.js "Sudoku"

  console.log
    sudoku:  [
      [
        0, 5, 4, 7, 9,
        3, 8, 0, 2
      ],
      [
        0, 2, 0, 0, 0,
        0, 9, 5, 3
      ],
      [
        3, 1, 9, 0, 2,
        5, 7, 0, 0
      ],
      [
        0, 3, 8, 1, 0,
        0, 2, 4, 9
      ],
      [
        0, 6, 0, 0, 0,
        0, 3, 7, 0
      ],
      [
        0, 0, 0, 0, 0,
        9, 0, 8, 0
      ],
      [
        1, 0, 0, 3, 6,
        0, 4, 0, 0
      ],
      [
        7, 8, 0, 0, 4,
        0, 0, 9, 6
      ],
      [
        0, 4, 0, 9, 0,
        8, 0, 3, 7
      ]
    ]

      at test/runtime/modules/Sudoku.test.ts:24:9

  console.log
    solution: 6,5,4,7,9,3,8,1,2,8,2,7,6,1,4,9,5,3,3,1,9,8,2,5,7,6,4,5,3,8,1,7,6,2,4,9,9,6,1,4,8,2,3,7,5,4,7,2,5,3,9,6,8,1,1,9,5,3,6,7,4,2,8,7,8,3,2,4,1,5,9,6,2,4,6,9,5,8,1,3,7

      at test/runtime/modules/Sudoku.test.ts:25:9

(node:581455) ExperimentalWarning: VM Modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:581455) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
  console.log
    sudokuhash 22004436885088329933660952136453429729140642005655392203861934592288253629184

      at checkStatus (test/runtime/modules/Sudoku.test.ts:62:13)

  console.log
    solution: 6,5,4,7,9,3,8,1,2,8,2,7,6,1,4,9,5,3,3,1,9,8,2,5,7,6,4,5,3,8,1,7,6,2,4,9,9,6,1,4,8,2,3,7,5,4,7,2,5,3,9,6,8,1,1,9,5,3,6,7,4,2,8,7,8,3,2,4,1,5,9,6,2,4,6,9,5,8,1,3,7

      at test/runtime/modules/Sudoku.test.ts:25:9

(node:581455) ExperimentalWarning: VM Modules is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
(node:581455) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
  console.log
    sudokuhash 22004436885088329933660952136453429729140642005655392203861934592288253629184

      at checkStatus (test/runtime/modules/Sudoku.test.ts:62:13)

  console.log
    status: is Solved= false

      at checkStatus (test/runtime/modules/Sudoku.test.ts:64:13)

  console.log
    failed as expected

      at Object.<anonymous> (test/runtime/modules/Sudoku.test.ts:82:15)

  console.log
    sudokuhash 0

laciferin2024 avatar Nov 02 '24 02:11 laciferin2024

Upon submitting a wrong answer, the sudoku hash is geting reset

laciferin2024 avatar Nov 02 '24 02:11 laciferin2024

Apparently assert was the issue . This sdk has deprecated a lot of stuffs in o1js without leaving enough information. God maan, i miss rust

laciferin2024 avatar Nov 02 '24 02:11 laciferin2024