Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
56 changes: 13 additions & 43 deletions Cargo.lock

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

16 changes: 8 additions & 8 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ ENV NODE_ENV=${NODE_ENV}
#
# This stage is used to install sccache and configure it.
# Later on, one should source /root/env before building to use sccache.
#
#
# Note that, due to security concerns, each stage needs to declare variables containing authentication secrets, like
# ACTIONS_RUNTIME_TOKEN, AWS_SECRET_ACCESS_KEY. This is to prevent leaking secrets to the final image. The secrets are
# loaded using docker buildx `--secret` flag and need to be explicitly mounted with `--mount=type=secret,id=SECRET_ID`.
Expand Down Expand Up @@ -205,7 +205,7 @@ RUN --mount=type=secret,id=AWS <<EOS
echo "export ACTIONS_CACHE_URL=${ACTIONS_CACHE_URL}" >> /root/env
# ACTIONS_RUNTIME_TOKEN is a secret so we quote it here, and it will be loaded when `source /root/env` is run
echo 'export ACTIONS_RUNTIME_TOKEN="$(cat /run/secrets/GHA)"' >> /root/env

### AWS S3 ###
elif [ -n "${SCCACHE_BUCKET}" ]; then
echo "export SCCACHE_BUCKET='${SCCACHE_BUCKET}'" >> /root/env
Expand All @@ -218,11 +218,11 @@ RUN --mount=type=secret,id=AWS <<EOS
mkdir --mode=0700 -p "$HOME/.aws"
ln -s /run/secrets/AWS "$HOME/.aws/credentials"
echo "export AWS_SHARED_CREDENTIALS_FILE=$HOME/.aws/credentials" >> /root/env

# Check if AWS credentials file is mounted correctly, eg. --mount=type=secret,id=AWS
echo '[ -e "${AWS_SHARED_CREDENTIALS_FILE}" ] || {
echo "$(id -u): Cannot read ${AWS_SHARED_CREDENTIALS_FILE}; did you use RUN --mount=type=secret,id=AWS ?";
exit 1;
echo '[ -e "${AWS_SHARED_CREDENTIALS_FILE}" ] || {
echo "$(id -u): Cannot read ${AWS_SHARED_CREDENTIALS_FILE}; did you use RUN --mount=type=secret,id=AWS ?";
exit 1;
}' >> /root/env

### memcached ###
Expand All @@ -233,9 +233,9 @@ RUN --mount=type=secret,id=AWS <<EOS
echo "Error: cannot determine sccache cache backend" >&2
exit 1
fi

echo "export SCCACHE_SERVER_PORT=$((RANDOM+1025))" >> /root/env

