Skip to content

Commit

Permalink
* Introduce RPC and new protocol crate
Browse files Browse the repository at this point in the history
* Fork ledger traits

* Subxt based client - connectivity
* Development runtime - working, global logger use needs to consider rust::tracing
* Signature and address types, substrate crypto used directly for account signatures
* Seed mechanism changed in ChronicleSigning to allow us to supply a specific seed
* Remove transaction costs and balance checks
  • Loading branch information
ryan-s-roberts committed Dec 11, 2023
1 parent f0c4df1 commit f12b956
Show file tree
Hide file tree
Showing 74 changed files with 7,121 additions and 4,960 deletions.
5,106 changes: 2,905 additions & 2,201 deletions Cargo.lock

Large diffs are not rendered by default.

36 changes: 16 additions & 20 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,20 @@ members = [
"crates/chronicle-domain",
"crates/chronicle-domain-lint",
"crates/chronicle-domain-test",
"crates/chronicle-protocol",
"crates/chronicle-synth",
"crates/chronicle-signing",
"crates/chronicle-telemetry",
"crates/gq-subscribe",
"crates/id-provider",
"crates/opa-tp",
"crates/opa-tp-protocol",
"crates/opactl",
"crates/sawtooth-tp",
"crates/pallet-chronicle",
"crates/pallet-opa",
"node/runtime-chronicle",
"node/node-chronicle",
"crates/embedded-substrate",
"crates/runtime-api-chronicle",
"crates/rpc-chronicle",
"crates/protocol-substrate-chronicle",
"crates/protocol-substrate-opa",
]

