diff --git a/Cargo.lock b/Cargo.lock index dfba341dae..2274a789f7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,21 +13,6 @@ dependencies = [ "num-traits", ] -[[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.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" - [[package]] name = "ahash" version = "0.8.12" @@ -55,11 +40,34 @@ version = "0.2.21" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923" +[[package]] +name = "alloy" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f07655fedc35188f3c50ff8fc6ee45703ae14ef1bc7ae7d80e23a747012184e3" +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", + "alloy-trie", +] + [[package]] name = "alloy-chains" -version = "0.2.4" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19a9cc9d81ace3da457883b0bdf76776e55f1b84219a9e9d55c27ad308548d3f" +checksum = "35d744058a9daa51a8cf22a3009607498fcf82d3cf4c5444dd8056cdf651f471" dependencies = [ "alloy-primitives", "num_enum", @@ -68,9 +76,9 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "1.0.12" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bcb57295c4b632b6b3941a089ee82d00ff31ff9eb3eac801bf605ffddc81041" +checksum = "2e318e25fb719e747a7e8db1654170fc185024f3ed5b10f86c08d448a912f6e2" dependencies = [ "alloy-eips", "alloy-primitives", @@ -79,6 +87,7 @@ dependencies = [ "alloy-trie", "alloy-tx-macros", "auto_impl", + "borsh", "c-kzg", "derive_more", "either", @@ -87,15 +96,16 @@ dependencies = [ "rand 0.8.5", "secp256k1 0.30.0", "serde", + "serde_json", "serde_with", "thiserror", ] [[package]] name = "alloy-consensus-any" -version = "1.0.12" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab669be40024565acb719daf1b2a050e6dc065fc0bec6050d97a81cdb860bd7" +checksum = "364380a845193a317bcb7a5398fc86cdb66c47ebe010771dde05f6869bf9e64a" dependencies = [ "alloy-consensus", "alloy-eips", @@ -105,6 +115,57 @@ dependencies = [ "serde", ] +[[package]] +name = "alloy-contract" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d39c80ffc806f27a76ed42f3351a455f3dc4f81d6ff92c8aad2cf36b7d3a34" +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", + "serde_json", + "thiserror", +] + +[[package]] +name = "alloy-core" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a651e1d9e50e6d0a78bd23cd08facb70459a94501c4036c7799a093e569a310" +dependencies = [ + "alloy-dyn-abi", + "alloy-json-abi", + "alloy-primitives", + "alloy-rlp", + "alloy-sol-types", +] + +[[package]] +name = "alloy-dyn-abi" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d48a9101f4a67c22fae57489f1ddf3057b8ab4a368d8eac3be088b6e9d9c9d9" +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" @@ -120,23 +181,25 @@ dependencies = [ [[package]] name = "alloy-eip2930" -version = "0.2.1" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b82752a889170df67bbb36d42ca63c531eb16274f0d7299ae2a680facba17bd" +checksum = "9441120fa82df73e8959ae0e4ab8ade03de2aaae61be313fbf5746277847ce25" dependencies = [ "alloy-primitives", "alloy-rlp", + "borsh", "serde", ] [[package]] name = "alloy-eip7702" -version = "0.6.1" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d4769c6ffddca380b0070d71c8b7f30bed375543fe76bb2f74ec0acf4b7cd16" +checksum = "2919c5a56a1007492da313e7a3b6d45ef5edc5d33416fdec63c0d7a2702a0d20" dependencies = [ "alloy-primitives", "alloy-rlp", + "borsh", "k256", "serde", "thiserror", @@ -144,9 +207,9 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "1.0.12" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f853de9ca1819f54de80de5d03bfc1bb7c9fafcf092b480a654447141bc354d" +checksum = "a4c4d7c5839d9f3a467900c625416b24328450c65702eb3d8caff8813e4d1d33" dependencies = [ "alloy-eip2124", "alloy-eip2930", @@ -155,18 +218,36 @@ dependencies = [ "alloy-rlp", "alloy-serde", "auto_impl", + "borsh", "c-kzg", "derive_more", "either", "serde", + "serde_with", "sha2 0.10.9", + "thiserror", +] + +[[package]] +name = "alloy-genesis" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ba4b1be0988c11f0095a2380aa596e35533276b8fa6c9e06961bbfe0aebcac5" +dependencies = [ + "alloy-eips", + "alloy-primitives", + "alloy-serde", + "alloy-trie", + "borsh", + "serde", + "serde_with", ] [[package]] name = "alloy-json-abi" -version = "1.2.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b26fdd571915bafe857fccba4ee1a4f352965800e46a53e4a5f50187b7776fa" +checksum = "9914c147bb9b25f440eca68a31dc29f5c22298bfa7754aa802965695384122b0" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -176,9 +257,9 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "1.0.12" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4997a9873c8639d079490f218e50e5fa07e70f957e9fc187c0a0535977f482f" +checksum = "f72cf87cda808e593381fb9f005ffa4d2475552b7a6c5ac33d087bf77d82abd0" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -191,9 +272,9 @@ dependencies = [ [[package]] name = "alloy-network" -version = "1.0.12" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0306e8d148b7b94d988615d367443c1b9d6d2e9fecd2e1f187ac5153dce56f5" +checksum = "12aeb37b6f2e61b93b1c3d34d01ee720207c76fe447e2a2c217e433ac75b17f5" dependencies = [ "alloy-consensus", "alloy-consensus-any", @@ -217,9 +298,9 @@ dependencies = [ [[package]] name = "alloy-network-primitives" -version = "1.0.12" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eef189583f4c53d231dd1297b28a675ff842b551fb34715f562868a1937431a" +checksum = "abd29ace62872083e30929cd9b282d82723196d196db589f3ceda67edcc05552" dependencies = [ "alloy-consensus", "alloy-eips", @@ -230,21 +311,20 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "1.2.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a326d47106039f38b811057215a92139f46eef7983a4b77b10930a0ea5685b1e" +checksum = "7db950a29746be9e2f2c6288c8bd7a6202a81f999ce109a2933d2379970ec0fa" dependencies = [ "alloy-rlp", "arbitrary", "bytes", "cfg-if", "const-hex", - "derive_arbitrary", "derive_more", - "foldhash", + "foldhash 0.2.0", "getrandom 0.3.3", - "hashbrown 0.15.4", - "indexmap 2.9.0", + "hashbrown 0.16.1", + "indexmap 2.12.1", "itoa", "k256", "keccak-asm", @@ -252,6 +332,7 @@ dependencies = [ "proptest", "proptest-derive", "rand 0.9.1", + "rapidhash", "ruint", "rustc-hash", "serde", @@ -261,9 +342,9 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "1.0.12" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea624ddcdad357c33652b86aa7df9bd21afd2080973389d3facf1a221c573948" +checksum = "9b710636d7126e08003b8217e24c09f0cca0b46d62f650a841736891b1ed1fc1" dependencies = [ "alloy-chains", "alloy-consensus", @@ -285,7 +366,6 @@ dependencies = [ "either", "futures", "futures-utils-wasm", - "http", "lru", "parking_lot", "pin-project", @@ -323,15 +403,14 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "1.0.12" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e43d00b4de38432304c4e4b01ae6a3601490fd9824c852329d158763ec18663c" +checksum = "d0882e72d2c1c0c79dcf4ab60a67472d3f009a949f774d4c17d0bdb669cfde05" dependencies = [ "alloy-json-rpc", "alloy-primitives", "alloy-transport", "alloy-transport-http", - "async-stream", "futures", "pin-project", "reqwest", @@ -341,16 +420,27 @@ dependencies = [ "tokio-stream", "tower", "tracing", - "tracing-futures", "url", "wasmtimer", ] +[[package]] +name = "alloy-rpc-types" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cf1398cb33aacb139a960fa3d8cf8b1202079f320e77e952a0b95967bf7a9f" +dependencies = [ + "alloy-primitives", + "alloy-rpc-types-eth", + "alloy-serde", + "serde", +] + [[package]] name = "alloy-rpc-types-any" -version = "1.0.12" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5958f2310d69f4806e6f6b90ceb4f2b781cc5a843517a7afe2e7cfec6de3cfb9" +checksum = "6a63fb40ed24e4c92505f488f9dd256e2afaed17faa1b7a221086ebba74f4122" dependencies = [ "alloy-consensus-any", "alloy-rpc-types-eth", @@ -359,9 +449,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "1.0.12" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1826285e4ffc2372a8c061d5cc145858e67a0be3309b768c5b77ddb6b9e6cbc7" +checksum = "9eae0c7c40da20684548cbc8577b6b7447f7bf4ddbac363df95e3da220e41e72" dependencies = [ "alloy-consensus", "alloy-consensus-any", @@ -374,14 +464,15 @@ dependencies = [ "itertools 0.14.0", "serde", "serde_json", + "serde_with", "thiserror", ] [[package]] name = "alloy-serde" -version = "1.0.12" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "906ce0190afeded19cb2e963cb8507c975a7862216b9e74f39bf91ddee6ae74b" +checksum = "c0df1987ed0ff2d0159d76b52e7ddfc4e4fbddacc54d2fbee765e0d14d7c01b5" dependencies = [ "alloy-primitives", "serde", @@ -390,9 +481,9 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "1.0.12" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c89baab06195c4be9c5d66f15c55e948013d1aff3ec1cfb0ed469e1423313fce" +checksum = "6ff69deedee7232d7ce5330259025b868c5e6a52fa8dffda2c861fb3a5889b24" dependencies = [ "alloy-primitives", "async-trait", @@ -405,9 +496,9 @@ dependencies = [ [[package]] name = "alloy-signer-local" -version = "1.0.12" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a249a923e302ac6db932567c43945392f0b6832518aab3c4274858f58756774" +checksum = "72cfe0be3ec5a8c1a46b2e5a7047ed41121d360d97f4405bb7c1c784880c86cb" dependencies = [ "alloy-consensus", "alloy-network", @@ -421,9 +512,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "1.2.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4be1ce1274ddd7fdfac86e5ece1b225e9bba1f2327e20fbb30ee6b9cc1423fe" +checksum = "a3b96d5f5890605ba9907ce1e2158e2701587631dc005bfa582cf92dd6f21147" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", @@ -435,14 +526,15 @@ dependencies = [ [[package]] name = "alloy-sol-macro-expander" -version = "1.2.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01e92f3708ea4e0d9139001c86c051c538af0146944a2a9c7181753bd944bf57" +checksum = "b8247b7cca5cde556e93f8b3882b01dbd272f527836049083d240c57bf7b4c15" dependencies = [ + "alloy-json-abi", "alloy-sol-macro-input", "const-hex", "heck", - "indexmap 2.9.0", + "indexmap 2.12.1", "proc-macro-error2", "proc-macro2", "quote", @@ -453,25 +545,27 @@ dependencies = [ [[package]] name = "alloy-sol-macro-input" -version = "1.2.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afe1bd348a41f8c9b4b54dfb314886786d6201235b0b3f47198b9d910c86bb2" +checksum = "3cd54f38512ac7bae10bbc38480eefb1b9b398ca2ce25db9cc0c048c6411c4f1" dependencies = [ + "alloy-json-abi", "const-hex", "dunce", "heck", "macro-string", "proc-macro2", "quote", + "serde_json", "syn 2.0.103", "syn-solidity", ] [[package]] name = "alloy-sol-type-parser" -version = "1.2.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6195df2acd42df92a380a8db6205a5c7b41282d0ce3f4c665ecf7911ac292f1" +checksum = "444b09815b44899564566d4d56613d14fa9a274b1043a021f00468568752f449" dependencies = [ "serde", "winnow", @@ -479,9 +573,9 @@ dependencies = [ [[package]] name = "alloy-sol-types" -version = "1.2.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6185e98a79cf19010722f48a74b5a65d153631d2f038cabd250f4b9e9813b8ad" +checksum = "dc1038284171df8bfd48befc0c7b78f667a7e2be162f45f07bd1c378078ebe58" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -491,12 +585,12 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "1.0.12" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d1ae10b1bc77fde38161e242749e41e65e34000d05da0a3d3f631e03bfcb19e" +checksum = "be98b07210d24acf5b793c99b759e9a696e4a2e67593aec0487ae3b3e1a2478c" dependencies = [ "alloy-json-rpc", - "alloy-primitives", + "auto_impl", "base64", "derive_more", "futures", @@ -514,9 +608,9 @@ dependencies = [ [[package]] name = "alloy-transport-http" -version = "1.0.12" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b234272ee449e32c9f1afbbe4ee08ea7c4b52f14479518f95c844ab66163c545" +checksum = "4198a1ee82e562cab85e7f3d5921aab725d9bd154b6ad5017f82df1695877c97" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -529,9 +623,9 @@ dependencies = [ [[package]] name = "alloy-trie" -version = "0.8.1" +version = "0.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "983d99aa81f586cef9dae38443245e585840fcf0fc58b09aee0b1f27aed1d500" +checksum = "e3412d52bb97c6c6cc27ccc28d4e6e8cf605469101193b50b0bd5813b1f990b5" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -545,23 +639,16 @@ dependencies = [ [[package]] name = "alloy-tx-macros" -version = "1.0.12" +version = "1.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b75ef8609ea2b31c799b0a56c724dca4c73105c5ccc205d9dfeb1d038df6a1da" +checksum = "333544408503f42d7d3792bfc0f7218b643d968a03d2c0ed383ae558fb4a76d0" dependencies = [ - "alloy-primitives", - "darling", + "darling 0.21.3", "proc-macro2", "quote", "syn 2.0.103", ] -[[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" @@ -638,6 +725,9 @@ 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" @@ -1010,21 +1100,6 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b7e4c2464d97fe331d41de9d5db0def0a96f4d823b8b32a2efd503578988973" -[[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" @@ -1168,6 +1243,29 @@ dependencies = [ "zeroize", ] +[[package]] +name = "borsh" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1da5ab77c1437701eeff7c88d968729e7766172279eab0676857b3d63af7a6f" +dependencies = [ + "borsh-derive", + "cfg_aliases", +] + +[[package]] +name = "borsh-derive" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0686c856aa6aac0c4498f936d7d6a02df690f614c03e4d906d1018062b5c5e2c" +dependencies = [ + "once_cell", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.103", +] + [[package]] name = "bumpalo" version = "3.18.1" @@ -1218,10 +1316,11 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5" [[package]] name = "cc" -version = "1.2.27" +version = "1.2.49" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d487aa071b5f64da6f19a3e848e3578944b726ee5a4854b82172f02aa876bfdc" +checksum = "90583009037521a116abf44494efecd645ba48b6622457080f080b85544e2215" dependencies = [ + "find-msvc-tools", "shlex", ] @@ -1231,17 +1330,22 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9555578bc9e57714c812a1f84e4fc5b4d21fcb063490c624de019f7464c91268" +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + [[package]] name = "chrono" -version = "0.4.41" +version = "0.4.42" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c469d952047f47f91b68d1cba3f10d63c11d73e4636f24f08daf0278abf01c4d" +checksum = "145052bdd345b87320e369255277e3fb5152762ad123a901ef5c262dd38fe8d2" dependencies = [ - "android-tzdata", "iana-time-zone", "num-traits", "serde", - "windows-link", + "windows-link 0.2.1", ] [[package]] @@ -1375,7 +1479,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "117725a109d387c937a1533ce01b450cbde6b88abceea8473c4d7a85853cda3c" dependencies = [ "lazy_static", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1566,8 +1670,18 @@ version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" dependencies = [ - "darling_core", - "darling_macro", + "darling_core 0.20.11", + "darling_macro 0.20.11", +] + +[[package]] +name = "darling" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cdf337090841a411e2a7f3deb9187445851f91b309c0c0a29e05f74a00a48c0" +dependencies = [ + "darling_core 0.21.3", + "darling_macro 0.21.3", ] [[package]] @@ -1584,13 +1698,39 @@ dependencies = [ "syn 2.0.103", ] +[[package]] +name = "darling_core" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1247195ecd7e3c85f83c8d2a366e4210d588e802133e1e355180a9870b517ea4" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "serde", + "strsim", + "syn 2.0.103", +] + [[package]] name = "darling_macro" version = "0.20.11" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" dependencies = [ - "darling_core", + "darling_core 0.20.11", + "quote", + "syn 2.0.103", +] + +[[package]] +name = "darling_macro" +version = "0.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d38308df82d1080de0afee5d069fa14b0326a88c14f15c5ccda35b4a6c414c81" +dependencies = [ + "darling_core 0.21.3", "quote", "syn 2.0.103", ] @@ -1822,7 +1962,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cea14ef9355e3beab063703aa9dab15afd25f0667c341310c1e5274bb1d0da18" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1975,6 +2115,12 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "find-msvc-tools" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3076410a55c90011c298b04d0cfa770b00fa04e1e3c97d3f6c9de105a03844" + [[package]] name = "fixed-hash" version = "0.8.0" @@ -1999,6 +2145,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9c4f5dac5e15c24eb999c26181a6ca40b39fe946cbe4c263c7209467bc83af2" +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + [[package]] name = "foreign-types" version = "0.3.2" @@ -2154,8 +2306,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "335ff9f135e4384c8150d6f27c6daed433577f86b4750418338c01a1a2528592" dependencies = [ "cfg-if", + "js-sys", "libc", "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", ] [[package]] @@ -2165,17 +2319,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "26145e563e54f2cadc477553f1ec5ee650b00862f0a58bcd12cbdc5f0ea2d2f4" dependencies = [ "cfg-if", + "js-sys", "libc", "r-efi", "wasi 0.14.2+wasi-0.2.4", + "wasm-bindgen", ] -[[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" @@ -2239,8 +2389,18 @@ checksum = "5971ac85611da7067dbfcabef3c70ebb5606018acd9e2a3903a0da507521e0d5" dependencies = [ "allocator-api2", "equivalent", - "foldhash", + "foldhash 0.1.5", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "foldhash 0.2.0", "serde", + "serde_core", ] [[package]] @@ -2341,6 +2501,23 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-rustls" +version = "0.27.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + [[package]] name = "hyper-tls" version = "0.6.0" @@ -2375,7 +2552,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2", + "socket2 0.5.10", "tokio", "tower-service", "tracing", @@ -2551,14 +2728,15 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.9.0" +version = "2.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cea70ddb795996207ad57735b50c5982d8844f38ba9ee5f1aedcfb708a2aa11e" +checksum = "0ad4bb2b565bca0645f4d68c5c9af97fba094e9791da685bf83cb5f3ce74acf2" dependencies = [ "arbitrary", "equivalent", - "hashbrown 0.15.4", + "hashbrown 0.16.1", "serde", + "serde_core", ] [[package]] @@ -2598,7 +2776,7 @@ checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2810,6 +2988,12 @@ dependencies = [ "hashbrown 0.15.4", ] +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + [[package]] name = "macro-string" version = "0.1.4" @@ -2827,15 +3011,6 @@ version = "2.7.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a282da65faaf38286cf3be983213fcf1d2e2a58700e808f83f4ea9a4804bc0" -[[package]] -name = "miniz_oxide" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" -dependencies = [ - "adler2", -] - [[package]] name = "mio" version = "1.0.4" @@ -2994,26 +3169,18 @@ checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" [[package]] name = "nybbles" -version = "0.3.4" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8983bb634df7248924ee0c4c3a749609b5abcb082c28fffe3254b3eb3602b307" +checksum = "bfa11e84403164a9f12982ab728f3c67c6fd4ab5b5f0254ffc217bdbd3b28ab0" dependencies = [ "alloy-rlp", - "const-hex", + "cfg-if", "proptest", + "ruint", "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" @@ -3277,7 +3444,7 @@ dependencies = [ "libc", "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -3543,9 +3710,9 @@ dependencies = [ [[package]] name = "proptest-derive" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ee1c9ac207483d5e7db4940700de86a9aae46ef90c48b57f99fe7edb8345e49" +checksum = "095a99f75c69734802359b682be8daaf8980296731f6470434ea2c652af1dd30" dependencies = [ "proc-macro2", "quote", @@ -3558,6 +3725,61 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" +[[package]] +name = "quinn" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2 0.6.1", + "thiserror", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" +dependencies = [ + "bytes", + "getrandom 0.3.3", + "lru-slab", + "rand 0.9.1", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2 0.6.1", + "tracing", + "windows-sys 0.60.2", +] + [[package]] name = "quote" version = "1.0.40" @@ -3650,11 +3872,21 @@ dependencies = [ "rand_core 0.9.3", ] +[[package]] +name = "rapidhash" +version = "4.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8e65c75143ce5d47c55b510297eeb1182f3c739b6043c537670e9fc18612dae" +dependencies = [ + "rand 0.9.1", + "rustversion", +] + [[package]] name = "rayon" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b418a60154510ca1a002a752ca9714984e21e4241e804d32555251faf8b78ffa" +checksum = "368f01d005bf8fd9b1206fb6fa653e6c4a81ceb1466406b81792d87c5677a58f" dependencies = [ "either", "rayon-core", @@ -3662,9 +3894,9 @@ dependencies = [ [[package]] name = "rayon-core" -version = "1.12.1" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1465873a3dfdaa8ae7cb14b4383657caab0b3e8a0aa9ae8e04b044854c8dfce2" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" dependencies = [ "crossbeam-deque", "crossbeam-utils", @@ -3747,6 +3979,7 @@ dependencies = [ "http-body", "http-body-util", "hyper", + "hyper-rustls", "hyper-tls", "hyper-util", "js-sys", @@ -3754,6 +3987,8 @@ dependencies = [ "native-tls", "percent-encoding", "pin-project-lite", + "quinn", + "rustls", "rustls-pki-types", "serde", "serde_json", @@ -3761,6 +3996,7 @@ dependencies = [ "sync_wrapper", "tokio", "tokio-native-tls", + "tokio-rustls", "tower", "tower-http", "tower-service", @@ -3768,6 +4004,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", + "webpki-roots", ] [[package]] @@ -3983,6 +4220,23 @@ dependencies = [ "thiserror", ] +[[package]] +name = "revm-supra-extension" +version = "0.1.0" +dependencies = [ + "alloy", + "alloy-consensus", + "alloy-contract", + "alloy-eips", + "alloy-serde", + "alloy-sol-types", + "derive_more", + "revm-context", + "revm-primitives", + "serde", + "thiserror", +] + [[package]] name = "revme" version = "7.2.2" @@ -4023,6 +4277,20 @@ dependencies = [ "subtle", ] +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.16", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "ripemd" version = "0.1.3" @@ -4118,12 +4386,6 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" -[[package]] -name = "rustc-demangle" -version = "0.1.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "989e6739f80c4ad5b13e0fd7fe89531180375b18520cc8c82080e4dc4035b84f" - [[package]] name = "rustc-hash" version = "2.1.1" @@ -4167,7 +4429,21 @@ dependencies = [ "errno", "libc", "linux-raw-sys", - "windows-sys 0.52.0", + "windows-sys 0.59.0", +] + +[[package]] +name = "rustls" +version = "0.23.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", ] [[package]] @@ -4176,9 +4452,21 @@ version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" dependencies = [ + "web-time", "zeroize", ] +[[package]] +name = "rustls-webpki" +version = "0.103.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ffdfa2f5286e2247234e03f680868ac2815974dc39e00ea15adc445d0aafe52" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + [[package]] name = "rustversion" version = "1.0.21" @@ -4310,9 +4598,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.14.0" +version = "2.15.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49db231d56a190491cb4aeda9527f1ad45345af50b0851622a7adb8c03b01c32" +checksum = "cc1f0cbffaac4852523ce30d8bd3c5cdc873501d96ff467ca09b6767bb8cd5c0" dependencies = [ "core-foundation-sys", "libc", @@ -4344,10 +4632,11 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" dependencies = [ + "serde_core", "serde_derive", ] @@ -4360,11 +4649,20 @@ dependencies = [ "serde", ] +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + [[package]] name = "serde_derive" -version = "1.0.219" +version = "1.0.228" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" dependencies = [ "proc-macro2", "quote", @@ -4377,7 +4675,7 @@ version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ - "indexmap 2.9.0", + "indexmap 2.12.1", "itoa", "memchr", "ryu", @@ -4406,7 +4704,7 @@ dependencies = [ "chrono", "hex", "indexmap 1.9.3", - "indexmap 2.9.0", + "indexmap 2.12.1", "schemars", "serde", "serde_derive", @@ -4421,7 +4719,7 @@ version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "81679d9ed988d5e9a5e6531dc3f2c28efbd639cbd1dfb628df08edea6004da77" dependencies = [ - "darling", + "darling 0.20.11", "proc-macro2", "quote", "syn 2.0.103", @@ -4538,6 +4836,16 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "socket2" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17129e116933cf371d018bb80ae557e889637989d8638274fb25622827b03881" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + [[package]] name = "sp1-lib" version = "5.0.5" @@ -4683,9 +4991,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "1.2.0" +version = "1.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14c8c8f496c33dc6343dac05b4be8d9e0bca180a4caa81d7b8416b10cc2273cd" +checksum = "f6b1d2e2059056b66fec4a6bb2b79511d5e8d76196ef49c38996f4b48db7662f" dependencies = [ "paste", "proc-macro2", @@ -4729,23 +5037,23 @@ dependencies = [ "getrandom 0.3.3", "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "thiserror" -version = "2.0.12" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" +checksum = "f63587ca0f12b72a0600bcba1d40081f830876000bb46dd2337a3051618f4fc8" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "2.0.12" +version = "2.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" +checksum = "3ff15c8ecd7de3849db632e14d18d2571fa09dfc5ed93479bc4485c7a517c913" dependencies = [ "proc-macro2", "quote", @@ -4821,27 +5129,41 @@ dependencies = [ "serde_json", ] +[[package]] +name = "tinyvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + [[package]] name = "tokio" -version = "1.45.1" +version = "1.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779" +checksum = "ff360e02eab121e0bc37a2d3b4d4dc622e6eda3a8e5253d5435ecf5bd4c68408" dependencies = [ - "backtrace", "bytes", "libc", "mio", "pin-project-lite", - "socket2", + "socket2 0.6.1", "tokio-macros", - "windows-sys 0.52.0", + "windows-sys 0.61.2", ] [[package]] name = "tokio-macros" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" +checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" dependencies = [ "proc-macro2", "quote", @@ -4858,6 +5180,16 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + [[package]] name = "tokio-stream" version = "0.1.17" @@ -4895,7 +5227,7 @@ version = "0.22.27" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" dependencies = [ - "indexmap 2.9.0", + "indexmap 2.12.1", "toml_datetime", "winnow", ] @@ -4977,18 +5309,6 @@ dependencies = [ "valuable", ] -[[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 = "tracing-subscriber" version = "0.2.25" @@ -5052,9 +5372,9 @@ checksum = "5a5f39404a5da50712a4c1eecf25e90dd62b613502b7e925fd4e4d19b5c96512" [[package]] name = "unicode-width" -version = "0.2.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4a1a07cc7db3810833284e8d372ccdc6da29741639ecc70c9ec107df0fa6154c" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" [[package]] name = "unicode-xid" @@ -5062,6 +5382,12 @@ version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + [[package]] name = "unty" version = "0.0.4" @@ -5093,9 +5419,9 @@ checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "uuid" -version = "1.17.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cf4199d1e5d15ddd86a694e4d0dffa9c323ce759fea589f00fef9d81cc1931d" +checksum = "e2e054861b4bd027cd373e18e8d8d8e6548085000e41290d95ce0c373a654b4a" dependencies = [ "getrandom 0.3.3", "js-sys", @@ -5274,13 +5600,22 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "webpki-roots" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2878ef029c47c6e8cf779119f20fcf52bde7ad42a731b2a304bc221df17571e" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "winapi-util" version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -5291,7 +5626,7 @@ checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3" dependencies = [ "windows-implement", "windows-interface", - "windows-link", + "windows-link 0.1.3", "windows-result", "windows-strings", ] @@ -5324,13 +5659,19 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5e6ad25900d524eaabdbbb96d20b4311e1e7ae1699af4fb28c17ae66c80d798a" +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + [[package]] name = "windows-result" version = "0.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56f42bd332cc6c8eac5af113fc0c1fd6a8fd2aa08a0119358686e5160d0586c6" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -5339,7 +5680,7 @@ version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "56e6c93f3a0c3b36176cb1327a4958a0353d5d166c2a35cb268ace15e91d3b57" dependencies = [ - "windows-link", + "windows-link 0.1.3", ] [[package]] @@ -5348,7 +5689,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", ] [[package]] @@ -5357,7 +5698,25 @@ version = "0.59.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" dependencies = [ - "windows-targets", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link 0.2.1", ] [[package]] @@ -5366,14 +5725,31 @@ 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", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link 0.2.1", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", ] [[package]] @@ -5382,48 +5758,96 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + [[package]] name = "windows_aarch64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + [[package]] name = "windows_i686_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + [[package]] name = "windows_i686_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + [[package]] name = "windows_x86_64_gnu" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + [[package]] name = "windows_x86_64_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + [[package]] name = "windows_x86_64_msvc" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + [[package]] name = "winnow" version = "0.7.11" diff --git a/Cargo.toml b/Cargo.toml index dd4f8aaf67..08f5639ec4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,6 +15,8 @@ members = [ "crates/context", "crates/context/interface", "crates/handler", + # supra extensions + "crates/supra-extension", # variants "crates/op-revm", @@ -35,6 +37,7 @@ members = [ "examples/my_evm", "examples/custom_opcodes", "examples/custom_precompile_journal", + ] resolver = "2" default-members = ["crates/revm"] @@ -56,6 +59,7 @@ context-interface = { path = "crates/context/interface", package = "revm-context handler = { path = "crates/handler", package = "revm-handler", version = "10.0.0", default-features = false } op-revm = { path = "crates/op-revm", package = "op-revm", version = "10.0.0", default-features = false } ee-tests = { path = "crates/ee-tests", package = "revm-ee-tests", version = "0.1.0", default-features = false } +supra-extension = { path = "crates/supra-extension", package = "revm-supra-extension", version = "0.1.0", default-features = false } # alloy alloy-eip2930 = { version = "0.2.1", default-features = false } @@ -72,6 +76,16 @@ alloy-signer = { version = "1.0.12", default-features = false } alloy-signer-local = { version = "1.0.12", default-features = false } alloy-transport = { version = "1.0.12", default-features = false } +alloy-contract = { version = "1.0.19"} +alloy = { version = "1.0.19", features = ["sol-types", "contract"] } +alloy-serde = { version = "1.0.19" } + +# libraries required to build supra-contract bindings +# For more detaisl see crates/supra-extension/build.rs +#forge = { git = "https://github.com/foundry-rs/foundry.git", tag="v1.4.1"} +#alloy-chains = { version = "0.2.13" } +#shlex = { version = "1.3.0" } + # precompiles ark-bls12-381 = { version = "0.5", default-features = false } ark-bn254 = { version = "0.5", default-features = false } @@ -113,6 +127,7 @@ derive-where = { version = "1.5.0", default-features = false } rand = "0.9" tokio = "1.45" either = { version = "1.15.0", default-features = false } +derive_more = { version = "2.0.1" } # dev-dependencies anyhow = "1.0.98" diff --git a/crates/context/interface/src/cfg.rs b/crates/context/interface/src/cfg.rs index c67c1af707..08886e2e78 100644 --- a/crates/context/interface/src/cfg.rs +++ b/crates/context/interface/src/cfg.rs @@ -58,7 +58,7 @@ pub trait Cfg { /// Returns whether the priority fee check is disabled. fn is_priority_fee_check_disabled(&self) -> bool; - + /// Returns whether the automation mode is enabled. fn is_automation_mode(&self) -> bool; } diff --git a/crates/context/interface/src/transaction.rs b/crates/context/interface/src/transaction.rs index 474d3e6ff7..ac7ed0df68 100644 --- a/crates/context/interface/src/transaction.rs +++ b/crates/context/interface/src/transaction.rs @@ -70,6 +70,11 @@ pub trait Transaction { /// Note : Common field for all transactions. fn nonce(&self) -> u64; + /// Transaction hash (32 bytes). + /// + /// Note : Common field for all transactions. + fn tx_hash(&self) -> B256; + /// Transaction kind. It can be Call or Create. /// /// Kind is applicable for: Legacy, EIP-2930, EIP-1559 diff --git a/crates/context/interface/src/transaction/either.rs b/crates/context/interface/src/transaction/either.rs index c4d6413de7..857ea3f151 100644 --- a/crates/context/interface/src/transaction/either.rs +++ b/crates/context/interface/src/transaction/either.rs @@ -118,4 +118,11 @@ where Either::Right(r) => r.max_priority_fee_per_gas(), } } + + fn tx_hash(&self) -> B256 { + match self { + Either::Left(l) => l.tx_hash(), + Either::Right(r) => r.tx_hash(), + } + } } diff --git a/crates/context/src/cfg.rs b/crates/context/src/cfg.rs index 815e3c4e06..668ba69a84 100644 --- a/crates/context/src/cfg.rs +++ b/crates/context/src/cfg.rs @@ -348,7 +348,7 @@ impl + Copy> Cfg for CfgEnv { } } } - + fn is_automation_mode(&self) -> bool { self.automation_mode } @@ -369,4 +369,4 @@ mod test { let cfg: CfgEnv = Default::default(); assert_eq!(cfg.max_blobs_per_tx(), None); } -} \ No newline at end of file +} diff --git a/crates/context/src/tx.rs b/crates/context/src/tx.rs index d3510e5c6c..2975b50f6d 100644 --- a/crates/context/src/tx.rs +++ b/crates/context/src/tx.rs @@ -86,6 +86,8 @@ pub struct TxEnv { /// /// [EIP-7702]: https://eips.ethereum.org/EIPS/eip-7702 pub authorization_list: Vec>, + /// Transaction hash + pub tx_hash: B256, } impl Default for TxEnv { @@ -226,6 +228,10 @@ impl Transaction for TxEnv { fn max_priority_fee_per_gas(&self) -> Option { self.gas_priority_fee } + + fn tx_hash(&self) -> B256 { + self.tx_hash + } } /// Builder for constructing [`TxEnv`] instances @@ -245,6 +251,7 @@ pub struct TxEnvBuilder { blob_hashes: Vec, max_fee_per_blob_gas: u128, authorization_list: Vec>, + tx_hash: B256, } impl TxEnvBuilder { @@ -265,6 +272,7 @@ impl TxEnvBuilder { blob_hashes: Vec::new(), max_fee_per_blob_gas: 0, authorization_list: Vec::new(), + tx_hash: B256::ZERO, } } @@ -374,6 +382,12 @@ impl TxEnvBuilder { self } + /// Set the transaction hash + pub fn tx_hash(mut self, tx_hash: B256) -> Self { + self.tx_hash = tx_hash; + self + } + /// Set the authorization list pub fn authorization_list( mut self, @@ -473,6 +487,7 @@ impl TxEnvBuilder { blob_hashes: self.blob_hashes, max_fee_per_blob_gas: self.max_fee_per_blob_gas, authorization_list: self.authorization_list, + tx_hash: self.tx_hash, }; // if tx_type is not set, derive it from fields and fix errors. @@ -565,6 +580,7 @@ impl TxEnvBuilder { blob_hashes: self.blob_hashes, max_fee_per_blob_gas: self.max_fee_per_blob_gas, authorization_list: self.authorization_list, + tx_hash: self.tx_hash, }; // Derive tx type from fields, if some fields are wrongly set it will return an error. @@ -626,6 +642,7 @@ impl TxEnv { blob_hashes, max_fee_per_blob_gas, authorization_list, + tx_hash, } = self; TxEnvBuilder::new() @@ -643,6 +660,7 @@ impl TxEnv { .blob_hashes(blob_hashes) .max_fee_per_blob_gas(max_fee_per_blob_gas) .authorization_list(authorization_list) + .tx_hash(tx_hash) } } diff --git a/crates/handler/src/frame.rs b/crates/handler/src/frame.rs index fa2cb1534a..6012dc41b2 100644 --- a/crates/handler/src/frame.rs +++ b/crates/handler/src/frame.rs @@ -3,6 +3,7 @@ use crate::item_or_result::FrameInitOrResult; use crate::{precompile_provider::PrecompileProvider, ItemOrResult}; use crate::{CallFrame, CreateFrame, FrameData, FrameResult}; use context::result::FromStringError; +use context::Transaction; use context_interface::context::ContextError; use context_interface::local::{FrameToken, OutFrame}; use context_interface::ContextTr; @@ -21,11 +22,12 @@ use interpreter::{ FrameInput, Gas, InputsImpl, InstructionResult, Interpreter, InterpreterAction, InterpreterResult, InterpreterTypes, SharedMemory, }; +use precompile::PrecompileId; use primitives::{ constants::CALL_STACK_LIMIT, hardfork::SpecId::{self, HOMESTEAD, LONDON, SPURIOUS_DRAGON}, }; -use primitives::{keccak256, Address, Bytes, U256}; +use primitives::{keccak256, Address, Bytes, B256, U256}; use state::Bytecode; use std::borrow::ToOwned; use std::boxed::Box; @@ -169,7 +171,6 @@ impl EthFrame { // Create subroutine checkpoint let checkpoint = ctx.journal_mut().checkpoint(); - // Touch address. For "EIP-158 State Clear", this will erase empty accounts. if let CallValue::Transfer(value) = inputs.value { // Transfer value from caller to called account @@ -183,7 +184,7 @@ impl EthFrame { } } - let interpreter_input = InputsImpl { + let mut interpreter_input = InputsImpl { target_address: inputs.target_address, caller_address: inputs.caller, bytecode_address: Some(inputs.bytecode_address), @@ -193,6 +194,17 @@ impl EthFrame { let is_static = inputs.is_static; let gas_limit = inputs.gas_limit; + // If the call's bytecode address is the TxHash precompile address, + // fetch the transaction hash from Tx and pass the hash to the + // interpreter by overwriting the interpreter_input's input with the hash. + if let Some(tx_hash_addr) = PrecompileId::TxHash.mainnet_address() { + if inputs.bytecode_address == tx_hash_addr { + let tx_hash = ctx.tx().tx_hash(); + interpreter_input.input = + CallInput::Bytes(Bytes::copy_from_slice(tx_hash.as_ref())); + } + } + if let Some(result) = precompiles .run( ctx, @@ -308,7 +320,7 @@ impl EthFrame { .journal_mut() .nonce_bump_journal_entry(inputs.caller); } - + // Create address let mut init_code_hash = None; let created_address = match inputs.scheme { diff --git a/crates/handler/src/pre_execution.rs b/crates/handler/src/pre_execution.rs index a8f59ec7b3..b69e469c04 100644 --- a/crates/handler/src/pre_execution.rs +++ b/crates/handler/src/pre_execution.rs @@ -174,7 +174,7 @@ pub fn validate_against_state_and_deduct_caller< caller_account.info.nonce = caller_account.info.nonce.saturating_add(1); } } - + journal.caller_accounting_journal_entry(tx.caller(), old_balance, tx.kind().is_call()); Ok(()) } diff --git a/crates/op-revm/src/transaction/abstraction.rs b/crates/op-revm/src/transaction/abstraction.rs index 2043f1ca0a..25123cd66d 100644 --- a/crates/op-revm/src/transaction/abstraction.rs +++ b/crates/op-revm/src/transaction/abstraction.rs @@ -187,6 +187,10 @@ impl Transaction for OpTransaction { fn authorization_list(&self) -> impl Iterator> { self.base.authorization_list() } + + fn tx_hash(&self) -> B256 { + self.base.tx_hash() + } } impl OpTxTr for OpTransaction { diff --git a/crates/precompile/src/id.rs b/crates/precompile/src/id.rs index 49c8259fff..7da3b322c6 100644 --- a/crates/precompile/src/id.rs +++ b/crates/precompile/src/id.rs @@ -1,6 +1,6 @@ use std::borrow::Cow; -use primitives::{address, Address}; +use primitives::{address, supra_constants::TX_HASH_ADDRESS, Address}; use crate::{Precompile, PrecompileSpecId}; @@ -44,6 +44,8 @@ pub enum PrecompileId { Bls12MapFp2ToGp2, /// ECDSA signature verification over the secp256r1 elliptic curve (also known as P-256 or prime256v1). P256Verify, + /// Transaction hash precompile. + TxHash, /// Custom precompile identifier. Custom(Cow<'static, str>), } @@ -78,6 +80,7 @@ impl PrecompileId { Self::Bls12MapFpToGp1 => address!("0x0000000000000000000000000000000000000010"), Self::Bls12MapFp2ToGp2 => address!("0x0000000000000000000000000000000000000011"), Self::P256Verify => address!("0x0000000000000000000000000000000000000012"), + Self::TxHash => TX_HASH_ADDRESS, Self::Custom(_) => return None, }; Some(address) @@ -104,6 +107,7 @@ impl PrecompileId { Self::Bls12MapFpToGp1 => "BLS12_MAP_FP_TO_G1", Self::Bls12MapFp2ToGp2 => "BLS12_MAP_FP2_TO_G2", Self::P256Verify => "P256VERIFY", + Self::TxHash => "TX_HASH", Self::Custom(a) => a.as_ref(), } } @@ -173,6 +177,7 @@ impl PrecompileId { crate::secp256r1::P256VERIFY_OSAKA } } + Self::TxHash => crate::tx_hash::TX_HASH, Self::Custom(_) => return None, }; diff --git a/crates/precompile/src/lib.rs b/crates/precompile/src/lib.rs index 92c420054f..ab97629bc8 100644 --- a/crates/precompile/src/lib.rs +++ b/crates/precompile/src/lib.rs @@ -21,6 +21,7 @@ pub mod kzg_point_evaluation; pub mod modexp; pub mod secp256k1; pub mod secp256r1; +pub mod tx_hash; pub mod utilities; pub use id::PrecompileId; @@ -195,6 +196,7 @@ impl Precompiles { INSTANCE.get_or_init(|| { let mut precompiles = Self::cancun().clone(); precompiles.extend(bls12_381::precompiles()); + precompiles.extend([tx_hash::TX_HASH]); precompiles }) } @@ -399,6 +401,7 @@ pub enum PrecompileSpecId { /// * `BLS12_PAIRING_CHECK` at address 0x0f /// * `BLS12_MAP_FP_TO_G1` at address 0x10 /// * `BLS12_MAP_FP2_TO_G2` at address 0x11 + /// * `TX_HASH` at address 0x53555001 PRAGUE, /// Osaka spec added changes to modexp precompile: /// * [`EIP-7823: Set upper bounds for MODEXP`](https://eips.ethereum.org/EIPS/eip-7823). diff --git a/crates/precompile/src/tx_hash.rs b/crates/precompile/src/tx_hash.rs new file mode 100644 index 0000000000..2083faf52a --- /dev/null +++ b/crates/precompile/src/tx_hash.rs @@ -0,0 +1,9 @@ +//! TX_HASH precompile is added to return the transaction hash of the +//! transaction +use primitives::supra_constants::TX_HASH_ADDRESS; + +use crate::{identity::identity_run, Precompile, PrecompileId}; + +/// TX_HASH precompile +pub const TX_HASH: Precompile = + Precompile::new(PrecompileId::TxHash, TX_HASH_ADDRESS, identity_run); diff --git a/crates/primitives/src/lib.rs b/crates/primitives/src/lib.rs index 8fb8bceeb2..fa711d736f 100644 --- a/crates/primitives/src/lib.rs +++ b/crates/primitives/src/lib.rs @@ -26,6 +26,7 @@ pub mod eip7907; pub mod eip7918; pub mod hardfork; mod once_lock; +pub mod supra_constants; pub use constants::*; pub use once_lock::OnceLock; diff --git a/crates/primitives/src/supra_constants.rs b/crates/primitives/src/supra_constants.rs new file mode 100644 index 0000000000..be9f1129f0 --- /dev/null +++ b/crates/primitives/src/supra_constants.rs @@ -0,0 +1,61 @@ +//! Constants defined by SUPRA to facilitate execution flow extensions. +use alloy_primitives::Address; + +/// Defines a constant of Address type for the input value with the specified name +#[macro_export] +macro_rules! define_reserved_addresses { + ( + $( + $doc:expr, + $name:ident = $value:expr + ),+ $(,)? + ) => { + $( + #[doc = $doc] + pub const $name: Address = $value; + )+ + }; +} + +/// Converts [`u64`] to [`Address`] type. +pub const fn u64_to_address(x: u64) -> Address { + let x = x.to_be_bytes(); + Address::new([ + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, x[0], x[1], x[2], x[3], x[4], x[5], x[6], x[7], + ]) +} + +/// Generates continues range of address. +/// - start is the start address +/// - N generic parameter specifying the length of the range from the specified start. +pub const fn generate_address_range(start: u64) -> [Address; N] { + let start_address = u64_to_address(start); + let mut reserved_addresses: [Address; N] = [start_address; N]; + let mut i = 1; + while i < N { + let address = u64_to_address(start + i as u64); + reserved_addresses[i]= address; + i += 1; + } + reserved_addresses +} + +/// [0x5355_5000, 0x53555_50FF] addresses are reserved as SUPRA special addresses. +pub const SUPRA_RESERVED_ADDRESSES: [Address; 0xFF] = generate_address_range::<0xff>(0x5355_5000); + +/// Checks whether specified input address is one of the SUPRA +pub fn is_supra_reserved(address: &Address) -> bool { + SUPRA_RESERVED_ADDRESSES.contains(address) +} + +/// Checks whether specified input address is SUPRA reserved VM_SIGNER +pub fn is_vm_signer(address: &Address) -> bool { + VM_SIGNER.eq(address) +} + +define_reserved_addresses!( + "Supra Reserved address for VM SIGNER", + VM_SIGNER = SUPRA_RESERVED_ADDRESSES[0], + "Supra Reserved address Precompile address to retrieve transaction hash", + TX_HASH_ADDRESS = SUPRA_RESERVED_ADDRESSES[1], +); diff --git a/crates/supra-extension/Cargo.toml b/crates/supra-extension/Cargo.toml new file mode 100644 index 0000000000..b0af7262c4 --- /dev/null +++ b/crates/supra-extension/Cargo.toml @@ -0,0 +1,37 @@ +[package] +name = "revm-supra-extension" +version = "0.1.0" +license.workspace = true +authors.workspace = true +categories.workspace = true +keywords.workspace = true +repository.workspace = true +documentation.workspace = true +homepage.workspace = true +edition.workspace = true +rust-version.workspace = true + +[dependencies] +alloy-sol-types = { workspace = true } +alloy-contract = { workspace = true } +alloy-consensus = { workspace = true } +alloy-eips = { workspace = true } +serde = { workspace = true } +alloy = { workspace = true } +derive_more = { workspace = true } +thiserror = { workspace = true } +primitives = { workspace = true } +context = { workspace = true } +alloy-serde = {workspace = true, optional = true } + +[lints] +workspace = true + + +[build-dependencies] +#forge = { workspace = true } +#clap = { workspace = true } +#shlex = { workspace = true } + +[features] +serde = ["alloy-serde"] diff --git a/crates/supra-extension/build.rs b/crates/supra-extension/build.rs new file mode 100644 index 0000000000..189a4ce76c --- /dev/null +++ b/crates/supra-extension/build.rs @@ -0,0 +1,49 @@ +use std::env; +use std::path::PathBuf; + + +fn main() { + // 1. Tell Cargo to rerun the script if the contracts directory changes + let cargo_dir = PathBuf::from( + env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR environment variable not set"), + ); + println!( + "cargo:rerun-if-changed={}/../../solidity/supra_contracts/src/SupraContractsBindings.sol", + cargo_dir.display() + ); + + // smr-moonshot referencing this version of the REVM has dependency conflicts caused by syn library used by forge. + // So unless the issue is fixed, rust bindings on updates of the SupraContractsBindings.sol will be regenerated manually + // and committed. This code should remain commented out otherwise + // To do it: + // - uncomment below code + // - uncomment build dependencies in Cargo.toml file of this project + // - uncomment forge library reference in top level Cargo.toml file + // - build the project + + + //// Determine the output directory for the generated bindings + //use clap::Parser; + //use forge::cmd::bind::BindArgs; + //let contracts_relative_path = PathBuf::from("../../solidity/supra_contracts"); + //let contracts_build_config = + // cargo_dir.join(contracts_relative_path.join(PathBuf::from("foundry.toml"))); + //let contract_names = "SupraContracts"; + + //let bindings_path = cargo_dir + // .join(PathBuf::from("src")) + // .join(PathBuf::from("supra_contract_bindings")); + + //// Ensure the output directory exists + //std::fs::create_dir_all(bindings_path.as_path()).expect("Failed to create bindings directory"); + //let command_inputs = format!( + // "bind --bindings-path {} --overwrite --module --select {} --alloy --config-path {}", + // bindings_path.display(), + // contract_names, + // contracts_build_config.display() + //); + //let parsed_inputs = shlex::split(&command_inputs).expect("Failed to parse command string"); + //let bind_cmd: BindArgs = + // BindArgs::try_parse_from(parsed_inputs).expect("Failed to parse command arguments"); + //bind_cmd.run().expect("Failed to execute bind command"); +} diff --git a/crates/supra-extension/src/errors.rs b/crates/supra-extension/src/errors.rs new file mode 100644 index 0000000000..3efdcdef47 --- /dev/null +++ b/crates/supra-extension/src/errors.rs @@ -0,0 +1,37 @@ +//! Errors reported in scope of supra-extension module. + +use thiserror::Error; + +/// Supra-extension error. +#[derive(Error, Debug)] +pub enum SupraExtensionError { + + /// Reported when transaction builder misses mandatory value to build final transaction. + #[error("Missing mandatory value: {0}::{1}")] + MissingBuilderValue(String, String), + + /// Reported on failure of automation task inner payload decode. + #[error("Failed to decode payload: {0}")] + PayloadDecode(#[from]alloy_sol_types::Error), + + /// Reported on failure of task state conversion to counterpart in native layer. + #[error("Invalid automation task state value: {0}, expected [0, 1, 2]")] + InvalidAutomationTaskStateValue(u8), + + /// Reported when automated transaction builder is attempted to be built for inactive task. + #[error("Attempt to create automated transaction builder for non-active task")] + InvalidAutomationTaskStateForBuilder +} + +/// Extracts value of the optional value or reports [`SupraExtensionError::MissingBuilderValue`]. +#[macro_export] +macro_rules! value_or_error { + ($tpy:ty, $name:literal, $value:expr) => { + match $value { + Some(v) => v, + None => { + return Err($crate::errors::SupraExtensionError::MissingBuilderValue(std::any::type_name::<$tpy>().to_string(), $name.to_string())); + } + } + }; +} \ No newline at end of file diff --git a/crates/supra-extension/src/lib.rs b/crates/supra-extension/src/lib.rs new file mode 100644 index 0000000000..6786119eb4 --- /dev/null +++ b/crates/supra-extension/src/lib.rs @@ -0,0 +1,8 @@ +//! # revm-supra-extension +//! Supra extensions of the transactions to support automation feature and block based checks + +#[allow(missing_docs, missing_debug_implementations)] +#[allow(elided_lifetimes_in_paths)] +pub mod supra_contract_bindings; +pub mod transactions; +pub mod errors; \ No newline at end of file diff --git a/crates/supra-extension/src/supra_contract_bindings/mod.rs b/crates/supra-extension/src/supra_contract_bindings/mod.rs new file mode 100644 index 0000000000..f95e49cc7a --- /dev/null +++ b/crates/supra-extension/src/supra_contract_bindings/mod.rs @@ -0,0 +1,6 @@ +#![allow(unused_imports, unused_attributes, clippy::all, rustdoc::all)] +//! This module contains the sol! generated bindings for solidity contracts. +//! This is autogenerated code. +//! Do not manually edit these files. +//! These files may be overwritten by the codegen system at any time. +pub mod r#supra_contracts_bindings; diff --git a/crates/supra-extension/src/supra_contract_bindings/supra_contracts_bindings.rs b/crates/supra-extension/src/supra_contract_bindings/supra_contracts_bindings.rs new file mode 100644 index 0000000000..506d67c488 --- /dev/null +++ b/crates/supra-extension/src/supra_contract_bindings/supra_contracts_bindings.rs @@ -0,0 +1,3595 @@ +///Module containing a contract's types and functions. +/** + +```solidity +library CommonUtils { + type CycleState is uint8; + type TaskState is uint8; + struct TaskDetails { uint128 maxGasAmount; uint128 gasPriceCap; uint128 automationFeeCapForCycle; uint128 lockedFeeForNextCycle; bytes32 txHash; uint64 taskIndex; uint64 registrationTime; uint64 expiryTime; address owner; TaskState state; bytes payloadTx; bytes[] auxData; } +} +```*/ +#[allow( + non_camel_case_types, + non_snake_case, + clippy::pub_underscore_fields, + clippy::style, + clippy::empty_structs_with_brackets +)] +pub mod CommonUtils { + use super::*; + use alloy::sol_types as alloy_sol_types; + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Default, Debug, PartialEq, Eq, Hash)] + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct CycleState(u8); + const _: () = { + use alloy::sol_types as alloy_sol_types; + #[automatically_derived] + impl alloy_sol_types::private::SolTypeValue for u8 { + #[inline] + fn stv_to_tokens( + &self, + ) -> as alloy_sol_types::SolType>::Token<'_> { + alloy_sol_types::private::SolTypeValue::< + alloy::sol_types::sol_data::Uint<8>, + >::stv_to_tokens(self) + } + #[inline] + fn stv_eip712_data_word(&self) -> alloy_sol_types::Word { + as alloy_sol_types::SolType>::tokenize(self) + .0 + } + #[inline] + fn stv_abi_encode_packed_to( + &self, + out: &mut alloy_sol_types::private::Vec, + ) { + as alloy_sol_types::SolType>::abi_encode_packed_to(self, out) + } + #[inline] + fn stv_abi_packed_encoded_size(&self) -> usize { + as alloy_sol_types::SolType>::abi_encoded_size(self) + } + } + impl CycleState { + /// The Solidity type name. + pub const NAME: &'static str = stringify!(@ name); + /// Convert from the underlying value type. + #[inline] + pub const fn from_underlying(value: u8) -> Self { + Self(value) + } + /// Return the underlying value. + #[inline] + pub const fn into_underlying(self) -> u8 { + self.0 + } + /// Return the single encoding of this value, delegating to the + /// underlying type. + #[inline] + pub fn abi_encode(&self) -> alloy_sol_types::private::Vec { + ::abi_encode(&self.0) + } + /// Return the packed encoding of this value, delegating to the + /// underlying type. + #[inline] + pub fn abi_encode_packed(&self) -> alloy_sol_types::private::Vec { + ::abi_encode_packed(&self.0) + } + } + #[automatically_derived] + impl From for CycleState { + fn from(value: u8) -> Self { + Self::from_underlying(value) + } + } + #[automatically_derived] + impl From for u8 { + fn from(value: CycleState) -> Self { + value.into_underlying() + } + } + #[automatically_derived] + impl alloy_sol_types::SolType for CycleState { + type RustType = u8; + type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; + const SOL_NAME: &'static str = Self::NAME; + const ENCODED_SIZE: Option = as alloy_sol_types::SolType>::ENCODED_SIZE; + const PACKED_ENCODED_SIZE: Option = as alloy_sol_types::SolType>::PACKED_ENCODED_SIZE; + #[inline] + fn valid_token(token: &Self::Token<'_>) -> bool { + Self::type_check(token).is_ok() + } + #[inline] + fn type_check(token: &Self::Token<'_>) -> alloy_sol_types::Result<()> { + as alloy_sol_types::SolType>::type_check(token) + } + #[inline] + fn detokenize(token: Self::Token<'_>) -> Self::RustType { + as alloy_sol_types::SolType>::detokenize(token) + } + } + #[automatically_derived] + impl alloy_sol_types::EventTopic for CycleState { + #[inline] + fn topic_preimage_length(rust: &Self::RustType) -> usize { + as alloy_sol_types::EventTopic>::topic_preimage_length(rust) + } + #[inline] + fn encode_topic_preimage( + rust: &Self::RustType, + out: &mut alloy_sol_types::private::Vec, + ) { + as alloy_sol_types::EventTopic>::encode_topic_preimage(rust, out) + } + #[inline] + fn encode_topic( + rust: &Self::RustType, + ) -> alloy_sol_types::abi::token::WordToken { + as alloy_sol_types::EventTopic>::encode_topic(rust) + } + } + }; + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Default, Debug, PartialEq, Eq, Hash)] + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct TaskState(u8); + const _: () = { + use alloy::sol_types as alloy_sol_types; + #[automatically_derived] + impl alloy_sol_types::private::SolTypeValue for u8 { + #[inline] + fn stv_to_tokens( + &self, + ) -> as alloy_sol_types::SolType>::Token<'_> { + alloy_sol_types::private::SolTypeValue::< + alloy::sol_types::sol_data::Uint<8>, + >::stv_to_tokens(self) + } + #[inline] + fn stv_eip712_data_word(&self) -> alloy_sol_types::Word { + as alloy_sol_types::SolType>::tokenize(self) + .0 + } + #[inline] + fn stv_abi_encode_packed_to( + &self, + out: &mut alloy_sol_types::private::Vec, + ) { + as alloy_sol_types::SolType>::abi_encode_packed_to(self, out) + } + #[inline] + fn stv_abi_packed_encoded_size(&self) -> usize { + as alloy_sol_types::SolType>::abi_encoded_size(self) + } + } + impl TaskState { + /// The Solidity type name. + pub const NAME: &'static str = stringify!(@ name); + /// Convert from the underlying value type. + #[inline] + pub const fn from_underlying(value: u8) -> Self { + Self(value) + } + /// Return the underlying value. + #[inline] + pub const fn into_underlying(self) -> u8 { + self.0 + } + /// Return the single encoding of this value, delegating to the + /// underlying type. + #[inline] + pub fn abi_encode(&self) -> alloy_sol_types::private::Vec { + ::abi_encode(&self.0) + } + /// Return the packed encoding of this value, delegating to the + /// underlying type. + #[inline] + pub fn abi_encode_packed(&self) -> alloy_sol_types::private::Vec { + ::abi_encode_packed(&self.0) + } + } + #[automatically_derived] + impl From for TaskState { + fn from(value: u8) -> Self { + Self::from_underlying(value) + } + } + #[automatically_derived] + impl From for u8 { + fn from(value: TaskState) -> Self { + value.into_underlying() + } + } + #[automatically_derived] + impl alloy_sol_types::SolType for TaskState { + type RustType = u8; + type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; + const SOL_NAME: &'static str = Self::NAME; + const ENCODED_SIZE: Option = as alloy_sol_types::SolType>::ENCODED_SIZE; + const PACKED_ENCODED_SIZE: Option = as alloy_sol_types::SolType>::PACKED_ENCODED_SIZE; + #[inline] + fn valid_token(token: &Self::Token<'_>) -> bool { + Self::type_check(token).is_ok() + } + #[inline] + fn type_check(token: &Self::Token<'_>) -> alloy_sol_types::Result<()> { + as alloy_sol_types::SolType>::type_check(token) + } + #[inline] + fn detokenize(token: Self::Token<'_>) -> Self::RustType { + as alloy_sol_types::SolType>::detokenize(token) + } + } + #[automatically_derived] + impl alloy_sol_types::EventTopic for TaskState { + #[inline] + fn topic_preimage_length(rust: &Self::RustType) -> usize { + as alloy_sol_types::EventTopic>::topic_preimage_length(rust) + } + #[inline] + fn encode_topic_preimage( + rust: &Self::RustType, + out: &mut alloy_sol_types::private::Vec, + ) { + as alloy_sol_types::EventTopic>::encode_topic_preimage(rust, out) + } + #[inline] + fn encode_topic( + rust: &Self::RustType, + ) -> alloy_sol_types::abi::token::WordToken { + as alloy_sol_types::EventTopic>::encode_topic(rust) + } + } + }; + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Default, Debug, PartialEq, Eq, Hash)] + /**```solidity +struct TaskDetails { uint128 maxGasAmount; uint128 gasPriceCap; uint128 automationFeeCapForCycle; uint128 lockedFeeForNextCycle; bytes32 txHash; uint64 taskIndex; uint64 registrationTime; uint64 expiryTime; address owner; TaskState state; bytes payloadTx; bytes[] auxData; } +```*/ + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct TaskDetails { + #[allow(missing_docs)] + pub maxGasAmount: u128, + #[allow(missing_docs)] + pub gasPriceCap: u128, + #[allow(missing_docs)] + pub automationFeeCapForCycle: u128, + #[allow(missing_docs)] + pub lockedFeeForNextCycle: u128, + #[allow(missing_docs)] + pub txHash: alloy::sol_types::private::FixedBytes<32>, + #[allow(missing_docs)] + pub taskIndex: u64, + #[allow(missing_docs)] + pub registrationTime: u64, + #[allow(missing_docs)] + pub expiryTime: u64, + #[allow(missing_docs)] + pub owner: alloy::sol_types::private::Address, + #[allow(missing_docs)] + pub state: ::RustType, + #[allow(missing_docs)] + pub payloadTx: alloy::sol_types::private::Bytes, + #[allow(missing_docs)] + pub auxData: alloy::sol_types::private::Vec, + } + #[allow( + non_camel_case_types, + non_snake_case, + clippy::pub_underscore_fields, + clippy::style + )] + const _: () = { + use alloy::sol_types as alloy_sol_types; + #[doc(hidden)] + #[allow(dead_code)] + type UnderlyingSolTuple<'a> = ( + alloy::sol_types::sol_data::Uint<128>, + alloy::sol_types::sol_data::Uint<128>, + alloy::sol_types::sol_data::Uint<128>, + alloy::sol_types::sol_data::Uint<128>, + alloy::sol_types::sol_data::FixedBytes<32>, + alloy::sol_types::sol_data::Uint<64>, + alloy::sol_types::sol_data::Uint<64>, + alloy::sol_types::sol_data::Uint<64>, + alloy::sol_types::sol_data::Address, + TaskState, + alloy::sol_types::sol_data::Bytes, + alloy::sol_types::sol_data::Array, + ); + #[doc(hidden)] + type UnderlyingRustTuple<'a> = ( + u128, + u128, + u128, + u128, + alloy::sol_types::private::FixedBytes<32>, + u64, + u64, + u64, + alloy::sol_types::private::Address, + ::RustType, + alloy::sol_types::private::Bytes, + alloy::sol_types::private::Vec, + ); + #[cfg(test)] + #[allow(dead_code, unreachable_patterns)] + fn _type_assertion( + _t: alloy_sol_types::private::AssertTypeEq, + ) { + match _t { + alloy_sol_types::private::AssertTypeEq::< + ::RustType, + >(_) => {} + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From for UnderlyingRustTuple<'_> { + fn from(value: TaskDetails) -> Self { + ( + value.maxGasAmount, + value.gasPriceCap, + value.automationFeeCapForCycle, + value.lockedFeeForNextCycle, + value.txHash, + value.taskIndex, + value.registrationTime, + value.expiryTime, + value.owner, + value.state, + value.payloadTx, + value.auxData, + ) + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From> for TaskDetails { + fn from(tuple: UnderlyingRustTuple<'_>) -> Self { + Self { + maxGasAmount: tuple.0, + gasPriceCap: tuple.1, + automationFeeCapForCycle: tuple.2, + lockedFeeForNextCycle: tuple.3, + txHash: tuple.4, + taskIndex: tuple.5, + registrationTime: tuple.6, + expiryTime: tuple.7, + owner: tuple.8, + state: tuple.9, + payloadTx: tuple.10, + auxData: tuple.11, + } + } + } + #[automatically_derived] + impl alloy_sol_types::SolValue for TaskDetails { + type SolType = Self; + } + #[automatically_derived] + impl alloy_sol_types::private::SolTypeValue for TaskDetails { + #[inline] + fn stv_to_tokens(&self) -> ::Token<'_> { + ( + as alloy_sol_types::SolType>::tokenize(&self.maxGasAmount), + as alloy_sol_types::SolType>::tokenize(&self.gasPriceCap), + as alloy_sol_types::SolType>::tokenize( + &self.automationFeeCapForCycle, + ), + as alloy_sol_types::SolType>::tokenize( + &self.lockedFeeForNextCycle, + ), + as alloy_sol_types::SolType>::tokenize(&self.txHash), + as alloy_sol_types::SolType>::tokenize(&self.taskIndex), + as alloy_sol_types::SolType>::tokenize(&self.registrationTime), + as alloy_sol_types::SolType>::tokenize(&self.expiryTime), + ::tokenize( + &self.owner, + ), + ::tokenize(&self.state), + ::tokenize( + &self.payloadTx, + ), + as alloy_sol_types::SolType>::tokenize(&self.auxData), + ) + } + #[inline] + fn stv_abi_encoded_size(&self) -> usize { + if let Some(size) = ::ENCODED_SIZE { + return size; + } + let tuple = as ::core::convert::From>::from(self.clone()); + as alloy_sol_types::SolType>::abi_encoded_size(&tuple) + } + #[inline] + fn stv_eip712_data_word(&self) -> alloy_sol_types::Word { + ::eip712_hash_struct(self) + } + #[inline] + fn stv_abi_encode_packed_to( + &self, + out: &mut alloy_sol_types::private::Vec, + ) { + let tuple = as ::core::convert::From>::from(self.clone()); + as alloy_sol_types::SolType>::abi_encode_packed_to(&tuple, out) + } + #[inline] + fn stv_abi_packed_encoded_size(&self) -> usize { + if let Some(size) = ::PACKED_ENCODED_SIZE { + return size; + } + let tuple = as ::core::convert::From>::from(self.clone()); + as alloy_sol_types::SolType>::abi_packed_encoded_size(&tuple) + } + } + #[automatically_derived] + impl alloy_sol_types::SolType for TaskDetails { + type RustType = Self; + type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; + const SOL_NAME: &'static str = ::NAME; + const ENCODED_SIZE: Option = as alloy_sol_types::SolType>::ENCODED_SIZE; + const PACKED_ENCODED_SIZE: Option = as alloy_sol_types::SolType>::PACKED_ENCODED_SIZE; + #[inline] + fn valid_token(token: &Self::Token<'_>) -> bool { + as alloy_sol_types::SolType>::valid_token(token) + } + #[inline] + fn detokenize(token: Self::Token<'_>) -> Self::RustType { + let tuple = as alloy_sol_types::SolType>::detokenize(token); + >>::from(tuple) + } + } + #[automatically_derived] + impl alloy_sol_types::SolStruct for TaskDetails { + const NAME: &'static str = "TaskDetails"; + #[inline] + fn eip712_root_type() -> alloy_sol_types::private::Cow<'static, str> { + alloy_sol_types::private::Cow::Borrowed( + "TaskDetails(uint128 maxGasAmount,uint128 gasPriceCap,uint128 automationFeeCapForCycle,uint128 lockedFeeForNextCycle,bytes32 txHash,uint64 taskIndex,uint64 registrationTime,uint64 expiryTime,address owner,uint8 state,bytes payloadTx,bytes[] auxData)", + ) + } + #[inline] + fn eip712_components() -> alloy_sol_types::private::Vec< + alloy_sol_types::private::Cow<'static, str>, + > { + alloy_sol_types::private::Vec::new() + } + #[inline] + fn eip712_encode_type() -> alloy_sol_types::private::Cow<'static, str> { + ::eip712_root_type() + } + #[inline] + fn eip712_encode_data(&self) -> alloy_sol_types::private::Vec { + [ + as alloy_sol_types::SolType>::eip712_data_word(&self.maxGasAmount) + .0, + as alloy_sol_types::SolType>::eip712_data_word(&self.gasPriceCap) + .0, + as alloy_sol_types::SolType>::eip712_data_word( + &self.automationFeeCapForCycle, + ) + .0, + as alloy_sol_types::SolType>::eip712_data_word( + &self.lockedFeeForNextCycle, + ) + .0, + as alloy_sol_types::SolType>::eip712_data_word(&self.txHash) + .0, + as alloy_sol_types::SolType>::eip712_data_word(&self.taskIndex) + .0, + as alloy_sol_types::SolType>::eip712_data_word( + &self.registrationTime, + ) + .0, + as alloy_sol_types::SolType>::eip712_data_word(&self.expiryTime) + .0, + ::eip712_data_word( + &self.owner, + ) + .0, + ::eip712_data_word( + &self.state, + ) + .0, + ::eip712_data_word( + &self.payloadTx, + ) + .0, + as alloy_sol_types::SolType>::eip712_data_word(&self.auxData) + .0, + ] + .concat() + } + } + #[automatically_derived] + impl alloy_sol_types::EventTopic for TaskDetails { + #[inline] + fn topic_preimage_length(rust: &Self::RustType) -> usize { + 0usize + + as alloy_sol_types::EventTopic>::topic_preimage_length( + &rust.maxGasAmount, + ) + + as alloy_sol_types::EventTopic>::topic_preimage_length( + &rust.gasPriceCap, + ) + + as alloy_sol_types::EventTopic>::topic_preimage_length( + &rust.automationFeeCapForCycle, + ) + + as alloy_sol_types::EventTopic>::topic_preimage_length( + &rust.lockedFeeForNextCycle, + ) + + as alloy_sol_types::EventTopic>::topic_preimage_length( + &rust.txHash, + ) + + as alloy_sol_types::EventTopic>::topic_preimage_length( + &rust.taskIndex, + ) + + as alloy_sol_types::EventTopic>::topic_preimage_length( + &rust.registrationTime, + ) + + as alloy_sol_types::EventTopic>::topic_preimage_length( + &rust.expiryTime, + ) + + ::topic_preimage_length( + &rust.owner, + ) + + ::topic_preimage_length( + &rust.state, + ) + + ::topic_preimage_length( + &rust.payloadTx, + ) + + as alloy_sol_types::EventTopic>::topic_preimage_length( + &rust.auxData, + ) + } + #[inline] + fn encode_topic_preimage( + rust: &Self::RustType, + out: &mut alloy_sol_types::private::Vec, + ) { + out.reserve( + ::topic_preimage_length(rust), + ); + as alloy_sol_types::EventTopic>::encode_topic_preimage( + &rust.maxGasAmount, + out, + ); + as alloy_sol_types::EventTopic>::encode_topic_preimage( + &rust.gasPriceCap, + out, + ); + as alloy_sol_types::EventTopic>::encode_topic_preimage( + &rust.automationFeeCapForCycle, + out, + ); + as alloy_sol_types::EventTopic>::encode_topic_preimage( + &rust.lockedFeeForNextCycle, + out, + ); + as alloy_sol_types::EventTopic>::encode_topic_preimage( + &rust.txHash, + out, + ); + as alloy_sol_types::EventTopic>::encode_topic_preimage( + &rust.taskIndex, + out, + ); + as alloy_sol_types::EventTopic>::encode_topic_preimage( + &rust.registrationTime, + out, + ); + as alloy_sol_types::EventTopic>::encode_topic_preimage( + &rust.expiryTime, + out, + ); + ::encode_topic_preimage( + &rust.owner, + out, + ); + ::encode_topic_preimage( + &rust.state, + out, + ); + ::encode_topic_preimage( + &rust.payloadTx, + out, + ); + as alloy_sol_types::EventTopic>::encode_topic_preimage( + &rust.auxData, + out, + ); + } + #[inline] + fn encode_topic( + rust: &Self::RustType, + ) -> alloy_sol_types::abi::token::WordToken { + let mut out = alloy_sol_types::private::Vec::new(); + ::encode_topic_preimage( + rust, + &mut out, + ); + alloy_sol_types::abi::token::WordToken( + alloy_sol_types::private::keccak256(out), + ) + } + } + }; + use alloy::contract as alloy_contract; + /**Creates a new wrapper around an on-chain [`CommonUtils`](self) contract instance. + +See the [wrapper's documentation](`CommonUtilsInstance`) for more details.*/ + #[inline] + pub const fn new< + P: alloy_contract::private::Provider, + N: alloy_contract::private::Network, + >( + address: alloy_sol_types::private::Address, + __provider: P, + ) -> CommonUtilsInstance { + CommonUtilsInstance::::new(address, __provider) + } + /**A [`CommonUtils`](self) instance. + +Contains type-safe methods for interacting with an on-chain instance of the +[`CommonUtils`](self) contract located at a given `address`, using a given +provider `P`. + +If the contract bytecode is available (see the [`sol!`](alloy_sol_types::sol!) +documentation on how to provide it), the `deploy` and `deploy_builder` methods can +be used to deploy a new instance of the contract. + +See the [module-level documentation](self) for all the available methods.*/ + #[derive(Clone)] + pub struct CommonUtilsInstance { + address: alloy_sol_types::private::Address, + provider: P, + _network: ::core::marker::PhantomData, + } + #[automatically_derived] + impl ::core::fmt::Debug for CommonUtilsInstance { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_tuple("CommonUtilsInstance").field(&self.address).finish() + } + } + /// Instantiation and getters/setters. + impl< + P: alloy_contract::private::Provider, + N: alloy_contract::private::Network, + > CommonUtilsInstance { + /**Creates a new wrapper around an on-chain [`CommonUtils`](self) contract instance. + +See the [wrapper's documentation](`CommonUtilsInstance`) for more details.*/ + #[inline] + pub const fn new( + address: alloy_sol_types::private::Address, + __provider: P, + ) -> Self { + Self { + address, + provider: __provider, + _network: ::core::marker::PhantomData, + } + } + /// Returns a reference to the address. + #[inline] + pub const fn address(&self) -> &alloy_sol_types::private::Address { + &self.address + } + /// Sets the address. + #[inline] + pub fn set_address(&mut self, address: alloy_sol_types::private::Address) { + self.address = address; + } + /// Sets the address and returns `self`. + pub fn at(mut self, address: alloy_sol_types::private::Address) -> Self { + self.set_address(address); + self + } + /// Returns a reference to the provider. + #[inline] + pub const fn provider(&self) -> &P { + &self.provider + } + } + impl CommonUtilsInstance<&P, N> { + /// Clones the provider and returns a new instance with the cloned provider. + #[inline] + pub fn with_cloned_provider(self) -> CommonUtilsInstance { + CommonUtilsInstance { + address: self.address, + provider: ::core::clone::Clone::clone(&self.provider), + _network: ::core::marker::PhantomData, + } + } + } + /// Function calls. + impl< + P: alloy_contract::private::Provider, + N: alloy_contract::private::Network, + > CommonUtilsInstance { + /// Creates a new call builder using this contract instance's provider and address. + /// + /// Note that the call can be any function call, not just those defined in this + /// contract. Prefer using the other methods for building type-safe contract calls. + pub fn call_builder( + &self, + call: &C, + ) -> alloy_contract::SolCallBuilder<&P, C, N> { + alloy_contract::SolCallBuilder::new_sol(&self.provider, &self.address, call) + } + } + /// Event filters. + impl< + P: alloy_contract::private::Provider, + N: alloy_contract::private::Network, + > CommonUtilsInstance { + /// Creates a new event filter using this contract instance's provider and address. + /// + /// Note that the type can be any event, not just those defined in this contract. + /// Prefer using the other methods for building type-safe event filters. + pub fn event_filter( + &self, + ) -> alloy_contract::Event<&P, E, N> { + alloy_contract::Event::new_sol(&self.provider, &self.address) + } + } +} +/** + +Generated by the following Solidity interface... +```solidity +library CommonUtils { + type CycleState is uint8; + type TaskState is uint8; + struct TaskDetails { + uint128 maxGasAmount; + uint128 gasPriceCap; + uint128 automationFeeCapForCycle; + uint128 lockedFeeForNextCycle; + bytes32 txHash; + uint64 taskIndex; + uint64 registrationTime; + uint64 expiryTime; + address owner; + TaskState state; + bytes payloadTx; + bytes[] auxData; + } +} + +interface SupraContractsBindings { + function blockPrologue() external; + function getAllActiveTaskIds() external view returns (uint256[] memory); + function getCycleInfo() external view returns (uint64, uint64, uint64, CommonUtils.CycleState); + function getTaskDetails(uint64 _taskIndex) external view returns (CommonUtils.TaskDetails memory); + function getTaskDetailsBulk(uint64[] memory _taskIndexes) external view returns (CommonUtils.TaskDetails[] memory); + function getTaskIdList() external view returns (uint256[] memory); + function getTransitionInfo() external view returns (uint64, uint128); + function ifTaskExists(uint64 _taskIndex) external view returns (bool); + function isAutomationEnabled() external view returns (bool); + function processTasks(uint64 _cycleIndex, uint64[] memory _taskIndexes) external; +} +``` + +...which was generated by the following JSON ABI: +```json +[ + { + "type": "function", + "name": "blockPrologue", + "inputs": [], + "outputs": [], + "stateMutability": "nonpayable" + }, + { + "type": "function", + "name": "getAllActiveTaskIds", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256[]", + "internalType": "uint256[]" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getCycleInfo", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint64", + "internalType": "uint64" + }, + { + "name": "", + "type": "uint64", + "internalType": "uint64" + }, + { + "name": "", + "type": "uint64", + "internalType": "uint64" + }, + { + "name": "", + "type": "uint8", + "internalType": "enum CommonUtils.CycleState" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getTaskDetails", + "inputs": [ + { + "name": "_taskIndex", + "type": "uint64", + "internalType": "uint64" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple", + "internalType": "struct CommonUtils.TaskDetails", + "components": [ + { + "name": "maxGasAmount", + "type": "uint128", + "internalType": "uint128" + }, + { + "name": "gasPriceCap", + "type": "uint128", + "internalType": "uint128" + }, + { + "name": "automationFeeCapForCycle", + "type": "uint128", + "internalType": "uint128" + }, + { + "name": "lockedFeeForNextCycle", + "type": "uint128", + "internalType": "uint128" + }, + { + "name": "txHash", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "taskIndex", + "type": "uint64", + "internalType": "uint64" + }, + { + "name": "registrationTime", + "type": "uint64", + "internalType": "uint64" + }, + { + "name": "expiryTime", + "type": "uint64", + "internalType": "uint64" + }, + { + "name": "owner", + "type": "address", + "internalType": "address" + }, + { + "name": "state", + "type": "uint8", + "internalType": "enum CommonUtils.TaskState" + }, + { + "name": "payloadTx", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "auxData", + "type": "bytes[]", + "internalType": "bytes[]" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getTaskDetailsBulk", + "inputs": [ + { + "name": "_taskIndexes", + "type": "uint64[]", + "internalType": "uint64[]" + } + ], + "outputs": [ + { + "name": "", + "type": "tuple[]", + "internalType": "struct CommonUtils.TaskDetails[]", + "components": [ + { + "name": "maxGasAmount", + "type": "uint128", + "internalType": "uint128" + }, + { + "name": "gasPriceCap", + "type": "uint128", + "internalType": "uint128" + }, + { + "name": "automationFeeCapForCycle", + "type": "uint128", + "internalType": "uint128" + }, + { + "name": "lockedFeeForNextCycle", + "type": "uint128", + "internalType": "uint128" + }, + { + "name": "txHash", + "type": "bytes32", + "internalType": "bytes32" + }, + { + "name": "taskIndex", + "type": "uint64", + "internalType": "uint64" + }, + { + "name": "registrationTime", + "type": "uint64", + "internalType": "uint64" + }, + { + "name": "expiryTime", + "type": "uint64", + "internalType": "uint64" + }, + { + "name": "owner", + "type": "address", + "internalType": "address" + }, + { + "name": "state", + "type": "uint8", + "internalType": "enum CommonUtils.TaskState" + }, + { + "name": "payloadTx", + "type": "bytes", + "internalType": "bytes" + }, + { + "name": "auxData", + "type": "bytes[]", + "internalType": "bytes[]" + } + ] + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getTaskIdList", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint256[]", + "internalType": "uint256[]" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "getTransitionInfo", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "uint64", + "internalType": "uint64" + }, + { + "name": "", + "type": "uint128", + "internalType": "uint128" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "ifTaskExists", + "inputs": [ + { + "name": "_taskIndex", + "type": "uint64", + "internalType": "uint64" + } + ], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "isAutomationEnabled", + "inputs": [], + "outputs": [ + { + "name": "", + "type": "bool", + "internalType": "bool" + } + ], + "stateMutability": "view" + }, + { + "type": "function", + "name": "processTasks", + "inputs": [ + { + "name": "_cycleIndex", + "type": "uint64", + "internalType": "uint64" + }, + { + "name": "_taskIndexes", + "type": "uint64[]", + "internalType": "uint64[]" + } + ], + "outputs": [], + "stateMutability": "nonpayable" + } +] +```*/ +#[allow( + non_camel_case_types, + non_snake_case, + clippy::pub_underscore_fields, + clippy::style, + clippy::empty_structs_with_brackets +)] +pub mod SupraContractsBindings { + use super::*; + use alloy::sol_types as alloy_sol_types; + /// The creation / init bytecode of the contract. + /// + /// ```text + ///0x + /// ``` + #[rustfmt::skip] + #[allow(clippy::all)] + pub static BYTECODE: alloy_sol_types::private::Bytes = alloy_sol_types::private::Bytes::from_static( + b"", + ); + /// The runtime bytecode of the contract, as deployed on the network. + /// + /// ```text + ///0x + /// ``` + #[rustfmt::skip] + #[allow(clippy::all)] + pub static DEPLOYED_BYTECODE: alloy_sol_types::private::Bytes = alloy_sol_types::private::Bytes::from_static( + b"", + ); + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Default, Debug, PartialEq, Eq, Hash)] + /**Function with signature `blockPrologue()` and selector `0x7ded091b`. +```solidity +function blockPrologue() external; +```*/ + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct blockPrologueCall; + ///Container type for the return parameters of the [`blockPrologue()`](blockPrologueCall) function. + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct blockPrologueReturn {} + #[allow( + non_camel_case_types, + non_snake_case, + clippy::pub_underscore_fields, + clippy::style + )] + const _: () = { + use alloy::sol_types as alloy_sol_types; + { + #[doc(hidden)] + #[allow(dead_code)] + type UnderlyingSolTuple<'a> = (); + #[doc(hidden)] + type UnderlyingRustTuple<'a> = (); + #[cfg(test)] + #[allow(dead_code, unreachable_patterns)] + fn _type_assertion( + _t: alloy_sol_types::private::AssertTypeEq, + ) { + match _t { + alloy_sol_types::private::AssertTypeEq::< + ::RustType, + >(_) => {} + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From for UnderlyingRustTuple<'_> { + fn from(value: blockPrologueCall) -> Self { + () + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From> for blockPrologueCall { + fn from(tuple: UnderlyingRustTuple<'_>) -> Self { + Self + } + } + } + { + #[doc(hidden)] + #[allow(dead_code)] + type UnderlyingSolTuple<'a> = (); + #[doc(hidden)] + type UnderlyingRustTuple<'a> = (); + #[cfg(test)] + #[allow(dead_code, unreachable_patterns)] + fn _type_assertion( + _t: alloy_sol_types::private::AssertTypeEq, + ) { + match _t { + alloy_sol_types::private::AssertTypeEq::< + ::RustType, + >(_) => {} + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From for UnderlyingRustTuple<'_> { + fn from(value: blockPrologueReturn) -> Self { + () + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From> for blockPrologueReturn { + fn from(tuple: UnderlyingRustTuple<'_>) -> Self { + Self {} + } + } + } + impl blockPrologueReturn { + fn _tokenize( + &self, + ) -> ::ReturnToken<'_> { + () + } + } + #[automatically_derived] + impl alloy_sol_types::SolCall for blockPrologueCall { + type Parameters<'a> = (); + type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; + type Return = blockPrologueReturn; + type ReturnTuple<'a> = (); + type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; + const SIGNATURE: &'static str = "blockPrologue()"; + const SELECTOR: [u8; 4] = [125u8, 237u8, 9u8, 27u8]; + #[inline] + fn new<'a>( + tuple: as alloy_sol_types::SolType>::RustType, + ) -> Self { + tuple.into() + } + #[inline] + fn tokenize(&self) -> Self::Token<'_> { + () + } + #[inline] + fn tokenize_returns(ret: &Self::Return) -> Self::ReturnToken<'_> { + blockPrologueReturn::_tokenize(ret) + } + #[inline] + fn abi_decode_returns(data: &[u8]) -> alloy_sol_types::Result { + as alloy_sol_types::SolType>::abi_decode_sequence(data) + .map(Into::into) + } + #[inline] + fn abi_decode_returns_validate( + data: &[u8], + ) -> alloy_sol_types::Result { + as alloy_sol_types::SolType>::abi_decode_sequence_validate(data) + .map(Into::into) + } + } + }; + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Default, Debug, PartialEq, Eq, Hash)] + /**Function with signature `getAllActiveTaskIds()` and selector `0xc5dcf6ac`. +```solidity +function getAllActiveTaskIds() external view returns (uint256[] memory); +```*/ + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct getAllActiveTaskIdsCall; + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Default, Debug, PartialEq, Eq, Hash)] + ///Container type for the return parameters of the [`getAllActiveTaskIds()`](getAllActiveTaskIdsCall) function. + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct getAllActiveTaskIdsReturn { + #[allow(missing_docs)] + pub _0: alloy::sol_types::private::Vec< + alloy::sol_types::private::primitives::aliases::U256, + >, + } + #[allow( + non_camel_case_types, + non_snake_case, + clippy::pub_underscore_fields, + clippy::style + )] + const _: () = { + use alloy::sol_types as alloy_sol_types; + { + #[doc(hidden)] + #[allow(dead_code)] + type UnderlyingSolTuple<'a> = (); + #[doc(hidden)] + type UnderlyingRustTuple<'a> = (); + #[cfg(test)] + #[allow(dead_code, unreachable_patterns)] + fn _type_assertion( + _t: alloy_sol_types::private::AssertTypeEq, + ) { + match _t { + alloy_sol_types::private::AssertTypeEq::< + ::RustType, + >(_) => {} + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From + for UnderlyingRustTuple<'_> { + fn from(value: getAllActiveTaskIdsCall) -> Self { + () + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From> + for getAllActiveTaskIdsCall { + fn from(tuple: UnderlyingRustTuple<'_>) -> Self { + Self + } + } + } + { + #[doc(hidden)] + #[allow(dead_code)] + type UnderlyingSolTuple<'a> = ( + alloy::sol_types::sol_data::Array>, + ); + #[doc(hidden)] + type UnderlyingRustTuple<'a> = ( + alloy::sol_types::private::Vec< + alloy::sol_types::private::primitives::aliases::U256, + >, + ); + #[cfg(test)] + #[allow(dead_code, unreachable_patterns)] + fn _type_assertion( + _t: alloy_sol_types::private::AssertTypeEq, + ) { + match _t { + alloy_sol_types::private::AssertTypeEq::< + ::RustType, + >(_) => {} + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From + for UnderlyingRustTuple<'_> { + fn from(value: getAllActiveTaskIdsReturn) -> Self { + (value._0,) + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From> + for getAllActiveTaskIdsReturn { + fn from(tuple: UnderlyingRustTuple<'_>) -> Self { + Self { _0: tuple.0 } + } + } + } + #[automatically_derived] + impl alloy_sol_types::SolCall for getAllActiveTaskIdsCall { + type Parameters<'a> = (); + type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; + type Return = alloy::sol_types::private::Vec< + alloy::sol_types::private::primitives::aliases::U256, + >; + type ReturnTuple<'a> = ( + alloy::sol_types::sol_data::Array>, + ); + type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; + const SIGNATURE: &'static str = "getAllActiveTaskIds()"; + const SELECTOR: [u8; 4] = [197u8, 220u8, 246u8, 172u8]; + #[inline] + fn new<'a>( + tuple: as alloy_sol_types::SolType>::RustType, + ) -> Self { + tuple.into() + } + #[inline] + fn tokenize(&self) -> Self::Token<'_> { + () + } + #[inline] + fn tokenize_returns(ret: &Self::Return) -> Self::ReturnToken<'_> { + ( + , + > as alloy_sol_types::SolType>::tokenize(ret), + ) + } + #[inline] + fn abi_decode_returns(data: &[u8]) -> alloy_sol_types::Result { + as alloy_sol_types::SolType>::abi_decode_sequence(data) + .map(|r| { + let r: getAllActiveTaskIdsReturn = r.into(); + r._0 + }) + } + #[inline] + fn abi_decode_returns_validate( + data: &[u8], + ) -> alloy_sol_types::Result { + as alloy_sol_types::SolType>::abi_decode_sequence_validate(data) + .map(|r| { + let r: getAllActiveTaskIdsReturn = r.into(); + r._0 + }) + } + } + }; + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Default, Debug, PartialEq, Eq, Hash)] + /**Function with signature `getCycleInfo()` and selector `0x873dc71d`. +```solidity +function getCycleInfo() external view returns (uint64, uint64, uint64, CommonUtils.CycleState); +```*/ + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct getCycleInfoCall; + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Default, Debug, PartialEq, Eq, Hash)] + ///Container type for the return parameters of the [`getCycleInfo()`](getCycleInfoCall) function. + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct getCycleInfoReturn { + #[allow(missing_docs)] + pub _0: u64, + #[allow(missing_docs)] + pub _1: u64, + #[allow(missing_docs)] + pub _2: u64, + #[allow(missing_docs)] + pub _3: ::RustType, + } + #[allow( + non_camel_case_types, + non_snake_case, + clippy::pub_underscore_fields, + clippy::style + )] + const _: () = { + use alloy::sol_types as alloy_sol_types; + { + #[doc(hidden)] + #[allow(dead_code)] + type UnderlyingSolTuple<'a> = (); + #[doc(hidden)] + type UnderlyingRustTuple<'a> = (); + #[cfg(test)] + #[allow(dead_code, unreachable_patterns)] + fn _type_assertion( + _t: alloy_sol_types::private::AssertTypeEq, + ) { + match _t { + alloy_sol_types::private::AssertTypeEq::< + ::RustType, + >(_) => {} + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From for UnderlyingRustTuple<'_> { + fn from(value: getCycleInfoCall) -> Self { + () + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From> for getCycleInfoCall { + fn from(tuple: UnderlyingRustTuple<'_>) -> Self { + Self + } + } + } + { + #[doc(hidden)] + #[allow(dead_code)] + type UnderlyingSolTuple<'a> = ( + alloy::sol_types::sol_data::Uint<64>, + alloy::sol_types::sol_data::Uint<64>, + alloy::sol_types::sol_data::Uint<64>, + CommonUtils::CycleState, + ); + #[doc(hidden)] + type UnderlyingRustTuple<'a> = ( + u64, + u64, + u64, + ::RustType, + ); + #[cfg(test)] + #[allow(dead_code, unreachable_patterns)] + fn _type_assertion( + _t: alloy_sol_types::private::AssertTypeEq, + ) { + match _t { + alloy_sol_types::private::AssertTypeEq::< + ::RustType, + >(_) => {} + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From for UnderlyingRustTuple<'_> { + fn from(value: getCycleInfoReturn) -> Self { + (value._0, value._1, value._2, value._3) + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From> for getCycleInfoReturn { + fn from(tuple: UnderlyingRustTuple<'_>) -> Self { + Self { + _0: tuple.0, + _1: tuple.1, + _2: tuple.2, + _3: tuple.3, + } + } + } + } + impl getCycleInfoReturn { + fn _tokenize( + &self, + ) -> ::ReturnToken<'_> { + ( + as alloy_sol_types::SolType>::tokenize(&self._0), + as alloy_sol_types::SolType>::tokenize(&self._1), + as alloy_sol_types::SolType>::tokenize(&self._2), + ::tokenize( + &self._3, + ), + ) + } + } + #[automatically_derived] + impl alloy_sol_types::SolCall for getCycleInfoCall { + type Parameters<'a> = (); + type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; + type Return = getCycleInfoReturn; + type ReturnTuple<'a> = ( + alloy::sol_types::sol_data::Uint<64>, + alloy::sol_types::sol_data::Uint<64>, + alloy::sol_types::sol_data::Uint<64>, + CommonUtils::CycleState, + ); + type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; + const SIGNATURE: &'static str = "getCycleInfo()"; + const SELECTOR: [u8; 4] = [135u8, 61u8, 199u8, 29u8]; + #[inline] + fn new<'a>( + tuple: as alloy_sol_types::SolType>::RustType, + ) -> Self { + tuple.into() + } + #[inline] + fn tokenize(&self) -> Self::Token<'_> { + () + } + #[inline] + fn tokenize_returns(ret: &Self::Return) -> Self::ReturnToken<'_> { + getCycleInfoReturn::_tokenize(ret) + } + #[inline] + fn abi_decode_returns(data: &[u8]) -> alloy_sol_types::Result { + as alloy_sol_types::SolType>::abi_decode_sequence(data) + .map(Into::into) + } + #[inline] + fn abi_decode_returns_validate( + data: &[u8], + ) -> alloy_sol_types::Result { + as alloy_sol_types::SolType>::abi_decode_sequence_validate(data) + .map(Into::into) + } + } + }; + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Default, Debug, PartialEq, Eq, Hash)] + /**Function with signature `getTaskDetails(uint64)` and selector `0xb2ef6896`. +```solidity +function getTaskDetails(uint64 _taskIndex) external view returns (CommonUtils.TaskDetails memory); +```*/ + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct getTaskDetailsCall { + #[allow(missing_docs)] + pub _taskIndex: u64, + } + #[derive(serde::Serialize, serde::Deserialize)] + #[derive()] + ///Container type for the return parameters of the [`getTaskDetails(uint64)`](getTaskDetailsCall) function. + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct getTaskDetailsReturn { + #[allow(missing_docs)] + pub _0: ::RustType, + } + #[allow( + non_camel_case_types, + non_snake_case, + clippy::pub_underscore_fields, + clippy::style + )] + const _: () = { + use alloy::sol_types as alloy_sol_types; + { + #[doc(hidden)] + #[allow(dead_code)] + type UnderlyingSolTuple<'a> = (alloy::sol_types::sol_data::Uint<64>,); + #[doc(hidden)] + type UnderlyingRustTuple<'a> = (u64,); + #[cfg(test)] + #[allow(dead_code, unreachable_patterns)] + fn _type_assertion( + _t: alloy_sol_types::private::AssertTypeEq, + ) { + match _t { + alloy_sol_types::private::AssertTypeEq::< + ::RustType, + >(_) => {} + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From for UnderlyingRustTuple<'_> { + fn from(value: getTaskDetailsCall) -> Self { + (value._taskIndex,) + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From> for getTaskDetailsCall { + fn from(tuple: UnderlyingRustTuple<'_>) -> Self { + Self { _taskIndex: tuple.0 } + } + } + } + { + #[doc(hidden)] + #[allow(dead_code)] + type UnderlyingSolTuple<'a> = (CommonUtils::TaskDetails,); + #[doc(hidden)] + type UnderlyingRustTuple<'a> = ( + ::RustType, + ); + #[cfg(test)] + #[allow(dead_code, unreachable_patterns)] + fn _type_assertion( + _t: alloy_sol_types::private::AssertTypeEq, + ) { + match _t { + alloy_sol_types::private::AssertTypeEq::< + ::RustType, + >(_) => {} + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From + for UnderlyingRustTuple<'_> { + fn from(value: getTaskDetailsReturn) -> Self { + (value._0,) + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From> + for getTaskDetailsReturn { + fn from(tuple: UnderlyingRustTuple<'_>) -> Self { + Self { _0: tuple.0 } + } + } + } + #[automatically_derived] + impl alloy_sol_types::SolCall for getTaskDetailsCall { + type Parameters<'a> = (alloy::sol_types::sol_data::Uint<64>,); + type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; + type Return = ::RustType; + type ReturnTuple<'a> = (CommonUtils::TaskDetails,); + type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; + const SIGNATURE: &'static str = "getTaskDetails(uint64)"; + const SELECTOR: [u8; 4] = [178u8, 239u8, 104u8, 150u8]; + #[inline] + fn new<'a>( + tuple: as alloy_sol_types::SolType>::RustType, + ) -> Self { + tuple.into() + } + #[inline] + fn tokenize(&self) -> Self::Token<'_> { + ( + as alloy_sol_types::SolType>::tokenize(&self._taskIndex), + ) + } + #[inline] + fn tokenize_returns(ret: &Self::Return) -> Self::ReturnToken<'_> { + (::tokenize(ret),) + } + #[inline] + fn abi_decode_returns(data: &[u8]) -> alloy_sol_types::Result { + as alloy_sol_types::SolType>::abi_decode_sequence(data) + .map(|r| { + let r: getTaskDetailsReturn = r.into(); + r._0 + }) + } + #[inline] + fn abi_decode_returns_validate( + data: &[u8], + ) -> alloy_sol_types::Result { + as alloy_sol_types::SolType>::abi_decode_sequence_validate(data) + .map(|r| { + let r: getTaskDetailsReturn = r.into(); + r._0 + }) + } + } + }; + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Default, Debug, PartialEq, Eq, Hash)] + /**Function with signature `getTaskDetailsBulk(uint64[])` and selector `0x12f72cf4`. +```solidity +function getTaskDetailsBulk(uint64[] memory _taskIndexes) external view returns (CommonUtils.TaskDetails[] memory); +```*/ + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct getTaskDetailsBulkCall { + #[allow(missing_docs)] + pub _taskIndexes: alloy::sol_types::private::Vec, + } + #[derive(serde::Serialize, serde::Deserialize)] + #[derive()] + ///Container type for the return parameters of the [`getTaskDetailsBulk(uint64[])`](getTaskDetailsBulkCall) function. + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct getTaskDetailsBulkReturn { + #[allow(missing_docs)] + pub _0: alloy::sol_types::private::Vec< + ::RustType, + >, + } + #[allow( + non_camel_case_types, + non_snake_case, + clippy::pub_underscore_fields, + clippy::style + )] + const _: () = { + use alloy::sol_types as alloy_sol_types; + { + #[doc(hidden)] + #[allow(dead_code)] + type UnderlyingSolTuple<'a> = ( + alloy::sol_types::sol_data::Array>, + ); + #[doc(hidden)] + type UnderlyingRustTuple<'a> = (alloy::sol_types::private::Vec,); + #[cfg(test)] + #[allow(dead_code, unreachable_patterns)] + fn _type_assertion( + _t: alloy_sol_types::private::AssertTypeEq, + ) { + match _t { + alloy_sol_types::private::AssertTypeEq::< + ::RustType, + >(_) => {} + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From + for UnderlyingRustTuple<'_> { + fn from(value: getTaskDetailsBulkCall) -> Self { + (value._taskIndexes,) + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From> + for getTaskDetailsBulkCall { + fn from(tuple: UnderlyingRustTuple<'_>) -> Self { + Self { _taskIndexes: tuple.0 } + } + } + } + { + #[doc(hidden)] + #[allow(dead_code)] + type UnderlyingSolTuple<'a> = ( + alloy::sol_types::sol_data::Array, + ); + #[doc(hidden)] + type UnderlyingRustTuple<'a> = ( + alloy::sol_types::private::Vec< + ::RustType, + >, + ); + #[cfg(test)] + #[allow(dead_code, unreachable_patterns)] + fn _type_assertion( + _t: alloy_sol_types::private::AssertTypeEq, + ) { + match _t { + alloy_sol_types::private::AssertTypeEq::< + ::RustType, + >(_) => {} + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From + for UnderlyingRustTuple<'_> { + fn from(value: getTaskDetailsBulkReturn) -> Self { + (value._0,) + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From> + for getTaskDetailsBulkReturn { + fn from(tuple: UnderlyingRustTuple<'_>) -> Self { + Self { _0: tuple.0 } + } + } + } + #[automatically_derived] + impl alloy_sol_types::SolCall for getTaskDetailsBulkCall { + type Parameters<'a> = ( + alloy::sol_types::sol_data::Array>, + ); + type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; + type Return = alloy::sol_types::private::Vec< + ::RustType, + >; + type ReturnTuple<'a> = ( + alloy::sol_types::sol_data::Array, + ); + type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; + const SIGNATURE: &'static str = "getTaskDetailsBulk(uint64[])"; + const SELECTOR: [u8; 4] = [18u8, 247u8, 44u8, 244u8]; + #[inline] + fn new<'a>( + tuple: as alloy_sol_types::SolType>::RustType, + ) -> Self { + tuple.into() + } + #[inline] + fn tokenize(&self) -> Self::Token<'_> { + ( + , + > as alloy_sol_types::SolType>::tokenize(&self._taskIndexes), + ) + } + #[inline] + fn tokenize_returns(ret: &Self::Return) -> Self::ReturnToken<'_> { + ( + as alloy_sol_types::SolType>::tokenize(ret), + ) + } + #[inline] + fn abi_decode_returns(data: &[u8]) -> alloy_sol_types::Result { + as alloy_sol_types::SolType>::abi_decode_sequence(data) + .map(|r| { + let r: getTaskDetailsBulkReturn = r.into(); + r._0 + }) + } + #[inline] + fn abi_decode_returns_validate( + data: &[u8], + ) -> alloy_sol_types::Result { + as alloy_sol_types::SolType>::abi_decode_sequence_validate(data) + .map(|r| { + let r: getTaskDetailsBulkReturn = r.into(); + r._0 + }) + } + } + }; + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Default, Debug, PartialEq, Eq, Hash)] + /**Function with signature `getTaskIdList()` and selector `0xec82b429`. +```solidity +function getTaskIdList() external view returns (uint256[] memory); +```*/ + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct getTaskIdListCall; + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Default, Debug, PartialEq, Eq, Hash)] + ///Container type for the return parameters of the [`getTaskIdList()`](getTaskIdListCall) function. + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct getTaskIdListReturn { + #[allow(missing_docs)] + pub _0: alloy::sol_types::private::Vec< + alloy::sol_types::private::primitives::aliases::U256, + >, + } + #[allow( + non_camel_case_types, + non_snake_case, + clippy::pub_underscore_fields, + clippy::style + )] + const _: () = { + use alloy::sol_types as alloy_sol_types; + { + #[doc(hidden)] + #[allow(dead_code)] + type UnderlyingSolTuple<'a> = (); + #[doc(hidden)] + type UnderlyingRustTuple<'a> = (); + #[cfg(test)] + #[allow(dead_code, unreachable_patterns)] + fn _type_assertion( + _t: alloy_sol_types::private::AssertTypeEq, + ) { + match _t { + alloy_sol_types::private::AssertTypeEq::< + ::RustType, + >(_) => {} + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From for UnderlyingRustTuple<'_> { + fn from(value: getTaskIdListCall) -> Self { + () + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From> for getTaskIdListCall { + fn from(tuple: UnderlyingRustTuple<'_>) -> Self { + Self + } + } + } + { + #[doc(hidden)] + #[allow(dead_code)] + type UnderlyingSolTuple<'a> = ( + alloy::sol_types::sol_data::Array>, + ); + #[doc(hidden)] + type UnderlyingRustTuple<'a> = ( + alloy::sol_types::private::Vec< + alloy::sol_types::private::primitives::aliases::U256, + >, + ); + #[cfg(test)] + #[allow(dead_code, unreachable_patterns)] + fn _type_assertion( + _t: alloy_sol_types::private::AssertTypeEq, + ) { + match _t { + alloy_sol_types::private::AssertTypeEq::< + ::RustType, + >(_) => {} + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From for UnderlyingRustTuple<'_> { + fn from(value: getTaskIdListReturn) -> Self { + (value._0,) + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From> for getTaskIdListReturn { + fn from(tuple: UnderlyingRustTuple<'_>) -> Self { + Self { _0: tuple.0 } + } + } + } + #[automatically_derived] + impl alloy_sol_types::SolCall for getTaskIdListCall { + type Parameters<'a> = (); + type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; + type Return = alloy::sol_types::private::Vec< + alloy::sol_types::private::primitives::aliases::U256, + >; + type ReturnTuple<'a> = ( + alloy::sol_types::sol_data::Array>, + ); + type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; + const SIGNATURE: &'static str = "getTaskIdList()"; + const SELECTOR: [u8; 4] = [236u8, 130u8, 180u8, 41u8]; + #[inline] + fn new<'a>( + tuple: as alloy_sol_types::SolType>::RustType, + ) -> Self { + tuple.into() + } + #[inline] + fn tokenize(&self) -> Self::Token<'_> { + () + } + #[inline] + fn tokenize_returns(ret: &Self::Return) -> Self::ReturnToken<'_> { + ( + , + > as alloy_sol_types::SolType>::tokenize(ret), + ) + } + #[inline] + fn abi_decode_returns(data: &[u8]) -> alloy_sol_types::Result { + as alloy_sol_types::SolType>::abi_decode_sequence(data) + .map(|r| { + let r: getTaskIdListReturn = r.into(); + r._0 + }) + } + #[inline] + fn abi_decode_returns_validate( + data: &[u8], + ) -> alloy_sol_types::Result { + as alloy_sol_types::SolType>::abi_decode_sequence_validate(data) + .map(|r| { + let r: getTaskIdListReturn = r.into(); + r._0 + }) + } + } + }; + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Default, Debug, PartialEq, Eq, Hash)] + /**Function with signature `getTransitionInfo()` and selector `0xf5c1249f`. +```solidity +function getTransitionInfo() external view returns (uint64, uint128); +```*/ + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct getTransitionInfoCall; + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Default, Debug, PartialEq, Eq, Hash)] + ///Container type for the return parameters of the [`getTransitionInfo()`](getTransitionInfoCall) function. + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct getTransitionInfoReturn { + #[allow(missing_docs)] + pub _0: u64, + #[allow(missing_docs)] + pub _1: u128, + } + #[allow( + non_camel_case_types, + non_snake_case, + clippy::pub_underscore_fields, + clippy::style + )] + const _: () = { + use alloy::sol_types as alloy_sol_types; + { + #[doc(hidden)] + #[allow(dead_code)] + type UnderlyingSolTuple<'a> = (); + #[doc(hidden)] + type UnderlyingRustTuple<'a> = (); + #[cfg(test)] + #[allow(dead_code, unreachable_patterns)] + fn _type_assertion( + _t: alloy_sol_types::private::AssertTypeEq, + ) { + match _t { + alloy_sol_types::private::AssertTypeEq::< + ::RustType, + >(_) => {} + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From + for UnderlyingRustTuple<'_> { + fn from(value: getTransitionInfoCall) -> Self { + () + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From> + for getTransitionInfoCall { + fn from(tuple: UnderlyingRustTuple<'_>) -> Self { + Self + } + } + } + { + #[doc(hidden)] + #[allow(dead_code)] + type UnderlyingSolTuple<'a> = ( + alloy::sol_types::sol_data::Uint<64>, + alloy::sol_types::sol_data::Uint<128>, + ); + #[doc(hidden)] + type UnderlyingRustTuple<'a> = (u64, u128); + #[cfg(test)] + #[allow(dead_code, unreachable_patterns)] + fn _type_assertion( + _t: alloy_sol_types::private::AssertTypeEq, + ) { + match _t { + alloy_sol_types::private::AssertTypeEq::< + ::RustType, + >(_) => {} + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From + for UnderlyingRustTuple<'_> { + fn from(value: getTransitionInfoReturn) -> Self { + (value._0, value._1) + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From> + for getTransitionInfoReturn { + fn from(tuple: UnderlyingRustTuple<'_>) -> Self { + Self { _0: tuple.0, _1: tuple.1 } + } + } + } + impl getTransitionInfoReturn { + fn _tokenize( + &self, + ) -> ::ReturnToken<'_> { + ( + as alloy_sol_types::SolType>::tokenize(&self._0), + as alloy_sol_types::SolType>::tokenize(&self._1), + ) + } + } + #[automatically_derived] + impl alloy_sol_types::SolCall for getTransitionInfoCall { + type Parameters<'a> = (); + type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; + type Return = getTransitionInfoReturn; + type ReturnTuple<'a> = ( + alloy::sol_types::sol_data::Uint<64>, + alloy::sol_types::sol_data::Uint<128>, + ); + type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; + const SIGNATURE: &'static str = "getTransitionInfo()"; + const SELECTOR: [u8; 4] = [245u8, 193u8, 36u8, 159u8]; + #[inline] + fn new<'a>( + tuple: as alloy_sol_types::SolType>::RustType, + ) -> Self { + tuple.into() + } + #[inline] + fn tokenize(&self) -> Self::Token<'_> { + () + } + #[inline] + fn tokenize_returns(ret: &Self::Return) -> Self::ReturnToken<'_> { + getTransitionInfoReturn::_tokenize(ret) + } + #[inline] + fn abi_decode_returns(data: &[u8]) -> alloy_sol_types::Result { + as alloy_sol_types::SolType>::abi_decode_sequence(data) + .map(Into::into) + } + #[inline] + fn abi_decode_returns_validate( + data: &[u8], + ) -> alloy_sol_types::Result { + as alloy_sol_types::SolType>::abi_decode_sequence_validate(data) + .map(Into::into) + } + } + }; + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Default, Debug, PartialEq, Eq, Hash)] + /**Function with signature `ifTaskExists(uint64)` and selector `0x8aaa404e`. +```solidity +function ifTaskExists(uint64 _taskIndex) external view returns (bool); +```*/ + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct ifTaskExistsCall { + #[allow(missing_docs)] + pub _taskIndex: u64, + } + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Default, Debug, PartialEq, Eq, Hash)] + ///Container type for the return parameters of the [`ifTaskExists(uint64)`](ifTaskExistsCall) function. + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct ifTaskExistsReturn { + #[allow(missing_docs)] + pub _0: bool, + } + #[allow( + non_camel_case_types, + non_snake_case, + clippy::pub_underscore_fields, + clippy::style + )] + const _: () = { + use alloy::sol_types as alloy_sol_types; + { + #[doc(hidden)] + #[allow(dead_code)] + type UnderlyingSolTuple<'a> = (alloy::sol_types::sol_data::Uint<64>,); + #[doc(hidden)] + type UnderlyingRustTuple<'a> = (u64,); + #[cfg(test)] + #[allow(dead_code, unreachable_patterns)] + fn _type_assertion( + _t: alloy_sol_types::private::AssertTypeEq, + ) { + match _t { + alloy_sol_types::private::AssertTypeEq::< + ::RustType, + >(_) => {} + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From for UnderlyingRustTuple<'_> { + fn from(value: ifTaskExistsCall) -> Self { + (value._taskIndex,) + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From> for ifTaskExistsCall { + fn from(tuple: UnderlyingRustTuple<'_>) -> Self { + Self { _taskIndex: tuple.0 } + } + } + } + { + #[doc(hidden)] + #[allow(dead_code)] + type UnderlyingSolTuple<'a> = (alloy::sol_types::sol_data::Bool,); + #[doc(hidden)] + type UnderlyingRustTuple<'a> = (bool,); + #[cfg(test)] + #[allow(dead_code, unreachable_patterns)] + fn _type_assertion( + _t: alloy_sol_types::private::AssertTypeEq, + ) { + match _t { + alloy_sol_types::private::AssertTypeEq::< + ::RustType, + >(_) => {} + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From for UnderlyingRustTuple<'_> { + fn from(value: ifTaskExistsReturn) -> Self { + (value._0,) + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From> for ifTaskExistsReturn { + fn from(tuple: UnderlyingRustTuple<'_>) -> Self { + Self { _0: tuple.0 } + } + } + } + #[automatically_derived] + impl alloy_sol_types::SolCall for ifTaskExistsCall { + type Parameters<'a> = (alloy::sol_types::sol_data::Uint<64>,); + type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; + type Return = bool; + type ReturnTuple<'a> = (alloy::sol_types::sol_data::Bool,); + type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; + const SIGNATURE: &'static str = "ifTaskExists(uint64)"; + const SELECTOR: [u8; 4] = [138u8, 170u8, 64u8, 78u8]; + #[inline] + fn new<'a>( + tuple: as alloy_sol_types::SolType>::RustType, + ) -> Self { + tuple.into() + } + #[inline] + fn tokenize(&self) -> Self::Token<'_> { + ( + as alloy_sol_types::SolType>::tokenize(&self._taskIndex), + ) + } + #[inline] + fn tokenize_returns(ret: &Self::Return) -> Self::ReturnToken<'_> { + ( + ::tokenize( + ret, + ), + ) + } + #[inline] + fn abi_decode_returns(data: &[u8]) -> alloy_sol_types::Result { + as alloy_sol_types::SolType>::abi_decode_sequence(data) + .map(|r| { + let r: ifTaskExistsReturn = r.into(); + r._0 + }) + } + #[inline] + fn abi_decode_returns_validate( + data: &[u8], + ) -> alloy_sol_types::Result { + as alloy_sol_types::SolType>::abi_decode_sequence_validate(data) + .map(|r| { + let r: ifTaskExistsReturn = r.into(); + r._0 + }) + } + } + }; + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Default, Debug, PartialEq, Eq, Hash)] + /**Function with signature `isAutomationEnabled()` and selector `0xe48e0e98`. +```solidity +function isAutomationEnabled() external view returns (bool); +```*/ + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct isAutomationEnabledCall; + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Default, Debug, PartialEq, Eq, Hash)] + ///Container type for the return parameters of the [`isAutomationEnabled()`](isAutomationEnabledCall) function. + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct isAutomationEnabledReturn { + #[allow(missing_docs)] + pub _0: bool, + } + #[allow( + non_camel_case_types, + non_snake_case, + clippy::pub_underscore_fields, + clippy::style + )] + const _: () = { + use alloy::sol_types as alloy_sol_types; + { + #[doc(hidden)] + #[allow(dead_code)] + type UnderlyingSolTuple<'a> = (); + #[doc(hidden)] + type UnderlyingRustTuple<'a> = (); + #[cfg(test)] + #[allow(dead_code, unreachable_patterns)] + fn _type_assertion( + _t: alloy_sol_types::private::AssertTypeEq, + ) { + match _t { + alloy_sol_types::private::AssertTypeEq::< + ::RustType, + >(_) => {} + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From + for UnderlyingRustTuple<'_> { + fn from(value: isAutomationEnabledCall) -> Self { + () + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From> + for isAutomationEnabledCall { + fn from(tuple: UnderlyingRustTuple<'_>) -> Self { + Self + } + } + } + { + #[doc(hidden)] + #[allow(dead_code)] + type UnderlyingSolTuple<'a> = (alloy::sol_types::sol_data::Bool,); + #[doc(hidden)] + type UnderlyingRustTuple<'a> = (bool,); + #[cfg(test)] + #[allow(dead_code, unreachable_patterns)] + fn _type_assertion( + _t: alloy_sol_types::private::AssertTypeEq, + ) { + match _t { + alloy_sol_types::private::AssertTypeEq::< + ::RustType, + >(_) => {} + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From + for UnderlyingRustTuple<'_> { + fn from(value: isAutomationEnabledReturn) -> Self { + (value._0,) + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From> + for isAutomationEnabledReturn { + fn from(tuple: UnderlyingRustTuple<'_>) -> Self { + Self { _0: tuple.0 } + } + } + } + #[automatically_derived] + impl alloy_sol_types::SolCall for isAutomationEnabledCall { + type Parameters<'a> = (); + type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; + type Return = bool; + type ReturnTuple<'a> = (alloy::sol_types::sol_data::Bool,); + type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; + const SIGNATURE: &'static str = "isAutomationEnabled()"; + const SELECTOR: [u8; 4] = [228u8, 142u8, 14u8, 152u8]; + #[inline] + fn new<'a>( + tuple: as alloy_sol_types::SolType>::RustType, + ) -> Self { + tuple.into() + } + #[inline] + fn tokenize(&self) -> Self::Token<'_> { + () + } + #[inline] + fn tokenize_returns(ret: &Self::Return) -> Self::ReturnToken<'_> { + ( + ::tokenize( + ret, + ), + ) + } + #[inline] + fn abi_decode_returns(data: &[u8]) -> alloy_sol_types::Result { + as alloy_sol_types::SolType>::abi_decode_sequence(data) + .map(|r| { + let r: isAutomationEnabledReturn = r.into(); + r._0 + }) + } + #[inline] + fn abi_decode_returns_validate( + data: &[u8], + ) -> alloy_sol_types::Result { + as alloy_sol_types::SolType>::abi_decode_sequence_validate(data) + .map(|r| { + let r: isAutomationEnabledReturn = r.into(); + r._0 + }) + } + } + }; + #[derive(serde::Serialize, serde::Deserialize)] + #[derive(Default, Debug, PartialEq, Eq, Hash)] + /**Function with signature `processTasks(uint64,uint64[])` and selector `0x7f69c35c`. +```solidity +function processTasks(uint64 _cycleIndex, uint64[] memory _taskIndexes) external; +```*/ + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct processTasksCall { + #[allow(missing_docs)] + pub _cycleIndex: u64, + #[allow(missing_docs)] + pub _taskIndexes: alloy::sol_types::private::Vec, + } + ///Container type for the return parameters of the [`processTasks(uint64,uint64[])`](processTasksCall) function. + #[allow(non_camel_case_types, non_snake_case, clippy::pub_underscore_fields)] + #[derive(Clone)] + pub struct processTasksReturn {} + #[allow( + non_camel_case_types, + non_snake_case, + clippy::pub_underscore_fields, + clippy::style + )] + const _: () = { + use alloy::sol_types as alloy_sol_types; + { + #[doc(hidden)] + #[allow(dead_code)] + type UnderlyingSolTuple<'a> = ( + alloy::sol_types::sol_data::Uint<64>, + alloy::sol_types::sol_data::Array>, + ); + #[doc(hidden)] + type UnderlyingRustTuple<'a> = (u64, alloy::sol_types::private::Vec); + #[cfg(test)] + #[allow(dead_code, unreachable_patterns)] + fn _type_assertion( + _t: alloy_sol_types::private::AssertTypeEq, + ) { + match _t { + alloy_sol_types::private::AssertTypeEq::< + ::RustType, + >(_) => {} + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From for UnderlyingRustTuple<'_> { + fn from(value: processTasksCall) -> Self { + (value._cycleIndex, value._taskIndexes) + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From> for processTasksCall { + fn from(tuple: UnderlyingRustTuple<'_>) -> Self { + Self { + _cycleIndex: tuple.0, + _taskIndexes: tuple.1, + } + } + } + } + { + #[doc(hidden)] + #[allow(dead_code)] + type UnderlyingSolTuple<'a> = (); + #[doc(hidden)] + type UnderlyingRustTuple<'a> = (); + #[cfg(test)] + #[allow(dead_code, unreachable_patterns)] + fn _type_assertion( + _t: alloy_sol_types::private::AssertTypeEq, + ) { + match _t { + alloy_sol_types::private::AssertTypeEq::< + ::RustType, + >(_) => {} + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From for UnderlyingRustTuple<'_> { + fn from(value: processTasksReturn) -> Self { + () + } + } + #[automatically_derived] + #[doc(hidden)] + impl ::core::convert::From> for processTasksReturn { + fn from(tuple: UnderlyingRustTuple<'_>) -> Self { + Self {} + } + } + } + impl processTasksReturn { + fn _tokenize( + &self, + ) -> ::ReturnToken<'_> { + () + } + } + #[automatically_derived] + impl alloy_sol_types::SolCall for processTasksCall { + type Parameters<'a> = ( + alloy::sol_types::sol_data::Uint<64>, + alloy::sol_types::sol_data::Array>, + ); + type Token<'a> = as alloy_sol_types::SolType>::Token<'a>; + type Return = processTasksReturn; + type ReturnTuple<'a> = (); + type ReturnToken<'a> = as alloy_sol_types::SolType>::Token<'a>; + const SIGNATURE: &'static str = "processTasks(uint64,uint64[])"; + const SELECTOR: [u8; 4] = [127u8, 105u8, 195u8, 92u8]; + #[inline] + fn new<'a>( + tuple: as alloy_sol_types::SolType>::RustType, + ) -> Self { + tuple.into() + } + #[inline] + fn tokenize(&self) -> Self::Token<'_> { + ( + as alloy_sol_types::SolType>::tokenize(&self._cycleIndex), + , + > as alloy_sol_types::SolType>::tokenize(&self._taskIndexes), + ) + } + #[inline] + fn tokenize_returns(ret: &Self::Return) -> Self::ReturnToken<'_> { + processTasksReturn::_tokenize(ret) + } + #[inline] + fn abi_decode_returns(data: &[u8]) -> alloy_sol_types::Result { + as alloy_sol_types::SolType>::abi_decode_sequence(data) + .map(Into::into) + } + #[inline] + fn abi_decode_returns_validate( + data: &[u8], + ) -> alloy_sol_types::Result { + as alloy_sol_types::SolType>::abi_decode_sequence_validate(data) + .map(Into::into) + } + } + }; + ///Container for all the [`SupraContractsBindings`](self) function calls. + #[derive(Clone)] + #[derive(serde::Serialize, serde::Deserialize)] + #[derive()] + pub enum SupraContractsBindingsCalls { + #[allow(missing_docs)] + blockPrologue(blockPrologueCall), + #[allow(missing_docs)] + getAllActiveTaskIds(getAllActiveTaskIdsCall), + #[allow(missing_docs)] + getCycleInfo(getCycleInfoCall), + #[allow(missing_docs)] + getTaskDetails(getTaskDetailsCall), + #[allow(missing_docs)] + getTaskDetailsBulk(getTaskDetailsBulkCall), + #[allow(missing_docs)] + getTaskIdList(getTaskIdListCall), + #[allow(missing_docs)] + getTransitionInfo(getTransitionInfoCall), + #[allow(missing_docs)] + ifTaskExists(ifTaskExistsCall), + #[allow(missing_docs)] + isAutomationEnabled(isAutomationEnabledCall), + #[allow(missing_docs)] + processTasks(processTasksCall), + } + impl SupraContractsBindingsCalls { + /// All the selectors of this enum. + /// + /// Note that the selectors might not be in the same order as the variants. + /// No guarantees are made about the order of the selectors. + /// + /// Prefer using `SolInterface` methods instead. + pub const SELECTORS: &'static [[u8; 4usize]] = &[ + [18u8, 247u8, 44u8, 244u8], + [125u8, 237u8, 9u8, 27u8], + [127u8, 105u8, 195u8, 92u8], + [135u8, 61u8, 199u8, 29u8], + [138u8, 170u8, 64u8, 78u8], + [178u8, 239u8, 104u8, 150u8], + [197u8, 220u8, 246u8, 172u8], + [228u8, 142u8, 14u8, 152u8], + [236u8, 130u8, 180u8, 41u8], + [245u8, 193u8, 36u8, 159u8], + ]; + /// The names of the variants in the same order as `SELECTORS`. + pub const VARIANT_NAMES: &'static [&'static str] = &[ + ::core::stringify!(getTaskDetailsBulk), + ::core::stringify!(blockPrologue), + ::core::stringify!(processTasks), + ::core::stringify!(getCycleInfo), + ::core::stringify!(ifTaskExists), + ::core::stringify!(getTaskDetails), + ::core::stringify!(getAllActiveTaskIds), + ::core::stringify!(isAutomationEnabled), + ::core::stringify!(getTaskIdList), + ::core::stringify!(getTransitionInfo), + ]; + /// The signatures in the same order as `SELECTORS`. + pub const SIGNATURES: &'static [&'static str] = &[ + ::SIGNATURE, + ::SIGNATURE, + ::SIGNATURE, + ::SIGNATURE, + ::SIGNATURE, + ::SIGNATURE, + ::SIGNATURE, + ::SIGNATURE, + ::SIGNATURE, + ::SIGNATURE, + ]; + /// Returns the signature for the given selector, if known. + #[inline] + pub fn signature_by_selector( + selector: [u8; 4usize], + ) -> ::core::option::Option<&'static str> { + match Self::SELECTORS.binary_search(&selector) { + ::core::result::Result::Ok(idx) => { + ::core::option::Option::Some(Self::SIGNATURES[idx]) + } + ::core::result::Result::Err(_) => ::core::option::Option::None, + } + } + /// Returns the enum variant name for the given selector, if known. + #[inline] + pub fn name_by_selector( + selector: [u8; 4usize], + ) -> ::core::option::Option<&'static str> { + let sig = Self::signature_by_selector(selector)?; + sig.split_once('(').map(|(name, _)| name) + } + } + #[automatically_derived] + impl alloy_sol_types::SolInterface for SupraContractsBindingsCalls { + const NAME: &'static str = "SupraContractsBindingsCalls"; + const MIN_DATA_LENGTH: usize = 0usize; + const COUNT: usize = 10usize; + #[inline] + fn selector(&self) -> [u8; 4] { + match self { + Self::blockPrologue(_) => { + ::SELECTOR + } + Self::getAllActiveTaskIds(_) => { + ::SELECTOR + } + Self::getCycleInfo(_) => { + ::SELECTOR + } + Self::getTaskDetails(_) => { + ::SELECTOR + } + Self::getTaskDetailsBulk(_) => { + ::SELECTOR + } + Self::getTaskIdList(_) => { + ::SELECTOR + } + Self::getTransitionInfo(_) => { + ::SELECTOR + } + Self::ifTaskExists(_) => { + ::SELECTOR + } + Self::isAutomationEnabled(_) => { + ::SELECTOR + } + Self::processTasks(_) => { + ::SELECTOR + } + } + } + #[inline] + fn selector_at(i: usize) -> ::core::option::Option<[u8; 4]> { + Self::SELECTORS.get(i).copied() + } + #[inline] + fn valid_selector(selector: [u8; 4]) -> bool { + Self::SELECTORS.binary_search(&selector).is_ok() + } + #[inline] + #[allow(non_snake_case)] + fn abi_decode_raw( + selector: [u8; 4], + data: &[u8], + ) -> alloy_sol_types::Result { + static DECODE_SHIMS: &[fn( + &[u8], + ) -> alloy_sol_types::Result] = &[ + { + fn getTaskDetailsBulk( + data: &[u8], + ) -> alloy_sol_types::Result { + ::abi_decode_raw( + data, + ) + .map(SupraContractsBindingsCalls::getTaskDetailsBulk) + } + getTaskDetailsBulk + }, + { + fn blockPrologue( + data: &[u8], + ) -> alloy_sol_types::Result { + ::abi_decode_raw( + data, + ) + .map(SupraContractsBindingsCalls::blockPrologue) + } + blockPrologue + }, + { + fn processTasks( + data: &[u8], + ) -> alloy_sol_types::Result { + ::abi_decode_raw( + data, + ) + .map(SupraContractsBindingsCalls::processTasks) + } + processTasks + }, + { + fn getCycleInfo( + data: &[u8], + ) -> alloy_sol_types::Result { + ::abi_decode_raw( + data, + ) + .map(SupraContractsBindingsCalls::getCycleInfo) + } + getCycleInfo + }, + { + fn ifTaskExists( + data: &[u8], + ) -> alloy_sol_types::Result { + ::abi_decode_raw( + data, + ) + .map(SupraContractsBindingsCalls::ifTaskExists) + } + ifTaskExists + }, + { + fn getTaskDetails( + data: &[u8], + ) -> alloy_sol_types::Result { + ::abi_decode_raw( + data, + ) + .map(SupraContractsBindingsCalls::getTaskDetails) + } + getTaskDetails + }, + { + fn getAllActiveTaskIds( + data: &[u8], + ) -> alloy_sol_types::Result { + ::abi_decode_raw( + data, + ) + .map(SupraContractsBindingsCalls::getAllActiveTaskIds) + } + getAllActiveTaskIds + }, + { + fn isAutomationEnabled( + data: &[u8], + ) -> alloy_sol_types::Result { + ::abi_decode_raw( + data, + ) + .map(SupraContractsBindingsCalls::isAutomationEnabled) + } + isAutomationEnabled + }, + { + fn getTaskIdList( + data: &[u8], + ) -> alloy_sol_types::Result { + ::abi_decode_raw( + data, + ) + .map(SupraContractsBindingsCalls::getTaskIdList) + } + getTaskIdList + }, + { + fn getTransitionInfo( + data: &[u8], + ) -> alloy_sol_types::Result { + ::abi_decode_raw( + data, + ) + .map(SupraContractsBindingsCalls::getTransitionInfo) + } + getTransitionInfo + }, + ]; + let Ok(idx) = Self::SELECTORS.binary_search(&selector) else { + return Err( + alloy_sol_types::Error::unknown_selector( + ::NAME, + selector, + ), + ); + }; + DECODE_SHIMS[idx](data) + } + #[inline] + #[allow(non_snake_case)] + fn abi_decode_raw_validate( + selector: [u8; 4], + data: &[u8], + ) -> alloy_sol_types::Result { + static DECODE_VALIDATE_SHIMS: &[fn( + &[u8], + ) -> alloy_sol_types::Result] = &[ + { + fn getTaskDetailsBulk( + data: &[u8], + ) -> alloy_sol_types::Result { + ::abi_decode_raw_validate( + data, + ) + .map(SupraContractsBindingsCalls::getTaskDetailsBulk) + } + getTaskDetailsBulk + }, + { + fn blockPrologue( + data: &[u8], + ) -> alloy_sol_types::Result { + ::abi_decode_raw_validate( + data, + ) + .map(SupraContractsBindingsCalls::blockPrologue) + } + blockPrologue + }, + { + fn processTasks( + data: &[u8], + ) -> alloy_sol_types::Result { + ::abi_decode_raw_validate( + data, + ) + .map(SupraContractsBindingsCalls::processTasks) + } + processTasks + }, + { + fn getCycleInfo( + data: &[u8], + ) -> alloy_sol_types::Result { + ::abi_decode_raw_validate( + data, + ) + .map(SupraContractsBindingsCalls::getCycleInfo) + } + getCycleInfo + }, + { + fn ifTaskExists( + data: &[u8], + ) -> alloy_sol_types::Result { + ::abi_decode_raw_validate( + data, + ) + .map(SupraContractsBindingsCalls::ifTaskExists) + } + ifTaskExists + }, + { + fn getTaskDetails( + data: &[u8], + ) -> alloy_sol_types::Result { + ::abi_decode_raw_validate( + data, + ) + .map(SupraContractsBindingsCalls::getTaskDetails) + } + getTaskDetails + }, + { + fn getAllActiveTaskIds( + data: &[u8], + ) -> alloy_sol_types::Result { + ::abi_decode_raw_validate( + data, + ) + .map(SupraContractsBindingsCalls::getAllActiveTaskIds) + } + getAllActiveTaskIds + }, + { + fn isAutomationEnabled( + data: &[u8], + ) -> alloy_sol_types::Result { + ::abi_decode_raw_validate( + data, + ) + .map(SupraContractsBindingsCalls::isAutomationEnabled) + } + isAutomationEnabled + }, + { + fn getTaskIdList( + data: &[u8], + ) -> alloy_sol_types::Result { + ::abi_decode_raw_validate( + data, + ) + .map(SupraContractsBindingsCalls::getTaskIdList) + } + getTaskIdList + }, + { + fn getTransitionInfo( + data: &[u8], + ) -> alloy_sol_types::Result { + ::abi_decode_raw_validate( + data, + ) + .map(SupraContractsBindingsCalls::getTransitionInfo) + } + getTransitionInfo + }, + ]; + let Ok(idx) = Self::SELECTORS.binary_search(&selector) else { + return Err( + alloy_sol_types::Error::unknown_selector( + ::NAME, + selector, + ), + ); + }; + DECODE_VALIDATE_SHIMS[idx](data) + } + #[inline] + fn abi_encoded_size(&self) -> usize { + match self { + Self::blockPrologue(inner) => { + ::abi_encoded_size( + inner, + ) + } + Self::getAllActiveTaskIds(inner) => { + ::abi_encoded_size( + inner, + ) + } + Self::getCycleInfo(inner) => { + ::abi_encoded_size( + inner, + ) + } + Self::getTaskDetails(inner) => { + ::abi_encoded_size( + inner, + ) + } + Self::getTaskDetailsBulk(inner) => { + ::abi_encoded_size( + inner, + ) + } + Self::getTaskIdList(inner) => { + ::abi_encoded_size( + inner, + ) + } + Self::getTransitionInfo(inner) => { + ::abi_encoded_size( + inner, + ) + } + Self::ifTaskExists(inner) => { + ::abi_encoded_size( + inner, + ) + } + Self::isAutomationEnabled(inner) => { + ::abi_encoded_size( + inner, + ) + } + Self::processTasks(inner) => { + ::abi_encoded_size( + inner, + ) + } + } + } + #[inline] + fn abi_encode_raw(&self, out: &mut alloy_sol_types::private::Vec) { + match self { + Self::blockPrologue(inner) => { + ::abi_encode_raw( + inner, + out, + ) + } + Self::getAllActiveTaskIds(inner) => { + ::abi_encode_raw( + inner, + out, + ) + } + Self::getCycleInfo(inner) => { + ::abi_encode_raw( + inner, + out, + ) + } + Self::getTaskDetails(inner) => { + ::abi_encode_raw( + inner, + out, + ) + } + Self::getTaskDetailsBulk(inner) => { + ::abi_encode_raw( + inner, + out, + ) + } + Self::getTaskIdList(inner) => { + ::abi_encode_raw( + inner, + out, + ) + } + Self::getTransitionInfo(inner) => { + ::abi_encode_raw( + inner, + out, + ) + } + Self::ifTaskExists(inner) => { + ::abi_encode_raw( + inner, + out, + ) + } + Self::isAutomationEnabled(inner) => { + ::abi_encode_raw( + inner, + out, + ) + } + Self::processTasks(inner) => { + ::abi_encode_raw( + inner, + out, + ) + } + } + } + } + use alloy::contract as alloy_contract; + /**Creates a new wrapper around an on-chain [`SupraContractsBindings`](self) contract instance. + +See the [wrapper's documentation](`SupraContractsBindingsInstance`) for more details.*/ + #[inline] + pub const fn new< + P: alloy_contract::private::Provider, + N: alloy_contract::private::Network, + >( + address: alloy_sol_types::private::Address, + __provider: P, + ) -> SupraContractsBindingsInstance { + SupraContractsBindingsInstance::::new(address, __provider) + } + /**Deploys this contract using the given `provider` and constructor arguments, if any. + +Returns a new instance of the contract, if the deployment was successful. + +For more fine-grained control over the deployment process, use [`deploy_builder`] instead.*/ + #[inline] + pub fn deploy< + P: alloy_contract::private::Provider, + N: alloy_contract::private::Network, + >( + __provider: P, + ) -> impl ::core::future::Future< + Output = alloy_contract::Result>, + > { + SupraContractsBindingsInstance::::deploy(__provider) + } + /**Creates a `RawCallBuilder` for deploying this contract using the given `provider` +and constructor arguments, if any. + +This is a simple wrapper around creating a `RawCallBuilder` with the data set to +the bytecode concatenated with the constructor's ABI-encoded arguments.*/ + #[inline] + pub fn deploy_builder< + P: alloy_contract::private::Provider, + N: alloy_contract::private::Network, + >(__provider: P) -> alloy_contract::RawCallBuilder { + SupraContractsBindingsInstance::::deploy_builder(__provider) + } + /**A [`SupraContractsBindings`](self) instance. + +Contains type-safe methods for interacting with an on-chain instance of the +[`SupraContractsBindings`](self) contract located at a given `address`, using a given +provider `P`. + +If the contract bytecode is available (see the [`sol!`](alloy_sol_types::sol!) +documentation on how to provide it), the `deploy` and `deploy_builder` methods can +be used to deploy a new instance of the contract. + +See the [module-level documentation](self) for all the available methods.*/ + #[derive(Clone)] + pub struct SupraContractsBindingsInstance { + address: alloy_sol_types::private::Address, + provider: P, + _network: ::core::marker::PhantomData, + } + #[automatically_derived] + impl ::core::fmt::Debug for SupraContractsBindingsInstance { + #[inline] + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + f.debug_tuple("SupraContractsBindingsInstance").field(&self.address).finish() + } + } + /// Instantiation and getters/setters. + impl< + P: alloy_contract::private::Provider, + N: alloy_contract::private::Network, + > SupraContractsBindingsInstance { + /**Creates a new wrapper around an on-chain [`SupraContractsBindings`](self) contract instance. + +See the [wrapper's documentation](`SupraContractsBindingsInstance`) for more details.*/ + #[inline] + pub const fn new( + address: alloy_sol_types::private::Address, + __provider: P, + ) -> Self { + Self { + address, + provider: __provider, + _network: ::core::marker::PhantomData, + } + } + /**Deploys this contract using the given `provider` and constructor arguments, if any. + +Returns a new instance of the contract, if the deployment was successful. + +For more fine-grained control over the deployment process, use [`deploy_builder`] instead.*/ + #[inline] + pub async fn deploy( + __provider: P, + ) -> alloy_contract::Result> { + let call_builder = Self::deploy_builder(__provider); + let contract_address = call_builder.deploy().await?; + Ok(Self::new(contract_address, call_builder.provider)) + } + /**Creates a `RawCallBuilder` for deploying this contract using the given `provider` +and constructor arguments, if any. + +This is a simple wrapper around creating a `RawCallBuilder` with the data set to +the bytecode concatenated with the constructor's ABI-encoded arguments.*/ + #[inline] + pub fn deploy_builder(__provider: P) -> alloy_contract::RawCallBuilder { + alloy_contract::RawCallBuilder::new_raw_deploy( + __provider, + ::core::clone::Clone::clone(&BYTECODE), + ) + } + /// Returns a reference to the address. + #[inline] + pub const fn address(&self) -> &alloy_sol_types::private::Address { + &self.address + } + /// Sets the address. + #[inline] + pub fn set_address(&mut self, address: alloy_sol_types::private::Address) { + self.address = address; + } + /// Sets the address and returns `self`. + pub fn at(mut self, address: alloy_sol_types::private::Address) -> Self { + self.set_address(address); + self + } + /// Returns a reference to the provider. + #[inline] + pub const fn provider(&self) -> &P { + &self.provider + } + } + impl SupraContractsBindingsInstance<&P, N> { + /// Clones the provider and returns a new instance with the cloned provider. + #[inline] + pub fn with_cloned_provider(self) -> SupraContractsBindingsInstance { + SupraContractsBindingsInstance { + address: self.address, + provider: ::core::clone::Clone::clone(&self.provider), + _network: ::core::marker::PhantomData, + } + } + } + /// Function calls. + impl< + P: alloy_contract::private::Provider, + N: alloy_contract::private::Network, + > SupraContractsBindingsInstance { + /// Creates a new call builder using this contract instance's provider and address. + /// + /// Note that the call can be any function call, not just those defined in this + /// contract. Prefer using the other methods for building type-safe contract calls. + pub fn call_builder( + &self, + call: &C, + ) -> alloy_contract::SolCallBuilder<&P, C, N> { + alloy_contract::SolCallBuilder::new_sol(&self.provider, &self.address, call) + } + ///Creates a new call builder for the [`blockPrologue`] function. + pub fn blockPrologue( + &self, + ) -> alloy_contract::SolCallBuilder<&P, blockPrologueCall, N> { + self.call_builder(&blockPrologueCall) + } + ///Creates a new call builder for the [`getAllActiveTaskIds`] function. + pub fn getAllActiveTaskIds( + &self, + ) -> alloy_contract::SolCallBuilder<&P, getAllActiveTaskIdsCall, N> { + self.call_builder(&getAllActiveTaskIdsCall) + } + ///Creates a new call builder for the [`getCycleInfo`] function. + pub fn getCycleInfo( + &self, + ) -> alloy_contract::SolCallBuilder<&P, getCycleInfoCall, N> { + self.call_builder(&getCycleInfoCall) + } + ///Creates a new call builder for the [`getTaskDetails`] function. + pub fn getTaskDetails( + &self, + _taskIndex: u64, + ) -> alloy_contract::SolCallBuilder<&P, getTaskDetailsCall, N> { + self.call_builder(&getTaskDetailsCall { _taskIndex }) + } + ///Creates a new call builder for the [`getTaskDetailsBulk`] function. + pub fn getTaskDetailsBulk( + &self, + _taskIndexes: alloy::sol_types::private::Vec, + ) -> alloy_contract::SolCallBuilder<&P, getTaskDetailsBulkCall, N> { + self.call_builder( + &getTaskDetailsBulkCall { + _taskIndexes, + }, + ) + } + ///Creates a new call builder for the [`getTaskIdList`] function. + pub fn getTaskIdList( + &self, + ) -> alloy_contract::SolCallBuilder<&P, getTaskIdListCall, N> { + self.call_builder(&getTaskIdListCall) + } + ///Creates a new call builder for the [`getTransitionInfo`] function. + pub fn getTransitionInfo( + &self, + ) -> alloy_contract::SolCallBuilder<&P, getTransitionInfoCall, N> { + self.call_builder(&getTransitionInfoCall) + } + ///Creates a new call builder for the [`ifTaskExists`] function. + pub fn ifTaskExists( + &self, + _taskIndex: u64, + ) -> alloy_contract::SolCallBuilder<&P, ifTaskExistsCall, N> { + self.call_builder(&ifTaskExistsCall { _taskIndex }) + } + ///Creates a new call builder for the [`isAutomationEnabled`] function. + pub fn isAutomationEnabled( + &self, + ) -> alloy_contract::SolCallBuilder<&P, isAutomationEnabledCall, N> { + self.call_builder(&isAutomationEnabledCall) + } + ///Creates a new call builder for the [`processTasks`] function. + pub fn processTasks( + &self, + _cycleIndex: u64, + _taskIndexes: alloy::sol_types::private::Vec, + ) -> alloy_contract::SolCallBuilder<&P, processTasksCall, N> { + self.call_builder( + &processTasksCall { + _cycleIndex, + _taskIndexes, + }, + ) + } + } + /// Event filters. + impl< + P: alloy_contract::private::Provider, + N: alloy_contract::private::Network, + > SupraContractsBindingsInstance { + /// Creates a new event filter using this contract instance's provider and address. + /// + /// Note that the type can be any event, not just those defined in this contract. + /// Prefer using the other methods for building type-safe event filters. + pub fn event_filter( + &self, + ) -> alloy_contract::Event<&P, E, N> { + alloy_contract::Event::new_sol(&self.provider, &self.address) + } + } +} diff --git a/crates/supra-extension/src/transactions/automated_transaction.rs b/crates/supra-extension/src/transactions/automated_transaction.rs new file mode 100644 index 0000000000..ebc7656dea --- /dev/null +++ b/crates/supra-extension/src/transactions/automated_transaction.rs @@ -0,0 +1,496 @@ +//! AutomatedTransaction generated based on the registered active automation task. + +use alloy::eips::eip2930::AccessList; +use alloy::primitives::{Address, Bytes, ChainId, B256, U256}; +use alloy_eips::eip2718::Typed2718; +use alloy_consensus::transaction::Transaction; +use alloy_sol_types::SolType; +use context::transaction::{AccessListItem, SignedAuthorization}; +use context::TransactionType; +use primitives::TxKind; +use crate::errors::SupraExtensionError; +use crate::supra_contract_bindings::supra_contracts_bindings::CommonUtils::TaskDetails; +use crate::value_or_error; + +#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] +#[repr(u8)] +/// Automated transaction type corresponding automation task type. +pub enum AutomatedTransactionType { + /// User submitted automation task based + #[default] + UST, + /// Governance submitted/authorized automation task based. Will be gasless transaction + GST +} + +#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] +/// Automated transaction generated by node runtime based on the registered active automation task. +pub struct AutomatedTransaction { + /// Height of the block in scope of which this transaction is being executed. + pub block_height: u64, + /// Hash of the transaction which registered an automation task based on which this transaction is created. + pub registration_hash: B256, + /// Owner address of the automation task, the source of this transaction. + pub sender: Address, + /// Type of the automated transaction. + pub txn_type: AutomatedTransactionType, + /// Chain id. + #[cfg_attr(feature = "serde", serde(with = "alloy_serde::quantity"))] + pub chain_id: ChainId, + /// A scalar value equal to the automation task index based on which this transaction is created. + #[cfg_attr(feature = "serde", serde(with = "alloy_serde::quantity"))] + pub nonce: u64, + /// A scalar value equal to the maximum + /// amount of gas that should be used in executing + /// this transaction. This is paid up-front, before any + /// computation is done and may not be increased + /// later; formally Tg. + #[cfg_attr( + feature = "serde", + serde(with = "alloy_serde::quantity", rename = "gas", alias = "gasLimit") + )] + pub gas_limit: u64, + /// A scalar value equal to the maximum + /// amount of gas that should be used in executing + /// this transaction. + #[cfg_attr(feature = "serde", serde(with = "alloy_serde::quantity"))] + pub max_fee_per_gas: u128, + /// The 160-bit address of the message call’s recipient or, for a contract creation + /// transaction, ∅, used here to denote the only member of B0 ; formally Tt. + #[cfg_attr(feature = "serde", serde(default))] + pub to: Address, + /// A scalar value equal to the number of Wei to + /// be transferred to the message call’s recipient or, + /// in the case of contract creation, as an endowment + /// to the newly created account; formally Tv. + pub value: U256, + /// The accessList specifies a list of addresses and storage keys; + /// these addresses and storage keys are added into the `accessed_addresses` + /// and `accessed_storage_keys` global sets (introduced in EIP-2929). + /// A gas cost is charged, though at a discount relative to the cost of + /// accessing outside the list. + // Deserialize with `alloy_serde::null_as_default` to also accept a `null` value + // instead of an (empty) array. This is due to certain RPC providers (e.g., Filecoin's) + // sometimes returning `null` instead of an empty array `[]`. + // More details in . + #[cfg_attr(feature = "serde", serde(deserialize_with = "alloy_serde::null_as_default"))] + pub access_list: AccessList, + /// Input has two uses depending if `to` field is Create or Call. + /// pub init: An unlimited size byte array specifying the + /// EVM-code for the account initialisation procedure CREATE, + /// data: An unlimited size byte array specifying the + /// input data of the message call, formally Td. + pub input: Bytes, +} + +impl Transaction for AutomatedTransaction { + + #[inline] + fn chain_id(&self) -> Option { + Some(self.chain_id) + } + + #[inline] + fn nonce(&self) -> u64 { + self.nonce + } + + #[inline] + fn gas_limit(&self) -> u64 { + self.gas_limit + } + + #[inline] + fn gas_price(&self) -> Option { + None + } + + #[inline] + fn max_fee_per_gas(&self) -> u128 { + self.max_fee_per_gas + } + + #[inline] + fn max_priority_fee_per_gas(&self) -> Option { + Some(0) + } + + #[inline] + fn max_fee_per_blob_gas(&self) -> Option { + None + } + + #[inline] + fn priority_fee_or_price(&self) -> u128 { + 0 + } + + fn effective_gas_price(&self, base_fee: Option) -> u128 { + alloy_eips::eip1559::calc_effective_gas_price( + self.max_fee_per_gas, + 0, + base_fee, + ) + } + + #[inline] + fn is_dynamic_fee(&self) -> bool { + true + } + + #[inline] + fn kind(&self) -> TxKind { + TxKind::Call(self.to) + } + + #[inline] + fn is_create(&self) -> bool { + false + } + + #[inline] + fn value(&self) -> U256 { + self.value + } + + #[inline] + fn input(&self) -> &Bytes { + &self.input + } + + #[inline] + fn access_list(&self) -> Option<&AccessList> { + Some(&self.access_list) + } + + #[inline] + fn blob_versioned_hashes(&self) -> Option<&[B256]> { + None + } + + #[inline] + fn authorization_list(&self) -> Option<&[SignedAuthorization]> { + None + } +} + +impl Typed2718 for AutomatedTransaction { + fn ty(&self) -> u8 { + TransactionType::Custom as u8 + } +} + +impl AutomatedTransaction { + /// Returns true if automated transaction is gas-less, otherwise false. + /// GST type transactions are considered as gas-less. + pub fn is_gasless(&self) -> bool { + matches!(self.txn_type, AutomatedTransactionType::GST) + } +} + +/// Evm automated transaction with priority to be scheduled for execution. +#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] +pub struct AutomatedTransactionDetails { + /// Transaction details + pub txn: AutomatedTransaction, + /// Priority of the automated transaction to be scheduled. + /// The low value indicates higher priority. + pub priority: u64, +} + +type AccessListItemTy = ( + alloy_sol_types::sol_data::Address, + alloy_sol_types::sol_data::Array>, +); +type AccessListTy = alloy_sol_types::sol_data::Array; +type ExpandedPayloadTy = ( + alloy_sol_types::sol_data::Uint<256>, + alloy_sol_types::sol_data::Address, + alloy_sol_types::sol_data::Bytes, + AccessListTy, +); + +/// Automation task state in native layer +#[derive(Clone, Debug, PartialEq, Eq)] +#[repr(u8)] +enum AutomationTaskState { + Pending = 0, + Active = 1, + Cancelled = 2, +} + +impl TryFrom for AutomationTaskState { + type Error = SupraExtensionError; + fn try_from(value: u8) -> Result { + match value { + 0 => Ok(Self::Pending), + 1 => Ok(Self::Active), + 2 => Ok(Self::Cancelled), + _ => Err(SupraExtensionError::InvalidAutomationTaskStateValue(value)) + } + } +} + +/// [`AutomatedTransactionBuilder`] result +#[derive(Clone, Debug, PartialEq, Eq)] +pub enum BuildResult { + /// Success result wrapping [`AutomatedTransactionDetails`] + Success(AutomatedTransactionDetails), + /// Build failure due to gas-price limit surpass. + GasPriceLimitExceeded { + /// Gas price specified for the transaction + gas_price: u128, + /// Gas price threshold specified for the automation task during registration. + gas_price_cap: u128, + }, +} + +/// Builder for [`AutomatedTransactionDetails`] +/// All properties are mandatory to be set for successful automated transaction build. +/// The following values fall back to agreed defaults if not specified: +/// - priority - defaults to task-index +/// - access_list - default to empty access-list +/// - value - defaults to 0 +#[derive(Clone, Debug)] +pub struct AutomatedTransactionBuilder { + block_height: Option, + chain_id: Option, + gas_limit: Option, + gas_price: Option, + gas_price_cap: u128, + registration_hash: Option, + task_index: Option, + expiry_timestamp: Option, + owner: Option
, + tpy: Option, + priority: Option, + + to: Option
, + value: Option, + access_list: Option, + input: Option, +} + +#[allow(missing_docs)] +impl AutomatedTransactionBuilder { + pub fn new(gas_price_cap: u128) -> Self { + Self { + block_height: None, + chain_id: None, + gas_limit: None, + gas_price: None, + gas_price_cap, + registration_hash: None, + task_index: None, + expiry_timestamp: None, + owner: None, + tpy: None, + priority: None, + to: None, + value: Some(U256::from(0)), + access_list: Some(AccessList::default()), + input: None, + } + } + + pub fn block_height(mut self, block_height: u64) -> Self { + self.block_height = Some(block_height); + self + } + + pub fn chain_id(mut self, chain_id: ChainId) -> Self { + self.chain_id = Some(chain_id); + self + } + + pub fn gas_limit(mut self, gas_limit: u64) -> Self { + self.gas_limit = Some(gas_limit); + self + } + pub fn gas_price(mut self, gas_price: u128) -> Self { + self.gas_price = Some(gas_price); + self + } + pub fn gas_price_cap(mut self, gas_price_cap: u128) -> Self { + self.gas_price_cap = gas_price_cap; + self + } + pub fn registration_hash(mut self, registration_hash: B256) -> Self { + self.registration_hash = Some(registration_hash); + self + } + pub fn task_index(mut self, task_index: u64) -> Self { + self.task_index = Some(task_index); + self + } + pub fn expiry_timestamp(mut self, expiry_timestamp: u64) -> Self { + self.expiry_timestamp = Some(expiry_timestamp); + self + } + pub fn owner(mut self, owner: Address) -> Self { + self.owner = Some(owner); + self + } + pub fn tpy(mut self, tpy: AutomatedTransactionType) -> Self { + self.tpy = Some(tpy); + self + } + pub fn priority(mut self, priority: u64) -> Self { + self.priority = Some(priority); + self + } + pub fn to(mut self, to: Address) -> Self { + self.to = Some(to); + self + } + pub fn value(mut self, value: U256) -> Self { + self.value = Some(value); + self + } + pub fn access_list(mut self, access_list: AccessList) -> Self { + self.access_list = Some(access_list); + self + } + pub fn input(mut self, input: Bytes) -> Self { + self.input = Some(input); + self + } + pub fn build(self) -> Result { + let Self { + block_height, + chain_id, + gas_limit, + gas_price, + gas_price_cap, + registration_hash, + task_index, + expiry_timestamp: _, + owner, + tpy, + priority, + to, + value, + access_list, + input, + } = self; + let block_height = + value_or_error!(AutomatedTransactionBuilder, "block_height", block_height); + let chain_id = value_or_error!(AutomatedTransactionBuilder, "chain_id", chain_id); + let gas_limit = value_or_error!(AutomatedTransactionBuilder, "gas_limit", gas_limit); + let gas_price = value_or_error!(AutomatedTransactionBuilder, "gasPrice", gas_price); + let registration_hash = value_or_error!( + AutomatedTransactionBuilder, + "registration_hash", + registration_hash + ); + let task_index = value_or_error!(AutomatedTransactionBuilder, "task_index", task_index); + let owner = value_or_error!(AutomatedTransactionBuilder, "owner", owner); + let tpy = value_or_error!(AutomatedTransactionBuilder, "type", tpy); + let priority = priority.unwrap_or(task_index); + let to = value_or_error!(AutomatedTransactionBuilder, "to", to); + let value = value_or_error!(AutomatedTransactionBuilder, "value", value); + let access_list = value_or_error!(AutomatedTransactionBuilder, "access_list", access_list); + let input = value_or_error!(AutomatedTransactionBuilder, "input", input); + if gas_price_cap < gas_price { + return Ok(BuildResult::GasPriceLimitExceeded { + gas_price, + gas_price_cap, + }); + } + let txn = AutomatedTransaction { + block_height, + registration_hash, + sender: owner, + txn_type: tpy, + chain_id, + nonce: task_index, + gas_limit, + max_fee_per_gas: gas_price, + to, + value, + access_list, + input, + }; + Ok(BuildResult::Success(AutomatedTransactionDetails { + txn, + priority, + })) + } + + /// Checks whether the task/transaction can be considered as expired compared to the input + /// timestamp threshold value + /// If no expiry timestamp is specified, the potential underlying task is not considered as expired. + pub fn is_expired(&self, threshold: u64) -> bool { + self.expiry_timestamp.map(|t| t < threshold).unwrap_or(false) + } +} + +/// Constructs [`AutomatedTransactionBuilder`] from automation task details loaded from chain state. +/// Fails if: +/// - inner payload cannot be deserialized based on the [`ExpandedPayloadTy`] schema +/// - Loaded task is not in active state (Active | Cancelled) +impl TryFrom for AutomatedTransactionBuilder { + type Error = SupraExtensionError; + + fn try_from(value: TaskDetails) -> Result { + let TaskDetails { + maxGasAmount, + gasPriceCap, + automationFeeCapForCycle: _, + lockedFeeForNextCycle: _, + txHash, + taskIndex, + registrationTime: _, + expiryTime, + owner, + state, + payloadTx, + auxData: _, + } = value; + + if AutomationTaskState::try_from(state)? == AutomationTaskState::Pending { + return Err(SupraExtensionError::InvalidAutomationTaskStateForBuilder) + } + + let (value, to, input, access_list) = ExpandedPayloadTy::abi_decode(payloadTx.as_ref())?; + let access_items = access_list + .into_iter() + .map(|(address, storage_keys)| AccessListItem { + address, + storage_keys, + }) + .collect(); + let builder = Self::new(gasPriceCap) + .gas_limit(maxGasAmount as u64) + .gas_price_cap(gasPriceCap) + .registration_hash(txHash) + .task_index(taskIndex) + .expiry_timestamp(expiryTime) + .owner(owner) + .to(to) + .value(value) + .input(input) + .access_list(AccessList(access_items)); + Ok(builder) + } +} + +#[cfg(test)] +mod test { + use alloy::hex; + use alloy_sol_types::SolType; + use crate::transactions::automated_transaction::ExpandedPayloadTy; + #[test] + fn check_decode() { + let encoded = hex!("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000006b182f1488e8efeb2eb298155ed5bd7ff8a14042000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000242e1a7d4d0000000000000000000000000000000000000000000000000000000000000064000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000001111000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000022220000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001"); + let (value, to, input, access_list) = ExpandedPayloadTy::abi_decode(&encoded).unwrap(); + println!("to: {:?}", to); + println!("value: {:?}", value); + println!("access_list: {:?}", access_list); + println!("input: {:?}", input); + } +} \ No newline at end of file diff --git a/crates/supra-extension/src/transactions/automation_record.rs b/crates/supra-extension/src/transactions/automation_record.rs new file mode 100644 index 0000000000..4c50c7ba64 --- /dev/null +++ b/crates/supra-extension/src/transactions/automation_record.rs @@ -0,0 +1,233 @@ +//! Automation registry transaction record definition to assist automation bookkeeping. +use crate::errors::SupraExtensionError; +use crate::supra_contract_bindings::supra_contracts_bindings::SupraContractsBindings::processTasksCall; +use crate::value_or_error; +use alloy::eips::eip2930::AccessList; +use alloy::primitives::{Address, Bytes, ChainId, TxKind, B256, U256}; +use alloy_sol_types::SolCall; +use primitives::supra_constants::VM_SIGNER; +use alloy_eips::eip2718::Typed2718; +use context::TransactionType; +use alloy_consensus::transaction::Transaction; +use context::transaction::SignedAuthorization; + +#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] +/// Transaction representing automation transaction record which will trigger automation task processing +/// during cycle transitions assisting automation bookkeeping flow. +pub struct AutomationRegistryRecord { + /// Address of the transaction sender. By default it will be `@evm_vm_signer` reserved addressed by supra. + pub sender: Address, + /// Height of the block in scope of which this transaction is being executed. + pub block_height: u64, + /// Chain id. + #[cfg_attr(feature = "serde", serde(with = "alloy_serde::quantity"))] + pub chain_id: ChainId, + /// Index of the automation record being executed in scope of the block. + #[cfg_attr(feature = "serde", serde(with = "alloy_serde::quantity"))] + pub nonce: u64, + /// A scalar value equal to the maximum + /// amount of gas that should be used in executing + /// this transaction. Automation record execution will be gas-less, but it still will be guarded + /// by gas limit. + #[cfg_attr( + feature = "serde", + serde(with = "alloy_serde::quantity", rename = "gas", alias = "gasLimit") + )] + pub gas_limit: u64, + /// The 160-bit address of the message call’s recipient. + /// It will correspond to the address of the automation-registry/automation-controller SC deployed + /// by governance. + #[cfg_attr(feature = "serde", serde(default))] + pub to: Address, + /// Expected input data of the transaction + /// - Selector of automation registry record executor + /// - Index of the cycle for which automation registry record is scheduled for execution. + /// - List of the task indexes to be processed + pub input: Bytes, +} + +impl Transaction for AutomationRegistryRecord { + + #[inline] + fn chain_id(&self) -> Option { + Some(self.chain_id) + } + + #[inline] + fn nonce(&self) -> u64 { + self.nonce + } + + #[inline] + fn gas_limit(&self) -> u64 { + self.gas_limit + } + + #[inline] + fn gas_price(&self) -> Option { + None + } + + #[inline] + fn max_fee_per_gas(&self) -> u128 { + 0 + } + + #[inline] + fn max_priority_fee_per_gas(&self) -> Option { + Some(0) + } + + #[inline] + fn max_fee_per_blob_gas(&self) -> Option { + None + } + + #[inline] + fn priority_fee_or_price(&self) -> u128 { + 0 + } + + fn effective_gas_price(&self, _base_fee: Option) -> u128 { + 0 + } + + #[inline] + fn is_dynamic_fee(&self) -> bool { + false + } + + #[inline] + fn kind(&self) -> TxKind { + TxKind::Call(self.to) + } + + #[inline] + fn is_create(&self) -> bool { + false + } + + #[inline] + fn value(&self) -> U256 { + U256::from(0) + } + + #[inline] + fn input(&self) -> &Bytes { + &self.input + } + + #[inline] + fn access_list(&self) -> Option<&AccessList> { + None + } + + #[inline] + fn blob_versioned_hashes(&self) -> Option<&[B256]> { + None + } + + #[inline] + fn authorization_list(&self) -> Option<&[SignedAuthorization]> { + None + } +} + +impl Typed2718 for AutomationRegistryRecord { + fn ty(&self) -> u8 { + TransactionType::Custom as u8 + } + +} + +/// Builder for [`AutomationRegistryRecord`] +#[derive(Clone, Debug)] +pub struct AutomationRecordBuilder { + to: Address, + chain_id: Option, + block_height: Option, + nonce: Option, + gas_limit: Option, + task_indexes: Option>, + cycle_index: Option, +} + +#[allow(missing_docs)] +impl AutomationRecordBuilder { + /// New builder with the target address as input. + pub fn new(to: Address) -> Self { + Self { + to, + chain_id: None, + block_height: None, + nonce: None, + gas_limit: None, + task_indexes: None, + cycle_index: None, + } + } + pub fn block_height(mut self, block_height: u64) -> Self { + self.block_height = Some(block_height); + self + } + pub fn nonce(mut self, nonce: u64) -> Self { + self.nonce = Some(nonce); + self + } + + pub fn gas_limit(mut self, gas_limit: u64) -> Self { + self.gas_limit = Some(gas_limit); + self + } + pub fn task_indexes(mut self, task_indexes: Vec) -> Self { + self.task_indexes = Some(task_indexes); + self + } + + pub fn cycle_index(mut self, cycle_index: u64) -> Self { + self.cycle_index = Some(cycle_index); + self + } + + pub fn chain_id(mut self, chain_id: ChainId) -> Self { + self.chain_id = Some(chain_id); + self + } + + pub fn build(self) -> Result { + let Self { + to, + chain_id, block_height, + nonce, + gas_limit, + task_indexes, + cycle_index, + } = self; + let block_height = value_or_error!(AutomationRecordBuilder, "block_height", block_height); + let nonce = value_or_error!(AutomationRecordBuilder, "nonce", nonce); + let task_indexes = value_or_error!(AutomationRecordBuilder, "task_indexes", task_indexes); + let gas_limit = value_or_error!(AutomationRecordBuilder, "gas_limit", gas_limit); + let cycle_index = value_or_error!(AutomationRecordBuilder, "cycle_index", cycle_index); + let chain_id = value_or_error!(AutomationRecordBuilder, "chain_id", chain_id); + + Ok(AutomationRegistryRecord { + sender: VM_SIGNER, + chain_id, + block_height, + nonce, + gas_limit, + to, + input: Self::get_process_tasks_payload(cycle_index, task_indexes), + }) + } + + fn get_process_tasks_payload(_cycle_index: u64, _task_indexes: Vec) -> Bytes { + let process_task_call = processTasksCall { + _cycleIndex: _cycle_index, + _taskIndexes: _task_indexes, + }; + Bytes::from(process_task_call.abi_encode()) + } +} diff --git a/crates/supra-extension/src/transactions/block_metadata.rs b/crates/supra-extension/src/transactions/block_metadata.rs new file mode 100644 index 0000000000..2da929ead0 --- /dev/null +++ b/crates/supra-extension/src/transactions/block_metadata.rs @@ -0,0 +1,205 @@ +//! Definition of the block metadata transaction which will be executed for every block +//! to aid block based checks to assist chain regular operations + +use crate::errors::SupraExtensionError; +use crate::supra_contract_bindings::supra_contracts_bindings::SupraContractsBindings::blockPrologueCall; +use crate::value_or_error; +use alloy::primitives::{Address, Bytes, ChainId, B256, U256}; +use alloy_sol_types::SolCall; +use context::TransactionType; +use primitives::supra_constants::VM_SIGNER; +use alloy_eips::eip2718::Typed2718; +use alloy_consensus::transaction::Transaction; +use context::transaction::{AccessList, SignedAuthorization}; +use primitives::eip7825::TX_GAS_LIMIT_CAP; +use primitives::TxKind; + +/// EVM system transaction generated based on the block sent for execution. +/// Will trigger `BlockMeta::block_prologue` supra-evm SC API execution to meat +/// other `supra-evm` SC checks requiring per-block execution. +#[derive(Clone, Debug, Default, PartialEq, Eq, Hash)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +#[cfg_attr(feature = "serde", serde(rename_all = "camelCase"))] +pub struct BlockMetadata { + /// Id of the chain in scope of which block is being executed + #[cfg_attr(feature = "serde", serde(with = "alloy_serde::quantity"))] + pub chain_id: ChainId, + /// Sender of the transaction. By default, will be agreed @evm_vm_signer + pub sender: Address, + /// A height of the block based on which this transaction is created + #[cfg_attr(feature = "serde", serde(with = "alloy_serde::quantity"))] + pub height: u64, + /// Hash of the block being executed + pub block_hash: B256, + /// Block creation timestamp in seconds + pub timestamp: U256, + /// The 160-bit address of the message call’s recipient + #[cfg_attr(feature = "serde", serde(default))] + pub to: Address, + /// An unlimited size byte array specifying the + /// input data of the message call. + pub input: Bytes, +} + +impl Transaction for BlockMetadata { + + #[inline] + fn chain_id(&self) -> Option { + Some(self.chain_id) + } + + #[inline] + fn nonce(&self) -> u64 { + self.height + } + + #[inline] + fn gas_limit(&self) -> u64 { + TX_GAS_LIMIT_CAP + } + + #[inline] + fn gas_price(&self) -> Option { + None + } + + #[inline] + fn max_fee_per_gas(&self) -> u128 { + 0 + } + + #[inline] + fn max_priority_fee_per_gas(&self) -> Option { + Some(0) + } + + #[inline] + fn max_fee_per_blob_gas(&self) -> Option { + None + } + + #[inline] + fn priority_fee_or_price(&self) -> u128 { + 0 + } + + fn effective_gas_price(&self, _base_fee: Option) -> u128 { + 0 + } + + #[inline] + fn is_dynamic_fee(&self) -> bool { + false + } + + #[inline] + fn kind(&self) -> TxKind { + TxKind::Call(self.to) + } + + #[inline] + fn is_create(&self) -> bool { + false + } + + #[inline] + fn value(&self) -> U256 { + U256::from(0) + } + + #[inline] + fn input(&self) -> &Bytes { + &self.input + } + + #[inline] + fn access_list(&self) -> Option<&AccessList> { + None + } + + #[inline] + fn blob_versioned_hashes(&self) -> Option<&[B256]> { + None + } + + #[inline] + fn authorization_list(&self) -> Option<&[SignedAuthorization]> { + None + } +} +impl Typed2718 for BlockMetadata { + fn ty(&self) -> u8 { + TransactionType::Custom as u8 + } + +} + +/// Builder for [`BlockMetadata`] transaction. +/// All properties are mandatory. +#[derive(Clone, Debug)] +pub struct BlockMetadataBuilder { + to: Address, + height: Option, + block_hash: Option, + timestamp: Option, + chain_id: Option, +} + +#[allow(missing_docs)] +impl BlockMetadataBuilder { + pub fn new(to: Address) -> Self { + Self { + to, + height: None, + block_hash: None, + timestamp: None, + chain_id: None, + } + } + pub fn height(mut self, height: u64) -> Self { + self.height = Some(height); + self + } + + pub fn block_hash(mut self, block_hash: B256) -> Self { + self.block_hash = Some(block_hash); + self + } + pub fn chain_id(mut self, chain_id: u64) -> Self { + self.chain_id = Some(chain_id); + self + } + + pub fn timestamp(mut self, timestamp: U256) -> Self { + self.timestamp = Some(timestamp); + self + } + + pub fn build(self) -> Result { + let Self { + to, + height, + block_hash, + timestamp, + chain_id, + } = self; + let height = value_or_error!(BlockMetadataBuilder, "height", height); + let block_hash = value_or_error!(BlockMetadataBuilder, "block_hash", block_hash); + let timestamp = value_or_error!(BlockMetadataBuilder, "timestamp", timestamp); + let chain_id = value_or_error!(BlockMetadataBuilder, "chain_id", chain_id); + + Ok(BlockMetadata { + chain_id, + sender: VM_SIGNER, + height, + block_hash, + timestamp, + to, + input: Self::get_block_prologue(), + }) + } + + fn get_block_prologue() -> Bytes { + Bytes::from(blockPrologueCall.abi_encode()) + } +} diff --git a/crates/supra-extension/src/transactions/mod.rs b/crates/supra-extension/src/transactions/mod.rs new file mode 100644 index 0000000000..f89aa9c026 --- /dev/null +++ b/crates/supra-extension/src/transactions/mod.rs @@ -0,0 +1,4 @@ +//! Set of transactions introduced as part of the supra extension +pub mod automation_record; +pub mod block_metadata; +pub mod automated_transaction; \ No newline at end of file diff --git a/solidity/supra_contracts/src/SupraContractsBindings.sol b/solidity/supra_contracts/src/SupraContractsBindings.sol new file mode 100644 index 0000000000..23039776a1 --- /dev/null +++ b/solidity/supra_contracts/src/SupraContractsBindings.sol @@ -0,0 +1,26 @@ +// SPDX-License-Identifier: MIT +pragma solidity 0.8.27; + +import {CommonUtils} from "./CommonUtils.sol"; + +interface SupraContractsBindings { + + // View functions of AutomationRegistry + function ifTaskExists(uint64 _taskIndex) external view returns (bool); + function getAllActiveTaskIds() external view returns (uint256[] memory); + function getTaskIdList() external view returns (uint256[] memory); + function isAutomationEnabled() external view returns (bool); + + function getTaskDetails(uint64 _taskIndex) external view returns (CommonUtils.TaskDetails memory); + function getTaskDetailsBulk(uint64[] memory _taskIndexes) external view returns (CommonUtils.TaskDetails[] memory); + + // View functions of AutomationController + function getCycleInfo() external view returns(uint64, uint64, uint64, CommonUtils.CycleState); + function getTransitionInfo() external view returns (uint64, uint128); + + // Entry function to be called by node runtime for bookkeeping + function processTasks(uint64 _cycleIndex, uint64[] memory _taskIndexes) external; + + // Entry function of the BlockMeta for block metadata transaction + function blockPrologue() external; +}