Skip to content

Commit

Permalink
feat: Time locks
Browse files Browse the repository at this point in the history
Introduces time locks, which are a type of type script that can lock a UTXO until a certain release date. UTXOs generated by the genesis block and mining rewards are time-locked.

Additionally:

 -   renames `native_coin` to `native_currency`
 -   copies the relevant interface from the tasm-lang compiler so as to run rust code in an environment emulating Triton VM
 -   refactors consensus logic programs and relations
 -   implements `Arbitrary` for several structs, including structs that are or hold witness data
 -   adds tests for these arbitrary methods
 -   wraps the list of input or output UTXOs into a struct containing a salt, so that claims pertaining to these sets can be reduced to claims pertaining to randomized commitments thereto.
  • Loading branch information
aszepieniec authored Feb 26, 2024
2 parents bb43556 + e5734d4 commit 80552a8
Show file tree
Hide file tree
Showing 57 changed files with 3,090 additions and 386 deletions.
152 changes: 148 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ publish = false
aead = "0"
aes-gcm = "0"
anyhow = "1"
arbitrary = { version = "1", features = ["derive"] }
bech32 = "0"
bincode = "1"
tiny-bip39 = "1.0.0"
bytes = "1"
bytesize = "1"
chrono = "^0.4.31"
Expand All @@ -30,6 +30,8 @@ num-bigint = { version = "0", features = ["serde"] }
num-rational = "0"
num-traits = "0"
priority-queue = "1"
proptest = "1.4"
proptest-arbitrary-interop = "0.1"
rand = "0.8"
ratatui = "0.23"
regex = "1.10.3"
Expand All @@ -40,6 +42,7 @@ serde_json = "1"
strum = { version = "0.25", features = ["derive"] }
tarpc = { version = "^0.34", features = ["tokio1", "serde-transport", "serde-transport-json", "tcp"] }
tasm-lib = "0.2.1"
tiny-bip39 = "1.0.0"
tokio = { version = "1", features = ["full", "tracing"] }
tokio-serde = { version = "0", features = ["bincode", "json"] }
tokio-util = { version = "0", features = ["codec"] }
Expand All @@ -55,6 +58,7 @@ unicode-width = "0"
zeroize = "1.7.0"

[dev-dependencies]
test-strategy = "0.3"
pin-project-lite = "0.2.13"
tokio-test = "0"

Expand Down
6 changes: 4 additions & 2 deletions src/bin/dashboard_src/history_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ use super::{dashboard_app::DashboardEvent, screen::Screen};
use crossterm::event::{Event, KeyCode, KeyEventKind};
use itertools::Itertools;
use neptune_core::{
models::blockchain::block::block_height::BlockHeight,
models::blockchain::transaction::neptune_coins::NeptuneCoins, rpc_server::RPCClient,
models::blockchain::{
block::block_height::BlockHeight, type_scripts::neptune_coins::NeptuneCoins,
},
rpc_server::RPCClient,
};
use num_traits::{CheckedSub, Zero};
use ratatui::{
Expand Down
2 changes: 1 addition & 1 deletion src/bin/dashboard_src/overview_screen.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use neptune_core::models::blockchain::type_scripts::neptune_coins::NeptuneCoins;
use neptune_core::prelude::twenty_first;

use std::net::SocketAddr;
Expand All @@ -15,7 +16,6 @@ use neptune_core::config_models::network::Network;
use neptune_core::models::blockchain::block::block_header::BlockHeader;
use neptune_core::models::blockchain::block::block_height::BlockHeight;
use neptune_core::models::blockchain::shared::Hash;
use neptune_core::models::blockchain::transaction::neptune_coins::NeptuneCoins;
use neptune_core::rpc_server::RPCClient;
use num_traits::Zero;
use ratatui::{
Expand Down
2 changes: 1 addition & 1 deletion src/bin/dashboard_src/send_screen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crossterm::event::{Event, KeyCode, KeyEventKind};
use neptune_core::{
config_models::network::Network,
models::{
blockchain::transaction::neptune_coins::NeptuneCoins,
blockchain::type_scripts::neptune_coins::NeptuneCoins,
state::wallet::address::generation_address,
},
rpc_server::RPCClient,
Expand Down
2 changes: 1 addition & 1 deletion src/bin/neptune-cli.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use neptune_core::models::blockchain::type_scripts::neptune_coins::NeptuneCoins;
use neptune_core::prelude::twenty_first;

use anyhow::{bail, Result};
Expand All @@ -6,7 +7,6 @@ use clap_complete::{generate, Shell};

use neptune_core::config_models::data_directory::DataDirectory;
use neptune_core::config_models::network::Network;
use neptune_core::models::blockchain::transaction::neptune_coins::NeptuneCoins;
use neptune_core::models::state::wallet::address::generation_address;
use neptune_core::models::state::wallet::WalletSecret;
use std::io;
Expand Down
Loading

0 comments on commit 80552a8

Please sign in to comment.