Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fast forward merge develop into master #315

Merged
merged 38 commits into from
Jul 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
401c8e8
feat: grovedb data wipe (#264)
iammadab Jul 13, 2023
c21af96
Merge branch 'master' into develop
iammadab Jul 13, 2023
cc1b577
feat: raw iter data wipe (#265)
iammadab Jul 21, 2023
8380363
add last key to subquery path only after subquery path verification (…
iammadab Sep 4, 2023
75b4df1
feat: Improve verify grovedb + better debug statements (#269)
iammadab Sep 25, 2023
5bed4f5
fix: just in time update (#270)
QuantumExplorer Sep 27, 2023
eade3e0
fix: improving merk deletion (#271)
QuantumExplorer Sep 28, 2023
3eb67eb
feat: clear subtree (#272)
iammadab Sep 29, 2023
63b4ff1
fix: forgot to add pub for clear_subtree
QuantumExplorer Sep 29, 2023
f948538
fix: early limit reduction (#273)
iammadab Oct 11, 2023
6e94623
fix: op ord implemenation (#275)
iammadab Oct 11, 2023
1119847
fix: proof panic when proving absent path with intermediary empty tre…
iammadab Oct 26, 2023
206bc63
chore: debug for op value and flags (#278)
shumkov Nov 23, 2023
b79c463
fix: remove unused jemalloc dependency (#284)
QuantumExplorer Feb 22, 2024
d007bed
fix: limit will now decrease when subquery has no elements (#277)
QuantumExplorer Feb 22, 2024
9eae545
fix: element verify debug (#287)
QuantumExplorer Apr 4, 2024
f5a3382
refactor: switch to bincode 2, clean up dependencies (#288)
QuantumExplorer Apr 5, 2024
941dd86
refactor: changed some str to Strings for better errors (#290)
QuantumExplorer Apr 24, 2024
d9292aa
fix!: empty parent paths should only error if we want them to error (…
QuantumExplorer Apr 26, 2024
7267fcf
feat: db state sync by merk chunking (#292)
ogabrielides May 1, 2024
cda80d5
feat: chunk ids as vec bytes (#294)
ogabrielides May 8, 2024
60037b6
feat: added version in state sync (#293)
ogabrielides May 8, 2024
5b67055
feat: sync multiple subtrees (#295)
ogabrielides May 9, 2024
65a7512
feat: State sync APIs should use encoded Ops (#297)
ogabrielides May 13, 2024
016795e
refactor: correct constructors for `SubtreeStateSyncInfo` and `MultiS…
ogabrielides May 16, 2024
aabfd3d
feat: GroveDB visualizer (#299)
fominok May 20, 2024
36f7468
refactor: root `chunk_id` should be equal to `app_hash` (#301)
ogabrielides Jun 3, 2024
abe89b6
bump visualizer (#302)
fominok Jun 17, 2024
43ebe83
typo (#304)
fominok Jun 17, 2024
a90cea1
fix visualizer files placed on stack (#305)
fominok Jun 19, 2024
f0d0858
receive full address for visualizer (#306)
fominok Jun 20, 2024
a4326b7
feat: various helper functions and fixes for platform contested resou…
QuantumExplorer Jun 30, 2024
d9814a2
fix: query item range inclusive right to left bounds (#310)
QuantumExplorer Jul 6, 2024
1b95932
better trunk panic (#311)
fominok Jul 8, 2024
9cecef9
feat!: proof system v1 (from v0.1) (#309)
QuantumExplorer Jul 9, 2024
57fec69
update visualizer commit (#312)
fominok Jul 9, 2024
4035d34
Grovedbg build fix (#313)
fominok Jul 10, 2024
8ada131
feat: runtime versioning (#314)
QuantumExplorer Jul 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions .github/workflows/grovedb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,22 @@ jobs:
access_token: ${{ github.token }}

- uses: actions/checkout@v2
with:
submodules: recursive

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown

- name: Enable Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "false"

- name: Setup Trunk
uses: jetli/[email protected]

- run: cargo test --workspace --all-features

Expand All @@ -42,16 +50,24 @@ jobs:

- name: Check out repo
uses: actions/checkout@v2
with:
submodules: recursive

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
components: clippy
target: wasm32-unknown-unknown

- name: Enable Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "false"

- name: Setup Trunk
uses: jetli/[email protected]

- uses: actions-rs/clippy-check@v1
with:
Expand All @@ -78,6 +94,8 @@ jobs:

- name: Enable Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "false"

- run: exit `cargo +nightly fmt --check | wc -l`

Expand All @@ -100,6 +118,8 @@ jobs:

- name: Enable Rust cache
uses: Swatinem/rust-cache@v2
with:
cache-on-failure: "false"

- run: cargo check

Expand Down
64 changes: 0 additions & 64 deletions .github/workflows/nodejs.yml

This file was deleted.

3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "grovedb/grovedbg"]
path = grovedb/grovedbg
url = https://github.com/dashpay/grovedbg
4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
[workspace]
resolver = "2"
exclude = ["grovedb/grovedbg"]
members = [
"costs",
"grovedb",
Expand All @@ -7,4 +9,6 @@ members = [
"storage",
"visualize",
"path",
"grovedbg-types",
"grovedb-version"
]
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,24 @@ From here we can build:

```cargo build```

## grovedbg

There is a work in progress implementation of a debugger layer for GroveDB. To use this library with
these capabilities enabled one needs to set a dependency with `grovedbg` feature.

At build time this requires two environment dependencies:
1. `wasm32-unknown-unknown` Rust toolchain;
2. [trunk](https://trunkrs.dev/) utility.

Then, to launch visualizer tool to observe the database structure inside of your browser on a port,
let's say 10000, the following snippet should do:

```rust
let db = Arc::new(GroveDb::open("db").unwrap());
db.start_visualzier(10000);
```

Just remember to use Arc because the HTTP server might outlast the GroveDB instance.

## Performance

Expand Down
6 changes: 3 additions & 3 deletions costs/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "grovedb-costs"
version = "1.0.0-rc.1"
version = "1.0.0-rc.2"
edition = "2021"
license = "MIT"
description = "Costs extension crate for GroveDB"
Expand All @@ -10,6 +10,6 @@ repository = "https://github.com/dashpay/grovedb"


[dependencies]
thiserror = "1.0.30"
thiserror = "1.0.59"
intmap = "2.0.0"
integer-encoding = "3.0.3"
integer-encoding = "4.0.0"
5 changes: 5 additions & 0 deletions costs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ pub struct OperationCost {
}

impl OperationCost {
/// Is Nothing
pub fn is_nothing(&self) -> bool {
self == &Self::default()
}

/// Helper function to build default `OperationCost` with different
/// `seek_count`.
pub fn with_seek_count(seek_count: u16) -> Self {
Expand Down
9 changes: 2 additions & 7 deletions costs/src/storage_cost/removal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,22 +49,17 @@ pub const UNKNOWN_EPOCH: u64 = u64::MAX;
pub type StorageRemovalPerEpochByIdentifier = BTreeMap<Identifier, IntMap<u32>>;

/// Removal bytes
#[derive(Debug, PartialEq, Clone, Eq)]
#[derive(Debug, PartialEq, Clone, Eq, Default)]
pub enum StorageRemovedBytes {
/// No storage removal
#[default]
NoStorageRemoval,
/// Basic storage removal
BasicStorageRemoval(u32),
/// Storage removal is given as sections
SectionedStorageRemoval(StorageRemovalPerEpochByIdentifier),
}

impl Default for StorageRemovedBytes {
fn default() -> Self {
NoStorageRemoval
}
}

impl Add for StorageRemovedBytes {
type Output = Self;

Expand Down
14 changes: 14 additions & 0 deletions grovedb-version/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[package]
name = "grovedb-version"
authors = ["Samuel Westrich <[email protected]>"]
description = "Versioning library for Platform"
version = "1.0.0-rc.2"
edition = "2021"
license = "MIT"

[dependencies]
thiserror = { version = "1.0.59" }
versioned-feature-core = { git = "https://github.com/dashpay/versioned-feature-core", version = "1.0.0" }

[features]
mock-versions = []
25 changes: 25 additions & 0 deletions grovedb-version/src/error.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
use thiserror::Error;
use versioned_feature_core::FeatureVersion;

#[derive(Error, Debug)]
pub enum GroveVersionError {
/// Expected some specific versions
#[error("grove unknown version on {method}, received: {received}")]
UnknownVersionMismatch {
/// method
method: String,
/// the allowed versions for this method
known_versions: Vec<FeatureVersion>,
/// requested core height
received: FeatureVersion,
},

/// Expected some specific versions
#[error("{method} not active for grove version")]
VersionNotActive {
/// method
method: String,
/// the allowed versions for this method
known_versions: Vec<FeatureVersion>,
},
}
106 changes: 106 additions & 0 deletions grovedb-version/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
use crate::version::GroveVersion;

pub mod error;
pub mod version;

#[macro_export]
macro_rules! check_grovedb_v0_with_cost {
($method:expr, $version:expr) => {{
const EXPECTED_VERSION: u16 = 0;
if $version != EXPECTED_VERSION {
return Err(GroveVersionError::UnknownVersionMismatch {
method: $method.to_string(),
known_versions: vec![EXPECTED_VERSION],
received: $version,
}
.into())
.wrap_with_cost(OperationCost::default());
}
}};
}

#[macro_export]
macro_rules! check_grovedb_v0 {
($method:expr, $version:expr) => {{
const EXPECTED_VERSION: u16 = 0;
if $version != EXPECTED_VERSION {
return Err(GroveVersionError::UnknownVersionMismatch {
method: $method.to_string(),
known_versions: vec![EXPECTED_VERSION],
received: $version,
}
.into());
}
}};
}

#[macro_export]
macro_rules! check_merk_v0_with_cost {
($method:expr, $version:expr) => {{
const EXPECTED_VERSION: u16 = 0;
if $version != EXPECTED_VERSION {
return Err(GroveVersionError::UnknownVersionMismatch {
method: $method.to_string(),
known_versions: vec![EXPECTED_VERSION],
received: $version,
}
.into())
.wrap_with_cost(OperationCost::default());
}
}};
}

#[macro_export]
macro_rules! check_merk_v0 {
($method:expr, $version:expr) => {{
const EXPECTED_VERSION: u16 = 0;
if $version != EXPECTED_VERSION {
return Err(GroveVersionError::UnknownVersionMismatch {
method: $method.to_string(),
known_versions: vec![EXPECTED_VERSION],
received: $version,
}
.into());
}
}};
}

pub trait TryFromVersioned<T>: Sized {
/// The type returned in the event of a conversion error.
type Error;

/// Performs the conversion.
fn try_from_versioned(value: T, grove_version: &GroveVersion) -> Result<Self, Self::Error>;
}

pub trait TryIntoVersioned<T>: Sized {
/// The type returned in the event of a conversion error.
type Error;

/// Performs the conversion.
fn try_into_versioned(self, grove_version: &GroveVersion) -> Result<T, Self::Error>;
}

impl<T, U> TryIntoVersioned<U> for T
where
U: TryFromVersioned<T>,
{
type Error = U::Error;

#[inline]
fn try_into_versioned(self, grove_version: &GroveVersion) -> Result<U, U::Error> {
U::try_from_versioned(self, grove_version)
}
}

impl<T, U> TryFromVersioned<U> for T
where
T: TryFrom<U>,
{
type Error = T::Error;

#[inline]
fn try_from_versioned(value: U, _grove_version: &GroveVersion) -> Result<Self, Self::Error> {
T::try_from(value)
}
}
Loading
Loading