[workspace.dependencies]
Expand All @@ -29,16 +30,12 @@ anyhow = "1.0.6"
assert_fs = "1.0"
async-graphql = "5.0.9"
async-graphql-poem = "5.0.9"
async-stl-client = { git = "https://github.com/btpworks/async-stl-sdk" }
async-stream = "0.3.3"
async-trait = "0.1.61"
backoff = { version = "0.4.0", features = ["futures", "tokio"] }
base64 = "0.21"
bytes = "1.3.0"
cached = "0.42"
frame-support = "24.0.0"
frame-system = "24.0.0"
frame-benchmarking = "24.0.0"
cfg-if = "1.0.0"
chronicle-signing = { path = "crates/chronicle-signing" }
chrono = "0.4.26"
Expand All @@ -53,14 +50,13 @@ criterion = { version = "0.5.1", features = ["async_futures", "async_tokio"] }
crossbeam = "0.8.1"
custom_error = "1.9.2"
derivative = "2.2.0"
diesel = { version = "2.0.0-rc.0", features = [
"postgres",
"uuid",
"chrono",
"r2d2",
] }
diesel_migrations = { version = "2.0.0-rc.0", features = ["postgres"] }
diesel = { version = "2.1", features = ["postgres", "uuid", "chrono", "r2d2"] }
diesel-async = { version = "0.4" }
diesel_migrations = { version = "2.1", features = ["postgres"] }
dotenvy = "0.15"
frame-benchmarking = "24.0.0"
frame-support = "24.0.0"
frame-system = "24.0.0"
futures = "0.3.21"
genco = "0.16.1"
glob = "0.3.0"
Expand All @@ -80,18 +76,21 @@ k256 = { version = "0.11.3", features = [
"ecdsa",
"pkcs8",
"sha256",
"keccak256",
"std",
"pem",
"serde",
] }
lazy_static = "1.4.0"
locspan = "0.7"
lru = "0.11"
macro-attr-2018 = "3.0.0"
maplit = "1.0.2"
metrics = "0.21.0"
metrics-exporter-prometheus = "0.12.1"
mime = "0.3"
mockito = "1.1"
newtype-derive-2018 = "0.2.1"
oauth2 = "4.4"
opa = { git = "https://github.com/tamasfe/opa-rs", rev = "3cf7fea" }
openssl = { version = "0.10" }
Expand Down Expand Up @@ -127,18 +126,16 @@ rust-embed = { version = "6.6.0", features = [
"debug-embed",
"include-exclude",
] }
sawtooth-sdk = { git = "https://github.com/hyperledger/sawtooth-sdk-rust", rev = "5a300de" }
secret-vault = { version = "1.8", features = [] }
secret-vault-value = "0.3"
serde = "1.0.152"
serde_derive = "1.0.152"
serde_json = "1.0.93"
serde_yaml = "0.9.14"
shellexpand = "3.0.0"
macro-attr-2018 = "3.0.0"
newtype-derive-2018 = "0.2.1"
temp-dir = "0.1.11"
tempfile = "3.4.0"
testcontainers = "0.14"
thiserror = "1.0"
tmq = "0.3"
tokio = { version = "1.27", features = [
Expand Down Expand Up @@ -166,4 +163,3 @@ uuid = "1.2.2"
valico = "3.6.0"
vaultrs = "*"
zmq = { version = "0.9", features = ["vendored"] }
testcontainers = "0.14"
16 changes: 6 additions & 10 deletions crates/api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,15 @@ async-graphql = { workspace = true, features = [
"uuid",
] }
async-graphql-poem = { workspace = true }
async-stl-client = { workspace = true }
async-stream = { workspace = true }
async-trait = { workspace = true }
base64 = { workspace = true }
cached = { workspace = true }
cfg-if = { workspace = true }
chronicle-protocol = { path = "../chronicle-protocol" }
chronicle-signing = { workspace = true }
chronicle-telemetry = { path = "../chronicle-telemetry" }
chrono = { workspace = true }
common = { path = "../common" }
common = { path = "../common", features = ["json-ld", "std"] }
custom_error = { workspace = true }
derivative = { workspace = true }
diesel = { workspace = true }
Expand All @@ -45,12 +43,12 @@ poem = { workspace = true }
portpicker = { workspace = true }
prost = { workspace = true }
protobuf = { workspace = true }
protocol-substrate-chronicle = { path = "../protocol-substrate-chronicle" }
protocol-substrate-opa = { path = "../protocol-substrate-opa" }
r2d2 = { workspace = true }
rand = { workspace = true }
rand_core = { workspace = true }
reqwest = { workspace = true }
sawtooth-sdk = { workspace = true }
sawtooth_tp = { path = "../sawtooth-tp" }
serde = { workspace = true }
serde_derive = { workspace = true }
serde_json = { workspace = true }
Expand All @@ -64,11 +62,9 @@ user-error = { workspace = true }
uuid = { workspace = true }

[dev-dependencies]
assert_fs = { workspace = true }
chronicle-protocol = { path = "../chronicle-protocol" }
insta = { workspace = true, features = ["json", "yaml"] }
opa-tp-protocol = { path = "../opa-tp-protocol" }
tempfile = { workspace = true }
assert_fs = { workspace = true }
insta = { workspace = true, features = ["json", "yaml"] }
tempfile = { workspace = true }

[build-dependencies]

Expand Down
13 changes: 7 additions & 6 deletions crates/api/src/chronicle_graphql/mutation.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
//! Primitive mutation operations that are not in terms of particular domain types

use crate::commands::{ActivityCommand, AgentCommand, ApiCommand, ApiResponse, EntityCommand};
use async_graphql::Context;
use chrono::{DateTime, Utc};
use common::{
attributes::Attributes,
commands::{ActivityCommand, AgentCommand, ApiCommand, ApiResponse, EntityCommand},
identity::AuthId,
prov::{operations::DerivationType, ActivityId, AgentId, EntityId, Role},
};
Expand All @@ -17,10 +16,12 @@ async fn transaction_context<'a>(
_ctx: &Context<'a>,
) -> async_graphql::Result<Submission> {
match res {
ApiResponse::Submission { subject, tx_id, .. } =>
Ok(Submission::from_submission(&subject, &tx_id)),
ApiResponse::AlreadyRecorded { subject, .. } =>
Ok(Submission::from_already_recorded(&subject)),
ApiResponse::Submission { subject, tx_id, .. } => {
Ok(Submission::from_submission(&subject, &tx_id))
},
ApiResponse::AlreadyRecorded { subject, .. } => {
Ok(Submission::from_already_recorded(&subject))
},
_ => unreachable!(),
}
}
Expand Down
14 changes: 3 additions & 11 deletions crates/api/src/commands.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use core::pin::Pin;
use std::{path::PathBuf, sync::Arc};
#[cfg(feature = "std")]
use std::{path::PathBuf, sync::Arc};

Expand All @@ -7,7 +8,7 @@ use futures::AsyncRead;

use serde::{Deserialize, Serialize};

use crate::{
use common::{
attributes::Attributes,
prov::{
operations::{ChronicleOperation, DerivationType},
Expand All @@ -16,13 +17,6 @@ use crate::{
},
};

#[cfg(not(feature = "std"))]
use parity_scale_codec::{
alloc::boxed::Box, alloc::string::String, alloc::sync::Arc, alloc::vec::Vec,
};
#[cfg(not(feature = "std"))]
use scale_info::prelude::*;

#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum NamespaceCommand {
Create { external_id: ExternalId },
Expand All @@ -47,7 +41,6 @@ pub enum AgentCommand {
role: Option<Role>,
},
}

#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum ActivityCommand {
Create {
Expand Down Expand Up @@ -156,8 +149,7 @@ impl ActivityCommand {
#[derive(Clone)]
pub enum PathOrFile {
Path(PathBuf),
File(Arc<Pin<Box<dyn AsyncRead + Sync + Send>>>), /* Non serialisable variant, used in
* process */
File(Arc<Pin<Box<dyn AsyncRead + Sync + Send>>>),
}

impl core::fmt::Debug for PathOrFile {
Expand Down
Loading

0 comments on commit f12b956

Please sign in to comment.