From 9d8c8551ed5656d67e19309b5a18094218459ad2 Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Sun, 8 Jun 2025 11:46:57 +0400 Subject: [PATCH 01/28] initialize cargo crate --- .envrc | 10 + .gitignore | 4 +- Cargo.lock | 3853 ++++++++++++++++++++++++++++++++++++++ Cargo.toml | 12 + crates/float/Cargo.toml | 7 + crates/float/src/main.rs | 3 + flake.lock | 30 +- 7 files changed, 3903 insertions(+), 16 deletions(-) create mode 100644 .envrc create mode 100644 Cargo.lock create mode 100644 Cargo.toml create mode 100644 crates/float/Cargo.toml create mode 100644 crates/float/src/main.rs diff --git a/.envrc b/.envrc new file mode 100644 index 00000000..a3693d2d --- /dev/null +++ b/.envrc @@ -0,0 +1,10 @@ +if ! has nix_direnv_version || ! nix_direnv_version 3.0.6; then + URL=https://raw.githubusercontent.com/nix-community/nix-direnv/3.0.6/direnvrc + HASH=sha256-RYcUJaRMf8oF5LznDrlCXbkOQrywm0HDv1VjYGaJGdM= + source_url "$URL" "$HASH" +fi + +watch_file flake.lock +watch_file flake.nix + +use flake . --verbose --show-trace \ No newline at end of file diff --git a/.gitignore b/.gitignore index bf3d16b4..805c9107 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ out -cache \ No newline at end of file +cache +.direnv +target \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock new file mode 100644 index 00000000..39f1140f --- /dev/null +++ b/Cargo.lock @@ -0,0 +1,3853 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "allocator-api2" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" + +[[package]] +name = "alloy" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0093d23bf026b580c1f66ed3a053d8209c104a446c5264d3ad99587f6edef24e" +dependencies = [ + "alloy-consensus", + "alloy-contract", + "alloy-core", + "alloy-eips", + "alloy-genesis", + "alloy-network", + "alloy-provider", + "alloy-rpc-client", + "alloy-rpc-types", + "alloy-serde", + "alloy-signer", + "alloy-signer-local", + "alloy-transport", + "alloy-transport-http", +] + +[[package]] +name = "alloy-chains" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6967ca1ed656766e471bc323da42fb0db320ca5e1418b408650e98e4757b3d2" +dependencies = [ + "alloy-primitives", + "num_enum", + "strum", +] + +[[package]] +name = "alloy-consensus" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad451f9a70c341d951bca4e811d74dbe1e193897acd17e9dbac1353698cc430b" +dependencies = [ + "alloy-eips", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "alloy-trie", + "auto_impl", + "c-kzg", + "derive_more", + "either", + "k256", + "once_cell", + "rand 0.8.5", + "secp256k1", + "serde", + "serde_with", + "thiserror", +] + +[[package]] +name = "alloy-consensus-any" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "142daffb15d5be1a2b20d2cd540edbcef03037b55d4ff69dc06beb4d06286dba" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "serde", +] + +[[package]] +name = "alloy-contract" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebf25443920ecb9728cb087fe4dc04a0b290bd6ac85638c58fe94aba70f1a44e" +dependencies = [ + "alloy-consensus", + "alloy-dyn-abi", + "alloy-json-abi", + "alloy-network", + "alloy-network-primitives", + "alloy-primitives", + "alloy-provider", + "alloy-rpc-types-eth", + "alloy-sol-types", + "alloy-transport", + "futures", + "futures-util", + "thiserror", +] + +[[package]] +name = "alloy-core" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5968f48d7a62587cd874bd84034831da4f7f577ce5de984828e376766efc0f32" +dependencies = [ + "alloy-dyn-abi", + "alloy-json-abi", + "alloy-primitives", + "alloy-rlp", + "alloy-sol-types", +] + +[[package]] +name = "alloy-dyn-abi" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9135eb501feccf7f4cb8a183afd406a65483fdad7bbd7332d0470e5d725c92f" +dependencies = [ + "alloy-json-abi", + "alloy-primitives", + "alloy-sol-type-parser", + "alloy-sol-types", + "itoa", + "serde", + "serde_json", + "winnow", +] + +[[package]] +name = "alloy-eip2124" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "741bdd7499908b3aa0b159bba11e71c8cddd009a2c2eb7a06e825f1ec87900a5" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "crc", + "serde", + "thiserror", +] + +[[package]] +name = "alloy-eip2930" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b82752a889170df67bbb36d42ca63c531eb16274f0d7299ae2a680facba17bd" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "serde", +] + +[[package]] +name = "alloy-eip7702" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d4769c6ffddca380b0070d71c8b7f30bed375543fe76bb2f74ec0acf4b7cd16" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "serde", + "thiserror", +] + +[[package]] +name = "alloy-eips" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3056872f6da48046913e76edb5ddced272861f6032f09461aea1a2497be5ae5d" +dependencies = [ + "alloy-eip2124", + "alloy-eip2930", + "alloy-eip7702", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "auto_impl", + "c-kzg", + "derive_more", + "either", + "serde", + "sha2", +] + +[[package]] +name = "alloy-genesis" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c98fb40f07997529235cc474de814cd7bd9de561e101716289095696c0e4639d" +dependencies = [ + "alloy-eips", + "alloy-primitives", + "alloy-serde", + "alloy-trie", + "serde", +] + +[[package]] +name = "alloy-json-abi" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b26fdd571915bafe857fccba4ee1a4f352965800e46a53e4a5f50187b7776fa" +dependencies = [ + "alloy-primitives", + "alloy-sol-type-parser", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-json-rpc" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc08b31ebf9273839bd9a01f9333cbb7a3abb4e820c312ade349dd18bdc79581" +dependencies = [ + "alloy-primitives", + "alloy-sol-types", + "serde", + "serde_json", + "thiserror", + "tracing", +] + +[[package]] +name = "alloy-network" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed117b08f0cc190312bf0c38c34cf4f0dabfb4ea8f330071c587cd7160a88cb2" +dependencies = [ + "alloy-consensus", + "alloy-consensus-any", + "alloy-eips", + "alloy-json-rpc", + "alloy-network-primitives", + "alloy-primitives", + "alloy-rpc-types-any", + "alloy-rpc-types-eth", + "alloy-serde", + "alloy-signer", + "alloy-sol-types", + "async-trait", + "auto_impl", + "derive_more", + "futures-utils-wasm", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "alloy-network-primitives" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7162ff7be8649c0c391f4e248d1273e85c62076703a1f3ec7daf76b283d886d" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-primitives", + "alloy-serde", + "serde", +] + +[[package]] +name = "alloy-primitives" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a326d47106039f38b811057215a92139f46eef7983a4b77b10930a0ea5685b1e" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more", + "foldhash", + "hashbrown 0.15.4", + "indexmap 2.9.0", + "itoa", + "k256", + "keccak-asm", + "paste", + "proptest", + "rand 0.9.1", + "ruint", + "rustc-hash", + "serde", + "sha3", + "tiny-keccak", +] + +[[package]] +name = "alloy-provider" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d84eba1fd8b6fe8b02f2acd5dd7033d0f179e304bd722d11e817db570d1fa6c4" +dependencies = [ + "alloy-chains", + "alloy-consensus", + "alloy-eips", + "alloy-json-rpc", + "alloy-network", + "alloy-network-primitives", + "alloy-primitives", + "alloy-rpc-client", + "alloy-rpc-types-eth", + "alloy-signer", + "alloy-sol-types", + "alloy-transport", + "alloy-transport-http", + "async-stream", + "async-trait", + "auto_impl", + "dashmap", + "either", + "futures", + "futures-utils-wasm", + "lru", + "parking_lot", + "pin-project", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", + "url", + "wasmtimer", +] + +[[package]] +name = "alloy-rlp" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f70d83b765fdc080dbcd4f4db70d8d23fe4761f2f02ebfa9146b833900634b4" +dependencies = [ + "alloy-rlp-derive", + "arrayvec", + "bytes", +] + +[[package]] +name = "alloy-rlp-derive" +version = "0.3.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64b728d511962dda67c1bc7ea7c03736ec275ed2cf4c35d9585298ac9ccf3b73" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "alloy-rpc-client" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "518a699422a3eab800f3dac2130d8f2edba8e4fff267b27a9c7dc6a2b0d313ee" +dependencies = [ + "alloy-json-rpc", + "alloy-primitives", + "alloy-transport", + "alloy-transport-http", + "async-stream", + "futures", + "pin-project", + "reqwest", + "serde", + "serde_json", + "tokio", + "tokio-stream", + "tower", + "tracing", + "tracing-futures", + "url", + "wasmtimer", +] + +[[package]] +name = "alloy-rpc-types" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c000cab4ec26a4b3e29d144e999e1c539c2fa0abed871bf90311eb3466187ca8" +dependencies = [ + "alloy-primitives", + "alloy-rpc-types-eth", + "alloy-serde", + "serde", +] + +[[package]] +name = "alloy-rpc-types-any" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "508b2fbe66d952089aa694e53802327798806498cd29ff88c75135770ecaabfc" +dependencies = [ + "alloy-consensus-any", + "alloy-rpc-types-eth", + "alloy-serde", +] + +[[package]] +name = "alloy-rpc-types-eth" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcaf7dff0fdd756a714d58014f4f8354a1706ebf9fa2cf73431e0aeec3c9431e" +dependencies = [ + "alloy-consensus", + "alloy-consensus-any", + "alloy-eips", + "alloy-network-primitives", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "alloy-sol-types", + "itertools 0.14.0", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "alloy-serde" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "730e8f2edf2fc224cabd1c25d090e1655fa6137b2e409f92e5eec735903f1507" +dependencies = [ + "alloy-primitives", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-signer" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b0d2428445ec13edc711909e023d7779618504c4800be055a5b940025dbafe3" +dependencies = [ + "alloy-primitives", + "async-trait", + "auto_impl", + "either", + "elliptic-curve", + "k256", + "thiserror", +] + +[[package]] +name = "alloy-signer-local" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e14fe6fedb7fe6e0dfae47fe020684f1d8e063274ef14bca387ddb7a6efa8ec1" +dependencies = [ + "alloy-consensus", + "alloy-network", + "alloy-primitives", + "alloy-signer", + "async-trait", + "k256", + "rand 0.8.5", + "thiserror", +] + +[[package]] +name = "alloy-sol-macro" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4be1ce1274ddd7fdfac86e5ece1b225e9bba1f2327e20fbb30ee6b9cc1423fe" +dependencies = [ + "alloy-sol-macro-expander", + "alloy-sol-macro-input", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "alloy-sol-macro-expander" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01e92f3708ea4e0d9139001c86c051c538af0146944a2a9c7181753bd944bf57" +dependencies = [ + "alloy-json-abi", + "alloy-sol-macro-input", + "const-hex", + "heck", + "indexmap 2.9.0", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.101", + "syn-solidity", + "tiny-keccak", +] + +[[package]] +name = "alloy-sol-macro-input" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9afe1bd348a41f8c9b4b54dfb314886786d6201235b0b3f47198b9d910c86bb2" +dependencies = [ + "alloy-json-abi", + "const-hex", + "dunce", + "heck", + "macro-string", + "proc-macro2", + "quote", + "serde_json", + "syn 2.0.101", + "syn-solidity", +] + +[[package]] +name = "alloy-sol-type-parser" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6195df2acd42df92a380a8db6205a5c7b41282d0ce3f4c665ecf7911ac292f1" +dependencies = [ + "serde", + "winnow", +] + +[[package]] +name = "alloy-sol-types" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6185e98a79cf19010722f48a74b5a65d153631d2f038cabd250f4b9e9813b8ad" +dependencies = [ + "alloy-json-abi", + "alloy-primitives", + "alloy-sol-macro", + "serde", +] + +[[package]] +name = "alloy-transport" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a712bdfeff42401a7dd9518f72f617574c36226a9b5414537fedc34350b73bf9" +dependencies = [ + "alloy-json-rpc", + "alloy-primitives", + "base64", + "derive_more", + "futures", + "futures-utils-wasm", + "parking_lot", + "serde", + "serde_json", + "thiserror", + "tokio", + "tower", + "tracing", + "url", + "wasmtimer", +] + +[[package]] +name = "alloy-transport-http" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ea5a76d7f2572174a382aedf36875bedf60bcc41116c9f031cf08040703a2dc" +dependencies = [ + "alloy-json-rpc", + "alloy-transport", + "reqwest", + "serde_json", + "tower", + "tracing", + "url", +] + +[[package]] +name = "alloy-trie" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "983d99aa81f586cef9dae38443245e585840fcf0fc58b09aee0b1f27aed1d500" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "arrayvec", + "derive_more", + "nybbles", + "serde", + "smallvec", + "tracing", +] + +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + +[[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 = "ark-ff" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6" +dependencies = [ + "ark-ff-asm 0.3.0", + "ark-ff-macros 0.3.0", + "ark-serialize 0.3.0", + "ark-std 0.3.0", + "derivative", + "num-bigint", + "num-traits", + "paste", + "rustc_version 0.3.3", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm 0.4.2", + "ark-ff-macros 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "digest 0.10.7", + "itertools 0.10.5", + "num-bigint", + "num-traits", + "paste", + "rustc_version 0.4.1", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" +dependencies = [ + "num-bigint", + "num-traits", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-serialize" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" +dependencies = [ + "ark-std 0.3.0", + "digest 0.9.0", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-std 0.4.0", + "digest 0.10.7", + "num-bigint", +] + +[[package]] +name = "ark-std" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" +dependencies = [ + "serde", +] + +[[package]] +name = "async-stream" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" +dependencies = [ + "async-stream-impl", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-stream-impl" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "async-trait" +version = "0.1.88" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "auto_impl" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffdcb70bdbc4d478427380519163274ac86e52916e10f0a8889adf0f96d3fee7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "backtrace" +version = "0.3.75" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6806a6321ec58106fea15becdad98371e28d92ccbc7c8f1b3b6dd724fe8f1002" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets", +] + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[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.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" + +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + +[[package]] +name = "bitcoin-io" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b47c4ab7a93edb0c7198c5535ed9b52b63095f4e9b45279c6736cec4b856baf" + +[[package]] +name = "bitcoin_hashes" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb18c03d0db0247e147a21a6faafd5a7eb851c743db062de72018b6b7e8e4d16" +dependencies = [ + "bitcoin-io", + "hex-conservative", +] + +[[package]] +name = "bitflags" +version = "2.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "tap", + "wyz", +] + +[[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 = "blst" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fd49896f12ac9b6dcd7a5998466b9b58263a695a3dd1ecc1aaca2e12a90b080" +dependencies = [ + "cc", + "glob", + "threadpool", + "zeroize", +] + +[[package]] +name = "bumpalo" +version = "3.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db76d6187cd04dff33004d8e6c9cc4e05cd330500379d2394209271b4aeee" + +[[package]] +name = "byte-slice-cast" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7575182f7272186991736b70173b0ea045398f984bf5ebbb3804736ce1330c9d" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71b6127be86fdcfddb610f7182ac57211d4b18a3e9c82eb2d17662f2227ad6a" +dependencies = [ + "serde", +] + +[[package]] +name = "c-kzg" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7318cfa722931cb5fe0838b98d3ce5621e75f6a6408abc21721d80de9223f2e4" +dependencies = [ + "blst", + "cc", + "glob", + "hex", + "libc", + "once_cell", + "serde", +] + +[[package]] +name = "cc" +version = "1.2.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "956a5e21988b87f372569b66183b78babf23ebc2e744b733e4350a752c4dafac" +dependencies = [ + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "chrono" +version = "0.4.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" +dependencies = [ + "android-tzdata", + "iana-time-zone", + "num-traits", + "serde", + "windows-link", +] + +[[package]] +name = "const-hex" +version = "1.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83e22e0ed40b96a48d3db274f72fd365bd78f67af39b6bbd47e8a15e1c6207ff" +dependencies = [ + "cfg-if", + "cpufeatures", + "hex", + "proptest", + "serde", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "const_format" +version = "0.2.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126f97965c8ad46d6d9163268ff28432e8f6a1196a55578867832e3049df63dd" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d57c2eccfb16dbac1f4e61e206105db5820c9d26c3c472bc17c774259ef7744" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[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 = "crc" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9710d3b3739c2e349eb44fe848ad0b7c8cb1e42bd87ee49371df2f7acaf3e675" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crunchy" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43da5946c66ffcc7745f48db692ffbb10a83bfe0afd96235c5c2a4fb23994929" + +[[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 0.6.4", + "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 = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core", + "darling_macro", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.101", +] + +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "dashmap" +version = "6.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf" +dependencies = [ + "cfg-if", + "crossbeam-utils", + "hashbrown 0.14.5", + "lock_api", + "once_cell", + "parking_lot_core", +] + +[[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.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" +dependencies = [ + "powerfmt", + "serde", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive_more" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "093242cf7570c207c83073cf82f79706fe7b8317e98620a47d5be7c3d8497678" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", + "unicode-xid", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[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 = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest 0.10.7", + "elliptic-curve", + "rfc6979", + "serdect", + "signature", + "spki", +] + +[[package]] +name = "either" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48c757948c5ede0e46177b7add2e67155f70e33c07fea8284df6576da70b3719" +dependencies = [ + "serde", +] + +[[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 0.10.7", + "ff", + "generic-array", + "group", + "pkcs8", + "rand_core 0.6.4", + "sec1", + "serdect", + "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.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18" +dependencies = [ + "libc", + "windows-sys 0.59.0", +] + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "fastrlp" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139834ddba373bbdd213dffe02c8d110508dcf1726c2be27e8d1f7d7e1856418" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", +] + +[[package]] +name = "fastrlp" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce8dba4714ef14b8274c371879b175aa55b16b30f269663f19d576f380018dc4" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", +] + +[[package]] +name = "ff" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" +dependencies = [ + "rand_core 0.6.4", + "subtle", +] + +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "byteorder", + "rand 0.8.5", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" +dependencies = [ + "futures-channel", + "futures-core", + "futures-executor", + "futures-io", + "futures-sink", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-executor" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "futures-utils-wasm" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42012b0f064e01aa58b545fe3727f90f7dd4020f4a3ea735b50344965f5a57e9" + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" +dependencies = [ + "cfg-if", + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", +] + +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + +[[package]] +name = "glob" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core 0.6.4", + "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.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "hashbrown" +version = "0.15.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", + "serde", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f154ce46856750ed433c8649605bf7ed2de3bc35fd9d2a9f30cddd873c80cb08" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] + +[[package]] +name = "hex-conservative" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5313b072ce3c597065a808dbf612c4c8e8590bdbf8b579508bf7a762c5eae6cd" +dependencies = [ + "arrayvec", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "http" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4a85d31aea989eead29a3aaf9e1115a180df8282431156e533de47660892565" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc2fdfdbff08affe55bb779f33b053aa1fe5dd5b54c257343c17edfa55711bdb" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-core", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.63" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0c919e5debc312ad217002b8048a17b7d83f80703865bbfcfebb0458b0b27d8" +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 = "icu_collections" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "200072f5d0e3614556f94a9930d5dc3e0662a652823904c3a75dc3b0af7fee47" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde2700ccaed3872079a65fb1a78f6c0a36c91570f28755dda67bc8f7d9f00a" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436880e8e18df4d7bbc06d58432329d6458cc84531f7ac5f024e93deadb37979" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00210d6893afc98edb752b664b8890f0ef174c8adbb8d0be9710fa66fbbf72d3" + +[[package]] +name = "icu_properties" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "016c619c1eeb94efb86809b015c58f479963de65bdb6253345c1a1276f22e32b" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "potential_utf", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "298459143998310acd25ffe6810ed544932242d3f07083eee1084d83a71bd632" + +[[package]] +name = "icu_provider" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c80da27b5f4187909049ee2d72f276f0d9f99a42c306bd0131ecfe04d8e5af" +dependencies = [ + "displaydoc", + "icu_locale_core", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[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.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +dependencies = [ + "equivalent", + "hashbrown 0.15.4", + "serde", +] + +[[package]] +name = "ipnet" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" + +[[package]] +name = "iri-string" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc5ebe9c3a1a7a5127f920a418f7585e9e758e911d0466ed004f393b0e380b2" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b192c782037fadd9cfa75548310488aabdbf3d2da73885b31bd0abd03351285" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" + +[[package]] +name = "js-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "serdect", + "sha2", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "keccak-asm" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "505d1856a39b200489082f90d897c3f07c455563880bc5952e38eabf731c83b6" +dependencies = [ + "digest 0.10.7", + "sha3-asm", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.172" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" + +[[package]] +name = "libm" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" + +[[package]] +name = "linux-raw-sys" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" + +[[package]] +name = "litemap" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "241eaef5fd12c88705a01fc1066c48c4b36e0dd4377dcdc7ec3942cea7a69956" + +[[package]] +name = "lock_api" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96936507f153605bddfcda068dd804796c84324ed2510809e5b2a624c81da765" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13dc2df351e3202783a1fe0d44375f7295ffb4049267b0f3018346dc122a1d94" + +[[package]] +name = "lru" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "227748d55f2f0ab4735d87fd623798cb6b664512fe979705f829c9f81c934465" +dependencies = [ + "hashbrown 0.15.4", +] + +[[package]] +name = "macro-string" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b27834086c65ec3f9387b096d66e99f221cf081c2b738042aa252bcd41204e3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "miniz_oxide" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" +dependencies = [ + "libc", + "wasi 0.11.0+wasi-snapshot-preview1", + "windows-sys 0.59.0", +] + +[[package]] +name = "native-tls" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87de3442987e9dbec73158d5c715e7ad9072fda936bb03d19d7fa10e00520f0e" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "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-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91df4bbde75afed763b708b7eee1e8e7651e02d97f6d5dd763e89367e957b23b" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "num_enum" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e613fc340b2220f734a8595782c551f1250e969d87d3be1ae0579e8d4065179" +dependencies = [ + "num_enum_derive", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "nybbles" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8983bb634df7248924ee0c4c3a749609b5abcb082c28fffe3254b3eb3602b307" +dependencies = [ + "alloy-rlp", + "const-hex", + "proptest", + "serde", + "smallvec", +] + +[[package]] +name = "object" +version = "0.36.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62948e14d923ea95ea2c7c86c71013138b66525b86bdc08d2dcc262bdb497b87" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "openssl" +version = "0.10.73" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8505734d46c8ab1e19a1dce3aef597ad87dcb4c37e7188231769bd6bd51cebf8" +dependencies = [ + "bitflags", + "cfg-if", + "foreign-types", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "openssl-probe" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d05e27ee213611ffe7d6348b942e8f942b37114c00cc03cec254295a4a17852e" + +[[package]] +name = "openssl-sys" +version = "0.9.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "90096e2e47630d78b7d1c20952dc621f957103f8bc2c8359ec81290d75238571" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "parity-scale-codec" +version = "3.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799781ae679d79a948e13d4824a40970bfa500058d245760dd857301059810fa" +dependencies = [ + "arrayvec", + "bitvec", + "byte-slice-cast", + "const_format", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "rustversion", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34b4653168b563151153c9e4c08ebed57fb8262bebfa79711552fa983c623e7a" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "parking_lot" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70d58bf43669b5795d1576d0641cfb6fbb2057bf629506267a92807158584a13" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc838d2a56b5b1a6c25f55575dfc605fabb63bb2365f6c2353ef9159aa69e4a5" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pest" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "198db74531d58c70a361c42201efde7e2591e976d518caf7662a47dc5720e7b6" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pin-project" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677f1add503faace112b9f1373e43e9e054bfdd22ff1a63c1bc485eaec6a6a8a" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" + +[[package]] +name = "potential_utf" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5a7c30837279ca13e7c867e9e40053bc68740f988cb07f7ca6df43cc734b585" +dependencies = [ + "zerovec", +] + +[[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.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "primitive-types" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" +dependencies = [ + "fixed-hash", + "impl-codec", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edce586971a4dfaa28950c6f18ed55e0406c1ab88bbce2c6f6293a7aaba73d35" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro-error-attr2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "proc-macro-error2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" +dependencies = [ + "proc-macro-error-attr2", + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "proc-macro2" +version = "1.0.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proptest" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fcdab19deb5195a31cf7726a210015ff1496ba1464fd42cb4f537b8b01b471f" +dependencies = [ + "bit-set", + "bit-vec", + "bitflags", + "lazy_static", + "num-traits", + "rand 0.9.1", + "rand_chacha 0.9.0", + "rand_xorshift", + "regex-syntax", + "rusty-fork", + "tempfile", + "unarray", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quote" +version = "1.0.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rain-math-float" +version = "0.1.0" +dependencies = [ + "alloy", +] + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", + "serde", +] + +[[package]] +name = "rand" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fbfd9d094a40bf3ae768db9361049ace4c0e04a4fd6b359518bd7b73a73dd97" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.3", + "serde", +] + +[[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 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.3", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.16", +] + +[[package]] +name = "rand_core" +version = "0.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "99d9a13982dcf210057a8a78572b2217b667c3beacbf3a0d8b454f6f82837d38" +dependencies = [ + "getrandom 0.3.3", + "serde", +] + +[[package]] +name = "rand_xorshift" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "513962919efc330f829edb2535844d1b912b0fbe2ca165d613e4e8788bb05a5a" +dependencies = [ + "rand_core 0.9.3", +] + +[[package]] +name = "redox_syscall" +version = "0.5.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "928fca9cf2aa042393a8325b9ead81d2f0df4cb12e1e24cef072922ccd99c5af" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "reqwest" +version = "0.12.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2f8e5513d63f2e5b386eb5106dc67eaf3f84e95258e210489136b8b92ad6119" +dependencies = [ + "base64", + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-tls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-native-tls", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac", + "subtle", +] + +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rustc-hex", +] + +[[package]] +name = "ruint" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11256b5fe8c68f56ac6f39ef0720e592f33d2367a4782740d9c9142e889c7fb4" +dependencies = [ + "alloy-rlp", + "ark-ff 0.3.0", + "ark-ff 0.4.2", + "bytes", + "fastrlp 0.3.1", + "fastrlp 0.4.0", + "num-bigint", + "num-integer", + "num-traits", + "parity-scale-codec", + "primitive-types", + "proptest", + "rand 0.8.5", + "rand 0.9.1", + "rlp", + "ruint-macro", + "serde", + "valuable", + "zeroize", +] + +[[package]] +name = "ruint-macro" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "rustc_version" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +dependencies = [ + "semver 0.11.0", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver 1.0.26", +] + +[[package]] +name = "rustix" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c71e83d6afe7ff64890ec6b71d6a69bb8a610ab78ce364b3352876bb4c801266" +dependencies = [ + "bitflags", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustls-pki-types" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustversion" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a0d197bd2c9dc6e53b84da9556a69ba4cdfab8619eb41a8bd1cc2027a0f6b1d" + +[[package]] +name = "rusty-fork" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] + +[[package]] +name = "ryu" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28d3b2b1366ec20994f1fd18c3c594f05c5dd4bc44d8bb0c1c632c8d6829481f" + +[[package]] +name = "schannel" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f29ebaa345f945cec9fbbc532eb307f0fdad8161f281b6369539c8d84876b3d" +dependencies = [ + "windows-sys 0.59.0", +] + +[[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", + "serdect", + "subtle", + "zeroize", +] + +[[package]] +name = "secp256k1" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b50c5943d326858130af85e049f2661ba3c78b26589b8ab98e65e80ae44a1252" +dependencies = [ + "bitcoin_hashes", + "rand 0.8.5", + "secp256k1-sys", + "serde", +] + +[[package]] +name = "secp256k1-sys" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4387882333d3aa8cb20530a17c69a3752e97837832f34f6dccc760e715001d9" +dependencies = [ + "cc", +] + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "1.0.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6fa9c48d24d85fb3de5ad847117517440f6beceb7798af16b4a87d616b8d0" + +[[package]] +name = "semver-parser" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9900206b54a3527fdc7b8a938bffd94a568bac4f4aa8113b209df75a09c0dec2" +dependencies = [ + "pest", +] + +[[package]] +name = "serde" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.219" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "serde_json" +version = "1.0.140" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" +dependencies = [ + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "serde_with" +version = "3.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6b6f7f2fcb69f747921f79f3926bd1e203fce4fef62c268dd3abfb6d86029aa" +dependencies = [ + "base64", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.9.0", + "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 2.0.101", +] + +[[package]] +name = "serdect" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a84f14a19e9a014bb9f4512488d9829a68e04ecabffb0f9904cd1ace94598177" +dependencies = [ + "base16ct", + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest 0.10.7", + "keccak", +] + +[[package]] +name = "sha3-asm" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28efc5e327c837aa837c59eae585fc250715ef939ac32881bcc11677cd02d46" +dependencies = [ + "cc", + "cfg-if", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest 0.10.7", + "rand_core 0.6.4", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" +dependencies = [ + "serde", +] + +[[package]] +name = "socket2" +version = "0.5.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e22376abed350d73dd1cd119b57ffccad95b4e585a7cda43e286245ce23c0678" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "strum" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f64def088c51c9510a8579e3c5d67c65349dcf755e5479ad3d010aa6454e2c32" +dependencies = [ + "strum_macros", +] + +[[package]] +name = "strum_macros" +version = "0.27.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c77a8c5abcaf0f9ce05d62342b7d298c346515365c36b673df4ebe3ced01fde8" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "rustversion", + "syn 2.0.101", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.101" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn-solidity" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "14c8c8f496c33dc6343dac05b4be8d9e0bca180a4caa81d7b8416b10cc2273cd" +dependencies = [ + "paste", + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tempfile" +version = "3.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" +dependencies = [ + "fastrand", + "getrandom 0.3.3", + "once_cell", + "rustix", + "windows-sys 0.59.0", +] + +[[package]] +name = "thiserror" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + +[[package]] +name = "time" +version = "0.3.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" + +[[package]] +name = "time-macros" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tinystr" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d4f6d1145dcb577acf783d4e601bc1d76a13337bb54e6233add580b07344c8b" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tokio" +version = "1.45.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-macros" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", + "tokio-util", +] + +[[package]] +name = "tokio-util" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66a539a9ad6d5d281510d5bd368c973d636c02dbf8a67300bfb6b950696ad7df" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap 2.9.0", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tower" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adc82fd73de2a9722ac5da747f12383d2bfdb93591ee6c58486e0097890f05f2" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.41" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b1ffbcf9c6f6b99d386e7444eb608ba646ae452a36b39737deb9663b610f662" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "tracing-core" +version = "0.1.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tracing-futures" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97d095ae15e245a057c8e8451bab9b3ee1e1f68e9ba2b4fbc18d0ac5237835f2" +dependencies = [ + "futures", + "futures-task", + "pin-project", + "tracing", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typenum" +version = "1.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1dccffe3ce07af9386bfd29e80c0ab1a8205a2fc34e4bcd40364df902cfa8f3f" + +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + +[[package]] +name = "unicode-ident" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "url" +version = "2.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "valuable" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba73ea9cf16a25df0c8caa16c51acb937d5712a8429db78a3ee29d5dcacd3a65" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wait-timeout" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ac3b126d3914f9849036f826e054cbabdc8519970b8998ddaf3b5bd3c65f11" +dependencies = [ + "libc", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" +dependencies = [ + "bumpalo", + "log", + "proc-macro2", + "quote", + "syn 2.0.101", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.50" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "555d470ec0bc3bb57890405e5d4322cc9ea83cebb085523ced7be4144dac1e61" +dependencies = [ + "cfg-if", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.100" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasmtimer" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0048ad49a55b9deb3953841fa1fc5858f0efbcb7a18868c899a360269fac1b23" +dependencies = [ + "futures", + "js-sys", + "parking_lot", + "pin-utils", + "slab", + "wasm-bindgen", +] + +[[package]] +name = "web-sys" +version = "0.3.77" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33b6dd2ef9186f1f2072e409e99cd22a975331a6b3591b12c764e0e55c60d5d2" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "windows-core" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "windows-interface" +version = "0.59.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "windows-link" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" + +[[package]] +name = "windows-result" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "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.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags", +] + +[[package]] +name = "writeable" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea2f10b9bb0928dfb1b42b65e1f9e36f7f54dbdf08457afefb38afcdec4fa2bb" + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "yoke" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f41bb01b8226ef4bfd589436a297c53d118f65921786300e427be8d487695cc" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1702d9583232ddb9174e01bb7c15a2ab8fb1bc6f227aa1233858c351a3ba0cb" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "zerotrie" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36f0bbd478583f79edad978b407914f61b2972f5af6fa089686016be8f9af595" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a05eb080e015ba39cc9e23bbe5e7fb04d5fb040350f99f34e338d5fdd294428" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 00000000..78a29898 --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,12 @@ +[workspace] +members = ["crates/*"] +resolver = "2" + +[workspace.package] +edition = "2024" +version = "0.1.0" +license = "CAL-1.0" +homepage = "https://github.com/rainprotocol/rain.math.float" + +[workspace.dependencies] +alloy = { version = "1.0.9", features = ["sol-types", "json", "json-abi"] } diff --git a/crates/float/Cargo.toml b/crates/float/Cargo.toml new file mode 100644 index 00000000..c746eebc --- /dev/null +++ b/crates/float/Cargo.toml @@ -0,0 +1,7 @@ +[package] +name = "rain-math-float" +version.workspace = true +edition.workspace = true + +[dependencies] +alloy.workspace = true diff --git a/crates/float/src/main.rs b/crates/float/src/main.rs new file mode 100644 index 00000000..e7a11a96 --- /dev/null +++ b/crates/float/src/main.rs @@ -0,0 +1,3 @@ +fn main() { + println!("Hello, world!"); +} diff --git a/flake.lock b/flake.lock index 09614c3d..2c5fe29f 100644 --- a/flake.lock +++ b/flake.lock @@ -104,11 +104,11 @@ }, "nixpkgs_2": { "locked": { - "lastModified": 1747828570, - "narHash": "sha256-tv8R4Z/69GC8zogsb5TNDRj5tkhMeHpyYIzRl1cJigo=", + "lastModified": 1749104371, + "narHash": "sha256-m2NmOPd6XgBiskmUq/BS9Xxuf3z0ebnGVfSKNAO5NEM=", "owner": "nixos", "repo": "nixpkgs", - "rev": "040a62f13f40879a05578a66dd4ae0d284c55a5b", + "rev": "48975d7f9b9960ed33c4e8561bcce20cc0c2de5b", "type": "github" }, "original": { @@ -135,11 +135,11 @@ }, "nixpkgs_4": { "locked": { - "lastModified": 1731531548, - "narHash": "sha256-sz8/v17enkYmfpgeeuyzniGJU0QQBfmAjlemAUYhfy8=", + "lastModified": 1748662220, + "narHash": "sha256-7gGa49iB9nCnFk4h/g9zwjlQAyjtpgcFkODjcOQS0Es=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "24f0d4acd634792badd6470134c387a3b039dace", + "rev": "59138c7667b7970d205d6a05a8bfa2d78caa3643", "type": "github" }, "original": { @@ -158,11 +158,11 @@ "solc": "solc" }, "locked": { - "lastModified": 1748346550, - "narHash": "sha256-Rlaj/hHHACo0blFKane6/arqIXWUCGe/sCNgqX8VfZ8=", + "lastModified": 1749284231, + "narHash": "sha256-2pxLmguxgvcIaoCrxrrJaod+Sen/HjULnibdjogNp14=", "owner": "rainprotocol", "repo": "rainix", - "rev": "a1a5c321f356cb5006d16dd2d1a2242c183b7e96", + "rev": "f3ef7c9b21db154d6e57858aa2f59ce40e6677bb", "type": "github" }, "original": { @@ -182,11 +182,11 @@ "nixpkgs": "nixpkgs_3" }, "locked": { - "lastModified": 1747795013, - "narHash": "sha256-c7i0xJ+xFhgjO9SWHYu5dF/7lq63RPDvwKAdjc6VCE4=", + "lastModified": 1749091064, + "narHash": "sha256-TGtYjzRX0sueFhwYsnNNFF5TTKnpnloznpIghLzxeXo=", "owner": "oxalica", "repo": "rust-overlay", - "rev": "6b1cf12374361859242a562e1933a7930649131a", + "rev": "12419593ce78f2e8e1e89a373c6515885e218acb", "type": "github" }, "original": { @@ -202,11 +202,11 @@ "solc-macos-amd64-list-json": "solc-macos-amd64-list-json" }, "locked": { - "lastModified": 1742758229, - "narHash": "sha256-FrU9rhab/0vOjjeFoQF+Ej43zRLv3enUIYjgLrH3Gd8=", + "lastModified": 1748780655, + "narHash": "sha256-mradCdMvjXwKd7kVFACB/d1CP2LLCyEgUu4vJCSzNLU=", "owner": "hellwolf", "repo": "solc.nix", - "rev": "6885b61bac89da19a6e3c70b89fdd592e2cef884", + "rev": "3b6f3223ace5a7bc400b01a434d86bb1cb2593fb", "type": "github" }, "original": { From 87ee8ea4868a912741c534a9780c4c98aeb03918 Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Sun, 8 Jun 2025 11:48:19 +0400 Subject: [PATCH 02/28] update ci --- .github/workflows/rainix.yaml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/rainix.yaml b/.github/workflows/rainix.yaml index 86411aa3..a679af5b 100644 --- a/.github/workflows/rainix.yaml +++ b/.github/workflows/rainix.yaml @@ -6,7 +6,8 @@ jobs: strategy: matrix: os: [ubuntu-latest] - task: [rainix-sol-test, rainix-sol-static] + task: + [rainix-sol-test, rainix-sol-static, rainix-rs-test, rainix-rs-static] fail-fast: false runs-on: ${{ matrix.os }} env: @@ -29,19 +30,16 @@ jobs: primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} # if there's no cache hit, restore a cache by this prefix restore-prefixes-first-match: nix-${{ runner.os }}- - # collect garbage until the Nix store size (in bytes) is at most this number - # before trying to save a new cache - # 1G = 1073741824 gc-max-store-size-linux: 1G - name: Run ${{ matrix.task }} env: ETH_RPC_URL: ${{ secrets.CI_DEPLOY_SEPOLIA_RPC_URL || vars.CI_DEPLOY_SEPOLIA_RPC_URL }} ETHERSCAN_API_KEY: ${{ secrets.EXPLORER_VERIFICATION_KEY }} - DEPLOY_BROADCAST: '' - DEPLOY_VERIFIER: '' + DEPLOY_BROADCAST: "" + DEPLOY_VERIFIER: "" DEPLOY_METABOARD_ADDRESS: ${{ vars.CI_DEPLOY_SEPOLIA_METABOARD_ADDRESS }} CI_FORK_SEPOLIA_BLOCK_NUMBER: ${{ vars.CI_FORK_SEPOLIA_BLOCK_NUMBER }} CI_FORK_SEPOLIA_DEPLOYER_ADDRESS: ${{ vars.CI_FORK_SEPOLIA_DEPLOYER_ADDRESS }} CI_DEPLOY_SEPOLIA_RPC_URL: ${{ secrets.CI_DEPLOY_SEPOLIA_RPC_URL || vars.CI_DEPLOY_SEPOLIA_RPC_URL }} - run: nix develop -c ${{ matrix.task }} \ No newline at end of file + run: nix develop -c ${{ matrix.task }} From f87cde331839b9702971c993febf8748b72b154b Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Sun, 8 Jun 2025 11:49:26 +0400 Subject: [PATCH 03/28] add ci concurrency config --- .github/workflows/git-clean.yaml | 6 +++++- .github/workflows/rainix.yaml | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/git-clean.yaml b/.github/workflows/git-clean.yaml index 09870919..5bfcf75f 100644 --- a/.github/workflows/git-clean.yaml +++ b/.github/workflows/git-clean.yaml @@ -1,6 +1,10 @@ name: Git is clean on: [push] +concurrency: + group: ${{ github.ref }}-git-clean + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + jobs: git-clean: runs-on: ubuntu-latest @@ -34,4 +38,4 @@ jobs: - run: nix develop -c forge fmt # Check if the repo is clean after generating pointers and formatting. - - run: git diff --exit-code \ No newline at end of file + - run: git diff --exit-code diff --git a/.github/workflows/rainix.yaml b/.github/workflows/rainix.yaml index a679af5b..4e8a053b 100644 --- a/.github/workflows/rainix.yaml +++ b/.github/workflows/rainix.yaml @@ -1,6 +1,10 @@ name: Rainix CI on: [push] +concurrency: + group: ${{ github.ref }}-rainix + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} + jobs: rainix: strategy: From 01a54398ea0769f76564f0ee192818fbc0601cc4 Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Sun, 8 Jun 2025 12:08:06 +0400 Subject: [PATCH 04/28] --amend --- .github/workflows/git-clean.yaml | 3 --- 1 file changed, 3 deletions(-) diff --git a/.github/workflows/git-clean.yaml b/.github/workflows/git-clean.yaml index 5bfcf75f..2472c617 100644 --- a/.github/workflows/git-clean.yaml +++ b/.github/workflows/git-clean.yaml @@ -26,9 +26,6 @@ jobs: primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} # if there's no cache hit, restore a cache by this prefix restore-prefixes-first-match: nix-${{ runner.os }}- - # collect garbage until the Nix store size (in bytes) is at most this number - # before trying to save a new cache - # 1G = 1073741824 gc-max-store-size-linux: 1G - run: nix develop -c forge script ./script/BuildPointers.sol From 5966f9900840c0b26b89c8be3977c876776708e8 Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Mon, 9 Jun 2025 14:46:02 +0400 Subject: [PATCH 05/28] db wip --- .vscode/settings.json | 4 + Cargo.lock | 654 ++++++++++++++++++++++++++++++++++++++- Cargo.toml | 2 + crates/float/Cargo.toml | 2 + crates/float/src/lib.rs | 15 + crates/float/src/main.rs | 3 - 6 files changed, 674 insertions(+), 6 deletions(-) create mode 100644 .vscode/settings.json create mode 100644 crates/float/src/lib.rs delete mode 100644 crates/float/src/main.rs diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..7b95e511 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,4 @@ +{ + "solidity.compileUsingRemoteVersion": "v0.8.25+commit.b61c2a91", + "solidity.formatter": "forge" +} \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 39f1140f..f94fca1a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -17,6 +17,18 @@ version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" +[[package]] +name = "ahash" +version = "0.8.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a15f179cd60c4584b8a8c596927aadc462e27f2ca70c04e0071964a73ba7a75" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + [[package]] name = "allocator-api2" version = "0.2.21" @@ -176,6 +188,7 @@ checksum = "9d4769c6ffddca380b0070d71c8b7f30bed375543fe76bb2f74ec0acf4b7cd16" dependencies = [ "alloy-primitives", "alloy-rlp", + "k256", "serde", "thiserror", ] @@ -197,7 +210,7 @@ dependencies = [ "derive_more", "either", "serde", - "sha2", + "sha2 0.10.9", ] [[package]] @@ -618,6 +631,51 @@ dependencies = [ "libc", ] +[[package]] +name = "ark-bls12-381" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3df4dcc01ff89867cd86b0da835f23c3f02738353aaee7dde7495af71363b8d5" +dependencies = [ + "ark-ec", + "ark-ff 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", +] + +[[package]] +name = "ark-bn254" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d69eab57e8d2663efa5c63135b2af4f396d66424f88954c21104125ab6b3e6bc" +dependencies = [ + "ark-ec", + "ark-ff 0.5.0", + "ark-r1cs-std", + "ark-std 0.5.0", +] + +[[package]] +name = "ark-ec" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43d68f2d516162846c1238e755a7c4d131b892b70cc70c471a8e3ca3ed818fce" +dependencies = [ + "ahash", + "ark-ff 0.5.0", + "ark-poly", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "educe", + "fnv", + "hashbrown 0.15.4", + "itertools 0.13.0", + "num-bigint", + "num-integer", + "num-traits", + "zeroize", +] + [[package]] name = "ark-ff" version = "0.3.0" @@ -656,6 +714,26 @@ dependencies = [ "zeroize", ] +[[package]] +name = "ark-ff" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a177aba0ed1e0fbb62aa9f6d0502e9b46dad8c2eab04c14258a1212d2557ea70" +dependencies = [ + "ark-ff-asm 0.5.0", + "ark-ff-macros 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "arrayvec", + "digest 0.10.7", + "educe", + "itertools 0.13.0", + "num-bigint", + "num-traits", + "paste", + "zeroize", +] + [[package]] name = "ark-ff-asm" version = "0.3.0" @@ -676,6 +754,16 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ark-ff-asm" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" +dependencies = [ + "quote", + "syn 2.0.101", +] + [[package]] name = "ark-ff-macros" version = "0.3.0" @@ -701,6 +789,63 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "ark-ff-macros" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09be120733ee33f7693ceaa202ca41accd5653b779563608f1234f78ae07c4b3" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "ark-poly" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "579305839da207f02b89cd1679e50e67b4331e2f9294a57693e5051b7703fe27" +dependencies = [ + "ahash", + "ark-ff 0.5.0", + "ark-serialize 0.5.0", + "ark-std 0.5.0", + "educe", + "fnv", + "hashbrown 0.15.4", +] + +[[package]] +name = "ark-r1cs-std" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "941551ef1df4c7a401de7068758db6503598e6f01850bdb2cfdb614a1f9dbea1" +dependencies = [ + "ark-ec", + "ark-ff 0.5.0", + "ark-relations", + "ark-std 0.5.0", + "educe", + "num-bigint", + "num-integer", + "num-traits", + "tracing", +] + +[[package]] +name = "ark-relations" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec46ddc93e7af44bcab5230937635b06fb5744464dd6a7e7b083e80ebd274384" +dependencies = [ + "ark-ff 0.5.0", + "ark-std 0.5.0", + "tracing", + "tracing-subscriber", +] + [[package]] name = "ark-serialize" version = "0.3.0" @@ -722,6 +867,30 @@ dependencies = [ "num-bigint", ] +[[package]] +name = "ark-serialize" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f4d068aaf107ebcd7dfb52bc748f8030e0fc930ac8e360146ca54c1203088f7" +dependencies = [ + "ark-serialize-derive", + "ark-std 0.5.0", + "arrayvec", + "digest 0.10.7", + "num-bigint", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213888f660fddcca0d257e88e54ac05bca01885f258ccdf695bafd77031bb69d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + [[package]] name = "ark-std" version = "0.3.0" @@ -742,6 +911,22 @@ dependencies = [ "rand 0.8.5", ] +[[package]] +name = "ark-std" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "246a225cc6131e9ee4f24619af0f19d67761fff15d7ccc22e42b80846e69449a" +dependencies = [ + "num-traits", + "rand 0.8.5", +] + +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + [[package]] name = "arrayvec" version = "0.7.6" @@ -784,6 +969,16 @@ dependencies = [ "syn 2.0.101", ] +[[package]] +name = "aurora-engine-modexp" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "518bc5745a6264b5fd7b09dffb9667e400ee9e2bbe18555fac75e1fe9afa0df9" +dependencies = [ + "hex", + "num", +] + [[package]] name = "auto_impl" version = "1.3.0" @@ -870,6 +1065,9 @@ name = "bitflags" version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" +dependencies = [ + "serde", +] [[package]] name = "bitvec" @@ -879,10 +1077,20 @@ checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" dependencies = [ "funty", "radium", + "serde", "tap", "wyz", ] +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + [[package]] name = "block-buffer" version = "0.10.4" @@ -1167,6 +1375,17 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "derive-where" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e73f2692d4bd3cac41dca28934a39894200c9fabf49586d77d0e5954af1d7902" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + [[package]] name = "derive_more" version = "2.0.1" @@ -1203,7 +1422,7 @@ version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ - "block-buffer", + "block-buffer 0.10.4", "const-oid", "crypto-common", "subtle", @@ -1241,6 +1460,18 @@ dependencies = [ "spki", ] +[[package]] +name = "educe" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d7bc049e1bd8cdeb31b68bbd586a9464ecf9f3944af3958a7a9d0f8b9799417" +dependencies = [ + "enum-ordinalize", + "proc-macro2", + "quote", + "syn 2.0.101", +] + [[package]] name = "either" version = "1.15.0" @@ -1270,6 +1501,26 @@ dependencies = [ "zeroize", ] +[[package]] +name = "enum-ordinalize" +version = "4.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fea0dcfa4e54eeb516fe454635a95753ddd39acda650ce703031c6973e315dd5" +dependencies = [ + "enum-ordinalize-derive", +] + +[[package]] +name = "enum-ordinalize-derive" +version = "4.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.101", +] + [[package]] name = "equivalent" version = "1.0.2" @@ -1896,6 +2147,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.14.0" @@ -1932,7 +2192,7 @@ dependencies = [ "elliptic-curve", "once_cell", "serdect", - "sha2", + "sha2 0.10.9", ] [[package]] @@ -1972,6 +2232,52 @@ version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9fbbcab51052fe104eb5e5d351cf728d30a5be1fe14d9be8a3b097481fb97de" +[[package]] +name = "libsecp256k1" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79019718125edc905a079a70cfa5f3820bc76139fc91d6f9abc27ea2a887139" +dependencies = [ + "arrayref", + "base64", + "digest 0.9.0", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand 0.8.5", + "serde", + "sha2 0.9.9", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" +dependencies = [ + "libsecp256k1-core", +] + [[package]] name = "linux-raw-sys" version = "0.9.4" @@ -2069,6 +2375,20 @@ dependencies = [ "tempfile", ] +[[package]] +name = "num" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + [[package]] name = "num-bigint" version = "0.4.6" @@ -2079,6 +2399,15 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + [[package]] name = "num-conv" version = "0.1.0" @@ -2094,6 +2423,28 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + [[package]] name = "num-traits" version = "0.2.19" @@ -2129,6 +2480,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ + "proc-macro-crate", "proc-macro2", "quote", "syn 2.0.101", @@ -2162,6 +2514,12 @@ version = "1.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + [[package]] name = "openssl" version = "0.10.73" @@ -2206,6 +2564,18 @@ dependencies = [ "vcpkg", ] +[[package]] +name = "p256" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9863ad85fa8f4460f9c48cb909d38a0d689dba1f6f6988a5e3e0d31071bcd4b" +dependencies = [ + "ecdsa", + "elliptic-curve", + "primeorder", + "sha2 0.10.9", +] + [[package]] name = "parity-scale-codec" version = "3.7.5" @@ -2280,6 +2650,49 @@ dependencies = [ "ucd-trie", ] +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_macros", + "phf_shared", + "serde", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared", + "rand 0.8.5", +] + +[[package]] +name = "phf_macros" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.101", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + [[package]] name = "pin-project" version = "1.1.10" @@ -2352,6 +2765,15 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "primeorder" +version = "0.13.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "353e1ca18966c16d9deb1c69278edbc5f194139612772bd9537af60ac231e1e6" +dependencies = [ + "elliptic-curve", +] + [[package]] name = "primitive-types" version = "0.12.2" @@ -2455,6 +2877,8 @@ name = "rain-math-float" version = "0.1.0" dependencies = [ "alloy", + "lazy_static", + "revm", ] [[package]] @@ -2582,6 +3006,191 @@ dependencies = [ "web-sys", ] +[[package]] +name = "revm" +version = "25.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08fd78df29217546ddfd587fe313aff2bf86e57cfe0f18d16cb326d9f50ba54d" +dependencies = [ + "revm-bytecode", + "revm-context", + "revm-context-interface", + "revm-database", + "revm-database-interface", + "revm-handler", + "revm-inspector", + "revm-interpreter", + "revm-precompile", + "revm-primitives", + "revm-state", +] + +[[package]] +name = "revm-bytecode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "942fe4724cf552fd28db6b0a2ca5b79e884d40dd8288a4027ed1e9090e0c6f49" +dependencies = [ + "bitvec", + "once_cell", + "phf", + "revm-primitives", + "serde", +] + +[[package]] +name = "revm-context" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "190f211f04c8030f5393cfcfa1569b88d5649f0f266bf4291981ba879fa6c5d1" +dependencies = [ + "cfg-if", + "derive-where", + "revm-bytecode", + "revm-context-interface", + "revm-database-interface", + "revm-primitives", + "revm-state", + "serde", +] + +[[package]] +name = "revm-context-interface" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42b7e7ff1154e6460cec025fe20dfe45f3325bbb905718643b6d053ec49da6e8" +dependencies = [ + "alloy-eip2930", + "alloy-eip7702", + "auto_impl", + "either", + "revm-database-interface", + "revm-primitives", + "revm-state", + "serde", +] + +[[package]] +name = "revm-database" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9456d5cb165fef91c8b538d0115de50059d1cf352d160a1396894eac017a2a34" +dependencies = [ + "alloy-eips", + "revm-bytecode", + "revm-database-interface", + "revm-primitives", + "revm-state", + "serde", +] + +[[package]] +name = "revm-database-interface" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaeb608de31bfd0e64bf9b5b18ee70ac70094c8c045b28ae8ae8701608d17d34" +dependencies = [ + "auto_impl", + "revm-primitives", + "revm-state", + "serde", +] + +[[package]] +name = "revm-handler" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfeaecd909e6be655c36d21032ca932b347e60ec5849ee29e670d63aa97b6adb" +dependencies = [ + "auto_impl", + "revm-bytecode", + "revm-context", + "revm-context-interface", + "revm-database-interface", + "revm-interpreter", + "revm-precompile", + "revm-primitives", + "revm-state", + "serde", +] + +[[package]] +name = "revm-inspector" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4de1c6cddc7d62364dc9fa2f405c2c4637c933c5591addf09977ec8a156e4b23" +dependencies = [ + "auto_impl", + "revm-context", + "revm-database-interface", + "revm-handler", + "revm-interpreter", + "revm-primitives", + "revm-state", + "serde", + "serde_json", +] + +[[package]] +name = "revm-interpreter" +version = "21.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7c3ca670eee335d9268a9100932ec1e09638bdd9b31eac9e22dec4de00f2cba" +dependencies = [ + "revm-bytecode", + "revm-context-interface", + "revm-primitives", + "serde", +] + +[[package]] +name = "revm-precompile" +version = "22.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4330c6982a2ef1d318cb10ce7e726a64e11e44fe1eac29d055de849a5e1e080e" +dependencies = [ + "ark-bls12-381", + "ark-bn254", + "ark-ec", + "ark-ff 0.5.0", + "ark-serialize 0.5.0", + "aurora-engine-modexp", + "blst", + "c-kzg", + "cfg-if", + "k256", + "libsecp256k1", + "once_cell", + "p256", + "revm-primitives", + "ripemd", + "secp256k1", + "sha2 0.10.9", +] + +[[package]] +name = "revm-primitives" +version = "19.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c1588093530ec4442461163be49c433c07a3235d1ca6f6799fef338dacc50d3" +dependencies = [ + "alloy-primitives", + "num_enum", + "serde", +] + +[[package]] +name = "revm-state" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44320ccf53067136a83cdbc54f4b7529e8f61497666f31d6f5cfd9035a1cc08f" +dependencies = [ + "bitflags", + "revm-bytecode", + "revm-primitives", + "serde", +] + [[package]] name = "rfc6979" version = "0.4.0" @@ -2592,6 +3201,15 @@ dependencies = [ "subtle", ] +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.7", +] + [[package]] name = "rlp" version = "0.5.2" @@ -2841,6 +3459,7 @@ version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ + "indexmap 2.9.0", "itoa", "memchr", "ryu", @@ -2899,6 +3518,19 @@ dependencies = [ "serde", ] +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + [[package]] name = "sha2" version = "0.10.9" @@ -2946,6 +3578,12 @@ dependencies = [ "rand_core 0.6.4", ] +[[package]] +name = "siphasher" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "56199f7ddabf13fe5074ce809e7d3f42b42ae711800501b5b16ea82ad029c39d" + [[package]] name = "slab" version = "0.4.9" @@ -3335,6 +3973,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9d12581f227e93f094d3af2ae690a574abb8a2b9b7a96e7cfe9647b2b617678" dependencies = [ "once_cell", + "valuable", ] [[package]] @@ -3349,6 +3988,15 @@ dependencies = [ "tracing", ] +[[package]] +name = "tracing-subscriber" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +dependencies = [ + "tracing-core", +] + [[package]] name = "try-lock" version = "0.2.5" diff --git a/Cargo.toml b/Cargo.toml index 78a29898..43cbcc71 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,3 +10,5 @@ homepage = "https://github.com/rainprotocol/rain.math.float" [workspace.dependencies] alloy = { version = "1.0.9", features = ["sol-types", "json", "json-abi"] } +revm = "25.0.0" +lazy_static = "1.5.0" diff --git a/crates/float/Cargo.toml b/crates/float/Cargo.toml index c746eebc..d87298f4 100644 --- a/crates/float/Cargo.toml +++ b/crates/float/Cargo.toml @@ -5,3 +5,5 @@ edition.workspace = true [dependencies] alloy.workspace = true +revm.workspace = true +lazy_static.workspace = true diff --git a/crates/float/src/lib.rs b/crates/float/src/lib.rs new file mode 100644 index 00000000..267e7ba2 --- /dev/null +++ b/crates/float/src/lib.rs @@ -0,0 +1,15 @@ +use alloy::{primitives::FixedBytes, sol}; + +sol!( + #![sol(all_derives = true)] + DecimalFloat, + "../../out/DecimalFloat.sol/DecimalFloat.json" +); + +use DecimalFloat::Float as SolFloat; + +pub struct Float(FixedBytes<32>); + +// impl Float { +// pub async fn new +// } diff --git a/crates/float/src/main.rs b/crates/float/src/main.rs deleted file mode 100644 index e7a11a96..00000000 --- a/crates/float/src/main.rs +++ /dev/null @@ -1,3 +0,0 @@ -fn main() { - println!("Hello, world!"); -} From 22c181559285e55d6f63cac72407d077ef2ceb54 Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Mon, 9 Jun 2025 14:59:47 +0400 Subject: [PATCH 06/28] set up db --- crates/float/src/lib.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/crates/float/src/lib.rs b/crates/float/src/lib.rs index 267e7ba2..97d077a1 100644 --- a/crates/float/src/lib.rs +++ b/crates/float/src/lib.rs @@ -1,4 +1,7 @@ +use DecimalFloat::Float as SolFloat; use alloy::{primitives::FixedBytes, sol}; +use lazy_static::lazy_static; +use revm::{database::InMemoryDB, primitives::address}; sol!( #![sol(all_derives = true)] @@ -6,7 +9,18 @@ sol!( "../../out/DecimalFloat.sol/DecimalFloat.json" ); -use DecimalFloat::Float as SolFloat; +lazy_static! { + static ref DB: InMemoryDB = { + let mut db = InMemoryDB::default(); + let bytecode = revm::state::Bytecode::new_legacy(DecimalFloat::BYTECODE.clone()); + let account_info = revm::state::AccountInfo::default().with_code(bytecode); + db.insert_account_info( + address!("00000000000000000000000000000000000f10a2"), + account_info, + ); + db + }; +} pub struct Float(FixedBytes<32>); From ee2e1b3e526e0036ea93f5af71d3c174828906f7 Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Mon, 9 Jun 2025 16:35:59 +0400 Subject: [PATCH 07/28] fn parse --- Cargo.lock | 2 +- Cargo.toml | 2 +- crates/float/Cargo.toml | 2 +- crates/float/src/lib.rs | 87 +++++++++++++++++++++++++++++++++-------- 4 files changed, 74 insertions(+), 19 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index f94fca1a..50b823e3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2877,8 +2877,8 @@ name = "rain-math-float" version = "0.1.0" dependencies = [ "alloy", - "lazy_static", "revm", + "thiserror", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 43cbcc71..26d11662 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,4 +11,4 @@ homepage = "https://github.com/rainprotocol/rain.math.float" [workspace.dependencies] alloy = { version = "1.0.9", features = ["sol-types", "json", "json-abi"] } revm = "25.0.0" -lazy_static = "1.5.0" +thiserror = "2.0.12" diff --git a/crates/float/Cargo.toml b/crates/float/Cargo.toml index d87298f4..b27b0eda 100644 --- a/crates/float/Cargo.toml +++ b/crates/float/Cargo.toml @@ -6,4 +6,4 @@ edition.workspace = true [dependencies] alloy.workspace = true revm.workspace = true -lazy_static.workspace = true +thiserror.workspace = true diff --git a/crates/float/src/lib.rs b/crates/float/src/lib.rs index 97d077a1..7aef7398 100644 --- a/crates/float/src/lib.rs +++ b/crates/float/src/lib.rs @@ -1,7 +1,14 @@ use DecimalFloat::Float as SolFloat; -use alloy::{primitives::FixedBytes, sol}; -use lazy_static::lazy_static; -use revm::{database::InMemoryDB, primitives::address}; +use alloy::primitives::{Address, Bytes, FixedBytes}; +use alloy::sol_types::SolInterface; +use alloy::{sol, sol_types::SolCall}; +use revm::context::result::{ + EVMError, ExecutionResult, HaltReason, Output, ResultAndState, SuccessReason, +}; +use revm::database::InMemoryDB; +use revm::primitives::{address, fixed_bytes}; +use revm::{Context, MainBuilder, MainContext, SystemCallEvm}; +use thiserror::Error; sol!( #![sol(all_derives = true)] @@ -9,21 +16,69 @@ sol!( "../../out/DecimalFloat.sol/DecimalFloat.json" ); -lazy_static! { - static ref DB: InMemoryDB = { +const FLOAT_ADDRESS: Address = address!("00000000000000000000000000000000000f10a2"); + +#[derive(Debug, Error)] +pub enum FloatError { + #[error("EVM error: {0}")] + Evm(#[from] EVMError), + #[error("Float execution reverted with output: {0}")] + Revert(Bytes), + #[error("Float execution halted with reason: {0:?}")] + Halt(HaltReason), + #[error("Execution ended for non-return reason. Reason: {0:?}. Output: {1:?}")] + UnexpectedSuccess(SuccessReason, Output), + #[error(transparent)] + AlloySolTypes(#[from] alloy::sol_types::Error), + #[error("Decimal Float error: {0:?}")] + DecimalFloat(DecimalFloat::DecimalFloatErrors), +} + +pub struct Float(FixedBytes<32>); + +impl Float { + fn as_sol(&self) -> SolFloat { + let Float(bytes) = self; + SolFloat::from_underlying(*bytes) + } + + pub fn parse(str: String) -> Result { let mut db = InMemoryDB::default(); let bytecode = revm::state::Bytecode::new_legacy(DecimalFloat::BYTECODE.clone()); let account_info = revm::state::AccountInfo::default().with_code(bytecode); - db.insert_account_info( - address!("00000000000000000000000000000000000f10a2"), - account_info, - ); - db - }; -} + db.insert_account_info(FLOAT_ADDRESS, account_info); -pub struct Float(FixedBytes<32>); + let mut evm = Context::mainnet().with_db(db).build_mainnet(); + + let calldata = DecimalFloat::parseCall { str }.abi_encode(); + + let result_and_state = + evm.transact_system_call_finalize(FLOAT_ADDRESS, Bytes::from(calldata))?; + + match result_and_state.result { + ExecutionResult::Success { + reason: SuccessReason::Return, + output: Output::Call(output), + .. + } => { + let decoded = DecimalFloat::parseCall::abi_decode_returns(output.as_ref())?; -// impl Float { -// pub async fn new -// } + let error_selector = decoded._0; + let parsed_float = decoded._1; + + if error_selector != fixed_bytes!("00000000") { + let decoded_err = + DecimalFloat::DecimalFloatErrors::abi_decode(error_selector.as_slice())?; + return Err(FloatError::DecimalFloat(decoded_err)); + } + + Ok(Float(parsed_float)) + } + ExecutionResult::Success { reason, output, .. } => { + Err(FloatError::UnexpectedSuccess(reason, output)) + } + ExecutionResult::Revert { output, .. } => Err(FloatError::Revert(output)), + ExecutionResult::Halt { reason, .. } => Err(FloatError::Halt(reason)), + } + } +} From f13d5bca2fff7cc16a1ad2f34885ffd5fcabbe36 Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Mon, 9 Jun 2025 19:04:15 +0400 Subject: [PATCH 08/28] parse and format --- crates/float/src/lib.rs | 44 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/crates/float/src/lib.rs b/crates/float/src/lib.rs index 7aef7398..72faab2a 100644 --- a/crates/float/src/lib.rs +++ b/crates/float/src/lib.rs @@ -81,4 +81,48 @@ impl Float { ExecutionResult::Halt { reason, .. } => Err(FloatError::Halt(reason)), } } + + pub fn format(self) -> Result { + let mut db = InMemoryDB::default(); + let bytecode = revm::state::Bytecode::new_legacy(DecimalFloat::BYTECODE.clone()); + let account_info = revm::state::AccountInfo::default().with_code(bytecode); + db.insert_account_info(FLOAT_ADDRESS, account_info); + + let mut evm = Context::mainnet().with_db(db).build_mainnet(); + + let Float(a) = self; + let calldata = DecimalFloat::formatCall { a }.abi_encode(); + + let result_and_state = + evm.transact_system_call_finalize(FLOAT_ADDRESS, Bytes::from(calldata))?; + + match result_and_state.result { + ExecutionResult::Success { + reason: SuccessReason::Return, + output: Output::Call(output), + .. + } => { + let decoded = DecimalFloat::formatCall::abi_decode_returns(output.as_ref())?; + + Ok(decoded) + } + ExecutionResult::Success { reason, output, .. } => { + Err(FloatError::UnexpectedSuccess(reason, output)) + } + ExecutionResult::Revert { output, .. } => Err(FloatError::Revert(output)), + ExecutionResult::Halt { reason, .. } => Err(FloatError::Halt(reason)), + } + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn test_parse_and_float() { + let float = Float::parse("1.234567890".to_string()).unwrap(); + let string = float.format().unwrap(); + assert_eq!(string, "1.234567890"); + } } From b64c150f44d34e38ed705ad58ce2b3cd2af7daaa Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Mon, 9 Jun 2025 19:10:30 +0400 Subject: [PATCH 09/28] make tests pass --- crates/float/src/lib.rs | 39 +++++++++++++++++++++++++-------------- 1 file changed, 25 insertions(+), 14 deletions(-) diff --git a/crates/float/src/lib.rs b/crates/float/src/lib.rs index 72faab2a..6185a27c 100644 --- a/crates/float/src/lib.rs +++ b/crates/float/src/lib.rs @@ -5,7 +5,11 @@ use alloy::{sol, sol_types::SolCall}; use revm::context::result::{ EVMError, ExecutionResult, HaltReason, Output, ResultAndState, SuccessReason, }; +use revm::context::{BlockEnv, CfgEnv, Evm, TxEnv}; use revm::database::InMemoryDB; +use revm::handler::EthPrecompiles; +use revm::handler::instructions::EthInstructions; +use revm::interpreter::interpreter::EthInterpreter; use revm::primitives::{address, fixed_bytes}; use revm::{Context, MainBuilder, MainContext, SystemCallEvm}; use thiserror::Error; @@ -19,7 +23,7 @@ sol!( const FLOAT_ADDRESS: Address = address!("00000000000000000000000000000000000f10a2"); #[derive(Debug, Error)] -pub enum FloatError { +pub enum CalculatorError { #[error("EVM error: {0}")] Evm(#[from] EVMError), #[error("Float execution reverted with output: {0}")] @@ -34,6 +38,13 @@ pub enum FloatError { DecimalFloat(DecimalFloat::DecimalFloatErrors), } +// type EvmContext = Context; +// struct Calculator(Evm, EthPrecompiles>); + +// impl Calculator { +// fn new() -> Result {} +// } + pub struct Float(FixedBytes<32>); impl Float { @@ -42,9 +53,9 @@ impl Float { SolFloat::from_underlying(*bytes) } - pub fn parse(str: String) -> Result { + pub fn parse(str: String) -> Result { let mut db = InMemoryDB::default(); - let bytecode = revm::state::Bytecode::new_legacy(DecimalFloat::BYTECODE.clone()); + let bytecode = revm::state::Bytecode::new_legacy(DecimalFloat::DEPLOYED_BYTECODE.clone()); let account_info = revm::state::AccountInfo::default().with_code(bytecode); db.insert_account_info(FLOAT_ADDRESS, account_info); @@ -69,22 +80,22 @@ impl Float { if error_selector != fixed_bytes!("00000000") { let decoded_err = DecimalFloat::DecimalFloatErrors::abi_decode(error_selector.as_slice())?; - return Err(FloatError::DecimalFloat(decoded_err)); + return Err(CalculatorError::DecimalFloat(decoded_err)); } Ok(Float(parsed_float)) } ExecutionResult::Success { reason, output, .. } => { - Err(FloatError::UnexpectedSuccess(reason, output)) + Err(CalculatorError::UnexpectedSuccess(reason, output)) } - ExecutionResult::Revert { output, .. } => Err(FloatError::Revert(output)), - ExecutionResult::Halt { reason, .. } => Err(FloatError::Halt(reason)), + ExecutionResult::Revert { output, .. } => Err(CalculatorError::Revert(output)), + ExecutionResult::Halt { reason, .. } => Err(CalculatorError::Halt(reason)), } } - pub fn format(self) -> Result { + pub fn format(self) -> Result { let mut db = InMemoryDB::default(); - let bytecode = revm::state::Bytecode::new_legacy(DecimalFloat::BYTECODE.clone()); + let bytecode = revm::state::Bytecode::new_legacy(DecimalFloat::DEPLOYED_BYTECODE.clone()); let account_info = revm::state::AccountInfo::default().with_code(bytecode); db.insert_account_info(FLOAT_ADDRESS, account_info); @@ -107,10 +118,10 @@ impl Float { Ok(decoded) } ExecutionResult::Success { reason, output, .. } => { - Err(FloatError::UnexpectedSuccess(reason, output)) + Err(CalculatorError::UnexpectedSuccess(reason, output)) } - ExecutionResult::Revert { output, .. } => Err(FloatError::Revert(output)), - ExecutionResult::Halt { reason, .. } => Err(FloatError::Halt(reason)), + ExecutionResult::Revert { output, .. } => Err(CalculatorError::Revert(output)), + ExecutionResult::Halt { reason, .. } => Err(CalculatorError::Halt(reason)), } } } @@ -121,8 +132,8 @@ mod tests { #[test] fn test_parse_and_float() { - let float = Float::parse("1.234567890".to_string()).unwrap(); + let float = Float::parse("1.23456789".to_string()).unwrap(); let string = float.format().unwrap(); - assert_eq!(string, "1.234567890"); + assert_eq!(string, "1.23456789"); } } From b897ac77074b31c04fcb4dca15b692fda9b6192f Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Mon, 9 Jun 2025 19:31:21 +0400 Subject: [PATCH 10/28] calculator --- crates/float/src/lib.rs | 45 +++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/crates/float/src/lib.rs b/crates/float/src/lib.rs index 6185a27c..4b987404 100644 --- a/crates/float/src/lib.rs +++ b/crates/float/src/lib.rs @@ -1,10 +1,7 @@ -use DecimalFloat::Float as SolFloat; use alloy::primitives::{Address, Bytes, FixedBytes}; use alloy::sol_types::SolInterface; use alloy::{sol, sol_types::SolCall}; -use revm::context::result::{ - EVMError, ExecutionResult, HaltReason, Output, ResultAndState, SuccessReason, -}; +use revm::context::result::{EVMError, ExecutionResult, HaltReason, Output, SuccessReason}; use revm::context::{BlockEnv, CfgEnv, Evm, TxEnv}; use revm::database::InMemoryDB; use revm::handler::EthPrecompiles; @@ -38,33 +35,31 @@ pub enum CalculatorError { DecimalFloat(DecimalFloat::DecimalFloatErrors), } -// type EvmContext = Context; -// struct Calculator(Evm, EthPrecompiles>); - -// impl Calculator { -// fn new() -> Result {} -// } +type EvmContext = Context; +pub struct Calculator { + evm: Evm, EthPrecompiles>, +} pub struct Float(FixedBytes<32>); -impl Float { - fn as_sol(&self) -> SolFloat { - let Float(bytes) = self; - SolFloat::from_underlying(*bytes) - } - - pub fn parse(str: String) -> Result { +impl Calculator { + pub fn new() -> Result { let mut db = InMemoryDB::default(); let bytecode = revm::state::Bytecode::new_legacy(DecimalFloat::DEPLOYED_BYTECODE.clone()); let account_info = revm::state::AccountInfo::default().with_code(bytecode); db.insert_account_info(FLOAT_ADDRESS, account_info); - let mut evm = Context::mainnet().with_db(db).build_mainnet(); + let evm = Context::mainnet().with_db(db).build_mainnet(); + Ok(Calculator { evm }) + } + + pub fn parse(&mut self, str: String) -> Result { let calldata = DecimalFloat::parseCall { str }.abi_encode(); - let result_and_state = - evm.transact_system_call_finalize(FLOAT_ADDRESS, Bytes::from(calldata))?; + let result_and_state = self + .evm + .transact_system_call_finalize(FLOAT_ADDRESS, Bytes::from(calldata))?; match result_and_state.result { ExecutionResult::Success { @@ -93,7 +88,7 @@ impl Float { } } - pub fn format(self) -> Result { + pub fn format(&mut self, float: Float) -> Result { let mut db = InMemoryDB::default(); let bytecode = revm::state::Bytecode::new_legacy(DecimalFloat::DEPLOYED_BYTECODE.clone()); let account_info = revm::state::AccountInfo::default().with_code(bytecode); @@ -101,7 +96,7 @@ impl Float { let mut evm = Context::mainnet().with_db(db).build_mainnet(); - let Float(a) = self; + let Float(a) = float; let calldata = DecimalFloat::formatCall { a }.abi_encode(); let result_and_state = @@ -132,8 +127,10 @@ mod tests { #[test] fn test_parse_and_float() { - let float = Float::parse("1.23456789".to_string()).unwrap(); - let string = float.format().unwrap(); + let mut calculator = Calculator::new().unwrap(); + + let float = calculator.parse("1.23456789".to_string()).unwrap(); + let string = calculator.format(float).unwrap(); assert_eq!(string, "1.23456789"); } } From 71b2dd68ec5b6376c2d912a03b774631cab5eacd Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Mon, 9 Jun 2025 19:49:20 +0400 Subject: [PATCH 11/28] refactor duplicated code with execute_call --- crates/float/src/lib.rs | 75 ++++++++++++++++++----------------------- 1 file changed, 32 insertions(+), 43 deletions(-) diff --git a/crates/float/src/lib.rs b/crates/float/src/lib.rs index 4b987404..c3ed1a83 100644 --- a/crates/float/src/lib.rs +++ b/crates/float/src/lib.rs @@ -54,32 +54,24 @@ impl Calculator { Ok(Calculator { evm }) } - pub fn parse(&mut self, str: String) -> Result { - let calldata = DecimalFloat::parseCall { str }.abi_encode(); - + fn execute_call( + &mut self, + calldata: Bytes, + process_output: F, + ) -> Result + where + F: FnOnce(Bytes) -> Result, + { let result_and_state = self .evm - .transact_system_call_finalize(FLOAT_ADDRESS, Bytes::from(calldata))?; + .transact_system_call_finalize(FLOAT_ADDRESS, calldata)?; match result_and_state.result { ExecutionResult::Success { reason: SuccessReason::Return, output: Output::Call(output), .. - } => { - let decoded = DecimalFloat::parseCall::abi_decode_returns(output.as_ref())?; - - let error_selector = decoded._0; - let parsed_float = decoded._1; - - if error_selector != fixed_bytes!("00000000") { - let decoded_err = - DecimalFloat::DecimalFloatErrors::abi_decode(error_selector.as_slice())?; - return Err(CalculatorError::DecimalFloat(decoded_err)); - } - - Ok(Float(parsed_float)) - } + } => process_output(output), ExecutionResult::Success { reason, output, .. } => { Err(CalculatorError::UnexpectedSuccess(reason, output)) } @@ -88,36 +80,33 @@ impl Calculator { } } - pub fn format(&mut self, float: Float) -> Result { - let mut db = InMemoryDB::default(); - let bytecode = revm::state::Bytecode::new_legacy(DecimalFloat::DEPLOYED_BYTECODE.clone()); - let account_info = revm::state::AccountInfo::default().with_code(bytecode); - db.insert_account_info(FLOAT_ADDRESS, account_info); + pub fn parse(&mut self, str: String) -> Result { + let calldata = DecimalFloat::parseCall { str }.abi_encode(); - let mut evm = Context::mainnet().with_db(db).build_mainnet(); + self.execute_call(Bytes::from(calldata), |output| { + let DecimalFloat::parseReturn { + _0: error_selector, + _1: parsed_float, + } = DecimalFloat::parseCall::abi_decode_returns(output.as_ref())?; - let Float(a) = float; - let calldata = DecimalFloat::formatCall { a }.abi_encode(); + if error_selector != fixed_bytes!("00000000") { + let decoded_err = + DecimalFloat::DecimalFloatErrors::abi_decode(error_selector.as_slice())?; + return Err(CalculatorError::DecimalFloat(decoded_err)); + } - let result_and_state = - evm.transact_system_call_finalize(FLOAT_ADDRESS, Bytes::from(calldata))?; + Ok(Float(parsed_float)) + }) + } - match result_and_state.result { - ExecutionResult::Success { - reason: SuccessReason::Return, - output: Output::Call(output), - .. - } => { - let decoded = DecimalFloat::formatCall::abi_decode_returns(output.as_ref())?; + pub fn format(&mut self, float: Float) -> Result { + let Float(a) = float; + let calldata = DecimalFloat::formatCall { a }.abi_encode(); - Ok(decoded) - } - ExecutionResult::Success { reason, output, .. } => { - Err(CalculatorError::UnexpectedSuccess(reason, output)) - } - ExecutionResult::Revert { output, .. } => Err(CalculatorError::Revert(output)), - ExecutionResult::Halt { reason, .. } => Err(CalculatorError::Halt(reason)), - } + self.execute_call(Bytes::from(calldata), |output| { + let decoded = DecimalFloat::formatCall::abi_decode_returns(output.as_ref())?; + Ok(decoded) + }) } } From 1db9614a6586556ecec0bb6744a44d791f8c2abb Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Tue, 10 Jun 2025 11:53:42 +0400 Subject: [PATCH 12/28] proptest --- .cargo/config.toml | 3 +++ Cargo.lock | 5 +++-- Cargo.toml | 1 + crates/float/Cargo.toml | 3 +++ crates/float/src/lib.rs | 39 +++++++++++++++++++++++++++++++++++++ src/lib/LibDecimalFloat.sol | 2 +- 6 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 00000000..0c6c27f8 --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,3 @@ +[target.wasm32-unknown-unknown] +# Required to make the rand feature of alloy work for wasm32-unknown-unknown +rustflags = ["--cfg", "getrandom_backend=\"wasm_js\""] diff --git a/Cargo.lock b/Cargo.lock index 50b823e3..1962a613 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -59,9 +59,9 @@ dependencies = [ [[package]] name = "alloy-chains" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6967ca1ed656766e471bc323da42fb0db320ca5e1418b408650e98e4757b3d2" +checksum = "19a9cc9d81ace3da457883b0bdf76776e55f1b84219a9e9d55c27ad308548d3f" dependencies = [ "alloy-primitives", "num_enum", @@ -2877,6 +2877,7 @@ name = "rain-math-float" version = "0.1.0" dependencies = [ "alloy", + "proptest", "revm", "thiserror", ] diff --git a/Cargo.toml b/Cargo.toml index 26d11662..bc66d622 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,3 +12,4 @@ homepage = "https://github.com/rainprotocol/rain.math.float" alloy = { version = "1.0.9", features = ["sol-types", "json", "json-abi"] } revm = "25.0.0" thiserror = "2.0.12" +proptest = "1.7.0" diff --git a/crates/float/Cargo.toml b/crates/float/Cargo.toml index b27b0eda..434dc18f 100644 --- a/crates/float/Cargo.toml +++ b/crates/float/Cargo.toml @@ -7,3 +7,6 @@ edition.workspace = true alloy.workspace = true revm.workspace = true thiserror.workspace = true + +[dev-dependencies] +proptest.workspace = true diff --git a/crates/float/src/lib.rs b/crates/float/src/lib.rs index c3ed1a83..54dcf26b 100644 --- a/crates/float/src/lib.rs +++ b/crates/float/src/lib.rs @@ -9,6 +9,7 @@ use revm::handler::instructions::EthInstructions; use revm::interpreter::interpreter::EthInterpreter; use revm::primitives::{address, fixed_bytes}; use revm::{Context, MainBuilder, MainContext, SystemCallEvm}; +use std::fmt; use thiserror::Error; sol!( @@ -40,8 +41,15 @@ pub struct Calculator { evm: Evm, EthPrecompiles>, } +#[derive(Copy, Clone)] pub struct Float(FixedBytes<32>); +impl fmt::Debug for Float { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + f.debug_tuple("Float").field(&self.0).finish() + } +} + impl Calculator { pub fn new() -> Result { let mut db = InMemoryDB::default(); @@ -113,6 +121,26 @@ impl Calculator { #[cfg(test)] mod tests { use super::*; + use proptest::prelude::*; + + prop_compose! { + fn valid_float()( + int_part in -1_000_000_000_000_000_000_i128..1_000_000_000_000_000_000_i128, + decimal_places in 0u8..18u8, + decimal_part in 0u64..1_000_000_000_000_000_000u64 + ) -> Float { + let mut calculator = Calculator::new().unwrap(); + + let num_str = if decimal_places == 0 { + format!("{int_part}") + } else { + let decimal_str = format!("{decimal_part:0width$}", width = decimal_places as usize); + format!("{int_part}.{decimal_str}") + }; + + calculator.parse(num_str).unwrap() + } + } #[test] fn test_parse_and_float() { @@ -122,4 +150,15 @@ mod tests { let string = calculator.format(float).unwrap(); assert_eq!(string, "1.23456789"); } + + proptest! { + #[test] + fn test_parse_format_property(float in valid_float()) { + let mut calculator = Calculator::new().unwrap(); + + let formatted = calculator.format(float.clone()).unwrap(); + let parsed = calculator.parse(formatted.clone()).unwrap(); + prop_assert_eq!(float.0, parsed.0); + } + } } diff --git a/src/lib/LibDecimalFloat.sol b/src/lib/LibDecimalFloat.sol index 69e4f22b..c3cdb7b5 100644 --- a/src/lib/LibDecimalFloat.sol +++ b/src/lib/LibDecimalFloat.sol @@ -71,7 +71,7 @@ int256 constant EXPONENT_LEAP_MULTIPLIER = int256(uint256(10 ** uint256(EXPONENT /// One use case for this number system is representing ratios of tokens that /// have both large differences in their decimals and unit value. For example, /// at the time of writing, 1 SHIB is worth about 2.7e-10 BTC while the -/// WTBC contract only supports 8 decimals vs. SHIB's 18 decimals. It's literally +/// WBTC contract only supports 8 decimals vs. SHIB's 18 decimals. It's literally /// not possible to represent a purchase of 1 SHIB (1e18) worth of WBTC, so it's /// easy to see how a fixed point decimal system could accidentally round /// something down to `0` or up to `1` or similarly bad precision loss, simply From ef69abed6dc833791dbee0786fe0cb368a9c8a58 Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Tue, 10 Jun 2025 13:04:09 +0400 Subject: [PATCH 13/28] add & sub --- crates/float/proptest-regressions/lib.txt | 7 +++ crates/float/src/lib.rs | 59 +++++++++++++++++++++-- 2 files changed, 63 insertions(+), 3 deletions(-) create mode 100644 crates/float/proptest-regressions/lib.txt diff --git a/crates/float/proptest-regressions/lib.txt b/crates/float/proptest-regressions/lib.txt new file mode 100644 index 00000000..70d20bf9 --- /dev/null +++ b/crates/float/proptest-regressions/lib.txt @@ -0,0 +1,7 @@ +# Seeds for failure cases proptest has generated in the past. It is +# automatically read and these particular cases re-run before any +# novel cases are generated. +# +# It is recommended to check this file in to source control so that +# everyone who runs the test benefits from these saved cases. +cc 664cbb4a3416dcc12fe1196bdf33bdf3f9e1403c6446f0516dc704da23be5723 # shrinks to a = Float(0x0000000000000000000000000000000000000000000000000000000000000000), b = Float(0xffffffff00000000000000000000000000000000000000000000000000000001) diff --git a/crates/float/src/lib.rs b/crates/float/src/lib.rs index 54dcf26b..62419433 100644 --- a/crates/float/src/lib.rs +++ b/crates/float/src/lib.rs @@ -41,7 +41,7 @@ pub struct Calculator { evm: Evm, EthPrecompiles>, } -#[derive(Copy, Clone)] +#[derive(Copy, Clone, PartialEq)] pub struct Float(FixedBytes<32>); impl fmt::Debug for Float { @@ -116,6 +116,28 @@ impl Calculator { Ok(decoded) }) } + + pub fn add(&mut self, a: Float, b: Float) -> Result { + let Float(a) = a; + let Float(b) = b; + let calldata = DecimalFloat::addCall { a, b }.abi_encode(); + + self.execute_call(Bytes::from(calldata), |output| { + let decoded = DecimalFloat::addCall::abi_decode_returns(output.as_ref())?; + Ok(Float(decoded)) + }) + } + + pub fn sub(&mut self, a: Float, b: Float) -> Result { + let Float(a) = a; + let Float(b) = b; + let calldata = DecimalFloat::subCall { a, b }.abi_encode(); + + self.execute_call(Bytes::from(calldata), |output| { + let decoded = DecimalFloat::subCall::abi_decode_returns(output.as_ref())?; + Ok(Float(decoded)) + }) + } } #[cfg(test)] @@ -143,7 +165,7 @@ mod tests { } #[test] - fn test_parse_and_float() { + fn test_parse_and_format() { let mut calculator = Calculator::new().unwrap(); let float = calculator.parse("1.23456789".to_string()).unwrap(); @@ -153,7 +175,7 @@ mod tests { proptest! { #[test] - fn test_parse_format_property(float in valid_float()) { + fn test_parse_format(float in valid_float()) { let mut calculator = Calculator::new().unwrap(); let formatted = calculator.format(float.clone()).unwrap(); @@ -161,4 +183,35 @@ mod tests { prop_assert_eq!(float.0, parsed.0); } } + + proptest! { + #[test] + fn test_add(a in valid_float(), b in valid_float()) { + let mut calculator = Calculator::new().unwrap(); + + calculator.add(a.clone(), b.clone()).unwrap(); + } + + #[test] + fn test_sub(a in valid_float(), b in valid_float()) { + let mut calculator = Calculator::new().unwrap(); + + calculator.sub(a.clone(), b.clone()).unwrap(); + } + + #[test] + fn test_add_sub(a in valid_float(), b in valid_float()) { + let mut calculator = Calculator::new().unwrap(); + + let sum = calculator.add(a.clone(), b.clone()).unwrap(); + let diff = calculator.sub(sum, b.clone()).unwrap(); + prop_assert_eq!( + calculator.format(a).unwrap(), + calculator.format(diff).unwrap(), + "a: {}, b: {}", + calculator.format(a).unwrap(), + calculator.format(b).unwrap(), + ); + } + } } From 7058f38ee3a8b259fece3118a3d1292a86e04df2 Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Tue, 10 Jun 2025 13:07:10 +0400 Subject: [PATCH 14/28] decode revert --- crates/float/src/lib.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/float/src/lib.rs b/crates/float/src/lib.rs index 62419433..a1bca313 100644 --- a/crates/float/src/lib.rs +++ b/crates/float/src/lib.rs @@ -83,7 +83,13 @@ impl Calculator { ExecutionResult::Success { reason, output, .. } => { Err(CalculatorError::UnexpectedSuccess(reason, output)) } - ExecutionResult::Revert { output, .. } => Err(CalculatorError::Revert(output)), + ExecutionResult::Revert { output, .. } => { + if let Ok(error) = DecimalFloat::DecimalFloatErrors::abi_decode(output.as_ref()) { + return Err(CalculatorError::DecimalFloat(error)); + } + + Err(CalculatorError::Revert(output)) + } ExecutionResult::Halt { reason, .. } => Err(CalculatorError::Halt(reason)), } } @@ -98,6 +104,7 @@ impl Calculator { } = DecimalFloat::parseCall::abi_decode_returns(output.as_ref())?; if error_selector != fixed_bytes!("00000000") { + // TODO: trying to decode selector as error is incorrect. this needs fixing let decoded_err = DecimalFloat::DecimalFloatErrors::abi_decode(error_selector.as_slice())?; return Err(CalculatorError::DecimalFloat(decoded_err)); From 6097c4315b0d5e1f96f8c6b3ea020bf67e611512 Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Wed, 11 Jun 2025 12:27:39 +0400 Subject: [PATCH 15/28] test edge cases --- Cargo.lock | 110 +++++++++++++++++++++------------------- Cargo.toml | 2 +- crates/float/Cargo.toml | 3 ++ crates/float/src/lib.rs | 89 ++++++++++++++++++++++++++++---- 4 files changed, 141 insertions(+), 63 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1962a613..da0999ec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,9 +13,9 @@ dependencies = [ [[package]] name = "adler2" -version = "2.0.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" [[package]] name = "ahash" @@ -46,6 +46,7 @@ dependencies = [ "alloy-core", "alloy-eips", "alloy-genesis", + "alloy-json-rpc", "alloy-network", "alloy-provider", "alloy-rpc-client", @@ -376,7 +377,7 @@ checksum = "64b728d511962dda67c1bc7ea7c03736ec275ed2cf4c35d9585298ac9ccf3b73" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -500,7 +501,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -517,7 +518,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", "syn-solidity", "tiny-keccak", ] @@ -536,7 +537,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.101", + "syn 2.0.102", "syn-solidity", ] @@ -761,7 +762,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" dependencies = [ "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -799,7 +800,7 @@ dependencies = [ "num-traits", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -888,7 +889,7 @@ checksum = "213888f660fddcca0d257e88e54ac05bca01885f258ccdf695bafd77031bb69d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -955,7 +956,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -966,7 +967,7 @@ checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -987,7 +988,7 @@ checksum = "ffdcb70bdbc4d478427380519163274ac86e52916e10f0a8889adf0f96d3fee7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -1165,9 +1166,9 @@ dependencies = [ [[package]] name = "cfg-if" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" +checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" [[package]] name = "chrono" @@ -1316,7 +1317,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -1327,7 +1328,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ "darling_core", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -1383,7 +1384,7 @@ checksum = "e73f2692d4bd3cac41dca28934a39894200c9fabf49586d77d0e5954af1d7902" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -1403,7 +1404,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", "unicode-xid", ] @@ -1436,7 +1437,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -1469,7 +1470,7 @@ dependencies = [ "enum-ordinalize", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -1518,7 +1519,7 @@ checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -1685,7 +1686,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -1742,8 +1743,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi 0.11.0+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -2097,7 +2100,7 @@ checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -2323,7 +2326,7 @@ checksum = "1b27834086c65ec3f9387b096d66e99f221cf081c2b738042aa252bcd41204e3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -2340,9 +2343,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" -version = "0.8.8" +version = "0.8.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" dependencies = [ "adler2", ] @@ -2483,7 +2486,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -2543,7 +2546,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -2601,7 +2604,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -2681,7 +2684,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -2710,7 +2713,7 @@ checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -2813,7 +2816,7 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -2877,6 +2880,7 @@ name = "rain-math-float" version = "0.1.0" dependencies = [ "alloy", + "getrandom 0.2.16", "proptest", "revm", "thiserror", @@ -3256,9 +3260,9 @@ checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" [[package]] name = "rustc-demangle" -version = "0.1.24" +version = "0.1.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" [[package]] name = "rustc-hash" @@ -3451,7 +3455,7 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -3506,7 +3510,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -3660,7 +3664,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -3682,9 +3686,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.101" +version = "2.0.102" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ce2b7fc941b3a24138a0a7cf8e858bfc6a992e7978a068a5c760deb0ed43caf" +checksum = "f6397daf94fa90f058bd0fd88429dd9e5738999cca8d701813c80723add80462" dependencies = [ "proc-macro2", "quote", @@ -3700,7 +3704,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -3720,7 +3724,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -3759,7 +3763,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -3845,7 +3849,7 @@ checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -3964,7 +3968,7 @@ checksum = "1b1ffbcf9c6f6b99d386e7444eb608ba646ae452a36b39737deb9663b610f662" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -4136,7 +4140,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", "wasm-bindgen-shared", ] @@ -4171,7 +4175,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4230,7 +4234,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -4241,7 +4245,7 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -4403,7 +4407,7 @@ checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", "synstructure", ] @@ -4424,7 +4428,7 @@ checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -4444,7 +4448,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", "synstructure", ] @@ -4465,7 +4469,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] [[package]] @@ -4498,5 +4502,5 @@ checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.101", + "syn 2.0.102", ] diff --git a/Cargo.toml b/Cargo.toml index bc66d622..48eb7988 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ license = "CAL-1.0" homepage = "https://github.com/rainprotocol/rain.math.float" [workspace.dependencies] -alloy = { version = "1.0.9", features = ["sol-types", "json", "json-abi"] } +alloy = { version = "1.0.9", features = ["sol-types", "json-rpc"] } revm = "25.0.0" thiserror = "2.0.12" proptest = "1.7.0" diff --git a/crates/float/Cargo.toml b/crates/float/Cargo.toml index 434dc18f..fe1ad3eb 100644 --- a/crates/float/Cargo.toml +++ b/crates/float/Cargo.toml @@ -8,5 +8,8 @@ alloy.workspace = true revm.workspace = true thiserror.workspace = true +[target.'cfg(target_family = "wasm")'.dependencies] +getrandom = { version = "0.2.11", features = ["js", "js-sys"] } + [dev-dependencies] proptest.workspace = true diff --git a/crates/float/src/lib.rs b/crates/float/src/lib.rs index a1bca313..c655f006 100644 --- a/crates/float/src/lib.rs +++ b/crates/float/src/lib.rs @@ -18,6 +18,8 @@ sol!( "../../out/DecimalFloat.sol/DecimalFloat.json" ); +use DecimalFloat::DecimalFloatErrors; + const FLOAT_ADDRESS: Address = address!("00000000000000000000000000000000000f10a2"); #[derive(Debug, Error)] @@ -33,7 +35,20 @@ pub enum CalculatorError { #[error(transparent)] AlloySolTypes(#[from] alloy::sol_types::Error), #[error("Decimal Float error: {0:?}")] - DecimalFloat(DecimalFloat::DecimalFloatErrors), + DecimalFloat(DecimalFloatErrors), + #[error("Decimal Float error selector: {0:?}")] + DecimalFloatSelector(Result>), +} + +#[derive(Debug)] +pub enum DecimalFloatErrorSelector { + CoefficientOverflow, + ExponentOverflow, + Log10Negative, + Log10Zero, + LossyConversionFromFloat, + NegativeFixedDecimalConversion, + WithTargetExponentOverflow, } type EvmContext = Context; @@ -104,10 +119,33 @@ impl Calculator { } = DecimalFloat::parseCall::abi_decode_returns(output.as_ref())?; if error_selector != fixed_bytes!("00000000") { - // TODO: trying to decode selector as error is incorrect. this needs fixing - let decoded_err = - DecimalFloat::DecimalFloatErrors::abi_decode(error_selector.as_slice())?; - return Err(CalculatorError::DecimalFloat(decoded_err)); + let FixedBytes(bytes) = error_selector; + let selector = match bytes { + ::SELECTOR => { + Ok(DecimalFloatErrorSelector::CoefficientOverflow) + } + ::SELECTOR => { + Ok(DecimalFloatErrorSelector::ExponentOverflow) + } + ::SELECTOR => { + Ok(DecimalFloatErrorSelector::Log10Negative) + } + ::SELECTOR => { + Ok(DecimalFloatErrorSelector::Log10Zero) + } + ::SELECTOR => { + Ok(DecimalFloatErrorSelector::LossyConversionFromFloat) + } + ::SELECTOR => { + Ok(DecimalFloatErrorSelector::NegativeFixedDecimalConversion) + } + ::SELECTOR => { + Ok(DecimalFloatErrorSelector::WithTargetExponentOverflow) + } + _ => Err(FixedBytes(bytes)), + }; + + return Err(CalculatorError::DecimalFloatSelector(selector)); } Ok(Float(parsed_float)) @@ -154,9 +192,9 @@ mod tests { prop_compose! { fn valid_float()( - int_part in -1_000_000_000_000_000_000_i128..1_000_000_000_000_000_000_i128, + int_part in -10i128.pow(18)..10i128.pow(18), decimal_places in 0u8..18u8, - decimal_part in 0u64..1_000_000_000_000_000_000u64 + decimal_part in 0u128..10u128.pow(18u32) ) -> Float { let mut calculator = Calculator::new().unwrap(); @@ -175,9 +213,42 @@ mod tests { fn test_parse_and_format() { let mut calculator = Calculator::new().unwrap(); - let float = calculator.parse("1.23456789".to_string()).unwrap(); + let float = calculator + .parse("1.1341234234625468391".to_string()) + .unwrap(); + // NOTE: LibFormatDecimalFloat.toDecimalString currently uses 18 decimal places + let err = calculator.format(float).unwrap_err(); + + assert!(matches!( + err, + CalculatorError::DecimalFloat(DecimalFloatErrors::LossyConversionFromFloat(_)) + )); + } + + #[test] + fn test_parse_edge_cases() { + let mut calculator = Calculator::new().unwrap(); + + // NOTE: I'm not sure if this is supposed to give an error + let float = calculator.parse("1.2.3".to_string()).unwrap(); let string = calculator.format(float).unwrap(); - assert_eq!(string, "1.23456789"); + assert_eq!(string, "1.2"); + + let err = calculator.parse("abc".to_string()).unwrap_err(); + assert!(matches!( + err, + CalculatorError::DecimalFloatSelector(Err(selector)) + if selector == fixed_bytes!("34bd2069") + )); + + // NOTE: I'd expect this (over quintillion and 19 decimals) to produce an error but it doesn't + + // let float = calculator + // .parse("1341234234625468391.1341234234625468391".to_string()) + // .unwrap_err(); + + // The value produced (broken down into first 224 and last 32 bits): + // 0xffffffed0000000000000000000000000a171f8863f1dca211b12be4 0xebc9a7e7 } proptest! { From 587ef3ef7bd5f607c38f9ba73e95d56a721812c2 Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Wed, 11 Jun 2025 12:34:35 +0400 Subject: [PATCH 16/28] add rainix-sol-prelude step --- .github/workflows/rainix.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/rainix.yaml b/.github/workflows/rainix.yaml index 4e8a053b..4bcecb14 100644 --- a/.github/workflows/rainix.yaml +++ b/.github/workflows/rainix.yaml @@ -36,6 +36,8 @@ jobs: restore-prefixes-first-match: nix-${{ runner.os }}- gc-max-store-size-linux: 1G + - run: nix develop -c rainix-sol-prelude + - name: Run ${{ matrix.task }} env: ETH_RPC_URL: ${{ secrets.CI_DEPLOY_SEPOLIA_RPC_URL || vars.CI_DEPLOY_SEPOLIA_RPC_URL }} From 507419aa1e8e8f289ba9a14c89a3bfad9dc88467 Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Wed, 11 Jun 2025 12:48:53 +0400 Subject: [PATCH 17/28] make clippy happy --- crates/float/src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/float/src/lib.rs b/crates/float/src/lib.rs index c655f006..9c0ee6ee 100644 --- a/crates/float/src/lib.rs +++ b/crates/float/src/lib.rs @@ -256,7 +256,7 @@ mod tests { fn test_parse_format(float in valid_float()) { let mut calculator = Calculator::new().unwrap(); - let formatted = calculator.format(float.clone()).unwrap(); + let formatted = calculator.format(float).unwrap(); let parsed = calculator.parse(formatted.clone()).unwrap(); prop_assert_eq!(float.0, parsed.0); } @@ -267,22 +267,22 @@ mod tests { fn test_add(a in valid_float(), b in valid_float()) { let mut calculator = Calculator::new().unwrap(); - calculator.add(a.clone(), b.clone()).unwrap(); + calculator.add(a, b).unwrap(); } #[test] fn test_sub(a in valid_float(), b in valid_float()) { let mut calculator = Calculator::new().unwrap(); - calculator.sub(a.clone(), b.clone()).unwrap(); + calculator.sub(a, b).unwrap(); } #[test] fn test_add_sub(a in valid_float(), b in valid_float()) { let mut calculator = Calculator::new().unwrap(); - let sum = calculator.add(a.clone(), b.clone()).unwrap(); - let diff = calculator.sub(sum, b.clone()).unwrap(); + let sum = calculator.add(a, b).unwrap(); + let diff = calculator.sub(sum, b).unwrap(); prop_assert_eq!( calculator.format(a).unwrap(), calculator.format(diff).unwrap(), From 0dcf889c019d47bced6428bd12fcf4bb48ef24fc Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Wed, 11 Jun 2025 13:08:56 +0400 Subject: [PATCH 18/28] address ai feedback --- crates/float/Cargo.toml | 2 ++ crates/float/src/lib.rs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/crates/float/Cargo.toml b/crates/float/Cargo.toml index fe1ad3eb..6a414ea1 100644 --- a/crates/float/Cargo.toml +++ b/crates/float/Cargo.toml @@ -2,6 +2,8 @@ name = "rain-math-float" version.workspace = true edition.workspace = true +license.workspace = true +homepage.workspace = true [dependencies] alloy.workspace = true diff --git a/crates/float/src/lib.rs b/crates/float/src/lib.rs index 9c0ee6ee..a2350e18 100644 --- a/crates/float/src/lib.rs +++ b/crates/float/src/lib.rs @@ -20,6 +20,8 @@ sol!( use DecimalFloat::DecimalFloatErrors; +/// Fixed address where the DecimalFloat contract is deployed in the in-memory EVM. +/// This arbitrary address is used consistently across all Calculator instances. const FLOAT_ADDRESS: Address = address!("00000000000000000000000000000000000f10a2"); #[derive(Debug, Error)] From d8a7a02f5cfbd38695eab6ae20c4e615611d13bc Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Wed, 11 Jun 2025 14:06:55 +0400 Subject: [PATCH 19/28] make wasm builds work and update ci --- .cargo/config.toml | 3 - .github/workflows/rainix.yaml | 17 +- Cargo.lock | 305 ++++++++++++++++++++++++++++++++-- Cargo.toml | 6 +- crates/float/Cargo.toml | 5 +- flake.nix | 24 ++- 6 files changed, 333 insertions(+), 27 deletions(-) delete mode 100644 .cargo/config.toml diff --git a/.cargo/config.toml b/.cargo/config.toml deleted file mode 100644 index 0c6c27f8..00000000 --- a/.cargo/config.toml +++ /dev/null @@ -1,3 +0,0 @@ -[target.wasm32-unknown-unknown] -# Required to make the rand feature of alloy work for wasm32-unknown-unknown -rustflags = ["--cfg", "getrandom_backend=\"wasm_js\""] diff --git a/.github/workflows/rainix.yaml b/.github/workflows/rainix.yaml index 4bcecb14..d5da6bca 100644 --- a/.github/workflows/rainix.yaml +++ b/.github/workflows/rainix.yaml @@ -9,9 +9,20 @@ jobs: rainix: strategy: matrix: - os: [ubuntu-latest] - task: - [rainix-sol-test, rainix-sol-static, rainix-rs-test, rainix-rs-static] + os: [ubuntu-latest, macos-latest] + task: [rainix-rs-test] + include: + # Solidity doesn't need to be tested on multiple platforms + - os: ubuntu-latest + task: rainix-sol-test + - os: ubuntu-latest + task: rainix-sol-static + # We don't need to do rust static analysis on multiple platforms + - os: ubuntu-latest + task: rainix-rs-static + # We don't need to do build for wasm32 on multiple platforms + - os: ubuntu-latest + task: test-wasm-build fail-fast: false runs-on: ${{ matrix.os }} env: diff --git a/Cargo.lock b/Cargo.lock index da0999ec..21b5dd4d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,17 @@ # It is not intended for manual editing. version = 4 +[[package]] +name = "addchain" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b2e69442aa5628ea6951fa33e24efe8313f4321a91bd729fc2f75bdfc858570" +dependencies = [ + "num-bigint 0.3.3", + "num-integer", + "num-traits", +] + [[package]] name = "addr2line" version = "0.24.2" @@ -671,7 +682,7 @@ dependencies = [ "fnv", "hashbrown 0.15.4", "itertools 0.13.0", - "num-bigint", + "num-bigint 0.4.6", "num-integer", "num-traits", "zeroize", @@ -688,7 +699,7 @@ dependencies = [ "ark-serialize 0.3.0", "ark-std 0.3.0", "derivative", - "num-bigint", + "num-bigint 0.4.6", "num-traits", "paste", "rustc_version 0.3.3", @@ -708,7 +719,7 @@ dependencies = [ "derivative", "digest 0.10.7", "itertools 0.10.5", - "num-bigint", + "num-bigint 0.4.6", "num-traits", "paste", "rustc_version 0.4.1", @@ -729,7 +740,7 @@ dependencies = [ "digest 0.10.7", "educe", "itertools 0.13.0", - "num-bigint", + "num-bigint 0.4.6", "num-traits", "paste", "zeroize", @@ -771,7 +782,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" dependencies = [ - "num-bigint", + "num-bigint 0.4.6", "num-traits", "quote", "syn 1.0.109", @@ -783,7 +794,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" dependencies = [ - "num-bigint", + "num-bigint 0.4.6", "num-traits", "proc-macro2", "quote", @@ -796,7 +807,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09be120733ee33f7693ceaa202ca41accd5653b779563608f1234f78ae07c4b3" dependencies = [ - "num-bigint", + "num-bigint 0.4.6", "num-traits", "proc-macro2", "quote", @@ -829,7 +840,7 @@ dependencies = [ "ark-relations", "ark-std 0.5.0", "educe", - "num-bigint", + "num-bigint 0.4.6", "num-integer", "num-traits", "tracing", @@ -865,7 +876,7 @@ checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" dependencies = [ "ark-std 0.4.0", "digest 0.10.7", - "num-bigint", + "num-bigint 0.4.6", ] [[package]] @@ -878,7 +889,7 @@ dependencies = [ "ark-std 0.5.0", "arrayvec", "digest 0.10.7", - "num-bigint", + "num-bigint 0.4.6", ] [[package]] @@ -1030,6 +1041,15 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "55248b47b0caf0546f7988906588779981c43bb1bc9d0c44087278f80cdb44ba" +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + [[package]] name = "bit-set" version = "0.8.0" @@ -1083,6 +1103,19 @@ dependencies = [ "wyz", ] +[[package]] +name = "blake3" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3888aaa89e4b2a40fca9848e400f6a658a5a3978de7be858e209cafa8be9a4a0" +dependencies = [ + "arrayref", + "arrayvec", + "cc", + "cfg-if", + "constant_time_eq", +] + [[package]] name = "block-buffer" version = "0.9.0" @@ -1222,6 +1255,12 @@ dependencies = [ "unicode-xid", ] +[[package]] +name = "constant_time_eq" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c74b8349d32d297c9134b8c88677813a227df8f779daa29bfc29c183fe3dca6" + [[package]] name = "core-foundation" version = "0.9.4" @@ -1572,10 +1611,27 @@ version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0b50bfb653653f9ca9095b427bed08ab8d75a137839d9ad64eb11810d5b6393" dependencies = [ + "byteorder", + "ff_derive", "rand_core 0.6.4", "subtle", ] +[[package]] +name = "ff_derive" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f10d12652036b0e99197587c6ba87a8fc3031986499973c030d8b44fcc151b60" +dependencies = [ + "addchain", + "num-bigint 0.3.3", + "num-integer", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + [[package]] name = "fixed-hash" version = "0.8.0" @@ -1725,6 +1781,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "42012b0f064e01aa58b545fe3727f90f7dd4020f4a3ea735b50344965f5a57e9" +[[package]] +name = "gcd" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d758ba1b47b00caf47f24925c0074ecb20d6dfcffe7f6d53395c0465674841a" + [[package]] name = "generic-array" version = "0.14.7" @@ -2150,6 +2212,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.13.0" @@ -2217,6 +2288,20 @@ dependencies = [ "sha3-asm", ] +[[package]] +name = "kzg-rs" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9201effeea3fcc93b587904ae2df9ce97e433184b9d6d299e9ebc9830a546636" +dependencies = [ + "ff", + "hex", + "serde_arrays", + "sha2 0.10.9", + "sp1_bls12_381", + "spin", +] + [[package]] name = "lazy_static" version = "1.5.0" @@ -2384,7 +2469,7 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" dependencies = [ - "num-bigint", + "num-bigint 0.4.6", "num-complex", "num-integer", "num-iter", @@ -2392,6 +2477,17 @@ dependencies = [ "num-traits", ] +[[package]] +name = "num-bigint" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6f7833f2cbf2360a6cfd58cd41a53aa7a90bd4c202f5b1c7dd2ed73c57b2c3" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + [[package]] name = "num-bigint" version = "0.4.6" @@ -2443,7 +2539,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" dependencies = [ - "num-bigint", + "num-bigint 0.4.6", "num-integer", "num-traits", ] @@ -2579,6 +2675,127 @@ dependencies = [ "sha2 0.10.9", ] +[[package]] +name = "p3-baby-bear" +version = "0.2.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7521838ecab2ddf4f7bc4ceebad06ec02414729598485c1ada516c39900820e8" +dependencies = [ + "num-bigint 0.4.6", + "p3-field", + "p3-mds", + "p3-poseidon2", + "p3-symmetric", + "rand 0.8.5", + "serde", +] + +[[package]] +name = "p3-dft" +version = "0.2.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46414daedd796f1eefcdc1811c0484e4bced5729486b6eaba9521c572c76761a" +dependencies = [ + "p3-field", + "p3-matrix", + "p3-maybe-rayon", + "p3-util", + "tracing", +] + +[[package]] +name = "p3-field" +version = "0.2.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48948a0516b349e9d1cdb95e7236a6ee010c44e68c5cc78b4b92bf1c4022a0d9" +dependencies = [ + "itertools 0.12.1", + "num-bigint 0.4.6", + "num-traits", + "p3-util", + "rand 0.8.5", + "serde", +] + +[[package]] +name = "p3-matrix" +version = "0.2.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e4de3f373589477cb735ea58e125898ed20935e03664b4614c7fac258b3c42f" +dependencies = [ + "itertools 0.12.1", + "p3-field", + "p3-maybe-rayon", + "p3-util", + "rand 0.8.5", + "serde", + "tracing", +] + +[[package]] +name = "p3-maybe-rayon" +version = "0.2.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3968ad1160310296eb04f91a5f4edfa38fe1d6b2b8cd6b5c64e6f9b7370979e" + +[[package]] +name = "p3-mds" +version = "0.2.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2356b1ed0add6d5dfbf7a338ce534a6fde827374394a52cec16a0840af6e97c9" +dependencies = [ + "itertools 0.12.1", + "p3-dft", + "p3-field", + "p3-matrix", + "p3-symmetric", + "p3-util", + "rand 0.8.5", +] + +[[package]] +name = "p3-poseidon2" +version = "0.2.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da1eec7e1b6900581bedd95e76e1ef4975608dd55be9872c9d257a8a9651c3a" +dependencies = [ + "gcd", + "p3-field", + "p3-mds", + "p3-symmetric", + "rand 0.8.5", + "serde", +] + +[[package]] +name = "p3-symmetric" +version = "0.2.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edb439bea1d822623b41ff4b51e3309e80d13cadf8b86d16ffd5e6efb9fdc360" +dependencies = [ + "itertools 0.12.1", + "p3-field", + "serde", +] + +[[package]] +name = "p3-util" +version = "0.2.3-succinct" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c2c2010678b9332b563eaa38364915b585c1a94b5ca61e2c7541c087ddda5c" +dependencies = [ + "serde", +] + +[[package]] +name = "pairing" +version = "0.23.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "81fec4625e73cf41ef4bb6846cafa6d44736525f442ba45e407c4a000a13996f" +dependencies = [ + "group", +] + [[package]] name = "parity-scale-codec" version = "3.7.5" @@ -3164,6 +3381,7 @@ dependencies = [ "c-kzg", "cfg-if", "k256", + "kzg-rs", "libsecp256k1", "once_cell", "p256", @@ -3237,7 +3455,7 @@ dependencies = [ "bytes", "fastrlp 0.3.1", "fastrlp 0.4.0", - "num-bigint", + "num-bigint 0.4.6", "num-integer", "num-traits", "parity-scale-codec", @@ -3447,6 +3665,15 @@ dependencies = [ "serde_derive", ] +[[package]] +name = "serde_arrays" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94a16b99c5ea4fe3daccd14853ad260ec00ea043b2708d1fd1da3106dcd8d9df" +dependencies = [ + "serde", +] + [[package]] name = "serde_derive" version = "1.0.219" @@ -3617,6 +3844,58 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "sp1-lib" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03046db52868c1b60e8acffa0777ef6dc11ec1bbbb10b9eb612a871f69c8d3f6" +dependencies = [ + "bincode", + "serde", + "sp1-primitives", +] + +[[package]] +name = "sp1-primitives" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6939d6b2f63e54e5fbd208a0293027608f22511741b62fe32b6f67f6c144e0c0" +dependencies = [ + "bincode", + "blake3", + "cfg-if", + "hex", + "lazy_static", + "num-bigint 0.4.6", + "p3-baby-bear", + "p3-field", + "p3-poseidon2", + "p3-symmetric", + "serde", + "sha2 0.10.9", +] + +[[package]] +name = "sp1_bls12_381" +version = "0.8.0-sp1-5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac255e1704ebcdeec5e02f6a0ebc4d2e9e6b802161938330b6810c13a610c583" +dependencies = [ + "cfg-if", + "ff", + "group", + "pairing", + "rand_core 0.6.4", + "sp1-lib", + "subtle", +] + +[[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" diff --git a/Cargo.toml b/Cargo.toml index 48eb7988..06950bff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,6 +10,10 @@ homepage = "https://github.com/rainprotocol/rain.math.float" [workspace.dependencies] alloy = { version = "1.0.9", features = ["sol-types", "json-rpc"] } -revm = "25.0.0" +revm = { version = "25.0.0", default-features = false, features = [ + "portable", + "std", + "tracer", +] } thiserror = "2.0.12" proptest = "1.7.0" diff --git a/crates/float/Cargo.toml b/crates/float/Cargo.toml index 6a414ea1..bb3dc985 100644 --- a/crates/float/Cargo.toml +++ b/crates/float/Cargo.toml @@ -7,10 +7,13 @@ homepage.workspace = true [dependencies] alloy.workspace = true -revm.workspace = true thiserror.workspace = true +[target.'cfg(not(target_family = "wasm"))'.dependencies] +revm = { workspace = true, features = ["c-kzg", "portable", "std", "tracer"] } + [target.'cfg(target_family = "wasm")'.dependencies] +revm = { workspace = true, features = ["kzg-rs", "portable", "std", "tracer"] } getrandom = { version = "0.2.11", features = ["js", "js-sys"] } [dev-dependencies] diff --git a/flake.nix b/flake.nix index 640ac762..a1637244 100644 --- a/flake.nix +++ b/flake.nix @@ -8,10 +8,22 @@ outputs = { self, flake-utils, rainix }: flake-utils.lib.eachDefaultSystem (system: - { - packages = rainix.packages.${system}; - devShells = rainix.devShells.${system}; - } - ); + let pkgs = rainix.pkgs.${system}; + in rec { + packages = rainix.packages.${system} // { + test-wasm-build = rainix.mkTask.${system} { + name = "test-wasm-build"; + body = '' + set -euxo pipefail + cargo build --target wasm32-unknown-unknown --workspace + ''; + }; + }; -} \ No newline at end of file + devShells = pkgs.mkShell { + shellHook = rainix.devShells.${system}.default.shellHook; + packages = [ packages.test-wasm-build ]; + inputsFrom = [ rainix.devShells.${system}.default ]; + }; + }); +} From d7237974ac7ac187e2b99f2db6ecb5e8cc4d76b7 Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Wed, 11 Jun 2025 14:09:21 +0400 Subject: [PATCH 20/28] fix nix flake --- flake.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index a1637244..22d563c9 100644 --- a/flake.nix +++ b/flake.nix @@ -20,7 +20,7 @@ }; }; - devShells = pkgs.mkShell { + devShells.default = pkgs.mkShell { shellHook = rainix.devShells.${system}.default.shellHook; packages = [ packages.test-wasm-build ]; inputsFrom = [ rainix.devShells.${system}.default ]; From b4b59fa056dd6ab7557c3f3d111bfa119e21c72e Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Wed, 11 Jun 2025 14:29:46 +0400 Subject: [PATCH 21/28] fix ci garbage collection --- .github/workflows/rainix.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/rainix.yaml b/.github/workflows/rainix.yaml index d5da6bca..7457d18f 100644 --- a/.github/workflows/rainix.yaml +++ b/.github/workflows/rainix.yaml @@ -45,9 +45,11 @@ jobs: primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }} # if there's no cache hit, restore a cache by this prefix restore-prefixes-first-match: nix-${{ runner.os }}- - gc-max-store-size-linux: 1G + gc-max-store-size-linux: 5G + gc-max-store-size-macos: 5G - run: nix develop -c rainix-sol-prelude + if: matrix.task == 'rainix-rs-test' || matrix.task == 'rainix-rs-static' || matrix.task == 'test-wasm-build' - name: Run ${{ matrix.task }} env: From fea8b564027cc4dd92f037d2b378af8d7c655ce1 Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Wed, 11 Jun 2025 14:43:50 +0400 Subject: [PATCH 22/28] selector refactor --- crates/float/src/lib.rs | 64 +++++++++++++++++++---------------------- 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/crates/float/src/lib.rs b/crates/float/src/lib.rs index a2350e18..ed179fb2 100644 --- a/crates/float/src/lib.rs +++ b/crates/float/src/lib.rs @@ -1,5 +1,5 @@ use alloy::primitives::{Address, Bytes, FixedBytes}; -use alloy::sol_types::SolInterface; +use alloy::sol_types::{SolError, SolInterface}; use alloy::{sol, sol_types::SolCall}; use revm::context::result::{EVMError, ExecutionResult, HaltReason, Output, SuccessReason}; use revm::context::{BlockEnv, CfgEnv, Evm, TxEnv}; @@ -9,7 +9,6 @@ use revm::handler::instructions::EthInstructions; use revm::interpreter::interpreter::EthInterpreter; use revm::primitives::{address, fixed_bytes}; use revm::{Context, MainBuilder, MainContext, SystemCallEvm}; -use std::fmt; use thiserror::Error; sol!( @@ -53,20 +52,40 @@ pub enum DecimalFloatErrorSelector { WithTargetExponentOverflow, } +impl TryFrom> for DecimalFloatErrorSelector { + type Error = FixedBytes<4>; + + fn try_from(error_selector: FixedBytes<4>) -> Result { + let FixedBytes(bytes) = error_selector; + match bytes { + ::SELECTOR => { + Ok(Self::CoefficientOverflow) + } + ::SELECTOR => Ok(Self::ExponentOverflow), + ::SELECTOR => Ok(Self::Log10Negative), + ::SELECTOR => Ok(Self::Log10Zero), + ::SELECTOR => { + Ok(Self::LossyConversionFromFloat) + } + ::SELECTOR => { + Ok(Self::NegativeFixedDecimalConversion) + } + ::SELECTOR => { + Ok(Self::WithTargetExponentOverflow) + } + _ => Err(error_selector), + } + } +} + type EvmContext = Context; pub struct Calculator { evm: Evm, EthPrecompiles>, } -#[derive(Copy, Clone, PartialEq)] +#[derive(Debug, Copy, Clone, PartialEq)] pub struct Float(FixedBytes<32>); -impl fmt::Debug for Float { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - f.debug_tuple("Float").field(&self.0).finish() - } -} - impl Calculator { pub fn new() -> Result { let mut db = InMemoryDB::default(); @@ -121,32 +140,7 @@ impl Calculator { } = DecimalFloat::parseCall::abi_decode_returns(output.as_ref())?; if error_selector != fixed_bytes!("00000000") { - let FixedBytes(bytes) = error_selector; - let selector = match bytes { - ::SELECTOR => { - Ok(DecimalFloatErrorSelector::CoefficientOverflow) - } - ::SELECTOR => { - Ok(DecimalFloatErrorSelector::ExponentOverflow) - } - ::SELECTOR => { - Ok(DecimalFloatErrorSelector::Log10Negative) - } - ::SELECTOR => { - Ok(DecimalFloatErrorSelector::Log10Zero) - } - ::SELECTOR => { - Ok(DecimalFloatErrorSelector::LossyConversionFromFloat) - } - ::SELECTOR => { - Ok(DecimalFloatErrorSelector::NegativeFixedDecimalConversion) - } - ::SELECTOR => { - Ok(DecimalFloatErrorSelector::WithTargetExponentOverflow) - } - _ => Err(FixedBytes(bytes)), - }; - + let selector = DecimalFloatErrorSelector::try_from(error_selector); return Err(CalculatorError::DecimalFloatSelector(selector)); } From 9d19c9e9ca0135b460dd830cdca4de4ad2faaf79 Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Fri, 13 Jun 2025 13:01:01 +0400 Subject: [PATCH 23/28] arb float generation --- Cargo.lock | 76 +++++++++++++++++++++++ Cargo.toml | 2 +- crates/float/proptest-regressions/lib.txt | 1 + crates/float/src/lib.rs | 56 +++++++++++++---- src/concrete/DecimalFloat.sol | 8 +++ 5 files changed, 130 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 21b5dd4d..996ebb1e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -91,6 +91,7 @@ dependencies = [ "alloy-rlp", "alloy-serde", "alloy-trie", + "arbitrary", "auto_impl", "c-kzg", "derive_more", @@ -115,6 +116,7 @@ dependencies = [ "alloy-primitives", "alloy-rlp", "alloy-serde", + "arbitrary", "serde", ] @@ -162,7 +164,10 @@ dependencies = [ "alloy-primitives", "alloy-sol-type-parser", "alloy-sol-types", + "arbitrary", + "derive_arbitrary", "itoa", + "proptest", "serde", "serde_json", "winnow", @@ -176,7 +181,9 @@ checksum = "741bdd7499908b3aa0b159bba11e71c8cddd009a2c2eb7a06e825f1ec87900a5" dependencies = [ "alloy-primitives", "alloy-rlp", + "arbitrary", "crc", + "rand 0.8.5", "serde", "thiserror", ] @@ -189,6 +196,8 @@ checksum = "7b82752a889170df67bbb36d42ca63c531eb16274f0d7299ae2a680facba17bd" dependencies = [ "alloy-primitives", "alloy-rlp", + "arbitrary", + "rand 0.8.5", "serde", ] @@ -200,7 +209,9 @@ checksum = "9d4769c6ffddca380b0070d71c8b7f30bed375543fe76bb2f74ec0acf4b7cd16" dependencies = [ "alloy-primitives", "alloy-rlp", + "arbitrary", "k256", + "rand 0.8.5", "serde", "thiserror", ] @@ -217,6 +228,7 @@ dependencies = [ "alloy-primitives", "alloy-rlp", "alloy-serde", + "arbitrary", "auto_impl", "c-kzg", "derive_more", @@ -310,9 +322,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a326d47106039f38b811057215a92139f46eef7983a4b77b10930a0ea5685b1e" dependencies = [ "alloy-rlp", + "arbitrary", "bytes", "cfg-if", "const-hex", + "derive_arbitrary", "derive_more", "foldhash", "hashbrown 0.15.4", @@ -322,6 +336,7 @@ dependencies = [ "keccak-asm", "paste", "proptest", + "proptest-derive", "rand 0.9.1", "ruint", "rustc-hash", @@ -423,6 +438,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c000cab4ec26a4b3e29d144e999e1c539c2fa0abed871bf90311eb3466187ca8" dependencies = [ "alloy-primitives", + "alloy-rpc-types-engine", "alloy-rpc-types-eth", "alloy-serde", "serde", @@ -439,6 +455,24 @@ dependencies = [ "alloy-serde", ] +[[package]] +name = "alloy-rpc-types-engine" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cab52691970553d84879d777419fa7b6a2e92e9fe8641f9324cc071008c2f656" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "arbitrary", + "derive_more", + "rand 0.8.5", + "serde", + "strum", +] + [[package]] name = "alloy-rpc-types-eth" version = "1.0.9" @@ -453,6 +487,7 @@ dependencies = [ "alloy-rlp", "alloy-serde", "alloy-sol-types", + "arbitrary", "itertools 0.14.0", "serde", "serde_json", @@ -466,6 +501,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "730e8f2edf2fc224cabd1c25d090e1655fa6137b2e409f92e5eec735903f1507" dependencies = [ "alloy-primitives", + "arbitrary", "serde", "serde_json", ] @@ -620,9 +656,13 @@ checksum = "983d99aa81f586cef9dae38443245e585840fcf0fc58b09aee0b1f27aed1d500" dependencies = [ "alloy-primitives", "alloy-rlp", + "arbitrary", "arrayvec", + "derive_arbitrary", "derive_more", "nybbles", + "proptest", + "proptest-derive", "serde", "smallvec", "tracing", @@ -643,6 +683,15 @@ dependencies = [ "libc", ] +[[package]] +name = "arbitrary" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" +dependencies = [ + "derive_arbitrary", +] + [[package]] name = "ark-bls12-381" version = "0.5.0" @@ -1179,6 +1228,7 @@ version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7318cfa722931cb5fe0838b98d3ce5621e75f6a6408abc21721d80de9223f2e4" dependencies = [ + "arbitrary", "blst", "cc", "glob", @@ -1426,6 +1476,17 @@ dependencies = [ "syn 2.0.102", ] +[[package]] +name = "derive_arbitrary" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.102", +] + [[package]] name = "derive_more" version = "2.0.1" @@ -2182,6 +2243,7 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" dependencies = [ + "arbitrary", "equivalent", "hashbrown 0.15.4", "serde", @@ -2592,6 +2654,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8983bb634df7248924ee0c4c3a749609b5abcb082c28fffe3254b3eb3602b307" dependencies = [ "alloy-rlp", + "arbitrary", "const-hex", "proptest", "serde", @@ -3065,6 +3128,17 @@ dependencies = [ "unarray", ] +[[package]] +name = "proptest-derive" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ee1c9ac207483d5e7db4940700de86a9aae46ef90c48b57f99fe7edb8345e49" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.102", +] + [[package]] name = "quick-error" version = "1.2.3" @@ -3450,6 +3524,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11256b5fe8c68f56ac6f39ef0720e592f33d2367a4782740d9c9142e889c7fb4" dependencies = [ "alloy-rlp", + "arbitrary", "ark-ff 0.3.0", "ark-ff 0.4.2", "bytes", @@ -3831,6 +3906,7 @@ version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" dependencies = [ + "arbitrary", "serde", ] diff --git a/Cargo.toml b/Cargo.toml index 06950bff..d02a1f08 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ license = "CAL-1.0" homepage = "https://github.com/rainprotocol/rain.math.float" [workspace.dependencies] -alloy = { version = "1.0.9", features = ["sol-types", "json-rpc"] } +alloy = { version = "1.0.9", features = ["sol-types", "json-rpc", "arbitrary"] } revm = { version = "25.0.0", default-features = false, features = [ "portable", "std", diff --git a/crates/float/proptest-regressions/lib.txt b/crates/float/proptest-regressions/lib.txt index 70d20bf9..7070cb90 100644 --- a/crates/float/proptest-regressions/lib.txt +++ b/crates/float/proptest-regressions/lib.txt @@ -5,3 +5,4 @@ # It is recommended to check this file in to source control so that # everyone who runs the test benefits from these saved cases. cc 664cbb4a3416dcc12fe1196bdf33bdf3f9e1403c6446f0516dc704da23be5723 # shrinks to a = Float(0x0000000000000000000000000000000000000000000000000000000000000000), b = Float(0xffffffff00000000000000000000000000000000000000000000000000000001) +cc 3fd2457aad2f1f4960353eb70458c7806f645c48898d3d336369b396c6cd13e1 # shrinks to a = Float(0x000000000000000000000000000000000000000000000000534a0c3580000000), b = Float(0x00000000000000000000000000000000000000000000000008e5c21900000000) diff --git a/crates/float/src/lib.rs b/crates/float/src/lib.rs index ed179fb2..56f0a699 100644 --- a/crates/float/src/lib.rs +++ b/crates/float/src/lib.rs @@ -1,3 +1,5 @@ +#[cfg(test)] +use alloy::primitives::aliases::I224; use alloy::primitives::{Address, Bytes, FixedBytes}; use alloy::sol_types::{SolError, SolInterface}; use alloy::{sol, sol_types::SolCall}; @@ -130,6 +132,25 @@ impl Calculator { } } + #[allow(dead_code)] // will be used in future tests + #[cfg(test)] + fn pack_lossless( + &mut self, + coefficient: I224, + exponent: i32, + ) -> Result { + let calldata = DecimalFloat::packLosslessCall { + coefficient, + exponent, + } + .abi_encode(); + + self.execute_call(Bytes::from(calldata), |output| { + let decoded = DecimalFloat::packLosslessCall::abi_decode_returns(output.as_ref())?; + Ok(Float(decoded)) + }) + } + pub fn parse(&mut self, str: String) -> Result { let calldata = DecimalFloat::parseCall { str }.abi_encode(); @@ -187,7 +208,18 @@ mod tests { use proptest::prelude::*; prop_compose! { - fn valid_float()( + fn arb_float()( + coefficient in any::(), + exponent in any::(), + ) -> Float { + let mut calculator = Calculator::new().unwrap(); + + calculator.pack_lossless(coefficient, exponent).unwrap() + } + } + + prop_compose! { + fn reasonable_float()( int_part in -10i128.pow(18)..10i128.pow(18), decimal_places in 0u8..18u8, decimal_part in 0u128..10u128.pow(18u32) @@ -237,19 +269,15 @@ mod tests { if selector == fixed_bytes!("34bd2069") )); - // NOTE: I'd expect this (over quintillion and 19 decimals) to produce an error but it doesn't - + // // NOTE: I'd expect this (over quintillion and 19 decimals) to produce an error but it doesn't // let float = calculator - // .parse("1341234234625468391.1341234234625468391".to_string()) - // .unwrap_err(); - - // The value produced (broken down into first 224 and last 32 bits): - // 0xffffffed0000000000000000000000000a171f8863f1dca211b12be4 0xebc9a7e7 + // .parse("100000000000000000000.1341234234625468391".to_string()) + // .unwrap(); } proptest! { #[test] - fn test_parse_format(float in valid_float()) { + fn test_parse_format(float in reasonable_float()) { let mut calculator = Calculator::new().unwrap(); let formatted = calculator.format(float).unwrap(); @@ -260,21 +288,25 @@ mod tests { proptest! { #[test] - fn test_add(a in valid_float(), b in valid_float()) { + fn test_add(a in reasonable_float(), b in reasonable_float()) { let mut calculator = Calculator::new().unwrap(); calculator.add(a, b).unwrap(); } + } + proptest! { #[test] - fn test_sub(a in valid_float(), b in valid_float()) { + fn test_sub(a in reasonable_float(), b in reasonable_float()) { let mut calculator = Calculator::new().unwrap(); calculator.sub(a, b).unwrap(); } + } + proptest! { #[test] - fn test_add_sub(a in valid_float(), b in valid_float()) { + fn test_add_sub(a in reasonable_float(), b in reasonable_float()) { let mut calculator = Calculator::new().unwrap(); let sum = calculator.add(a, b).unwrap(); diff --git a/src/concrete/DecimalFloat.sol b/src/concrete/DecimalFloat.sol index 4026fa33..9b59a6f8 100644 --- a/src/concrete/DecimalFloat.sol +++ b/src/concrete/DecimalFloat.sol @@ -163,4 +163,12 @@ contract DecimalFloat { function isZero(Float a) external pure returns (bool) { return a.isZero(); } + + /// Exposes `LibDecimalFloat.packLossless` for offchain use. + /// @param coefficient The coefficient to pack. + /// @param exponent The exponent to pack. + /// @return The packed float. + function packLossless(int224 coefficient, int32 exponent) external pure returns (Float) { + return LibDecimalFloat.packLossless(coefficient, exponent); + } } From 0007e78f9b440edc65b8f40612a10c41d1525581 Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Fri, 13 Jun 2025 15:32:34 +0400 Subject: [PATCH 24/28] fix wasm build --- Cargo.lock | 139 +++++++++++++++++++--------------------- Cargo.toml | 2 +- crates/float/Cargo.toml | 1 + crates/float/src/lib.rs | 13 ++-- 4 files changed, 71 insertions(+), 84 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 996ebb1e..00365697 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -403,7 +403,7 @@ checksum = "64b728d511962dda67c1bc7ea7c03736ec275ed2cf4c35d9585298ac9ccf3b73" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -548,7 +548,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -565,7 +565,7 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", "syn-solidity", "tiny-keccak", ] @@ -584,7 +584,7 @@ dependencies = [ "proc-macro2", "quote", "serde_json", - "syn 2.0.102", + "syn 2.0.103", "syn-solidity", ] @@ -822,7 +822,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62945a2f7e6de02a31fe400aa489f0e0f5b2502e69f95f853adb82a96c7a6b60" dependencies = [ "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -860,7 +860,7 @@ dependencies = [ "num-traits", "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -949,7 +949,7 @@ checksum = "213888f660fddcca0d257e88e54ac05bca01885f258ccdf695bafd77031bb69d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -1016,7 +1016,7 @@ checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -1027,7 +1027,7 @@ checksum = "e539d3fca749fcee5236ab05e93a52867dd549cc157c8cb7f99595f3cedffdb5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -1048,7 +1048,7 @@ checksum = "ffdcb70bdbc4d478427380519163274ac86e52916e10f0a8889adf0f96d3fee7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -1240,9 +1240,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.2.26" +version = "1.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956a5e21988b87f372569b66183b78babf23ebc2e744b733e4350a752c4dafac" +checksum = "d487aa071b5f64da6f19a3e848e3578944b726ee5a4854b82172f02aa876bfdc" dependencies = [ "shlex", ] @@ -1406,7 +1406,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -1417,7 +1417,7 @@ checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ "darling_core", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -1473,7 +1473,7 @@ checksum = "e73f2692d4bd3cac41dca28934a39894200c9fabf49586d77d0e5954af1d7902" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -1484,7 +1484,7 @@ checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -1504,7 +1504,7 @@ checksum = "bda628edc44c4bb645fbe0f758797143e4e07926f7ebf4e9bdfbd3d2ce621df3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", "unicode-xid", ] @@ -1537,7 +1537,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -1570,7 +1570,7 @@ dependencies = [ "enum-ordinalize", "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -1619,7 +1619,7 @@ checksum = "0d28318a75d4aead5c4db25382e8ef717932d0346600cacae6357eb5941bc5ff" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -1803,7 +1803,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -1868,7 +1868,7 @@ dependencies = [ "cfg-if", "js-sys", "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi 0.11.1+wasi-snapshot-preview1", "wasm-bindgen", ] @@ -1939,9 +1939,9 @@ checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" [[package]] name = "hermit-abi" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f154ce46856750ed433c8649605bf7ed2de3bc35fd9d2a9f30cddd873c80cb08" +checksum = "fc0fef456e4baa96da950455cd02c081ca953b141298e41db3fc7e36b1da849c" [[package]] name = "hex" @@ -2223,7 +2223,7 @@ checksum = "a0eb5a3343abf848c0984fe4604b2b105da9539376e24fc0a3b0007411ae4fd9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -2473,20 +2473,14 @@ checksum = "1b27834086c65ec3f9387b096d66e99f221cf081c2b738042aa252bcd41204e3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] name = "memchr" -version = "2.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" - -[[package]] -name = "mime" -version = "0.3.17" +version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" [[package]] name = "miniz_oxide" @@ -2504,7 +2498,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78bed444cc8a2160f01cbcf811ef18cac863ad68ae8ca62092e8db51d51c761c" dependencies = [ "libc", - "wasi 0.11.0+wasi-snapshot-preview1", + "wasi 0.11.1+wasi-snapshot-preview1", "windows-sys 0.59.0", ] @@ -2644,7 +2638,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -2705,7 +2699,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -2884,7 +2878,7 @@ dependencies = [ "proc-macro-crate", "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -2964,7 +2958,7 @@ dependencies = [ "phf_shared", "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -2993,7 +2987,7 @@ checksum = "6e918e4ff8c4549eb882f14b3a4bc8c8bc93de829416eacf579f1207a8fbf861" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -3096,7 +3090,7 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -3136,7 +3130,7 @@ checksum = "4ee1c9ac207483d5e7db4940700de86a9aae46ef90c48b57f99fe7edb8345e49" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -3250,9 +3244,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.12" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "928fca9cf2aa042393a8325b9ead81d2f0df4cb12e1e24cef072922ccd99c5af" +checksum = "0d04b7d0ee6b4a0207a0a7adb104d23ecb0b47d6beae7152d0fa34b692b29fd6" dependencies = [ "bitflags", ] @@ -3265,9 +3259,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.12.19" +version = "0.12.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2f8e5513d63f2e5b386eb5106dc67eaf3f84e95258e210489136b8b92ad6119" +checksum = "eabf4c97d9130e2bf606614eb937e86edac8292eaa6f422f995d7e8de1eb1813" dependencies = [ "base64", "bytes", @@ -3278,12 +3272,9 @@ dependencies = [ "hyper", "hyper-tls", "hyper-util", - "ipnet", "js-sys", "log", - "mime", "native-tls", - "once_cell", "percent-encoding", "pin-project-lite", "rustls-pki-types", @@ -3757,7 +3748,7 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -3812,7 +3803,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -4019,7 +4010,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -4041,9 +4032,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.102" +version = "2.0.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6397daf94fa90f058bd0fd88429dd9e5738999cca8d701813c80723add80462" +checksum = "e4307e30089d6fd6aff212f2da3a1f9e32f3223b1f010fb09b7c95f90f3ca1e8" dependencies = [ "proc-macro2", "quote", @@ -4059,7 +4050,7 @@ dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -4079,7 +4070,7 @@ checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -4118,7 +4109,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -4204,7 +4195,7 @@ checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -4323,7 +4314,7 @@ checksum = "1b1ffbcf9c6f6b99d386e7444eb608ba646ae452a36b39737deb9663b610f662" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -4460,9 +4451,9 @@ dependencies = [ [[package]] name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" +version = "0.11.1+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" [[package]] name = "wasi" @@ -4495,7 +4486,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", "wasm-bindgen-shared", ] @@ -4530,7 +4521,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4589,7 +4580,7 @@ checksum = "a47fddd13af08290e67f4acabf4b459f647552718f683a7b415d290ac744a836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -4600,14 +4591,14 @@ checksum = "bd9211b69f8dcdfa817bfd14bf1c97c9188afa36f4750130fcdf3f400eca9fa8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] name = "windows-link" -version = "0.1.1" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" +checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" [[package]] name = "windows-result" @@ -4711,9 +4702,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.7.10" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06928c8748d81b05c9be96aad92e1b6ff01833332f281e8cfca3be4b35fc9ec" +checksum = "74c7b26e3480b707944fc872477815d29a8e429d2f93a1ce000f5fa84a15cbcd" dependencies = [ "memchr", ] @@ -4762,7 +4753,7 @@ checksum = "38da3c9736e16c5d3c8c597a9aaa5d1fa565d0532ae05e27c24aa62fb32c0ab6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", "synstructure", ] @@ -4783,7 +4774,7 @@ checksum = "28a6e20d751156648aa063f3800b706ee209a32c0b4d9f24be3d980b01be55ef" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -4803,7 +4794,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", "synstructure", ] @@ -4824,7 +4815,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] [[package]] @@ -4857,5 +4848,5 @@ checksum = "5b96237efa0c878c64bd89c436f661be4e46b2f3eff1ebb976f7ef2321d2f58f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.102", + "syn 2.0.103", ] diff --git a/Cargo.toml b/Cargo.toml index d02a1f08..06950bff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ license = "CAL-1.0" homepage = "https://github.com/rainprotocol/rain.math.float" [workspace.dependencies] -alloy = { version = "1.0.9", features = ["sol-types", "json-rpc", "arbitrary"] } +alloy = { version = "1.0.9", features = ["sol-types", "json-rpc"] } revm = { version = "25.0.0", default-features = false, features = [ "portable", "std", diff --git a/crates/float/Cargo.toml b/crates/float/Cargo.toml index bb3dc985..3a0bdf2a 100644 --- a/crates/float/Cargo.toml +++ b/crates/float/Cargo.toml @@ -17,4 +17,5 @@ revm = { workspace = true, features = ["kzg-rs", "portable", "std", "tracer"] } getrandom = { version = "0.2.11", features = ["js", "js-sys"] } [dev-dependencies] +alloy = { workspace = true, features = ["sol-types", "json-rpc", "arbitrary"] } proptest.workspace = true diff --git a/crates/float/src/lib.rs b/crates/float/src/lib.rs index 56f0a699..05b862e2 100644 --- a/crates/float/src/lib.rs +++ b/crates/float/src/lib.rs @@ -221,16 +221,14 @@ mod tests { prop_compose! { fn reasonable_float()( int_part in -10i128.pow(18)..10i128.pow(18), - decimal_places in 0u8..18u8, decimal_part in 0u128..10u128.pow(18u32) ) -> Float { let mut calculator = Calculator::new().unwrap(); - let num_str = if decimal_places == 0 { + let num_str = if decimal_part == 0 { format!("{int_part}") } else { - let decimal_str = format!("{decimal_part:0width$}", width = decimal_places as usize); - format!("{int_part}.{decimal_str}") + format!("{int_part}.{decimal_part}") }; calculator.parse(num_str).unwrap() @@ -245,6 +243,7 @@ mod tests { .parse("1.1341234234625468391".to_string()) .unwrap(); // NOTE: LibFormatDecimalFloat.toDecimalString currently uses 18 decimal places + // TODO: make this fail on a separate PR let err = calculator.format(float).unwrap_err(); assert!(matches!( @@ -258,6 +257,7 @@ mod tests { let mut calculator = Calculator::new().unwrap(); // NOTE: I'm not sure if this is supposed to give an error + // TODO: make this fail on a separate PR let float = calculator.parse("1.2.3".to_string()).unwrap(); let string = calculator.format(float).unwrap(); assert_eq!(string, "1.2"); @@ -268,11 +268,6 @@ mod tests { CalculatorError::DecimalFloatSelector(Err(selector)) if selector == fixed_bytes!("34bd2069") )); - - // // NOTE: I'd expect this (over quintillion and 19 decimals) to produce an error but it doesn't - // let float = calculator - // .parse("100000000000000000000.1341234234625468391".to_string()) - // .unwrap(); } proptest! { From 9e62a2c619991c86047ca543608d0a2fafa94485 Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Fri, 13 Jun 2025 16:55:33 +0400 Subject: [PATCH 25/28] use thread_local! to reduce the number of initializations --- Cargo.lock | 1 + Cargo.toml | 1 + crates/float/Cargo.toml | 1 + crates/float/src/lib.rs | 191 ++++++++++++++++++---------------------- 4 files changed, 88 insertions(+), 106 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 00365697..888f2386 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3166,6 +3166,7 @@ version = "0.1.0" dependencies = [ "alloy", "getrandom 0.2.16", + "once_cell", "proptest", "revm", "thiserror", diff --git a/Cargo.toml b/Cargo.toml index 06950bff..0373588a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,3 +17,4 @@ revm = { version = "25.0.0", default-features = false, features = [ ] } thiserror = "2.0.12" proptest = "1.7.0" +once_cell = "1.21.3" diff --git a/crates/float/Cargo.toml b/crates/float/Cargo.toml index 3a0bdf2a..ae7dd845 100644 --- a/crates/float/Cargo.toml +++ b/crates/float/Cargo.toml @@ -7,6 +7,7 @@ homepage.workspace = true [dependencies] alloy.workspace = true +once_cell = "1.21.3" thiserror.workspace = true [target.'cfg(not(target_family = "wasm"))'.dependencies] diff --git a/crates/float/src/lib.rs b/crates/float/src/lib.rs index 05b862e2..cbccb6c7 100644 --- a/crates/float/src/lib.rs +++ b/crates/float/src/lib.rs @@ -3,6 +3,7 @@ use alloy::primitives::aliases::I224; use alloy::primitives::{Address, Bytes, FixedBytes}; use alloy::sol_types::{SolError, SolInterface}; use alloy::{sol, sol_types::SolCall}; +use once_cell::unsync::Lazy; use revm::context::result::{EVMError, ExecutionResult, HaltReason, Output, SuccessReason}; use revm::context::{BlockEnv, CfgEnv, Evm, TxEnv}; use revm::database::InMemoryDB; @@ -11,14 +12,31 @@ use revm::handler::instructions::EthInstructions; use revm::interpreter::interpreter::EthInterpreter; use revm::primitives::{address, fixed_bytes}; use revm::{Context, MainBuilder, MainContext, SystemCallEvm}; +use std::cell::RefCell; +use std::thread::AccessError; use thiserror::Error; sol!( - #![sol(all_derives = true)] + #![sol(all_derives)] DecimalFloat, "../../out/DecimalFloat.sol/DecimalFloat.json" ); +type EvmContext = Context; +type LocalEvm = Evm, EthPrecompiles>; + +thread_local! { + static LOCAL_EVM: Lazy> = Lazy::new(|| { + let mut db = InMemoryDB::default(); + let bytecode = revm::state::Bytecode::new_legacy(DecimalFloat::DEPLOYED_BYTECODE.clone()); + let account_info = revm::state::AccountInfo::default().with_code(bytecode); + db.insert_account_info(FLOAT_ADDRESS, account_info); + + let evm = Context::mainnet().with_db(db).build_mainnet(); + RefCell::new(evm) + }); +} + use DecimalFloat::DecimalFloatErrors; /// Fixed address where the DecimalFloat contract is deployed in the in-memory EVM. @@ -26,7 +44,7 @@ use DecimalFloat::DecimalFloatErrors; const FLOAT_ADDRESS: Address = address!("00000000000000000000000000000000000f10a2"); #[derive(Debug, Error)] -pub enum CalculatorError { +pub enum FloatError { #[error("EVM error: {0}")] Evm(#[from] EVMError), #[error("Float execution reverted with output: {0}")] @@ -41,6 +59,8 @@ pub enum CalculatorError { DecimalFloat(DecimalFloatErrors), #[error("Decimal Float error selector: {0:?}")] DecimalFloatSelector(Result>), + #[error(transparent)] + Access(#[from] AccessError), } #[derive(Debug)] @@ -80,81 +100,60 @@ impl TryFrom> for DecimalFloatErrorSelector { } } -type EvmContext = Context; -pub struct Calculator { - evm: Evm, EthPrecompiles>, -} - -#[derive(Debug, Copy, Clone, PartialEq)] -pub struct Float(FixedBytes<32>); - -impl Calculator { - pub fn new() -> Result { - let mut db = InMemoryDB::default(); - let bytecode = revm::state::Bytecode::new_legacy(DecimalFloat::DEPLOYED_BYTECODE.clone()); - let account_info = revm::state::AccountInfo::default().with_code(bytecode); - db.insert_account_info(FLOAT_ADDRESS, account_info); - - let evm = Context::mainnet().with_db(db).build_mainnet(); - - Ok(Calculator { evm }) - } - - fn execute_call( - &mut self, - calldata: Bytes, - process_output: F, - ) -> Result - where - F: FnOnce(Bytes) -> Result, - { - let result_and_state = self - .evm - .transact_system_call_finalize(FLOAT_ADDRESS, calldata)?; - - match result_and_state.result { - ExecutionResult::Success { - reason: SuccessReason::Return, - output: Output::Call(output), - .. - } => process_output(output), - ExecutionResult::Success { reason, output, .. } => { - Err(CalculatorError::UnexpectedSuccess(reason, output)) +fn execute_call(calldata: Bytes, process_output: F) -> Result +where + F: FnOnce(Bytes) -> Result, +{ + let result = LOCAL_EVM.try_with(|evm| { + let evm = &mut *evm.borrow_mut(); + let result_and_state = evm.transact_system_call_finalize(FLOAT_ADDRESS, calldata)?; + + Ok::<_, FloatError>(result_and_state.result) + })??; + + match result { + ExecutionResult::Success { + reason: SuccessReason::Return, + output: Output::Call(output), + .. + } => process_output(output), + ExecutionResult::Success { reason, output, .. } => { + Err(FloatError::UnexpectedSuccess(reason, output)) + } + ExecutionResult::Revert { output, .. } => { + if let Ok(error) = DecimalFloat::DecimalFloatErrors::abi_decode(output.as_ref()) { + return Err(FloatError::DecimalFloat(error)); } - ExecutionResult::Revert { output, .. } => { - if let Ok(error) = DecimalFloat::DecimalFloatErrors::abi_decode(output.as_ref()) { - return Err(CalculatorError::DecimalFloat(error)); - } - Err(CalculatorError::Revert(output)) - } - ExecutionResult::Halt { reason, .. } => Err(CalculatorError::Halt(reason)), + Err(FloatError::Revert(output)) } + ExecutionResult::Halt { reason, .. } => Err(FloatError::Halt(reason)), } +} + +#[derive(Debug, Copy, Clone, PartialEq)] +pub struct Float(FixedBytes<32>); +impl Float { #[allow(dead_code)] // will be used in future tests #[cfg(test)] - fn pack_lossless( - &mut self, - coefficient: I224, - exponent: i32, - ) -> Result { + fn pack_lossless(coefficient: I224, exponent: i32) -> Result { let calldata = DecimalFloat::packLosslessCall { coefficient, exponent, } .abi_encode(); - self.execute_call(Bytes::from(calldata), |output| { + execute_call(Bytes::from(calldata), |output| { let decoded = DecimalFloat::packLosslessCall::abi_decode_returns(output.as_ref())?; Ok(Float(decoded)) }) } - pub fn parse(&mut self, str: String) -> Result { + pub fn parse(str: String) -> Result { let calldata = DecimalFloat::parseCall { str }.abi_encode(); - self.execute_call(Bytes::from(calldata), |output| { + execute_call(Bytes::from(calldata), |output| { let DecimalFloat::parseReturn { _0: error_selector, _1: parsed_float, @@ -162,40 +161,40 @@ impl Calculator { if error_selector != fixed_bytes!("00000000") { let selector = DecimalFloatErrorSelector::try_from(error_selector); - return Err(CalculatorError::DecimalFloatSelector(selector)); + return Err(FloatError::DecimalFloatSelector(selector)); } Ok(Float(parsed_float)) }) } - pub fn format(&mut self, float: Float) -> Result { - let Float(a) = float; + pub fn format(self) -> Result { + let Float(a) = self; let calldata = DecimalFloat::formatCall { a }.abi_encode(); - self.execute_call(Bytes::from(calldata), |output| { + execute_call(Bytes::from(calldata), |output| { let decoded = DecimalFloat::formatCall::abi_decode_returns(output.as_ref())?; Ok(decoded) }) } - pub fn add(&mut self, a: Float, b: Float) -> Result { - let Float(a) = a; + pub fn add(self, b: Self) -> Result { + let Float(a) = self; let Float(b) = b; let calldata = DecimalFloat::addCall { a, b }.abi_encode(); - self.execute_call(Bytes::from(calldata), |output| { + execute_call(Bytes::from(calldata), |output| { let decoded = DecimalFloat::addCall::abi_decode_returns(output.as_ref())?; Ok(Float(decoded)) }) } - pub fn sub(&mut self, a: Float, b: Float) -> Result { - let Float(a) = a; + pub fn sub(self: Self, b: Self) -> Result { + let Float(a) = self; let Float(b) = b; let calldata = DecimalFloat::subCall { a, b }.abi_encode(); - self.execute_call(Bytes::from(calldata), |output| { + execute_call(Bytes::from(calldata), |output| { let decoded = DecimalFloat::subCall::abi_decode_returns(output.as_ref())?; Ok(Float(decoded)) }) @@ -212,9 +211,7 @@ mod tests { coefficient in any::(), exponent in any::(), ) -> Float { - let mut calculator = Calculator::new().unwrap(); - - calculator.pack_lossless(coefficient, exponent).unwrap() + Float::pack_lossless(coefficient, exponent).unwrap() } } @@ -223,49 +220,39 @@ mod tests { int_part in -10i128.pow(18)..10i128.pow(18), decimal_part in 0u128..10u128.pow(18u32) ) -> Float { - let mut calculator = Calculator::new().unwrap(); - let num_str = if decimal_part == 0 { format!("{int_part}") } else { format!("{int_part}.{decimal_part}") }; - calculator.parse(num_str).unwrap() + Float::parse(num_str).unwrap() } } #[test] fn test_parse_and_format() { - let mut calculator = Calculator::new().unwrap(); - - let float = calculator - .parse("1.1341234234625468391".to_string()) - .unwrap(); + let float = Float::parse("1.1341234234625468391".to_string()).unwrap(); // NOTE: LibFormatDecimalFloat.toDecimalString currently uses 18 decimal places // TODO: make this fail on a separate PR - let err = calculator.format(float).unwrap_err(); + let err = float.format().unwrap_err(); assert!(matches!( err, - CalculatorError::DecimalFloat(DecimalFloatErrors::LossyConversionFromFloat(_)) + FloatError::DecimalFloat(DecimalFloatErrors::LossyConversionFromFloat(_)) )); } #[test] fn test_parse_edge_cases() { - let mut calculator = Calculator::new().unwrap(); - - // NOTE: I'm not sure if this is supposed to give an error - // TODO: make this fail on a separate PR - let float = calculator.parse("1.2.3".to_string()).unwrap(); - let string = calculator.format(float).unwrap(); + let float = Float::parse("1.2.3".to_string()).unwrap(); + let string = float.format().unwrap(); assert_eq!(string, "1.2"); - let err = calculator.parse("abc".to_string()).unwrap_err(); + let err = Float::parse("abc".to_string()).unwrap_err(); assert!(matches!( err, - CalculatorError::DecimalFloatSelector(Err(selector)) + FloatError::DecimalFloatSelector(Err(selector)) if selector == fixed_bytes!("34bd2069") )); } @@ -273,10 +260,8 @@ mod tests { proptest! { #[test] fn test_parse_format(float in reasonable_float()) { - let mut calculator = Calculator::new().unwrap(); - - let formatted = calculator.format(float).unwrap(); - let parsed = calculator.parse(formatted.clone()).unwrap(); + let formatted = float.format().unwrap(); + let parsed = Float::parse(formatted.clone()).unwrap(); prop_assert_eq!(float.0, parsed.0); } } @@ -284,34 +269,28 @@ mod tests { proptest! { #[test] fn test_add(a in reasonable_float(), b in reasonable_float()) { - let mut calculator = Calculator::new().unwrap(); - - calculator.add(a, b).unwrap(); + a.add(b).unwrap(); } } proptest! { #[test] fn test_sub(a in reasonable_float(), b in reasonable_float()) { - let mut calculator = Calculator::new().unwrap(); - - calculator.sub(a, b).unwrap(); + a.sub(b).unwrap(); } } proptest! { #[test] fn test_add_sub(a in reasonable_float(), b in reasonable_float()) { - let mut calculator = Calculator::new().unwrap(); - - let sum = calculator.add(a, b).unwrap(); - let diff = calculator.sub(sum, b).unwrap(); + let sum = a.add(b).unwrap(); + let diff = sum.sub(b).unwrap(); prop_assert_eq!( - calculator.format(a).unwrap(), - calculator.format(diff).unwrap(), + a.format().unwrap(), + diff.format().unwrap(), "a: {}, b: {}", - calculator.format(a).unwrap(), - calculator.format(b).unwrap(), + a.format().unwrap(), + b.format().unwrap(), ); } } From 0a7c1b7638a65c79018da8df31c0a2a1ee6b5721 Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Fri, 13 Jun 2025 16:59:47 +0400 Subject: [PATCH 26/28] update parse test --- crates/float/src/lib.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/float/src/lib.rs b/crates/float/src/lib.rs index cbccb6c7..4594b4bf 100644 --- a/crates/float/src/lib.rs +++ b/crates/float/src/lib.rs @@ -245,9 +245,12 @@ mod tests { #[test] fn test_parse_edge_cases() { - let float = Float::parse("1.2.3".to_string()).unwrap(); - let string = float.format().unwrap(); - assert_eq!(string, "1.2"); + let err = Float::parse("1.2.3".to_string()).unwrap_err(); + assert!(matches!( + err, + FloatError::DecimalFloatSelector(Err(selector)) + if selector == fixed_bytes!("ad384e87") + )); let err = Float::parse("abc".to_string()).unwrap_err(); assert!(matches!( From c298fa787fe47998ce8f234fa64d9a4bc3b5d063 Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Fri, 13 Jun 2025 17:18:20 +0400 Subject: [PATCH 27/28] make clippy happy --- crates/float/Cargo.toml | 16 +++++++++++++--- crates/float/src/lib.rs | 21 +++++++++++++++------ 2 files changed, 28 insertions(+), 9 deletions(-) diff --git a/crates/float/Cargo.toml b/crates/float/Cargo.toml index ae7dd845..3a95a16f 100644 --- a/crates/float/Cargo.toml +++ b/crates/float/Cargo.toml @@ -7,14 +7,24 @@ homepage.workspace = true [dependencies] alloy.workspace = true -once_cell = "1.21.3" +once_cell.workspace = true thiserror.workspace = true [target.'cfg(not(target_family = "wasm"))'.dependencies] -revm = { workspace = true, features = ["c-kzg", "portable", "std", "tracer"] } +revm = { workspace = true, default-features = false, features = [ + "c-kzg", + "portable", + "std", + "tracer", +] } [target.'cfg(target_family = "wasm")'.dependencies] -revm = { workspace = true, features = ["kzg-rs", "portable", "std", "tracer"] } +revm = { workspace = true, default-features = false, features = [ + "kzg-rs", + "portable", + "std", + "tracer", +] } getrandom = { version = "0.2.11", features = ["js", "js-sys"] } [dev-dependencies] diff --git a/crates/float/src/lib.rs b/crates/float/src/lib.rs index 4594b4bf..14ebf7c4 100644 --- a/crates/float/src/lib.rs +++ b/crates/float/src/lib.rs @@ -13,6 +13,7 @@ use revm::interpreter::interpreter::EthInterpreter; use revm::primitives::{address, fixed_bytes}; use revm::{Context, MainBuilder, MainContext, SystemCallEvm}; use std::cell::RefCell; +use std::ops::{Add, Sub}; use std::thread::AccessError; use thiserror::Error; @@ -177,8 +178,12 @@ impl Float { Ok(decoded) }) } +} + +impl Add for Float { + type Output = Result; - pub fn add(self, b: Self) -> Result { + fn add(self, b: Self) -> Self::Output { let Float(a) = self; let Float(b) = b; let calldata = DecimalFloat::addCall { a, b }.abi_encode(); @@ -188,8 +193,12 @@ impl Float { Ok(Float(decoded)) }) } +} + +impl Sub for Float { + type Output = Result; - pub fn sub(self: Self, b: Self) -> Result { + fn sub(self, b: Self) -> Self::Output { let Float(a) = self; let Float(b) = b; let calldata = DecimalFloat::subCall { a, b }.abi_encode(); @@ -272,22 +281,22 @@ mod tests { proptest! { #[test] fn test_add(a in reasonable_float(), b in reasonable_float()) { - a.add(b).unwrap(); + (a + b).unwrap(); } } proptest! { #[test] fn test_sub(a in reasonable_float(), b in reasonable_float()) { - a.sub(b).unwrap(); + (a - b).unwrap(); } } proptest! { #[test] fn test_add_sub(a in reasonable_float(), b in reasonable_float()) { - let sum = a.add(b).unwrap(); - let diff = sum.sub(b).unwrap(); + let sum = (a + b).unwrap(); + let diff = (sum - b).unwrap(); prop_assert_eq!( a.format().unwrap(), diff.format().unwrap(), From dbe108f385b3c799cb130822a9545b664afeaa2f Mon Sep 17 00:00:00 2001 From: 0xgleb Date: Fri, 13 Jun 2025 17:30:09 +0400 Subject: [PATCH 28/28] rm once_cell --- Cargo.lock | 1 - Cargo.toml | 1 - crates/float/Cargo.toml | 1 - crates/float/src/lib.rs | 5 ++--- 4 files changed, 2 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 888f2386..00365697 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3166,7 +3166,6 @@ version = "0.1.0" dependencies = [ "alloy", "getrandom 0.2.16", - "once_cell", "proptest", "revm", "thiserror", diff --git a/Cargo.toml b/Cargo.toml index 0373588a..06950bff 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -17,4 +17,3 @@ revm = { version = "25.0.0", default-features = false, features = [ ] } thiserror = "2.0.12" proptest = "1.7.0" -once_cell = "1.21.3" diff --git a/crates/float/Cargo.toml b/crates/float/Cargo.toml index 3a95a16f..e1e3cf1b 100644 --- a/crates/float/Cargo.toml +++ b/crates/float/Cargo.toml @@ -7,7 +7,6 @@ homepage.workspace = true [dependencies] alloy.workspace = true -once_cell.workspace = true thiserror.workspace = true [target.'cfg(not(target_family = "wasm"))'.dependencies] diff --git a/crates/float/src/lib.rs b/crates/float/src/lib.rs index 14ebf7c4..a8cbcbe0 100644 --- a/crates/float/src/lib.rs +++ b/crates/float/src/lib.rs @@ -3,7 +3,6 @@ use alloy::primitives::aliases::I224; use alloy::primitives::{Address, Bytes, FixedBytes}; use alloy::sol_types::{SolError, SolInterface}; use alloy::{sol, sol_types::SolCall}; -use once_cell::unsync::Lazy; use revm::context::result::{EVMError, ExecutionResult, HaltReason, Output, SuccessReason}; use revm::context::{BlockEnv, CfgEnv, Evm, TxEnv}; use revm::database::InMemoryDB; @@ -27,7 +26,7 @@ type EvmContext = Context; type LocalEvm = Evm, EthPrecompiles>; thread_local! { - static LOCAL_EVM: Lazy> = Lazy::new(|| { + static LOCAL_EVM: RefCell = { let mut db = InMemoryDB::default(); let bytecode = revm::state::Bytecode::new_legacy(DecimalFloat::DEPLOYED_BYTECODE.clone()); let account_info = revm::state::AccountInfo::default().with_code(bytecode); @@ -35,7 +34,7 @@ thread_local! { let evm = Context::mainnet().with_db(db).build_mainnet(); RefCell::new(evm) - }); + }; } use DecimalFloat::DecimalFloatErrors;