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
Workspaces split #153
Merged
Merged
Workspaces split #153
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0fb2027
Workspace refactor initial moving existing code
rooooooooob 0e8b6d6
Move CIP25 library into CML.
rooooooooob f9d9052
Base code changes for module split
rooooooooob 556f2b3
Move on-chain crypto into chain crate
rooooooooob 5989c7f
crypto-wasm crate added
rooooooooob 07b4c9c
Merge branch 'develop' into workspaces-split
rooooooooob File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
[workspace] | ||
|
||
# this is for the new crate structure. The legacy code (current CML) still resides in the `rust` directory. | ||
members = [ | ||
"core", | ||
"crypto", | ||
"cip25", | ||
"cip25-wasm", | ||
"wasm" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
[package] | ||
name = "cardano-multiplatform-lib-chain" | ||
version = "0.1.0" | ||
edition = "2018" | ||
|
||
[lib] | ||
crate-type = ["cdylib", "rlib"] | ||
|
||
[dependencies] | ||
cardano-multiplatform-lib-core = { "path" = "../core" } | ||
cardano-multiplatform-lib-crypto = { "path" = "../crypto" } | ||
cbor_event = "2.2.0" | ||
linked-hash-map = "0.5.3" | ||
gostkin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
derivative = "2.2.0" | ||
serde = { version = "1.0", features = ["derive"] } | ||
serde_json = "1.0.57" | ||
schemars = "0.8.8" | ||
|
||
bech32 = "0.7.2" | ||
hex = "0.4.0" | ||
itertools = "0.10.1" | ||
getrandom = { version = "0.2.3", features = ["js"] } | ||
rand = "0.8.5" | ||
fraction = "0.10.0" | ||
base64 = "0.13" | ||
num-bigint = "0.4.0" | ||
num-integer = "0.1.45" | ||
#rand_os = "0.1" | ||
thiserror = "1.0.37" | ||
# These can be removed if we make wasm bindings for ALL functionality here. | ||
# This was not done right now as there is a lot of existing legacy code e.g. | ||
# for Byron that might need to be used from WASM and might not. | ||
# We can remove this dependency when that is decided. | ||
# | ||
# The other use-case here is enums. Without this two enums would need to be defined | ||
# despite wasm_bindgen supporting C-style enums (with non-negative values) 100% | ||
# This could possibly be resolved with macros but maybe not. | ||
|
||
# non-wasm | ||
#[target.'cfg(not(all(target_arch = "wasm32", not(target_os = "emscripten"))))'.dependencies] | ||
#rand_os = "0.1" | ||
#noop_proc_macro = "0.3.0" | ||
|
||
# wasm | ||
#[target.'cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))'.dependencies] | ||
wasm-bindgen = { version = "=0.2.82", features = ["serde-serialize"] } | ||
#rand_os = { version = "0.1", features = ["wasm-bindgen"] } | ||
#js-sys = "=0.3.59" | ||
|
||
|
||
[dev-dependencies] | ||
quickcheck = "0.9.2" | ||
quickcheck_macros = "0.9.1" | ||
rand_chacha = "0.3.1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Chain | ||
|
||
This is the core cardano-multiplatform-lib crate for all on-chain data types. | ||
This was generated from the `specs/babbage/` CDDL specs using cddl-codegen. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,49 @@ | ||
use std::io::{BufRead, Seek, Write}; | ||
pub use error::*; | ||
|
||
// This library was code-generated using an experimental CDDL to rust tool: | ||
// https://github.com/dcSpark/cddl-codegen | ||
|
||
use cbor_event::{self, de::Deserializer, se::Serializer}; | ||
|
||
use cbor_event::Type as CBORType; | ||
|
||
use cbor_event::Special as CBORSpecial; | ||
|
||
use serialization::*; | ||
|
||
use std::collections::BTreeMap; | ||
|
||
use std::convert::{From, TryFrom}; | ||
use schemars::JsonSchema; | ||
|
||
#[macro_use] | ||
extern crate cfg_if; | ||
|
||
pub mod error; | ||
|
||
pub mod serialization; | ||
|
||
pub mod ordered_hash_map; | ||
|
||
pub mod chain_core; | ||
pub mod chain_crypto; | ||
pub mod impl_mockchain; | ||
//pub mod legacy_address; | ||
pub mod typed_bytes; | ||
|
||
use ordered_hash_map::OrderedHashMap; | ||
|
||
use cbor_event::{Sz, LenSz, StringLenSz}; | ||
pub use cardano_multiplatform_lib_core::{ | ||
ordered_hash_map::OrderedHashMap, | ||
error::{DeserializeError, DeserializeFailure}, | ||
serialization::{Serialize, Deserialize, StringEncoding, LenEncoding}, | ||
}; | ||
|
||
use cardano_multiplatform_lib_crypto::{ | ||
BootstrapWitness, | ||
KesSignature, | ||
KesVkey, | ||
Nonce, | ||
SignkeyKES, | ||
Vkey, | ||
Vkeywitness, | ||
VrfCert, | ||
VrfVkey, | ||
// auto-gened hashes/sigs: | ||
Ed25519Signature, | ||
Ed25519KeyHash, | ||
ScriptHash, | ||
TransactionHash, | ||
GenesisDelegateHash, | ||
GenesisHash, | ||
AuxiliaryDataHash, | ||
PoolMetadataHash, | ||
VRFKeyHash, | ||
BlockBodyHash, | ||
BlockHeaderHash, | ||
DataHash, | ||
ScriptDataHash, | ||
VRFVKey, | ||
KESVKey, | ||
}; | ||
|
||
pub mod cbor_encodings; | ||
|
||
|
@@ -44,6 +53,9 @@ extern crate derivative; | |
|
||
pub(crate) use derivative::Derivative; | ||
|
||
// This library was code-generated using an experimental CDDL to rust tool: | ||
// https://github.com/dcSpark/cddl-codegen | ||
|
||
// TODO: for regen, change babbage's cddl to have our own names in the first place | ||
pub type AddrKeyhash = Ed25519KeyHash; | ||
|
||
|
@@ -200,9 +212,9 @@ pub mod certs; | |
pub use certs::*; | ||
|
||
|
||
pub mod crypto; | ||
//pub mod crypto; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can be removed , we have public exposure above |
||
|
||
pub use crypto::*; | ||
//pub use crypto::*; | ||
|
||
|
||
pub mod metadata; | ||
|
@@ -346,22 +358,6 @@ impl NetworkId { | |
} | ||
} | ||
|
||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, schemars::JsonSchema)] | ||
pub struct Nonce1 { | ||
pub bytes: Vec<u8>, | ||
#[serde(skip)] | ||
pub encodings: Option<Nonce1Encoding>, | ||
} | ||
|
||
impl Nonce1 { | ||
pub fn new(bytes: Vec<u8>) -> Self { | ||
Self { | ||
bytes, | ||
encodings: None, | ||
} | ||
} | ||
} | ||
|
||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, schemars::JsonSchema)] | ||
pub struct PositiveInterval { | ||
#[serde(skip)] | ||
|
@@ -628,22 +624,4 @@ impl Value { | |
encodings: None, | ||
} | ||
} | ||
} | ||
|
||
#[derive(Clone, Debug, serde::Deserialize, serde::Serialize, schemars::JsonSchema)] | ||
pub struct Vkeywitness { | ||
pub vkey: Vkey, | ||
pub signature: Ed25519Signature, | ||
#[serde(skip)] | ||
pub encodings: Option<VkeywitnessEncoding>, | ||
} | ||
|
||
impl Vkeywitness { | ||
pub fn new(vkey: Vkey, signature: Ed25519Signature) -> Self { | ||
Self { | ||
vkey, | ||
signature, | ||
encodings: None, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We'll still need to figure out what to do with the JSON schema generating stuff as we currently have multiple in the project now with CIP25.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you share a little more context please? what's the problem? seems like I don't have full picture
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the WASM build in legacy CML we have as part of a build script a rust program in
rust/json-gen
that outputs JSON schemas that define the JSON format of on-chain data. We have a similar script injson-gen-split
. We also have that with CIP-25 as well since we used the JSON functionality of cddl-codegen too. The program outputs those schemas then the rest of the build scripts piece those together (see thescripts/
folder +package.json
for how the scripts/programs are composed) into the final output.ts
file output by wasm-bindgen / wasm-pack to represent the types from JS/typescript. We're going to have to update the build scripts and such now that we'll have multiple wasm builds as well.