@typeberry/jam 0.0.1-ffdd6b4 → 0.0.4-9a78ba2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/3d2227eb3bf29d80c75a.js +3 -0
  2. package/6b655f8772c01b768329.js +1 -0
  3. package/LICENSE +5 -0
  4. package/README.md +202 -0
  5. package/bandersnatch/6b655f8772c01b768329.js +1 -0
  6. package/bandersnatch/ccf8ada94096a8f232f5.js +1 -0
  7. package/bandersnatch/e2fdc1b646378dd96eda.js +1 -0
  8. package/bandersnatch/index.js +3036 -0
  9. package/bandersnatch/index.js.map +1 -0
  10. package/bandersnatch/package.json +3 -0
  11. package/bandersnatch/sourcemap-register.cjs +1 -0
  12. package/block-generator/6b655f8772c01b768329.js +1 -0
  13. package/block-generator/bootstrap-generator.mjs +161 -0
  14. package/block-generator/bootstrap-generator.mjs.map +1 -0
  15. package/block-generator/ccf8ada94096a8f232f5.js +1 -0
  16. package/block-generator/e2fdc1b646378dd96eda.js +1 -0
  17. package/block-generator/index.js +18401 -0
  18. package/block-generator/index.js.map +1 -0
  19. package/block-generator/package.json +3 -0
  20. package/block-generator/sourcemap-register.cjs +1 -0
  21. package/bootstrap-generator.mjs.map +1 -0
  22. package/bootstrap-importer.mjs.map +1 -0
  23. package/bootstrap-network.mjs.map +1 -0
  24. package/ccf8ada94096a8f232f5.js +1 -0
  25. package/e2fdc1b646378dd96eda.js +1 -0
  26. package/importer/6b655f8772c01b768329.js +1 -0
  27. package/importer/bootstrap-bandersnatch.mjs.map +1 -0
  28. package/importer/ccf8ada94096a8f232f5.js +1 -0
  29. package/importer/e2fdc1b646378dd96eda.js +1 -0
  30. package/importer/index.js +25845 -0
  31. package/importer/index.js.map +1 -0
  32. package/importer/package.json +3 -0
  33. package/importer/sourcemap-register.cjs +1 -0
  34. package/index.js +57536 -0
  35. package/index.js.map +1 -0
  36. package/jam-network/3d2227eb3bf29d80c75a.js +3 -0
  37. package/jam-network/6b655f8772c01b768329.js +1 -0
  38. package/jam-network/bootstrap-network.mjs +161 -0
  39. package/jam-network/bootstrap-network.mjs.map +1 -0
  40. package/jam-network/ccf8ada94096a8f232f5.js +1 -0
  41. package/jam-network/e2fdc1b646378dd96eda.js +1 -0
  42. package/jam-network/index.js +47873 -0
  43. package/jam-network/index.js.map +1 -0
  44. package/jam-network/package.json +3 -0
  45. package/jam-network/sourcemap-register.cjs +1 -0
  46. package/package.json +9 -16
  47. package/sourcemap-register.cjs +1 -0
  48. package/bandersnatch_bg.wasm +0 -0
  49. package/ed25519_wasm_bg.wasm +0 -0
  50. package/reed_solomon_wasm_bg.wasm +0 -0
  51. package/typeberry.mjs +0 -3
  52. package/typeberry.mjs.LICENSE.txt +0 -94
