Skip to content

Commit

Permalink
Merge branch 'main' into donovan/eigen-templates
Browse files Browse the repository at this point in the history
  • Loading branch information
Tjemmmic committed Nov 27, 2024
2 parents 023496b + f35d0c1 commit 3e33fc5
Show file tree
Hide file tree
Showing 64 changed files with 1,978 additions and 1,211 deletions.
35 changes: 19 additions & 16 deletions Cargo.lock

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

11 changes: 6 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,21 +45,21 @@ broken_intra_doc_links = "deny"

[workspace.dependencies]
gadget-io = { version = "0.0.5", path = "./gadget-io", default-features = false }
blueprint-manager = { version = "0.1.2", path = "./blueprint-manager" }
blueprint-manager = { version = "0.1.3", path = "./blueprint-manager" }
blueprint-serde = { version = "0.2.0", path = "./blueprint-serde", package = "gadget-blueprint-serde" }
blueprint-test-utils = { path = "./blueprint-test-utils" }
gadget-sdk = { path = "./sdk", default-features = false, version = "0.5.0" }
gadget-sdk = { path = "./sdk", default-features = false, version = "0.5.1" }

incredible-squaring-blueprint = { path = "./blueprints/incredible-squaring", default-features = false, version = "0.1.1" }
incredible-squaring-blueprint-eigenlayer = { path = "./blueprints/incredible-squaring-eigenlayer", default-features = false, version = "0.1.1" }
incredible-squaring-blueprint-symbiotic = { path = "./blueprints/incredible-squaring-symbiotic", default-features = false, version = "0.1.1" }
blueprint-examples = { path = "./blueprints/examples", default-features = false, version = "0.1.1" }
gadget-blueprint-proc-macro = { path = "./macros/blueprint-proc-macro", default-features = false, version = "0.4.0" }
gadget-blueprint-proc-macro-core = { path = "./macros/blueprint-proc-macro-core", default-features = false, version = "0.2.0" }
gadget-context-derive = { path = "./macros/context-derive", default-features = false, version = "0.2.1" }
gadget-context-derive = { path = "./macros/context-derive", default-features = false, version = "0.2.2" }
blueprint-build-utils = { path = "./blueprint-build-utils", default-features = false, version = "0.1.0" }
blueprint-metadata = { path = "./blueprint-metadata", default-features = false, version = "0.1.7" }
cargo-tangle = { path = "./cli", version = "0.2.4" }
cargo-tangle = { path = "./cli", version = "0.3.0" }
cargo_metadata = { version = "0.18.1" }

# Tangle-related dependencies
Expand Down Expand Up @@ -130,6 +130,7 @@ reqwest = "0.12.7"
rustdoc-types = "0.31.0"
schnorrkel = { version = "0.11.4", default-features = false, features = ["preaudit_deprecated", "getrandom"] }
serde = { version = "1.0.208", default-features = false }
serde_bytes = { version = "0.11.15", default-features = false }
serde_json = "1.0"
serde_test = "1.0.177"
sha2 = "0.10.8"
Expand All @@ -156,6 +157,7 @@ lazy_static = "1.5.0"
jsonrpc-core = "18.0.0"
jsonrpc-http-server = "18.0.0"
tempfile = "3.10.1"
cargo_toml = { version = "0.20.5" }

alloy-primitives = "0.7.2"
alloy-json-abi = "0.7.2"
Expand Down Expand Up @@ -196,7 +198,6 @@ testcontainers = { version = "0.20.1" }
# Symbiotic
symbiotic-rs = { version = "0.1.0" }
dashmap = "6.1.0"
bincode2 = "2.0.1"
lru-mem = "0.3.0"

[profile.dev.package.backtrace]
Expand Down
6 changes: 6 additions & 0 deletions blueprint-manager/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [0.1.3](https://github.com/tangle-network/gadget/compare/blueprint-manager-v0.1.2...blueprint-manager-v0.1.3) - 2024-11-20

### Other

- updated the following local packages: gadget-sdk

## [0.1.2](https://github.com/tangle-network/gadget/compare/blueprint-manager-v0.1.1...blueprint-manager-v0.1.2) - 2024-11-16

### Other
Expand Down
2 changes: 1 addition & 1 deletion blueprint-manager/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "blueprint-manager"
version = "0.1.2"
version = "0.1.3"
description = "Tangle Blueprint manager and Runner"
authors.workspace = true
edition.workspace = true
Expand Down
6 changes: 5 additions & 1 deletion blueprint-serde/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ repository.workspace = true
[dependencies]
paste.workspace = true
serde.workspace = true
serde_bytes = { workspace = true, features = ["alloc"] }
tangle-subxt.workspace = true

[dev-dependencies]
Expand All @@ -21,4 +22,7 @@ workspace = true

[features]
default = ["std"]
std = []
std = [
"serde/std",
"serde_bytes/std"
]
115 changes: 12 additions & 103 deletions blueprint-serde/src/de.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use crate::error::{Error, Result, UnsupportedType};
use crate::Field;
use alloc::collections::BTreeMap;
use alloc::string::String;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use serde::de;
use serde::de::IntoDeserializer;
use serde::{de, forward_to_deserialize_any};
use tangle_subxt::subxt_core::utils::AccountId32;
use tangle_subxt::tangle_testnet_runtime::api::runtime_types::bounded_collections::bounded_vec::BoundedVec;
use tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::BoundedString;
Expand All @@ -16,24 +16,6 @@ use tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives:
/// See [`crate::from_field`].
pub struct Deserializer(pub(crate) Field<AccountId32>);

macro_rules! deserialize_primitive {
($($t:ty => $pat:pat),+ $(,)?) => {
$(
paste::paste! {
fn [<deserialize_ $t>]<V>(self, visitor: V) -> Result<V::Value>
where
V: de::Visitor<'de>,
{
match self.0 {
$pat(value) => visitor.[<visit_ $t>](value),
_ => Err(self.invalid_type(&visitor))
}
}
}
)+
}
}

impl<'de> de::Deserializer<'de> for Deserializer {
type Error = Error;

Expand All @@ -56,25 +38,16 @@ impl<'de> de::Deserializer<'de> for Deserializer {
let s = String::from_utf8(s.0 .0)?;
visitor.visit_string(s)
}
Field::Bytes(b) => visitor.visit_bytes(b.0.as_slice()),
Field::Bytes(b) => {
// Unless `deserialize_bytes` is explicitly called, assume a sequence is desired
de::value::SeqDeserializer::new(b.0.into_iter()).deserialize_any(visitor)
}
Field::Array(seq) | Field::List(seq) => visit_seq(seq.0, visitor),
Field::Struct(_, fields) => visit_struct(*fields, visitor),
Field::AccountId(a) => visitor.visit_bytes(a.0.as_slice()),
Field::AccountId(a) => visitor.visit_string(a.to_string()),
}
}

