Skip to content

Commit

Permalink
Revert "Update to remove ScSpecTypeSet" (#882)
Browse files Browse the repository at this point in the history
  • Loading branch information
2opremio authored Aug 22, 2023
1 parent 617c3c0 commit e6e10f0
Show file tree
Hide file tree
Showing 24 changed files with 153 additions and 152 deletions.
120 changes: 29 additions & 91 deletions Cargo.lock

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

12 changes: 6 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@ version = "0.9.4"
[workspace.dependencies.soroban-env-host]
version = "0.0.17"
git = "https://github.com/stellar/rs-soroban-env"
rev = "00c85906a602b4050b2a49ca1a86860c3812d699"
rev = "048be90e10dfda6486141f96ea86e32fb91681f4"

[workspace.dependencies.soroban-spec]
version = "0.9.1"
git = "https://github.com/stellar/rs-soroban-sdk"
rev = "ff71e7414acfb56fb347d3745c9e0f2119a3cfeb"
rev = "df9334d4e3a1a2c2e0034cfabb643972d4d7f717"
# path = "../rs-soroban-sdk/soroban-spec"

[workspace.dependencies.soroban-spec-rust]
version = "0.9.1"
git = "https://github.com/stellar/rs-soroban-sdk"
rev = "ff71e7414acfb56fb347d3745c9e0f2119a3cfeb"
rev = "df9334d4e3a1a2c2e0034cfabb643972d4d7f717"
# path = "../rs-soroban-sdk/soroban-spec-rust"

[workspace.dependencies.soroban-spec-json]
Expand All @@ -45,12 +45,12 @@ path = "./cmd/crates/soroban-spec-tools"
[workspace.dependencies.soroban-sdk]
version = "0.9.1"
git = "https://github.com/stellar/rs-soroban-sdk"
rev = "ff71e7414acfb56fb347d3745c9e0f2119a3cfeb"
rev = "df9334d4e3a1a2c2e0034cfabb643972d4d7f717"

[workspace.dependencies.soroban-ledger-snapshot]
version = "0.9.1"
git = "https://github.com/stellar/rs-soroban-sdk"
rev = "ff71e7414acfb56fb347d3745c9e0f2119a3cfeb"
rev = "df9334d4e3a1a2c2e0034cfabb643972d4d7f717"

[workspace.dependencies.soroban-cli]
version = "0.9.4"
Expand All @@ -59,7 +59,7 @@ path = "cmd/soroban-cli"
[workspace.dependencies.stellar-xdr]
version = "0.0.17"
git = "https://github.com/stellar/rs-stellar-xdr"
rev = "e2a9cbf72d94941de1bde6ba34a38e1f49328567"
rev = "4876e5eb20016caebbd13bcf6401626dc6073b8e"
default-features = false

[workspace.dependencies]
Expand Down
3 changes: 0 additions & 3 deletions cmd/crates/soroban-spec-json/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ pub fn generate_from_wasm(wasm: &[u8]) -> Result<String, FromWasmError> {
Ok(json)
}

/// # Panics
///
/// If `serde_json::to_string_pretty` fails to serialize the spec entries.
pub fn generate(spec: &[ScSpecEntry]) -> String {
let collected: Vec<_> = spec.iter().map(Entry::from).collect();
serde_json::to_string_pretty(&collected).expect("serialization of the spec entries should not have any failure cases as all keys are strings and the serialize implementations are derived")
Expand Down
4 changes: 4 additions & 0 deletions cmd/crates/soroban-spec-json/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ pub enum Type {
Map { key: Box<Type>, value: Box<Type> },
Option { value: Box<Type> },
Result { value: Box<Type>, error: Box<Type> },
Set { element: Box<Type> },
Vec { element: Box<Type> },
BytesN { n: u32 },
Tuple { elements: Vec<Type> },
Expand Down Expand Up @@ -177,6 +178,9 @@ impl From<&ScSpecTypeDef> for Type {
value: Box::new(Type::from(res.ok_type.as_ref())),
error: Box::new(Type::from(res.error_type.as_ref())),
},
ScSpecTypeDef::Set(set) => Type::Set {
element: Box::new(Type::from(set.element_type.as_ref())),
},
ScSpecTypeDef::Tuple(tuple) => Type::Tuple {
elements: tuple.value_types.iter().map(Type::from).collect(),
},
Expand Down
Loading

0 comments on commit e6e10f0

Please sign in to comment.