@@ -0,0 +1,3 @@
1
+ export { default as quiche } from './quiche.js';
2
+ export * from './types.js';
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ module.exports = eval("require")("bandersnatch_bg.wasm");
package/LICENSE ADDED
@@ -0,0 +1,5 @@
1
+ Copyright (c) 2024 Fluffy Labs
2
+
3
+ This Source Code Form is subject to the terms of the Mozilla Public
4
+ License, v. 2.0. If a copy of the MPL was not distributed with this
5
+ file, You can obtain one at http://mozilla.org/MPL/2.0/.
package/README.md ADDED
@@ -0,0 +1,202 @@
1
+ # typeberry 🫐
2
+
3
+ [![JAM Conformance 0.7.0](https://github.com/FluffyLabs/typeberry/actions/workflows/vectors-jam-conformance-070.yml/badge.svg?branch=main)](https://github.com/FluffyLabs/typeberry/actions/workflows/vectors-jam-conformance-070.yml) [![W3F vectors](https://github.com/FluffyLabs/typeberry/actions/workflows/vectors-w3f.yml/badge.svg?branch=main)](https://github.com/FluffyLabs/typeberry/actions/workflows/vectors-w3f.yml) [![Publish commits](https://github.com/FluffyLabs/typeberry/actions/workflows/blockchain-git-log.yml/badge.svg?branch=main)](https://github.com/FluffyLabs/typeberry/actions/workflows/blockchain-git-log.yml) [![License: MPL 2.0](https://img.shields.io/badge/License-MPL%202.0-brightgreen.svg)](https://opensource.org/licenses/MPL-2.0)
4
+
5
+ Typeberry is a TypeScript implementation of [JAM protocol](https://graypaper.com/) by Fluffy Labs.
6
+
7
+ **NOTE: Since we are taking part in the JAM Prize, we do not accept any external
8
+ PRs unless the contributor waives any claims to the prize and copy rights for
9
+ the submitted code. By creating the PR you accept this requirement.**
10
+
11
+ ## Implementation status
12
+
13
+ Gray Paper compliance can be controlled via `GP_VERSION` environment variable.
14
+
15
+ - [x] 0.6.7
16
+ - [x] 0.7.0
17
+ - [ ] 0.7.1 (partial)
18
+
19
+ JAM Prize requirements
20
+
21
+ - [x] Milestone 1
22
+ - [x] Block import
23
+ - [x] W3F test vectors
24
+ - [x] JAM Conformance Fuzzer
25
+ - [ ] Performance optimisations
26
+ - [ ] Milestone 2
27
+ - [x] Networking (partial)
28
+ - [ ] Fast PVM
29
+ - [ ] Milestone 3
30
+ - [ ] PVM Recompiler
31
+ - [ ] Milestone 4
32
+ - [ ] Milestone 5
33
+
34
+ ## Requirements
35
+
36
+ ```bash
37
+ $ node --version
38
+ v 22.9.0
39
+ ```
40
+
41
+ We recommend [NVM](https://github.com/nvm-sh/nvm) to install and manage different
42
+ `node` versions.
43
+
44
+ ### Installing dependencies
45
+
46
+ ```bash
47
+ $ npm ci
48
+ ```
49
+
50
+ ### Running typeberry
51
+
52
+ ```bash
53
+ $ npm start
54
+ ```
55
+
56
+ ### Running fuzz-target
57
+
58
+ ```bash
59
+ $ npm start -- fuzz-target
60
+ ```
61
+
62
+ ### Running with Docker
63
+
64
+ Build and run typeberry using Docker:
65
+
66
+ ```bash
67
+ # Build the Docker image
68
+ $ docker build -t typeberry .
69
+
70
+ # Run with default settings
71
+ $ docker run typeberry
72
+
73
+ # Run with custom arguments
74
+ $ docker run typeberry --config /app/configs/typeberry-dev.json --node-name my-node
75
+
76
+ # Run with environment variables (e.g., for logging)
77
+ $ docker run -e JAM_LOG=trace GP_VERSION=0.7.0 typeberry
78
+
79
+ # Run with volume mounts for persistent data
80
+ $ docker run -v $(pwd)/database:/app/database typeberry
81
+ ```
82
+
83
+ The Docker container uses a minimal Alpine Linux image and forwards all arguments to `npm start`.
84
+
85
+ ### Running the JSON RPC
86
+
87
+ JSON-RPC does not require `typeberry` to be running, so we just need to point the binary to the correct database.
88
+
89
+ Note the DB needs to be already initialized.
90
+
91
+ ```bash
92
+ $ npm start -w @typeberry/rpc
93
+ ```
94
+
95
+ ### Additional tooling
96
+
97
+ - [@typeberry/convert](bin/convert/README.md) - convert common JAM formats
98
+ - [JAM search](https://github.com/fluffylabs/jam-search) - search across all public JAM-related channels
99
+ - [State Viewer](https://github.com/fluffylabs/state-viewer) - load & inspect state of test vectors
100
+ - [PVM Debugger](https://github.com/fluffylabs/pvm-debugger) - load & inspect a PVM program
101
+ - [Gray Paper Reader](https://github.com/fluffylabs/graypaper-reader) - view the Gray Paper
102
+ - [Ananas](https://github.com/tomusdrw/anan-as) - AssemblyScript PVM interpreter
103
+
104
+ ### Formatting & linting
105
+
106
+ ```bash
107
+ $ npm run qa
108
+ ```
109
+
110
+ Formatting & linting is done by [biomejs](https://biomejs.dev/)). You can run
111
+ separate tools using commands below.
112
+ Note that all safe fixes will be applied automatically.
113
+
114
+ ```bash
115
+ $ npm run format # format the code
116
+ $ npm run lint # lint the code & organise imports
117
+ ```
118
+
119
+ A shorthand to run all the checks and apply safe fixes all at once is:
120
+ ```bash
121
+ $ npm run qa-fix
122
+ ```
123
+
124
+ ### Running unit tests
125
+
126
+ ```bash
127
+ $ npm run test
128
+ ```
129
+
130
+ Running tests from a single package:
131
+ ```bash
132
+ $ npm run test -w @typeberry/trie
133
+ ```
134
+
135
+ ### Running benchmarks
136
+ This command will run all benchmarks from `./benchmarks/` folder
137
+
138
+ ```bash
139
+ $ npm start -w @typeberry/benchmark
140
+ ```
141
+
142
+ Since each benchmark file is also runnable, it's easy to run just one benchmark, e.g:
143
+ ```bash
144
+ $ npm exec tsx ./benchmarks/math/mul_overflow.ts
145
+ ```
146
+
147
+ ### Running JSON test vectors
148
+
149
+ To run JSON test cases coming from the official
150
+ [JAM test vectors repository](https://github.com/w3f/jamtestvectors/) you need
151
+ to first check out the repository with test cases and then use `test-runner`
152
+ to execute them.
153
+
154
+ ```bash
155
+ $ git clone https://github.com/w3f/jamtestvectors.git
156
+ $ npm run w3f -w @typeberry/test-runner -- jamtestvectors/**/*.json ../jamtestvectors/erasure_coding/vectors/*
157
+ ```
158
+
159
+ Since there are multiple sources of test vectors (and their versions may differ),
160
+ all relevant ones can be easily checked out from [our test vectors repository](https://github.com/FluffyLabs/test-vectors).
161
+
162
+ Obviously it's also possible to run just single test case or part of the test
163
+ cases by altering the glob pattern in the path.
164
+
165
+ ### Running JSON RPC E2E tests
166
+
167
+ To run JSON RPC E2E test-vectors [test-vectors](https://github.com/fluffylabs/test-vectors)
168
+ repository needs to be checked out with ref matching our tests. Then to run tests:
169
+
170
+ ```bash
171
+ $ npm run test:e2e -w @typeberry/rpc
172
+ ```
173
+
174
+ ### Adding a new component / package
175
+
176
+ ```bash
177
+ $ npm init -w ./packages/core/mycomponent
178
+ $ npm init -w ./packages/jam/mycomponent
179
+ ```
180
+
181
+ This command will automatically update the `workspaces` field in top-level `package.json`.
182
+
183
+ ## Codestyle
184
+
185
+ A brief, but evolving description of our codestyle and guideliness is availabe
186
+ in [CODESTYLE](./CODESTYLE.md).
187
+
188
+ ## Add Typeberry's remote notes to Gray Paper Reader
189
+
190
+ 1. Open **Gray Paper Reader** and go to **Notes** > **Settings** (⚙️).<br/>
191
+ ![gpr-source-notes-1](https://github.com/user-attachments/assets/945152f4-a8f1-4167-af86-9c1e41102615)
192
+ 2. Click **"+ New Source"**.
193
+ ![gpr-source-notes-2](https://github.com/user-attachments/assets/7356dbe3-fa05-4fcb-99c3-28cb4b9553df)
194
+ 3. Set **Source Name** to **Typeberry**.
195
+ 4. Paste the following in **Source URL:**
196
+ ```
197
+ https://fluffylabs.dev/typeberry/links.json
198
+ ```
199
+ 5. Select **All Versions**.
200
+ ![gpr-source-notes-3](https://github.com/user-attachments/assets/877a6494-75fd-4c0c-b531-55af6f676c89)
201
+ 6. Click **OK**.
202
+ 7. Ensure the ✅ next to **Typeberry** is enabled.
@@ -0,0 +1 @@
1
+ module.exports = eval("require")("bandersnatch_bg.wasm");
@@ -0,0 +1 @@
1
+ module.exports = eval("require")("reed_solomon_wasm_bg.wasm");
@@ -0,0 +1 @@
1
+ module.exports = eval("require")("ed25519_wasm_bg.wasm");