Joystream / joystream

Joystream Monorepo
http://www.joystream.org
GNU General Public License v3.0
1.42k stars 115 forks source link

project-token pallet: disable all amm dispatch calls when pallet is frozen #5031

Closed mnaamani closed 8 months ago

mnaamani commented 8 months ago

Fixes https://github.com/Joystream/joystream/issues/5028

Was there a reason we didn't disable amm buy/sell dispatch calls. Or is this a case that AMM work was merged into nara after freezing feature was added and we simply overlooked it?

mnaamani commented 8 months ago

I will add two more tests for for buy/sell amm cases when pallet is frozen.

mnaamani commented 8 months ago

The runtime upgrade test script is failing:

storage trie downloaded at /home/runner/work/joystream/joystream/tests/network-tests/data/storage.json
yarn workspace v1.22.21
yarn run v1.22.21
$ node -r ts-node/register --unhandled-rejections=strict src/fork-off.ts /home/runner/work/joystream/joystream/tests/network-tests/data wss://rpc.joystream.org:9944
Error: Cannot create a string longer than 0x1fffffe8 characters
    at Object.slice (node:buffer:638:37)
    at Buffer.toString (node:buffer:857:14)
    at Object.readFileSync (node:fs:508:41)
    at main (/home/runner/work/joystream/joystream/utils/api-scripts/src/fork-off.ts:65:42)
    at processTicksAndRejections (node:internal/process/task_queues:95:5) {
  code: 'ERR_STRING_TOO_LONG'
}
Error: The operation was canceled.

Will need to revise it to address the specific issue described above. But also it seems the CI check is not exiting and it keeps running until some github defined timeout.

This is caused by the size of the exported state becoming very large > 800MB

mnaamani commented 8 months ago

Switched to use BFJ to parse large json file. Now we run out of memory when running the script :)

 <--- Last few GCs --->

[4775:0x6493c70]   313506 ms: Mark-sweep 4041.1 (4128.4) -> 4025.2 (4128.6) MB, 2149.7 / 0.0 ms  (average mu = 0.133, current mu = 0.012) allocation failure; scavenge might not succeed
[4775:0x6493c70]   315649 ms: Mark-sweep 4041.3 (4128.6) -> 4025.4 (4128.9) MB, 2119.8 / 0.0 ms  (average mu = 0.076, current mu = 0.011) allocation failure; scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Will probably need to use a streaming json parer instead. For now we can be satisfied with the try-runtime tests https://github.com/Joystream/joystream/actions/runs/7501462693/job/20422155610?pr=5031