@typeberry/convert 0.1.2-60899f7

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.
@@ -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,203 @@
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
+ - [ ] 0.7.2 (partial)
19
+
20
+ JAM Prize requirements
21
+
22
+ - [x] Milestone 1
23
+ - [x] Block import
24
+ - [x] W3F test vectors
25
+ - [x] JAM Conformance Fuzzer
26
+ - [ ] Performance optimisations
27
+ - [ ] Milestone 2
28
+ - [x] Networking (partial)
29
+ - [ ] Fast PVM
30
+ - [ ] Milestone 3
31
+ - [ ] PVM Recompiler
32
+ - [ ] Milestone 4
33
+ - [ ] Milestone 5
34
+
35
+ ## Requirements
36
+
37
+ ```bash
38
+ $ node --version
39
+ v 22.9.0
40
+ ```
41
+
42
+ We recommend [NVM](https://github.com/nvm-sh/nvm) to install and manage different
43
+ `node` versions.
44
+
45
+ ### Installing dependencies
46
+
47
+ ```bash
48
+ $ npm ci
49
+ ```
50
+
51
+ ### Running typeberry
52
+
53
+ ```bash
54
+ $ npm start
55
+ ```
56
+
57
+ ### Running fuzz-target
58
+
59
+ ```bash
60
+ $ npm start -- fuzz-target
61
+ ```
62
+
63
+ ### Running with Docker
64
+
65
+ Build and run typeberry using Docker:
66
+
67
+ ```bash
68
+ # Build the Docker image
69
+ $ docker build -t typeberry .
70
+
71
+ # Run with default settings
72
+ $ docker run typeberry
73
+
74
+ # Run with custom arguments
75
+ $ docker run typeberry --config /app/configs/typeberry-dev.json --node-name my-node
76
+
77
+ # Run with environment variables (e.g., for logging)
78
+ $ docker run -e JAM_LOG=trace GP_VERSION=0.7.0 typeberry
79
+
80
+ # Run with volume mounts for persistent data
81
+ $ docker run -v $(pwd)/database:/app/database typeberry
82
+ ```
83
+
84
+ The Docker container uses a minimal Alpine Linux image and forwards all arguments to `npm start`.
85
+
86
+ ### Running the JSON RPC
87
+
88
+ JSON-RPC does not require `typeberry` to be running, so we just need to point the binary to the correct database.
89
+
90
+ Note the DB needs to be already initialized.
91
+
92
+ ```bash
93
+ $ npm start -w @typeberry/rpc
94
+ ```
95
+
96
+ ### Additional tooling
97
+
98
+ - [@typeberry/convert](bin/convert/README.md) - convert common JAM formats
99
+ - [JAM search](https://github.com/fluffylabs/jam-search) - search across all public JAM-related channels
100
+ - [State Viewer](https://github.com/fluffylabs/state-viewer) - load & inspect state of test vectors
101
+ - [PVM Debugger](https://github.com/fluffylabs/pvm-debugger) - load & inspect a PVM program
102
+ - [Gray Paper Reader](https://github.com/fluffylabs/graypaper-reader) - view the Gray Paper
103
+ - [Ananas](https://github.com/tomusdrw/anan-as) - AssemblyScript PVM interpreter
104
+
105
+ ### Formatting & linting
106
+
107
+ ```bash
108
+ $ npm run qa
109
+ ```
110
+
111
+ Formatting & linting is done by [biomejs](https://biomejs.dev/)). You can run
112
+ separate tools using commands below.
113
+ Note that all safe fixes will be applied automatically.
114
+
115
+ ```bash
116
+ $ npm run format # format the code
117
+ $ npm run lint # lint the code & organise imports
118
+ ```
119
+
120
+ A shorthand to run all the checks and apply safe fixes all at once is:
121
+ ```bash
122
+ $ npm run qa-fix
123
+ ```
124
+
125
+ ### Running unit tests
126
+
127
+ ```bash
128
+ $ npm run test
129
+ ```
130
+
131
+ Running tests from a single package:
132
+ ```bash
133
+ $ npm run test -w @typeberry/trie
134
+ ```
135
+
136
+ ### Running benchmarks
137
+ This command will run all benchmarks from `./benchmarks/` folder
138
+
139
+ ```bash
140
+ $ npm start -w @typeberry/benchmark
141
+ ```
142
+
143
+ Since each benchmark file is also runnable, it's easy to run just one benchmark, e.g:
144
+ ```bash
145
+ $ npm exec tsx ./benchmarks/math/mul_overflow.ts
146
+ ```
147
+
148
+ ### Running JSON test vectors
149
+
150
+ To run JSON test cases coming from the official
151
+ [JAM test vectors repository](https://github.com/w3f/jamtestvectors/) you need
152
+ to first check out the repository with test cases and then use `test-runner`
153
+ to execute them.
154
+
155
+ ```bash
156
+ $ git clone https://github.com/w3f/jamtestvectors.git
157
+ $ npm run w3f -w @typeberry/test-runner -- jamtestvectors/**/*.json ../jamtestvectors/erasure_coding/vectors/*
158
+ ```
159
+
160
+ Since there are multiple sources of test vectors (and their versions may differ),
161
+ all relevant ones can be easily checked out from [our test vectors repository](https://github.com/FluffyLabs/test-vectors).
162
+
163
+ Obviously it's also possible to run just single test case or part of the test
164
+ cases by altering the glob pattern in the path.
165
+
166
+ ### Running JSON RPC E2E tests
167
+
168
+ To run JSON RPC E2E test-vectors [test-vectors](https://github.com/fluffylabs/test-vectors)
169
+ repository needs to be checked out with ref matching our tests. Then to run tests:
170
+
171
+ ```bash
172
+ $ npm run test:e2e -w @typeberry/rpc
173
+ ```
174
+
175
+ ### Adding a new component / package
176
+
177
+ ```bash
178
+ $ npm init -w ./packages/core/mycomponent
179
+ $ npm init -w ./packages/jam/mycomponent
180
+ ```
181
+
182
+ This command will automatically update the `workspaces` field in top-level `package.json`.
183
+
184
+ ## Codestyle
185
+
186
+ A brief, but evolving description of our codestyle and guideliness is availabe
187
+ in [CODESTYLE](./CODESTYLE.md).
188
+
189
+ ## Add Typeberry's remote notes to Gray Paper Reader
190
+
191
+ 1. Open **Gray Paper Reader** and go to **Notes** > **Settings** (⚙️).<br/>
192
+ ![gpr-source-notes-1](https://github.com/user-attachments/assets/945152f4-a8f1-4167-af86-9c1e41102615)
193
+ 2. Click **"+ New Source"**.
194
+ ![gpr-source-notes-2](https://github.com/user-attachments/assets/7356dbe3-fa05-4fcb-99c3-28cb4b9553df)
195
+ 3. Set **Source Name** to **Typeberry**.
196
+ 4. Paste the following in **Source URL:**
197
+ ```
198
+ https://fluffylabs.dev/typeberry/links.json
199
+ ```
200
+ 5. Select **All Versions**.
201
+ ![gpr-source-notes-3](https://github.com/user-attachments/assets/877a6494-75fd-4c0c-b531-55af6f676c89)
202
+ 6. Click **OK**.
203
+ 7. Ensure the ✅ next to **Typeberry** is enabled.
@@ -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");