SaitoTech / saito-lite

A cross-platform javascript saito implementation
https://saito.io
58 stars 20 forks source link

block validation error #264

Open f8daniel opened 2 years ago

f8daniel commented 2 years ago

How I got here: Trying to get saito-lite-rust to work locally, updated nodejs/npm. New versions of nodejs/npm required rebuilding node packages for saito-lite.

System Ubuntu WSL with Node.js 16.13.1 and npm 8.3.0 (npm 7.24.2 is completely identical)

Issue:

Behaviorally: The Saito-Lite node "works" as in one can connect to the localhost and navigate around. I can launch a game in one browser and click to join in a second browser. However, Joiner stays in perpetual "waiting" state, while game immediately disappears from originator. Console has a combination of the following errors:

ERROR 410829: block treasury does not validate in new block saito.js:70:113326
2867913960.86039713 -- vs -- 2839263213.88393200 ---> 2867942640.28680000 -- 0.0
...
ERROR 620394: block does not exist on disk that should. terminating

Terminal shows the following error: ERROR 582039: mempool already contains this transaction...

Any subsequent attempts to try the game again or different game, throws SQL errors in the terminal on top of the errors mentioned above, e.g.

[Error: SQLITE_CONSTRAINT: UNIQUE constraint failed: games.game_id] {
  errno: 19,
  code: 'SQLITE_CONSTRAINT'
}
[Error: SQLITE_CONSTRAINT: UNIQUE constraint failed: invites.acceptance_sig] {
  errno: 19,
  code: 'SQLITE_CONSTRAINT'
}

Attempted fixes (tried in non-exhaustive combinations)

Installing packages with Node 16.13.1 and npm 8.3.0 (or npm 7.24.2) throws a fair number of warnings:

npm WARN deprecated crypto@1.0.1: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in.
npm WARN deprecated babel@6.23.0: In 6.x, the babel package has been deprecated in favor of babel-cli. Check https://opencollective.com/babel to support the Babel maintainers
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated formidable@1.2.6: Please upgrade to latest, formidable@v2 or formidable@v3! Check these notes: https://bit.ly/2ZEqIau
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated node-pre-gyp@0.11.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.

Running "npm audit fix --force" fixes the Chokidar issue by upgrading to webpack5, but cannot compile/run because webpack config files aren't suitable (something with fs)

Downgrading (Node 14.18.2 with npm 6.14.15) creates pages and pages of warnings from node-gyp compiling of sqlite3 and secp256k1, but exhibits the same behavior and messages in the console & terminal. Node 13.14.0 same same.

Working hypothesis: Gremlins. If the repository hadn't been working fine up until the first week of December, I'd just assume it was a bug in the blockchain, but it has to be something in the runtime environment, no?

trevelyan commented 2 years ago

I'm able to create and join games.

Maybe there is an issue with master that is fixed in my branch?

I'll get a push ready for this evening and if we still have issues on that -- work with you to get them fixed.

--david

On Tue, Dec 28, 2021 at 1:34 AM Daniel Worlton @.***> wrote:

How I got here: Trying to get saito-lite-rust to work locally, updated nodejs/npm. New versions of nodejs/npm required rebuilding node packages for saito-lite.

System Ubuntu WSL with Node.js 16.13.1 and npm 8.3.0 (npm 7.24.2 is completely identical) Issue:

Behaviorally: The Saito-Lite node "works" as in one can connect to the localhost and navigate around. I can launch a game in one browser and click to join in a second browser. However, Joiner stays in perpetual "waiting" state, while game immediately disappears from originator. Console has a combination of the following errors:

ERROR 410829: block treasury does not validate in new block saito.js:70:113326 2867913960.86039713 -- vs -- 2839263213.88393200 ---> 2867942640.28680000 -- 0.0 ... ERROR 620394: block does not exist on disk that should. terminating

Terminal shows the following error: ERROR 582039: mempool already contains this transaction...

Any subsequent attempts to try the game again or different game, throws SQL errors in the terminal on top of the errors mentioned above, e.g.

[Error: SQLITE_CONSTRAINT: UNIQUE constraint failed: games.game_id] { errno: 19, code: 'SQLITE_CONSTRAINT' } [Error: SQLITE_CONSTRAINT: UNIQUE constraint failed: invites.acceptance_sig] { errno: 19, code: 'SQLITE_CONSTRAINT' }

Attempted fixes (tried in non-exhaustive combinations)

  • different versions of Nodejs ranging from 13-17 (17 fails to compile)
  • different versions of npm ranging from 4-8. (LockFileVersion change between <6 and >7 overwrites package-lock)
  • Completely deleted nodejs/npm and reinstalled via nvm
  • "npm audit fix" of vulnerabilities
  • clearing node_modules and building a clean "npm install"
  • deleting package-lock.json / reverting to remote-repo package-lock.json
  • nuking with recompile and resetting wallets in browsers (Firefox + Chrome)

Installing packages with Node 16.13.1 and npm 8.3.0 (or npm 7.24.2) throws a fair number of warnings:

npm WARN deprecated @.: This package is no longer supported. It's now a built-in Node module. If you've depended on crypto, you should switch to the one that's built-in. npm WARN deprecated @.: In 6.x, the babel package has been deprecated in favor of babel-cli. Check https://opencollective.com/babel to support the Babel maintainers npm WARN deprecated @.: Please see https://github.com/lydell/urix#deprecated npm WARN deprecated @.: this library is no longer supported npm WARN deprecated @.: https://github.com/lydell/resolve-url#deprecated npm WARN deprecated @.: Please upgrade to latest, @. or @.! Check these notes: https://bit.ly/2ZEqIau npm WARN deprecated @.: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies. npm WARN deprecated @.: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) npm WARN deprecated @.: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) npm WARN deprecated @.: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797) npm WARN deprecated @.: The querystring API is considered Legacy. new code should use the URLSearchParams API instead. npm WARN deprecated @.: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated @.: request has been deprecated, see https://github.com/request/request/issues/3142 npm WARN deprecated @.: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future npm WARN deprecated @.: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js. npm WARN deprecated @.: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.

Running "npm audit fix --force" fixes the Chokidar issue by upgrading to webpack5, but cannot compile/run because webpack config files aren't suitable (something with fs)

Downgrading (Node 14.18.2 with npm 6.14.15) creates pages and pages of warnings from node-gyp compiling of sqlite3 and secp256k1, but exhibits the same behavior and messages in the console & terminal. Node 13.14.0 same same.

Working hypothesis: Gremlins. If the repository hadn't been working fine up until the first week of December, I'd just assume it was a bug in the blockchain, but it has to be something in the runtime environment, no?

— Reply to this email directly, view it on GitHub https://github.com/SaitoTech/saito-lite/issues/264, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAHAMX4VWE6ZOHN2IQQ7WOTUTCWTHANCNFSM5K2YZZJQ . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>