Skip to content

Commit c47dc40

Browse files
authored
Merge branch 'kaspanet:master' into pskb-wasm
2 parents 9a017a1 + aac16a9 commit c47dc40

File tree

45 files changed

+1399
-1180
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+1399
-1180
lines changed

Cargo.lock

Lines changed: 554 additions & 829 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ bincode = { version = "1.3.3", default-features = false }
150150
blake2b_simd = "1.0.2"
151151
borsh = { version = "1.5.1", features = ["derive", "rc"] }
152152
bs58 = { version = "0.5.0", features = ["check"], default-features = false }
153+
bytes = "1.7.1"
153154
cc = "1.0.83"
154155
cfb-mode = "0.8.2"
155156
cfg-if = "1.0.0"
@@ -188,6 +189,8 @@ hex-literal = "0.4.1"
188189
hexplay = "0.3.0"
189190
hmac = { version = "0.12.1", default-features = false }
190191
home = "0.5.5"
192+
http-body = "1.0.1"
193+
http-body-util = "0.1.2"
191194
igd-next = { version = "0.14.2", features = ["aio_tokio"] }
192195
indexmap = "2.1.0"
193196
intertrait = "0.2.2"
@@ -211,8 +214,7 @@ parking_lot = "0.12.1"
211214
paste = "1.0.14"
212215
pbkdf2 = "0.12.2"
213216
portable-atomic = { version = "1.5.1", features = ["float"] }
214-
prost = "0.12.1"
215-
# prost = "0.13.1"
217+
prost = "0.13.2"
216218
rand = "0.8.5"
217219
rand_chacha = "0.3.1"
218220
rand_core = { version = "0.6.4", features = ["std"] }
@@ -222,6 +224,7 @@ regex = "1.10.2"
222224
ripemd = { version = "0.1.3", default-features = false }
223225
rlimit = "0.10.1"
224226
rocksdb = "0.22.0"
227+
rv = "0.16.4"
225228
secp256k1 = { version = "0.29.0", features = [
226229
"global-context",
227230
"rand-std",
@@ -241,8 +244,6 @@ sha3 = "0.10.8"
241244
slugify-rs = "0.0.3"
242245
smallvec = { version = "1.11.1", features = ["serde"] }
243246
sorted-insert = "0.2.3"
244-
statest = "0.2.2"
245-
statrs = "0.13.0" # TODO "0.16.0"
246247
subtle = { version = "2.5.0", default-features = false }
247248
sysinfo = "0.31.2"
248249
tempfile = "3.8.1"
@@ -251,8 +252,8 @@ thiserror = "1.0.50"
251252
tokio = { version = "1.33.0", features = ["sync", "rt-multi-thread"] }
252253
tokio-stream = "0.1.14"
253254
toml = "0.8.8"
254-
tonic = { version = "0.10.2", features = ["tls-webpki-roots", "gzip", "transport"] }
255-
tonic-build = { version = "0.10.2", features = ["prost"] }
255+
tonic = { version = "0.12.3", features = ["tls-webpki-roots", "gzip", "transport"] }
256+
tonic-build = { version = "0.12.3", features = ["prost"] }
256257
triggered = "0.1.2"
257258
uuid = { version = "1.5.0", features = ["v4", "fast-rng", "serde"] }
258259
wasm-bindgen = { version = "0.2.93", features = ["serde-serialize"] }
@@ -262,12 +263,11 @@ web-sys = "0.3.70"
262263
xxhash-rust = { version = "0.8.7", features = ["xxh3"] }
263264
zeroize = { version = "1.6.0", default-features = false, features = ["alloc"] }
264265
pin-project-lite = "0.2.13"
265-
tower-http = { version = "0.4.4", features = [
266+
tower-http = { version = "0.5.2", features = [
266267
"map-response-body",
267268
"map-request-body",
268269
] }
269-
tower = "0.4.7"
270-
hyper = "0.14.27"
270+
tower = "0.5.1"
271271
chrono = "0.4.31"
272272
indexed_db_futures = "0.5.0"
273273
# workflow dependencies that are not a part of core libraries

README.md

Lines changed: 48 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ The default branch of this repository is `master` and new contributions are cons
1212
## Installation
1313
<details>
1414
<summary>Building on Linux</summary>
15-
15+
1616
1. Install general prerequisites
1717

1818
```bash
19-
sudo apt install curl git build-essential libssl-dev pkg-config
19+
sudo apt install curl git build-essential libssl-dev pkg-config
2020
```
2121

2222
2. Install Protobuf (required for gRPC)
23-
23+
2424
```bash
2525
sudo apt install protobuf-compiler libprotobuf-dev #Required for gRPC
2626
```
@@ -36,16 +36,16 @@ The default branch of this repository is `master` and new contributions are cons
3636
llvm python3-clang
3737
```
3838
3. Install the [rust toolchain](https://rustup.rs/)
39-
40-
If you already have rust installed, update it by running: `rustup update`
39+
40+
If you already have rust installed, update it by running: `rustup update`
4141
4. Install wasm-pack
4242
```bash
4343
cargo install wasm-pack
4444
```
4545
4. Install wasm32 target
4646
```bash
4747
rustup target add wasm32-unknown-unknown
48-
```
48+
```
4949
5. Clone the repo
5050
```bash
5151
git clone https://github.com/kaspanet/rusty-kaspa
@@ -55,52 +55,52 @@ The default branch of this repository is `master` and new contributions are cons
5555

5656

5757

58-
<details>
58+
<details>
5959
<summary>Building on Windows</summary>
6060

6161

6262
1. [Install Git for Windows](https://gitforwindows.org/) or an alternative Git distribution.
6363

6464
2. Install [Protocol Buffers](https://github.com/protocolbuffers/protobuf/releases/download/v21.10/protoc-21.10-win64.zip) and add the `bin` directory to your `Path`
6565

66-
66+
6767
3. Install [LLVM-15.0.6-win64.exe](https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.6/LLVM-15.0.6-win64.exe)
6868

6969
Add the `bin` directory of the LLVM installation (`C:\Program Files\LLVM\bin`) to PATH
70-
70+
7171
set `LIBCLANG_PATH` environment variable to point to the `bin` directory as well
7272

7373
**IMPORTANT:** Due to C++ dependency configuration issues, LLVM `AR` installation on Windows may not function correctly when switching between WASM and native C++ code compilation (native `RocksDB+secp256k1` vs WASM32 builds of `secp256k1`). Unfortunately, manually setting `AR` environment variable also confuses C++ build toolchain (it should not be set for native but should be set for WASM32 targets). Currently, the best way to address this, is as follows: after installing LLVM on Windows, go to the target `bin` installation directory and copy or rename `LLVM_AR.exe` to `AR.exe`.
74-
74+
7575
4. Install the [rust toolchain](https://rustup.rs/)
76-
77-
If you already have rust installed, update it by running: `rustup update`
76+
77+
If you already have rust installed, update it by running: `rustup update`
7878
5. Install wasm-pack
7979
```bash
8080
cargo install wasm-pack
8181
```
8282
6. Install wasm32 target
8383
```bash
8484
rustup target add wasm32-unknown-unknown
85-
```
85+
```
8686
7. Clone the repo
8787
```bash
8888
git clone https://github.com/kaspanet/rusty-kaspa
8989
cd rusty-kaspa
9090
```
91-
</details>
91+
</details>
9292

9393

94-
<details>
94+
<details>
9595
<summary>Building on Mac OS</summary>
9696

9797

9898
1. Install Protobuf (required for gRPC)
9999
```bash
100100
brew install protobuf
101101
```
102-
2. Install llvm.
103-
102+
2. Install llvm.
103+
104104
The default XCode installation of `llvm` does not support WASM build targets.
105105
To build WASM on MacOS you need to install `llvm` from homebrew (at the time of writing, the llvm version for MacOS is 16.0.1).
106106
```bash
@@ -133,23 +133,23 @@ To build WASM on MacOS you need to install `llvm` from homebrew (at the time of
133133
source ~/.zshrc
134134
```
135135
3. Install the [rust toolchain](https://rustup.rs/)
136-
137-
If you already have rust installed, update it by running: `rustup update`
136+
137+
If you already have rust installed, update it by running: `rustup update`
138138
4. Install wasm-pack
139139
```bash
140140
cargo install wasm-pack
141141
```
142142
4. Install wasm32 target
143143
```bash
144144
rustup target add wasm32-unknown-unknown
145-
```
145+
```
146146
5. Clone the repo
147147
```bash
148148
git clone https://github.com/kaspanet/rusty-kaspa
149149
cd rusty-kaspa
150150
```
151151

152-
</details>
152+
</details>
153153

154154
<details>
155155

@@ -184,7 +184,8 @@ To build WASM on MacOS you need to install `llvm` from homebrew (at the time of
184184
<summary>
185185
Kaspa CLI + Wallet
186186
</summary>
187-
`kaspa-cli` crate provides cli-driven RPC interface to the node and a
187+
188+
`kaspa-cli` crate provides a cli-driven RPC interface to the node and a
188189
terminal interface to the Rusty Kaspa Wallet runtime. These wallets are
189190
compatible with WASM SDK Wallet API and Kaspa NG projects.
190191

@@ -235,7 +236,7 @@ cargo run --release --bin kaspad -- --testnet
235236
```
236237
237238
**Testnet 11**
238-
239+
239240
For participation in the 10BPS test network (TN11), see the following detailed [guide](docs/testnet11.md).
240241
241242
<details>
@@ -249,7 +250,7 @@ cargo run --release --bin kaspad -- --configfile /path/to/configfile.toml
249250
# or
250251
cargo run --release --bin kaspad -- -C /path/to/configfile.toml
251252
```
252-
- The config file should be a list of \<CLI argument\> = \<value\> separated by newlines.
253+
- The config file should be a list of \<CLI argument\> = \<value\> separated by newlines.
253254
- Whitespace around the `=` is fine, `arg=value` and `arg = value` are both parsed correctly.
254255
- Values with special characters like `.` or `=` will require quoting the value i.e \<CLI argument\> = "\<value\>".
255256
- Arguments with multiple values should be surrounded with brackets like `addpeer = ["10.0.0.1", "1.2.3.4"]`.
@@ -297,17 +298,17 @@ wRPC
297298
**Sidenote:**
298299
299300
Rusty Kaspa integrates an optional wRPC
300-
subsystem. wRPC is a high-performance, platform-neutral, Rust-centric, WebSocket-framed RPC
301+
subsystem. wRPC is a high-performance, platform-neutral, Rust-centric, WebSocket-framed RPC
301302
implementation that can use [Borsh](https://borsh.io/) and JSON protocol encoding.
302303
303-
JSON protocol messaging
304-
is similar to JSON-RPC 1.0, but differs from the specification due to server-side
304+
JSON protocol messaging
305+
is similar to JSON-RPC 1.0, but differs from the specification due to server-side
305306
notifications.
306307
307308
[Borsh](https://borsh.io/) encoding is meant for inter-process communication. When using [Borsh](https://borsh.io/)
308-
both client and server should be built from the same codebase.
309+
both client and server should be built from the same codebase.
309310
310-
JSON protocol is based on
311+
JSON protocol is based on
311312
Kaspa data structures and is data-structure-version agnostic. You can connect to the
312313
JSON endpoint using any WebSocket library. Built-in RPC clients for JavaScript and
313314
TypeScript capable of running in web browsers and Node.js are available as a part of
@@ -316,27 +317,21 @@ wRPC
316317
</details>
317318
318319
319-
320-
<details>
321-
322-
323320
## Benchmarking & Testing
324321
325322
326-
<details>
323+
<details>
327324
328325
<summary>Simulation framework (Simpa)</summary>
329326
330-
Logging in `kaspad` and `simpa` can be [filtered](https://docs.rs/env_logger/0.10.0/env_logger/#filtering-results) by either:
331-
332-
The current codebase supports a full in-process network simulation, building an actual DAG over virtual time with virtual delay and benchmarking validation time (following the simulation generation).
327+
The current codebase supports a full in-process network simulation, building an actual DAG over virtual time with virtual delay and benchmarking validation time (following the simulation generation).
333328
334329
To see the available commands
335-
```bash
330+
```bash
336331
cargo run --release --bin simpa -- --help
337-
```
332+
```
338333
339-
The following command will run a simulation to produce 1000 blocks with communication delay of 2 seconds and 8 BPS (blocks per second) while attempting to fill each block with up to 200 transactions.
334+
The following command will run a simulation to produce 1000 blocks with communication delay of 2 seconds and 8 BPS (blocks per second) while attempting to fill each block with up to 200 transactions.
340335
341336
```bash
342337
cargo run --release --bin simpa -- -t=200 -d=2 -b=8 -n=1000
@@ -347,7 +342,7 @@ cargo run --release --bin simpa -- -t=200 -d=2 -b=8 -n=1000
347342
348343
349344
350-
<details>
345+
<details>
351346
352347
<summary>Heap Profiling</summary>
353348
@@ -362,7 +357,7 @@ It will produce `{bin-name}-heap.json` file in the root of the workdir, that can
362357
</details>
363358
364359
365-
<details>
360+
<details>
366361
367362
<summary>Tests</summary>
368363
@@ -384,12 +379,21 @@ cd rusty-kaspa
384379
cargo nextest run --release
385380
```
386381
382+
</details>
383+
384+
<details>
387385
386+
<summary>Lints</summary>
387+
388+
```bash
389+
cd rusty-kaspa
390+
./check
391+
```
388392
389393
</details>
390394
391395
392-
<details>
396+
<details>
393397
394398
<summary>Benchmarks</summary>
395399
@@ -400,7 +404,7 @@ cargo bench
400404
401405
</details>
402406
403-
<details>
407+
<details>
404408
405409
<summary>Logging</summary>
406410
@@ -415,4 +419,3 @@ Logging in `kaspad` and `simpa` can be [filtered](https://docs.rs/env_logger/0.1
415419
In this command we set the `loglevel` to `INFO`.
416420
417421
</details>
418-

cli/src/cli.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@ mod panic_handler {
10161016
fn stack(error: &Error) -> String;
10171017
}
10181018

1019-
pub fn process(info: &std::panic::PanicInfo) -> String {
1019+
pub fn process(info: &std::panic::PanicHookInfo) -> String {
10201020
let mut msg = info.to_string();
10211021

10221022
// Add the error stack to our message.
@@ -1053,7 +1053,7 @@ mod panic_handler {
10531053
impl KaspaCli {
10541054
pub fn init_panic_hook(self: &Arc<Self>) {
10551055
let this = self.clone();
1056-
let handler = move |info: &std::panic::PanicInfo| {
1056+
let handler = move |info: &std::panic::PanicHookInfo| {
10571057
let msg = panic_handler::process(info);
10581058
this.term().writeln(msg.crlf());
10591059
panic_handler::console_error(msg);

cli/src/utils.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pub fn try_parse_required_nonzero_kaspa_as_sompi_u64<S: ToString + Display>(kasp
88
let sompi_amount = kaspa_amount
99
.to_string()
1010
.parse::<f64>()
11-
.map_err(|_| Error::custom(format!("Supplied Kasapa amount is not valid: '{kaspa_amount}'")))?
11+
.map_err(|_| Error::custom(format!("Supplied Kaspa amount is not valid: '{kaspa_amount}'")))?
1212
* SOMPI_PER_KASPA as f64;
1313
if sompi_amount < 0.0 {
1414
Err(Error::custom("Supplied Kaspa amount is not valid: '{kaspa_amount}'"))

components/addressmanager/Cargo.toml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,4 @@ thiserror.workspace = true
2727
tokio.workspace = true
2828

2929
[dev-dependencies]
30-
statrs.workspace = true
31-
statest.workspace = true
30+
rv.workspace = true

0 commit comments

Comments
 (0)