deserialize_primitive!(
bool => Field::Bool,
i8 => Field::Int8,
i16 => Field::Int16,
i32 => Field::Int32,
i64 => Field::Int64,
u8 => Field::Uint8,
u16 => Field::Uint16,
u32 => Field::Uint32,
u64 => Field::Uint64,
);

fn deserialize_f32<V>(self, _visitor: V) -> Result<V::Value>
where
V: de::Visitor<'de>,
Expand Down Expand Up @@ -118,36 +91,6 @@ impl<'de> de::Deserializer<'de> for Deserializer {
self.deserialize_string(visitor)
}

fn deserialize_string<V>(self, visitor: V) -> Result<V::Value>
where
V: de::Visitor<'de>,
{
match self.0 {
Field::String(bound_string) => {
visitor.visit_string(String::from_utf8(bound_string.0 .0)?)
}
_ => Err(self.invalid_type(&visitor)),
}
}

fn deserialize_bytes<V>(self, visitor: V) -> Result<V::Value>
where
V: de::Visitor<'de>,
{
self.deserialize_byte_buf(visitor)
}

fn deserialize_byte_buf<V>(self, visitor: V) -> Result<V::Value>
where
V: de::Visitor<'de>,
{
match self.0 {
Field::Bytes(seq) => visitor.visit_byte_buf(seq.0),
Field::String(s) => visitor.visit_string(String::from_utf8(s.0 .0)?),
_ => Err(self.invalid_type(&visitor)),
}
}

fn deserialize_option<V>(self, visitor: V) -> Result<V::Value>
where
V: de::Visitor<'de>,
Expand Down Expand Up @@ -182,23 +125,6 @@ impl<'de> de::Deserializer<'de> for Deserializer {
visitor.visit_newtype_struct(self)
}

fn deserialize_seq<V>(self, visitor: V) -> Result<V::Value>
where
V: de::Visitor<'de>,
{
match self.0 {
Field::Array(seq) | Field::List(seq) => visit_seq(seq.0, visitor),
_ => Err(self.invalid_type(&visitor)),
}
}

fn deserialize_tuple<V>(self, _len: usize, visitor: V) -> Result<V::Value>
where
V: de::Visitor<'de>,
{
self.deserialize_seq(visitor)
}

fn deserialize_tuple_struct<V>(
self,
_name: &'static str,
Expand Down Expand Up @@ -228,21 +154,6 @@ impl<'de> de::Deserializer<'de> for Deserializer {
Err(Error::UnsupportedType(UnsupportedType::Map))
}

fn deserialize_struct<V>(
self,
_name: &'static str,
_fields: &'static [&'static str],
visitor: V,
) -> Result<V::Value>
where
V: de::Visitor<'de>,
{
match self.0 {
Field::Struct(_name, fields) => visit_struct(*fields, visitor),
_ => Err(self.invalid_type(&visitor)),
}
}

fn deserialize_enum<V>(
self,
_name: &'static str,
Expand All @@ -261,20 +172,18 @@ impl<'de> de::Deserializer<'de> for Deserializer {
}
}

fn deserialize_identifier<V>(self, visitor: V) -> Result<V::Value>
where
V: de::Visitor<'de>,
{
self.deserialize_str(visitor)
}

fn deserialize_ignored_any<V>(self, visitor: V) -> Result<V::Value>
where
V: de::Visitor<'de>,
{
drop(self);
visitor.visit_unit()
}

forward_to_deserialize_any! {
bool u8 u16 u32 u64 i8 i16 i32 i64 string
bytes byte_buf seq struct identifier tuple
}
}

impl Deserializer {
Expand Down
1 change: 1 addition & 0 deletions blueprint-serde/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ use tangle_subxt::subxt_core::utils::AccountId32;
pub use tangle_subxt::tangle_testnet_runtime::api::runtime_types::tangle_primitives::services::field::Field;
pub use tangle_subxt::tangle_testnet_runtime::api::runtime_types::bounded_collections::bounded_vec::BoundedVec;
pub use ser::new_bounded_string;
pub use serde_bytes::ByteBuf;
use error::Result;

/// Derive a [`Field`] from an instance of type `S`
Expand Down
Loading

0 comments on commit 3e33fc5

Please sign in to comment.