Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
910a325
more deserialization
QuantumExplorer Apr 21, 2023
1c60fb8
more work
QuantumExplorer Apr 22, 2023
d974b28
more work on efficient data serialization
QuantumExplorer Apr 22, 2023
322b60a
clean up of data contract
QuantumExplorer Apr 22, 2023
71b8e80
more work
QuantumExplorer Apr 22, 2023
1808f71
removed DriveContractExt
QuantumExplorer Apr 22, 2023
fd14239
more cleanup
QuantumExplorer Apr 22, 2023
e84ed04
more work
QuantumExplorer Apr 22, 2023
0e101a7
more work on serialization/deserialization
QuantumExplorer Apr 22, 2023
e0d76c7
derive macro for serialization
QuantumExplorer Apr 22, 2023
ae7ca27
derive macro for deserialization
QuantumExplorer Apr 22, 2023
75e9c71
more work on macros
QuantumExplorer Apr 22, 2023
7590c87
more work on macros
QuantumExplorer Apr 22, 2023
eeea9ee
more work on deserialization
QuantumExplorer Apr 22, 2023
5209661
dpp tests passing
QuantumExplorer Apr 22, 2023
620b422
more work
QuantumExplorer Apr 22, 2023
b7da504
more trials
QuantumExplorer Apr 23, 2023
7c4ffc7
trial
QuantumExplorer Apr 23, 2023
cac2e79
making progress
QuantumExplorer Apr 23, 2023
adbbc21
trial
QuantumExplorer Apr 23, 2023
3fd4827
working
QuantumExplorer Apr 23, 2023
7e26c7a
more work
QuantumExplorer Apr 23, 2023
389a075
more work
QuantumExplorer Apr 23, 2023
042fe8c
more work
QuantumExplorer Apr 23, 2023
6f70948
Platform signable is done
QuantumExplorer Apr 23, 2023
aa101c7
more work
QuantumExplorer Apr 23, 2023
131783a
added a platform value convertible
QuantumExplorer Apr 23, 2023
a06050a
dpp compiling
QuantumExplorer Apr 24, 2023
78f8d53
more work
QuantumExplorer Apr 24, 2023
bcfdd05
more work
QuantumExplorer Apr 24, 2023
c736f73
more work
QuantumExplorer Apr 24, 2023
05e5e4a
all dpp tests passing
QuantumExplorer Apr 24, 2023
1557741
changed a lot of errors
QuantumExplorer Apr 24, 2023
b0bf077
more fixes
QuantumExplorer Apr 24, 2023
7a27923
more work
QuantumExplorer Apr 24, 2023
a8c0e00
tests compiling
QuantumExplorer Apr 24, 2023
baef2d5
41 failing
QuantumExplorer Apr 24, 2023
6b77c9a
abci tests passing
QuantumExplorer Apr 24, 2023
e5d4a6f
more fixes
QuantumExplorer Apr 24, 2023
ff69e6e
fixes for tests
QuantumExplorer Apr 24, 2023
f646e00
fixing of required and added non flattened properties to document type
QuantumExplorer Apr 25, 2023
d04c728
more fixes
QuantumExplorer Apr 25, 2023
cfa68cd
more fixes
QuantumExplorer Apr 25, 2023
82ec9da
more work
QuantumExplorer Apr 25, 2023
99e2ca0
more work
QuantumExplorer Apr 25, 2023
9b1d8f6
more fixes
QuantumExplorer Apr 25, 2023
26e254a
all rs-drive tests passing
QuantumExplorer Apr 25, 2023
434585e
fixes
QuantumExplorer Apr 25, 2023
8ec882c
fixes
QuantumExplorer Apr 25, 2023
cf4639c
Merge branch 'v0.25-dev' into nightly/22Apr23
QuantumExplorer Apr 25, 2023
5c9ad4c
linting
QuantumExplorer Apr 25, 2023
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
38 changes: 29 additions & 9 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ members = [
"packages/wasm-dpp",
"packages/rs-drive",
"packages/rs-platform-value",
"packages/rs-platform-serialization",
"packages/rs-platform-value-convertible",
"packages/rs-drive-abci",
"packages/dashpay-contract",
"packages/withdrawals-contract",
Expand Down
7 changes: 5 additions & 2 deletions packages/rs-dpp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "dpp"
version = "0.1.0"
edition = "2018"
authors = ["Anton Suprunchuk <anton.suprunchuk@gmail.com>"]
authors = ["Anton Suprunchuk <anton.suprunchuk@gmail.com>", "Samuel Westrich <sam@dash.org>", "Ivan Shumkov <ivan@shumkov.ru>", "Djavid Gabibiyan <djavid@dash.org>"]

[dependencies]
anyhow = { version = "1.0.70" }
Expand All @@ -15,7 +15,7 @@ chrono = { version = "0.4.20", default-features = false, features = [
"wasmbind",
"clock",
] }
ciborium = { git = "https://github.com/qrayven/ciborium", branch = "feat-ser-null-as-undefined" }
ciborium = { git = "https://github.com/qrayven/ciborium", branch = "feat-ser-null-as-undefined" , optional = true}
dashcore = { git = "https://github.com/dashpay/rust-dashcore", features = [
"std",
"secp-recovery",
Expand Down Expand Up @@ -50,6 +50,8 @@ thiserror = { version = "1.0" }
mockall = { version = "0.11.3", optional = true }
data-contracts = { path = "../data-contracts" }
platform-value = { path = "../rs-platform-value" }
platform-value-convertible = { path = "../rs-platform-value-convertible" }
platform-serialization = { path = "../rs-platform-serialization" }
derive_more = "0.99.17"
ed25519-dalek = {version = "2.0.0-rc.2", features = ["rand_core"] }

Expand All @@ -60,4 +62,5 @@ pretty_assertions = { version = "1.3.0" }

[features]
default = ["fixtures-and-mocks"]
cbor = ["ciborium"]
fixtures-and-mocks = ["mockall"]
29 changes: 5 additions & 24 deletions packages/rs-dpp/src/block/block_info.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
use crate::block::epoch::Epoch;
use crate::serialization_traits::{PlatformDeserializable, PlatformSerializable};
use crate::ProtocolError;
use bincode::config;
use bincode::{Decode, Encode};
use platform_serialization::{PlatformDeserialize, PlatformSerialize};

/// Block information
#[derive(Clone, Default, Encode, Decode)]
#[derive(Clone, Default, Encode, Decode, PlatformSerialize, PlatformDeserialize)]
#[platform_error_type(ProtocolError)]
#[platform_deserialize_limit(15000)]
pub struct BlockInfo {
/// Block time in milliseconds
pub time_ms: u64,
Expand Down Expand Up @@ -42,27 +46,4 @@ impl BlockInfo {
..Default::default()
}
}

/// Serialize block info
pub fn serialize(&self) -> Result<Vec<u8>, ProtocolError> {
let config = config::standard().with_big_endian().with_no_limit();
bincode::encode_to_vec(self, config).map_err(|e| {
ProtocolError::EncodingError(format!("unable to serialize data contract {e}"))
})
}

/// The size of serialized block info
pub fn serialized_size(&self) -> Result<usize, ProtocolError> {
self.serialize().map(|a| a.len())
}

/// Deserialization of block info
pub fn deserialize(bytes: &[u8]) -> Result<Self, ProtocolError> {
let config = config::standard().with_big_endian().with_limit::<15000>();
bincode::decode_from_slice(bytes, config)
.map_err(|e| {
ProtocolError::EncodingError(format!("unable to deserialize block info {}", e))
})
.map(|(a, _)| a)
}
}
3 changes: 2 additions & 1 deletion packages/rs-dpp/src/convertible.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ pub trait Convertible {
fn to_json(&self) -> Result<JsonValue, ProtocolError>;
/// Returns the cbor-encoded bytes representation of the object. The data is prefixed by 4 bytes containing
/// the Protocol Version
fn to_buffer(&self) -> Result<Vec<u8>, ProtocolError>;
#[cfg(feature = "cbor")]
fn to_cbor_buffer(&self) -> Result<Vec<u8>, ProtocolError>;
}
3 changes: 2 additions & 1 deletion packages/rs-dpp/src/data_contract/contract_config.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use bincode::{Decode, Encode};
use serde::{Deserialize, Serialize};

pub const DEFAULT_CONTRACT_KEEPS_HISTORY: bool = false;
Expand All @@ -14,7 +15,7 @@ pub mod property {
pub const DOCUMENTS_MUTABLE_CONTRACT_DEFAULT: &str = "documentsMutableContractDefault";
}

#[derive(Serialize, Deserialize, Debug, Clone, Copy, PartialEq, Eq)]
#[derive(Serialize, Deserialize, Encode, Decode, Debug, Clone, Copy, PartialEq, Eq)]
#[serde(rename_all = "camelCase", default)]
pub struct ContractConfig {
/// Can the contract ever be deleted
Expand Down
Loading