From ff71e7414acfb56fb347d3745c9e0f2119a3cfeb Mon Sep 17 00:00:00 2001 From: Graydon Hoare Date: Mon, 21 Aug 2023 21:18:29 -0700 Subject: [PATCH] Remove ScSpecTypeSet support, which was already mostly dead. (#1054) Reflects https://github.com/stellar/rs-stellar-xdr/pull/291 which reflects https://github.com/stellar/stellar-xdr/pull/136 which addresses https://github.com/stellar/stellar-xdr/issues/135 which resulted from https://github.com/stellar/rs-soroban-sdk/pull/979 This will need updating when https://github.com/stellar/rs-stellar-xdr/pull/291 merges, before it can merge. --- Cargo.lock | 12 ++++++------ Cargo.toml | 8 ++++---- soroban-sdk-macros/src/map_type.rs | 14 +------------- soroban-spec-rust/src/types.rs | 4 ---- 4 files changed, 11 insertions(+), 27 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ff9c8d51e..6b9a1bd2e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1103,7 +1103,7 @@ checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" [[package]] name = "soroban-env-common" version = "0.0.17" -source = "git+https://github.com/stellar/rs-soroban-env?rev=c2e1c21cf8d44db23a159090e3cbaab741860295#c2e1c21cf8d44db23a159090e3cbaab741860295" +source = "git+https://github.com/stellar/rs-soroban-env?rev=00c85906a602b4050b2a49ca1a86860c3812d699#00c85906a602b4050b2a49ca1a86860c3812d699" dependencies = [ "arbitrary", "crate-git-revision", @@ -1120,7 +1120,7 @@ dependencies = [ [[package]] name = "soroban-env-guest" version = "0.0.17" -source = "git+https://github.com/stellar/rs-soroban-env?rev=c2e1c21cf8d44db23a159090e3cbaab741860295#c2e1c21cf8d44db23a159090e3cbaab741860295" +source = "git+https://github.com/stellar/rs-soroban-env?rev=00c85906a602b4050b2a49ca1a86860c3812d699#00c85906a602b4050b2a49ca1a86860c3812d699" dependencies = [ "soroban-env-common", "static_assertions", @@ -1129,7 +1129,7 @@ dependencies = [ [[package]] name = "soroban-env-host" version = "0.0.17" -source = "git+https://github.com/stellar/rs-soroban-env?rev=c2e1c21cf8d44db23a159090e3cbaab741860295#c2e1c21cf8d44db23a159090e3cbaab741860295" +source = "git+https://github.com/stellar/rs-soroban-env?rev=00c85906a602b4050b2a49ca1a86860c3812d699#00c85906a602b4050b2a49ca1a86860c3812d699" dependencies = [ "backtrace", "curve25519-dalek", @@ -1155,7 +1155,7 @@ dependencies = [ [[package]] name = "soroban-env-macros" version = "0.0.17" -source = "git+https://github.com/stellar/rs-soroban-env?rev=c2e1c21cf8d44db23a159090e3cbaab741860295#c2e1c21cf8d44db23a159090e3cbaab741860295" +source = "git+https://github.com/stellar/rs-soroban-env?rev=00c85906a602b4050b2a49ca1a86860c3812d699#00c85906a602b4050b2a49ca1a86860c3812d699" dependencies = [ "itertools", "proc-macro2", @@ -1181,7 +1181,7 @@ dependencies = [ [[package]] name = "soroban-native-sdk-macros" version = "0.0.17" -source = "git+https://github.com/stellar/rs-soroban-env?rev=c2e1c21cf8d44db23a159090e3cbaab741860295#c2e1c21cf8d44db23a159090e3cbaab741860295" +source = "git+https://github.com/stellar/rs-soroban-env?rev=00c85906a602b4050b2a49ca1a86860c3812d699#00c85906a602b4050b2a49ca1a86860c3812d699" dependencies = [ "itertools", "proc-macro2", @@ -1307,7 +1307,7 @@ dependencies = [ [[package]] name = "stellar-xdr" version = "0.0.17" -source = "git+https://github.com/stellar/rs-stellar-xdr?rev=2d2526f515a476b1e3df70233a4cf9232287977e#2d2526f515a476b1e3df70233a4cf9232287977e" +source = "git+https://github.com/stellar/rs-stellar-xdr?rev=e2a9cbf72d94941de1bde6ba34a38e1f49328567#e2a9cbf72d94941de1bde6ba34a38e1f49328567" dependencies = [ "arbitrary", "base64 0.13.1", diff --git a/Cargo.toml b/Cargo.toml index 1bd8a4670..0f2bdfb4e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -40,17 +40,17 @@ soroban-token-sdk = { version = "0.9.2", path = "soroban-token-sdk" } [workspace.dependencies.soroban-env-common] version = "0.0.17" git = "https://github.com/stellar/rs-soroban-env" -rev = "c2e1c21cf8d44db23a159090e3cbaab741860295" +rev = "00c85906a602b4050b2a49ca1a86860c3812d699" [workspace.dependencies.soroban-env-guest] version = "0.0.17" git = "https://github.com/stellar/rs-soroban-env" -rev = "c2e1c21cf8d44db23a159090e3cbaab741860295" +rev = "00c85906a602b4050b2a49ca1a86860c3812d699" [workspace.dependencies.soroban-env-host] version = "0.0.17" git = "https://github.com/stellar/rs-soroban-env" -rev = "c2e1c21cf8d44db23a159090e3cbaab741860295" +rev = "00c85906a602b4050b2a49ca1a86860c3812d699" [workspace.dependencies.stellar-strkey] version = "0.0.7" @@ -60,7 +60,7 @@ rev = "e6ba45c60c16de28c7522586b80ed0150157df73" [workspace.dependencies.stellar-xdr] version = "0.0.17" git = "https://github.com/stellar/rs-stellar-xdr" -rev = "2d2526f515a476b1e3df70233a4cf9232287977e" +rev = "e2a9cbf72d94941de1bde6ba34a38e1f49328567" default-features = false #[patch."https://github.com/stellar/rs-soroban-env"] diff --git a/soroban-sdk-macros/src/map_type.rs b/soroban-sdk-macros/src/map_type.rs index db9e2a290..32d79fedb 100644 --- a/soroban-sdk-macros/src/map_type.rs +++ b/soroban-sdk-macros/src/map_type.rs @@ -1,6 +1,6 @@ use stellar_xdr::{ ScSpecTypeBytesN, ScSpecTypeDef, ScSpecTypeMap, ScSpecTypeOption, ScSpecTypeResult, - ScSpecTypeSet, ScSpecTypeTuple, ScSpecTypeUdt, ScSpecTypeVec, + ScSpecTypeTuple, ScSpecTypeUdt, ScSpecTypeVec, }; use syn::{ spanned::Spanned, Error, Expr, ExprLit, GenericArgument, Lit, Path, PathArguments, PathSegment, @@ -86,18 +86,6 @@ pub fn map_type(t: &Type) -> Result { element_type: Box::new(map_type(t)?), }))) } - "Set" => { - let t = match args.as_slice() { - [GenericArgument::Type(t)] => t, - [..] => Err(Error::new( - t.span(), - "incorrect number of generic arguments, expect one for Set", - ))?, - }; - Ok(ScSpecTypeDef::Set(Box::new(ScSpecTypeSet { - element_type: Box::new(map_type(t)?), - }))) - } "Map" => { let (k, v) = match args.as_slice() { [GenericArgument::Type(k), GenericArgument::Type(v)] => (k, v), diff --git a/soroban-spec-rust/src/types.rs b/soroban-spec-rust/src/types.rs index 11869cfc5..9222dc7a8 100644 --- a/soroban-spec-rust/src/types.rs +++ b/soroban-spec-rust/src/types.rs @@ -166,10 +166,6 @@ pub fn generate_type_ident(spec: &ScSpecTypeDef) -> TokenStream { let value_ident = generate_type_ident(&m.value_type); quote! { soroban_sdk::Map<#key_ident, #value_ident> } } - ScSpecTypeDef::Set(s) => { - let element_ident = generate_type_ident(&s.element_type); - quote! { soroban_sdk::Set<#element_ident> } - } ScSpecTypeDef::Tuple(t) => { let type_idents = t.value_types.iter().map(generate_type_ident); quote! { (#(#type_idents,)*) }