# Configure compilers to use sccache
echo "export CXX='sccache clang++'" >> /root/env
echo "export CC='sccache clang'" >> /root/env
Expand Down
2 changes: 1 addition & 1 deletion packages/rs-dpp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ chrono = { version = "0.4.35", default-features = false, features = [
"wasmbind",
"clock",
] }
ciborium = { git = "https://github.com/qrayven/ciborium", branch = "feat-ser-null-as-undefined", optional = true }
ciborium = { version = "0.2.2", optional = true }
dashcore = { git = "https://github.com/dashpay/rust-dashcore", features = [
"std",
"secp-recovery",
Expand Down
4 changes: 1 addition & 3 deletions packages/rs-dpp/src/util/cbor_value/canonical.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,7 @@ impl CborCanonicalMap {

let map = CborValue::Map(self.inner);

ciborium::ser::SerializerOptions::default()
.serialize_null_as_undefined(true)
.into_writer(&map, &mut bytes)?;
ciborium::ser::into_writer(&map, &mut bytes)?;

Ok(bytes)
}
Expand Down
15 changes: 8 additions & 7 deletions packages/rs-drive-abci/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ license = "MIT"
[dependencies]
arc-swap = "1.7.0"
bincode = { version = "2.0.0-rc.3", features = ["serde"] }
ciborium = { git = "https://github.com/qrayven/ciborium", branch = "feat-ser-null-as-undefined" }
ciborium = { version = "0.2.2" }
chrono = "0.4.35"
serde = { version = "1.0.197", features = ["derive"] }
serde_json = { version = "1.0", features = ["preserve_order"] }
Expand Down Expand Up @@ -73,7 +73,7 @@ tokio-util = { version = "0.7" }
derive_more = { version = "1.0", features = ["from", "deref", "deref_mut"] }
async-trait = "0.1.77"
console-subscriber = { version = "0.4", optional = true }
bls-signatures = { git = "https://github.com/dashpay/bls-signatures", tag = "1.3.3" }
bls-signatures = { git = "https://github.com/dashpay/bls-signatures", tag = "1.3.3", optional = true}

[dev-dependencies]
bs58 = { version = "0.5.0" }
Expand All @@ -93,19 +93,20 @@ dpp = { path = "../rs-dpp", features = [
"data-contract-json-conversion",
"data-contract-cbor-conversion",
] }
drive = { path = "../rs-drive" }
drive = { path = "../rs-drive", features = ["fixtures-and-mocks"] }
strategy-tests = { path = "../strategy-tests" }
assert_matches = "1.5.0"
drive-abci = { path = ".", features = ["testing-config"] }
drive-abci = { path = ".", features = ["testing-config", "mocks"] }
bls-signatures = { git = "https://github.com/dashpay/bls-signatures", tag = "1.3.3"}
mockall = { version = "0.13" }

# For tests of grovedb verify
rocksdb = { version = "0.23.0" }
integer-encoding = { version = "4.0.0" }

[features]

default = ["mocks"]
mocks = ["mockall", "drive/fixtures-and-mocks"]
default = []
mocks = ["mockall", "drive/fixtures-and-mocks", "bls-signatures"]
console = ["console-subscriber", "tokio/tracing"]
testing-config = []
grovedbg = ["drive/grovedbg"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ pub(super) struct OldStructureValidatorSetV0 {
/// The list of masternodes
pub members: BTreeMap<ProTxHash, ValidatorV0>,
/// The threshold quorum public key
#[cfg(feature = "bls-signatures")]
pub threshold_public_key: bls_signatures::PublicKey,

/// Extra fields for forward compatibility.
#[cfg(not(feature = "bls-signatures"))]
#[serde(flatten)]
pub extra_fields: std::collections::HashMap<String, serde_json::Value>,
}

impl From<OldStructureValidatorSetV0> for dpp::core_types::validator_set::v0::ValidatorSetV0 {
Expand All @@ -42,7 +48,9 @@ impl From<OldStructureValidatorSetV0> for dpp::core_types::validator_set::v0::Va
quorum_index,
core_height,
members,
#[cfg(feature = "bls-signatures")]
threshold_public_key,
..
} = value;
Self {
quorum_hash,
Expand All @@ -52,8 +60,11 @@ impl From<OldStructureValidatorSetV0> for dpp::core_types::validator_set::v0::Va
.into_iter()
.map(|(pro_tx_hash, validator)| (pro_tx_hash, validator.into()))
.collect(),
#[cfg(feature = "bls-signatures")]
threshold_public_key: PublicKey::try_from(threshold_public_key.to_bytes().as_slice())
.expect("this should not be possible to error as the threshold_public_key was already verified on disk"),
#[cfg(not(feature = "bls-signatures"))]
threshold_public_key: Default::default(),
}
}
}
Expand All @@ -64,6 +75,7 @@ pub(super) struct ValidatorV0 {
/// The proTxHash
pub pro_tx_hash: ProTxHash,
/// The public key share of this validator for this quorum
#[cfg(feature = "bls-signatures")]
pub public_key: Option<bls_signatures::PublicKey>,
/// The node address
pub node_ip: String,
Expand All @@ -83,6 +95,7 @@ impl From<ValidatorV0> for dpp::core_types::validator::v0::ValidatorV0 {
fn from(value: ValidatorV0) -> Self {
let ValidatorV0 {
pro_tx_hash,
#[cfg(feature = "bls-signatures")]
public_key,
node_ip,
node_id,
Expand All @@ -93,7 +106,10 @@ impl From<ValidatorV0> for dpp::core_types::validator::v0::ValidatorV0 {
} = value;
Self {
pro_tx_hash,
#[cfg(feature = "bls-signatures")]
public_key: public_key.map(|pk| PublicKey::try_from(pk.to_bytes().as_slice()).expect("this should not be possible to error as the public_key was already verified on disk")),
#[cfg(not(feature = "bls-signatures"))]
public_key: None,
node_ip,
node_id,
core_port,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ mod v0;
use crate::config::QuorumLikeConfig;
use crate::error::execution::ExecutionError;
use crate::error::Error;
use crate::platform_types::signature_verification_quorum_set::v0::for_saving::SignatureVerificationQuorumSetForSavingV0;
use crate::platform_types::signature_verification_quorum_set::v0::for_saving_v0::SignatureVerificationQuorumSetForSavingV0;
use crate::platform_types::signature_verification_quorum_set::v0::for_saving_v1::SignatureVerificationQuorumSetForSavingV1;
use crate::platform_types::signature_verification_quorum_set::v0::for_saving_v2::SignatureVerificationQuorumSetForSavingV2;
pub use crate::platform_types::signature_verification_quorum_set::v0::quorum_set::{
QuorumConfig, QuorumsWithConfig, SelectedQuorumSetIterator, SignatureVerificationQuorumSetV0,
SignatureVerificationQuorumSetV0Methods, SIGN_OFFSET,
Expand Down Expand Up @@ -121,13 +122,15 @@ pub enum SignatureVerificationQuorumSetForSaving {
V0(SignatureVerificationQuorumSetForSavingV0),
/// Version 1 of the signature verification quorums
V1(SignatureVerificationQuorumSetForSavingV1),
/// Version 2 of the signature verification quorums
V2(SignatureVerificationQuorumSetForSavingV2),
}

impl From<SignatureVerificationQuorumSet> for SignatureVerificationQuorumSetForSaving {
fn from(value: SignatureVerificationQuorumSet) -> Self {
match value {
SignatureVerificationQuorumSet::V0(v0) => {
SignatureVerificationQuorumSetForSaving::V1(v0.into())
SignatureVerificationQuorumSetForSaving::V2(v0.into())
}
}
}
Expand All @@ -142,6 +145,9 @@ impl From<SignatureVerificationQuorumSetForSaving> for SignatureVerificationQuor
SignatureVerificationQuorumSetForSaving::V1(v1) => {
SignatureVerificationQuorumSet::V0(v1.into())
}
SignatureVerificationQuorumSetForSaving::V2(v2) => {
SignatureVerificationQuorumSet::V0(v2.into())
}
}
}
}
Loading
Loading