Skip to content

Commit 69f97fa

Browse files
authored
Merge pull request #2647 from ljedrz/feat/locktick_feature
[Feat] Introduce a lock accounting feature
2 parents dac95b8 + 4dc8567 commit 69f97fa

File tree

23 files changed

+143
-0
lines changed

23 files changed

+143
-0
lines changed

Cargo.lock

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

Cargo.toml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,13 @@ cuda = [ "snarkvm-algorithms/cuda" ]
134134
save_r1cs_hashes = [ "snarkvm-circuit/save_r1cs_hashes" ]
135135
history = [ "snarkvm-synthesizer/history" ]
136136
parameters_no_std_out = [ "snarkvm-parameters/no_std_out" ]
137+
locktick = [
138+
"dep:locktick",
139+
"snarkvm-algorithms?/locktick",
140+
"snarkvm-ledger?/locktick",
141+
"snarkvm-parameters?/locktick",
142+
"snarkvm-synthesizer?/locktick"
143+
]
137144
noconfig = [ ]
138145
rocks = [ "snarkvm-ledger/rocks", "snarkvm-synthesizer/rocks" ]
139146
test = [ "snarkvm-ledger/test" ]
@@ -233,6 +240,11 @@ optional = true
233240
version = "2.0"
234241
features = [ "rayon" ]
235242

243+
[dependencies.locktick]
244+
version = "0.3"
245+
features = [ "parking_lot" ]
246+
optional = true
247+
236248
[dependencies.num-format]
237249
version = "0.4.4"
238250

algorithms/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,11 @@ version = "0.11.0"
110110
version = "1.4"
111111
optional = true
112112

113+
[dependencies.locktick]
114+
version = "0.3"
115+
features = [ "parking_lot" ]
116+
optional = true
117+
113118
[dependencies.parking_lot]
114119
version = "0.12"
115120

@@ -200,6 +205,7 @@ cuda = [ "snarkvm-algorithms-cuda" ]
200205
profiler = [ "aleo-std/profiler" ]
201206
crypto_hash = [ ]
202207
fft = [ ]
208+
locktick = [ "dep:locktick", "snarkvm-parameters?/locktick" ]
203209
msm = [ ]
204210
test = [ ]
205211
polycommit = [ "crypto_hash", "fft", "msm", "rand_core" ]

ledger/Cargo.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ async = [
3838
"ledger-query/async",
3939
"synthesizer/async"
4040
]
41+
locktick = [
42+
"dep:locktick",
43+
"ledger-puzzle/locktick",
44+
"ledger-store/locktick",
45+
"synthesizer/locktick"
46+
]
4147
metrics = [ "ledger-committee/metrics" ]
4248
rocks = [ "ledger-store/rocks" ]
4349
serial = [
@@ -122,6 +128,11 @@ version = "1.0.73"
122128
version = "2.0"
123129
features = [ "serde" ]
124130

131+
[dependencies.locktick]
132+
version = "0.3"
133+
features = [ "parking_lot" ]
134+
optional = true
135+
125136
[dependencies.lru]
126137
version = "0.12"
127138

ledger/puzzle/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ required-features = [ "setup" ]
3232
[features]
3333
default = [ "indexmap/rayon", "rayon" ]
3434
cuda = [ "snarkvm-algorithms/cuda" ]
35+
locktick = [ "dep:locktick", "snarkvm-algorithms/locktick" ]
3536
serial = [ "console/serial", "snarkvm-algorithms/serial" ]
3637
setup = [ ]
3738
timer = [ "aleo-std/timer" ]
@@ -60,6 +61,11 @@ version = "1"
6061
version = "2.0"
6162
features = [ "serde", "rayon" ]
6263

64+
[dependencies.locktick]
65+
version = "0.3"
66+
features = [ "parking_lot" ]
67+
optional = true
68+
6369
[dependencies.lru]
6470
version = "0.12"
6571

ledger/puzzle/epoch/Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ edition = "2021"
2626
[features]
2727
default = [ "synthesis", "rayon" ]
2828
serial = [ "console/serial", "snarkvm-ledger-puzzle/serial" ]
29+
locktick = [
30+
"dep:locktick",
31+
"snarkvm-ledger-puzzle/locktick",
32+
"snarkvm-synthesizer-process/locktick"
33+
]
2934
merkle = [ ]
3035
synthesis = [
3136
"aleo-std",
@@ -78,6 +83,11 @@ version = "2"
7883
version = "2.0"
7984
features = [ "serde", "rayon" ]
8085

86+
[dependencies.locktick]
87+
version = "0.3"
88+
features = [ "parking_lot" ]
89+
optional = true
90+
8191
[dependencies.lru]
8292
version = "0.12"
8393
optional = true

ledger/puzzle/epoch/src/synthesis/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ use snarkvm_ledger_puzzle::PuzzleTrait;
2525

2626
use anyhow::{Result, bail};
2727
use core::{marker::PhantomData, num::NonZeroUsize};
28+
#[cfg(feature = "locktick")]
29+
use locktick::parking_lot::RwLock;
2830
use lru::LruCache;
31+
#[cfg(not(feature = "locktick"))]
2932
use parking_lot::RwLock;
3033
use rand_chacha::ChaChaRng;
3134
use std::sync::Arc;

ledger/puzzle/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ use console::{
5252
use aleo_std::prelude::*;
5353
use core::num::NonZeroUsize;
5454
use indexmap::IndexMap;
55+
#[cfg(feature = "locktick")]
56+
use locktick::parking_lot::RwLock;
5557
use lru::LruCache;
58+
#[cfg(not(feature = "locktick"))]
5659
use parking_lot::RwLock;
5760
use rand::SeedableRng;
5861
use rand_chacha::ChaChaRng;

ledger/src/lib.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,10 @@ use aleo_std::{
7070
use anyhow::Result;
7171
use core::ops::Range;
7272
use indexmap::IndexMap;
73+
#[cfg(feature = "locktick")]
74+
use locktick::parking_lot::{Mutex, RwLock};
7375
use lru::LruCache;
76+
#[cfg(not(feature = "locktick"))]
7477
use parking_lot::{Mutex, RwLock};
7578
use rand::{prelude::IteratorRandom, rngs::OsRng};
7679
use std::{borrow::Cow, sync::Arc};

ledger/store/Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ edition = "2021"
1818

1919
[features]
2020
default = [ "indexmap/rayon", "rayon" ]
21+
locktick = [ "dep:locktick", "ledger-puzzle/locktick" ]
2122
rocks = [ "once_cell", "rocksdb", "smallvec", "tracing" ]
2223
serial = [
2324
"console/serial",
@@ -93,6 +94,11 @@ version = "1.3"
9394
version = "2.0"
9495
features = [ "serde" ]
9596

97+
[dependencies.locktick]
98+
version = "0.3"
99+
features = [ "parking_lot" ]
100+
optional = true
101+
96102
[dependencies.once_cell]
97103
version = "1.18"
98104
optional = true

0 commit comments

Comments
 (0)