Skip to content

Commit

Permalink
Merge pull request #77 from spectrum-finance/batched-vrf-proofs-dev-1295
Browse files Browse the repository at this point in the history
Batched VRF proofs + Validation framework
  • Loading branch information
oskin1 committed Aug 7, 2023
2 parents 2ef9386 + 0527136 commit 668a283
Show file tree
Hide file tree
Showing 44 changed files with 1,018 additions and 563 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[workspace]
members = [
"spectrum-node",
"spectrum-consensus",
"spectrum-network",
"spectrum-view",
"spectrum-ledger",
Expand Down
29 changes: 29 additions & 0 deletions docs/ModifierValidation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Modifier Application


**BlockHeader:**
```mermaid
flowchart TD
D(Diffusion)
NV(NodeView)
H([History])
S([State])
D-->|"Apply(BlockHeader)"|NV
H-->|Log|NV
NV-->|"Apply(Valid(BlockHeader))"|H
S-->|State|NV
```

**BlockBody:**
```mermaid
flowchart TD
D(Diffusion)
NV(NodeView)
H([History])
S([State])
D-->|"Apply(BlockBody)"|NV
H-->|Log|NV
NV-->|"Apply(Valid(BlockBody))"|H
S-->|State|NV
NV-->|"[Apply(Valid(Tx))]"|S
```
9 changes: 7 additions & 2 deletions docs/ProjectStructure.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,11 @@
* `spectrum-kes` - KES impl
* `spectrum-sigma` - Impl of Sigma Aggregation protocol
* `spectrum-view` - View of the ledger state
* `spectrum-node` - Node implementation
* `spectrum-consensus` - Consensus rules
* `spectrum-node` - Wired Node App

**Dependency graph:**

```mermaid
flowchart TD
SN[spectrum-network]
Expand All @@ -30,6 +32,7 @@ flowchart TD
SS[spectrum-sigma]
SVI[spectrum-view]
SI[spectrum-node]
SCS[spectrum-consensus]
SL --> SS
SL --> SV
SL --> SK
Expand All @@ -44,6 +47,8 @@ flowchart TD
SM --> SC
SH --> SC
SVI --> SL
SI --> SVI
SI --> SD
SD --> SVI
SCS --> SVI
SI --> SCS
```
27 changes: 27 additions & 0 deletions spectrum-consensus/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
[package]
name = "spectrum-consensus"
version = "0.1.0"
edition = "2021"
rust-version = "1.71.0"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
futures = "0.3.21"
libp2p = { version = "0.52.0", features = ["websocket", "noise", "yamux", "ping", "tcp", "dns", "async-std", "secp256k1"] }
async-std = { version = "1.10.0", features = ["attributes"] }
spectrum-crypto = { version = "0.1.0", path = "../spectrum-crypto" }
spectrum-network = { version = "0.1.0", path = "../spectrum-network" }
spectrum-ledger = { version = "0.1.0", path = "../spectrum-ledger" }
spectrum-view = { version = "0.1.0", path = "../spectrum-view" }
rand = "0.8.5"
log = "0.4.17"
log4rs = "1.2.0"
k256 = { version = "0.13.*", features = ["serde", "arithmetic"] }
serde = { version = "1.0.147", features = ["derive"] }
base16 = "0.2.1"
serde_yaml = "0.9.21"
tokio = { version = "1.28.*", features = ["rt", "rt-multi-thread"] }
thiserror = "1.0.34"
async-trait = "0.1.68"
nonempty = "0.8.1"
1 change: 1 addition & 0 deletions spectrum-consensus/src/block_header.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

3 changes: 3 additions & 0 deletions spectrum-consensus/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mod block_header;
mod validation;
mod rules;
15 changes: 15 additions & 0 deletions spectrum-consensus/src/rules.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use spectrum_ledger::consensus::AnyRuleId;

#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub struct RuleSpec {
/// Essential rules cannot be disabled.
pub essential: bool,
/// Is rule active
pub active: bool,
pub description: *const str,
}

/// Consensus rules table.
pub trait ConsensusRuleSet {
fn get_rule(&self, rule_id: AnyRuleId) -> RuleSpec;
}

0 comments on commit 668a283

Please sign in to comment.