diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..858c907 --- /dev/null +++ b/.env.example @@ -0,0 +1,70 @@ +# Soroban Network Configuration - Environment Variables +# +# Copy this file to .env and fill in your values for local development. +# IMPORTANT: Never commit .env with real values to version control. +# +# For more information, see SOROBAN.md + +# ============================================================ +# NETWORK SELECTION +# ============================================================ +# Which network profile to use from soroban.toml +# Valid values: testnet, mainnet, sandbox +# If not set, defaults to testnet +SOROBAN_NETWORK=testnet + +# ============================================================ +# RPC ENDPOINT (Optional - overrides soroban.toml) +# ============================================================ +# Custom RPC URL for the selected network +# If not set, uses the URL defined in soroban.toml for the profile +# Examples: +# Testnet: https://soroban-testnet.stellar.org +# Mainnet: https://mainnet.sorobanrpc.com +# Sandbox: http://localhost:8000 +SOROBAN_RPC_URL= + +# ============================================================ +# NETWORK PASSPHRASE (Optional - overrides soroban.toml) +# ============================================================ +# Network identifier used for transaction signing +# Must match the network you're connecting to +# Examples: +# Testnet: Test SDF Network ; September 2015 +# Mainnet: Public Global Stellar Network ; September 2015 +# Sandbox: Standalone Network ; February 2017 +SOROBAN_NETWORK_PASSPHRASE= + +# ============================================================ +# CONTRACT CONFIGURATION +# ============================================================ +# Contract ID on the selected network +# Format: C + 56 characters (base32 encoded) +# Example: CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABSC4 +# This is obtained after deploying the contract +SOROBAN_CONTRACT_ID= + +# ============================================================ +# ACCOUNT CONFIGURATION +# ============================================================ +# Account address for transactions (public key) +# Format: G + 56 characters (base32 encoded) +# Example: GBRPYHIL2CI3WHZDTOOQFC6EB4KCYFFWXHEUNUME34PJF7RDOFB6HXY +SOROBAN_ACCOUNT= + +# ============================================================ +# OPTIONAL: ADVANCED CONFIGURATION +# ============================================================ +# Signing key (NEVER commit this to version control!) +# Format: S + 56 characters (base32 encoded) +# Example: SBKGIY64UHZB3OZXAGOIHJ7NDATQZ3NRDJSOFYJOGZTV3UQRN635CGG +# Generate a new key: soroban config identity generate +# SOROBAN_SIGNING_KEY= + +# Timeout for RPC requests in milliseconds +# Default: 30000 (30 seconds) +SOROBAN_RPC_TIMEOUT_MS=30000 + +# Enable verbose logging for debugging +# Default: false +SOROBAN_DEBUG=false diff --git a/.gitignore b/.gitignore index 9c9037f..1dfac24 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,6 @@ # Rust /target/ **/*.rs.bk -Cargo.lock # IDE .vscode/ diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 0000000..28ec03d --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,1960 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "addr2line" +version = "0.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "anstream" +version = "0.6.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d5b281e737544384e969a5ccad3f1cdd24b48086a0fc1b2a5262a26b8f4f4a" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] + +[[package]] +name = "anstyle" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5192cca8006f1fd4f7237516f40fa183bb07f8fbdfedaa0036de5ea9b0b45e78" + +[[package]] +name = "anstyle-parse" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7644824f0aa2c7b9384579234ef10eb7efb6a0deb83f9630a49594dd9c15c2" +dependencies = [ + "utf8parse", +] + +[[package]] +name = "anstyle-query" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40c48f72fd53cd289104fc64099abca73db4166ad86ea0b4341abe65af83dadc" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "anstyle-wincon" +version = "3.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "291e6a250ff86cd4a820112fb8898808a366d8f9f58ce16d1f538353ad55747d" +dependencies = [ + "anstyle", + "once_cell_polyfill", + "windows-sys 0.61.2", +] + +[[package]] +name = "anyhow" +version = "1.0.102" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f202df86484c868dbad7eaa557ef785d5c66295e41b460ef922eca0723b842c" + +[[package]] +name = "arbitrary" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +dependencies = [ + "derive_arbitrary", +] + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "backtrace" +version = "0.3.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base32" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23ce669cd6c8588f79e15cf450314f9638f967fc5770ff1c7c1deb0925ea7cfa" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64ct" +version = "1.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2af50177e190e07a26ab74f8b1efbfe2ef87da2116221318cb1c2e82baf7de06" + +[[package]] +name = "bitflags" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" + +[[package]] +name = "bytes-lit" +version = "0.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0adabf37211a5276e46335feabcbb1530c95eb3fdf85f324c7db942770aa025d" +dependencies = [ + "num-bigint", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "cc" +version = "1.2.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "chrono" +version = "0.4.43" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fac4744fb15ae8337dc853fee7fb3f4e48c0fbaa23d0afe49c447b4fab126118" +dependencies = [ + "iana-time-zone", + "num-traits", + "serde", + "windows-link", +] + +[[package]] +name = "clap" +version = "4.5.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2797f34da339ce31042b27d23607e051786132987f595b02ba4f6a6dffb7030a" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.60" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24a241312cea5059b13574bb9b3861cabf758b879c15190b37b6d6fd63ab6876" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_derive" +version = "4.5.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a92793da1a46a5f2a02a6f4c46c6496b28c43638adea8306fcb0caa1634f24e5" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "clap_lex" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a822ea5bc7590f9d40f1ba12c0dc3c2760f3482c6984db1573ad11031420831" + +[[package]] +name = "colorchoice" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b05b61dc5112cbb17e4b6cd61790d9845d13888356391624cbe7e41efeac1e75" + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crate-git-revision" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c521bf1f43d31ed2f73441775ed31935d77901cb3451e44b38a1c1612fcbaf98" +dependencies = [ + "serde", + "serde_derive", + "serde_json", +] + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "ctor" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a2785755761f3ddc1492979ce1e48d2c00d09311c39e4466429188f3dd6501" +dependencies = [ + "quote", + "syn", +] + +[[package]] +name = "curve25519-dalek" +version = "4.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a677b8922c94e01bdbb12126b0bc852f00447528dee1782229af9c720c3f348" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "digest", + "fiat-crypto", + "platforms", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "darling" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn", +] + +[[package]] +name = "darling_macro" +version = "0.20.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" +dependencies = [ + "darling_core", + "quote", + "syn", +] + +[[package]] +name = "der" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7c1832837b905bbfb5101e07cc24c8deddf52f93225eee6ead5f4d63d53ddcb" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "deranged" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d630bccd429a5bb5a64b5e94f693bfc48c9f8566418fda4c494cc94f911f87cc" +dependencies = [ + "powerfmt", + "serde", +] + +[[package]] +name = "derive_arbitrary" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e567bd82dcff979e4b03460c307b3cdc9e96fde3d73bed1496d2bc75d9dd62a" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "dotenvy" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "ed25519" +version = "2.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "115531babc129696a58c64a4fef0a8bf9e9698629fb97e9e40767d235cfbcd53" +dependencies = [ + "pkcs8", + "signature", +] + +[[package]] +name = "ed25519-dalek" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" +dependencies = [ + "curve25519-dalek", + "ed25519", + "rand_core", + "serde", + "sha2", + "zeroize", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "escape-bytes" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2bfcf67fea2815c2fc3b90873fae90957be12ff417335dfadc7f52927feb03b2" + +[[package]] +name = "ethnum" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b90ca2580b73ab6a1f724b76ca11ab632df820fd6040c336200d2c1df7b3c82c" + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core", + "subtle", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "generic-array" +version = "0.14.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4bb6743198531e02858aeaea5398fcc883e71851fcbcb5a2f773e2fb6cb1edf2" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasip2", +] + +[[package]] +name = "gimli" +version = "0.28.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.15.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9229cfe53dfd69f0609a49f65461bd93001ea1ef889cd5529dd176593f5338a1" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] + +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "206a8042aec68fa4a62e8d3f7aa4ceb508177d9324faf261e1959e495b7a1921" +dependencies = [ + "equivalent", + "hashbrown 0.15.5", + "serde", +] + +[[package]] +name = "indexmap-nostd" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" + +[[package]] +name = "is_terminal_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6cb138bb79a146c1bd460005623e142ef0181e3d0219cb493e02f7d08a35695" + +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" + +[[package]] +name = "js-sys" +version = "0.3.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c942ebf8e95485ca0d52d97da7c5a2c387d0e7f0ba4c35e93bfcaee045955b3" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "k256" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2", + "signature", +] + +[[package]] +name = "keccak" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb26cec98cce3a3d96cbb7bced3c4b16e3d13f27ec56dbd62cbc8f39cfb9d653" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "libc" +version = "0.2.182" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6800badb6cb2082ffd7b6a67e6125bb39f18782f793520caee8cb8846be06112" + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "linux-raw-sys" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df1d3c3b53da64cf5760482273a98e575c651a67eec7f77df96b5b642de8f039" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "miniz_oxide" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" +dependencies = [ + "adler", +] + +[[package]] +name = "mio" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "num-bigint" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-derive" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfb77679af88f8b125209d354a202862602672222e7f2313fdd6dc349bad4712" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "num-integer" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" +dependencies = [ + "autocfg", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +dependencies = [ + "autocfg", +] + +[[package]] +name = "object" +version = "0.32.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "once_cell_polyfill" +version = "1.70.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "384b8ab6d37215f3c5301a95a4accb5d64aa607f1fcb26a11b5303878451b4fe" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "platforms" +version = "3.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a546fc83c436ffbef8e7e639df8498bbc5122e0bd19cf8db208720c2cc85290e" + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae005bd773ab59b4725093fd7df83fd7892f7d8eafb48dbd7de6e024e4215f9d" +dependencies = [ + "proc-macro2", + "syn", +] + +[[package]] +name = "proc-macro2" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.33" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.11", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "rustc-demangle" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50b8869d9fc858ce7266cce0194bd74df58b9d0e3f6df3a9fc8eb470d95c09d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "146c9e247ccc180c1f61615433868c99f3de3ae256a30a43b49f67c2d9171f34" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "semver" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d767eb0aabc880b29956c35734170f26ed551a859dbd361d140cdbeca61ab1e2" + +[[package]] +name = "serde" +version = "1.0.192" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.192" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +dependencies = [ + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_with" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" +dependencies = [ + "base64 0.22.1", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.11.1", + "serde", + "serde_derive", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d00caa5193a3c8362ac2b73be6b9e768aa5a4b2f721d8f4b339600c3cb51f8e" +dependencies = [ + "darling", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest", + "keccak", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest", + "rand_core", +] + +[[package]] +name = "skillsync-core" +version = "0.1.0" +dependencies = [ + "soroban-sdk", +] + +[[package]] +name = "skillsync-tools" +version = "0.1.0" +dependencies = [ + "anyhow", + "clap", + "dotenvy", + "serde", + "serde_json", + "soroban-sdk", + "tempfile", + "thiserror", + "tokio", + "toml", +] + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86f4aa3ad99f2088c990dfa82d367e19cb29268ed67c574d10d0a4bfe71f07e0" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + +[[package]] +name = "soroban-builtin-sdk-macros" +version = "20.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cc32c6e817f3ca269764ec0d7d14da6210b74a5bf14d4e745aa3ee860558900" +dependencies = [ + "itertools", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "soroban-env-common" +version = "20.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c14e18d879c520ff82612eaae0590acaf6a7f3b977407e1abb1c9e31f94c7814" +dependencies = [ + "arbitrary", + "crate-git-revision", + "ethnum", + "num-derive", + "num-traits", + "serde", + "soroban-env-macros", + "soroban-wasmi", + "static_assertions", + "stellar-xdr", +] + +[[package]] +name = "soroban-env-guest" +version = "20.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5122ca2abd5ebcc1e876a96b9b44f87ce0a0e06df8f7c09772ddb58b159b7454" +dependencies = [ + "soroban-env-common", + "static_assertions", +] + +[[package]] +name = "soroban-env-host" +version = "20.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "114a0fa0d0cc39d0be16b1ee35b6e5f4ee0592ddcf459bde69391c02b03cf520" +dependencies = [ + "backtrace", + "curve25519-dalek", + "ed25519-dalek", + "getrandom 0.2.11", + "hex-literal", + "hmac", + "k256", + "num-derive", + "num-integer", + "num-traits", + "rand", + "rand_chacha", + "sha2", + "sha3", + "soroban-builtin-sdk-macros", + "soroban-env-common", + "soroban-wasmi", + "static_assertions", + "stellar-strkey", +] + +[[package]] +name = "soroban-env-macros" +version = "20.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b13e3f8c86f812e0669e78fcb3eae40c385c6a9dd1a4886a1de733230b4fcf27" +dependencies = [ + "itertools", + "proc-macro2", + "quote", + "serde", + "serde_json", + "stellar-xdr", + "syn", +] + +[[package]] +name = "soroban-ledger-snapshot" +version = "20.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61a54708f44890e0546180db6b4f530e2a88d83b05a9b38a131caa21d005e25a" +dependencies = [ + "serde", + "serde_json", + "serde_with", + "soroban-env-common", + "soroban-env-host", + "thiserror", +] + +[[package]] +name = "soroban-sdk" +version = "20.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84fc8be9068dd4e0212d8b13ad61089ea87e69ac212c262914503a961c8dc3a3" +dependencies = [ + "arbitrary", + "bytes-lit", + "ctor", + "ed25519-dalek", + "rand", + "serde", + "serde_json", + "soroban-env-guest", + "soroban-env-host", + "soroban-ledger-snapshot", + "soroban-sdk-macros", + "stellar-strkey", +] + +[[package]] +name = "soroban-sdk-macros" +version = "20.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db20def4ead836663633f58d817d0ed8e1af052c9650a04adf730525af85b964" +dependencies = [ + "crate-git-revision", + "darling", + "itertools", + "proc-macro2", + "quote", + "rustc_version", + "sha2", + "soroban-env-common", + "soroban-spec", + "soroban-spec-rust", + "stellar-xdr", + "syn", +] + +[[package]] +name = "soroban-spec" +version = "20.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3eefeb5d373b43f6828145d00f0c5cc35e96db56a6671ae9614f84beb2711cab" +dependencies = [ + "base64 0.13.1", + "stellar-xdr", + "thiserror", + "wasmparser", +] + +[[package]] +name = "soroban-spec-rust" +version = "20.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3152bca4737ef734ac37fe47b225ee58765c9095970c481a18516a2b287c7a33" +dependencies = [ + "prettyplease", + "proc-macro2", + "quote", + "sha2", + "soroban-spec", + "stellar-xdr", + "syn", + "thiserror", +] + +[[package]] +name = "soroban-wasmi" +version = "0.31.1-soroban.20.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "710403de32d0e0c35375518cb995d4fc056d0d48966f2e56ea471b8cb8fc9719" +dependencies = [ + "smallvec", + "spin", + "wasmi_arena", + "wasmi_core", + "wasmparser-nostd", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "stellar-strkey" +version = "0.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12d2bf45e114117ea91d820a846fd1afbe3ba7d717988fee094ce8227a3bf8bd" +dependencies = [ + "base32", + "crate-git-revision", + "thiserror", +] + +[[package]] +name = "stellar-xdr" +version = "20.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e59cdf3eb4467fb5a4b00b52e7de6dca72f67fac6f9b700f55c95a5d86f09c9d" +dependencies = [ + "arbitrary", + "base64 0.13.1", + "crate-git-revision", + "escape-bytes", + "hex", + "serde", + "serde_with", + "stellar-strkey", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "tempfile" +version = "3.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0136791f7c95b1f6dd99f9cc786b91bb81c3800b639b3478e561ddb7be95e5f1" +dependencies = [ + "fastrand", + "getrandom 0.3.4", + "once_cell", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "thiserror" +version = "1.0.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e3de26b0965292219b4287ff031fcba86837900fe9cd2b34ea8ad893c0953d2" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "268026685b2be38d7103e9e507c938a1fcb3d7e6eb15e87870b617bf37b6d581" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "time" +version = "0.3.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e7d9e3bb61134e77bde20dd4825b97c010155709965fedf0f49bb138e52a9d" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "40868e7c1d2f0b8d73e4a8c7f0ff63af4f6d19be117e90bd73eb1d62cf831c6b" + +[[package]] +name = "time-macros" +version = "0.2.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30cfb0125f12d9c277f35663a0a33f8c30190f4e4574868a330595412d34ebf3" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tokio" +version = "1.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap 2.11.1", + "serde", + "serde_spanned", + "toml_datetime", + "toml_write", + "winnow", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "unicode-ident" +version = "1.0.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" + +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64024a30ec1e37399cf85a7ffefebdb72205ca1c972291c51512360d90bd8566" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "008b239d9c740232e71bd39e8ef6429d27097518b6b30bdf9086833bd5b6d608" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5256bae2d58f54820e6490f9839c49780dff84c65aeab9e772f15d5f0e913a55" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.108" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f01b580c9ac74c8d8f0c0e4afb04eeef2acf145458e52c03845ee9cd23e3d12" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasmi_arena" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "104a7f73be44570cac297b3035d76b169d6599637631cf37a1703326a0727073" + +[[package]] +name = "wasmi_core" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf1a7db34bff95b85c261002720c00c3a6168256dcb93041d3fa2054d19856a" +dependencies = [ + "downcast-rs", + "libm", + "num-traits", + "paste", +] + +[[package]] +name = "wasmparser" +version = "0.88.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb8cf7dd82407fe68161bedcd57fde15596f32ebf6e9b3bdbf3ae1da20e38e5e" +dependencies = [ + "indexmap 1.9.3", +] + +[[package]] +name = "wasmparser-nostd" +version = "0.100.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5a015fe95f3504a94bb1462c717aae75253e39b9dd6c3fb1062c934535c64aa" +dependencies = [ + "indexmap-nostd", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winnow" +version = "0.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5364e9d77fcdeeaa6062ced926ee3381faa2ee02d3eb83a5c27a8825540829" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" diff --git a/IMPLEMENTATION_SUMMARY.md b/IMPLEMENTATION_SUMMARY.md deleted file mode 100644 index 7181083..0000000 --- a/IMPLEMENTATION_SUMMARY.md +++ /dev/null @@ -1,317 +0,0 @@ -# Production-Grade WASM Release Workflow - Implementation Summary - -## ✅ Deliverables Checklist - -### 1. GitHub Actions Workflow: `.github/workflows/release.yml` -- **Triggers**: On git tags matching `v*` (e.g., `v0.2.0`) -- **Deterministic Build**: Pinned Rust toolchain, `CARGO_INCREMENTAL=0`, `--locked` -- **WASM Optimization**: Uses `wasm-tools strip` + `wasm-opt -Oz` -- **SHA256 Checksums**: Generated and included with releases -- **Reproducibility Verification**: Rebuilds locally in CI and verifies checksums match -- **Artifact Upload**: Uses official `softprops/action-gh-release` -- **Security**: `permissions: contents: write` only, no deprecated `set-output` - -### 2. Release Documentation: `RELEASE.md` -Comprehensive guide including: -- Prerequisites and tool installation -- Step-by-step release process -- Tag creation and workflow triggering -- Local checksum verification procedures -- Full reproducible build instructions -- Quick verification script -- Troubleshooting guide -- FAQ section - -### 3. Build Configuration Reference: `BUILD_CONFIG.md` -Technical reference including: -- Required dev dependencies with exact versions -- Explanation of all Cargo.toml profile settings -- Environment variables for deterministic builds -- Verified tool versions -- Build flags and their purposes -- Cargo.lock importance -- Artifact progression -- Common issues and solutions -- Checklist before release - ---- - -## 🚀 Quick Start: Cut Your First Release - -```bash -# 1. Ensure code is ready -git checkout main -git pull origin main -cargo test --all - -# 2. Create annotated tag -git tag -a v0.2.0 -m "Release v0.2.0: Initial smart contract release" - -# 3. Push tag to trigger workflow -git push origin v0.2.0 - -# 4. Monitor at: https://github.com///actions - -# 5. Download and verify artifacts -sha256sum -c checksums.txt # Should show "OK" -``` - ---- - -## 🔐 Workflow Features - -### Build Determinism -✓ Rust toolchain pinned via `rust-toolchain.toml` -✓ Dependencies locked via `Cargo.lock` enforced with `--locked` -✓ `codegen-units = 1` prevents parallel compilation non-determinism -✓ `CARGO_INCREMENTAL=0` disables incremental caching -✓ `RUSTFLAGS="-C embed-bitcode=no"` removes bitcode randomness - -### Artifact Optimization -✓ `wasm-tools strip` removes all symbols and debug info -✓ `wasm-opt -Oz` applies aggressive size optimizations -✓ Deterministic names: `core-.wasm` - -### Integrity Verification -✓ SHA256 checksums generated for all artifacts -✓ Reproducibility verification: rebuilds in CI and compares checksums -✓ Workflow fails immediately if checksums don't match -✓ Checksums uploaded alongside artifacts - -### Release Management -✓ Uses official `softprops/action-gh-release` -✓ Only writes to `contents` permission scope -✓ Fails fast on any error (set -euo pipefail) -✓ Clear artifact labeling and release notes - ---- - -## 📋 Files Created - -``` -.github/ -└── workflows/ - └── release.yml (205 lines, production-grade workflow) - -RELEASE.md (300+ lines, complete guide) -BUILD_CONFIG.md (350+ lines, technical reference) -``` - ---- - -## 🔍 Workflow Job Details - -### Job 1: `build-and-verify` -1. Checkout repository -2. Install Rust (stable) with wasm32-unknown-unknown target -3. Cache dependencies (Swatinem/rust-cache) -4. Install wasm-opt and wasm-tools -5. **Build** with deterministic settings -6. **Strip** WASM binary -7. **Optimize** with wasm-opt -Oz -8. Generate SHA256 checksums -9. Create release-artifacts directory -10. **Verify reproducibility** by rebuilding and comparing checksums -11. **Upload** to GitHub Release via softprops/action-gh-release - -### Job 2: `publish-release-notes` (informational) -- Creates summary metadata with build information -- Includes links to reproducibility guide - ---- - -## ✨ Key Features - -### No Pseudo-Code -✓ All shell steps are complete, copy-paste ready -✓ All YAML is syntactically valid -✓ No placeholders; uses `github.ref_name`, `github.sha` properly - -### Production-Grade -✓ Uses official stable GitHub actions (v4, v2, v1) -✓ Fail-fast error handling (`set -euo pipefail`) -✓ Explicit permission scoping -✓ Runs on ubuntu-22.04 (stable, LTS) - -### Reproducibility Guarantees -✓ Toolchain pinning prevents version skew -✓ Dependency locking prevents transitive updates -✓ CI verification prevents supply chain tampering -✓ SHA256 checksums enable offline verification - -### Supply Chain Security -✓ Deterministic builds enable binary verification -✓ Checksums allow end-users to audit artifacts -✓ Reproducibility verification in CI pipeline -✓ No reliance on third-party build systems - ---- - -## 📖 Documentation Structure - -### For Users Cutting Releases -→ Start with **RELEASE.md** -- "How to Cut a Release" section (step-by-step) -- Workflow monitoring guide -- Verification procedures - -### For DevOps/CI Engineers -→ Start with **BUILD_CONFIG.md** -- Explains all configuration choices -- Tool versions and flags -- Troubleshooting for build failures - -### For Smart Contract Auditors -→ Use **RELEASE.md** → "How to Reproduce the Build Locally" -- Verify binary matches source -- Reproduce exact artifact locally -- Validate supply chain integrity - ---- - -## 🛠️ Required Development Dependencies - -Install once locally: - -```bash -# Rust (auto-pins via rust-toolchain.toml) -curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -rustup target add wasm32-unknown-unknown - -# WASM tools -cargo install wasm-opt -cargo install wasm-tools -``` - -For CI/CD, the workflow handles all installation automatically. - ---- - -## 🎯 Minimal Cargo Configuration (Already Set) - -The project's `Cargo.toml` already has optimal release settings: - -```toml -[profile.release] -opt-level = "z" # Size optimization for contracts -codegen-units = 1 # CRITICAL for reproducibility -lto = true # Link-time optimization -strip = true # Strip symbols -``` - -**Do not modify these without understanding reproducibility impact.** - ---- - -## ✅ Quality Assurance - -The workflow includes: - -- ✓ Type checking (Cargo compilation) -- ✓ Explicit error handling (set -euo pipefail) -- ✓ Integrity verification (SHA256 checksums) -- ✓ Reproducibility verification (rebuild + compare) -- ✓ Permission principle (write only on contents) -- ✓ Latest action versions (v4, v2, v1) -- ✓ No deprecated APIs (no set-output) - ---- - -## 🔗 Related Documentation - -Inside repository: -- `.github/workflows/release.yml` - The GitHub Actions workflow -- `RELEASE.md` - Complete release guide and verification procedures -- `BUILD_CONFIG.md` - Technical configuration reference -- `Cargo.toml` - Project configuration (with optimal profiles) -- `rust-toolchain.toml` - Pinned Rust version - -External: -- [GitHub Actions Documentation](https://docs.github.com/en/actions) -- [Cargo Release Profiles](https://doc.rust-lang.org/cargo/reference/profiles.html) -- [Reproducible Builds](https://reproducible-builds.org/) -- [Soroban Documentation](https://soroban.stellar.org/) - ---- - -## 🚨 Important Notes - -1. **Tag format**: Use `v*` prefix (e.g., `v0.2.0`, `v1.0.0`). Workflow only triggers on these patterns. - -2. **Cargo.lock**: MUST be committed to git. Never use `.gitignore` for Cargo.lock. - -3. **Reproducibility**: If you modify Cargo.toml profiles, understand that builds may no longer be reproducible. - -4. **Tool Versions**: Keep wasm-opt and wasm-tools up to date. The workflow installs latest by default. - -5. **Verification**: Always downstream users should verify checksums with: `sha256sum -c checksums.txt` - ---- - -## 📊 Workflow Execution Flow - -``` -Tag push (v0.2.0) - ↓ -GitHub Actions triggered - ↓ -ubuntu-22.04 runner launched - ↓ -[build-and-verify job] - ├─ Checkout at v0.2.0 - ├─ Install Rust (stable) - ├─ Add wasm32 target - ├─ Cache dependencies - ├─ Install wasm tools - ├─ Build with deterministic flags - ├─ Strip WASM - ├─ Optimize with wasm-opt -Oz - ├─ Generate SHA256 checksums - ├─ Verify reproducibility (rebuild + verify) - └─ Upload to GitHub Release - ↓ -[publish-release-notes job] - └─ Create build metadata - ↓ -Release available at: - https://github.com///releases/tag/v0.2.0 -``` - ---- - -## ❓ FAQ - -**Q: Can I release from a non-main branch?** -A: Yes. Push the tag from any branch; it will trigger the workflow. - -**Q: What if the reproducibility check fails?** -A: The workflow fails with an error message. You must resolve the mismatch before release. - -**Q: How do I verify artifacts locally?** -A: See RELEASE.md → "How to Verify Checksums Locally" → `sha256sum -c checksums.txt` - -**Q: Can I reproduce the exact binary?** -A: Yes. RELEASE.md → "How to Reproduce the Build Locally" has step-by-step instructions. - -**Q: Are there any costs for GitHub Actions?** -A: Public repos: Free. Private repos: 2,000 minutes/month free per account. - -**Q: What if I need to release multiple times per day?** -A: Just push multiple tags. Workflow runs independently per tag. - ---- - -## 🎓 Learning Resources - -If you want to understand the concepts: - -1. **Deterministic Builds**: https://reproducible-builds.org/ -2. **Cargo Profiles**: https://doc.rust-lang.org/cargo/reference/profiles.html -3. **WASM Optimization**: https://github.com/binaryen/binaryen -4. **GitHub Actions**: https://docs.github.com/en/actions - ---- - -**Implementation Complete** ✅ - -All files are production-ready and can be committed immediately to your repository. diff --git a/RELEASE.md b/RELEASE.md deleted file mode 100644 index aff4839..0000000 --- a/RELEASE.md +++ /dev/null @@ -1,403 +0,0 @@ -# Release Process Documentation - -This document explains how to cut releases for SkillSync Contract and verify artifact integrity. - -## Overview - -This project uses a deterministic, reproducible build process for WASM smart contract artifacts: - -- **Pinned Rust toolchain** ensures consistency across machines -- **Locked dependencies** (`Cargo.lock`) guarantee identical builds -- **Disabled incremental compilation** prevents stale artifacts -- **SHA256 checksums** enable integrity verification -- **Reproducibility verification** in CI prevents supply chain compromise - ---- - -## Prerequisites for Local Development - -Install the required tools for building and verifying releases: - -```bash -# Install Rust (uses rust-toolchain.toml for version pinning) -curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -t stable -c rustfmt,clippy - -# Explicitly add wasm32 target -rustup target add wasm32-unknown-unknown - -# Install WASM optimization tools -cargo install wasm-opt -cargo install wasm-tools -``` - -**Verify installation:** - -```bash -rustc --version -cargo --version -wasm-opt --version -wasm-tools --version -``` - ---- - -## How to Cut a Release - -### Step 1: Prepare the Code - -Ensure all commits are on `main` (or your release branch): - -```bash -git checkout main -git pull origin main -``` - -### Step 2: Verify Tests Pass - -```bash -cargo test --all -cargo build --all --release -``` - -### Step 3: Determine the Version - -Use [Semantic Versioning](https://semver.org/): - -- `v1.2.3` - patch release (bug fixes) -- `v1.2.0` - minor release (new features, backward compatible) -- `v2.0.0` - major release (breaking changes) - -### Step 4: Create an Annotated Git Tag - -**Option A: Latest commit** - -```bash -git tag -a v0.2.0 -m "Release v0.2.0: Description of changes" -``` - -**Option B: Specific commit** - -```bash -git tag -a v0.2.0 -m "Release v0.2.0: Description of changes" -``` - -### Step 5: Push the Tag to Trigger Workflow - -```bash -git push origin v0.2.0 -``` - -This triggers the `.github/workflows/release.yml` workflow in GitHub Actions. - -### Step 6: Monitor the Workflow - -1. Go to: `https://github.com///actions` -2. Select the "Release WASM Artifacts" workflow -3. Monitor the build: - - ✓ **Build WASM artifact** - compiles with optimizations - - ✓ **Strip WASM binary** - removes debug info - - ✓ **Optimize WASM** - applies wasm-opt -Oz - - ✓ **Verify build reproducibility** - rebuilds and checks SHA256 - - ✓ **Upload artifacts** - publishes to GitHub Release - -The workflow **fails immediately if reproducibility check fails**. - -### Step 7: Verify Release - -1. Go to: `https://github.com///releases` -2. Confirm artifacts are present: - - `core-v0.2.0.wasm` - optimized smart contract WASM binary - - `checksums.txt` - SHA256 checksums - ---- - -## How to Verify Checksums Locally - -After downloading artifacts from a GitHub Release: - -### Verify Single Artifact - -```bash -sha256sum core-v0.2.0.wasm -# Compare against the value in checksums.txt -``` - -### Verify All Artifacts (Recommended) - -```bash -# Download checksums.txt from the release -# Place it in the same directory as the artifacts - -sha256sum -c checksums.txt - -# Expected output: -# core-v0.2.0.wasm: OK -``` - -### Fail on Verification Error - -```bash -sha256sum -c checksums.txt || exit 1 -``` - ---- - -## How to Reproduce the Build Locally - -To verify you can rebuild the exact same binary: - -### Step 1: Clone the Repository at the Release Tag - -```bash -git clone https://github.com//.git skillsync-contract -cd skillsync-contract -git checkout v0.2.0 # Replace with your release version -``` - -### Step 2: Verify Toolchain is Pinned - -```bash -cat rust-toolchain.toml -# Should output: -# [toolchain] -# channel = "stable" -# targets = ["wasm32-unknown-unknown"] -# components = ["rustfmt", "clippy"] -``` - -### Step 3: Build with Deterministic Settings - -```bash -# Disable incremental compilation -export CARGO_INCREMENTAL=0 -export RUSTFLAGS="-C embed-bitcode=no" - -# Build (--locked ensures Cargo.lock is respected) -cargo build -p skillsync-core \ - --target wasm32-unknown-unknown \ - --release \ - --locked -``` - -### Step 4: Process the WASM Binary - -Strip debug information: - -```bash -wasm-tools strip \ - target/wasm32-unknown-unknown/release/skillsync_core.wasm \ - -o skillsync_core_stripped.wasm - -mv skillsync_core_stripped.wasm \ - target/wasm32-unknown-unknown/release/skillsync_core.wasm -``` - -Optimize: - -```bash -wasm-opt -Oz \ - target/wasm32-unknown-unknown/release/skillsync_core.wasm \ - -o skillsync_core_opt.wasm - -mv skillsync_core_opt.wasm \ - target/wasm32-unknown-unknown/release/skillsync_core.wasm -``` - -### Step 5: Compute Checksum - -```bash -sha256sum target/wasm32-unknown-unknown/release/skillsync_core.wasm -``` - -### Step 6: Compare Against Release Checksum - -```bash -# From the GitHub Release, get the checksum value -# For example: a1b2c3d4... - -EXPECTED="a1b2c3d4..." -COMPUTED=$(sha256sum target/wasm32-unknown-unknown/release/skillsync_core.wasm | cut -d' ' -f1) - -if [ "$EXPECTED" = "$COMPUTED" ]; then - echo "✓ Build reproducibility verified!" -else - echo "✗ Checksums DO NOT match!" - echo "Expected: $EXPECTED" - echo "Got: $COMPUTED" - exit 1 -fi -``` - -### Quick Reproduction Script - -Save as `verify-release.sh`: - -```bash -#!/bin/bash -set -euo pipefail - -VERSION="${1:?Usage: $0 [artifacts_dir]}" -ARTIFACTS_DIR="${2:-.}" - -echo "Verifying release $VERSION" - -# Clone and checkout -REPO_DIR="/tmp/skillsync-verify-$VERSION" -rm -rf "$REPO_DIR" -git clone https://github.com//.git "$REPO_DIR" -cd "$REPO_DIR" -git checkout "$VERSION" - -# Build -export CARGO_INCREMENTAL=0 -export RUSTFLAGS="-C embed-bitcode=no" -cargo build -p skillsync-core \ - --target wasm32-unknown-unknown \ - --release \ - --locked - -# Process -wasm-tools strip \ - target/wasm32-unknown-unknown/release/skillsync_core.wasm \ - -o /tmp/wasm_stripped.wasm -mv /tmp/wasm_stripped.wasm \ - target/wasm32-unknown-unknown/release/skillsync_core.wasm - -wasm-opt -Oz \ - target/wasm32-unknown-unknown/release/skillsync_core.wasm \ - -o /tmp/wasm_opt.wasm -mv /tmp/wasm_opt.wasm \ - target/wasm32-unknown-unknown/release/skillsync_core.wasm - -# Verify -COMPUTED=$(sha256sum target/wasm32-unknown-unknown/release/skillsync_core.wasm | cut -d' ' -f1) -EXPECTED=$(cat "$ARTIFACTS_DIR/checksums.txt" | grep core | cut -d' ' -f1) - -echo "Expected checksum: $EXPECTED" -echo "Computed checksum: $COMPUTED" - -if [ "$EXPECTED" = "$COMPUTED" ]; then - echo "✓ Release $VERSION verified successfully!" - exit 0 -else - echo "✗ Verification FAILED: checksums do not match" - exit 1 -fi -``` - -Usage: - -```bash -chmod +x verify-release.sh -./verify-release.sh v0.2.0 ./downloaded-artifacts -``` - ---- - -## Minimal Cargo Configuration for Reproducibility - -The workspace already includes optimal settings in `Cargo.toml`: - -```toml -[profile.release] -opt-level = "z" # Optimize for size (ideal for WASM) -overflow-checks = true # Safety checks even in release -debug = 0 # Strip debug info -strip = true # Strip symbols -debug-assertions = false # Disable debug assertions -panic = "abort" # Faster panic handling -codegen-units = 1 # Single-threaded codegen (deterministic) -lto = true # Link-time optimization -``` - -**DO NOT modify these settings** unless you understand the reproducibility implications. - ---- - -## Troubleshooting - -### Checksums Don't Match - -**Cause**: Different build environments or settings. - -**Solution**: -1. Verify you're on the correct git tag: `git describe --tags` -2. Verify toolchain: `rustup show` (must match tag's `rust-toolchain.toml`) -3. Verify WASM tools versions: `wasm-opt --version`, `wasm-tools --version` -4. Check you're using `--locked`: `cargo +stable build -p skillsync-core --target wasm32-unknown-unknown --release --locked` -5. Ensure `CARGO_INCREMENTAL=0` and `RUSTFLAGS` are set - -### Build Fails in CI - -Check the GitHub Actions logs at: `https://github.com///actions` - -Common issues: -- Rust toolchain install failed: check internet connectivity -- WASM optimization failed: check wasm-opt installation -- Reproducibility verification failed: see logs for checksum mismatch - ---- - -## Security Considerations - -1. **Artifact Signing**: Consider adding GPG signatures to checksums.txt for production: - ```bash - gpg --clearsign checksums.txt - ``` - -2. **Build Machine Integrity**: CI uses fresh Ubuntu container (guaranteed clean environment) - -3. **Dependency Pinning**: `Cargo.lock` is committed and `--locked` enforces its use - -4. **Supply Chain Security**: Reproducible builds enable detection of tampering - ---- - -## CI/CD Pipeline Details - -The workflow (.github/workflows/release.yml) performs: - -1. **Checkout** - fetch source at tag -2. **Install Toolchain** - uses dtolnay/rust-toolchain@stable with pinned targets -3. **Cache Dependencies** - Swatinem/rust-cache for faster rebuilds -4. **Install Tools** - wasm-opt, wasm-tools -5. **Build** - with CARGO_INCREMENTAL=0, --locked, and deterministic flags -6. **Strip** - remove all symbols and debug info -7. **Optimize** - wasm-opt -Oz for size -8. **Checksum** - generate SHA256 -9. **Verify Reproducibility** - rebuild and compare checksums (exits 1 on mismatch) -10. **Upload** - softprops/action-gh-release with checksums.txt and WASM binary - ---- - -## FAQ - -**Q: Can I release from any branch?** -A: No. The workflow only triggers on tags (`push: tags: v*`). Create and push a tag to trigger. - -**Q: How do I release from a non-main branch?** -A: Just push the tag from any branch. The tag points to a specific commit regardless of branch. - -**Q: What if I need to re-release the same version?** -A: Delete the old tag locally and remotely, then recreate: -```bash -git tag -d v0.2.0 -git push origin :v0.2.0 # Delete remote tag -git tag -a v0.2.0 -m "Release v0.2.0" -git push origin v0.2.0 -``` - -**Q: Are builds truly reproducible?** -A: Yes, the workflow verifies by: rebuilding locally in same CI, recomputing checksum, comparing checksums, failing if they differ. - -**Q: Can I modify compiler settings?** -A: Only if you update Cargo.toml and understand the reproducibility impact. All users must use identical settings. - ---- - -## Related Documentation - -- [Cargo Book - Profiles](https://doc.rust-lang.org/cargo/reference/profiles.html) -- [Soroban Documentation](https://soroban.stellar.org/) -- [wasm-opt Documentation](https://github.com/binaryen/binaryen) -- [Reproducible Builds](https://reproducible-builds.org/) diff --git a/crates/tools/Cargo.toml b/crates/tools/Cargo.toml index 1e04af3..497c990 100644 --- a/crates/tools/Cargo.toml +++ b/crates/tools/Cargo.toml @@ -3,6 +3,10 @@ name = "skillsync-tools" version = "0.1.0" edition = "2021" +[lib] +name = "skillsync_tools" +path = "src/lib.rs" + [[bin]] name = "skillsync" path = "src/main.rs" @@ -14,3 +18,9 @@ anyhow = "1.0" tokio = { version = "1.0", features = ["full"] } serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" +toml = "0.8" +dotenvy = "0.15" +thiserror = "1.0" + +[dev-dependencies] +tempfile = "3.8" diff --git a/crates/tools/src/config.rs b/crates/tools/src/config.rs new file mode 100644 index 0000000..7611920 --- /dev/null +++ b/crates/tools/src/config.rs @@ -0,0 +1,413 @@ +//! Multi-network Soroban configuration management +//! +//! This module provides typed, strongly-validated configuration for Soroban networks. +//! Configuration is resolved in priority order: +//! +//! 1. Environment variables (SOROBAN_*) +//! 2. soroban.toml profile selection +//! 3. Error if required fields are missing +//! +//! # Examples +//! +//! ```rust,no_run +//! use skillsync_tools::config::{Config, Network}; +//! +//! # fn main() -> Result<(), Box> { +//! let config = Config::load()?; +//! println!("Network: {}", config.network); +//! println!("RPC URL: {}", config.rpc_url); +//! # Ok(()) +//! # } +//! ``` + +use serde::{Deserialize, Serialize}; +use std::fmt; +use std::path::Path; +use thiserror::Error; + +/// Configuration error types +#[derive(Error, Debug)] +pub enum ConfigError { + #[error("IO error: {0}")] + Io(#[from] std::io::Error), + + #[error("TOML parse error: {0}")] + TomlError(#[from] toml::de::Error), + + #[error("Missing required field: {0}")] + MissingField(String), + + #[error("Invalid network: {0}. Must be: testnet, mainnet, or sandbox")] + InvalidNetwork(String), + + #[error("Missing SOROBAN_NETWORK environment variable and soroban.toml not found")] + MissingNetworkConfig, + + #[error("Env var error: {0}")] + EnvVar(#[from] std::env::VarError), + + #[error("Configuration validation failed: {0}")] + ValidationError(String), +} + +/// Soroban supported networks +#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)] +#[serde(rename_all = "lowercase")] +pub enum Network { + /// Stellar Testnet - for testing before mainnet + Testnet, + /// Stellar Mainnet - production + Mainnet, + /// Local Soroban Sandbox - for local development + Sandbox, +} + +impl Network { + /// Get network as string + pub fn as_str(&self) -> &'static str { + match self { + Network::Testnet => "testnet", + Network::Mainnet => "mainnet", + Network::Sandbox => "sandbox", + } + } + + /// Parse network from string + pub fn from_str(s: &str) -> Result { + match s.to_lowercase().as_str() { + "testnet" => Ok(Network::Testnet), + "mainnet" => Ok(Network::Mainnet), + "sandbox" => Ok(Network::Sandbox), + other => Err(ConfigError::InvalidNetwork(other.to_string())), + } + } + + /// Get default RPC URL for this network + pub fn default_rpc_url(&self) -> &'static str { + match self { + Network::Testnet => "https://soroban-testnet.stellar.org", + Network::Mainnet => "https://mainnet.sorobanrpc.com", + Network::Sandbox => "http://localhost:8000", + } + } + + /// Get network passphrase for transaction signing + pub fn passphrase(&self) -> &'static str { + match self { + Network::Testnet => "Test SDF Network ; September 2015", + Network::Mainnet => "Public Global Stellar Network ; September 2015", + Network::Sandbox => "Standalone Network ; February 2017", + } + } +} + +impl fmt::Display for Network { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}", self.as_str()) + } +} + +/// TOML profile definition from soroban.toml +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct NetworkProfile { + pub network: String, + pub rpc_url: String, + pub network_passphrase: String, + #[serde(default)] + pub description: Option, +} + +/// Complete Soroban configuration +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct SorobanToml { + #[serde(default)] + pub default: Option, + #[serde(default)] + pub profile: std::collections::HashMap, +} + +/// Default profile section +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct DefaultProfile { + pub network: Option, +} + +/// Resolved runtime configuration with all required fields +#[derive(Debug, Clone)] +pub struct Config { + /// Active network + pub network: Network, + /// RPC endpoint URL + pub rpc_url: String, + /// Network passphrase for signing + pub network_passphrase: String, + /// Contract ID (optional) + pub contract_id: Option, + /// Account address (optional) + pub account: Option, + /// RPC timeout in milliseconds + pub rpc_timeout_ms: u64, + /// Debug mode + pub debug: bool, +} + +impl Config { + /// Load configuration from environment and soroban.toml + /// + /// # Resolution Order + /// + /// 1. Load SOROBAN_NETWORK from env + /// 2. Load individual env vars (SOROBAN_RPC_URL, etc) + /// 3. Load soroban.toml if it exists + /// 4. Overlay env vars on top of TOML values + /// 5. Validate required fields + /// + /// # Errors + /// + /// Returns `ConfigError` if: + /// - No network is configured + /// - Invalid network name is provided + /// - Required fields are missing + pub fn load() -> Result { + // Load .env file if it exists (non-fatal) + let _ = dotenvy::dotenv(); + + // Determine active network + let network_name = std::env::var("SOROBAN_NETWORK") + .ok() + .or_else(|| { + // Try to get from soroban.toml default + Self::load_toml() + .ok() + .and_then(|toml| toml.default.and_then(|d| d.network)) + }) + .unwrap_or_else(|| "testnet".to_string()); + + let network = Network::from_str(&network_name)?; + + // Load TOML profile as baseline + let toml_config = Self::load_toml().ok(); + let profile = toml_config + .as_ref() + .and_then(|t| t.profile.get(network_name.as_str())); + + // Build config with env overrides + let rpc_url = std::env::var("SOROBAN_RPC_URL") + .ok() + .or_else(|| profile.map(|p| p.rpc_url.clone())) + .unwrap_or_else(|| network.default_rpc_url().to_string()); + + let network_passphrase = std::env::var("SOROBAN_NETWORK_PASSPHRASE") + .ok() + .or_else(|| profile.map(|p| p.network_passphrase.clone())) + .unwrap_or_else(|| network.passphrase().to_string()); + + let contract_id = std::env::var("SOROBAN_CONTRACT_ID").ok(); + let account = std::env::var("SOROBAN_ACCOUNT").ok(); + let rpc_timeout_ms = std::env::var("SOROBAN_RPC_TIMEOUT_MS") + .ok() + .and_then(|s| s.parse().ok()) + .unwrap_or(30000); + let debug = std::env::var("SOROBAN_DEBUG") + .ok() + .map(|s| s.eq_ignore_ascii_case("true")) + .unwrap_or(false); + + // Validate + Self::validate(&network, &rpc_url, &network_passphrase)?; + + Ok(Config { + network, + rpc_url, + network_passphrase, + contract_id, + account, + rpc_timeout_ms, + debug, + }) + } + + /// Load soroban.toml from workspace root + fn load_toml() -> Result { + let paths = [Path::new("soroban.toml"), Path::new("./soroban.toml")]; + + for path in paths { + if path.exists() { + let content = std::fs::read_to_string(path)?; + return toml::from_str(&content).map_err(ConfigError::TomlError); + } + } + + Err(ConfigError::MissingNetworkConfig) + } + + /// Validate configuration values + fn validate(_network: &Network, rpc_url: &str, passphrase: &str) -> Result<(), ConfigError> { + if rpc_url.is_empty() { + return Err(ConfigError::MissingField("rpc_url".to_string())); + } + + if passphrase.is_empty() { + return Err(ConfigError::MissingField("network_passphrase".to_string())); + } + + // Validate RPC URL format + if !rpc_url.starts_with("http://") && !rpc_url.starts_with("https://") { + return Err(ConfigError::ValidationError(format!( + "RPC URL must start with http:// or https://: {}", + rpc_url + ))); + } + + Ok(()) + } + + /// Print the resolved configuration + pub fn print_summary(&self) { + println!("╔════════════════════════════════════════════════════════════════╗"); + println!("║ SOROBAN NETWORK CONFIGURATION RESOLVED ║"); + println!("╚════════════════════════════════════════════════════════════════╝"); + println!(" Network: {}", self.network); + println!(" RPC URL: {}", self.rpc_url); + println!(" Network Passphrase: {}", self.network_passphrase); + + if let Some(ref contract) = self.contract_id { + println!(" Contract ID: {}", contract); + } else { + println!(" Contract ID: (not configured)"); + } + + if let Some(ref account) = self.account { + println!(" Account: {}", account); + } else { + println!(" Account: (not configured)"); + } + + println!(" RPC Timeout: {}ms", self.rpc_timeout_ms); + + if self.debug { + println!(" Debug Mode: ENABLED"); + } + + println!("╚════════════════════════════════════════════════════════════════╝"); + } + + /// Get configuration as JSON + pub fn to_json(&self) -> Result { + serde_json::to_string_pretty(self) + } +} + +// Manual Serialize impl for Config since we want custom serialization +impl Serialize for Config { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + use serde::ser::SerializeMap; + let mut map = serializer.serialize_map(Some(7))?; + map.serialize_entry("network", &self.network.to_string())?; + map.serialize_entry("rpc_url", &self.rpc_url)?; + map.serialize_entry("network_passphrase", &self.network_passphrase)?; + map.serialize_entry("contract_id", &self.contract_id)?; + map.serialize_entry("account", &self.account)?; + map.serialize_entry("rpc_timeout_ms", &self.rpc_timeout_ms)?; + map.serialize_entry("debug", &self.debug)?; + map.end() + } +} + +#[cfg(test)] +mod tests { + use super::*; + use std::env; + + fn setup_test_env() { + env::remove_var("SOROBAN_NETWORK"); + env::remove_var("SOROBAN_RPC_URL"); + env::remove_var("SOROBAN_NETWORK_PASSPHRASE"); + env::remove_var("SOROBAN_CONTRACT_ID"); + env::remove_var("SOROBAN_ACCOUNT"); + } + + #[test] + fn test_network_from_str() { + assert_eq!(Network::from_str("testnet").unwrap(), Network::Testnet); + assert_eq!(Network::from_str("mainnet").unwrap(), Network::Mainnet); + assert_eq!(Network::from_str("sandbox").unwrap(), Network::Sandbox); + assert_eq!(Network::from_str("TESTNET").unwrap(), Network::Testnet); + } + + #[test] + fn test_network_invalid() { + assert!(Network::from_str("invalid").is_err()); + } + + #[test] + fn test_network_display() { + assert_eq!(Network::Testnet.to_string(), "testnet"); + assert_eq!(Network::Mainnet.to_string(), "mainnet"); + assert_eq!(Network::Sandbox.to_string(), "sandbox"); + } + + #[test] + fn test_network_default_rpc_urls() { + assert_eq!( + Network::Testnet.default_rpc_url(), + "https://soroban-testnet.stellar.org" + ); + assert_eq!( + Network::Mainnet.default_rpc_url(), + "https://mainnet.sorobanrpc.com" + ); + assert_eq!(Network::Sandbox.default_rpc_url(), "http://localhost:8000"); + } + + #[test] + fn test_network_passphrases() { + assert_eq!( + Network::Testnet.passphrase(), + "Test SDF Network ; September 2015" + ); + assert_eq!( + Network::Mainnet.passphrase(), + "Public Global Stellar Network ; September 2015" + ); + assert_eq!( + Network::Sandbox.passphrase(), + "Standalone Network ; February 2017" + ); + } + + #[test] + fn test_validate_missing_rpc_url() { + let result = Config::validate(&Network::Testnet, "", "Test SDF Network ; September 2015"); + assert!(result.is_err()); + } + + #[test] + fn test_validate_missing_passphrase() { + let result = Config::validate(&Network::Testnet, "https://example.com", ""); + assert!(result.is_err()); + } + + #[test] + fn test_validate_invalid_rpc_url() { + let result = Config::validate( + &Network::Testnet, + "ftp://example.com", + "Test SDF Network ; September 2015", + ); + assert!(result.is_err()); + } + + #[test] + fn test_validate_success() { + let result = Config::validate( + &Network::Testnet, + "https://soroban-testnet.stellar.org", + "Test SDF Network ; September 2015", + ); + assert!(result.is_ok()); + } +} diff --git a/crates/tools/src/lib.rs b/crates/tools/src/lib.rs new file mode 100644 index 0000000..9fd586a --- /dev/null +++ b/crates/tools/src/lib.rs @@ -0,0 +1,7 @@ +//! SkillSync Tools Library +//! +//! Provides configuration management and utilities for Soroban smart contract deployment. + +pub mod config; + +pub use config::{Config, ConfigError, Network}; diff --git a/crates/tools/src/main.rs b/crates/tools/src/main.rs index 960021d..afdfe4e 100644 --- a/crates/tools/src/main.rs +++ b/crates/tools/src/main.rs @@ -1,5 +1,8 @@ +mod config; + use anyhow::Result; use clap::{Parser, Subcommand}; +use config::Config; #[derive(Parser)] #[command(name = "skillsync")] @@ -11,17 +14,25 @@ struct Cli { #[derive(Subcommand)] enum Commands { + /// Manage network configuration + Network { + #[command(subcommand)] + action: Option, + }, /// Deploy the SkillSync contract Deploy { - /// Network to deploy to (testnet/mainnet) - #[arg(short, long, default_value = "testnet")] - network: String, + /// Network to deploy to (testnet/mainnet/sandbox) + #[arg(short, long)] + network: Option, /// Contract WASM file path #[arg(short, long)] wasm: String, }, - /// Check configuration + /// Check and display configuration Config { + /// Format output as JSON + #[arg(short, long)] + json: bool, /// Validate configuration files #[arg(short, long)] validate: bool, @@ -34,24 +45,73 @@ enum Commands { }, } +#[derive(Subcommand)] +enum NetworkAction { + /// Show active network configuration + Show, + /// List available networks + List, +} + #[tokio::main] async fn main() -> Result<()> { let cli = Cli::parse(); match cli.command { + Commands::Network { action } => match action { + Some(NetworkAction::Show) => { + let config = Config::load()?; + config.print_summary(); + Ok(()) + } + Some(NetworkAction::List) => { + println!("╔════════════════════════════════════════════════════════════════╗"); + println!("║ AVAILABLE SOROBAN NETWORKS ║"); + println!("╚════════════════════════════════════════════════════════════════╝"); + println!(" testnet - Stellar Testnet (for testing)"); + println!(" mainnet - Stellar Mainnet (production)"); + println!(" sandbox - Local Soroban Sandbox (localhost:8000)"); + println!(); + println!("To select a network:"); + println!(" export SOROBAN_NETWORK=testnet"); + println!(" cargo run -p skillsync-tools -- network show"); + Ok(()) + } + None => { + let config = Config::load()?; + config.print_summary(); + Ok(()) + } + }, Commands::Deploy { network, wasm } => { - println!("Deploying contract to {} network", network); + let config = match network { + Some(net) => { + // Override network from command line + std::env::set_var("SOROBAN_NETWORK", net.clone()); + Config::load()? + } + None => Config::load()?, + }; + + println!("Deploying contract to {} network", config.network); println!("WASM file: {}", wasm); + println!("RPC URL: {}", config.rpc_url); // TODO: Implement deployment logic Ok(()) } - Commands::Config { validate } => { + Commands::Config { json, validate } => { + let config = Config::load()?; + if validate { - println!("Validating configuration..."); - // TODO: Implement config validation + println!("✓ Configuration is valid"); + } + + if json { + println!("{}", config.to_json()?); } else { - println!("Configuration check completed"); + config.print_summary(); } + Ok(()) } Commands::Build { profile } => { diff --git a/soroban.toml b/soroban.toml new file mode 100644 index 0000000..3b4141f --- /dev/null +++ b/soroban.toml @@ -0,0 +1,28 @@ +# Soroban Multi-Network Configuration +# +# This file defines network profiles for deploying SkillSync contracts. +# Networks can be selected via SOROBAN_NETWORK environment variable. +# +# See SOROBAN.md for complete documentation on network management. + +[profile.testnet] +network = "testnet" +rpc_url = "https://soroban-testnet.stellar.org" +network_passphrase = "Test SDF Network ; September 2015" +description = "Stellar Testnet - for testing before mainnet deployment" + +[profile.mainnet] +network = "mainnet" +rpc_url = "https://mainnet.sorobanrpc.com" +network_passphrase = "Public Global Stellar Network ; September 2015" +description = "Stellar Mainnet - production network" + +[profile.sandbox] +network = "sandbox" +rpc_url = "http://localhost:8000" +network_passphrase = "Standalone Network ; February 2017" +description = "Local Soroban sandbox - for local development" + +# Default profile to use if SOROBAN_NETWORK is not set +[default] +network = "testnet"