diff --git a/.tool-versions b/.tool-versions index 8030dc9..4e4d000 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1,2 +1,2 @@ -scarb 2.5.3 -starknet-foundry 0.16.0 +scarb 2.8.0 +starknet-foundry 0.27.0 diff --git a/Scarb.lock b/Scarb.lock index c0f3c1e..1eed624 100644 --- a/Scarb.lock +++ b/Scarb.lock @@ -3,18 +3,113 @@ version = 1 [[package]] name = "openzeppelin" -version = "0.9.0" -source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.9.0#364db5b1aecc1335d2e65db887291d19aa28937d" +version = "0.16.0" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb" +dependencies = [ + "openzeppelin_access", + "openzeppelin_account", + "openzeppelin_governance", + "openzeppelin_introspection", + "openzeppelin_merkle_tree", + "openzeppelin_presets", + "openzeppelin_security", + "openzeppelin_token", + "openzeppelin_upgrades", + "openzeppelin_utils", +] + +[[package]] +name = "openzeppelin_access" +version = "0.16.0" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb" +dependencies = [ + "openzeppelin_introspection", + "openzeppelin_utils", +] + +[[package]] +name = "openzeppelin_account" +version = "0.16.0" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb" +dependencies = [ + "openzeppelin_introspection", + "openzeppelin_utils", +] + +[[package]] +name = "openzeppelin_governance" +version = "0.16.0" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb" +dependencies = [ + "openzeppelin_access", + "openzeppelin_introspection", +] + +[[package]] +name = "openzeppelin_introspection" +version = "0.16.0" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb" + +[[package]] +name = "openzeppelin_merkle_tree" +version = "0.16.0" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb" + +[[package]] +name = "openzeppelin_presets" +version = "0.16.0" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb" +dependencies = [ + "openzeppelin_access", + "openzeppelin_account", + "openzeppelin_introspection", + "openzeppelin_token", + "openzeppelin_upgrades", +] + +[[package]] +name = "openzeppelin_security" +version = "0.16.0" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb" + +[[package]] +name = "openzeppelin_testing" +version = "0.16.0" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb" +dependencies = [ + "snforge_std", +] + +[[package]] +name = "openzeppelin_token" +version = "0.16.0" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb" +dependencies = [ + "openzeppelin_account", + "openzeppelin_governance", + "openzeppelin_introspection", +] + +[[package]] +name = "openzeppelin_upgrades" +version = "0.16.0" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb" + +[[package]] +name = "openzeppelin_utils" +version = "0.16.0" +source = "git+https://github.com/OpenZeppelin/cairo-contracts.git?tag=v0.16.0#ba00ce76a93dcf25c081ab2698da20690b5a1cfb" [[package]] name = "piltover" version = "0.1.0" dependencies = [ "openzeppelin", + "openzeppelin_testing", "snforge_std", ] [[package]] name = "snforge_std" -version = "0.16.0" -source = "git+https://github.com/foundry-rs/starknet-foundry?tag=v0.16.0#f58e0ab42b6095b7d0cb841ede595aecbc9cb45d" +version = "0.27.0" +source = "git+https://github.com/foundry-rs/starknet-foundry?tag=v0.27.0#2d99b7c00678ef0363881ee0273550c44a9263de" diff --git a/Scarb.toml b/Scarb.toml index 6063afe..cc33e9c 100644 --- a/Scarb.toml +++ b/Scarb.toml @@ -4,9 +4,16 @@ version = "0.1.0" edition = "2023_10" [dependencies] -snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.16.0" } -starknet = "2.5.3" -openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.9.0" } +starknet = "2.8.0" +openzeppelin = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.16.0" } + +[dev-dependencies] +snforge_std = { git = "https://github.com/foundry-rs/starknet-foundry", tag = "v0.27.0" } +openzeppelin_testing = { git = "https://github.com/OpenZeppelin/cairo-contracts.git", tag = "v0.16.0" } + +[lib] +sierra = true +casm = true [scripts] test = "snforge test" diff --git a/bindings/Cargo.lock b/bindings/Cargo.lock index 2b1bcc0..7782bed 100644 --- a/bindings/Cargo.lock +++ b/bindings/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" dependencies = [ "gimli", ] @@ -17,6 +17,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + [[package]] name = "aes" version = "0.8.4" @@ -28,6 +34,15 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + [[package]] name = "android-tzdata" version = "0.1.1" @@ -44,90 +59,75 @@ dependencies = [ ] [[package]] -name = "anyhow" -version = "1.0.82" +name = "anstream" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" +dependencies = [ + "anstyle", + "anstyle-parse", + "anstyle-query", + "anstyle-wincon", + "colorchoice", + "is_terminal_polyfill", + "utf8parse", +] [[package]] -name = "ark-ff" -version = "0.4.2" +name = "anstyle" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" -dependencies = [ - "ark-ff-asm", - "ark-ff-macros", - "ark-serialize", - "ark-std", - "derivative", - "digest", - "itertools", - "num-bigint", - "num-traits", - "paste", - "rustc_version", - "zeroize", -] +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" [[package]] -name = "ark-ff-asm" -version = "0.4.2" +name = "anstyle-parse" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" dependencies = [ - "quote", - "syn 1.0.109", + "utf8parse", ] [[package]] -name = "ark-ff-macros" -version = "0.4.2" +name = "anstyle-query" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" dependencies = [ - "num-bigint", - "num-traits", - "proc-macro2", - "quote", - "syn 1.0.109", + "windows-sys 0.52.0", ] [[package]] -name = "ark-serialize" -version = "0.4.2" +name = "anstyle-wincon" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" dependencies = [ - "ark-std", - "digest", - "num-bigint", + "anstyle", + "windows-sys 0.52.0", ] [[package]] -name = "ark-std" -version = "0.4.0" +name = "anyhow" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" -dependencies = [ - "num-traits", - "rand", -] +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "async-trait" -version = "0.1.79" +version = "0.1.82" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507401cad91ec6a857ed5513a2073c82a9b9048762b885bb98655b306964681" +checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.77", ] [[package]] @@ -138,36 +138,30 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.77", ] [[package]] name = "autocfg" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" -version = "0.3.71" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" dependencies = [ "addr2line", "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.7.4", "object", "rustc-demangle", ] -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - [[package]] name = "base64" version = "0.21.7" @@ -175,16 +169,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] -name = "bigdecimal" -version = "0.3.1" +name = "base64" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6773ddc0eafc0e509fb60e48dff7f450f8e674a0686ae8605e8d9901bd5eefa" -dependencies = [ - "num-bigint", - "num-integer", - "num-traits", - "serde", -] +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bindings" @@ -240,25 +228,41 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" [[package]] name = "cainome" -version = "0.1.5" -source = "git+https://github.com/cartridge-gg/cainome?tag=v0.1.10#3f98ae4b8239bb976ab434b438775bcd3db5207a" +version = "0.2.3" +source = "git+https://github.com/cartridge-gg/cainome?rev=v0.4.0#0d29bb06b3f7cb7fcb8f0749c3b2ad105a5551dd" dependencies = [ + "anyhow", + "async-trait", "cainome-cairo-serde", "cainome-parser", "cainome-rs", + "cainome-rs-macro", + "camino", + "clap", + "clap_complete", + "convert_case", + "serde", + "serde_json", + "starknet", + "starknet-types-core 0.1.5 (git+https://github.com/starknet-io/types-rs?rev=f98f048)", + "thiserror", + "tracing", + "tracing-subscriber", + "url", ] [[package]] name = "cainome-cairo-serde" version = "0.1.0" -source = "git+https://github.com/cartridge-gg/cainome?tag=v0.1.10#3f98ae4b8239bb976ab434b438775bcd3db5207a" +source = "git+https://github.com/cartridge-gg/cainome?rev=v0.4.0#0d29bb06b3f7cb7fcb8f0749c3b2ad105a5551dd" dependencies = [ + "serde", "starknet", "thiserror", ] @@ -266,36 +270,69 @@ dependencies = [ [[package]] name = "cainome-parser" version = "0.1.0" -source = "git+https://github.com/cartridge-gg/cainome?tag=v0.1.10#3f98ae4b8239bb976ab434b438775bcd3db5207a" +source = "git+https://github.com/cartridge-gg/cainome?rev=v0.4.0#0d29bb06b3f7cb7fcb8f0749c3b2ad105a5551dd" dependencies = [ + "convert_case", "quote", "serde_json", "starknet", - "syn 2.0.58", + "syn 2.0.77", "thiserror", ] [[package]] name = "cainome-rs" version = "0.1.0" -source = "git+https://github.com/cartridge-gg/cainome?tag=v0.1.10#3f98ae4b8239bb976ab434b438775bcd3db5207a" +source = "git+https://github.com/cartridge-gg/cainome?rev=v0.4.0#0d29bb06b3f7cb7fcb8f0749c3b2ad105a5551dd" +dependencies = [ + "anyhow", + "cainome-cairo-serde", + "cainome-parser", + "camino", + "prettyplease", + "proc-macro2", + "quote", + "serde_json", + "starknet", + "syn 2.0.77", + "thiserror", +] + +[[package]] +name = "cainome-rs-macro" +version = "0.1.0" +source = "git+https://github.com/cartridge-gg/cainome?rev=v0.4.0#0d29bb06b3f7cb7fcb8f0749c3b2ad105a5551dd" dependencies = [ "anyhow", "cainome-cairo-serde", "cainome-parser", + "cainome-rs", + "proc-macro-error", "proc-macro2", "quote", "serde_json", "starknet", - "syn 2.0.58", + "syn 2.0.77", "thiserror", ] +[[package]] +name = "camino" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" +dependencies = [ + "serde", +] + [[package]] name = "cc" -version = "1.0.92" +version = "1.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2678b2e3449475e95b0aa6f9b506a28e61b3dc8996592b983695e8ebb58a8b41" +checksum = "e9d013ecb737093c0e86b151a7b837993cf9ec6c502946cfb44bedc392421e0b" +dependencies = [ + "shlex", +] [[package]] name = "cfg-if" @@ -305,15 +342,15 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.37" +version = "0.4.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a0d04d43504c61aa6c7531f1871dd0d418d91130162063b789da00fd7057a5e" +checksum = "a21f936df1771bf62b77f047b726c4625ff2e8aa607c01ec06e5a05bd8463401" dependencies = [ "android-tzdata", "iana-time-zone", "num-traits", "serde", - "windows-targets 0.52.4", + "windows-targets 0.52.6", ] [[package]] @@ -326,6 +363,70 @@ dependencies = [ "inout", ] +[[package]] +name = "clap" +version = "4.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" +dependencies = [ + "clap_builder", + "clap_derive", +] + +[[package]] +name = "clap_builder" +version = "4.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" +dependencies = [ + "anstream", + "anstyle", + "clap_lex", + "strsim", +] + +[[package]] +name = "clap_complete" +version = "4.5.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "205d5ef6d485fa47606b98b0ddc4ead26eb850aaa86abfb562a94fb3280ecba0" +dependencies = [ + "clap", +] + +[[package]] +name = "clap_derive" +version = "4.5.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +dependencies = [ + "heck", + "proc-macro2", + "quote", + "syn 2.0.77", +] + +[[package]] +name = "clap_lex" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" + +[[package]] +name = "colorchoice" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" + +[[package]] +name = "convert_case" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec182b0ca2f35d8fc196cf3404988fd8b8c739a4d270ff118a398feb0cbec1ca" +dependencies = [ + "unicode-segmentation", +] + [[package]] name = "core-foundation" version = "0.9.4" @@ -338,24 +439,24 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" dependencies = [ "libc", ] [[package]] name = "crc32fast" -version = "1.4.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] @@ -398,9 +499,9 @@ dependencies = [ [[package]] name = "darling" -version = "0.20.8" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54e36fcd13ed84ffdfda6f5be89b31287cbb80c439841fe69e04841435464391" +checksum = "6f63b86c8a8826a49b8c21f08a2d07338eec8d900540f8630dc76284be802989" dependencies = [ "darling_core", "darling_macro", @@ -408,27 +509,27 @@ dependencies = [ [[package]] name = "darling_core" -version = "0.20.8" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c2cf1c23a687a1feeb728783b993c4e1ad83d99f351801977dd809b48d0a70f" +checksum = "95133861a8032aaea082871032f5815eb9e98cef03fa916ab4500513994df9e5" dependencies = [ "fnv", "ident_case", "proc-macro2", "quote", "strsim", - "syn 2.0.58", + "syn 2.0.77", ] [[package]] name = "darling_macro" -version = "0.20.8" +version = "0.20.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a668eda54683121533a393014d8692171709ff57a7d61f187b6e782719f8933f" +checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.58", + "syn 2.0.77", ] [[package]] @@ -441,17 +542,6 @@ dependencies = [ "serde", ] -[[package]] -name = "derivative" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - [[package]] name = "digest" version = "0.10.7" @@ -463,12 +553,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "either" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11157ac094ffbdde99aa67b23417ebdd801842852b500e395a45a9c0aac03e4a" - [[package]] name = "encoding_rs" version = "0.8.34" @@ -547,12 +631,12 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.28" +version = "1.0.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" +checksum = "324a1be68054ef05ad64b861cc9eaf1d623d2d8cb25b4bf2cb9cdd902b4bf253" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.8.0", ] [[package]] @@ -627,9 +711,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "js-sys", @@ -640,9 +724,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "h2" @@ -656,7 +740,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.2.6", + "indexmap 2.5.0", "slab", "tokio", "tokio-util", @@ -671,9 +755,21 @@ checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] name = "hashbrown" -version = "0.14.3" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" [[package]] name = "hex" @@ -714,9 +810,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "httpdate" @@ -726,9 +822,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" [[package]] name = "hyper" -version = "0.14.28" +version = "0.14.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" dependencies = [ "bytes", "futures-channel", @@ -852,12 +948,13 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.6" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" dependencies = [ "equivalent", - "hashbrown 0.14.3", + "hashbrown 0.14.5", + "serde", ] [[package]] @@ -876,13 +973,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] -name = "itertools" -version = "0.10.5" +name = "is_terminal_polyfill" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itoa" @@ -892,9 +986,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" dependencies = [ "wasm-bindgen", ] @@ -908,23 +1002,60 @@ dependencies = [ "cpufeatures", ] +[[package]] +name = "lambdaworks-crypto" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7fb5d4f22241504f7c7b8d2c3a7d7835d7c07117f10bff2a7d96a9ef6ef217c3" +dependencies = [ + "lambdaworks-math", + "serde", + "sha2", + "sha3", +] + +[[package]] +name = "lambdaworks-math" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "358e172628e713b80a530a59654154bfc45783a6ed70ea284839800cebdf8f97" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + [[package]] name = "libc" -version = "0.2.153" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "matchers" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" +dependencies = [ + "regex-automata 0.1.10", +] [[package]] name = "memchr" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "mime" @@ -934,31 +1065,50 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + [[package]] name = "mio" -version = "0.8.11" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ + "hermit-abi", "libc", "wasi", - "windows-sys 0.48.0", + "windows-sys 0.52.0", +] + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", ] [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ - "autocfg", "num-integer", "num-traits", ] @@ -980,18 +1130,18 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", ] [[package]] name = "object" -version = "0.32.2" +version = "0.36.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" dependencies = [ "memchr", ] @@ -1002,11 +1152,17 @@ version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + [[package]] name = "parity-scale-codec" -version = "3.6.9" +version = "3.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881331e34fa842a2fb61cc2db9643a8fedc615e47cfcc52597d1af0db9a7e8fe" +checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" dependencies = [ "arrayvec", "bitvec", @@ -1018,9 +1174,9 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.6.9" +version = "3.6.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be30eaf4b0a9fba5336683b38de57bb86d179a35862ba6bfcf57625d006bde5b" +checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -1028,12 +1184,6 @@ dependencies = [ "syn 1.0.109", ] -[[package]] -name = "paste" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" - [[package]] name = "pbkdf2" version = "0.11.0" @@ -1069,9 +1219,22 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "prettyplease" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "479cf940fbbb3426c32c5d5176f62ad57549a0bb84773423ba8be9d089f5faba" +dependencies = [ + "proc-macro2", + "syn 2.0.77", +] [[package]] name = "primitive-types" @@ -1088,28 +1251,51 @@ dependencies = [ [[package]] name = "proc-macro-crate" -version = "2.0.2" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b00f26d3400549137f92511a46ac1cd8ce37cb5598a96d382381458b992a5d24" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" dependencies = [ - "toml_datetime", "toml_edit", ] +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + [[package]] name = "proc-macro2" -version = "1.0.79" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e835ff2298f5721608eb1a980ecaee1aef2c132bf95ecc026a11b7bf3c01c02e" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -1150,6 +1336,50 @@ dependencies = [ "getrandom", ] +[[package]] +name = "regex" +version = "1.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", +] + +[[package]] +name = "regex-automata" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" +dependencies = [ + "regex-syntax 0.6.29", +] + +[[package]] +name = "regex-automata" +version = "0.4.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax 0.8.4", +] + +[[package]] +name = "regex-syntax" +version = "0.6.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" + +[[package]] +name = "regex-syntax" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" + [[package]] name = "reqwest" version = "0.11.27" @@ -1228,9 +1458,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustc-hex" @@ -1238,20 +1468,11 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - [[package]] name = "rustls" -version = "0.21.10" +version = "0.21.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" +checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e" dependencies = [ "log", "ring", @@ -1280,9 +1501,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "salsa20" @@ -1315,39 +1536,34 @@ dependencies = [ "untrusted", ] -[[package]] -name = "semver" -version = "1.0.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca" - [[package]] name = "serde" -version = "1.0.197" +version = "1.0.209" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2" +checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.197" +version = "1.0.209" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b" +checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.77", ] [[package]] name = "serde_json" -version = "1.0.115" +version = "1.0.128" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12dc5c46daa8e9fdf4f5e71b6cf9a53f2487da0e86e55808e2d35539666497dd" +checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] @@ -1377,15 +1593,17 @@ dependencies = [ [[package]] name = "serde_with" -version = "2.3.3" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07ff71d2c147a7b57362cead5e22f772cd52f6ab31cfcd9edcd7f6aeb2a0afbe" +checksum = "69cecfa94848272156ea67b2b1a53f20fc7bc638c4a46d2f8abde08f05f4b857" dependencies = [ - "base64 0.13.1", + "base64 0.22.1", "chrono", "hex", "indexmap 1.9.3", + "indexmap 2.5.0", "serde", + "serde_derive", "serde_json", "serde_with_macros", "time", @@ -1393,14 +1611,14 @@ dependencies = [ [[package]] name = "serde_with_macros" -version = "2.3.3" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "881b6f881b17d13214e5d494c939ebab463d01264ce1811e9d4ac3a882e7695f" +checksum = "a8fee4991ef4f274617a51ad4af30519438dacb2f56ac773b08a1922ff743350" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.77", ] [[package]] @@ -1424,6 +1642,21 @@ dependencies = [ "keccak", ] +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "slab" version = "0.4.9" @@ -1433,11 +1666,17 @@ dependencies = [ "autocfg", ] +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + [[package]] name = "socket2" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", "windows-sys 0.52.0", @@ -1451,15 +1690,13 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "starknet" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eb139c5e6f6c6da627080e33cc00b3fc1c9733403034ca1ee9c42a95c337c7f" +version = "0.11.0" +source = "git+https://github.com/xJonathanLEI/starknet-rs?rev=2ddc694#2ddc69479d326ed154df438d22f2d720fbba746e" dependencies = [ "starknet-accounts", "starknet-contract", - "starknet-core 0.8.1", + "starknet-core", "starknet-crypto", - "starknet-ff", "starknet-macros", "starknet-providers", "starknet-signers", @@ -1467,13 +1704,13 @@ dependencies = [ [[package]] name = "starknet-accounts" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3743932c80ad2a5868c2dd4ef729de4e12060c88e73e4bb678a5f8e51b105e53" +version = "0.10.0" +source = "git+https://github.com/xJonathanLEI/starknet-rs?rev=2ddc694#2ddc69479d326ed154df438d22f2d720fbba746e" dependencies = [ "async-trait", "auto_impl", - "starknet-core 0.8.1", + "starknet-core", + "starknet-crypto", "starknet-providers", "starknet-signers", "thiserror", @@ -1481,44 +1718,25 @@ dependencies = [ [[package]] name = "starknet-contract" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e55aac528c5376e1626d5a8d4daaf280bfd08f909dadc729e5b009203d6ec21" +version = "0.10.0" +source = "git+https://github.com/xJonathanLEI/starknet-rs?rev=2ddc694#2ddc69479d326ed154df438d22f2d720fbba746e" dependencies = [ "serde", "serde_json", "serde_with", "starknet-accounts", - "starknet-core 0.8.1", + "starknet-core", "starknet-providers", "thiserror", ] [[package]] name = "starknet-core" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1da8287d38c2c1253c95c915c8d28d4ef4722f8c200e264133e1ba60bdadef7c" -dependencies = [ - "base64 0.21.7", - "flate2", - "hex", - "serde", - "serde_json", - "serde_json_pythonic", - "serde_with", - "sha3", - "starknet-crypto", - "starknet-ff", -] - -[[package]] -name = "starknet-core" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ed286d637e34fb8ae1cd2f9615120ec8ff38d1cffd311ed7fdd497cdd2bd01f" +version = "0.11.1" +source = "git+https://github.com/xJonathanLEI/starknet-rs?rev=2ddc694#2ddc69479d326ed154df438d22f2d720fbba746e" dependencies = [ "base64 0.21.7", + "crypto-bigint", "flate2", "hex", "serde", @@ -1527,14 +1745,13 @@ dependencies = [ "serde_with", "sha3", "starknet-crypto", - "starknet-ff", + "starknet-types-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "starknet-crypto" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e2c30c01e8eb0fc913c4ee3cf676389fffc1d1182bfe5bb9670e4e72e968064" +version = "0.7.1" +source = "git+https://github.com/xJonathanLEI/starknet-rs?rev=2ddc694#2ddc69479d326ed154df438d22f2d720fbba746e" dependencies = [ "crypto-bigint", "hex", @@ -1544,93 +1761,91 @@ dependencies = [ "num-traits", "rfc6979", "sha2", - "starknet-crypto-codegen", "starknet-curve", - "starknet-ff", + "starknet-types-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "zeroize", ] -[[package]] -name = "starknet-crypto-codegen" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bbc159a1934c7be9761c237333a57febe060ace2bc9e3b337a59a37af206d19f" -dependencies = [ - "starknet-curve", - "starknet-ff", - "syn 2.0.58", -] - [[package]] name = "starknet-curve" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1c383518bb312751e4be80f53e8644034aa99a0afb29d7ac41b89a997db875b" -dependencies = [ - "starknet-ff", -] - -[[package]] -name = "starknet-ff" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abf1b44ec5b18d87c1ae5f54590ca9d0699ef4dd5b2ffa66fc97f24613ec585" +version = "0.5.0" +source = "git+https://github.com/xJonathanLEI/starknet-rs?rev=2ddc694#2ddc69479d326ed154df438d22f2d720fbba746e" dependencies = [ - "ark-ff", - "bigdecimal", - "crypto-bigint", - "getrandom", - "hex", - "num-bigint", - "serde", + "starknet-types-core 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", ] [[package]] name = "starknet-macros" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95d549d3078bdbe775d0deaa8ddb57a19942989ce7c1f2dfd60beeb322bb4945" +version = "0.2.0" +source = "git+https://github.com/xJonathanLEI/starknet-rs?rev=2ddc694#2ddc69479d326ed154df438d22f2d720fbba746e" dependencies = [ - "starknet-core 0.10.0", - "syn 2.0.58", + "starknet-core", + "syn 2.0.77", ] [[package]] name = "starknet-providers" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b08084f36ff7f11743ec71f33f0b11d439cbe0524058def299eb47de1ef1c28" +version = "0.11.0" +source = "git+https://github.com/xJonathanLEI/starknet-rs?rev=2ddc694#2ddc69479d326ed154df438d22f2d720fbba746e" dependencies = [ "async-trait", "auto_impl", "ethereum-types", "flate2", + "getrandom", "log", "reqwest", "serde", "serde_json", "serde_with", - "starknet-core 0.8.1", + "starknet-core", "thiserror", "url", ] [[package]] name = "starknet-signers" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91919d8f318f0b5bcc4ff5849fbd3fb46adaaa72e0bf204742bab7c822425ff4" +version = "0.9.0" +source = "git+https://github.com/xJonathanLEI/starknet-rs?rev=2ddc694#2ddc69479d326ed154df438d22f2d720fbba746e" dependencies = [ "async-trait", "auto_impl", "crypto-bigint", "eth-keystore", + "getrandom", "rand", - "starknet-core 0.8.1", + "starknet-core", "starknet-crypto", "thiserror", ] +[[package]] +name = "starknet-types-core" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6bacf0ba19bc721e518bc4bf389ff13daa8a7c5db5fd320600473b8aa9fcbd" +dependencies = [ + "lambdaworks-crypto", + "lambdaworks-math", + "num-bigint", + "num-integer", + "num-traits", + "serde", +] + +[[package]] +name = "starknet-types-core" +version = "0.1.5" +source = "git+https://github.com/starknet-io/types-rs?rev=f98f048#f98f048efa776f1f8da81a19f337a9b8c2f4b8f7" +dependencies = [ + "lambdaworks-crypto", + "lambdaworks-math", + "num-bigint", + "num-integer", + "num-traits", + "serde", +] + [[package]] name = "static_assertions" version = "1.1.0" @@ -1639,15 +1854,15 @@ checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" [[package]] name = "strsim" -version = "0.10.0" +version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" @@ -1662,9 +1877,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.58" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44cfb93f38070beee36b3fef7d4f5a16f27751d94b187b666a5cc5e9b0d30687" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -1706,22 +1921,32 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "thiserror" -version = "1.0.58" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03468839009160513471e86a034bb2c5c0e4baae3b43f79ffc55c4a5427b3297" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.58" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61f3ba182994efc43764a46c018c347bc492c79f024e705f46567b418f6d4f7" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.77", +] + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", ] [[package]] @@ -1766,9 +1991,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" dependencies = [ "tinyvec_macros", ] @@ -1781,9 +2006,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.37.0" +version = "1.40.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" +checksum = "e2b070231665d27ad9ec9b8df639893f46727666c6767db40317fbe920a5d998" dependencies = [ "backtrace", "bytes", @@ -1791,7 +2016,7 @@ dependencies = [ "mio", "pin-project-lite", "socket2", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -1806,40 +2031,39 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.10" +version = "0.7.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", - "tracing", ] [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" [[package]] name = "toml_edit" -version = "0.20.2" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.5.0", "toml_datetime", "winnow", ] [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" @@ -1848,9 +2072,21 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ "pin-project-lite", + "tracing-attributes", "tracing-core", ] +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.77", +] + [[package]] name = "tracing-core" version = "0.1.32" @@ -1858,6 +2094,49 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" dependencies = [ "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-serde" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc6b213177105856957181934e4920de57730fc69bf42c37ee5bb664d406d9e1" +dependencies = [ + "serde", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "matchers", + "nu-ansi-term", + "once_cell", + "regex", + "serde", + "serde_json", + "sharded-slab", + "smallvec", + "thread_local", + "tracing", + "tracing-core", + "tracing-log", + "tracing-serde", ] [[package]] @@ -1905,6 +2184,12 @@ dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-segmentation" +version = "1.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" + [[package]] name = "untrusted" version = "0.9.0" @@ -1913,15 +2198,21 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", "percent-encoding", ] +[[package]] +name = "utf8parse" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" + [[package]] name = "uuid" version = "0.8.2" @@ -1932,11 +2223,17 @@ dependencies = [ "serde", ] +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "want" @@ -1955,34 +2252,35 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.77", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.42" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" dependencies = [ "cfg-if", "js-sys", @@ -1992,9 +2290,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2002,28 +2300,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.77", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" dependencies = [ "js-sys", "wasm-bindgen", @@ -2035,13 +2333,35 @@ version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + [[package]] name = "windows-core" version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.52.4", + "windows-targets 0.52.6", ] [[package]] @@ -2059,7 +2379,7 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.4", + "windows-targets 0.52.6", ] [[package]] @@ -2079,17 +2399,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.4" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7dd37b7e5ab9018759f893a1952c9420d060016fc19a472b4bb20d1bdd694d1b" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.4", - "windows_aarch64_msvc 0.52.4", - "windows_i686_gnu 0.52.4", - "windows_i686_msvc 0.52.4", - "windows_x86_64_gnu 0.52.4", - "windows_x86_64_gnullvm 0.52.4", - "windows_x86_64_msvc 0.52.4", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "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]] @@ -2100,9 +2421,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.4" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcf46cf4c365c6f2d1cc93ce535f2c8b244591df96ceee75d8e83deb70a9cac9" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -2112,9 +2433,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.4" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da9f259dd3bcf6990b55bffd094c4f7235817ba4ceebde8e6d11cd0c5633b675" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -2124,9 +2445,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.4" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b474d8268f99e0995f25b9f095bc7434632601028cf86590aea5c8a5cb7801d3" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -2136,9 +2463,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.4" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1515e9a29e5bed743cb4415a9ecf5dfca648ce85ee42e15873c3cd8610ff8e02" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -2148,9 +2475,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.4" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5eee091590e89cc02ad514ffe3ead9eb6b660aedca2183455434b93546371a03" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -2160,9 +2487,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.4" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77ca79f2451b49fa9e2af39f0747fe999fcda4f5e241b2898624dca97a1f2177" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -2172,15 +2499,15 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.4" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32b752e52a2da0ddfbdbcc6fceadfeede4c939ed16d13e648833a61dfb611ed8" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.5.40" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" dependencies = [ "memchr", ] @@ -2205,21 +2532,28 @@ dependencies = [ ] [[package]] -name = "zeroize" -version = "1.7.0" +name = "zerocopy" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ - "zeroize_derive", + "byteorder", + "zerocopy-derive", ] [[package]] -name = "zeroize_derive" -version = "1.4.2" +name = "zerocopy-derive" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.58", + "syn 2.0.77", ] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" diff --git a/bindings/Cargo.toml b/bindings/Cargo.toml index e595576..30bc133 100644 --- a/bindings/Cargo.toml +++ b/bindings/Cargo.toml @@ -6,5 +6,4 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -cainome = { git = "https://github.com/cartridge-gg/cainome", tag = "v0.1.10", features = ["abigen-rs"] } - +cainome = { git = "https://github.com/cartridge-gg/cainome", rev = "v0.4.0", features = ["abigen-rs"] } diff --git a/bindings/src/bindings.rs b/bindings/src/bindings.rs index 5fc3925..dff3c53 100644 --- a/bindings/src/bindings.rs +++ b/bindings/src/bindings.rs @@ -1,23 +1,34 @@ #[derive(Debug)] pub struct AppChain < A : starknet :: accounts :: ConnectedAccount + Sync > -{ pub address : starknet :: core :: types :: FieldElement, pub account : A, } -impl < A : starknet :: accounts :: ConnectedAccount + Sync > AppChain < A > { - pub fn - new(address : starknet :: core :: types :: FieldElement, account : A) -> - Self { Self { address, account } } pub fn - set_contract_address(mut self, address : starknet :: core :: types :: - FieldElement) { self.address = address; } pub fn provider(& self) -> & A - :: Provider { self.account.provider() } + pub address : starknet :: core :: types :: Felt, pub account : A, pub + block_id : starknet :: core :: types :: BlockId, +} impl < A : starknet :: accounts :: ConnectedAccount + Sync > AppChain < A > +{ + pub fn new(address : starknet :: core :: types :: Felt, account : A) -> + Self + { + Self + { + address, account, block_id : starknet :: core :: types :: BlockId + :: Tag(starknet :: core :: types :: BlockTag :: Pending) + } + } pub fn + set_contract_address(& mut self, address : starknet :: core :: types :: + Felt) { self.address = address; } pub fn provider(& self) -> & A :: + Provider { self.account.provider() } pub fn + set_block(& mut self, block_id : starknet :: core :: types :: BlockId) + { self.block_id = block_id; } pub fn + with_block(self, block_id : starknet :: core :: types :: BlockId) -> Self + { Self { block_id, .. self } } } #[derive(Debug)] pub struct AppChainReader < P : starknet :: providers :: Provider + Sync > { - pub address : starknet :: core :: types :: FieldElement, pub provider : P, - pub block_id : starknet :: core :: types :: BlockId, + pub address : starknet :: core :: types :: Felt, pub provider : P, pub + block_id : starknet :: core :: types :: BlockId, } impl < P : starknet :: providers :: Provider + Sync > AppChainReader < P > { - pub fn - new(address : starknet :: core :: types :: FieldElement, provider : P,) -> + pub fn new(address : starknet :: core :: types :: Felt, provider : P,) -> Self { Self @@ -26,200 +37,128 @@ Provider + Sync > :: Tag(starknet :: core :: types :: BlockTag :: Pending) } } pub fn - set_contract_address(mut self, address : starknet :: core :: types :: - FieldElement) { self.address = address; } pub fn provider(& self) -> & P + set_contract_address(& mut self, address : starknet :: core :: types :: + Felt) { self.address = address; } pub fn provider(& self) -> & P { & self.provider } pub fn + set_block(& mut self, block_id : starknet :: core :: types :: BlockId) + { self.block_id = block_id; } pub fn with_block(self, block_id : starknet :: core :: types :: BlockId) -> Self { Self { block_id, .. self } } -} #[derive(Debug, PartialEq, Clone)] pub struct U256 -{ pub low : u128, pub high : u128 } impl cainome :: cairo_serde :: CairoSerde -for U256 -{ - type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < - usize > = None; #[inline] fn - cairo_serialized_size(__rust : & Self :: RustType) -> usize - { - let mut __size = 0; __size += u128 :: - cairo_serialized_size(& __rust.low); __size += u128 :: - cairo_serialized_size(& __rust.high); __size - } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: - core :: types :: FieldElement > - { - let mut __out : Vec < starknet :: core :: types :: FieldElement > = - vec! []; __out.extend(u128 :: cairo_serialize(& __rust.low)); - __out.extend(u128 :: cairo_serialize(& __rust.high)); __out - } fn - cairo_deserialize(__felts : & [starknet :: core :: types :: FieldElement], - __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > - { - let mut __offset = __offset; let low = u128 :: - cairo_deserialize(__felts, __offset) ? ; __offset += u128 :: - cairo_serialized_size(& low); let high = u128 :: - cairo_deserialize(__felts, __offset) ? ; __offset += u128 :: - cairo_serialized_size(& high); Ok(U256 { low, high }) - } -} #[derive(Debug, PartialEq, Clone)] pub struct MessageToStarknetReceived -{ - pub message_hash : starknet :: core :: types :: FieldElement, pub from : - cainome :: cairo_serde :: ContractAddress, pub to : cainome :: cairo_serde - :: ContractAddress, pub payload : Vec < starknet :: core :: types :: - FieldElement > -} impl cainome :: cairo_serde :: CairoSerde for MessageToStarknetReceived +} #[derive(Debug, PartialEq, Eq, Clone, Copy,)] pub struct +LogStateTransitionFact +{ pub state_transition_fact : cainome :: cairo_serde :: U256 } impl cainome :: +cairo_serde :: CairoSerde for LogStateTransitionFact { type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < usize > = None; #[inline] fn cairo_serialized_size(__rust : & Self :: RustType) -> usize { - let mut __size = 0; __size += starknet :: core :: types :: - FieldElement :: cairo_serialized_size(& __rust.message_hash); __size - += cainome :: cairo_serde :: ContractAddress :: - cairo_serialized_size(& __rust.from); __size += cainome :: cairo_serde - :: ContractAddress :: cairo_serialized_size(& __rust.to); __size += - Vec :: < starknet :: core :: types :: FieldElement > :: - cairo_serialized_size(& __rust.payload); __size + let mut __size = 0; __size += cainome :: cairo_serde :: U256 :: + cairo_serialized_size(& __rust.state_transition_fact); __size } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: - core :: types :: FieldElement > + core :: types :: Felt > { - let mut __out : Vec < starknet :: core :: types :: FieldElement > = - vec! []; - __out.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(& __rust.message_hash)); - __out.extend(cainome :: cairo_serde :: ContractAddress :: - cairo_serialize(& __rust.from)); - __out.extend(cainome :: cairo_serde :: ContractAddress :: - cairo_serialize(& __rust.to)); - __out.extend(Vec :: < starknet :: core :: types :: FieldElement > :: - cairo_serialize(& __rust.payload)); __out + let mut __out : Vec < starknet :: core :: types :: Felt > = vec! []; + __out.extend(cainome :: cairo_serde :: U256 :: + cairo_serialize(& __rust.state_transition_fact)); __out } fn - cairo_deserialize(__felts : & [starknet :: core :: types :: FieldElement], + cairo_deserialize(__felts : & [starknet :: core :: types :: Felt], __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > { - let mut __offset = __offset; let message_hash = starknet :: core :: - types :: FieldElement :: cairo_deserialize(__felts, __offset) ? ; - __offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& message_hash); let from = cainome :: - cairo_serde :: ContractAddress :: cairo_deserialize(__felts, __offset) - ? ; __offset += cainome :: cairo_serde :: ContractAddress :: - cairo_serialized_size(& from); let to = cainome :: cairo_serde :: - ContractAddress :: cairo_deserialize(__felts, __offset) ? ; __offset - += cainome :: cairo_serde :: ContractAddress :: - cairo_serialized_size(& to); let payload = Vec :: < starknet :: core - :: types :: FieldElement > :: cairo_deserialize(__felts, __offset) ? ; - __offset += Vec :: < starknet :: core :: types :: FieldElement > :: - cairo_serialized_size(& payload); - Ok(MessageToStarknetReceived { message_hash, from, to, payload }) + let mut __offset = __offset; let state_transition_fact = cainome :: + cairo_serde :: U256 :: cairo_deserialize(__felts, __offset) ? ; + __offset += cainome :: cairo_serde :: U256 :: + cairo_serialized_size(& state_transition_fact); + Ok(LogStateTransitionFact { state_transition_fact }) } -} #[derive(Debug, PartialEq, Clone)] pub struct ProgramInfoChanged +} #[derive(Debug, PartialEq, Eq, Clone, Copy,)] pub struct LogStateUpdate { - pub changed_by : cainome :: cairo_serde :: ContractAddress, pub - old_program_hash : starknet :: core :: types :: FieldElement, pub - new_program_hash : starknet :: core :: types :: FieldElement, pub - old_config_hash : starknet :: core :: types :: FieldElement, pub - new_config_hash : starknet :: core :: types :: FieldElement -} impl cainome :: cairo_serde :: CairoSerde for ProgramInfoChanged + pub state_root : starknet :: core :: types :: Felt, pub block_number : + starknet :: core :: types :: Felt, pub block_hash : starknet :: core :: + types :: Felt +} impl cainome :: cairo_serde :: CairoSerde for LogStateUpdate { type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < usize > = None; #[inline] fn cairo_serialized_size(__rust : & Self :: RustType) -> usize { - let mut __size = 0; __size += cainome :: cairo_serde :: - ContractAddress :: cairo_serialized_size(& __rust.changed_by); __size - += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& __rust.old_program_hash); __size += starknet - :: core :: types :: FieldElement :: - cairo_serialized_size(& __rust.new_program_hash); __size += starknet - :: core :: types :: FieldElement :: - cairo_serialized_size(& __rust.old_config_hash); __size += starknet :: - core :: types :: FieldElement :: - cairo_serialized_size(& __rust.new_config_hash); __size + let mut __size = 0; __size += starknet :: core :: types :: Felt :: + cairo_serialized_size(& __rust.state_root); __size += starknet :: core + :: types :: Felt :: cairo_serialized_size(& __rust.block_number); + __size += starknet :: core :: types :: Felt :: + cairo_serialized_size(& __rust.block_hash); __size } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: - core :: types :: FieldElement > + core :: types :: Felt > { - let mut __out : Vec < starknet :: core :: types :: FieldElement > = - vec! []; - __out.extend(cainome :: cairo_serde :: ContractAddress :: - cairo_serialize(& __rust.changed_by)); - __out.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(& __rust.old_program_hash)); - __out.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(& __rust.new_program_hash)); - __out.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(& __rust.old_config_hash)); - __out.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(& __rust.new_config_hash)); __out + let mut __out : Vec < starknet :: core :: types :: Felt > = vec! []; + __out.extend(starknet :: core :: types :: Felt :: + cairo_serialize(& __rust.state_root)); + __out.extend(starknet :: core :: types :: Felt :: + cairo_serialize(& __rust.block_number)); + __out.extend(starknet :: core :: types :: Felt :: + cairo_serialize(& __rust.block_hash)); __out } fn - cairo_deserialize(__felts : & [starknet :: core :: types :: FieldElement], + cairo_deserialize(__felts : & [starknet :: core :: types :: Felt], __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > { - let mut __offset = __offset; let changed_by = cainome :: cairo_serde - :: ContractAddress :: cairo_deserialize(__felts, __offset) ? ; - __offset += cainome :: cairo_serde :: ContractAddress :: - cairo_serialized_size(& changed_by); let old_program_hash = starknet - :: core :: types :: FieldElement :: - cairo_deserialize(__felts, __offset) ? ; __offset += starknet :: core - :: types :: FieldElement :: cairo_serialized_size(& old_program_hash); - let new_program_hash = starknet :: core :: types :: FieldElement :: - cairo_deserialize(__felts, __offset) ? ; __offset += starknet :: core - :: types :: FieldElement :: cairo_serialized_size(& new_program_hash); - let old_config_hash = starknet :: core :: types :: FieldElement :: - cairo_deserialize(__felts, __offset) ? ; __offset += starknet :: core - :: types :: FieldElement :: cairo_serialized_size(& old_config_hash); - let new_config_hash = starknet :: core :: types :: FieldElement :: - cairo_deserialize(__felts, __offset) ? ; __offset += starknet :: core - :: types :: FieldElement :: cairo_serialized_size(& new_config_hash); - Ok(ProgramInfoChanged - { - changed_by, old_program_hash, new_program_hash, old_config_hash, - new_config_hash - }) + let mut __offset = __offset; let state_root = starknet :: core :: + types :: Felt :: cairo_deserialize(__felts, __offset) ? ; __offset += + starknet :: core :: types :: Felt :: + cairo_serialized_size(& state_root); let block_number = starknet :: + core :: types :: Felt :: cairo_deserialize(__felts, __offset) ? ; + __offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& block_number); let block_hash = starknet :: + core :: types :: Felt :: cairo_deserialize(__felts, __offset) ? ; + __offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& block_hash); + Ok(LogStateUpdate { state_root, block_number, block_hash }) } -} #[derive(Debug, PartialEq, Clone)] pub struct MessageCanceled +} #[derive(Debug, PartialEq, Eq, Clone, Copy,)] pub struct MessageCanceled { - pub message_hash : starknet :: core :: types :: FieldElement, pub from : - cainome :: cairo_serde :: ContractAddress, pub to : cainome :: cairo_serde - :: ContractAddress, pub selector : starknet :: core :: types :: - FieldElement, pub payload : Vec < starknet :: core :: types :: - FieldElement > , pub nonce : starknet :: core :: types :: FieldElement + pub message_hash : starknet :: core :: types :: Felt, pub from : cainome + :: cairo_serde :: ContractAddress, pub to : cainome :: cairo_serde :: + ContractAddress, pub selector : starknet :: core :: types :: Felt, pub + payload : Vec < starknet :: core :: types :: Felt > , pub nonce : starknet + :: core :: types :: Felt } impl cainome :: cairo_serde :: CairoSerde for MessageCanceled { type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < usize > = None; #[inline] fn cairo_serialized_size(__rust : & Self :: RustType) -> usize { - let mut __size = 0; __size += starknet :: core :: types :: - FieldElement :: cairo_serialized_size(& __rust.message_hash); __size - += cainome :: cairo_serde :: ContractAddress :: + let mut __size = 0; __size += starknet :: core :: types :: Felt :: + cairo_serialized_size(& __rust.message_hash); __size += cainome :: + cairo_serde :: ContractAddress :: cairo_serialized_size(& __rust.from); __size += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& __rust.to); __size += - starknet :: core :: types :: FieldElement :: + starknet :: core :: types :: Felt :: cairo_serialized_size(& __rust.selector); __size += Vec :: < starknet - :: core :: types :: FieldElement > :: - cairo_serialized_size(& __rust.payload); __size += starknet :: core :: - types :: FieldElement :: cairo_serialized_size(& __rust.nonce); __size + :: core :: types :: Felt > :: cairo_serialized_size(& __rust.payload); + __size += starknet :: core :: types :: Felt :: + cairo_serialized_size(& __rust.nonce); __size } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: - core :: types :: FieldElement > + core :: types :: Felt > { - let mut __out : Vec < starknet :: core :: types :: FieldElement > = - vec! []; - __out.extend(starknet :: core :: types :: FieldElement :: + let mut __out : Vec < starknet :: core :: types :: Felt > = vec! []; + __out.extend(starknet :: core :: types :: Felt :: cairo_serialize(& __rust.message_hash)); __out.extend(cainome :: cairo_serde :: ContractAddress :: cairo_serialize(& __rust.from)); __out.extend(cainome :: cairo_serde :: ContractAddress :: cairo_serialize(& __rust.to)); - __out.extend(starknet :: core :: types :: FieldElement :: + __out.extend(starknet :: core :: types :: Felt :: cairo_serialize(& __rust.selector)); - __out.extend(Vec :: < starknet :: core :: types :: FieldElement > :: + __out.extend(Vec :: < starknet :: core :: types :: Felt > :: cairo_serialize(& __rust.payload)); - __out.extend(starknet :: core :: types :: FieldElement :: + __out.extend(starknet :: core :: types :: Felt :: cairo_serialize(& __rust.nonce)); __out } fn - cairo_deserialize(__felts : & [starknet :: core :: types :: FieldElement], + cairo_deserialize(__felts : & [starknet :: core :: types :: Felt], __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > { let mut __offset = __offset; let message_hash = starknet :: core :: - types :: FieldElement :: cairo_deserialize(__felts, __offset) ? ; - __offset += starknet :: core :: types :: FieldElement :: + types :: Felt :: cairo_deserialize(__felts, __offset) ? ; __offset += + starknet :: core :: types :: Felt :: cairo_serialized_size(& message_hash); let from = cainome :: cairo_serde :: ContractAddress :: cairo_deserialize(__felts, __offset) ? ; __offset += cainome :: cairo_serde :: ContractAddress :: @@ -227,102 +166,64 @@ for U256 ContractAddress :: cairo_deserialize(__felts, __offset) ? ; __offset += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& to); let selector = starknet :: core :: types - :: FieldElement :: cairo_deserialize(__felts, __offset) ? ; __offset - += starknet :: core :: types :: FieldElement :: + :: Felt :: cairo_deserialize(__felts, __offset) ? ; __offset += + starknet :: core :: types :: Felt :: cairo_serialized_size(& selector); let payload = Vec :: < starknet :: - core :: types :: FieldElement > :: - cairo_deserialize(__felts, __offset) ? ; __offset += Vec :: < starknet - :: core :: types :: FieldElement > :: + core :: types :: Felt > :: cairo_deserialize(__felts, __offset) ? ; + __offset += Vec :: < starknet :: core :: types :: Felt > :: cairo_serialized_size(& payload); let nonce = starknet :: core :: - types :: FieldElement :: cairo_deserialize(__felts, __offset) ? ; - __offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& nonce); + types :: Felt :: cairo_deserialize(__felts, __offset) ? ; __offset += + starknet :: core :: types :: Felt :: cairo_serialized_size(& nonce); Ok(MessageCanceled { message_hash, from, to, selector, payload, nonce }) } -} #[derive(Debug, PartialEq, Clone)] pub struct OwnershipTransferred -{ - pub previous_owner : cainome :: cairo_serde :: ContractAddress, pub - new_owner : cainome :: cairo_serde :: ContractAddress -} impl cainome :: cairo_serde :: CairoSerde for OwnershipTransferred -{ - type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < - usize > = None; #[inline] fn - cairo_serialized_size(__rust : & Self :: RustType) -> usize - { - let mut __size = 0; __size += cainome :: cairo_serde :: - ContractAddress :: cairo_serialized_size(& __rust.previous_owner); - __size += cainome :: cairo_serde :: ContractAddress :: - cairo_serialized_size(& __rust.new_owner); __size - } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: - core :: types :: FieldElement > - { - let mut __out : Vec < starknet :: core :: types :: FieldElement > = - vec! []; - __out.extend(cainome :: cairo_serde :: ContractAddress :: - cairo_serialize(& __rust.previous_owner)); - __out.extend(cainome :: cairo_serde :: ContractAddress :: - cairo_serialize(& __rust.new_owner)); __out - } fn - cairo_deserialize(__felts : & [starknet :: core :: types :: FieldElement], - __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > - { - let mut __offset = __offset; let previous_owner = cainome :: - cairo_serde :: ContractAddress :: cairo_deserialize(__felts, __offset) - ? ; __offset += cainome :: cairo_serde :: ContractAddress :: - cairo_serialized_size(& previous_owner); let new_owner = cainome :: - cairo_serde :: ContractAddress :: cairo_deserialize(__felts, __offset) - ? ; __offset += cainome :: cairo_serde :: ContractAddress :: - cairo_serialized_size(& new_owner); - Ok(OwnershipTransferred { previous_owner, new_owner }) - } -} #[derive(Debug, PartialEq, Clone)] pub struct MessageCancellationStarted +} #[derive(Debug, PartialEq, Eq, Clone, Copy,)] pub struct +MessageCancellationStarted { - pub message_hash : starknet :: core :: types :: FieldElement, pub from : - cainome :: cairo_serde :: ContractAddress, pub to : cainome :: cairo_serde - :: ContractAddress, pub selector : starknet :: core :: types :: - FieldElement, pub payload : Vec < starknet :: core :: types :: - FieldElement > , pub nonce : starknet :: core :: types :: FieldElement + pub message_hash : starknet :: core :: types :: Felt, pub from : cainome + :: cairo_serde :: ContractAddress, pub to : cainome :: cairo_serde :: + ContractAddress, pub selector : starknet :: core :: types :: Felt, pub + payload : Vec < starknet :: core :: types :: Felt > , pub nonce : starknet + :: core :: types :: Felt } impl cainome :: cairo_serde :: CairoSerde for MessageCancellationStarted { type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < usize > = None; #[inline] fn cairo_serialized_size(__rust : & Self :: RustType) -> usize { - let mut __size = 0; __size += starknet :: core :: types :: - FieldElement :: cairo_serialized_size(& __rust.message_hash); __size - += cainome :: cairo_serde :: ContractAddress :: + let mut __size = 0; __size += starknet :: core :: types :: Felt :: + cairo_serialized_size(& __rust.message_hash); __size += cainome :: + cairo_serde :: ContractAddress :: cairo_serialized_size(& __rust.from); __size += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& __rust.to); __size += - starknet :: core :: types :: FieldElement :: + starknet :: core :: types :: Felt :: cairo_serialized_size(& __rust.selector); __size += Vec :: < starknet - :: core :: types :: FieldElement > :: - cairo_serialized_size(& __rust.payload); __size += starknet :: core :: - types :: FieldElement :: cairo_serialized_size(& __rust.nonce); __size + :: core :: types :: Felt > :: cairo_serialized_size(& __rust.payload); + __size += starknet :: core :: types :: Felt :: + cairo_serialized_size(& __rust.nonce); __size } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: - core :: types :: FieldElement > + core :: types :: Felt > { - let mut __out : Vec < starknet :: core :: types :: FieldElement > = - vec! []; - __out.extend(starknet :: core :: types :: FieldElement :: + let mut __out : Vec < starknet :: core :: types :: Felt > = vec! []; + __out.extend(starknet :: core :: types :: Felt :: cairo_serialize(& __rust.message_hash)); __out.extend(cainome :: cairo_serde :: ContractAddress :: cairo_serialize(& __rust.from)); __out.extend(cainome :: cairo_serde :: ContractAddress :: cairo_serialize(& __rust.to)); - __out.extend(starknet :: core :: types :: FieldElement :: + __out.extend(starknet :: core :: types :: Felt :: cairo_serialize(& __rust.selector)); - __out.extend(Vec :: < starknet :: core :: types :: FieldElement > :: + __out.extend(Vec :: < starknet :: core :: types :: Felt > :: cairo_serialize(& __rust.payload)); - __out.extend(starknet :: core :: types :: FieldElement :: + __out.extend(starknet :: core :: types :: Felt :: cairo_serialize(& __rust.nonce)); __out } fn - cairo_deserialize(__felts : & [starknet :: core :: types :: FieldElement], + cairo_deserialize(__felts : & [starknet :: core :: types :: Felt], __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > { let mut __offset = __offset; let message_hash = starknet :: core :: - types :: FieldElement :: cairo_deserialize(__felts, __offset) ? ; - __offset += starknet :: core :: types :: FieldElement :: + types :: Felt :: cairo_deserialize(__felts, __offset) ? ; __offset += + starknet :: core :: types :: Felt :: cairo_serialized_size(& message_hash); let from = cainome :: cairo_serde :: ContractAddress :: cairo_deserialize(__felts, __offset) ? ; __offset += cainome :: cairo_serde :: ContractAddress :: @@ -330,84 +231,54 @@ for U256 ContractAddress :: cairo_deserialize(__felts, __offset) ? ; __offset += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& to); let selector = starknet :: core :: types - :: FieldElement :: cairo_deserialize(__felts, __offset) ? ; __offset - += starknet :: core :: types :: FieldElement :: + :: Felt :: cairo_deserialize(__felts, __offset) ? ; __offset += + starknet :: core :: types :: Felt :: cairo_serialized_size(& selector); let payload = Vec :: < starknet :: - core :: types :: FieldElement > :: - cairo_deserialize(__felts, __offset) ? ; __offset += Vec :: < starknet - :: core :: types :: FieldElement > :: + core :: types :: Felt > :: cairo_deserialize(__felts, __offset) ? ; + __offset += Vec :: < starknet :: core :: types :: Felt > :: cairo_serialized_size(& payload); let nonce = starknet :: core :: - types :: FieldElement :: cairo_deserialize(__felts, __offset) ? ; - __offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& nonce); + types :: Felt :: cairo_deserialize(__felts, __offset) ? ; __offset += + starknet :: core :: types :: Felt :: cairo_serialized_size(& nonce); Ok(MessageCancellationStarted { message_hash, from, to, selector, payload, nonce }) } -} #[derive(Debug, PartialEq, Clone)] pub struct LogStateTransitionFact -{ pub state_transition_fact : U256 } impl cainome :: cairo_serde :: CairoSerde -for LogStateTransitionFact -{ - type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < - usize > = None; #[inline] fn - cairo_serialized_size(__rust : & Self :: RustType) -> usize - { - let mut __size = 0; __size += U256 :: - cairo_serialized_size(& __rust.state_transition_fact); __size - } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: - core :: types :: FieldElement > - { - let mut __out : Vec < starknet :: core :: types :: FieldElement > = - vec! []; - __out.extend(U256 :: cairo_serialize(& __rust.state_transition_fact)); - __out - } fn - cairo_deserialize(__felts : & [starknet :: core :: types :: FieldElement], - __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > - { - let mut __offset = __offset; let state_transition_fact = U256 :: - cairo_deserialize(__felts, __offset) ? ; __offset += U256 :: - cairo_serialized_size(& state_transition_fact); - Ok(LogStateTransitionFact { state_transition_fact }) - } -} #[derive(Debug, PartialEq, Clone)] pub struct MessageConsumed +} #[derive(Debug, PartialEq, Eq, Clone, Copy,)] pub struct MessageConsumed { - pub message_hash : starknet :: core :: types :: FieldElement, pub from : - cainome :: cairo_serde :: ContractAddress, pub to : cainome :: cairo_serde - :: ContractAddress, pub payload : Vec < starknet :: core :: types :: - FieldElement > + pub message_hash : starknet :: core :: types :: Felt, pub from : cainome + :: cairo_serde :: ContractAddress, pub to : cainome :: cairo_serde :: + ContractAddress, pub payload : Vec < starknet :: core :: types :: Felt > } impl cainome :: cairo_serde :: CairoSerde for MessageConsumed { type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < usize > = None; #[inline] fn cairo_serialized_size(__rust : & Self :: RustType) -> usize { - let mut __size = 0; __size += starknet :: core :: types :: - FieldElement :: cairo_serialized_size(& __rust.message_hash); __size - += cainome :: cairo_serde :: ContractAddress :: + let mut __size = 0; __size += starknet :: core :: types :: Felt :: + cairo_serialized_size(& __rust.message_hash); __size += cainome :: + cairo_serde :: ContractAddress :: cairo_serialized_size(& __rust.from); __size += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& __rust.to); __size += - Vec :: < starknet :: core :: types :: FieldElement > :: + Vec :: < starknet :: core :: types :: Felt > :: cairo_serialized_size(& __rust.payload); __size } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: - core :: types :: FieldElement > + core :: types :: Felt > { - let mut __out : Vec < starknet :: core :: types :: FieldElement > = - vec! []; - __out.extend(starknet :: core :: types :: FieldElement :: + let mut __out : Vec < starknet :: core :: types :: Felt > = vec! []; + __out.extend(starknet :: core :: types :: Felt :: cairo_serialize(& __rust.message_hash)); __out.extend(cainome :: cairo_serde :: ContractAddress :: cairo_serialize(& __rust.from)); __out.extend(cainome :: cairo_serde :: ContractAddress :: cairo_serialize(& __rust.to)); - __out.extend(Vec :: < starknet :: core :: types :: FieldElement > :: + __out.extend(Vec :: < starknet :: core :: types :: Felt > :: cairo_serialize(& __rust.payload)); __out } fn - cairo_deserialize(__felts : & [starknet :: core :: types :: FieldElement], + cairo_deserialize(__felts : & [starknet :: core :: types :: Felt], __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > { let mut __offset = __offset; let message_hash = starknet :: core :: - types :: FieldElement :: cairo_deserialize(__felts, __offset) ? ; - __offset += starknet :: core :: types :: FieldElement :: + types :: Felt :: cairo_deserialize(__felts, __offset) ? ; __offset += + starknet :: core :: types :: Felt :: cairo_serialized_size(& message_hash); let from = cainome :: cairo_serde :: ContractAddress :: cairo_deserialize(__felts, __offset) ? ; __offset += cainome :: cairo_serde :: ContractAddress :: @@ -415,102 +286,121 @@ for LogStateTransitionFact ContractAddress :: cairo_deserialize(__felts, __offset) ? ; __offset += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& to); let payload = Vec :: < starknet :: core - :: types :: FieldElement > :: cairo_deserialize(__felts, __offset) ? ; - __offset += Vec :: < starknet :: core :: types :: FieldElement > :: + :: types :: Felt > :: cairo_deserialize(__felts, __offset) ? ; + __offset += Vec :: < starknet :: core :: types :: Felt > :: cairo_serialized_size(& payload); Ok(MessageConsumed { message_hash, from, to, payload }) } -} #[derive(Debug, PartialEq, Clone)] pub struct LogStateUpdate +} #[derive(Debug, PartialEq, Eq, Clone, Copy,)] pub struct MessageSent { - pub state_root : starknet :: core :: types :: FieldElement, pub - block_number : starknet :: core :: types :: FieldElement, pub block_hash : - starknet :: core :: types :: FieldElement -} impl cainome :: cairo_serde :: CairoSerde for LogStateUpdate + pub message_hash : starknet :: core :: types :: Felt, pub from : cainome + :: cairo_serde :: ContractAddress, pub to : cainome :: cairo_serde :: + ContractAddress, pub selector : starknet :: core :: types :: Felt, pub + nonce : starknet :: core :: types :: Felt, pub payload : Vec < starknet :: + core :: types :: Felt > +} impl cainome :: cairo_serde :: CairoSerde for MessageSent { type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < usize > = None; #[inline] fn cairo_serialized_size(__rust : & Self :: RustType) -> usize { - let mut __size = 0; __size += starknet :: core :: types :: - FieldElement :: cairo_serialized_size(& __rust.state_root); __size += - starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& __rust.block_number); __size += starknet :: - core :: types :: FieldElement :: - cairo_serialized_size(& __rust.block_hash); __size + let mut __size = 0; __size += starknet :: core :: types :: Felt :: + cairo_serialized_size(& __rust.message_hash); __size += cainome :: + cairo_serde :: ContractAddress :: + cairo_serialized_size(& __rust.from); __size += cainome :: cairo_serde + :: ContractAddress :: cairo_serialized_size(& __rust.to); __size += + starknet :: core :: types :: Felt :: + cairo_serialized_size(& __rust.selector); __size += starknet :: core + :: types :: Felt :: cairo_serialized_size(& __rust.nonce); __size += + Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialized_size(& __rust.payload); __size } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: - core :: types :: FieldElement > + core :: types :: Felt > { - let mut __out : Vec < starknet :: core :: types :: FieldElement > = - vec! []; - __out.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(& __rust.state_root)); - __out.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(& __rust.block_number)); - __out.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(& __rust.block_hash)); __out + let mut __out : Vec < starknet :: core :: types :: Felt > = vec! []; + __out.extend(starknet :: core :: types :: Felt :: + cairo_serialize(& __rust.message_hash)); + __out.extend(cainome :: cairo_serde :: ContractAddress :: + cairo_serialize(& __rust.from)); + __out.extend(cainome :: cairo_serde :: ContractAddress :: + cairo_serialize(& __rust.to)); + __out.extend(starknet :: core :: types :: Felt :: + cairo_serialize(& __rust.selector)); + __out.extend(starknet :: core :: types :: Felt :: + cairo_serialize(& __rust.nonce)); + __out.extend(Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialize(& __rust.payload)); __out } fn - cairo_deserialize(__felts : & [starknet :: core :: types :: FieldElement], + cairo_deserialize(__felts : & [starknet :: core :: types :: Felt], __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > { - let mut __offset = __offset; let state_root = starknet :: core :: - types :: FieldElement :: cairo_deserialize(__felts, __offset) ? ; - __offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& state_root); let block_number = starknet :: - core :: types :: FieldElement :: cairo_deserialize(__felts, __offset) - ? ; __offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& block_number); let block_hash = starknet :: - core :: types :: FieldElement :: cairo_deserialize(__felts, __offset) - ? ; __offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& block_hash); - Ok(LogStateUpdate { state_root, block_number, block_hash }) + let mut __offset = __offset; let message_hash = starknet :: core :: + types :: Felt :: cairo_deserialize(__felts, __offset) ? ; __offset += + starknet :: core :: types :: Felt :: + cairo_serialized_size(& message_hash); let from = cainome :: + cairo_serde :: ContractAddress :: cairo_deserialize(__felts, __offset) + ? ; __offset += cainome :: cairo_serde :: ContractAddress :: + cairo_serialized_size(& from); let to = cainome :: cairo_serde :: + ContractAddress :: cairo_deserialize(__felts, __offset) ? ; __offset + += cainome :: cairo_serde :: ContractAddress :: + cairo_serialized_size(& to); let selector = starknet :: core :: types + :: Felt :: cairo_deserialize(__felts, __offset) ? ; __offset += + starknet :: core :: types :: Felt :: + cairo_serialized_size(& selector); let nonce = starknet :: core :: + types :: Felt :: cairo_deserialize(__felts, __offset) ? ; __offset += + starknet :: core :: types :: Felt :: cairo_serialized_size(& nonce); + let payload = Vec :: < starknet :: core :: types :: Felt > :: + cairo_deserialize(__felts, __offset) ? ; __offset += Vec :: < starknet + :: core :: types :: Felt > :: cairo_serialized_size(& payload); + Ok(MessageSent { message_hash, from, to, selector, nonce, payload }) } -} #[derive(Debug, PartialEq, Clone)] pub struct MessageSent +} #[derive(Debug, PartialEq, Eq, Clone, Copy,)] pub struct +MessageToAppchainSealed { - pub message_hash : starknet :: core :: types :: FieldElement, pub from : - cainome :: cairo_serde :: ContractAddress, pub to : cainome :: cairo_serde - :: ContractAddress, pub selector : starknet :: core :: types :: - FieldElement, pub nonce : starknet :: core :: types :: FieldElement, pub - payload : Vec < starknet :: core :: types :: FieldElement > -} impl cainome :: cairo_serde :: CairoSerde for MessageSent + pub message_hash : starknet :: core :: types :: Felt, pub from : cainome + :: cairo_serde :: ContractAddress, pub to : cainome :: cairo_serde :: + ContractAddress, pub selector : starknet :: core :: types :: Felt, pub + nonce : starknet :: core :: types :: Felt, pub payload : Vec < starknet :: + core :: types :: Felt > +} impl cainome :: cairo_serde :: CairoSerde for MessageToAppchainSealed { type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < usize > = None; #[inline] fn cairo_serialized_size(__rust : & Self :: RustType) -> usize { - let mut __size = 0; __size += starknet :: core :: types :: - FieldElement :: cairo_serialized_size(& __rust.message_hash); __size - += cainome :: cairo_serde :: ContractAddress :: + let mut __size = 0; __size += starknet :: core :: types :: Felt :: + cairo_serialized_size(& __rust.message_hash); __size += cainome :: + cairo_serde :: ContractAddress :: cairo_serialized_size(& __rust.from); __size += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& __rust.to); __size += - starknet :: core :: types :: FieldElement :: + starknet :: core :: types :: Felt :: cairo_serialized_size(& __rust.selector); __size += starknet :: core - :: types :: FieldElement :: cairo_serialized_size(& __rust.nonce); - __size += Vec :: < starknet :: core :: types :: FieldElement > :: + :: types :: Felt :: cairo_serialized_size(& __rust.nonce); __size += + Vec :: < starknet :: core :: types :: Felt > :: cairo_serialized_size(& __rust.payload); __size } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: - core :: types :: FieldElement > + core :: types :: Felt > { - let mut __out : Vec < starknet :: core :: types :: FieldElement > = - vec! []; - __out.extend(starknet :: core :: types :: FieldElement :: + let mut __out : Vec < starknet :: core :: types :: Felt > = vec! []; + __out.extend(starknet :: core :: types :: Felt :: cairo_serialize(& __rust.message_hash)); __out.extend(cainome :: cairo_serde :: ContractAddress :: cairo_serialize(& __rust.from)); __out.extend(cainome :: cairo_serde :: ContractAddress :: cairo_serialize(& __rust.to)); - __out.extend(starknet :: core :: types :: FieldElement :: + __out.extend(starknet :: core :: types :: Felt :: cairo_serialize(& __rust.selector)); - __out.extend(starknet :: core :: types :: FieldElement :: + __out.extend(starknet :: core :: types :: Felt :: cairo_serialize(& __rust.nonce)); - __out.extend(Vec :: < starknet :: core :: types :: FieldElement > :: + __out.extend(Vec :: < starknet :: core :: types :: Felt > :: cairo_serialize(& __rust.payload)); __out } fn - cairo_deserialize(__felts : & [starknet :: core :: types :: FieldElement], + cairo_deserialize(__felts : & [starknet :: core :: types :: Felt], __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > { let mut __offset = __offset; let message_hash = starknet :: core :: - types :: FieldElement :: cairo_deserialize(__felts, __offset) ? ; - __offset += starknet :: core :: types :: FieldElement :: + types :: Felt :: cairo_deserialize(__felts, __offset) ? ; __offset += + starknet :: core :: types :: Felt :: cairo_serialized_size(& message_hash); let from = cainome :: cairo_serde :: ContractAddress :: cairo_deserialize(__felts, __offset) ? ; __offset += cainome :: cairo_serde :: ContractAddress :: @@ -518,86 +408,69 @@ for LogStateTransitionFact ContractAddress :: cairo_deserialize(__felts, __offset) ? ; __offset += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& to); let selector = starknet :: core :: types - :: FieldElement :: cairo_deserialize(__felts, __offset) ? ; __offset - += starknet :: core :: types :: FieldElement :: + :: Felt :: cairo_deserialize(__felts, __offset) ? ; __offset += + starknet :: core :: types :: Felt :: cairo_serialized_size(& selector); let nonce = starknet :: core :: - types :: FieldElement :: cairo_deserialize(__felts, __offset) ? ; - __offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& nonce); let payload = Vec :: < starknet :: - core :: types :: FieldElement > :: + types :: Felt :: cairo_deserialize(__felts, __offset) ? ; __offset += + starknet :: core :: types :: Felt :: cairo_serialized_size(& nonce); + let payload = Vec :: < starknet :: core :: types :: Felt > :: cairo_deserialize(__felts, __offset) ? ; __offset += Vec :: < starknet - :: core :: types :: FieldElement > :: - cairo_serialized_size(& payload); - Ok(MessageSent { message_hash, from, to, selector, nonce, payload }) + :: core :: types :: Felt > :: cairo_serialized_size(& payload); + Ok(MessageToAppchainSealed + { message_hash, from, to, selector, nonce, payload }) } -} #[derive(Debug, PartialEq, Clone)] pub struct MessageToAppchainSealed +} #[derive(Debug, PartialEq, Eq, Clone, Copy,)] pub struct +MessageToStarknetReceived { - pub message_hash : starknet :: core :: types :: FieldElement, pub from : - cainome :: cairo_serde :: ContractAddress, pub to : cainome :: cairo_serde - :: ContractAddress, pub selector : starknet :: core :: types :: - FieldElement, pub nonce : starknet :: core :: types :: FieldElement, pub - payload : Vec < starknet :: core :: types :: FieldElement > -} impl cainome :: cairo_serde :: CairoSerde for MessageToAppchainSealed + pub message_hash : starknet :: core :: types :: Felt, pub from : cainome + :: cairo_serde :: ContractAddress, pub to : cainome :: cairo_serde :: + ContractAddress, pub payload : Vec < starknet :: core :: types :: Felt > +} impl cainome :: cairo_serde :: CairoSerde for MessageToStarknetReceived { type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < usize > = None; #[inline] fn cairo_serialized_size(__rust : & Self :: RustType) -> usize { - let mut __size = 0; __size += starknet :: core :: types :: - FieldElement :: cairo_serialized_size(& __rust.message_hash); __size - += cainome :: cairo_serde :: ContractAddress :: + let mut __size = 0; __size += starknet :: core :: types :: Felt :: + cairo_serialized_size(& __rust.message_hash); __size += cainome :: + cairo_serde :: ContractAddress :: cairo_serialized_size(& __rust.from); __size += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& __rust.to); __size += - starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& __rust.selector); __size += starknet :: core - :: types :: FieldElement :: cairo_serialized_size(& __rust.nonce); - __size += Vec :: < starknet :: core :: types :: FieldElement > :: + Vec :: < starknet :: core :: types :: Felt > :: cairo_serialized_size(& __rust.payload); __size } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: - core :: types :: FieldElement > + core :: types :: Felt > { - let mut __out : Vec < starknet :: core :: types :: FieldElement > = - vec! []; - __out.extend(starknet :: core :: types :: FieldElement :: + let mut __out : Vec < starknet :: core :: types :: Felt > = vec! []; + __out.extend(starknet :: core :: types :: Felt :: cairo_serialize(& __rust.message_hash)); __out.extend(cainome :: cairo_serde :: ContractAddress :: cairo_serialize(& __rust.from)); __out.extend(cainome :: cairo_serde :: ContractAddress :: cairo_serialize(& __rust.to)); - __out.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(& __rust.selector)); - __out.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(& __rust.nonce)); - __out.extend(Vec :: < starknet :: core :: types :: FieldElement > :: + __out.extend(Vec :: < starknet :: core :: types :: Felt > :: cairo_serialize(& __rust.payload)); __out } fn - cairo_deserialize(__felts : & [starknet :: core :: types :: FieldElement], + cairo_deserialize(__felts : & [starknet :: core :: types :: Felt], __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > { let mut __offset = __offset; let message_hash = starknet :: core :: - types :: FieldElement :: cairo_deserialize(__felts, __offset) ? ; - __offset += starknet :: core :: types :: FieldElement :: + types :: Felt :: cairo_deserialize(__felts, __offset) ? ; __offset += + starknet :: core :: types :: Felt :: cairo_serialized_size(& message_hash); let from = cainome :: cairo_serde :: ContractAddress :: cairo_deserialize(__felts, __offset) ? ; __offset += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& from); let to = cainome :: cairo_serde :: ContractAddress :: cairo_deserialize(__felts, __offset) ? ; __offset += cainome :: cairo_serde :: ContractAddress :: - cairo_serialized_size(& to); let selector = starknet :: core :: types - :: FieldElement :: cairo_deserialize(__felts, __offset) ? ; __offset - += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& selector); let nonce = starknet :: core :: - types :: FieldElement :: cairo_deserialize(__felts, __offset) ? ; - __offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& nonce); let payload = Vec :: < starknet :: - core :: types :: FieldElement > :: - cairo_deserialize(__felts, __offset) ? ; __offset += Vec :: < starknet - :: core :: types :: FieldElement > :: + cairo_serialized_size(& to); let payload = Vec :: < starknet :: core + :: types :: Felt > :: cairo_deserialize(__felts, __offset) ? ; + __offset += Vec :: < starknet :: core :: types :: Felt > :: cairo_serialized_size(& payload); - Ok(MessageToAppchainSealed - { message_hash, from, to, selector, nonce, payload }) + Ok(MessageToStarknetReceived { message_hash, from, to, payload }) } -} #[derive(Debug, PartialEq, Clone)] pub struct OwnershipTransferStarted +} #[derive(Debug, PartialEq, Eq, Clone, Copy,)] pub struct +OwnershipTransferStarted { pub previous_owner : cainome :: cairo_serde :: ContractAddress, pub new_owner : cainome :: cairo_serde :: ContractAddress @@ -612,16 +485,15 @@ for LogStateTransitionFact __size += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& __rust.new_owner); __size } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: - core :: types :: FieldElement > + core :: types :: Felt > { - let mut __out : Vec < starknet :: core :: types :: FieldElement > = - vec! []; + let mut __out : Vec < starknet :: core :: types :: Felt > = vec! []; __out.extend(cainome :: cairo_serde :: ContractAddress :: cairo_serialize(& __rust.previous_owner)); __out.extend(cainome :: cairo_serde :: ContractAddress :: cairo_serialize(& __rust.new_owner)); __out } fn - cairo_deserialize(__felts : & [starknet :: core :: types :: FieldElement], + cairo_deserialize(__felts : & [starknet :: core :: types :: Felt], __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > { let mut __offset = __offset; let previous_owner = cainome :: @@ -633,123 +505,459 @@ for LogStateTransitionFact cairo_serialized_size(& new_owner); Ok(OwnershipTransferStarted { previous_owner, new_owner }) } -} #[derive(Debug, PartialEq, Clone)] pub enum Event +} #[derive(Debug, PartialEq, Eq, Clone, Copy,)] pub struct +OwnershipTransferred { - MessageSent(MessageSent), MessageConsumed(MessageConsumed), - MessageCancellationStarted(MessageCancellationStarted), - MessageCanceled(MessageCanceled), - MessageToStarknetReceived(MessageToStarknetReceived), - MessageToAppchainSealed(MessageToAppchainSealed) -} impl cainome :: cairo_serde :: CairoSerde for Event + pub previous_owner : cainome :: cairo_serde :: ContractAddress, pub + new_owner : cainome :: cairo_serde :: ContractAddress +} impl cainome :: cairo_serde :: CairoSerde for OwnershipTransferred { type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < - usize > = std :: option :: Option :: None; #[inline] fn + usize > = None; #[inline] fn cairo_serialized_size(__rust : & Self :: RustType) -> usize { - match __rust - { - Event :: MessageSent(val) => MessageSent :: - cairo_serialized_size(val) + 1, Event :: MessageConsumed(val) => - MessageConsumed :: cairo_serialized_size(val) + 1, Event :: - MessageCancellationStarted(val) => MessageCancellationStarted :: - cairo_serialized_size(val) + 1, Event :: MessageCanceled(val) => - MessageCanceled :: cairo_serialized_size(val) + 1, Event :: - MessageToStarknetReceived(val) => MessageToStarknetReceived :: - cairo_serialized_size(val) + 1, Event :: - MessageToAppchainSealed(val) => MessageToAppchainSealed :: - cairo_serialized_size(val) + 1, _ => 0 - } + let mut __size = 0; __size += cainome :: cairo_serde :: + ContractAddress :: cairo_serialized_size(& __rust.previous_owner); + __size += cainome :: cairo_serde :: ContractAddress :: + cairo_serialized_size(& __rust.new_owner); __size } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: - core :: types :: FieldElement > - { - match __rust - { - Event :: MessageSent(val) => - { - let mut temp = vec! []; - temp.extend(usize :: cairo_serialize(& 0usize)); - temp.extend(MessageSent :: cairo_serialize(val)); temp - }, Event :: MessageConsumed(val) => - { - let mut temp = vec! []; - temp.extend(usize :: cairo_serialize(& 1usize)); - temp.extend(MessageConsumed :: cairo_serialize(val)); temp - }, Event :: MessageCancellationStarted(val) => - { - let mut temp = vec! []; - temp.extend(usize :: cairo_serialize(& 2usize)); - temp.extend(MessageCancellationStarted :: - cairo_serialize(val)); temp - }, Event :: MessageCanceled(val) => - { - let mut temp = vec! []; - temp.extend(usize :: cairo_serialize(& 3usize)); - temp.extend(MessageCanceled :: cairo_serialize(val)); temp - }, Event :: MessageToStarknetReceived(val) => - { - let mut temp = vec! []; - temp.extend(usize :: cairo_serialize(& 4usize)); - temp.extend(MessageToStarknetReceived :: - cairo_serialize(val)); temp - }, Event :: MessageToAppchainSealed(val) => - { - let mut temp = vec! []; - temp.extend(usize :: cairo_serialize(& 5usize)); - temp.extend(MessageToAppchainSealed :: cairo_serialize(val)); - temp - }, _ => vec! [] - } - } fn - cairo_deserialize(__felts : & [starknet :: core :: types :: FieldElement], - __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > + core :: types :: Felt > { - let __index : u128 = __felts [__offset].try_into().unwrap(); match + let mut __out : Vec < starknet :: core :: types :: Felt > = vec! []; + __out.extend(cainome :: cairo_serde :: ContractAddress :: + cairo_serialize(& __rust.previous_owner)); + __out.extend(cainome :: cairo_serde :: ContractAddress :: + cairo_serialize(& __rust.new_owner)); __out + } fn + cairo_deserialize(__felts : & [starknet :: core :: types :: Felt], + __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > + { + let mut __offset = __offset; let previous_owner = cainome :: + cairo_serde :: ContractAddress :: cairo_deserialize(__felts, __offset) + ? ; __offset += cainome :: cairo_serde :: ContractAddress :: + cairo_serialized_size(& previous_owner); let new_owner = cainome :: + cairo_serde :: ContractAddress :: cairo_deserialize(__felts, __offset) + ? ; __offset += cainome :: cairo_serde :: ContractAddress :: + cairo_serialized_size(& new_owner); + Ok(OwnershipTransferred { previous_owner, new_owner }) + } +} #[derive(Debug, PartialEq, Eq, Clone, Copy,)] pub struct ProgramInfoChanged +{ + pub changed_by : cainome :: cairo_serde :: ContractAddress, pub + old_program_hash : starknet :: core :: types :: Felt, pub new_program_hash + : starknet :: core :: types :: Felt, pub old_config_hash : starknet :: + core :: types :: Felt, pub new_config_hash : starknet :: core :: types :: + Felt +} impl cainome :: cairo_serde :: CairoSerde for ProgramInfoChanged +{ + type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < + usize > = None; #[inline] fn + cairo_serialized_size(__rust : & Self :: RustType) -> usize + { + let mut __size = 0; __size += cainome :: cairo_serde :: + ContractAddress :: cairo_serialized_size(& __rust.changed_by); __size + += starknet :: core :: types :: Felt :: + cairo_serialized_size(& __rust.old_program_hash); __size += starknet + :: core :: types :: Felt :: + cairo_serialized_size(& __rust.new_program_hash); __size += starknet + :: core :: types :: Felt :: + cairo_serialized_size(& __rust.old_config_hash); __size += starknet :: + core :: types :: Felt :: + cairo_serialized_size(& __rust.new_config_hash); __size + } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: + core :: types :: Felt > + { + let mut __out : Vec < starknet :: core :: types :: Felt > = vec! []; + __out.extend(cainome :: cairo_serde :: ContractAddress :: + cairo_serialize(& __rust.changed_by)); + __out.extend(starknet :: core :: types :: Felt :: + cairo_serialize(& __rust.old_program_hash)); + __out.extend(starknet :: core :: types :: Felt :: + cairo_serialize(& __rust.new_program_hash)); + __out.extend(starknet :: core :: types :: Felt :: + cairo_serialize(& __rust.old_config_hash)); + __out.extend(starknet :: core :: types :: Felt :: + cairo_serialize(& __rust.new_config_hash)); __out + } fn + cairo_deserialize(__felts : & [starknet :: core :: types :: Felt], + __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > + { + let mut __offset = __offset; let changed_by = cainome :: cairo_serde + :: ContractAddress :: cairo_deserialize(__felts, __offset) ? ; + __offset += cainome :: cairo_serde :: ContractAddress :: + cairo_serialized_size(& changed_by); let old_program_hash = starknet + :: core :: types :: Felt :: cairo_deserialize(__felts, __offset) ? ; + __offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& old_program_hash); let new_program_hash = + starknet :: core :: types :: Felt :: + cairo_deserialize(__felts, __offset) ? ; __offset += starknet :: core + :: types :: Felt :: cairo_serialized_size(& new_program_hash); let + old_config_hash = starknet :: core :: types :: Felt :: + cairo_deserialize(__felts, __offset) ? ; __offset += starknet :: core + :: types :: Felt :: cairo_serialized_size(& old_config_hash); let + new_config_hash = starknet :: core :: types :: Felt :: + cairo_deserialize(__felts, __offset) ? ; __offset += starknet :: core + :: types :: Felt :: cairo_serialized_size(& new_config_hash); + Ok(ProgramInfoChanged + { + changed_by, old_program_hash, new_program_hash, old_config_hash, + new_config_hash + }) + } +} #[derive(Debug, PartialEq, Eq, Clone, Copy,)] pub struct Upgraded +{ pub class_hash : cainome :: cairo_serde :: ClassHash } impl cainome :: +cairo_serde :: CairoSerde for Upgraded +{ + type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < + usize > = None; #[inline] fn + cairo_serialized_size(__rust : & Self :: RustType) -> usize + { + let mut __size = 0; __size += cainome :: cairo_serde :: ClassHash :: + cairo_serialized_size(& __rust.class_hash); __size + } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: + core :: types :: Felt > + { + let mut __out : Vec < starknet :: core :: types :: Felt > = vec! []; + __out.extend(cainome :: cairo_serde :: ClassHash :: + cairo_serialize(& __rust.class_hash)); __out + } fn + cairo_deserialize(__felts : & [starknet :: core :: types :: Felt], + __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > + { + let mut __offset = __offset; let class_hash = cainome :: cairo_serde + :: ClassHash :: cairo_deserialize(__felts, __offset) ? ; __offset += + cainome :: cairo_serde :: ClassHash :: + cairo_serialized_size(& class_hash); Ok(Upgraded { class_hash }) + } +} #[derive(Debug, PartialEq, Eq, Clone, Copy,)] pub enum Event +{ Upgraded(Upgraded) } impl cainome :: cairo_serde :: CairoSerde for Event +{ + type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < + usize > = std :: option :: Option :: None; #[inline] fn + cairo_serialized_size(__rust : & Self :: RustType) -> usize + { + match __rust + { + Event :: Upgraded(val) => Upgraded :: cairo_serialized_size(val) + + 1, _ => 0 + } + } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: + core :: types :: Felt > + { + match __rust + { + Event :: Upgraded(val) => + { + let mut temp = vec! []; + temp.extend(usize :: cairo_serialize(& 0usize)); + temp.extend(Upgraded :: cairo_serialize(val)); temp + }, _ => vec! [] + } + } fn + cairo_deserialize(__felts : & [starknet :: core :: types :: Felt], + __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > + { + let __f = __felts [__offset]; let __index = u128 :: + from_be_bytes(__f.to_bytes_be() [16 ..].try_into().unwrap()); match __index as usize { 0usize => Ok(Event :: - MessageSent(MessageSent :: - cairo_deserialize(__felts, __offset + 1) ?)), 1usize => + Upgraded(Upgraded :: cairo_deserialize(__felts, __offset + 1) ?)), + _ => return + Err(cainome :: cairo_serde :: Error :: + Deserialize(format! ("Index not handle for enum {}", "Event"))) + } + } +} impl TryFrom < starknet :: core :: types :: EmittedEvent > for Event +{ + type Error = String; fn + try_from(event : starknet :: core :: types :: EmittedEvent) -> Result < + Self, Self :: Error > + { + use cainome :: cairo_serde :: CairoSerde; if event.keys.is_empty() + { return Err("Event has no key".to_string()); } let selector = + event.keys [0]; if selector == starknet :: core :: utils :: + get_selector_from_name("Upgraded").unwrap_or_else(| _ | panic! + ("Invalid selector for {}", "Upgraded")) + { + let mut key_offset = 0 + 1; let mut data_offset = 0; let + class_hash = match cainome :: cairo_serde :: ClassHash :: + cairo_deserialize(& event.data, data_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", "class_hash", + "Upgraded", e)), + }; data_offset += cainome :: cairo_serde :: ClassHash :: + cairo_serialized_size(& class_hash); return + Ok(Event :: Upgraded(Upgraded { class_hash })) + }; + Err(format! ("Could not match any event from keys {:?}", event.keys)) + } +} #[derive(Debug, PartialEq, Eq, Clone, Copy,)] pub enum Event +{ + OwnableEvent(Event), UpgradeableEvent(Event), ConfigEvent(Event), + MessagingEvent(Event), ReentrancyGuardEvent(Event), StateEvent(Event), + LogStateUpdate(LogStateUpdate), + LogStateTransitionFact(LogStateTransitionFact) +} impl cainome :: cairo_serde :: CairoSerde for Event +{ + type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < + usize > = std :: option :: Option :: None; #[inline] fn + cairo_serialized_size(__rust : & Self :: RustType) -> usize + { + match __rust + { + Event :: OwnableEvent(val) => Event :: cairo_serialized_size(val) + + 1, Event :: UpgradeableEvent(val) => Event :: + cairo_serialized_size(val) + 1, Event :: ConfigEvent(val) => Event + :: cairo_serialized_size(val) + 1, Event :: MessagingEvent(val) => + Event :: cairo_serialized_size(val) + 1, Event :: + ReentrancyGuardEvent(val) => Event :: cairo_serialized_size(val) + + 1, Event :: StateEvent(val) => Event :: cairo_serialized_size(val) + + 1, Event :: LogStateUpdate(val) => LogStateUpdate :: + cairo_serialized_size(val) + 1, Event :: + LogStateTransitionFact(val) => LogStateTransitionFact :: + cairo_serialized_size(val) + 1, _ => 0 + } + } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: + core :: types :: Felt > + { + match __rust + { + Event :: OwnableEvent(val) => + { + let mut temp = vec! []; + temp.extend(usize :: cairo_serialize(& 0usize)); + temp.extend(Event :: cairo_serialize(val)); temp + }, Event :: UpgradeableEvent(val) => + { + let mut temp = vec! []; + temp.extend(usize :: cairo_serialize(& 1usize)); + temp.extend(Event :: cairo_serialize(val)); temp + }, Event :: ConfigEvent(val) => + { + let mut temp = vec! []; + temp.extend(usize :: cairo_serialize(& 2usize)); + temp.extend(Event :: cairo_serialize(val)); temp + }, Event :: MessagingEvent(val) => + { + let mut temp = vec! []; + temp.extend(usize :: cairo_serialize(& 3usize)); + temp.extend(Event :: cairo_serialize(val)); temp + }, Event :: ReentrancyGuardEvent(val) => + { + let mut temp = vec! []; + temp.extend(usize :: cairo_serialize(& 4usize)); + temp.extend(Event :: cairo_serialize(val)); temp + }, Event :: StateEvent(val) => + { + let mut temp = vec! []; + temp.extend(usize :: cairo_serialize(& 5usize)); + temp.extend(Event :: cairo_serialize(val)); temp + }, Event :: LogStateUpdate(val) => + { + let mut temp = vec! []; + temp.extend(usize :: cairo_serialize(& 6usize)); + temp.extend(LogStateUpdate :: cairo_serialize(val)); temp + }, Event :: LogStateTransitionFact(val) => + { + let mut temp = vec! []; + temp.extend(usize :: cairo_serialize(& 7usize)); + temp.extend(LogStateTransitionFact :: cairo_serialize(val)); + temp + }, _ => vec! [] + } + } fn + cairo_deserialize(__felts : & [starknet :: core :: types :: Felt], + __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > + { + let __f = __felts [__offset]; let __index = u128 :: + from_be_bytes(__f.to_bytes_be() [16 ..].try_into().unwrap()); match + __index as usize + { + 0usize => Ok(Event :: - MessageConsumed(MessageConsumed :: - cairo_deserialize(__felts, __offset + 1) ?)), 2usize => + OwnableEvent(Event :: cairo_deserialize(__felts, __offset + 1) + ?)), 1usize => Ok(Event :: - MessageCancellationStarted(MessageCancellationStarted :: - cairo_deserialize(__felts, __offset + 1) ?)), 3usize => + UpgradeableEvent(Event :: cairo_deserialize(__felts, __offset + 1) + ?)), 2usize => Ok(Event :: - MessageCanceled(MessageCanceled :: - cairo_deserialize(__felts, __offset + 1) ?)), 4usize => + ConfigEvent(Event :: cairo_deserialize(__felts, __offset + 1) ?)), + 3usize => Ok(Event :: - MessageToStarknetReceived(MessageToStarknetReceived :: + MessagingEvent(Event :: cairo_deserialize(__felts, __offset + 1) + ?)), 4usize => + Ok(Event :: + ReentrancyGuardEvent(Event :: cairo_deserialize(__felts, __offset + 1) ?)), 5usize => Ok(Event :: - MessageToAppchainSealed(MessageToAppchainSealed :: - cairo_deserialize(__felts, __offset + 1) ?)), _ => return - Err(cainome :: cairo_serde :: Error :: - Deserialize(format! ("Index not handle for enum {}", "Event"))) - } - } -} impl TryFrom < starknet :: core :: types :: EmittedEvent > for Event -{ - type Error = String; fn - try_from(event : starknet :: core :: types :: EmittedEvent) -> Result < - Self, Self :: Error > - { - use cainome :: cairo_serde :: CairoSerde; if event.keys.is_empty() - { return Err("Event has no key".to_string()); } let selector = - event.keys [0]; if selector == starknet :: core :: utils :: + StateEvent(Event :: cairo_deserialize(__felts, __offset + 1) ?)), + 6usize => + Ok(Event :: + LogStateUpdate(LogStateUpdate :: + cairo_deserialize(__felts, __offset + 1) ?)), 7usize => + Ok(Event :: + LogStateTransitionFact(LogStateTransitionFact :: + cairo_deserialize(__felts, __offset + 1) ?)), _ => return + Err(cainome :: cairo_serde :: Error :: + Deserialize(format! ("Index not handle for enum {}", "Event"))) + } + } +} impl TryFrom < starknet :: core :: types :: EmittedEvent > for Event +{ + type Error = String; fn + try_from(event : starknet :: core :: types :: EmittedEvent) -> Result < + Self, Self :: Error > + { + use cainome :: cairo_serde :: CairoSerde; if event.keys.is_empty() + { return Err("Event has no key".to_string()); } let selector = + event.keys [0]; if selector == starknet :: core :: utils :: + get_selector_from_name("OwnershipTransferred").unwrap_or_else(| _ | + panic! ("Invalid selector for {}", "OwnershipTransferred")) + { + let mut key_offset = 0 + 1; let mut data_offset = 0; let + previous_owner = match cainome :: cairo_serde :: ContractAddress + :: cairo_deserialize(& event.keys, key_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", + "previous_owner", "OwnershipTransferred", e)), + }; key_offset += cainome :: cairo_serde :: ContractAddress :: + cairo_serialized_size(& previous_owner); let new_owner = match + cainome :: cairo_serde :: ContractAddress :: + cairo_deserialize(& event.keys, key_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", "new_owner", + "OwnershipTransferred", e)), + }; key_offset += cainome :: cairo_serde :: ContractAddress :: + cairo_serialized_size(& new_owner); return + Ok(Event :: + OwnableEvent(Event :: + OwnershipTransferred(OwnershipTransferred + { previous_owner, new_owner }))) + }; let selector = event.keys [0]; if selector == starknet :: core :: + utils :: + get_selector_from_name("OwnershipTransferStarted").unwrap_or_else(| _ + | panic! ("Invalid selector for {}", "OwnershipTransferStarted")) + { + let mut key_offset = 0 + 1; let mut data_offset = 0; let + previous_owner = match cainome :: cairo_serde :: ContractAddress + :: cairo_deserialize(& event.keys, key_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", + "previous_owner", "OwnershipTransferStarted", e)), + }; key_offset += cainome :: cairo_serde :: ContractAddress :: + cairo_serialized_size(& previous_owner); let new_owner = match + cainome :: cairo_serde :: ContractAddress :: + cairo_deserialize(& event.keys, key_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", "new_owner", + "OwnershipTransferStarted", e)), + }; key_offset += cainome :: cairo_serde :: ContractAddress :: + cairo_serialized_size(& new_owner); return + Ok(Event :: + OwnableEvent(Event :: + OwnershipTransferStarted(OwnershipTransferStarted + { previous_owner, new_owner }))) + }; let selector = event.keys [0]; if selector == starknet :: core :: + utils :: + get_selector_from_name("Upgraded").unwrap_or_else(| _ | panic! + ("Invalid selector for {}", "Upgraded")) + { + let mut key_offset = 0 + 1; let mut data_offset = 0; let + class_hash = match cainome :: cairo_serde :: ClassHash :: + cairo_deserialize(& event.data, data_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", "class_hash", + "Upgraded", e)), + }; data_offset += cainome :: cairo_serde :: ClassHash :: + cairo_serialized_size(& class_hash); return + Ok(Event :: + UpgradeableEvent(Event :: Upgraded(Upgraded { class_hash }))) + }; let selector = event.keys [0]; if selector == starknet :: core :: + utils :: + get_selector_from_name("ProgramInfoChanged").unwrap_or_else(| _ | + panic! ("Invalid selector for {}", "ProgramInfoChanged")) + { + let mut key_offset = 0 + 1; let mut data_offset = 0; let + changed_by = match cainome :: cairo_serde :: ContractAddress :: + cairo_deserialize(& event.data, data_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", "changed_by", + "ProgramInfoChanged", e)), + }; data_offset += cainome :: cairo_serde :: ContractAddress :: + cairo_serialized_size(& changed_by); let old_program_hash = match + starknet :: core :: types :: Felt :: + cairo_deserialize(& event.data, data_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", + "old_program_hash", "ProgramInfoChanged", e)), + }; data_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& old_program_hash); let new_program_hash = + match starknet :: core :: types :: Felt :: + cairo_deserialize(& event.data, data_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", + "new_program_hash", "ProgramInfoChanged", e)), + }; data_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& new_program_hash); let old_config_hash = + match starknet :: core :: types :: Felt :: + cairo_deserialize(& event.data, data_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", + "old_config_hash", "ProgramInfoChanged", e)), + }; data_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& old_config_hash); let new_config_hash = + match starknet :: core :: types :: Felt :: + cairo_deserialize(& event.data, data_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", + "new_config_hash", "ProgramInfoChanged", e)), + }; data_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& new_config_hash); return + Ok(Event :: + ConfigEvent(Event :: + ProgramInfoChanged(ProgramInfoChanged + { + changed_by, old_program_hash, new_program_hash, + old_config_hash, new_config_hash + }))) + }; let selector = event.keys [0]; if selector == starknet :: core :: + utils :: get_selector_from_name("MessageSent").unwrap_or_else(| _ | panic! ("Invalid selector for {}", "MessageSent")) { let mut key_offset = 0 + 1; let mut data_offset = 0; let - message_hash = match starknet :: core :: types :: FieldElement :: + message_hash = match starknet :: core :: types :: Felt :: cairo_deserialize(& event.keys, key_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "message_hash", "MessageSent", e)), - }; key_offset += starknet :: core :: types :: FieldElement :: + }; key_offset += starknet :: core :: types :: Felt :: cairo_serialized_size(& message_hash); let from = match cainome :: cairo_serde :: ContractAddress :: cairo_deserialize(& event.keys, key_offset) @@ -769,50 +977,50 @@ for LogStateTransitionFact "MessageSent", e)), }; key_offset += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& to); let selector = match starknet :: core - :: types :: FieldElement :: - cairo_deserialize(& event.data, data_offset) + :: types :: Felt :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "selector", "MessageSent", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: + }; data_offset += starknet :: core :: types :: Felt :: cairo_serialized_size(& selector); let nonce = match starknet :: - core :: types :: FieldElement :: + core :: types :: Felt :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "nonce", "MessageSent", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: + }; data_offset += starknet :: core :: types :: Felt :: cairo_serialized_size(& nonce); let payload = match Vec :: < - starknet :: core :: types :: FieldElement > :: + starknet :: core :: types :: Felt > :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "payload", "MessageSent", e)), - }; data_offset += Vec :: < starknet :: core :: types :: - FieldElement > :: cairo_serialized_size(& payload); return + }; data_offset += Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialized_size(& payload); return Ok(Event :: + MessagingEvent(Event :: MessageSent(MessageSent - { message_hash, from, to, selector, nonce, payload })) + { message_hash, from, to, selector, nonce, payload }))) }; let selector = event.keys [0]; if selector == starknet :: core :: utils :: get_selector_from_name("MessageConsumed").unwrap_or_else(| _ | panic! ("Invalid selector for {}", "MessageConsumed")) { let mut key_offset = 0 + 1; let mut data_offset = 0; let - message_hash = match starknet :: core :: types :: FieldElement :: + message_hash = match starknet :: core :: types :: Felt :: cairo_deserialize(& event.keys, key_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "message_hash", "MessageConsumed", e)), - }; key_offset += starknet :: core :: types :: FieldElement :: + }; key_offset += starknet :: core :: types :: Felt :: cairo_serialized_size(& message_hash); let from = match cainome :: cairo_serde :: ContractAddress :: cairo_deserialize(& event.keys, key_offset) @@ -832,32 +1040,33 @@ for LogStateTransitionFact "MessageConsumed", e)), }; key_offset += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& to); let payload = match Vec :: < starknet - :: core :: types :: FieldElement > :: + :: core :: types :: Felt > :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "payload", "MessageConsumed", e)), - }; data_offset += Vec :: < starknet :: core :: types :: - FieldElement > :: cairo_serialized_size(& payload); return + }; data_offset += Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialized_size(& payload); return Ok(Event :: + MessagingEvent(Event :: MessageConsumed(MessageConsumed - { message_hash, from, to, payload })) + { message_hash, from, to, payload }))) }; let selector = event.keys [0]; if selector == starknet :: core :: utils :: get_selector_from_name("MessageCancellationStarted").unwrap_or_else(| _ | panic! ("Invalid selector for {}", "MessageCancellationStarted")) { let mut key_offset = 0 + 1; let mut data_offset = 0; let - message_hash = match starknet :: core :: types :: FieldElement :: + message_hash = match starknet :: core :: types :: Felt :: cairo_deserialize(& event.keys, key_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "message_hash", "MessageCancellationStarted", e)), - }; key_offset += starknet :: core :: types :: FieldElement :: + }; key_offset += starknet :: core :: types :: Felt :: cairo_serialized_size(& message_hash); let from = match cainome :: cairo_serde :: ContractAddress :: cairo_deserialize(& event.keys, key_offset) @@ -877,50 +1086,50 @@ for LogStateTransitionFact "MessageCancellationStarted", e)), }; key_offset += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& to); let selector = match starknet :: core - :: types :: FieldElement :: - cairo_deserialize(& event.data, data_offset) + :: types :: Felt :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "selector", "MessageCancellationStarted", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: + }; data_offset += starknet :: core :: types :: Felt :: cairo_serialized_size(& selector); let payload = match Vec :: < - starknet :: core :: types :: FieldElement > :: + starknet :: core :: types :: Felt > :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "payload", "MessageCancellationStarted", e)), - }; data_offset += Vec :: < starknet :: core :: types :: - FieldElement > :: cairo_serialized_size(& payload); let nonce = - match starknet :: core :: types :: FieldElement :: + }; data_offset += Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialized_size(& payload); let nonce = match starknet :: + core :: types :: Felt :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "nonce", "MessageCancellationStarted", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: + }; data_offset += starknet :: core :: types :: Felt :: cairo_serialized_size(& nonce); return Ok(Event :: + MessagingEvent(Event :: MessageCancellationStarted(MessageCancellationStarted - { message_hash, from, to, selector, payload, nonce })) + { message_hash, from, to, selector, payload, nonce }))) }; let selector = event.keys [0]; if selector == starknet :: core :: utils :: get_selector_from_name("MessageCanceled").unwrap_or_else(| _ | panic! ("Invalid selector for {}", "MessageCanceled")) { let mut key_offset = 0 + 1; let mut data_offset = 0; let - message_hash = match starknet :: core :: types :: FieldElement :: + message_hash = match starknet :: core :: types :: Felt :: cairo_deserialize(& event.keys, key_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "message_hash", "MessageCanceled", e)), - }; key_offset += starknet :: core :: types :: FieldElement :: + }; key_offset += starknet :: core :: types :: Felt :: cairo_serialized_size(& message_hash); let from = match cainome :: cairo_serde :: ContractAddress :: cairo_deserialize(& event.keys, key_offset) @@ -940,50 +1149,50 @@ for LogStateTransitionFact "MessageCanceled", e)), }; key_offset += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& to); let selector = match starknet :: core - :: types :: FieldElement :: - cairo_deserialize(& event.data, data_offset) + :: types :: Felt :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "selector", "MessageCanceled", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: + }; data_offset += starknet :: core :: types :: Felt :: cairo_serialized_size(& selector); let payload = match Vec :: < - starknet :: core :: types :: FieldElement > :: + starknet :: core :: types :: Felt > :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "payload", "MessageCanceled", e)), - }; data_offset += Vec :: < starknet :: core :: types :: - FieldElement > :: cairo_serialized_size(& payload); let nonce = - match starknet :: core :: types :: FieldElement :: + }; data_offset += Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialized_size(& payload); let nonce = match starknet :: + core :: types :: Felt :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "nonce", "MessageCanceled", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: + }; data_offset += starknet :: core :: types :: Felt :: cairo_serialized_size(& nonce); return Ok(Event :: + MessagingEvent(Event :: MessageCanceled(MessageCanceled - { message_hash, from, to, selector, payload, nonce })) + { message_hash, from, to, selector, payload, nonce }))) }; let selector = event.keys [0]; if selector == starknet :: core :: utils :: get_selector_from_name("MessageToStarknetReceived").unwrap_or_else(| _ | panic! ("Invalid selector for {}", "MessageToStarknetReceived")) { let mut key_offset = 0 + 1; let mut data_offset = 0; let - message_hash = match starknet :: core :: types :: FieldElement :: + message_hash = match starknet :: core :: types :: Felt :: cairo_deserialize(& event.keys, key_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "message_hash", "MessageToStarknetReceived", e)), - }; key_offset += starknet :: core :: types :: FieldElement :: + }; key_offset += starknet :: core :: types :: Felt :: cairo_serialized_size(& message_hash); let from = match cainome :: cairo_serde :: ContractAddress :: cairo_deserialize(& event.keys, key_offset) @@ -1003,32 +1212,33 @@ for LogStateTransitionFact "MessageToStarknetReceived", e)), }; key_offset += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& to); let payload = match Vec :: < starknet - :: core :: types :: FieldElement > :: + :: core :: types :: Felt > :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "payload", "MessageToStarknetReceived", e)), - }; data_offset += Vec :: < starknet :: core :: types :: - FieldElement > :: cairo_serialized_size(& payload); return + }; data_offset += Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialized_size(& payload); return Ok(Event :: + MessagingEvent(Event :: MessageToStarknetReceived(MessageToStarknetReceived - { message_hash, from, to, payload })) + { message_hash, from, to, payload }))) }; let selector = event.keys [0]; if selector == starknet :: core :: utils :: get_selector_from_name("MessageToAppchainSealed").unwrap_or_else(| _ | panic! ("Invalid selector for {}", "MessageToAppchainSealed")) { let mut key_offset = 0 + 1; let mut data_offset = 0; let - message_hash = match starknet :: core :: types :: FieldElement :: + message_hash = match starknet :: core :: types :: Felt :: cairo_deserialize(& event.keys, key_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "message_hash", "MessageToAppchainSealed", e)), - }; key_offset += starknet :: core :: types :: FieldElement :: + }; key_offset += starknet :: core :: types :: Felt :: cairo_serialized_size(& message_hash); let from = match cainome :: cairo_serde :: ContractAddress :: cairo_deserialize(& event.keys, key_offset) @@ -1048,46 +1258,96 @@ for LogStateTransitionFact "MessageToAppchainSealed", e)), }; key_offset += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& to); let selector = match starknet :: core - :: types :: FieldElement :: - cairo_deserialize(& event.data, data_offset) + :: types :: Felt :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "selector", "MessageToAppchainSealed", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: + }; data_offset += starknet :: core :: types :: Felt :: cairo_serialized_size(& selector); let nonce = match starknet :: - core :: types :: FieldElement :: + core :: types :: Felt :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "nonce", "MessageToAppchainSealed", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: + }; data_offset += starknet :: core :: types :: Felt :: cairo_serialized_size(& nonce); let payload = match Vec :: < - starknet :: core :: types :: FieldElement > :: + starknet :: core :: types :: Felt > :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "payload", "MessageToAppchainSealed", e)), - }; data_offset += Vec :: < starknet :: core :: types :: - FieldElement > :: cairo_serialized_size(& payload); return + }; data_offset += Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialized_size(& payload); return Ok(Event :: + MessagingEvent(Event :: MessageToAppchainSealed(MessageToAppchainSealed - { message_hash, from, to, selector, nonce, payload })) + { message_hash, from, to, selector, nonce, payload }))) + }; let selector = event.keys [0]; if selector == starknet :: core :: + utils :: + get_selector_from_name("LogStateUpdate").unwrap_or_else(| _ | panic! + ("Invalid selector for {}", "LogStateUpdate")) + { + let mut key_offset = 0 + 1; let mut data_offset = 0; let + state_root = match starknet :: core :: types :: Felt :: + cairo_deserialize(& event.data, data_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", "state_root", + "LogStateUpdate", e)), + }; data_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& state_root); let block_number = match + starknet :: core :: types :: Felt :: + cairo_deserialize(& event.data, data_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", + "block_number", "LogStateUpdate", e)), + }; data_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& block_number); let block_hash = match + starknet :: core :: types :: Felt :: + cairo_deserialize(& event.data, data_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", "block_hash", + "LogStateUpdate", e)), + }; data_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& block_hash); return + Ok(Event :: + LogStateUpdate(LogStateUpdate + { state_root, block_number, block_hash })) + }; let selector = event.keys [0]; if selector == starknet :: core :: + utils :: + get_selector_from_name("LogStateTransitionFact").unwrap_or_else(| _ | + panic! ("Invalid selector for {}", "LogStateTransitionFact")) + { + let mut key_offset = 0 + 1; let mut data_offset = 0; let + state_transition_fact = match cainome :: cairo_serde :: U256 :: + cairo_deserialize(& event.data, data_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", + "state_transition_fact", "LogStateTransitionFact", e)), + }; data_offset += cainome :: cairo_serde :: U256 :: + cairo_serialized_size(& state_transition_fact); return + Ok(Event :: + LogStateTransitionFact(LogStateTransitionFact + { state_transition_fact })) }; Err(format! ("Could not match any event from keys {:?}", event.keys)) } -} #[derive(Debug, PartialEq, Clone)] pub enum Event -{ - OwnableEvent(Event), ConfigEvent(Event), MessagingEvent(Event), - ReentrancyGuardEvent(Event), StateEvent(Event), - LogStateUpdate(LogStateUpdate), - LogStateTransitionFact(LogStateTransitionFact) -} impl cainome :: cairo_serde :: CairoSerde for Event +} #[derive(Debug, PartialEq, Eq, Clone, Copy,)] pub enum Event +{ ProgramInfoChanged(ProgramInfoChanged) } impl cainome :: cairo_serde :: +CairoSerde for Event { type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < usize > = std :: option :: Option :: None; #[inline] fn @@ -1095,88 +1355,154 @@ for LogStateTransitionFact { match __rust { - Event :: OwnableEvent(val) => Event :: cairo_serialized_size(val) - + 1, Event :: ConfigEvent(val) => Event :: - cairo_serialized_size(val) + 1, Event :: MessagingEvent(val) => - Event :: cairo_serialized_size(val) + 1, Event :: - ReentrancyGuardEvent(val) => Event :: cairo_serialized_size(val) + - 1, Event :: StateEvent(val) => Event :: cairo_serialized_size(val) - + 1, Event :: LogStateUpdate(val) => LogStateUpdate :: - cairo_serialized_size(val) + 1, Event :: - LogStateTransitionFact(val) => LogStateTransitionFact :: + Event :: ProgramInfoChanged(val) => ProgramInfoChanged :: cairo_serialized_size(val) + 1, _ => 0 } } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: - core :: types :: FieldElement > + core :: types :: Felt > { match __rust { - Event :: OwnableEvent(val) => + Event :: ProgramInfoChanged(val) => { let mut temp = vec! []; temp.extend(usize :: cairo_serialize(& 0usize)); - temp.extend(Event :: cairo_serialize(val)); temp - }, Event :: ConfigEvent(val) => + temp.extend(ProgramInfoChanged :: cairo_serialize(val)); temp + }, _ => vec! [] + } + } fn + cairo_deserialize(__felts : & [starknet :: core :: types :: Felt], + __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > + { + let __f = __felts [__offset]; let __index = u128 :: + from_be_bytes(__f.to_bytes_be() [16 ..].try_into().unwrap()); match + __index as usize + { + 0usize => + Ok(Event :: + ProgramInfoChanged(ProgramInfoChanged :: + cairo_deserialize(__felts, __offset + 1) ?)), _ => return + Err(cainome :: cairo_serde :: Error :: + Deserialize(format! ("Index not handle for enum {}", "Event"))) + } + } +} impl TryFrom < starknet :: core :: types :: EmittedEvent > for Event +{ + type Error = String; fn + try_from(event : starknet :: core :: types :: EmittedEvent) -> Result < + Self, Self :: Error > + { + use cainome :: cairo_serde :: CairoSerde; if event.keys.is_empty() + { return Err("Event has no key".to_string()); } let selector = + event.keys [0]; if selector == starknet :: core :: utils :: + get_selector_from_name("ProgramInfoChanged").unwrap_or_else(| _ | + panic! ("Invalid selector for {}", "ProgramInfoChanged")) + { + let mut key_offset = 0 + 1; let mut data_offset = 0; let + changed_by = match cainome :: cairo_serde :: ContractAddress :: + cairo_deserialize(& event.data, data_offset) { - let mut temp = vec! []; - temp.extend(usize :: cairo_serialize(& 1usize)); - temp.extend(Event :: cairo_serialize(val)); temp - }, Event :: MessagingEvent(val) => + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", "changed_by", + "ProgramInfoChanged", e)), + }; data_offset += cainome :: cairo_serde :: ContractAddress :: + cairo_serialized_size(& changed_by); let old_program_hash = match + starknet :: core :: types :: Felt :: + cairo_deserialize(& event.data, data_offset) { - let mut temp = vec! []; - temp.extend(usize :: cairo_serialize(& 2usize)); - temp.extend(Event :: cairo_serialize(val)); temp - }, Event :: ReentrancyGuardEvent(val) => + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", + "old_program_hash", "ProgramInfoChanged", e)), + }; data_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& old_program_hash); let new_program_hash = + match starknet :: core :: types :: Felt :: + cairo_deserialize(& event.data, data_offset) { - let mut temp = vec! []; - temp.extend(usize :: cairo_serialize(& 3usize)); - temp.extend(Event :: cairo_serialize(val)); temp - }, Event :: StateEvent(val) => + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", + "new_program_hash", "ProgramInfoChanged", e)), + }; data_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& new_program_hash); let old_config_hash = + match starknet :: core :: types :: Felt :: + cairo_deserialize(& event.data, data_offset) { - let mut temp = vec! []; - temp.extend(usize :: cairo_serialize(& 4usize)); - temp.extend(Event :: cairo_serialize(val)); temp - }, Event :: LogStateUpdate(val) => + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", + "old_config_hash", "ProgramInfoChanged", e)), + }; data_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& old_config_hash); let new_config_hash = + match starknet :: core :: types :: Felt :: + cairo_deserialize(& event.data, data_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", + "new_config_hash", "ProgramInfoChanged", e)), + }; data_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& new_config_hash); return + Ok(Event :: + ProgramInfoChanged(ProgramInfoChanged + { + changed_by, old_program_hash, new_program_hash, + old_config_hash, new_config_hash + })) + }; + Err(format! ("Could not match any event from keys {:?}", event.keys)) + } +} #[derive(Debug, PartialEq, Eq, Clone, Copy,)] pub enum Event +{ + OwnershipTransferred(OwnershipTransferred), + OwnershipTransferStarted(OwnershipTransferStarted) +} impl cainome :: cairo_serde :: CairoSerde for Event +{ + type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < + usize > = std :: option :: Option :: None; #[inline] fn + cairo_serialized_size(__rust : & Self :: RustType) -> usize + { + match __rust + { + Event :: OwnershipTransferred(val) => OwnershipTransferred :: + cairo_serialized_size(val) + 1, Event :: + OwnershipTransferStarted(val) => OwnershipTransferStarted :: + cairo_serialized_size(val) + 1, _ => 0 + } + } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: + core :: types :: Felt > + { + match __rust + { + Event :: OwnershipTransferred(val) => { let mut temp = vec! []; - temp.extend(usize :: cairo_serialize(& 5usize)); - temp.extend(LogStateUpdate :: cairo_serialize(val)); temp - }, Event :: LogStateTransitionFact(val) => + temp.extend(usize :: cairo_serialize(& 0usize)); + temp.extend(OwnershipTransferred :: cairo_serialize(val)); + temp + }, Event :: OwnershipTransferStarted(val) => { let mut temp = vec! []; - temp.extend(usize :: cairo_serialize(& 6usize)); - temp.extend(LogStateTransitionFact :: cairo_serialize(val)); + temp.extend(usize :: cairo_serialize(& 1usize)); + temp.extend(OwnershipTransferStarted :: cairo_serialize(val)); temp }, _ => vec! [] } } fn - cairo_deserialize(__felts : & [starknet :: core :: types :: FieldElement], + cairo_deserialize(__felts : & [starknet :: core :: types :: Felt], __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > { - let __index : u128 = __felts [__offset].try_into().unwrap(); match + let __f = __felts [__offset]; let __index = u128 :: + from_be_bytes(__f.to_bytes_be() [16 ..].try_into().unwrap()); match __index as usize { 0usize => Ok(Event :: - OwnableEvent(Event :: cairo_deserialize(__felts, __offset + 1) - ?)), 1usize => - Ok(Event :: - ConfigEvent(Event :: cairo_deserialize(__felts, __offset + 1) ?)), - 2usize => - Ok(Event :: - MessagingEvent(Event :: cairo_deserialize(__felts, __offset + 1) - ?)), 3usize => - Ok(Event :: - ReentrancyGuardEvent(Event :: - cairo_deserialize(__felts, __offset + 1) ?)), 4usize => - Ok(Event :: - StateEvent(Event :: cairo_deserialize(__felts, __offset + 1) ?)), - 5usize => - Ok(Event :: - LogStateUpdate(LogStateUpdate :: - cairo_deserialize(__felts, __offset + 1) ?)), 6usize => + OwnershipTransferred(OwnershipTransferred :: + cairo_deserialize(__felts, __offset + 1) ?)), 1usize => Ok(Event :: - LogStateTransitionFact(LogStateTransitionFact :: + OwnershipTransferStarted(OwnershipTransferStarted :: cairo_deserialize(__felts, __offset + 1) ?)), _ => return Err(cainome :: cairo_serde :: Error :: Deserialize(format! ("Index not handle for enum {}", "Event"))) @@ -1214,9 +1540,8 @@ for LogStateTransitionFact }; key_offset += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& new_owner); return Ok(Event :: - OwnableEvent(Event :: OwnershipTransferred(OwnershipTransferred - { previous_owner, new_owner }))) + { previous_owner, new_owner })) }; let selector = event.keys [0]; if selector == starknet :: core :: utils :: get_selector_from_name("OwnershipTransferStarted").unwrap_or_else(| _ @@ -1242,255 +1567,129 @@ for LogStateTransitionFact }; key_offset += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& new_owner); return Ok(Event :: - OwnableEvent(Event :: OwnershipTransferStarted(OwnershipTransferStarted - { previous_owner, new_owner }))) - }; let selector = event.keys [0]; if selector == starknet :: core :: - utils :: - get_selector_from_name("ProgramInfoChanged").unwrap_or_else(| _ | - panic! ("Invalid selector for {}", "ProgramInfoChanged")) - { - let mut key_offset = 0 + 1; let mut data_offset = 0; let - changed_by = match cainome :: cairo_serde :: ContractAddress :: - cairo_deserialize(& event.data, data_offset) - { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", "changed_by", - "ProgramInfoChanged", e)), - }; data_offset += cainome :: cairo_serde :: ContractAddress :: - cairo_serialized_size(& changed_by); let old_program_hash = match - starknet :: core :: types :: FieldElement :: - cairo_deserialize(& event.data, data_offset) - { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", - "old_program_hash", "ProgramInfoChanged", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& old_program_hash); let new_program_hash = - match starknet :: core :: types :: FieldElement :: - cairo_deserialize(& event.data, data_offset) - { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", - "new_program_hash", "ProgramInfoChanged", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& new_program_hash); let old_config_hash = - match starknet :: core :: types :: FieldElement :: - cairo_deserialize(& event.data, data_offset) - { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", - "old_config_hash", "ProgramInfoChanged", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& old_config_hash); let new_config_hash = - match starknet :: core :: types :: FieldElement :: - cairo_deserialize(& event.data, data_offset) - { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", - "new_config_hash", "ProgramInfoChanged", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& new_config_hash); return - Ok(Event :: - ConfigEvent(Event :: - ProgramInfoChanged(ProgramInfoChanged - { - changed_by, old_program_hash, new_program_hash, - old_config_hash, new_config_hash - }))) - }; let selector = event.keys [0]; if selector == starknet :: core :: - utils :: - get_selector_from_name("MessageSent").unwrap_or_else(| _ | panic! - ("Invalid selector for {}", "MessageSent")) - { - let mut key_offset = 0 + 1; let mut data_offset = 0; let - message_hash = match starknet :: core :: types :: FieldElement :: - cairo_deserialize(& event.keys, key_offset) - { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", - "message_hash", "MessageSent", e)), - }; key_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& message_hash); let from = match cainome :: - cairo_serde :: ContractAddress :: - cairo_deserialize(& event.keys, key_offset) - { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", "from", - "MessageSent", e)), - }; key_offset += cainome :: cairo_serde :: ContractAddress :: - cairo_serialized_size(& from); let to = match cainome :: - cairo_serde :: ContractAddress :: - cairo_deserialize(& event.keys, key_offset) - { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", "to", - "MessageSent", e)), - }; key_offset += cainome :: cairo_serde :: ContractAddress :: - cairo_serialized_size(& to); let selector = match starknet :: core - :: types :: FieldElement :: - cairo_deserialize(& event.data, data_offset) - { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", "selector", - "MessageSent", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& selector); let nonce = match starknet :: - core :: types :: FieldElement :: - cairo_deserialize(& event.data, data_offset) - { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", "nonce", - "MessageSent", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& nonce); let payload = match Vec :: < - starknet :: core :: types :: FieldElement > :: - cairo_deserialize(& event.data, data_offset) - { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", "payload", - "MessageSent", e)), - }; data_offset += Vec :: < starknet :: core :: types :: - FieldElement > :: cairo_serialized_size(& payload); return - Ok(Event :: - MessagingEvent(Event :: - MessageSent(MessageSent - { message_hash, from, to, selector, nonce, payload }))) - }; let selector = event.keys [0]; if selector == starknet :: core :: - utils :: - get_selector_from_name("MessageConsumed").unwrap_or_else(| _ | panic! - ("Invalid selector for {}", "MessageConsumed")) + { previous_owner, new_owner })) + }; + Err(format! ("Could not match any event from keys {:?}", event.keys)) + } +} #[derive(Debug, PartialEq, Eq, Clone, Copy,)] pub enum Event +{ + MessageSent(MessageSent), MessageConsumed(MessageConsumed), + MessageCancellationStarted(MessageCancellationStarted), + MessageCanceled(MessageCanceled), + MessageToStarknetReceived(MessageToStarknetReceived), + MessageToAppchainSealed(MessageToAppchainSealed) +} impl cainome :: cairo_serde :: CairoSerde for Event +{ + type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < + usize > = std :: option :: Option :: None; #[inline] fn + cairo_serialized_size(__rust : & Self :: RustType) -> usize + { + match __rust { - let mut key_offset = 0 + 1; let mut data_offset = 0; let - message_hash = match starknet :: core :: types :: FieldElement :: - cairo_deserialize(& event.keys, key_offset) - { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", - "message_hash", "MessageConsumed", e)), - }; key_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& message_hash); let from = match cainome :: - cairo_serde :: ContractAddress :: - cairo_deserialize(& event.keys, key_offset) - { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", "from", - "MessageConsumed", e)), - }; key_offset += cainome :: cairo_serde :: ContractAddress :: - cairo_serialized_size(& from); let to = match cainome :: - cairo_serde :: ContractAddress :: - cairo_deserialize(& event.keys, key_offset) - { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", "to", - "MessageConsumed", e)), - }; key_offset += cainome :: cairo_serde :: ContractAddress :: - cairo_serialized_size(& to); let payload = match Vec :: < starknet - :: core :: types :: FieldElement > :: - cairo_deserialize(& event.data, data_offset) - { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", "payload", - "MessageConsumed", e)), - }; data_offset += Vec :: < starknet :: core :: types :: - FieldElement > :: cairo_serialized_size(& payload); return - Ok(Event :: - MessagingEvent(Event :: - MessageConsumed(MessageConsumed - { message_hash, from, to, payload }))) - }; let selector = event.keys [0]; if selector == starknet :: core :: - utils :: - get_selector_from_name("MessageCancellationStarted").unwrap_or_else(| - _ | panic! ("Invalid selector for {}", "MessageCancellationStarted")) + Event :: MessageSent(val) => MessageSent :: + cairo_serialized_size(val) + 1, Event :: MessageConsumed(val) => + MessageConsumed :: cairo_serialized_size(val) + 1, Event :: + MessageCancellationStarted(val) => MessageCancellationStarted :: + cairo_serialized_size(val) + 1, Event :: MessageCanceled(val) => + MessageCanceled :: cairo_serialized_size(val) + 1, Event :: + MessageToStarknetReceived(val) => MessageToStarknetReceived :: + cairo_serialized_size(val) + 1, Event :: + MessageToAppchainSealed(val) => MessageToAppchainSealed :: + cairo_serialized_size(val) + 1, _ => 0 + } + } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: + core :: types :: Felt > + { + match __rust { - let mut key_offset = 0 + 1; let mut data_offset = 0; let - message_hash = match starknet :: core :: types :: FieldElement :: - cairo_deserialize(& event.keys, key_offset) + Event :: MessageSent(val) => { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", - "message_hash", "MessageCancellationStarted", e)), - }; key_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& message_hash); let from = match cainome :: - cairo_serde :: ContractAddress :: - cairo_deserialize(& event.keys, key_offset) + let mut temp = vec! []; + temp.extend(usize :: cairo_serialize(& 0usize)); + temp.extend(MessageSent :: cairo_serialize(val)); temp + }, Event :: MessageConsumed(val) => { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", "from", - "MessageCancellationStarted", e)), - }; key_offset += cainome :: cairo_serde :: ContractAddress :: - cairo_serialized_size(& from); let to = match cainome :: - cairo_serde :: ContractAddress :: - cairo_deserialize(& event.keys, key_offset) + let mut temp = vec! []; + temp.extend(usize :: cairo_serialize(& 1usize)); + temp.extend(MessageConsumed :: cairo_serialize(val)); temp + }, Event :: MessageCancellationStarted(val) => { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", "to", - "MessageCancellationStarted", e)), - }; key_offset += cainome :: cairo_serde :: ContractAddress :: - cairo_serialized_size(& to); let selector = match starknet :: core - :: types :: FieldElement :: - cairo_deserialize(& event.data, data_offset) + let mut temp = vec! []; + temp.extend(usize :: cairo_serialize(& 2usize)); + temp.extend(MessageCancellationStarted :: + cairo_serialize(val)); temp + }, Event :: MessageCanceled(val) => { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", "selector", - "MessageCancellationStarted", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& selector); let payload = match Vec :: < - starknet :: core :: types :: FieldElement > :: - cairo_deserialize(& event.data, data_offset) + let mut temp = vec! []; + temp.extend(usize :: cairo_serialize(& 3usize)); + temp.extend(MessageCanceled :: cairo_serialize(val)); temp + }, Event :: MessageToStarknetReceived(val) => { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", "payload", - "MessageCancellationStarted", e)), - }; data_offset += Vec :: < starknet :: core :: types :: - FieldElement > :: cairo_serialized_size(& payload); let nonce = - match starknet :: core :: types :: FieldElement :: - cairo_deserialize(& event.data, data_offset) + let mut temp = vec! []; + temp.extend(usize :: cairo_serialize(& 4usize)); + temp.extend(MessageToStarknetReceived :: + cairo_serialize(val)); temp + }, Event :: MessageToAppchainSealed(val) => { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", "nonce", - "MessageCancellationStarted", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& nonce); return + let mut temp = vec! []; + temp.extend(usize :: cairo_serialize(& 5usize)); + temp.extend(MessageToAppchainSealed :: cairo_serialize(val)); + temp + }, _ => vec! [] + } + } fn + cairo_deserialize(__felts : & [starknet :: core :: types :: Felt], + __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > + { + let __f = __felts [__offset]; let __index = u128 :: + from_be_bytes(__f.to_bytes_be() [16 ..].try_into().unwrap()); match + __index as usize + { + 0usize => Ok(Event :: - MessagingEvent(Event :: - MessageCancellationStarted(MessageCancellationStarted - { message_hash, from, to, selector, payload, nonce }))) - }; let selector = event.keys [0]; if selector == starknet :: core :: - utils :: - get_selector_from_name("MessageCanceled").unwrap_or_else(| _ | panic! - ("Invalid selector for {}", "MessageCanceled")) + MessageSent(MessageSent :: + cairo_deserialize(__felts, __offset + 1) ?)), 1usize => + Ok(Event :: + MessageConsumed(MessageConsumed :: + cairo_deserialize(__felts, __offset + 1) ?)), 2usize => + Ok(Event :: + MessageCancellationStarted(MessageCancellationStarted :: + cairo_deserialize(__felts, __offset + 1) ?)), 3usize => + Ok(Event :: + MessageCanceled(MessageCanceled :: + cairo_deserialize(__felts, __offset + 1) ?)), 4usize => + Ok(Event :: + MessageToStarknetReceived(MessageToStarknetReceived :: + cairo_deserialize(__felts, __offset + 1) ?)), 5usize => + Ok(Event :: + MessageToAppchainSealed(MessageToAppchainSealed :: + cairo_deserialize(__felts, __offset + 1) ?)), _ => return + Err(cainome :: cairo_serde :: Error :: + Deserialize(format! ("Index not handle for enum {}", "Event"))) + } + } +} impl TryFrom < starknet :: core :: types :: EmittedEvent > for Event +{ + type Error = String; fn + try_from(event : starknet :: core :: types :: EmittedEvent) -> Result < + Self, Self :: Error > + { + use cainome :: cairo_serde :: CairoSerde; if event.keys.is_empty() + { return Err("Event has no key".to_string()); } let selector = + event.keys [0]; if selector == starknet :: core :: utils :: + get_selector_from_name("MessageSent").unwrap_or_else(| _ | panic! + ("Invalid selector for {}", "MessageSent")) { let mut key_offset = 0 + 1; let mut data_offset = 0; let - message_hash = match starknet :: core :: types :: FieldElement :: + message_hash = match starknet :: core :: types :: Felt :: cairo_deserialize(& event.keys, key_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", - "message_hash", "MessageCanceled", e)), - }; key_offset += starknet :: core :: types :: FieldElement :: + "message_hash", "MessageSent", e)), + }; key_offset += starknet :: core :: types :: Felt :: cairo_serialized_size(& message_hash); let from = match cainome :: cairo_serde :: ContractAddress :: cairo_deserialize(& event.keys, key_offset) @@ -1498,7 +1697,7 @@ for LogStateTransitionFact Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "from", - "MessageCanceled", e)), + "MessageSent", e)), }; key_offset += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& from); let to = match cainome :: cairo_serde :: ContractAddress :: @@ -1507,54 +1706,52 @@ for LogStateTransitionFact Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "to", - "MessageCanceled", e)), + "MessageSent", e)), }; key_offset += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& to); let selector = match starknet :: core - :: types :: FieldElement :: - cairo_deserialize(& event.data, data_offset) + :: types :: Felt :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "selector", - "MessageCanceled", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& selector); let payload = match Vec :: < - starknet :: core :: types :: FieldElement > :: + "MessageSent", e)), + }; data_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& selector); let nonce = match starknet :: + core :: types :: Felt :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! - ("Could not deserialize field {} for {}: {:?}", "payload", - "MessageCanceled", e)), - }; data_offset += Vec :: < starknet :: core :: types :: - FieldElement > :: cairo_serialized_size(& payload); let nonce = - match starknet :: core :: types :: FieldElement :: + ("Could not deserialize field {} for {}: {:?}", "nonce", + "MessageSent", e)), + }; data_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& nonce); let payload = match Vec :: < + starknet :: core :: types :: Felt > :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! - ("Could not deserialize field {} for {}: {:?}", "nonce", - "MessageCanceled", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& nonce); return + ("Could not deserialize field {} for {}: {:?}", "payload", + "MessageSent", e)), + }; data_offset += Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialized_size(& payload); return Ok(Event :: - MessagingEvent(Event :: - MessageCanceled(MessageCanceled - { message_hash, from, to, selector, payload, nonce }))) + MessageSent(MessageSent + { message_hash, from, to, selector, nonce, payload })) }; let selector = event.keys [0]; if selector == starknet :: core :: utils :: - get_selector_from_name("MessageToStarknetReceived").unwrap_or_else(| _ - | panic! ("Invalid selector for {}", "MessageToStarknetReceived")) + get_selector_from_name("MessageConsumed").unwrap_or_else(| _ | panic! + ("Invalid selector for {}", "MessageConsumed")) { let mut key_offset = 0 + 1; let mut data_offset = 0; let - message_hash = match starknet :: core :: types :: FieldElement :: + message_hash = match starknet :: core :: types :: Felt :: cairo_deserialize(& event.keys, key_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", - "message_hash", "MessageToStarknetReceived", e)), - }; key_offset += starknet :: core :: types :: FieldElement :: + "message_hash", "MessageConsumed", e)), + }; key_offset += starknet :: core :: types :: Felt :: cairo_serialized_size(& message_hash); let from = match cainome :: cairo_serde :: ContractAddress :: cairo_deserialize(& event.keys, key_offset) @@ -1562,7 +1759,7 @@ for LogStateTransitionFact Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "from", - "MessageToStarknetReceived", e)), + "MessageConsumed", e)), }; key_offset += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& from); let to = match cainome :: cairo_serde :: ContractAddress :: @@ -1571,36 +1768,35 @@ for LogStateTransitionFact Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "to", - "MessageToStarknetReceived", e)), + "MessageConsumed", e)), }; key_offset += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& to); let payload = match Vec :: < starknet - :: core :: types :: FieldElement > :: + :: core :: types :: Felt > :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "payload", - "MessageToStarknetReceived", e)), - }; data_offset += Vec :: < starknet :: core :: types :: - FieldElement > :: cairo_serialized_size(& payload); return + "MessageConsumed", e)), + }; data_offset += Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialized_size(& payload); return Ok(Event :: - MessagingEvent(Event :: - MessageToStarknetReceived(MessageToStarknetReceived - { message_hash, from, to, payload }))) + MessageConsumed(MessageConsumed + { message_hash, from, to, payload })) }; let selector = event.keys [0]; if selector == starknet :: core :: utils :: - get_selector_from_name("MessageToAppchainSealed").unwrap_or_else(| _ | - panic! ("Invalid selector for {}", "MessageToAppchainSealed")) + get_selector_from_name("MessageCancellationStarted").unwrap_or_else(| + _ | panic! ("Invalid selector for {}", "MessageCancellationStarted")) { let mut key_offset = 0 + 1; let mut data_offset = 0; let - message_hash = match starknet :: core :: types :: FieldElement :: + message_hash = match starknet :: core :: types :: Felt :: cairo_deserialize(& event.keys, key_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", - "message_hash", "MessageToAppchainSealed", e)), - }; key_offset += starknet :: core :: types :: FieldElement :: + "message_hash", "MessageCancellationStarted", e)), + }; key_offset += starknet :: core :: types :: Felt :: cairo_serialized_size(& message_hash); let from = match cainome :: cairo_serde :: ContractAddress :: cairo_deserialize(& event.keys, key_offset) @@ -1608,7 +1804,7 @@ for LogStateTransitionFact Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "from", - "MessageToAppchainSealed", e)), + "MessageCancellationStarted", e)), }; key_offset += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& from); let to = match cainome :: cairo_serde :: ContractAddress :: @@ -1617,265 +1813,224 @@ for LogStateTransitionFact Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "to", - "MessageToAppchainSealed", e)), + "MessageCancellationStarted", e)), }; key_offset += cainome :: cairo_serde :: ContractAddress :: cairo_serialized_size(& to); let selector = match starknet :: core - :: types :: FieldElement :: - cairo_deserialize(& event.data, data_offset) + :: types :: Felt :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", "selector", - "MessageToAppchainSealed", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& selector); let nonce = match starknet :: - core :: types :: FieldElement :: + "MessageCancellationStarted", e)), + }; data_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& selector); let payload = match Vec :: < + starknet :: core :: types :: Felt > :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! - ("Could not deserialize field {} for {}: {:?}", "nonce", - "MessageToAppchainSealed", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& nonce); let payload = match Vec :: < - starknet :: core :: types :: FieldElement > :: + ("Could not deserialize field {} for {}: {:?}", "payload", + "MessageCancellationStarted", e)), + }; data_offset += Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialized_size(& payload); let nonce = match starknet :: + core :: types :: Felt :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! - ("Could not deserialize field {} for {}: {:?}", "payload", - "MessageToAppchainSealed", e)), - }; data_offset += Vec :: < starknet :: core :: types :: - FieldElement > :: cairo_serialized_size(& payload); return + ("Could not deserialize field {} for {}: {:?}", "nonce", + "MessageCancellationStarted", e)), + }; data_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& nonce); return Ok(Event :: - MessagingEvent(Event :: - MessageToAppchainSealed(MessageToAppchainSealed - { message_hash, from, to, selector, nonce, payload }))) + MessageCancellationStarted(MessageCancellationStarted + { message_hash, from, to, selector, payload, nonce })) }; let selector = event.keys [0]; if selector == starknet :: core :: utils :: - get_selector_from_name("LogStateUpdate").unwrap_or_else(| _ | panic! - ("Invalid selector for {}", "LogStateUpdate")) + get_selector_from_name("MessageCanceled").unwrap_or_else(| _ | panic! + ("Invalid selector for {}", "MessageCanceled")) { let mut key_offset = 0 + 1; let mut data_offset = 0; let - state_root = match starknet :: core :: types :: FieldElement :: - cairo_deserialize(& event.data, data_offset) - { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", "state_root", - "LogStateUpdate", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& state_root); let block_number = match - starknet :: core :: types :: FieldElement :: - cairo_deserialize(& event.data, data_offset) + message_hash = match starknet :: core :: types :: Felt :: + cairo_deserialize(& event.keys, key_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", - "block_number", "LogStateUpdate", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& block_number); let block_hash = match - starknet :: core :: types :: FieldElement :: - cairo_deserialize(& event.data, data_offset) + "message_hash", "MessageCanceled", e)), + }; key_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& message_hash); let from = match cainome :: + cairo_serde :: ContractAddress :: + cairo_deserialize(& event.keys, key_offset) { Ok(v) => v, Err(e) => return Err(format! - ("Could not deserialize field {} for {}: {:?}", "block_hash", - "LogStateUpdate", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& block_hash); return - Ok(Event :: - LogStateUpdate(LogStateUpdate - { state_root, block_number, block_hash })) - }; let selector = event.keys [0]; if selector == starknet :: core :: - utils :: - get_selector_from_name("LogStateTransitionFact").unwrap_or_else(| _ | - panic! ("Invalid selector for {}", "LogStateTransitionFact")) - { - let mut key_offset = 0 + 1; let mut data_offset = 0; let - state_transition_fact = match U256 :: - cairo_deserialize(& event.data, data_offset) + ("Could not deserialize field {} for {}: {:?}", "from", + "MessageCanceled", e)), + }; key_offset += cainome :: cairo_serde :: ContractAddress :: + cairo_serialized_size(& from); let to = match cainome :: + cairo_serde :: ContractAddress :: + cairo_deserialize(& event.keys, key_offset) { Ok(v) => v, Err(e) => return Err(format! - ("Could not deserialize field {} for {}: {:?}", - "state_transition_fact", "LogStateTransitionFact", e)), - }; data_offset += U256 :: - cairo_serialized_size(& state_transition_fact); return - Ok(Event :: - LogStateTransitionFact(LogStateTransitionFact - { state_transition_fact })) - }; - Err(format! ("Could not match any event from keys {:?}", event.keys)) - } -} #[derive(Debug, PartialEq, Clone)] pub enum MessageToStarknetStatus -{ - NothingToConsume, - ReadyToConsume(starknet :: core :: types :: FieldElement) -} impl cainome :: cairo_serde :: CairoSerde for MessageToStarknetStatus -{ - type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < - usize > = std :: option :: Option :: None; #[inline] fn - cairo_serialized_size(__rust : & Self :: RustType) -> usize - { - match __rust - { - MessageToStarknetStatus :: NothingToConsume => 1, - MessageToStarknetStatus :: ReadyToConsume(val) => starknet :: core - :: types :: FieldElement :: cairo_serialized_size(val) + 1, _ => 0 - } - } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: - core :: types :: FieldElement > - { - match __rust - { - MessageToStarknetStatus :: NothingToConsume => usize :: - cairo_serialize(& 0usize), MessageToStarknetStatus :: - ReadyToConsume(val) => - { - let mut temp = vec! []; - temp.extend(usize :: cairo_serialize(& 1usize)); - temp.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(val)); temp - }, _ => vec! [] - } - } fn - cairo_deserialize(__felts : & [starknet :: core :: types :: FieldElement], - __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > - { - let __index : u128 = __felts [__offset].try_into().unwrap(); match - __index as usize - { - 0usize => Ok(MessageToStarknetStatus :: NothingToConsume), 1usize - => - Ok(MessageToStarknetStatus :: - ReadyToConsume(starknet :: core :: types :: FieldElement :: - cairo_deserialize(__felts, __offset + 1) ?)), _ => return - Err(cainome :: cairo_serde :: Error :: - Deserialize(format! - ("Index not handle for enum {}", "MessageToStarknetStatus"))) - } - } -} #[derive(Debug, PartialEq, Clone)] pub enum Event -{ ProgramInfoChanged(ProgramInfoChanged) } impl cainome :: cairo_serde :: -CairoSerde for Event -{ - type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < - usize > = std :: option :: Option :: None; #[inline] fn - cairo_serialized_size(__rust : & Self :: RustType) -> usize - { - match __rust - { - Event :: ProgramInfoChanged(val) => ProgramInfoChanged :: - cairo_serialized_size(val) + 1, _ => 0 - } - } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: - core :: types :: FieldElement > - { - match __rust - { - Event :: ProgramInfoChanged(val) => + ("Could not deserialize field {} for {}: {:?}", "to", + "MessageCanceled", e)), + }; key_offset += cainome :: cairo_serde :: ContractAddress :: + cairo_serialized_size(& to); let selector = match starknet :: core + :: types :: Felt :: cairo_deserialize(& event.data, data_offset) { - let mut temp = vec! []; - temp.extend(usize :: cairo_serialize(& 0usize)); - temp.extend(ProgramInfoChanged :: cairo_serialize(val)); temp - }, _ => vec! [] - } - } fn - cairo_deserialize(__felts : & [starknet :: core :: types :: FieldElement], - __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > - { - let __index : u128 = __felts [__offset].try_into().unwrap(); match - __index as usize - { - 0usize => - Ok(Event :: - ProgramInfoChanged(ProgramInfoChanged :: - cairo_deserialize(__felts, __offset + 1) ?)), _ => return - Err(cainome :: cairo_serde :: Error :: - Deserialize(format! ("Index not handle for enum {}", "Event"))) - } - } -} impl TryFrom < starknet :: core :: types :: EmittedEvent > for Event -{ - type Error = String; fn - try_from(event : starknet :: core :: types :: EmittedEvent) -> Result < - Self, Self :: Error > - { - use cainome :: cairo_serde :: CairoSerde; if event.keys.is_empty() - { return Err("Event has no key".to_string()); } let selector = - event.keys [0]; if selector == starknet :: core :: utils :: - get_selector_from_name("ProgramInfoChanged").unwrap_or_else(| _ | - panic! ("Invalid selector for {}", "ProgramInfoChanged")) - { - let mut key_offset = 0 + 1; let mut data_offset = 0; let - changed_by = match cainome :: cairo_serde :: ContractAddress :: + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", "selector", + "MessageCanceled", e)), + }; data_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& selector); let payload = match Vec :: < + starknet :: core :: types :: Felt > :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! - ("Could not deserialize field {} for {}: {:?}", "changed_by", - "ProgramInfoChanged", e)), - }; data_offset += cainome :: cairo_serde :: ContractAddress :: - cairo_serialized_size(& changed_by); let old_program_hash = match - starknet :: core :: types :: FieldElement :: + ("Could not deserialize field {} for {}: {:?}", "payload", + "MessageCanceled", e)), + }; data_offset += Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialized_size(& payload); let nonce = match starknet :: + core :: types :: Felt :: cairo_deserialize(& event.data, data_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", "nonce", + "MessageCanceled", e)), + }; data_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& nonce); return + Ok(Event :: + MessageCanceled(MessageCanceled + { message_hash, from, to, selector, payload, nonce })) + }; let selector = event.keys [0]; if selector == starknet :: core :: + utils :: + get_selector_from_name("MessageToStarknetReceived").unwrap_or_else(| _ + | panic! ("Invalid selector for {}", "MessageToStarknetReceived")) + { + let mut key_offset = 0 + 1; let mut data_offset = 0; let + message_hash = match starknet :: core :: types :: Felt :: + cairo_deserialize(& event.keys, key_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", - "old_program_hash", "ProgramInfoChanged", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& old_program_hash); let new_program_hash = - match starknet :: core :: types :: FieldElement :: + "message_hash", "MessageToStarknetReceived", e)), + }; key_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& message_hash); let from = match cainome :: + cairo_serde :: ContractAddress :: + cairo_deserialize(& event.keys, key_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", "from", + "MessageToStarknetReceived", e)), + }; key_offset += cainome :: cairo_serde :: ContractAddress :: + cairo_serialized_size(& from); let to = match cainome :: + cairo_serde :: ContractAddress :: + cairo_deserialize(& event.keys, key_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", "to", + "MessageToStarknetReceived", e)), + }; key_offset += cainome :: cairo_serde :: ContractAddress :: + cairo_serialized_size(& to); let payload = match Vec :: < starknet + :: core :: types :: Felt > :: cairo_deserialize(& event.data, data_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", "payload", + "MessageToStarknetReceived", e)), + }; data_offset += Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialized_size(& payload); return + Ok(Event :: + MessageToStarknetReceived(MessageToStarknetReceived + { message_hash, from, to, payload })) + }; let selector = event.keys [0]; if selector == starknet :: core :: + utils :: + get_selector_from_name("MessageToAppchainSealed").unwrap_or_else(| _ | + panic! ("Invalid selector for {}", "MessageToAppchainSealed")) + { + let mut key_offset = 0 + 1; let mut data_offset = 0; let + message_hash = match starknet :: core :: types :: Felt :: + cairo_deserialize(& event.keys, key_offset) { Ok(v) => v, Err(e) => return Err(format! ("Could not deserialize field {} for {}: {:?}", - "new_program_hash", "ProgramInfoChanged", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& new_program_hash); let old_config_hash = - match starknet :: core :: types :: FieldElement :: + "message_hash", "MessageToAppchainSealed", e)), + }; key_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& message_hash); let from = match cainome :: + cairo_serde :: ContractAddress :: + cairo_deserialize(& event.keys, key_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", "from", + "MessageToAppchainSealed", e)), + }; key_offset += cainome :: cairo_serde :: ContractAddress :: + cairo_serialized_size(& from); let to = match cainome :: + cairo_serde :: ContractAddress :: + cairo_deserialize(& event.keys, key_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", "to", + "MessageToAppchainSealed", e)), + }; key_offset += cainome :: cairo_serde :: ContractAddress :: + cairo_serialized_size(& to); let selector = match starknet :: core + :: types :: Felt :: cairo_deserialize(& event.data, data_offset) + { + Ok(v) => v, Err(e) => return + Err(format! + ("Could not deserialize field {} for {}: {:?}", "selector", + "MessageToAppchainSealed", e)), + }; data_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& selector); let nonce = match starknet :: + core :: types :: Felt :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! - ("Could not deserialize field {} for {}: {:?}", - "old_config_hash", "ProgramInfoChanged", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& old_config_hash); let new_config_hash = - match starknet :: core :: types :: FieldElement :: + ("Could not deserialize field {} for {}: {:?}", "nonce", + "MessageToAppchainSealed", e)), + }; data_offset += starknet :: core :: types :: Felt :: + cairo_serialized_size(& nonce); let payload = match Vec :: < + starknet :: core :: types :: Felt > :: cairo_deserialize(& event.data, data_offset) { Ok(v) => v, Err(e) => return Err(format! - ("Could not deserialize field {} for {}: {:?}", - "new_config_hash", "ProgramInfoChanged", e)), - }; data_offset += starknet :: core :: types :: FieldElement :: - cairo_serialized_size(& new_config_hash); return + ("Could not deserialize field {} for {}: {:?}", "payload", + "MessageToAppchainSealed", e)), + }; data_offset += Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialized_size(& payload); return Ok(Event :: - ProgramInfoChanged(ProgramInfoChanged - { - changed_by, old_program_hash, new_program_hash, - old_config_hash, new_config_hash - })) + MessageToAppchainSealed(MessageToAppchainSealed + { message_hash, from, to, selector, nonce, payload })) }; Err(format! ("Could not match any event from keys {:?}", event.keys)) } -} #[derive(Debug, PartialEq, Clone)] pub enum Event {} impl cainome :: -cairo_serde :: CairoSerde for Event +} #[derive(Debug, PartialEq, Eq, Clone, Copy,)] pub enum Event {} impl cainome +:: cairo_serde :: CairoSerde for Event { type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < usize > = std :: option :: Option :: None; #[inline] fn cairo_serialized_size(__rust : & Self :: RustType) -> usize { match __rust { _ => 0 } } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: core :: - types :: FieldElement > { match __rust { _ => vec! [] } } fn - cairo_deserialize(__felts : & [starknet :: core :: types :: FieldElement], + types :: Felt > { match __rust { _ => vec! [] } } fn + cairo_deserialize(__felts : & [starknet :: core :: types :: Felt], __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > { - let __index : u128 = __felts [__offset].try_into().unwrap(); match + let __f = __felts [__offset]; let __index = u128 :: + from_be_bytes(__f.to_bytes_be() [16 ..].try_into().unwrap()); match __index as usize { _ => return @@ -1893,137 +2048,20 @@ cairo_serde :: CairoSerde for Event { return Err("Event has no key".to_string()); } Err(format! ("Could not match any event from keys {:?}", event.keys)) } -} #[derive(Debug, PartialEq, Clone)] pub enum Event -{ - OwnershipTransferred(OwnershipTransferred), - OwnershipTransferStarted(OwnershipTransferStarted) -} impl cainome :: cairo_serde :: CairoSerde for Event -{ - type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < - usize > = std :: option :: Option :: None; #[inline] fn - cairo_serialized_size(__rust : & Self :: RustType) -> usize - { - match __rust - { - Event :: OwnershipTransferred(val) => OwnershipTransferred :: - cairo_serialized_size(val) + 1, Event :: - OwnershipTransferStarted(val) => OwnershipTransferStarted :: - cairo_serialized_size(val) + 1, _ => 0 - } - } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: - core :: types :: FieldElement > - { - match __rust - { - Event :: OwnershipTransferred(val) => - { - let mut temp = vec! []; - temp.extend(usize :: cairo_serialize(& 0usize)); - temp.extend(OwnershipTransferred :: cairo_serialize(val)); - temp - }, Event :: OwnershipTransferStarted(val) => - { - let mut temp = vec! []; - temp.extend(usize :: cairo_serialize(& 1usize)); - temp.extend(OwnershipTransferStarted :: cairo_serialize(val)); - temp - }, _ => vec! [] - } - } fn - cairo_deserialize(__felts : & [starknet :: core :: types :: FieldElement], - __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > - { - let __index : u128 = __felts [__offset].try_into().unwrap(); match - __index as usize - { - 0usize => - Ok(Event :: - OwnershipTransferred(OwnershipTransferred :: - cairo_deserialize(__felts, __offset + 1) ?)), 1usize => - Ok(Event :: - OwnershipTransferStarted(OwnershipTransferStarted :: - cairo_deserialize(__felts, __offset + 1) ?)), _ => return - Err(cainome :: cairo_serde :: Error :: - Deserialize(format! ("Index not handle for enum {}", "Event"))) - } - } -} impl TryFrom < starknet :: core :: types :: EmittedEvent > for Event -{ - type Error = String; fn - try_from(event : starknet :: core :: types :: EmittedEvent) -> Result < - Self, Self :: Error > - { - use cainome :: cairo_serde :: CairoSerde; if event.keys.is_empty() - { return Err("Event has no key".to_string()); } let selector = - event.keys [0]; if selector == starknet :: core :: utils :: - get_selector_from_name("OwnershipTransferred").unwrap_or_else(| _ | - panic! ("Invalid selector for {}", "OwnershipTransferred")) - { - let mut key_offset = 0 + 1; let mut data_offset = 0; let - previous_owner = match cainome :: cairo_serde :: ContractAddress - :: cairo_deserialize(& event.keys, key_offset) - { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", - "previous_owner", "OwnershipTransferred", e)), - }; key_offset += cainome :: cairo_serde :: ContractAddress :: - cairo_serialized_size(& previous_owner); let new_owner = match - cainome :: cairo_serde :: ContractAddress :: - cairo_deserialize(& event.keys, key_offset) - { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", "new_owner", - "OwnershipTransferred", e)), - }; key_offset += cainome :: cairo_serde :: ContractAddress :: - cairo_serialized_size(& new_owner); return - Ok(Event :: - OwnershipTransferred(OwnershipTransferred - { previous_owner, new_owner })) - }; let selector = event.keys [0]; if selector == starknet :: core :: - utils :: - get_selector_from_name("OwnershipTransferStarted").unwrap_or_else(| _ - | panic! ("Invalid selector for {}", "OwnershipTransferStarted")) - { - let mut key_offset = 0 + 1; let mut data_offset = 0; let - previous_owner = match cainome :: cairo_serde :: ContractAddress - :: cairo_deserialize(& event.keys, key_offset) - { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", - "previous_owner", "OwnershipTransferStarted", e)), - }; key_offset += cainome :: cairo_serde :: ContractAddress :: - cairo_serialized_size(& previous_owner); let new_owner = match - cainome :: cairo_serde :: ContractAddress :: - cairo_deserialize(& event.keys, key_offset) - { - Ok(v) => v, Err(e) => return - Err(format! - ("Could not deserialize field {} for {}: {:?}", "new_owner", - "OwnershipTransferStarted", e)), - }; key_offset += cainome :: cairo_serde :: ContractAddress :: - cairo_serialized_size(& new_owner); return - Ok(Event :: - OwnershipTransferStarted(OwnershipTransferStarted - { previous_owner, new_owner })) - }; - Err(format! ("Could not match any event from keys {:?}", event.keys)) - } -} #[derive(Debug, PartialEq, Clone)] pub enum Event {} impl cainome :: -cairo_serde :: CairoSerde for Event +} #[derive(Debug, PartialEq, Eq, Clone, Copy,)] pub enum Event {} impl cainome +:: cairo_serde :: CairoSerde for Event { type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < usize > = std :: option :: Option :: None; #[inline] fn cairo_serialized_size(__rust : & Self :: RustType) -> usize { match __rust { _ => 0 } } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: core :: - types :: FieldElement > { match __rust { _ => vec! [] } } fn - cairo_deserialize(__felts : & [starknet :: core :: types :: FieldElement], + types :: Felt > { match __rust { _ => vec! [] } } fn + cairo_deserialize(__felts : & [starknet :: core :: types :: Felt], __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > { - let __index : u128 = __felts [__offset].try_into().unwrap(); match + let __f = __felts [__offset]; let __index = u128 :: + from_be_bytes(__f.to_bytes_be() [16 ..].try_into().unwrap()); match __index as usize { _ => return @@ -2041,9 +2079,10 @@ cairo_serde :: CairoSerde for Event { return Err("Event has no key".to_string()); } Err(format! ("Could not match any event from keys {:?}", event.keys)) } -} #[derive(Debug, PartialEq, Clone)] pub enum MessageToAppchainStatus -{ SealedOrNotSent, Pending(starknet :: core :: types :: FieldElement) } impl -cainome :: cairo_serde :: CairoSerde for MessageToAppchainStatus +} #[derive(Debug, PartialEq, Eq, Clone, Copy,)] pub enum +MessageToAppchainStatus +{ SealedOrNotSent, Pending(starknet :: core :: types :: Felt) } impl cainome +:: cairo_serde :: CairoSerde for MessageToAppchainStatus { type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < usize > = std :: option :: Option :: None; #[inline] fn @@ -2053,10 +2092,10 @@ cainome :: cairo_serde :: CairoSerde for MessageToAppchainStatus { MessageToAppchainStatus :: SealedOrNotSent => 1, MessageToAppchainStatus :: Pending(val) => starknet :: core :: - types :: FieldElement :: cairo_serialized_size(val) + 1, _ => 0 + types :: Felt :: cairo_serialized_size(val) + 1, _ => 0 } } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: - core :: types :: FieldElement > + core :: types :: Felt > { match __rust { @@ -2066,80 +2105,124 @@ cainome :: cairo_serde :: CairoSerde for MessageToAppchainStatus { let mut temp = vec! []; temp.extend(usize :: cairo_serialize(& 1usize)); - temp.extend(starknet :: core :: types :: FieldElement :: + temp.extend(starknet :: core :: types :: Felt :: + cairo_serialize(val)); temp + }, _ => vec! [] + } + } fn + cairo_deserialize(__felts : & [starknet :: core :: types :: Felt], + __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > + { + let __f = __felts [__offset]; let __index = u128 :: + from_be_bytes(__f.to_bytes_be() [16 ..].try_into().unwrap()); match + __index as usize + { + 0usize => Ok(MessageToAppchainStatus :: SealedOrNotSent), 1usize + => + Ok(MessageToAppchainStatus :: + Pending(starknet :: core :: types :: Felt :: + cairo_deserialize(__felts, __offset + 1) ?)), _ => return + Err(cainome :: cairo_serde :: Error :: + Deserialize(format! + ("Index not handle for enum {}", "MessageToAppchainStatus"))) + } + } +} #[derive(Debug, PartialEq, Eq, Clone, Copy,)] pub enum +MessageToStarknetStatus +{ NothingToConsume, ReadyToConsume(starknet :: core :: types :: Felt) } impl +cainome :: cairo_serde :: CairoSerde for MessageToStarknetStatus +{ + type RustType = Self; const SERIALIZED_SIZE : std :: option :: Option < + usize > = std :: option :: Option :: None; #[inline] fn + cairo_serialized_size(__rust : & Self :: RustType) -> usize + { + match __rust + { + MessageToStarknetStatus :: NothingToConsume => 1, + MessageToStarknetStatus :: ReadyToConsume(val) => starknet :: core + :: types :: Felt :: cairo_serialized_size(val) + 1, _ => 0 + } + } fn cairo_serialize(__rust : & Self :: RustType) -> Vec < starknet :: + core :: types :: Felt > + { + match __rust + { + MessageToStarknetStatus :: NothingToConsume => usize :: + cairo_serialize(& 0usize), MessageToStarknetStatus :: + ReadyToConsume(val) => + { + let mut temp = vec! []; + temp.extend(usize :: cairo_serialize(& 1usize)); + temp.extend(starknet :: core :: types :: Felt :: cairo_serialize(val)); temp }, _ => vec! [] } } fn - cairo_deserialize(__felts : & [starknet :: core :: types :: FieldElement], + cairo_deserialize(__felts : & [starknet :: core :: types :: Felt], __offset : usize) -> cainome :: cairo_serde :: Result < Self :: RustType > { - let __index : u128 = __felts [__offset].try_into().unwrap(); match + let __f = __felts [__offset]; let __index = u128 :: + from_be_bytes(__f.to_bytes_be() [16 ..].try_into().unwrap()); match __index as usize { - 0usize => Ok(MessageToAppchainStatus :: SealedOrNotSent), 1usize + 0usize => Ok(MessageToStarknetStatus :: NothingToConsume), 1usize => - Ok(MessageToAppchainStatus :: - Pending(starknet :: core :: types :: FieldElement :: + Ok(MessageToStarknetStatus :: + ReadyToConsume(starknet :: core :: types :: Felt :: cairo_deserialize(__felts, __offset + 1) ?)), _ => return Err(cainome :: cairo_serde :: Error :: Deserialize(format! - ("Index not handle for enum {}", "MessageToAppchainStatus"))) + ("Index not handle for enum {}", "MessageToStarknetStatus"))) } } } impl < A : starknet :: accounts :: ConnectedAccount + Sync > AppChain < A > { #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub fn - get_facts_registry(& self,) -> cainome :: cairo_serde :: call :: FCall < A - :: Provider, cainome :: cairo_serde :: ContractAddress > + appchain_to_sn_messages(& self, message_hash : & starknet :: core :: types + :: Felt) -> cainome :: cairo_serde :: call :: FCall < A :: Provider, + MessageToStarknetStatus > { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! - []; let __call = starknet :: core :: types :: FunctionCall + []; + __calldata.extend(starknet :: core :: types :: Felt :: + cairo_serialize(message_hash)); let __call = starknet :: core :: types + :: FunctionCall { contract_address : self.address, entry_point_selector : starknet - :: macros :: selector! ("get_facts_registry"), calldata : + :: macros :: selector! ("appchain_to_sn_messages"), calldata : __calldata, }; cainome :: cairo_serde :: call :: FCall :: new(__call, self.provider(),) } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub - fn - sn_to_appchain_messages(& self, message_hash : & starknet :: core :: types - :: FieldElement) -> cainome :: cairo_serde :: call :: FCall < A :: - Provider, MessageToAppchainStatus > + fn get_facts_registry(& self,) -> cainome :: cairo_serde :: call :: FCall + < A :: Provider, cainome :: cairo_serde :: ContractAddress > { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! - []; - __calldata.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(message_hash)); let __call = starknet :: core :: types - :: FunctionCall + []; let __call = starknet :: core :: types :: FunctionCall { contract_address : self.address, entry_point_selector : starknet - :: macros :: selector! ("sn_to_appchain_messages"), calldata : + :: macros :: selector! ("get_facts_registry"), calldata : __calldata, }; cainome :: cairo_serde :: call :: FCall :: new(__call, self.provider(),) } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub - fn - appchain_to_sn_messages(& self, message_hash : & starknet :: core :: types - :: FieldElement) -> cainome :: cairo_serde :: call :: FCall < A :: - Provider, MessageToStarknetStatus > + fn get_program_info(& self,) -> cainome :: cairo_serde :: call :: FCall < + A :: Provider, + (starknet :: core :: types :: Felt, starknet :: core :: types :: Felt) > { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! - []; - __calldata.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(message_hash)); let __call = starknet :: core :: types - :: FunctionCall + []; let __call = starknet :: core :: types :: FunctionCall { contract_address : self.address, entry_point_selector : starknet - :: macros :: selector! ("appchain_to_sn_messages"), calldata : + :: macros :: selector! ("get_program_info"), calldata : __calldata, }; cainome :: cairo_serde :: call :: FCall :: new(__call, self.provider(),) } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub fn get_state(& self,) -> cainome :: cairo_serde :: call :: FCall < A :: Provider, - (starknet :: core :: types :: FieldElement, starknet :: core :: types :: - FieldElement, starknet :: core :: types :: FieldElement) > + (starknet :: core :: types :: Felt, starknet :: core :: types :: Felt, + starknet :: core :: types :: Felt) > { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! []; let __call = starknet :: core :: types :: FunctionCall @@ -2164,398 +2247,435 @@ cainome :: cairo_serde :: CairoSerde for MessageToAppchainStatus }; cainome :: cairo_serde :: call :: FCall :: new(__call, self.provider(),) } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub - fn get_program_info(& self,) -> cainome :: cairo_serde :: call :: FCall < - A :: Provider, - (starknet :: core :: types :: FieldElement, starknet :: core :: types :: - FieldElement) > + fn + sn_to_appchain_messages(& self, message_hash : & starknet :: core :: types + :: Felt) -> cainome :: cairo_serde :: call :: FCall < A :: Provider, + MessageToAppchainStatus > { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! - []; let __call = starknet :: core :: types :: FunctionCall + []; + __calldata.extend(starknet :: core :: types :: Felt :: + cairo_serialize(message_hash)); let __call = starknet :: core :: types + :: FunctionCall { contract_address : self.address, entry_point_selector : starknet - :: macros :: selector! ("get_program_info"), calldata : + :: macros :: selector! ("sn_to_appchain_messages"), calldata : __calldata, }; cainome :: cairo_serde :: call :: FCall :: new(__call, self.provider(),) } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub fn - update_state_getcall(& self, program_output : & Vec :: < starknet :: core - :: types :: FieldElement > , onchain_data_hash : & starknet :: core :: - types :: FieldElement, onchain_data_size : & U256) -> starknet :: accounts - :: Call + cancel_message_getcall(& self, to_address : & cainome :: cairo_serde :: + ContractAddress, selector : & starknet :: core :: types :: Felt, payload : + & Vec :: < starknet :: core :: types :: Felt > , nonce : & starknet :: + core :: types :: Felt) -> starknet :: core :: types :: Call { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! []; - __calldata.extend(Vec :: < starknet :: core :: types :: FieldElement > - :: cairo_serialize(program_output)); - __calldata.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(onchain_data_hash)); - __calldata.extend(U256 :: cairo_serialize(onchain_data_size)); - starknet :: accounts :: Call + __calldata.extend(cainome :: cairo_serde :: ContractAddress :: + cairo_serialize(to_address)); + __calldata.extend(starknet :: core :: types :: Felt :: + cairo_serialize(selector)); + __calldata.extend(Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialize(payload)); + __calldata.extend(starknet :: core :: types :: Felt :: + cairo_serialize(nonce)); starknet :: core :: types :: Call { to : self.address, selector : starknet :: macros :: selector! - ("update_state"), calldata : __calldata, + ("cancel_message"), calldata : __calldata, } - } #[allow(clippy :: ptr_arg)] pub fn - update_state(& self, program_output : & Vec :: < starknet :: core :: types - :: FieldElement > , onchain_data_hash : & starknet :: core :: types :: - FieldElement, onchain_data_size : & U256) -> starknet :: accounts :: - Execution < A > - { - use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! - []; - __calldata.extend(Vec :: < starknet :: core :: types :: FieldElement > - :: cairo_serialize(program_output)); - __calldata.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(onchain_data_hash)); - __calldata.extend(U256 :: cairo_serialize(onchain_data_size)); let - __call = starknet :: accounts :: Call - { - to : self.address, selector : starknet :: macros :: selector! - ("update_state"), calldata : __calldata, - }; self.account.execute(vec! [__call]) } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub fn - set_program_info_getcall(& self, program_hash : & starknet :: core :: - types :: FieldElement, config_hash : & starknet :: core :: types :: - FieldElement) -> starknet :: accounts :: Call - { - use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! - []; - __calldata.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(program_hash)); - __calldata.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(config_hash)); starknet :: accounts :: Call - { - to : self.address, selector : starknet :: macros :: selector! - ("set_program_info"), calldata : __calldata, - } - } #[allow(clippy :: ptr_arg)] pub fn - set_program_info(& self, program_hash : & starknet :: core :: types :: - FieldElement, config_hash : & starknet :: core :: types :: FieldElement) - -> starknet :: accounts :: Execution < A > + cancel_message(& self, to_address : & cainome :: cairo_serde :: + ContractAddress, selector : & starknet :: core :: types :: Felt, payload : + & Vec :: < starknet :: core :: types :: Felt > , nonce : & starknet :: + core :: types :: Felt) -> starknet :: accounts :: ExecutionV1 < A > { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! []; - __calldata.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(program_hash)); - __calldata.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(config_hash)); let __call = starknet :: accounts :: + __calldata.extend(cainome :: cairo_serde :: ContractAddress :: + cairo_serialize(to_address)); + __calldata.extend(starknet :: core :: types :: Felt :: + cairo_serialize(selector)); + __calldata.extend(Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialize(payload)); + __calldata.extend(starknet :: core :: types :: Felt :: + cairo_serialize(nonce)); let __call = starknet :: core :: types :: Call { to : self.address, selector : starknet :: macros :: selector! - ("set_program_info"), calldata : __calldata, - }; self.account.execute(vec! [__call]) + ("cancel_message"), calldata : __calldata, + }; self.account.execute_v1(vec! [__call]) } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub fn - unregister_operator_getcall(& self, address : & cainome :: cairo_serde :: - ContractAddress) -> starknet :: accounts :: Call + consume_message_from_appchain_getcall(& self, from_address : & cainome :: + cairo_serde :: ContractAddress, payload : & Vec :: < starknet :: core :: + types :: Felt >) -> starknet :: core :: types :: Call { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! []; __calldata.extend(cainome :: cairo_serde :: ContractAddress :: - cairo_serialize(address)); starknet :: accounts :: Call + cairo_serialize(from_address)); + __calldata.extend(Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialize(payload)); starknet :: core :: types :: Call { to : self.address, selector : starknet :: macros :: selector! - ("unregister_operator"), calldata : __calldata, + ("consume_message_from_appchain"), calldata : __calldata, } - } #[allow(clippy :: ptr_arg)] pub fn - unregister_operator(& self, address : & cainome :: cairo_serde :: - ContractAddress) -> starknet :: accounts :: Execution < A > + } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub + fn + consume_message_from_appchain(& self, from_address : & cainome :: + cairo_serde :: ContractAddress, payload : & Vec :: < starknet :: core :: + types :: Felt >) -> starknet :: accounts :: ExecutionV1 < A > { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! []; __calldata.extend(cainome :: cairo_serde :: ContractAddress :: - cairo_serialize(address)); let __call = starknet :: accounts :: Call + cairo_serialize(from_address)); + __calldata.extend(Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialize(payload)); let __call = starknet :: core :: types :: + Call { to : self.address, selector : starknet :: macros :: selector! - ("unregister_operator"), calldata : __calldata, - }; self.account.execute(vec! [__call]) + ("consume_message_from_appchain"), calldata : __calldata, + }; self.account.execute_v1(vec! [__call]) } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub fn - update_getcall(& self, program_output : & Vec :: < starknet :: core :: - types :: FieldElement >) -> starknet :: accounts :: Call + register_operator_getcall(& self, address : & cainome :: cairo_serde :: + ContractAddress) -> starknet :: core :: types :: Call { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! []; - __calldata.extend(Vec :: < starknet :: core :: types :: FieldElement > - :: cairo_serialize(program_output)); starknet :: accounts :: Call + __calldata.extend(cainome :: cairo_serde :: ContractAddress :: + cairo_serialize(address)); starknet :: core :: types :: Call { to : self.address, selector : starknet :: macros :: selector! - ("update"), calldata : __calldata, + ("register_operator"), calldata : __calldata, } - } #[allow(clippy :: ptr_arg)] pub fn - update(& self, program_output : & Vec :: < starknet :: core :: types :: - FieldElement >) -> starknet :: accounts :: Execution < A > + } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub + fn + register_operator(& self, address : & cainome :: cairo_serde :: + ContractAddress) -> starknet :: accounts :: ExecutionV1 < A > { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! []; - __calldata.extend(Vec :: < starknet :: core :: types :: FieldElement > - :: cairo_serialize(program_output)); let __call = starknet :: accounts - :: Call + __calldata.extend(cainome :: cairo_serde :: ContractAddress :: + cairo_serialize(address)); let __call = starknet :: core :: types :: + Call { to : self.address, selector : starknet :: macros :: selector! - ("update"), calldata : __calldata, - }; self.account.execute(vec! [__call]) + ("register_operator"), calldata : __calldata, + }; self.account.execute_v1(vec! [__call]) } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub fn send_message_to_appchain_getcall(& self, to_address : & cainome :: cairo_serde :: ContractAddress, selector : & starknet :: core :: types :: - FieldElement, payload : & Vec :: < starknet :: core :: types :: - FieldElement >) -> starknet :: accounts :: Call + Felt, payload : & Vec :: < starknet :: core :: types :: Felt >) -> + starknet :: core :: types :: Call { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! []; __calldata.extend(cainome :: cairo_serde :: ContractAddress :: cairo_serialize(to_address)); - __calldata.extend(starknet :: core :: types :: FieldElement :: + __calldata.extend(starknet :: core :: types :: Felt :: cairo_serialize(selector)); - __calldata.extend(Vec :: < starknet :: core :: types :: FieldElement > - :: cairo_serialize(payload)); starknet :: accounts :: Call + __calldata.extend(Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialize(payload)); starknet :: core :: types :: Call { to : self.address, selector : starknet :: macros :: selector! ("send_message_to_appchain"), calldata : __calldata, } - } #[allow(clippy :: ptr_arg)] pub fn + } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub + fn send_message_to_appchain(& self, to_address : & cainome :: cairo_serde :: - ContractAddress, selector : & starknet :: core :: types :: FieldElement, - payload : & Vec :: < starknet :: core :: types :: FieldElement >) -> - starknet :: accounts :: Execution < A > + ContractAddress, selector : & starknet :: core :: types :: Felt, payload : + & Vec :: < starknet :: core :: types :: Felt >) -> starknet :: accounts :: + ExecutionV1 < A > { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! []; __calldata.extend(cainome :: cairo_serde :: ContractAddress :: cairo_serialize(to_address)); - __calldata.extend(starknet :: core :: types :: FieldElement :: + __calldata.extend(starknet :: core :: types :: Felt :: cairo_serialize(selector)); - __calldata.extend(Vec :: < starknet :: core :: types :: FieldElement > - :: cairo_serialize(payload)); let __call = starknet :: accounts :: + __calldata.extend(Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialize(payload)); let __call = starknet :: core :: types :: Call { to : self.address, selector : starknet :: macros :: selector! ("send_message_to_appchain"), calldata : __calldata, - }; self.account.execute(vec! [__call]) + }; self.account.execute_v1(vec! [__call]) } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub fn - consume_message_from_appchain_getcall(& self, from_address : & cainome :: - cairo_serde :: ContractAddress, payload : & Vec :: < starknet :: core :: - types :: FieldElement >) -> starknet :: accounts :: Call + set_facts_registry_getcall(& self, address : & cainome :: cairo_serde :: + ContractAddress) -> starknet :: core :: types :: Call { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! []; __calldata.extend(cainome :: cairo_serde :: ContractAddress :: - cairo_serialize(from_address)); - __calldata.extend(Vec :: < starknet :: core :: types :: FieldElement > - :: cairo_serialize(payload)); starknet :: accounts :: Call + cairo_serialize(address)); starknet :: core :: types :: Call { to : self.address, selector : starknet :: macros :: selector! - ("consume_message_from_appchain"), calldata : __calldata, + ("set_facts_registry"), calldata : __calldata, } - } #[allow(clippy :: ptr_arg)] pub fn - consume_message_from_appchain(& self, from_address : & cainome :: - cairo_serde :: ContractAddress, payload : & Vec :: < starknet :: core :: - types :: FieldElement >) -> starknet :: accounts :: Execution < A > + } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub + fn + set_facts_registry(& self, address : & cainome :: cairo_serde :: + ContractAddress) -> starknet :: accounts :: ExecutionV1 < A > { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! []; __calldata.extend(cainome :: cairo_serde :: ContractAddress :: - cairo_serialize(from_address)); - __calldata.extend(Vec :: < starknet :: core :: types :: FieldElement > - :: cairo_serialize(payload)); let __call = starknet :: accounts :: + cairo_serialize(address)); let __call = starknet :: core :: types :: Call { to : self.address, selector : starknet :: macros :: selector! - ("consume_message_from_appchain"), calldata : __calldata, - }; self.account.execute(vec! [__call]) + ("set_facts_registry"), calldata : __calldata, + }; self.account.execute_v1(vec! [__call]) } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub fn - cancel_message_getcall(& self, to_address : & cainome :: cairo_serde :: - ContractAddress, selector : & starknet :: core :: types :: FieldElement, - payload : & Vec :: < starknet :: core :: types :: FieldElement > , nonce : - & starknet :: core :: types :: FieldElement) -> starknet :: accounts :: - Call + set_program_info_getcall(& self, program_hash : & starknet :: core :: + types :: Felt, config_hash : & starknet :: core :: types :: Felt) -> + starknet :: core :: types :: Call + { + use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! + []; + __calldata.extend(starknet :: core :: types :: Felt :: + cairo_serialize(program_hash)); + __calldata.extend(starknet :: core :: types :: Felt :: + cairo_serialize(config_hash)); starknet :: core :: types :: Call + { + to : self.address, selector : starknet :: macros :: selector! + ("set_program_info"), calldata : __calldata, + } + } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub + fn + set_program_info(& self, program_hash : & starknet :: core :: types :: + Felt, config_hash : & starknet :: core :: types :: Felt) -> starknet :: + accounts :: ExecutionV1 < A > + { + use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! + []; + __calldata.extend(starknet :: core :: types :: Felt :: + cairo_serialize(program_hash)); + __calldata.extend(starknet :: core :: types :: Felt :: + cairo_serialize(config_hash)); let __call = starknet :: core :: types + :: Call + { + to : self.address, selector : starknet :: macros :: selector! + ("set_program_info"), calldata : __calldata, + }; self.account.execute_v1(vec! [__call]) + } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub + fn + start_message_cancellation_getcall(& self, to_address : & cainome :: + cairo_serde :: ContractAddress, selector : & starknet :: core :: types :: + Felt, payload : & Vec :: < starknet :: core :: types :: Felt > , nonce : & + starknet :: core :: types :: Felt) -> starknet :: core :: types :: Call { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! []; __calldata.extend(cainome :: cairo_serde :: ContractAddress :: cairo_serialize(to_address)); - __calldata.extend(starknet :: core :: types :: FieldElement :: + __calldata.extend(starknet :: core :: types :: Felt :: cairo_serialize(selector)); - __calldata.extend(Vec :: < starknet :: core :: types :: FieldElement > - :: cairo_serialize(payload)); - __calldata.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(nonce)); starknet :: accounts :: Call + __calldata.extend(Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialize(payload)); + __calldata.extend(starknet :: core :: types :: Felt :: + cairo_serialize(nonce)); starknet :: core :: types :: Call { to : self.address, selector : starknet :: macros :: selector! - ("cancel_message"), calldata : __calldata, + ("start_message_cancellation"), calldata : __calldata, } - } #[allow(clippy :: ptr_arg)] pub fn - cancel_message(& self, to_address : & cainome :: cairo_serde :: - ContractAddress, selector : & starknet :: core :: types :: FieldElement, - payload : & Vec :: < starknet :: core :: types :: FieldElement > , nonce : - & starknet :: core :: types :: FieldElement) -> starknet :: accounts :: - Execution < A > + } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub + fn + start_message_cancellation(& self, to_address : & cainome :: cairo_serde + :: ContractAddress, selector : & starknet :: core :: types :: Felt, + payload : & Vec :: < starknet :: core :: types :: Felt > , nonce : & + starknet :: core :: types :: Felt) -> starknet :: accounts :: ExecutionV1 + < A > { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! []; __calldata.extend(cainome :: cairo_serde :: ContractAddress :: cairo_serialize(to_address)); - __calldata.extend(starknet :: core :: types :: FieldElement :: + __calldata.extend(starknet :: core :: types :: Felt :: cairo_serialize(selector)); - __calldata.extend(Vec :: < starknet :: core :: types :: FieldElement > - :: cairo_serialize(payload)); - __calldata.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(nonce)); let __call = starknet :: accounts :: Call + __calldata.extend(Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialize(payload)); + __calldata.extend(starknet :: core :: types :: Felt :: + cairo_serialize(nonce)); let __call = starknet :: core :: types :: + Call { to : self.address, selector : starknet :: macros :: selector! - ("cancel_message"), calldata : __calldata, - }; self.account.execute(vec! [__call]) + ("start_message_cancellation"), calldata : __calldata, + }; self.account.execute_v1(vec! [__call]) } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub fn - register_operator_getcall(& self, address : & cainome :: cairo_serde :: - ContractAddress) -> starknet :: accounts :: Call + unregister_operator_getcall(& self, address : & cainome :: cairo_serde :: + ContractAddress) -> starknet :: core :: types :: Call { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! []; __calldata.extend(cainome :: cairo_serde :: ContractAddress :: - cairo_serialize(address)); starknet :: accounts :: Call + cairo_serialize(address)); starknet :: core :: types :: Call { to : self.address, selector : starknet :: macros :: selector! - ("register_operator"), calldata : __calldata, + ("unregister_operator"), calldata : __calldata, } - } #[allow(clippy :: ptr_arg)] pub fn - register_operator(& self, address : & cainome :: cairo_serde :: - ContractAddress) -> starknet :: accounts :: Execution < A > + } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub + fn + unregister_operator(& self, address : & cainome :: cairo_serde :: + ContractAddress) -> starknet :: accounts :: ExecutionV1 < A > { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! []; __calldata.extend(cainome :: cairo_serde :: ContractAddress :: - cairo_serialize(address)); let __call = starknet :: accounts :: Call + cairo_serialize(address)); let __call = starknet :: core :: types :: + Call { to : self.address, selector : starknet :: macros :: selector! - ("register_operator"), calldata : __calldata, - }; self.account.execute(vec! [__call]) + ("unregister_operator"), calldata : __calldata, + }; self.account.execute_v1(vec! [__call]) } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub fn - start_message_cancellation_getcall(& self, to_address : & cainome :: - cairo_serde :: ContractAddress, selector : & starknet :: core :: types :: - FieldElement, payload : & Vec :: < starknet :: core :: types :: - FieldElement > , nonce : & starknet :: core :: types :: FieldElement) -> - starknet :: accounts :: Call + update_getcall(& self, program_output : & Vec :: < starknet :: core :: + types :: Felt >) -> starknet :: core :: types :: Call { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! []; - __calldata.extend(cainome :: cairo_serde :: ContractAddress :: - cairo_serialize(to_address)); - __calldata.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(selector)); - __calldata.extend(Vec :: < starknet :: core :: types :: FieldElement > - :: cairo_serialize(payload)); - __calldata.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(nonce)); starknet :: accounts :: Call + __calldata.extend(Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialize(program_output)); starknet :: core :: types :: Call { to : self.address, selector : starknet :: macros :: selector! - ("start_message_cancellation"), calldata : __calldata, + ("update"), calldata : __calldata, } - } #[allow(clippy :: ptr_arg)] pub fn - start_message_cancellation(& self, to_address : & cainome :: cairo_serde - :: ContractAddress, selector : & starknet :: core :: types :: - FieldElement, payload : & Vec :: < starknet :: core :: types :: - FieldElement > , nonce : & starknet :: core :: types :: FieldElement) -> - starknet :: accounts :: Execution < A > + } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub + fn + update(& self, program_output : & Vec :: < starknet :: core :: types :: + Felt >) -> starknet :: accounts :: ExecutionV1 < A > { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! []; - __calldata.extend(cainome :: cairo_serde :: ContractAddress :: - cairo_serialize(to_address)); - __calldata.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(selector)); - __calldata.extend(Vec :: < starknet :: core :: types :: FieldElement > - :: cairo_serialize(payload)); - __calldata.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(nonce)); let __call = starknet :: accounts :: Call + __calldata.extend(Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialize(program_output)); let __call = starknet :: core :: + types :: Call { to : self.address, selector : starknet :: macros :: selector! - ("start_message_cancellation"), calldata : __calldata, - }; self.account.execute(vec! [__call]) + ("update"), calldata : __calldata, + }; self.account.execute_v1(vec! [__call]) } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub fn - set_facts_registry_getcall(& self, address : & cainome :: cairo_serde :: - ContractAddress) -> starknet :: accounts :: Call + update_state_getcall(& self, program_output : & Vec :: < starknet :: core + :: types :: Felt > , onchain_data_hash : & starknet :: core :: types :: + Felt, onchain_data_size : & cainome :: cairo_serde :: U256) -> starknet :: + core :: types :: Call { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! []; - __calldata.extend(cainome :: cairo_serde :: ContractAddress :: - cairo_serialize(address)); starknet :: accounts :: Call + __calldata.extend(Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialize(program_output)); + __calldata.extend(starknet :: core :: types :: Felt :: + cairo_serialize(onchain_data_hash)); + __calldata.extend(cainome :: cairo_serde :: U256 :: + cairo_serialize(onchain_data_size)); starknet :: core :: types :: Call { to : self.address, selector : starknet :: macros :: selector! - ("set_facts_registry"), calldata : __calldata, + ("update_state"), calldata : __calldata, } - } #[allow(clippy :: ptr_arg)] pub fn - set_facts_registry(& self, address : & cainome :: cairo_serde :: - ContractAddress) -> starknet :: accounts :: Execution < A > + } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub + fn + update_state(& self, program_output : & Vec :: < starknet :: core :: types + :: Felt > , onchain_data_hash : & starknet :: core :: types :: Felt, + onchain_data_size : & cainome :: cairo_serde :: U256) -> starknet :: + accounts :: ExecutionV1 < A > { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! []; - __calldata.extend(cainome :: cairo_serde :: ContractAddress :: - cairo_serialize(address)); let __call = starknet :: accounts :: Call + __calldata.extend(Vec :: < starknet :: core :: types :: Felt > :: + cairo_serialize(program_output)); + __calldata.extend(starknet :: core :: types :: Felt :: + cairo_serialize(onchain_data_hash)); + __calldata.extend(cainome :: cairo_serde :: U256 :: + cairo_serialize(onchain_data_size)); let __call = starknet :: core :: + types :: Call { to : self.address, selector : starknet :: macros :: selector! - ("set_facts_registry"), calldata : __calldata, - }; self.account.execute(vec! [__call]) + ("update_state"), calldata : __calldata, + }; self.account.execute_v1(vec! [__call]) + } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub + fn + upgrade_getcall(& self, new_class_hash : & cainome :: cairo_serde :: + ClassHash) -> starknet :: core :: types :: Call + { + use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! + []; + __calldata.extend(cainome :: cairo_serde :: ClassHash :: + cairo_serialize(new_class_hash)); starknet :: core :: types :: Call + { + to : self.address, selector : starknet :: macros :: selector! + ("upgrade"), calldata : __calldata, + } + } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub + fn upgrade(& self, new_class_hash : & cainome :: cairo_serde :: ClassHash) + -> starknet :: accounts :: ExecutionV1 < A > + { + use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! + []; + __calldata.extend(cainome :: cairo_serde :: ClassHash :: + cairo_serialize(new_class_hash)); let __call = starknet :: core :: + types :: Call + { + to : self.address, selector : starknet :: macros :: selector! + ("upgrade"), calldata : __calldata, + }; self.account.execute_v1(vec! [__call]) } } impl < P : starknet :: providers :: Provider + Sync > AppChainReader < P > { #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub fn - get_facts_registry(& self,) -> cainome :: cairo_serde :: call :: FCall < - P, cainome :: cairo_serde :: ContractAddress > + appchain_to_sn_messages(& self, message_hash : & starknet :: core :: types + :: Felt) -> cainome :: cairo_serde :: call :: FCall < P, + MessageToStarknetStatus > { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! - []; let __call = starknet :: core :: types :: FunctionCall + []; + __calldata.extend(starknet :: core :: types :: Felt :: + cairo_serialize(message_hash)); let __call = starknet :: core :: types + :: FunctionCall { contract_address : self.address, entry_point_selector : starknet - :: macros :: selector! ("get_facts_registry"), calldata : + :: macros :: selector! ("appchain_to_sn_messages"), calldata : __calldata, }; cainome :: cairo_serde :: call :: FCall :: new(__call, self.provider(),) } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub - fn - sn_to_appchain_messages(& self, message_hash : & starknet :: core :: types - :: FieldElement) -> cainome :: cairo_serde :: call :: FCall < P, - MessageToAppchainStatus > + fn get_facts_registry(& self,) -> cainome :: cairo_serde :: call :: FCall + < P, cainome :: cairo_serde :: ContractAddress > { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! - []; - __calldata.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(message_hash)); let __call = starknet :: core :: types - :: FunctionCall + []; let __call = starknet :: core :: types :: FunctionCall { contract_address : self.address, entry_point_selector : starknet - :: macros :: selector! ("sn_to_appchain_messages"), calldata : + :: macros :: selector! ("get_facts_registry"), calldata : __calldata, }; cainome :: cairo_serde :: call :: FCall :: new(__call, self.provider(),) } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub - fn - appchain_to_sn_messages(& self, message_hash : & starknet :: core :: types - :: FieldElement) -> cainome :: cairo_serde :: call :: FCall < P, - MessageToStarknetStatus > + fn get_program_info(& self,) -> cainome :: cairo_serde :: call :: FCall < + P, (starknet :: core :: types :: Felt, starknet :: core :: types :: Felt) + > { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! - []; - __calldata.extend(starknet :: core :: types :: FieldElement :: - cairo_serialize(message_hash)); let __call = starknet :: core :: types - :: FunctionCall + []; let __call = starknet :: core :: types :: FunctionCall { contract_address : self.address, entry_point_selector : starknet - :: macros :: selector! ("appchain_to_sn_messages"), calldata : + :: macros :: selector! ("get_program_info"), calldata : __calldata, }; cainome :: cairo_serde :: call :: FCall :: new(__call, self.provider(),) } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub fn get_state(& self,) -> cainome :: cairo_serde :: call :: FCall < P, - (starknet :: core :: types :: FieldElement, starknet :: core :: types :: - FieldElement, starknet :: core :: types :: FieldElement) > + (starknet :: core :: types :: Felt, starknet :: core :: types :: Felt, + starknet :: core :: types :: Felt) > { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! []; let __call = starknet :: core :: types :: FunctionCall @@ -2580,16 +2700,19 @@ cainome :: cairo_serde :: CairoSerde for MessageToAppchainStatus }; cainome :: cairo_serde :: call :: FCall :: new(__call, self.provider(),) } #[allow(clippy :: ptr_arg)] #[allow(clippy :: too_many_arguments)] pub - fn get_program_info(& self,) -> cainome :: cairo_serde :: call :: FCall < - P, - (starknet :: core :: types :: FieldElement, starknet :: core :: types :: - FieldElement) > + fn + sn_to_appchain_messages(& self, message_hash : & starknet :: core :: types + :: Felt) -> cainome :: cairo_serde :: call :: FCall < P, + MessageToAppchainStatus > { use cainome :: cairo_serde :: CairoSerde; let mut __calldata = vec! - []; let __call = starknet :: core :: types :: FunctionCall + []; + __calldata.extend(starknet :: core :: types :: Felt :: + cairo_serialize(message_hash)); let __call = starknet :: core :: types + :: FunctionCall { contract_address : self.address, entry_point_selector : starknet - :: macros :: selector! ("get_program_info"), calldata : + :: macros :: selector! ("sn_to_appchain_messages"), calldata : __calldata, }; cainome :: cairo_serde :: call :: FCall :: new(__call, self.provider(),) diff --git a/bindings/src/lib.rs b/bindings/src/lib.rs index 4f0835f..89070d6 100644 --- a/bindings/src/lib.rs +++ b/bindings/src/lib.rs @@ -3,5 +3,6 @@ use cainome::rs::abigen; abigen!( AppChain, "../target/dev/piltover_appchain.contract_class.json", - output_path("src/bindings.rs") + output_path("src/bindings.rs"), + derives(Debug, PartialEq, Eq, Clone, Copy) ); diff --git a/src/appchain.cairo b/src/appchain.cairo index 47e3d73..2b1d5cf 100644 --- a/src/appchain.cairo +++ b/src/appchain.cairo @@ -211,7 +211,7 @@ mod appchain { impl UpgradeableImpl of IUpgradeable { fn upgrade(ref self: ContractState, new_class_hash: ClassHash) { self.ownable.assert_only_owner(); - self.upgradeable._upgrade(new_class_hash); + self.upgradeable.upgrade(new_class_hash); } } } diff --git a/src/components/onchain_data_fact_tree_encoder.cairo b/src/components/onchain_data_fact_tree_encoder.cairo index c0e4ae6..3af2efe 100644 --- a/src/components/onchain_data_fact_tree_encoder.cairo +++ b/src/components/onchain_data_fact_tree_encoder.cairo @@ -5,7 +5,8 @@ struct DataAvailabilityFact { } /// Encodes a GPS fact Merkle tree where the root has two children. -/// The left child contains the data we care about and the right child contains on-chain data for the fact. +/// The left child contains the data we care about and the right child contains on-chain data for +/// the fact. /// /// # Arguments /// diff --git a/src/config/component.cairo b/src/config/component.cairo index 5f04a95..8b8ad17 100644 --- a/src/config/component.cairo +++ b/src/config/component.cairo @@ -21,12 +21,13 @@ mod config_cpt { }; use piltover::config::interface::IConfig; use starknet::ContractAddress; + use starknet::storage::Map; use super::errors; #[storage] struct Storage { /// Appchain operators that are allowed to update the state. - operators: LegacyMap, + operators: Map, /// Program info (StarknetOS), with program hash and config hash. program_info: (felt252, felt252), /// Facts registry contract address. diff --git a/src/config/tests/test_config.cairo b/src/config/tests/test_config.cairo index 5d5e2eb..08e1aac 100644 --- a/src/config/tests/test_config.cairo +++ b/src/config/tests/test_config.cairo @@ -1,16 +1,16 @@ -use openzeppelin::tests::utils::constants as c; +use openzeppelin_testing::constants as c; use piltover::config::{ config_cpt, config_cpt::InternalTrait as ConfigInternal, IConfig, IConfigDispatcherTrait, IConfigDispatcher, config_mock }; use snforge_std as snf; -use snforge_std::{CheatTarget, ContractClassTrait}; +use snforge_std::ContractClassTrait; use starknet::ContractAddress; fn deploy_mock() -> IConfigDispatcher { - let contract = snf::declare('config_mock'); + let contract = snf::declare("config_mock").unwrap(); let calldata = array![c::OWNER().into()]; - let contract_address = contract.deploy(@calldata).unwrap(); + let (contract_address, _) = contract.deploy(@calldata).unwrap(); IConfigDispatcher { contract_address } } @@ -19,7 +19,7 @@ fn config_register_operator_ok() { let mock = deploy_mock(); assert(!mock.is_operator(c::OPERATOR()), 'expect not operator'); - snf::start_prank(CheatTarget::One(mock.contract_address), c::OWNER()); + snf::start_cheat_caller_address(mock.contract_address, c::OWNER()); mock.register_operator(c::OPERATOR()); assert(mock.is_operator(c::OPERATOR()), 'expect operator'); @@ -31,7 +31,7 @@ fn config_register_multiple_operators_ok() { assert(!mock.is_operator(c::OPERATOR()), 'expect not operator'); assert(!mock.is_operator(c::OTHER()), 'expect not operator'); - snf::start_prank(CheatTarget::One(mock.contract_address), c::OWNER()); + snf::start_cheat_caller_address(mock.contract_address, c::OWNER()); mock.register_operator(c::OPERATOR()); mock.register_operator(c::OTHER()); @@ -44,7 +44,7 @@ fn config_register_multiple_operators_ok() { fn config_unregister_operator_ok() { let mock = deploy_mock(); - snf::start_prank(CheatTarget::One(mock.contract_address), c::OWNER()); + snf::start_cheat_caller_address(mock.contract_address, c::OWNER()); mock.register_operator(c::OPERATOR()); assert(mock.is_operator(c::OPERATOR()), 'expect operator'); @@ -57,7 +57,7 @@ fn config_unregister_operator_ok() { fn config_unregister_multiple_operators_ok() { let mock = deploy_mock(); - snf::start_prank(CheatTarget::One(mock.contract_address), c::OWNER()); + snf::start_cheat_caller_address(mock.contract_address, c::OWNER()); mock.register_operator(c::OPERATOR()); mock.register_operator(c::OTHER()); @@ -85,7 +85,7 @@ fn config_set_operator_unauthorized() { fn config_set_program_info_ok() { let mock = deploy_mock(); - snf::start_prank(CheatTarget::One(mock.contract_address), c::OWNER()); + snf::start_cheat_caller_address(mock.contract_address, c::OWNER()); // Owner sets the info. mock.set_program_info(0x1, 0x2); @@ -94,7 +94,7 @@ fn config_set_program_info_ok() { mock.register_operator(c::OPERATOR()); // Operator can also set the program info. - snf::start_prank(CheatTarget::One(mock.contract_address), c::OPERATOR()); + snf::start_cheat_caller_address(mock.contract_address, c::OPERATOR()); mock.set_program_info(0x11, 0x22); assert(mock.get_program_info() == (0x11, 0x22), 'expect operator hashes'); @@ -105,7 +105,7 @@ fn config_set_program_info_ok() { fn config_set_program_info_unauthorized() { let mock = deploy_mock(); - snf::start_prank(CheatTarget::One(mock.contract_address), c::OPERATOR()); + snf::start_cheat_caller_address(mock.contract_address, c::OPERATOR()); mock.set_program_info(0x11, 0x22); } @@ -113,7 +113,7 @@ fn config_set_program_info_unauthorized() { fn config_set_facts_registry_ok() { let mock = deploy_mock(); - snf::start_prank(CheatTarget::One(mock.contract_address), c::OWNER()); + snf::start_cheat_caller_address(mock.contract_address, c::OWNER()); let facts_registry_address = starknet::contract_address_const::<0x123>(); @@ -124,7 +124,7 @@ fn config_set_facts_registry_ok() { mock.register_operator(c::OPERATOR()); // Operator can also set the program info. - snf::start_prank(CheatTarget::One(mock.contract_address), c::OPERATOR()); + snf::start_cheat_caller_address(mock.contract_address, c::OPERATOR()); mock.set_facts_registry(c::OTHER()); assert(mock.get_facts_registry() == c::OTHER(), 'expect other address'); @@ -138,6 +138,6 @@ fn config_set_facts_registry_unauthorized() { let facts_registry_address = starknet::contract_address_const::<0x123>(); // Other is not an operator. - snf::start_prank(CheatTarget::One(mock.contract_address), c::OTHER()); + snf::start_cheat_caller_address(mock.contract_address, c::OTHER()); mock.set_facts_registry(facts_registry_address); } diff --git a/src/messaging/component.cairo b/src/messaging/component.cairo index f689021..92758c0 100644 --- a/src/messaging/component.cairo +++ b/src/messaging/component.cairo @@ -51,6 +51,7 @@ mod messaging_cpt { types::{MessageToAppchainStatus, MessageToStarknetStatus, MessageHash, Nonce} }; use starknet::ContractAddress; + use starknet::storage::Map; use super::errors; #[storage] @@ -58,14 +59,14 @@ mod messaging_cpt { /// Cancellation delay in seconds for message from Starknet to Appchain. cancellation_delay_secs: u64, /// Ledger of messages from Starknet to Appchain that are being cancelled. - sn_to_appc_cancellations: LegacyMap::, + sn_to_appc_cancellations: Map::, /// The nonce for messages sent to the Appchain from Starknet. sn_to_appc_nonce: Nonce, /// Ledger of messages hashes sent from Starknet to the appchain. - sn_to_appc_messages: LegacyMap::, + sn_to_appc_messages: Map::, /// Ledger of messages hashes registered from the Appchain and a refcount /// associated to it to control messages consumption. - appc_to_sn_messages: LegacyMap::, + appc_to_sn_messages: Map::, } #[event] diff --git a/src/messaging/interface.cairo b/src/messaging/interface.cairo index 0be1460..ff8192e 100644 --- a/src/messaging/interface.cairo +++ b/src/messaging/interface.cairo @@ -15,7 +15,8 @@ trait IMessaging { /// # Arguments /// /// * `to_address` - Contract address to send the message to on the Appchain. - /// * `selector` - The `l1_handler` function selector of the contract on the Appchain to execute. + /// * `selector` - The `l1_handler` function selector of the contract on the Appchain to + /// execute. /// * `payload` - The message payload. /// /// # Returns @@ -42,28 +43,29 @@ trait IMessaging { ) -> MessageHash; /// Checks the status of message sent to the Appchain from Starknet - /// - /// + /// + /// /// # Arguments - /// + /// /// * `message_hash` - The hash of the message that was sent to the Appchain. - /// + /// /// # Returns - /// + /// /// Returns the Nonce used for the message with the given `msgHash`, /// or 0 if no message with such a hash is pending. fn sn_to_appchain_messages(self: @T, message_hash: felt252) -> MessageToAppchainStatus; /// Checks the status of message sent to the Starknet from the Appchain - /// - /// + /// + /// /// # Arguments - /// + /// /// * `message_hash` - The hash of the message that was sent to Starknet. - /// + /// /// # Returns - /// - /// Returns the count of messages with given `msg_hash` that are pending to be consumed on starknet, otherwise 0 + /// + /// Returns the count of messages with given `msg_hash` that are pending to be consumed on + /// starknet, otherwise 0 fn appchain_to_sn_messages(self: @T, message_hash: felt252) -> MessageToStarknetStatus; /// Starts the cancellation procedure for a message sent from @@ -76,7 +78,8 @@ trait IMessaging { /// # Arguments /// /// * `to_address` - Contract address to send the message to on the Appchain. - /// * `selector` - The `l1_handler` function selector of the contract on the Appchain to execute. + /// * `selector` - The `l1_handler` function selector of the contract on the Appchain to + /// execute. /// * `payload` - The message's payload. /// * `nonce` - The message's nonce. /// @@ -98,7 +101,8 @@ trait IMessaging { /// # Arguments /// /// * `to_address` - Contract address to send the message to on the Appchain. - /// * `selector` - The `l1_handler` function selector of the contract on the Appchain to execute. + /// * `selector` - The `l1_handler` function selector of the contract on the Appchain to + /// execute. /// * `payload` - The message's payload. /// * `nonce` - The message's nonce. /// diff --git a/src/messaging/tests/test_messaging.cairo b/src/messaging/tests/test_messaging.cairo index 2d96028..7dd1963 100644 --- a/src/messaging/tests/test_messaging.cairo +++ b/src/messaging/tests/test_messaging.cairo @@ -1,6 +1,6 @@ use core::array::ArrayTrait; use core::zeroable::Zeroable; -use openzeppelin::tests::utils::constants as c; +use openzeppelin_testing::constants as c; use piltover::messaging::{ messaging_cpt, messaging_cpt::InternalTrait as MessagingInternal, IMessaging, IMessagingDispatcherTrait, IMessagingDispatcher, messaging_mock, @@ -12,18 +12,16 @@ use piltover::messaging::{ output_process::{MessageToStarknet, MessageToAppchain}, hash, output_process, }; use snforge_std as snf; -use snforge_std::{ - CheatTarget, ContractClassTrait, SpyOn, EventSpy, cheatcodes::events::EventAssertions, -}; -use starknet::{ContractAddress, storage::StorageMemberAccessTrait}; +use snforge_std::{ContractClassTrait, EventSpy, EventSpyAssertionsTrait}; +use starknet::ContractAddress; /// Deploys the mock with a specific cancellation delay. fn deploy_mock_with_delay(cancellation_delay_secs: u64) -> (IMessagingDispatcher, EventSpy) { - let contract = snf::declare('messaging_mock'); + let contract = snf::declare("messaging_mock").unwrap(); let calldata = array![cancellation_delay_secs.into()]; - let contract_address = contract.deploy(@calldata).unwrap(); + let (contract_address, _) = contract.deploy(@calldata).unwrap(); - let mut spy = snf::spy_events(SpyOn::One(contract_address)); + let mut spy = snf::spy_events(); (IMessagingDispatcher { contract_address }, spy) } @@ -166,7 +164,7 @@ fn send_message_ok() { let selector = selector!("func1"); let payload = array![1, 2, 3]; - snf::start_prank(CheatTarget::One(mock.contract_address), from); + snf::start_cheat_caller_address(mock.contract_address, from); let (message_hash, nonce) = mock.send_message_to_appchain(to, selector, payload.span()); assert(message_hash.is_non_zero(), 'invalid message hash'); @@ -188,7 +186,7 @@ fn sn_to_appchain_messages_ok() { let selector = selector!("func1"); let payload = array![1, 2, 3]; - snf::start_prank(CheatTarget::One(mock.contract_address), from); + snf::start_cheat_caller_address(mock.contract_address, from); // Calculate the message_hash let message_hash = hash::compute_message_hash_sn_to_appc( @@ -200,7 +198,7 @@ fn sn_to_appchain_messages_ok() { 'Should not be pending before' ); - snf::start_prank(CheatTarget::One(from), from); + snf::start_cheat_caller_address(from, from); let (message_hash, nonce) = mock.send_message_to_appchain(to, selector, payload.span()); // Ensure the message is pending to consume @@ -226,7 +224,7 @@ fn start_cancellation_ok() { let selector = selector!("func1"); let payload = array![1, 2, 3]; - snf::start_prank(CheatTarget::One(mock.contract_address), from); + snf::start_cheat_caller_address(mock.contract_address, from); let (message_hash, nonce) = mock.send_message_to_appchain(to, selector, payload.span()); let message_hash_cancel = mock.start_message_cancellation(to, selector, payload.span(), nonce); @@ -285,15 +283,15 @@ fn cancel_message_ok() { let selector = selector!("func1"); let payload = array![1, 2, 3]; - snf::start_prank(CheatTarget::One(mock.contract_address), from); + snf::start_cheat_caller_address(mock.contract_address, from); let (message_hash, nonce) = mock.send_message_to_appchain(to, selector, payload.span()); // The block timestamp must not be 0 for the protocol to be valid. // This can't happen on-chain, but here it must be explicitely set greater than 0. - snf::start_warp(CheatTarget::One(mock.contract_address), 1); + snf::start_cheat_block_timestamp(mock.contract_address, 1); mock.start_message_cancellation(to, selector, payload.span(), nonce); - snf::start_warp(CheatTarget::One(mock.contract_address), delay_secs + 10); + snf::start_cheat_block_timestamp(mock.contract_address, delay_secs + 10); let message_hash_cancel = mock.cancel_message(to, selector, payload.span(), nonce); assert(message_hash_cancel == message_hash, 'invalid message hash'); @@ -343,12 +341,12 @@ fn cancel_message_cancellation_not_requested() { let selector = selector!("func1"); let payload = array![1, 2, 3]; - snf::start_prank(CheatTarget::One(mock.contract_address), from); + snf::start_cheat_caller_address(mock.contract_address, from); let (_message_hash, nonce) = mock.send_message_to_appchain(to, selector, payload.span()); // Don't start the cancellation. - snf::start_warp(CheatTarget::One(mock.contract_address), delay_secs + 10); + snf::start_cheat_block_timestamp(mock.contract_address, delay_secs + 10); mock.cancel_message(to, selector, payload.span(), nonce); } @@ -363,13 +361,13 @@ fn cancel_message_cancellation_not_allowed_yet() { let selector = selector!("func1"); let payload = array![1, 2, 3]; - snf::start_prank(CheatTarget::One(mock.contract_address), from); + snf::start_cheat_caller_address(mock.contract_address, from); let (_message_hash, nonce) = mock.send_message_to_appchain(to, selector, payload.span()); - snf::start_warp(CheatTarget::One(mock.contract_address), 1); + snf::start_cheat_block_timestamp(mock.contract_address, 1); mock.start_message_cancellation(to, selector, payload.span(), nonce); - snf::start_warp(CheatTarget::One(mock.contract_address), 5); + snf::start_cheat_block_timestamp(mock.contract_address, 5); mock.cancel_message(to, selector, payload.span(), nonce); } @@ -407,7 +405,7 @@ fn process_messages_to_appchain_ok() { let selector = selector!("func1"); let payload = array![1, 2, 3]; - snf::start_prank(CheatTarget::One(starknet::get_contract_address()), from); + snf::start_cheat_caller_address(starknet::get_contract_address(), from); let (_message_hash, _nonce) = mock.send_message_to_appchain(to, selector, payload.span()); let m = MessageToAppchain { @@ -450,7 +448,7 @@ fn consume_message_from_appchain_ok() { mock.process_messages_to_starknet(messages); // Ensure the caller address inside the mock function is correctly set. - snf::start_prank(CheatTarget::One(to), to); + snf::start_cheat_caller_address(to, to); mock.consume_message_from_appchain(from, payload); } @@ -472,7 +470,7 @@ fn appchain_to_sn_messages_ok() { mock.process_messages_to_starknet(messages); - // Ensure that message is available to consume + // Ensure that message is available to consume let count_after = mock.appchain_to_sn_messages(message_hash); assert(count_after == MessageToStarknetStatus::ReadyToConsume(1), 'message not be present'); } @@ -489,6 +487,6 @@ fn consume_message_from_appchain_invalid_to_consume() { // Don't process the messages to starknet. // Ensure the caller address inside the mock function is correctly set. - snf::start_prank(CheatTarget::One(to), to); + snf::start_cheat_caller_address(to, to); mock.consume_message_from_appchain(from, payload); } diff --git a/src/messaging/types.cairo b/src/messaging/types.cairo index 83dac37..2e7382d 100644 --- a/src/messaging/types.cairo +++ b/src/messaging/types.cairo @@ -1,13 +1,13 @@ pub type MessageHash = felt252; pub type Nonce = felt252; -#[derive(Serde, Drop, Eq, PartialEq)] +#[derive(Serde, Drop, PartialEq)] pub enum MessageToAppchainStatus { SealedOrNotSent, // sn->appc: The nonce is 0 for the message hash. Pending: Nonce, // sn->appc: The nonce > 0. } -#[derive(Serde, Drop, Eq, PartialEq)] +#[derive(Serde, Drop, PartialEq)] pub enum MessageToStarknetStatus { NothingToConsume, // appc->sn: the ref count is 0. ReadyToConsume: felt252 // appc->sn: the ref count > 0. diff --git a/src/state/component.cairo b/src/state/component.cairo index 76618a1..f345e81 100644 --- a/src/state/component.cairo +++ b/src/state/component.cairo @@ -38,7 +38,8 @@ mod state_cpt { let mut program_output = program_output; let program_output: ProgramOutput = Serde::deserialize(ref program_output).unwrap(); - // Check the blockNumber first as the error is less ambiguous then INVALID_PREVIOUS_ROOT. + // Check the blockNumber first as the error is less ambiguous then + // INVALID_PREVIOUS_ROOT. self.block_number.write(self.block_number.read() + 1); assert( self.block_number.read() == program_output.block_number, diff --git a/src/state/tests/test_state.cairo b/src/state/tests/test_state.cairo index 885701a..87a8fdb 100644 --- a/src/state/tests/test_state.cairo +++ b/src/state/tests/test_state.cairo @@ -1,17 +1,18 @@ +use core::result::ResultTrait; use piltover::state::{ state_cpt, state_cpt::InternalTrait as StateInternal, IState, IStateDispatcher, IStateDispatcherTrait, state_mock, }; use snforge_std as snf; -use snforge_std::{ContractClassTrait}; +use snforge_std::ContractClassTrait; /// Deploys the mock with a specific state. fn deploy_mock_with_state( state_root: felt252, block_number: felt252, block_hash: felt252, ) -> IStateDispatcher { - let contract = snf::declare('state_mock'); + let contract = snf::declare("state_mock").unwrap(); let calldata = array![state_root, block_number, block_hash]; - let contract_address = contract.deploy(@calldata).unwrap(); + let (contract_address, _) = contract.deploy(@calldata).unwrap(); IStateDispatcher { contract_address } } diff --git a/tests/test_appchain.cairo b/tests/test_appchain.cairo index 0def3e7..9d86212 100644 --- a/tests/test_appchain.cairo +++ b/tests/test_appchain.cairo @@ -1,6 +1,7 @@ +use core::result::ResultTrait; //! Appchain testing. //! -use openzeppelin::tests::utils::constants as c; +use openzeppelin_testing::constants as c; use piltover::appchain::appchain::{Event, LogStateUpdate, LogStateTransitionFact}; use piltover::config::{IConfig, IConfigDispatcherTrait, IConfigDispatcher}; use piltover::interface::{IAppchain, IAppchainDispatcherTrait, IAppchainDispatcher}; @@ -10,18 +11,16 @@ use piltover::mocks::{ }; // To change when Herodotus finishes implementing FactRegistry. use piltover::snos_output::ProgramOutput; use snforge_std as snf; -use snforge_std::{ - CheatTarget, ContractClassTrait, SpyOn, EventSpy, cheatcodes::events::EventAssertions, -}; -use starknet::{ContractAddress, storage::StorageMemberAccessTrait}; +use snforge_std::{ContractClassTrait, EventSpy, EventSpyAssertionsTrait}; +use starknet::ContractAddress; /// Deploys the appchain contract. fn deploy_with_owner(owner: felt252) -> (IAppchainDispatcher, EventSpy) { - let contract = snf::declare('appchain'); + let contract = snf::declare("appchain").unwrap(); let calldata = array![owner, 0, 0, 0]; - let contract_address = contract.deploy(@calldata).unwrap(); + let (contract_address, _) = contract.deploy(@calldata).unwrap(); - let mut spy = snf::spy_events(SpyOn::One(contract_address)); + let mut spy = snf::spy_events(); (IAppchainDispatcher { contract_address }, spy) } @@ -30,19 +29,19 @@ fn deploy_with_owner(owner: felt252) -> (IAppchainDispatcher, EventSpy) { fn deploy_with_owner_and_state( owner: felt252, state_root: felt252, block_number: felt252, block_hash: felt252, ) -> (IAppchainDispatcher, EventSpy) { - let contract = snf::declare('appchain'); + let contract = snf::declare("appchain").unwrap(); let calldata = array![owner, state_root, block_number, block_hash]; - let contract_address = contract.deploy(@calldata).unwrap(); + let (contract_address, _) = contract.deploy(@calldata).unwrap(); - let mut spy = snf::spy_events(SpyOn::One(contract_address)); + let mut spy = snf::spy_events(); (IAppchainDispatcher { contract_address }, spy) } /// Deploys the fact registry mock contract. fn deploy_fact_registry_mock() -> IFactRegistryMockDispatcher { - let contract = snf::declare('fact_registry_mock'); - let contract_address = contract.deploy(@array![]).unwrap(); + let contract = snf::declare("fact_registry_mock").unwrap(); + let (contract_address, _) = contract.deploy(@array![]).unwrap(); IFactRegistryMockDispatcher { contract_address } } @@ -123,7 +122,7 @@ fn appchain_owner_ok() { let iconfig = IConfigDispatcher { contract_address: appchain.contract_address }; - snf::start_prank(CheatTarget::One(appchain.contract_address), c::OWNER()); + snf::start_cheat_caller_address(appchain.contract_address, c::OWNER()); iconfig.set_program_info(0x11, 0x22); } @@ -169,7 +168,7 @@ fn update_state_ok() { ] .span(); - snf::start_prank(CheatTarget::One(appchain.contract_address), c::OWNER()); + snf::start_cheat_caller_address(appchain.contract_address, c::OWNER()); iconfig .set_program_info( program_hash: 0x11, @@ -184,7 +183,7 @@ fn update_state_ok() { appchain.contract_address, selector!("sn_to_appc_nonce"), array![1629170 - 1].span() ); - snf::start_prank(CheatTarget::One(appchain.contract_address), contract_sn); + snf::start_cheat_caller_address(appchain.contract_address, contract_sn); imsg.send_message_to_appchain(contract_appc, selector_appc, payload_sn_to_appc); // Updating the state will register the message to starknet ready to be consumed @@ -192,7 +191,7 @@ fn update_state_ok() { let output = get_state_update(); let onchain_data_hash = 0x0; let onchain_data_size: u256 = 0; - snf::start_prank(CheatTarget::One(appchain.contract_address), c::OWNER()); + snf::start_cheat_caller_address(appchain.contract_address, c::OWNER()); appchain.update_state(output, onchain_data_hash, onchain_data_size); let expected_log_state_update = LogStateUpdate { @@ -216,6 +215,6 @@ fn update_state_ok() { ] ); - snf::start_prank(CheatTarget::One(appchain.contract_address), contract_sn); + snf::start_cheat_caller_address(appchain.contract_address, contract_sn); imsg.consume_message_from_appchain(contract_appc, payload_appc_to_sn); }