diff --git a/Cargo.lock b/Cargo.lock index ef891b1e1..e9b2bd37e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.24.1" +version = "0.24.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5fb1d8e4442bd405fdfd1dacb42792696b0cf9cb15882e5d097b742a676d375" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" dependencies = [ "gimli", ] @@ -58,9 +58,9 @@ checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "alloy" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2683873c2744f6cd72d0db51bb74fee9ed310e0476a140bdc19e82b407d8a0a" +checksum = "8367891bf380210abb0d6aa30c5f85a9080cb4a066c4d5c5acadad630823751b" dependencies = [ "alloy-consensus", "alloy-core", @@ -76,10 +76,11 @@ dependencies = [ [[package]] name = "alloy-chains" -version = "0.1.31" +version = "0.1.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b68b94c159bcc2ca5f758b8663d7b00fc7c5e40569984595ddf2221b0f7f7f6e" +checksum = "742b81ecb16cc5e9c029d55257cc8d9d5f9409f6384b65d996e583ad62a8c831" dependencies = [ + "alloy-primitives", "num_enum", "strum", ] @@ -96,9 +97,9 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c28ddd17ffb7e4d66ef3a84e7b179072a9320cdc4b26c7f6f44cbf1081631b36" +checksum = "629b62e38d471cc15fea534eb7283d2f8a4e8bdb1811bcc5d66dda6cfce6fae1" dependencies = [ "alloy-eips", "alloy-primitives", @@ -110,9 +111,9 @@ dependencies = [ [[package]] name = "alloy-core" -version = "0.8.3" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88b095eb0533144b4497e84a9cc3e44a5c2e3754a3983c0376a55a2f9183a53e" +checksum = "a54c7158ea4a394bef220d82d8fdd412fb9b1ca2d6024db539070b7bc01b6401" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -131,9 +132,9 @@ dependencies = [ [[package]] name = "alloy-eip7702" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d319bb544ca6caeab58c39cea8921c55d924d4f68f2c60f24f914673f9a74a" +checksum = "ea59dc42102bc9a1905dc57901edc6dd48b9f38115df86c7d252acba70d71d04" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -142,9 +143,9 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f6c5c0a383f14519531cf58d8440e74f10b938e289f803af870be6f79223110" +checksum = "f923dd5fca5f67a43d81ed3ebad0880bd41f6dd0ada930030353ac356c54cd0f" dependencies = [ "alloy-eip2930", "alloy-eip7702", @@ -160,9 +161,9 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7111af869909275cffc5c84d16b6c892d6d512773e40cbe83187d0b9c5235e91" +checksum = "d3c717b5298fad078cd3a418335b266eba91b511383ca9bd497f742d5975d5ab" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -174,9 +175,9 @@ dependencies = [ [[package]] name = "alloy-network" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "342028392a2d5050b7b93dd32a0715d3b3b9ce30072ecb69a35dd4895c005495" +checksum = "fb3705ce7d8602132bcf5ac7a1dd293a42adc2f183abf5907c30ac535ceca049" dependencies = [ "alloy-consensus", "alloy-eips", @@ -195,9 +196,9 @@ dependencies = [ [[package]] name = "alloy-network-primitives" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6e66d78c049dcadd065a926a9f2d9a9b2b10981a7889449e694fac7bccd2c6f" +checksum = "94ad40869867ed2d9cd3842b1e800889e5b49e6b92da346e93862b4a741bedf3" dependencies = [ "alloy-eips", "alloy-primitives", @@ -207,31 +208,37 @@ dependencies = [ [[package]] name = "alloy-primitives" -version = "0.8.3" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "411aff151f2a73124ee473708e82ed51b2535f68928b6a1caa8bc1246ae6f7cd" +checksum = "38f35429a652765189c1c5092870d8360ee7b7769b09b06d89ebaefd34676446" dependencies = [ "alloy-rlp", "bytes", "cfg-if", "const-hex", "derive_more", + "foldhash", + "hashbrown 0.15.0", "hex-literal", + "indexmap", "itoa", "k256", "keccak-asm", + "paste", "proptest", "rand", "ruint", + "rustc-hash", "serde", + "sha3", "tiny-keccak", ] [[package]] name = "alloy-provider" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79f14ccc2a3c575cb17b1b4af8c772cf9b5b93b7ce7047d6640e53954abb558d" +checksum = "927f708dd457ed63420400ee5f06945df9632d5d101851952056840426a10dc5" dependencies = [ "alloy-chains", "alloy-consensus", @@ -281,14 +288,14 @@ checksum = "4d0f2d905ebd295e7effec65e5f6868d153936130ae718352771de3e7d03c75c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] name = "alloy-rpc-client" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc79aeca84abb122a2fffbc1c91fdf958dca5c95be3875977bc99672bde0027" +checksum = "7d82952dca71173813d4e5733e2c986d8b04aea9e0f3b0a576664c232ad050a5" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -307,9 +314,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22045187a5ebf5b2af3f8b6831b66735b6556c5750ec5790aeeb45935260c1c2" +checksum = "64333d639f2a0cf73491813c629a405744e16343a4bc5640931be707c345ecc5" dependencies = [ "alloy-rpc-types-eth", "alloy-rpc-types-trace", @@ -319,9 +326,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "238f494727ff861a803bd73b1274ef788a615bf8f8c4bfada4e6df42afa275d2" +checksum = "83aa984386deda02482660aa31cb8ca1e63d533f1c31a52d7d181ac5ec68e9b8" dependencies = [ "alloy-consensus", "alloy-eips", @@ -332,7 +339,7 @@ dependencies = [ "alloy-sol-types", "cfg-if", "derive_more", - "hashbrown", + "hashbrown 0.14.5", "itertools 0.13.0", "serde", "serde_json", @@ -340,9 +347,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-trace" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64ca08b0ccc0861055ceb83a1db009c4c8a7f52a259e7cda7ca6ca36ec2b5ce8" +checksum = "98db35cd42c90b484377e6bc44d95377a7a38a5ebee996e67754ac0446d542ab" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", @@ -354,9 +361,9 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b95b6f024a558593dd3b8628af03f7df2ca50e4c56839293ad0a7546e471db0" +checksum = "731f75ec5d383107fd745d781619bd9cedf145836c51ecb991623d41278e71fa" dependencies = [ "alloy-primitives", "serde", @@ -365,9 +372,9 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da64740ff0518606c514eb0e03dd0a1daa8ff94d6d491a626fd8e50efd6c4f18" +checksum = "307324cca94354cd654d6713629f0383ec037e1ff9e3e3d547212471209860c0" dependencies = [ "alloy-primitives", "async-trait", @@ -379,23 +386,23 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.8.3" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0458ccb02a564228fcd76efb8eb5a520521a8347becde37b402afec9a1b83859" +checksum = "3b2395336745358cc47207442127c47c63801a7065ecc0aa928da844f8bb5576" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] name = "alloy-sol-macro-expander" -version = "0.8.3" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bc65475025fc1e84bf86fc840f04f63fcccdcf3cf12053c99918e4054dfbc69" +checksum = "9ed5047c9a241df94327879c2b0729155b58b941eae7805a7ada2e19436e6b39" dependencies = [ "alloy-sol-macro-input", "const-hex", @@ -404,31 +411,31 @@ dependencies = [ "proc-macro-error2", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "syn-solidity", "tiny-keccak", ] [[package]] name = "alloy-sol-macro-input" -version = "0.8.3" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ed10f0715a0b69fde3236ff3b9ae5f6f7c97db5a387747100070d3016b9266b" +checksum = "5dee02a81f529c415082235129f0df8b8e60aa1601b9c9298ffe54d75f57210b" dependencies = [ "const-hex", "dunce", "heck", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "syn-solidity", ] [[package]] name = "alloy-sol-types" -version = "0.8.3" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1eb88e4da0a1b697ed6a9f811fdba223cf4d5c21410804fd1707836af73a462b" +checksum = "c2841af22d99e2c0f82a78fe107b6481be3dd20b89bfb067290092794734343a" dependencies = [ "alloy-primitives", "alloy-sol-macro", @@ -437,9 +444,9 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c7a669caa427abe8802184c8776f5103302f9337bb30a5b36bdebc332946c14" +checksum = "33616b2edf7454302a1d48084db185e52c309f73f6c10be99b0fe39354b3f1e9" dependencies = [ "alloy-json-rpc", "base64", @@ -456,9 +463,9 @@ dependencies = [ [[package]] name = "alloy-transport-http" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4433ffa97aab6ae643de81c7bde9a2f043496f27368a607405a5c78a610caf74" +checksum = "a944f5310c690b62bbb3e7e5ce34527cbd36b2d18532a797af123271ce595a49" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -471,9 +478,9 @@ dependencies = [ [[package]] name = "amq-protocol" -version = "7.2.1" +version = "7.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f0234884b3641db74d22ccc20fc2594db5f23d7d41ade5c93d7ee33d200960c" +checksum = "e3a41c091e49edfcc098b4f90d4d7706a8cf9158034e84ebfee7ff346092f67c" dependencies = [ "amq-protocol-tcp", "amq-protocol-types", @@ -485,9 +492,9 @@ dependencies = [ [[package]] name = "amq-protocol-tcp" -version = "7.2.1" +version = "7.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "265dca43d9dbb3d5bbb0b3ef1b0cd9044ce3aa5d697d5b66cde974d1f6063f09" +checksum = "3ed7a4a662472f88823ed2fc81babb0b00562f2c54284e3e7bffc02b6df649bf" dependencies = [ "amq-protocol-uri", "tcp-stream", @@ -496,9 +503,9 @@ dependencies = [ [[package]] name = "amq-protocol-types" -version = "7.2.1" +version = "7.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c7412353b58923fa012feb9a64ccc0c811747babee2e5a2fd63eb102dc8054c3" +checksum = "bd6484fdc918c1b6e2ae8eda2914d19a5873e1975f93ad8d33d6a24d1d98df05" dependencies = [ "cookie-factory", "nom", @@ -508,9 +515,9 @@ dependencies = [ [[package]] name = "amq-protocol-uri" -version = "7.2.1" +version = "7.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2be91352c805d5704784e079117d5291fd5bf2569add53c914ebce6d1a795d33" +checksum = "7f7f2da69e0e1182765bf33407cd8a843f20791b5af2b57a2645818c4776c56c" dependencies = [ "amq-protocol-types", "percent-encoding", @@ -735,7 +742,7 @@ checksum = "965c2d33e53cb6b267e148a4cb0760bc01f4904c1cd4bb4002a085bb016d1490" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "synstructure", ] @@ -747,7 +754,7 @@ checksum = "7b18050c2cd6fe86c3a76584ef5e0baf286d038cda203eb6223df2cc413565f7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -771,7 +778,7 @@ dependencies = [ "proc-macro2", "quote", "rustc_version 0.4.1", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -816,9 +823,9 @@ dependencies = [ [[package]] name = "async-global-executor-trait" -version = "2.1.0" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33dd14c5a15affd2abcff50d84efd4009ada28a860f01c14f9d654f3e81b3f75" +checksum = "80f19936c1a84fb48ceb8899b642d2a72572587d1021cc561bfb24de9f33ee89" dependencies = [ "async-global-executor", "async-trait", @@ -898,9 +905,9 @@ dependencies = [ [[package]] name = "async-stream" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd56dd203fef61ac097dd65721a419ddccb106b2d2b70ba60a6b529f03961a51" +checksum = "0b5a71a6f37880a80d1d7f19efd781e4b5de42c88f0722cc13bcb6cc2cfe8476" dependencies = [ "async-stream-impl", "futures-core", @@ -909,13 +916,13 @@ dependencies = [ [[package]] name = "async-stream-impl" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" +checksum = "c7c24de15d275a1ecfd47a380fb4d5ec9bfe0933f309ed5e705b775596a3574d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -926,13 +933,13 @@ checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" [[package]] name = "async-trait" -version = "0.1.82" +version = "0.1.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a27b8a3a6e1a44fa4c8baf1f653e4172e81486d4941f2237e20dc2d0cf4ddff1" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -958,20 +965,20 @@ checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] name = "autocfg" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" [[package]] name = "axum" -version = "0.7.5" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a6c9af12842a67734c9a2e355436e5d03b22383ed60cf13cd0c18fbfe3dcbcf" +checksum = "504e3947307ac8326a5437504c517c4b56716c9d98fac0028c2acc7ca47d70ae" dependencies = [ "async-trait", "axum-core", @@ -995,7 +1002,7 @@ dependencies = [ "serde_urlencoded", "sync_wrapper 1.0.1", "tokio", - "tower 0.4.13", + "tower 0.5.1", "tower-layer", "tower-service", "tracing", @@ -1003,9 +1010,9 @@ dependencies = [ [[package]] name = "axum-core" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a15c63fd72d41492dc4f497196f5da1fb04fb7529e631d73630d1b491e47a2e3" +checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" dependencies = [ "async-trait", "bytes", @@ -1016,7 +1023,7 @@ dependencies = [ "mime", "pin-project-lite", "rustversion", - "sync_wrapper 0.1.2", + "sync_wrapper 1.0.1", "tower-layer", "tower-service", "tracing", @@ -1051,6 +1058,15 @@ dependencies = [ "windows-targets 0.52.6", ] +[[package]] +name = "backtrace-ext" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537beee3be4a18fb023b570f80e3ae28003db9167a751266b259926e25539d50" +dependencies = [ + "backtrace", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -1180,9 +1196,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.7.1" +version = "1.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" +checksum = "428d9aa8fbc0670b7b8d6030a7fadd0f86151cae55e4dbbece15f3780a3dfaf3" dependencies = [ "serde", ] @@ -1225,9 +1241,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.18" +version = "1.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476" +checksum = "b16803a61b81d9eabb7eae2588776c4c1e584b738ede45fdbb4c972cec1e9945" dependencies = [ "jobserver", "libc", @@ -1279,9 +1295,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.17" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e5a21b8495e732f1b3c364c9949b201ca7bae518c502c80256c96ad79eaf6ac" +checksum = "b97f376d85a664d5837dbae44bf546e6477a679ff6610010f17276f686d867e8" dependencies = [ "clap_builder", "clap_derive", @@ -1289,9 +1305,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.17" +version = "4.5.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cf2dd12af7a047ad9d6da2b6b249759a22a7abc0f474c1dae1777afa4b21a73" +checksum = "19bc80abd44e4bed93ca373a0704ccbd1b710dc5749406201bb018272808dc54" dependencies = [ "anstream", "anstyle", @@ -1301,14 +1317,14 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.13" +version = "4.5.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +checksum = "4ac6a0c7b1a9e9a5186361f67dfa1b88213572f427fb9ab038efb2bd8c582dab" dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1366,9 +1382,9 @@ checksum = "0b396d1f76d455557e1218ec8066ae14bba60b4b36ecd55577ba979f5db7ecaa" [[package]] name = "const-hex" -version = "1.12.0" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94fb8a24a26d37e1ffd45343323dc9fe6654ceea44c12f2fcb3d7ac29e610bc6" +checksum = "0121754e84117e65f9d90648ee6aa4882a6e63110307ab73967a4c5e7e69e586" dependencies = [ "cfg-if", "cpufeatures", @@ -1478,9 +1494,9 @@ dependencies = [ [[package]] name = "critical-section" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f64009896348fc5af4222e9cf7d7d82a95a256c634ebcf61c53e4ea461422242" +checksum = "790eea4361631c5e7d22598ecd5723ff611904e3344ce8720784c93e3d83d40b" [[package]] name = "crossbeam" @@ -1597,7 +1613,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1608,7 +1624,7 @@ checksum = "d336a2a514f6ccccaa3e09b02d41d35330c07ddf03a62165fcec10bb561c7806" dependencies = [ "darling_core", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1618,7 +1634,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "978747c1d849a7d2ee5e8adc0159961c48fb7e5db2f06af6723b80123bb53856" dependencies = [ "cfg-if", - "hashbrown", + "hashbrown 0.14.5", "lock_api", "once_cell", "parking_lot_core", @@ -1632,7 +1648,7 @@ checksum = "5041cc499144891f3790297212f32a74fb938e5136a14943f338ef9e0ae276cf" dependencies = [ "cfg-if", "crossbeam-utils", - "hashbrown", + "hashbrown 0.14.5", "lock_api", "once_cell", "parking_lot_core", @@ -1679,7 +1695,7 @@ checksum = "8034092389675178f570469e6c3b0465d3d30b4505c294a6550db47f3c17ad18" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1702,35 +1718,55 @@ dependencies = [ "syn 1.0.109", ] +[[package]] +name = "derive-quote-to-tokens" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "733607c1694b00bf49f2d3a0764549feffe761d0ee59a022ae591cf0617ed013" +dependencies = [ + "syn-helpers", +] + +[[package]] +name = "derive-syn-parse" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d65d7ce8132b7c0e54497a4d9a55a1c2a0912a0d786cf894472ba818fba45762" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + [[package]] name = "derive_builder" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd33f37ee6a119146a1781d3356a7c26028f83d779b2e04ecd45fdc75c76877b" +checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" dependencies = [ "derive_builder_macro", ] [[package]] name = "derive_builder_core" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7431fa049613920234f22c47fdc33e6cf3ee83067091ea4277a3f8c4587aae38" +checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] name = "derive_builder_macro" -version = "0.20.1" +version = "0.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4abae7035bf79b9877b779505d8cf3749285b80c43941eda66604841889451dc" +checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" dependencies = [ "derive_builder_core", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1750,7 +1786,7 @@ checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "unicode-xid", ] @@ -1819,7 +1855,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1860,6 +1896,12 @@ version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" +[[package]] +name = "either_n" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c91ae510829160d5cfb19eb4ae7b6e01d44b767ca8f727c6cee936e53cc9ae5" + [[package]] name = "elliptic-curve" version = "0.13.8" @@ -1900,7 +1942,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -1968,7 +2010,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ec3aeb0284b473041df2419a28e3cdf0c64a78d2b9511af4b6e40bad3964b172" dependencies = [ "ethereum-types", - "hashbrown", + "hashbrown 0.14.5", "keccak-hash 0.10.0", "log", "parking_lot", @@ -2035,14 +2077,19 @@ version = "0.4.0" dependencies = [ "anyhow", "bytes", + "camino", "criterion", + "derive-quote-to-tokens", + "derive-syn-parse", "env_logger 0.11.5", "ethereum-types", - "hashbrown", + "glob", + "hashbrown 0.14.5", "hex", "hex-literal", "itertools 0.13.0", "keccak-hash 0.10.0", + "libtest-mimic", "line-index", "log", "mpt_trie", @@ -2054,6 +2101,9 @@ dependencies = [ "plonky2", "plonky2_maybe_rayon 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "plonky2_util", + "pretty_assertions", + "proc-macro2", + "quote", "rand", "rand_chacha", "ripemd", @@ -2066,6 +2116,8 @@ dependencies = [ "smt_trie", "starky", "static_assertions", + "syn 2.0.79", + "syn-miette", "thiserror", "tiny-keccak", "tokio", @@ -2078,9 +2130,9 @@ dependencies = [ [[package]] name = "executor-trait" -version = "2.1.0" +version = "2.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a1052dd43212a7777ec6a69b117da52f5e52f07aec47d00c1a2b33b85d06b08" +checksum = "13c39dff9342e4e0e16ce96be751eb21a94e94a87bb2f6e63ad1961c2ce109bf" dependencies = [ "async-trait", ] @@ -2165,6 +2217,12 @@ version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" +[[package]] +name = "foldhash" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" + [[package]] name = "foreign-types" version = "0.3.2" @@ -2197,9 +2255,9 @@ checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -2212,9 +2270,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -2222,15 +2280,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -2239,9 +2297,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-lite" @@ -2273,32 +2331,32 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", @@ -2342,23 +2400,11 @@ dependencies = [ "wasm-bindgen", ] -[[package]] -name = "getset" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f636605b743120a8d32ed92fc27b6cde1a769f8f936c065151eb66f88ded513c" -dependencies = [ - "proc-macro-error2", - "proc-macro2", - "quote", - "syn 2.0.77", -] - [[package]] name = "gimli" -version = "0.31.0" +version = "0.31.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32085ea23f3234fc7846555e85283ba4de91e21016dc0455a16286d87a292d64" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" [[package]] name = "git2" @@ -2421,6 +2467,18 @@ dependencies = [ "serde", ] +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", + "serde", +] + [[package]] name = "heapless" version = "0.7.17" @@ -2513,9 +2571,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.9.4" +version = "1.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" [[package]] name = "httpdate" @@ -2531,9 +2589,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" dependencies = [ "bytes", "futures-channel", @@ -2567,9 +2625,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da62f120a8a37763efb0cf8fdf264b884c7b8b9ac8660b900c8661030c00e6ba" +checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" dependencies = [ "bytes", "futures-channel", @@ -2580,7 +2638,6 @@ dependencies = [ "pin-project-lite", "socket2 0.5.7", "tokio", - "tower 0.4.13", "tower-service", "tracing", ] @@ -2652,12 +2709,13 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68b900aa2f7301e21c36462b170ee99994de34dff39a4a6a528e80e7376d07e5" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" dependencies = [ "equivalent", - "hashbrown", + "hashbrown 0.15.0", + "serde", ] [[package]] @@ -2701,9 +2759,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.10.0" +version = "2.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "187674a687eed5fe42285b40c6291f9a01517d415fad1c3cbc6a9f778af7fcd4" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" [[package]] name = "is-terminal" @@ -2716,6 +2774,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "is_ci" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7655c9839580ee829dfacba1d1278c2b7883e50a277ff7541299489d6bdfdc45" + [[package]] name = "is_terminal_polyfill" version = "1.70.1" @@ -2786,18 +2850,18 @@ dependencies = [ [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" dependencies = [ "wasm-bindgen", ] [[package]] name = "k256" -version = "0.13.3" +version = "0.13.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "956ff9b67e26e1a6a866cb758f12c6f8746208489e3e4a4b5580802f2f0a587b" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" dependencies = [ "cfg-if", "ecdsa", @@ -2806,6 +2870,15 @@ dependencies = [ "sha2", ] +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + [[package]] name = "keccak-asm" version = "0.1.4" @@ -2866,9 +2939,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.158" +version = "0.2.161" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" [[package]] name = "libgit2-sys" @@ -2949,7 +3022,7 @@ checksum = "cb26336e6dc7cc76e7927d2c9e7e3bb376d7af65a6f56a0b16c47d18a9b1abc5" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -2983,11 +3056,11 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "lru" -version = "0.12.4" +version = "0.12.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ee39891760e7d94734f6f63fedc29a2e4a152f836120753a72503f09fcf904" +checksum = "234cf4f4a04dc1f57e24b96cc0cd600cf2af460d4161ac5ecdd0af8e1f3b2a38" dependencies = [ - "hashbrown", + "hashbrown 0.15.0", ] [[package]] @@ -3024,6 +3097,37 @@ version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" +[[package]] +name = "miette" +version = "7.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4edc8853320c2a0dab800fbda86253c8938f6ea88510dc92c5f1ed20e794afc1" +dependencies = [ + "backtrace", + "backtrace-ext", + "cfg-if", + "miette-derive", + "owo-colors", + "supports-color", + "supports-hyperlinks", + "supports-unicode", + "terminal_size", + "textwrap", + "thiserror", + "unicode-width", +] + +[[package]] +name = "miette-derive" +version = "7.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcf09caffaac8068c346b6df2a7fc27a177fd20b39421a39ce0a211bde679a6c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.79", +] + [[package]] name = "mime" version = "0.3.17" @@ -3237,7 +3341,7 @@ checksum = "af1844ef2428cc3e1cb900be36181049ef3d3193c63e43026cfe202983b27a56" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -3260,9 +3364,9 @@ dependencies = [ [[package]] name = "object" -version = "0.36.4" +version = "0.36.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "084f1a5821ac4c651660a94a7153d27ac9d8a53736203f58b31945ded098070a" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" dependencies = [ "memchr", ] @@ -3278,9 +3382,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.20.0" +version = "1.20.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33ea5043e58958ee56f3e15a90aee535795cd7dfd319846288d93c5b57d85cbe" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" [[package]] name = "oorandom" @@ -3290,9 +3394,9 @@ checksum = "b410bbe7e14ab526a0e86877eb47c6996a2bd7746f027ba551028c925390e4e9" [[package]] name = "openssl" -version = "0.10.66" +version = "0.10.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" +checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" dependencies = [ "bitflags 2.6.0", "cfg-if", @@ -3311,7 +3415,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -3322,9 +3426,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.103" +version = "0.9.104" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" dependencies = [ "cc", "libc", @@ -3344,6 +3448,12 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" +[[package]] +name = "owo-colors" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb37767f6569cd834a413442455e0f066d0d522de8630436e2a1761d9726ba56" + [[package]] name = "p12-keystore" version = "0.1.3" @@ -3406,7 +3516,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0bde85d55c108d4eef3404b4c88d1982a270dc11146a085f4f45c1548b4d2b4c" dependencies = [ "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -3497,9 +3607,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.12" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c73c26c01b8c87956cea613c907c9d6ecffd8d18a2a5908e5de0adfaa185cea" +checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" dependencies = [ "memchr", "thiserror", @@ -3508,9 +3618,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.12" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "664d22978e2815783adbdd2c588b455b1bd625299ce36b2a99881ac9627e6d8d" +checksum = "d214365f632b123a47fd913301e14c946c61d1c183ee245fa76eb752e59a02dd" dependencies = [ "pest", "pest_generator", @@ -3518,22 +3628,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.12" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2d5487022d5d33f4c30d91c22afa240ce2a644e87fe08caad974d4eab6badbe" +checksum = "eb55586734301717aea2ac313f50b2eb8f60d2fc3dc01d190eefa2e625f60c4e" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] name = "pest_meta" -version = "2.7.12" +version = "2.7.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0091754bbd0ea592c4deb3a122ce8ecbb0753b738aa82bc055fcc2eccc8d8174" +checksum = "b75da2a70cf4d9cb76833c990ac9cd3923c9a8905a8929789ce347c84564d03d" dependencies = [ "once_cell", "pest", @@ -3542,22 +3652,22 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.1.5" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" +checksum = "baf123a161dde1e524adf36f90bc5d8d3462824a9c43553ad07a8183161189ec" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.5" +version = "1.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" +checksum = "a4502d8515ca9f32f1fb543d987f63d95a14934883db45bdb48060b6b69257f8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -3637,9 +3747,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d231b230927b5e4ad203db57bbcbee2802f6bce620b1e4a9024a07d94e2907ec" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" [[package]] name = "plonky2" @@ -3649,7 +3759,7 @@ dependencies = [ "ahash", "anyhow", "getrandom", - "hashbrown", + "hashbrown 0.14.5", "itertools 0.11.0", "keccak-hash 0.8.0", "log", @@ -3789,6 +3899,16 @@ dependencies = [ "zerocopy", ] +[[package]] +name = "pretty_assertions" +version = "1.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ae130e2f271fbc2ac3a40fb1d07180839cdbbe443c7a27e1e3c13c5cac0116d" +dependencies = [ + "diff", + "yansi", +] + [[package]] name = "pretty_env_logger" version = "0.5.0" @@ -3850,14 +3970,14 @@ dependencies = [ "proc-macro-error-attr2", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.88" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "7c3a7fc5db1e57d5a779a352c8cdb57b29aa4c40cc69c3a68a7fedc815fbf2f9" dependencies = [ "unicode-ident", ] @@ -3876,7 +3996,7 @@ dependencies = [ "rand", "rand_chacha", "rand_xorshift", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", "rusty-fork", "tempfile", "unarray", @@ -3912,6 +4032,7 @@ dependencies = [ "libc", "rand_chacha", "rand_core", + "serde", ] [[package]] @@ -3984,9 +4105,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.4" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0884ad60e090bf1345b93da0a5de8923c93884cd03f40dfcfddd3b4bee661853" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" dependencies = [ "bitflags 2.6.0", ] @@ -4004,14 +4125,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.6" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "38200e5ee88914975b69f657f0801b6f6dccafd44fd9326302a4aaeecfacb1d8" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", + "regex-automata 0.4.8", + "regex-syntax 0.8.5", ] [[package]] @@ -4025,13 +4146,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", ] [[package]] @@ -4042,15 +4163,15 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.12.7" +version = "0.12.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" +checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b" dependencies = [ "base64", "bytes", @@ -4176,6 +4297,12 @@ version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + [[package]] name = "rustc-hex" version = "2.1.0" @@ -4238,9 +4365,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.13" +version = "0.23.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2dabaac7466917e566adb06783a81ca48944c6898a1b08b9374106dd671f4c8" +checksum = "5fbb44d7acc4e873d613422379f69f237a1b141928c02f6bc6ccfddddc2d7993" dependencies = [ "once_cell", "ring", @@ -4278,19 +4405,18 @@ dependencies = [ [[package]] name = "rustls-pemfile" -version = "2.1.3" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" dependencies = [ - "base64", "rustls-pki-types", ] [[package]] name = "rustls-pki-types" -version = "1.8.0" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" [[package]] name = "rustls-webpki" @@ -4305,9 +4431,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" [[package]] name = "rusty-fork" @@ -4347,9 +4473,9 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.24" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9aaafd5a2b6e3d657ff009d82fbd630b6bd54dd4eb06f21693925cdf80f9b8b" +checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" dependencies = [ "windows-sys 0.59.0", ] @@ -4400,9 +4526,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.1" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" +checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" dependencies = [ "core-foundation-sys", "libc", @@ -4458,14 +4584,14 @@ checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] name = "serde_json" -version = "1.0.128" +version = "1.0.129" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6ff5456707a1de34e7e37f2a6fd3d3f808c318259cbd01ab6377795054b483d8" +checksum = "6dbcf9b78a125ee667ae19388837dd12294b858d101fdd393cb9d5501ef09eb2" dependencies = [ "itoa", "memchr", @@ -4491,14 +4617,14 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] name = "serde_spanned" -version = "0.6.7" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" +checksum = "87607cb1398ed59d48732e575a4c28a7a8ebf2454b964fe3f224f2afc07909e1" dependencies = [ "serde", ] @@ -4537,6 +4663,16 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest 0.10.7", + "keccak", +] + [[package]] name = "sha3-asm" version = "0.1.4" @@ -4596,6 +4732,12 @@ version = "1.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" +[[package]] +name = "smawk" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" + [[package]] name = "smt_trie" version = "0.1.1" @@ -4665,7 +4807,7 @@ source = "git+https://github.com/0xPolygonZero/plonky2.git?rev=2488cdacd49ede157 dependencies = [ "ahash", "anyhow", - "hashbrown", + "hashbrown 0.14.5", "itertools 0.11.0", "log", "num-bigint", @@ -4706,7 +4848,7 @@ dependencies = [ "proc-macro2", "quote", "rustversion", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -4715,6 +4857,27 @@ version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" +[[package]] +name = "supports-color" +version = "3.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8775305acf21c96926c900ad056abeef436701108518cf890020387236ac5a77" +dependencies = [ + "is_ci", +] + +[[package]] +name = "supports-hyperlinks" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c0a1e5168041f5f3ff68ff7d95dcb9c8749df29f6e7e89ada40dd4c9de404ee" + +[[package]] +name = "supports-unicode" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7401a30af6cb5818bb64852270bb722533397edcfc7344954a38f420819ece2" + [[package]] name = "syn" version = "1.0.109" @@ -4728,25 +4891,48 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.77" +version = "2.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" +checksum = "89132cd0bf050864e1d38dc3bbc07a0eb8e7530af26344d3d2bbbef83499f590" dependencies = [ "proc-macro2", "quote", "unicode-ident", ] +[[package]] +name = "syn-helpers" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59c391dcee7e7a1efd7dc921922b97b4be54129a195b6baec95bb2a223203d9d" +dependencies = [ + "either_n", + "proc-macro2", + "quote", + "syn 2.0.79", +] + +[[package]] +name = "syn-miette" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd1a2bfae2df81406f8d21baa0253d34ddd0ddafcd1e7aa12aa24279bb76a24b" +dependencies = [ + "miette", + "proc-macro2", + "syn 2.0.79", +] + [[package]] name = "syn-solidity" -version = "0.8.3" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b95156f8b577cb59dc0b1df15c6f29a10afc5f8a7ac9786b0b5c68c19149278" +checksum = "ebfc1bfd06acc78f16d8fd3ef846bc222ee7002468d10a7dce8d703d6eab89a3" dependencies = [ "paste", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -4772,7 +4958,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -4795,9 +4981,9 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" dependencies = [ "cfg-if", "fastrand 2.1.1", @@ -4815,30 +5001,51 @@ dependencies = [ "winapi-util", ] +[[package]] +name = "terminal_size" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21bebf2b7c9e0a515f6e0f8c51dc0f8e4696391e6f1ff30379559f8365fb0df7" +dependencies = [ + "rustix 0.38.37", + "windows-sys 0.48.0", +] + [[package]] name = "text-size" version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f18aa187839b2bdb1ad2fa35ead8c4c2976b64e4363c386d45ac0f7ee85c9233" +[[package]] +name = "textwrap" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23d434d3f8967a09480fb04132ebe0a3e088c173e6d0ee7897abbdf4eab0f8b9" +dependencies = [ + "smawk", + "unicode-linebreak", + "unicode-width", +] + [[package]] name = "thiserror" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" +checksum = "d50af8abc119fb8bb6dbabcfa89656f46f84aa0ac7688088608076ad2b459a84" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.63" +version = "1.0.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" +checksum = "08904e7672f5eb876eaaf87e0ce17857500934f4981c4a0ab2b4aa98baac7fc3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -4947,9 +5154,9 @@ dependencies = [ [[package]] name = "tokio-executor-trait" -version = "2.1.1" +version = "2.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "802ccf58e108fe16561f35348fabe15ff38218968f033d587e399a84937533cc" +checksum = "96a1593beae7759f592e1100c5997fe9e9ebf4b5968062f1fbcd807989cd1b79" dependencies = [ "async-trait", "executor-trait", @@ -4964,7 +5171,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -5039,9 +5246,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.20" +version = "0.22.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" dependencies = [ "indexmap", "serde", @@ -5076,8 +5283,10 @@ dependencies = [ "futures-util", "pin-project-lite", "sync_wrapper 0.1.2", + "tokio", "tower-layer", "tower-service", + "tracing", ] [[package]] @@ -5117,7 +5326,7 @@ checksum = "84fd902d4e0b9a4b27f2f440108dc034e1758628a9b702f8ec61ad66355422fa" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -5193,7 +5402,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -5243,9 +5452,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "trybuild" -version = "1.0.99" +version = "1.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "207aa50d36c4be8d8c6ea829478be44a372c6a77669937bb39c698e52f1491e8" +checksum = "8923cde76a6329058a86f04d033f0945a2c6df8b94093512e4ab188b3e3a8950" dependencies = [ "glob", "serde", @@ -5273,9 +5482,9 @@ dependencies = [ [[package]] name = "ucd-trie" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed646292ffc8188ef8ea4d1e0e0150fb15a5c2e12ad9b8fc191ae7a8a7f3c4b9" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" [[package]] name = "uint" @@ -5297,9 +5506,9 @@ checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" [[package]] name = "unicode-bidi" -version = "0.3.15" +version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08f95100a766bf4f8f28f90d77e0a5461bbdb219042e7679bebe79004fed8d75" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" [[package]] name = "unicode-ident" @@ -5307,20 +5516,32 @@ version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" +[[package]] +name = "unicode-linebreak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b09c83c3c29d37506a3e260c08c03743a6bb66a9cd432c6934ab501a190571f" + [[package]] name = "unicode-normalization" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" dependencies = [ "tinyvec", ] +[[package]] +name = "unicode-width" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7dd6e30e90baa6f72411720665d41d89b9a3d039dc45b8faea1ddd07f617f6af" + [[package]] name = "unicode-xid" -version = "0.2.5" +version = "0.2.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "229730647fbc343e3a80e463c1db7f78f3855d3f3739bee0dda773c9a037c90a" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" [[package]] name = "unroll" @@ -5370,9 +5591,9 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "vergen" -version = "9.0.0" +version = "9.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c32e7318e93a9ac53693b6caccfb05ff22e04a44c7cf8a279051f24c09da286f" +checksum = "349ed9e45296a581f455bc18039878f409992999bc1d5da12a6800eb18c8752f" dependencies = [ "anyhow", "derive_builder", @@ -5383,9 +5604,9 @@ dependencies = [ [[package]] name = "vergen-git2" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62c52cd2b2b8b7ec75fc20111b3022ac3ff83e4fc14b9497cfcfd39c54f9c67" +checksum = "e771aff771c0d7c2f42e434e2766d304d917e29b40f0424e8faaaa936bbc3f29" dependencies = [ "anyhow", "derive_builder", @@ -5398,13 +5619,12 @@ dependencies = [ [[package]] name = "vergen-lib" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e06bee42361e43b60f363bad49d63798d0f42fb1768091812270eca00c784720" +checksum = "229eaddb0050920816cf051e619affaf18caa3dd512de8de5839ccbc8e53abb0" dependencies = [ "anyhow", "derive_builder", - "getset", "rustversion", ] @@ -5456,9 +5676,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" dependencies = [ "cfg-if", "once_cell", @@ -5467,24 +5687,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.43" +version = "0.4.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" dependencies = [ "cfg-if", "js-sys", @@ -5494,9 +5714,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -5504,28 +5724,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" [[package]] name = "web-sys" -version = "0.3.70" +version = "0.3.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" dependencies = [ "js-sys", "wasm-bindgen", @@ -5752,9 +5972,9 @@ checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" -version = "0.6.18" +version = "0.6.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" dependencies = [ "memchr", ] @@ -5818,7 +6038,7 @@ dependencies = [ "dotenvy", "evm_arithmetization", "futures", - "hashbrown", + "hashbrown 0.14.5", "hex", "itertools 0.13.0", "jemallocator", @@ -5866,7 +6086,7 @@ checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -5886,7 +6106,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", ] [[package]] @@ -5905,6 +6125,6 @@ version = "0.1.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.77", + "syn 2.0.79", "trybuild", ] diff --git a/evm_arithmetization/Cargo.toml b/evm_arithmetization/Cargo.toml index f5dfec2f2..0c4464f15 100644 --- a/evm_arithmetization/Cargo.toml +++ b/evm_arithmetization/Cargo.toml @@ -17,6 +17,8 @@ keywords.workspace = true [dependencies] anyhow.workspace = true bytes.workspace = true +derive-quote-to-tokens = "0.1.1" +derive-syn-parse = "0.2.0" env_logger.workspace = true ethereum-types.workspace = true hashbrown.workspace = true @@ -35,6 +37,8 @@ pest_derive.workspace = true plonky2 = { workspace = true, features = ["parallel"] } plonky2_maybe_rayon = { workspace = true, features = ["parallel"] } plonky2_util.workspace = true +proc-macro2.workspace = true +quote.workspace = true rand.workspace = true rand_chacha.workspace = true rlp.workspace = true @@ -46,6 +50,7 @@ sha2.workspace = true smt_trie = { workspace = true, optional = true } starky = { workspace = true, features = ["parallel"] } static_assertions.workspace = true +syn.workspace = true thiserror.workspace = true tiny-keccak.workspace = true tokio.workspace = true @@ -56,9 +61,14 @@ zk_evm_common.workspace = true zk_evm_proc_macro.workspace = true [dev-dependencies] +camino = "1.1.9" criterion.workspace = true +glob = "0.3.1" hex.workspace = true +libtest-mimic = "0.7.3" +pretty_assertions = "1.4.1" ripemd.workspace = true +syn-miette = "0.3.0" [features] default = ["eth_mainnet"] @@ -79,6 +89,9 @@ harness = false name = "fibonacci_25m_gas" harness = false +[[test]] +name = "parse" +harness = false # Display math equations properly in documentation [package.metadata.docs.rs] diff --git a/evm_arithmetization/src/cpu/kernel/asm/beacon_roots.asm b/evm_arithmetization/src/cpu/kernel/asm/beacon_roots.asm index 265d61b90..b78b7154a 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/beacon_roots.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/beacon_roots.asm @@ -1,10 +1,10 @@ -/// EIP-4788: Beacon block root in the EVM -/// -/// -/// *NOTE*: This will panic if one of the provided timestamps is zero. +// EIP-4788: Beacon block root in the EVM +// +// +// *NOTE*: This will panic if one of the provided timestamps is zero. -/// Pre-stack: (empty) -/// Post-stack: (empty) +// Pre-stack: (empty) +// Post-stack: (empty) global set_beacon_root: // stack: (empty) PUSH txn_loop diff --git a/evm_arithmetization/src/cpu/kernel/asm/bloom_filter.asm b/evm_arithmetization/src/cpu/kernel/asm/bloom_filter.asm index 35a4ebd76..b6388c283 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/bloom_filter.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/bloom_filter.asm @@ -1,4 +1,4 @@ -/// Implementation of Bloom filters for logs. +// Implementation of Bloom filters for logs. // Adds a Bloom entry to the transaction Bloom filter and the block Bloom filter. // diff --git a/evm_arithmetization/src/cpu/kernel/asm/cdk_pre_execution.asm b/evm_arithmetization/src/cpu/kernel/asm/cdk_pre_execution.asm index bc1145d63..36295d263 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/cdk_pre_execution.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/cdk_pre_execution.asm @@ -1,9 +1,9 @@ -/// CDK-Erigon pre-block execution logic. -/// Reference implementation: `cdk-erigon/core/state/intra_block_state_zkevm.go`. -/// This currently supports the Etrog upgrade. +// CDK-Erigon pre-block execution logic. +// Reference implementation: `cdk-erigon/core/state/intra_block_state_zkevm.go`. +// This currently supports the Etrog upgrade. -/// Pre-stack: (empty) -/// Post-stack: (empty) +// Pre-stack: (empty) +// Post-stack: (empty) global pre_block_execution: // stack: (empty) PUSH txn_loop diff --git a/evm_arithmetization/src/cpu/kernel/asm/core/access_lists.asm b/evm_arithmetization/src/cpu/kernel/asm/core/access_lists.asm index 84cc4077b..e00e79b23 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/core/access_lists.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/core/access_lists.asm @@ -1,10 +1,10 @@ -/// Access lists for addresses and storage keys. -/// The access list is stored in a sorted linked list in SEGMENT_ACCESSED_ADDRESSES for addresses and -/// SEGMENT_ACCESSED_STORAGE_KEYS segment for storage keys. The length of -/// the segments is stored in the global metadata. -/// Both arrays are stored in the kernel memory (context=0). -/// Searching and inserting is done by guessing the predecessor in the list. -/// If the address/storage key isn't found in the array, it is inserted at the end. +// Access lists for addresses and storage keys. +// The access list is stored in a sorted linked list in SEGMENT_ACCESSED_ADDRESSES for addresses and +// SEGMENT_ACCESSED_STORAGE_KEYS segment for storage keys. The length of +// the segments is stored in the global metadata. +// Both arrays are stored in the kernel memory (context=0). +// Searching and inserting is done by guessing the predecessor in the list. +// If the address/storage key isn't found in the array, it is inserted at the end. // Initialize the set of accessed addresses and storage keys with an empty list of the form (@U256_MAX)⮌ // which is written as [@U256_MAX, @SEGMENT_ACCESSED_ADDRESSES] in SEGMENT_ACCESSED_ADDRESSES @@ -89,8 +89,8 @@ global init_access_lists: %endmacro -/// Inserts the address into the access list if it is not already present. -/// Return 1 if the address was inserted, 0 if it was already present. +// Inserts the address into the access list if it is not already present. +// Return 1 if the address was inserted, 0 if it was already present. global insert_accessed_addresses: // stack: addr, retdest PROVER_INPUT(access_lists::address_insert) @@ -172,13 +172,13 @@ insert_new_address: SWAP1 JUMP -/// Remove the address from the access list. -/// Panics if the address is not in the access list. -/// Otherwise it guesses the node before the address (pred) -/// such that (pred)->(next)->(next_next), where the (next) node -/// stores the address. It writes the link (pred)->(next_next) -/// and (next) is marked as deleted by writing U256_MAX in its -/// next node pointer. +// Remove the address from the access list. +// Panics if the address is not in the access list. +// Otherwise it guesses the node before the address (pred) +// such that (pred)->(next)->(next_next), where the (next) node +// stores the address. It writes the link (pred)->(next_next) +// and (next) is marked as deleted by writing U256_MAX in its +// next node pointer. global remove_accessed_addresses: // stack: addr, retdest PROVER_INPUT(access_lists::address_remove) @@ -232,9 +232,9 @@ global remove_accessed_addresses: // stack: ptr %endmacro -/// Inserts the storage key into the access list if it is not already present. -/// Return `1, value_ptr` if the storage key was inserted, `0, value_ptr` if it was already present. -/// Callers to this function must ensure the original storage value is stored at `value_ptr`. +// Inserts the storage key into the access list if it is not already present. +// Return `1, value_ptr` if the storage key was inserted, `0, value_ptr` if it was already present. +// Callers to this function must ensure the original storage value is stored at `value_ptr`. global insert_accessed_storage_keys: // stack: addr, key, retdest PROVER_INPUT(access_lists::storage_insert) @@ -351,8 +351,8 @@ insert_storage_key: %journal_add_storage_loaded JUMP -/// Remove the storage key and its value from the access list. -/// Panics if the key is not in the list. +// Remove the storage key and its value from the access list. +// Panics if the key is not in the list. global remove_accessed_storage_keys: // stack: addr, key, retdest PROVER_INPUT(access_lists::storage_remove) diff --git a/evm_arithmetization/src/cpu/kernel/asm/core/selfdestruct_list.asm b/evm_arithmetization/src/cpu/kernel/asm/core/selfdestruct_list.asm index 05e158c34..210b9f92b 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/core/selfdestruct_list.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/core/selfdestruct_list.asm @@ -1,6 +1,6 @@ -/// Self-destruct list. -/// Implemented as an array, with the length stored in the global metadata. -/// Note: This array allows duplicates. +// Self-destruct list. +// Implemented as an array, with the length stored in the global metadata. +// Note: This array allows duplicates. %macro insert_selfdestruct_list // stack: addr @@ -13,8 +13,8 @@ %mstore_global_metadata(@GLOBAL_METADATA_SELFDESTRUCT_LIST_LEN) // Store new length. %endmacro -/// Remove one occurrence of the address from the list. -/// No effect if the address is not in the list. +// Remove one occurrence of the address from the list. +// No effect if the address is not in the list. global remove_selfdestruct_list: // stack: addr, retdest %mload_global_metadata(@GLOBAL_METADATA_SELFDESTRUCT_LIST_LEN) diff --git a/evm_arithmetization/src/cpu/kernel/asm/core/touched_addresses.asm b/evm_arithmetization/src/cpu/kernel/asm/core/touched_addresses.asm index a8e926e77..94c2d68ae 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/core/touched_addresses.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/core/touched_addresses.asm @@ -10,7 +10,7 @@ POP %endmacro -/// Inserts the address into the list if it is not already present. +// Inserts the address into the list if it is not already present. global insert_touched_addresses: // stack: addr, retdest %mload_global_metadata(@GLOBAL_METADATA_TOUCHED_ADDRESSES_LEN) @@ -45,8 +45,8 @@ insert_touched_addresses_found: %stack (i, len, addr, retdest) -> (retdest) JUMP -/// Remove the address from the list. -/// Panics if the address is not in the list. +// Remove the address from the list. +// Panics if the address is not in the list. global remove_touched_addresses: // stack: addr, retdest %mload_global_metadata(@GLOBAL_METADATA_TOUCHED_ADDRESSES_LEN) diff --git a/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/constants.asm b/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/constants.asm index 20882c053..0d1277408 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/constants.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/constants.asm @@ -1,11 +1,11 @@ -/// miller_data is defined by -/// (1) taking the binary expansion of N254, the order of the elliptic curve group -/// (2) popping the first and last elements, then appending a 0: -/// exp = bin(N254)[1:-1] + [0] -/// (3) counting the lengths of runs of 1s then 0s in exp, e.g. -/// if exp = 1100010011110, then EXP = [(2,3), (1,2), (4,1)] -/// (4) byte encoding each pair (n,m) as follows: -/// miller_data = [(0x20)n + m for (n,m) in EXP] +// miller_data is defined by +// (1) taking the binary expansion of N254, the order of the elliptic curve group +// (2) popping the first and last elements, then appending a 0: +// exp = bin(N254)[1:-1] + [0] +// (3) counting the lengths of runs of 1s then 0s in exp, e.g. +// if exp = 1100010011110, then EXP = [(2,3), (1,2), (4,1)] +// (4) byte encoding each pair (n,m) as follows: +// miller_data = [(0x20)n + m for (n,m) in EXP] global miller_data: BYTES 0xdc, 0x22, 0x42, 0x21 @@ -24,13 +24,13 @@ global miller_data: BYTES 0x25 -/// final_exp first computes y^a4, y^a2, y^a0 -/// representing a4, a2, a0 in *little endian* binary, define -/// EXPS4 = [(a4[i], a2[i], a0[i]) for i in 0..len(a4)] -/// EXPS2 = [ (a2[i], a0[i]) for i in len(a4)..len(a2)] -/// EXPS0 = [ a0[i] for i in len(a2)..len(a0)] -/// power_data_n is simply a reverse-order byte encoding of EXPSn -/// where (i,j,k) is sent to (100)i + (10)j + k +// final_exp first computes y^a4, y^a2, y^a0 +// representing a4, a2, a0 in *little endian* binary, define +// EXPS4 = [(a4[i], a2[i], a0[i]) for i in 0..len(a4)] +// EXPS2 = [ (a2[i], a0[i]) for i in len(a4)..len(a2)] +// EXPS0 = [ a0[i] for i in len(a2)..len(a0)] +// power_data_n is simply a reverse-order byte encoding of EXPSn +// where (i,j,k) is sent to (100)i + (10)j + k global power_data_4: BYTES 111, 010, 011, 111 diff --git a/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/final_exponent.asm b/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/final_exponent.asm index 035cb4383..93163c3da 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/final_exponent.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/final_exponent.asm @@ -1,17 +1,17 @@ -/// To make the Tate pairing an invariant, the final step is to exponentiate by -/// (p^12 - 1)/N = (p^6 - 1) * (p^2 + 1) * (p^4 - p^2 + 1)/N -/// and thus we can exponentiate by each factor sequentially. -/// -/// def bn254_final_exponent(y: Fp12): -/// y = first_exp(y) -/// y = second_exp(y) -/// return final_exp(y) +// To make the Tate pairing an invariant, the final step is to exponentiate by +// (p^12 - 1)/N = (p^6 - 1) * (p^2 + 1) * (p^4 - p^2 + 1)/N +// and thus we can exponentiate by each factor sequentially. +// +// def bn254_final_exponent(y: Fp12): +// y = first_exp(y) +// y = second_exp(y) +// return final_exp(y) global bn254_final_exponent: -/// first, exponentiate by (p^6 - 1) via -/// def first_exp(y): -/// return y.frob(6) / y +// first, exponentiate by (p^6 - 1) via +// def first_exp(y): +// return y.frob(6) / y // stack: k, inp, out, retdest {out: y} %stack (k, inp, out) -> (out, 0, first_exp, out) // stack: out, 0, first_exp, out, retdest {out: y} @@ -24,9 +24,9 @@ first_exp: // stack: out, 0, out, second_exp, out, retdest {out: y_6, 0: y^-1} %jump(mul_fp254_12) -/// second, exponentiate by (p^2 + 1) via -/// def second_exp(y): -/// return y.frob(2) * y +// second, exponentiate by (p^2 + 1) via +// def second_exp(y): +// return y.frob(2) * y second_exp: // stack: out, retdest {out: y} %stack (out) -> (out, 0, out, out, final_exp, out) @@ -35,21 +35,21 @@ second_exp: // stack: 0, out, out, final_exp, out, retdest {out: y, 0: y_2} %jump(mul_fp254_12) -/// Finally, we must exponentiate by (p^4 - p^2 + 1)/N -/// To do so efficiently, we can express this power as -/// (p^4 - p^2 + 1)/N = p^3 + (a2)p^2 - (a1)p - a0 -/// and simultaneously compute y^a4, y^a2, y^a0 where -/// a1 = a4 + 2a2 - a0 -/// We first initialize these powers as 1 and then use -/// binary algorithms for exponentiation. -/// -/// def final_exp(y): -/// y4, y2, y0 = 1, 1, 1 -/// power_loop_4() -/// power_loop_2() -/// power_loop_0() -/// custom_powers() -/// final_power() +// Finally, we must exponentiate by (p^4 - p^2 + 1)/N +// To do so efficiently, we can express this power as +// (p^4 - p^2 + 1)/N = p^3 + (a2)p^2 - (a1)p - a0 +// and simultaneously compute y^a4, y^a2, y^a0 where +// a1 = a4 + 2a2 - a0 +// We first initialize these powers as 1 and then use +// binary algorithms for exponentiation. +// +// def final_exp(y): +// y4, y2, y0 = 1, 1, 1 +// power_loop_4() +// power_loop_2() +// power_loop_0() +// custom_powers() +// final_power() final_exp: // stack: val, retdest @@ -74,24 +74,24 @@ final_exp: // stack: 64, 62, 65, 0, val, retdest {0: sqr, 12: y0, 24: y2, 36: y4} %jump(power_loop_4) -/// After computing the powers -/// y^a4, y^a2, y^a0 -/// we would like to transform them to -/// y^a2, y^-a1, y^-a0 -/// -/// def custom_powers() -/// y0 = y0^{-1} -/// y1 = y4 * y2^2 * y0 -/// return y2, y1, y0 -/// -/// And finally, upon doing so, compute the final power -/// y^(p^3) * (y^a2)^(p^2) * (y^-a1)^p * (y^-a0) -/// -/// def final_power() -/// y = y.frob(3) -/// y2 = y2.frob(2) -/// y1 = y1.frob(1) -/// return y * y2 * y1 * y0 +// After computing the powers +// y^a4, y^a2, y^a0 +// we would like to transform them to +// y^a2, y^-a1, y^-a0 +// +// def custom_powers() +// y0 = y0^{-1} +// y1 = y4 * y2^2 * y0 +// return y2, y1, y0 +// +// And finally, upon doing so, compute the final power +// y^(p^3) * (y^a2)^(p^2) * (y^-a1)^p * (y^-a0) +// +// def final_power() +// y = y.frob(3) +// y2 = y2.frob(2) +// y1 = y1.frob(1) +// return y * y2 * y1 * y0 custom_powers: // stack: val, retdest {12: y0, 24: y2, 36: y4} @@ -140,35 +140,35 @@ final_mul: %jump(mul_fp254_12) -/// def power_loop_4(): -/// for i in range(64): -/// abc = load(i, power_data_4) -/// if a: -/// y4 *= acc -/// if b: -/// y2 *= acc -/// if c: -/// y0 *= acc -/// acc = square_fp254_12(acc) -/// y4 *= acc -/// -/// def power_loop_2(): -/// for i in range(62): -/// ab = load(i, power_data_2) -/// if a: -/// y2 *= acc -/// if b: -/// y0 *= acc -/// acc = square_fp254_12(acc) -/// y2 *= acc -/// -/// def power_loop_0(): -/// for i in range(65): -/// a = load(i, power_data_0) -/// if a: -/// y0 *= acc -/// acc = square_fp254_12(acc) -/// y0 *= acc +// def power_loop_4(): +// for i in range(64): +// abc = load(i, power_data_4) +// if a: +// y4 *= acc +// if b: +// y2 *= acc +// if c: +// y0 *= acc +// acc = square_fp254_12(acc) +// y4 *= acc +// +// def power_loop_2(): +// for i in range(62): +// ab = load(i, power_data_2) +// if a: +// y2 *= acc +// if b: +// y0 *= acc +// acc = square_fp254_12(acc) +// y2 *= acc +// +// def power_loop_0(): +// for i in range(65): +// a = load(i, power_data_0) +// if a: +// y0 *= acc +// acc = square_fp254_12(acc) +// y0 *= acc power_loop_4: // stack: i , j, k, sqr {0: sqr, 12: y0, 24: y2, 36: y4} diff --git a/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/miller_loop.asm b/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/miller_loop.asm index 99cf24e71..dc99838e1 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/miller_loop.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/miller_loop.asm @@ -1,29 +1,29 @@ -/// def miller(P, Q): -/// miller_init() -/// miller_loop() -/// -/// def miller_init(): -/// out = 1 -/// O = P -/// times = 61 -/// -/// def miller_loop(): -/// while times: -/// 0xnm = load(miller_data) -/// while 0xnm > 0x20: -/// miller_one() -/// while 0xnm: -/// miller_zero() -/// times -= 1 -/// -/// def miller_one(): -/// 0xnm -= 0x20 -/// mul_tangent() -/// mul_cord() -/// -/// def miller_zero(): -/// 0xnm -= 1 -/// mul_tangent() +// def miller(P, Q): +// miller_init() +// miller_loop() +// +// def miller_init(): +// out = 1 +// O = P +// times = 61 +// +// def miller_loop(): +// while times: +// 0xnm = load(miller_data) +// while 0xnm > 0x20: +// miller_one() +// while 0xnm: +// miller_zero() +// times -= 1 +// +// def miller_one(): +// 0xnm -= 0x20 +// mul_tangent() +// mul_cord() +// +// def miller_zero(): +// 0xnm -= 1 +// mul_tangent() global bn254_miller: // stack: ptr, out, retdest @@ -85,11 +85,11 @@ miller_zero: %jump(mul_tangent) -/// def mul_tangent() -/// out = square_fp254_12(out) -/// line = tangent(O, Q) -/// out = mul_fp254_12_sparse(out, line) -/// O += O +// def mul_tangent() +// out = square_fp254_12(out) +// line = tangent(O, Q) +// out = mul_fp254_12_sparse(out, line) +// O += O mul_tangent: // stack: retdest, 0xnm, times, O, P, Q, out @@ -132,10 +132,10 @@ after_double: // stack: retdest, 0xnm, times, 2*O, P, Q, out {12: line} JUMP -/// def mul_cord() -/// line = cord(P, O, Q) -/// out = mul_fp254_12_sparse(out, line) -/// O += P +// def mul_cord() +// line = cord(P, O, Q) +// out = mul_fp254_12_sparse(out, line) +// O += P mul_cord: // stack: 0xnm, times, O, P, Q, out @@ -179,12 +179,12 @@ after_add: %jump(miller_one) -/// def tangent(px, py, qx, qy): -/// return sparse_store( -/// py**2 - 9, -/// (-3px**2) * qx, -/// (2py) * qy, -/// ) +// def tangent(px, py, qx, qy): +// return sparse_store( +// py**2 - 9, +// (-3px**2) * qx, +// (2py) * qy, +// ) %macro tangent // stack: px, py, qx, qx_, qy, qy_ @@ -239,12 +239,12 @@ after_add: %mstore_bn254_pairing(21) %endmacro -/// def cord(p1x, p1y, p2x, p2y, qx, qy): -/// return sparse_store( -/// p1y*p2x - p2y*p1x, -/// (p2y - p1y) * qx, -/// (p1x - p2x) * qy, -/// ) +// def cord(p1x, p1y, p2x, p2y, qx, qy): +// return sparse_store( +// p1y*p2x - p2y*p1x, +// (p2y - p1y) * qx, +// (p1x - p2x) * qy, +// ) %macro cord // stack: p1x , p1y, p2x , p2y, qx, qx_, qy, qy_ diff --git a/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/pairing.asm b/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/pairing.asm index b1bd2f835..f7dc31c05 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/pairing.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/pairing.asm @@ -1,38 +1,38 @@ -/// The input to the pairing script is a list of points -/// P_i = n_i*G: Curve, Q_i = m_i*H: TwistedCurve -/// where G, H are the respective generators, such that -/// sum_i n_i*m_i = 0 -/// and therefore, due to bilinearity of the pairing: -/// prod_i e(P_i, Q_i) -/// = prod_i e(n_i G, m_i H) -/// = prod_i e(G,H)^{n_i * m_i} -/// = e(G,H)^{sum_i n_i * m_i} -/// = e(G,H)^0 -/// = 1: Fp12 +// The input to the pairing script is a list of points +// P_i = n_i*G: Curve, Q_i = m_i*H: TwistedCurve +// where G, H are the respective generators, such that +// sum_i n_i*m_i = 0 +// and therefore, due to bilinearity of the pairing: +// prod_i e(P_i, Q_i) +// = prod_i e(n_i G, m_i H) +// = prod_i e(G,H)^{n_i * m_i} +// = e(G,H)^{sum_i n_i * m_i} +// = e(G,H)^0 +// = 1: Fp12 -/// def bn254_pairing(pairs: List((Curve, TwistedCurve))) -> Bool: -/// -/// for P, Q in pairs: -/// if not (P.is_valid and Q.is_valid): -/// return @U256_MAX -/// -/// out = 1 -/// for P, Q in pairs: -/// if P != 0 and Q != 0: -/// out *= miller_loop(P, Q) -/// -/// result = bn254_final_exponent(out) -/// return result == unit_fp12 +// def bn254_pairing(pairs: List((Curve, TwistedCurve))) -> Bool: +// +// for P, Q in pairs: +// if not (P.is_valid and Q.is_valid): +// return @U256_MAX +// +// out = 1 +// for P, Q in pairs: +// if P != 0 and Q != 0: +// out *= miller_loop(P, Q) +// +// result = bn254_final_exponent(out) +// return result == unit_fp12 -/// The following is a key to this API -/// -/// - k is the number of inputs -/// - each input given by a pair of points, one on the curve and one on the twisted curve -/// - each input consists of 6 stack terms---2 for the curve point and 4 for the twisted curve point -/// - the inputs are presumed to be placed on the kernel contiguously -/// - the output (as defined above) is an Fp12 element -/// - out and inp are the BnPairing segment offsets for the output element and input -/// - the assembly code currently uses offsets 0-78 for scratch space +// The following is a key to this API +// +// - k is the number of inputs +// - each input given by a pair of points, one on the curve and one on the twisted curve +// - each input consists of 6 stack terms---2 for the curve point and 4 for the twisted curve point +// - the inputs are presumed to be placed on the kernel contiguously +// - the output (as defined above) is an Fp12 element +// - out and inp are the BnPairing segment offsets for the output element and input +// - the assembly code currently uses offsets 0-78 for scratch space global bn254_pairing: // stack: k, inp, out, retdest diff --git a/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/twisted_curve_checks.asm b/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/twisted_curve_checks.asm index c9583498e..08c3cd50d 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/twisted_curve_checks.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/twisted_curve_checks.asm @@ -93,10 +93,10 @@ MUL // Cheaper than AND %endmacro -/// The `ECPAIRING` precompile requires checking that G2 -/// inputs are on the correct prime-order subgroup. -/// This macro performs this check, based on the algorithm -/// detailed in . +// The `ECPAIRING` precompile requires checking that G2 +// inputs are on the correct prime-order subgroup. +// This macro performs this check, based on the algorithm +// detailed in . %macro bn_check_twisted_subgroup // stack: Q = (X, Y) %dup_bn_g2 diff --git a/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/twisted_curve_endomorphism.asm b/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/twisted_curve_endomorphism.asm index dfe819ef8..afc5972d4 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/twisted_curve_endomorphism.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/curve_arithmetic/twisted_curve_endomorphism.asm @@ -1,6 +1,6 @@ // Implementation of the BN254 twist endomorphism. -/// Frobenius map over BN254 quadratic extension. +// Frobenius map over BN254 quadratic extension. %macro frob_fp254_2 // stack: X = (x, x_) %conj_fp254_2 diff --git a/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/field_arithmetic/degree_12_mul.asm b/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/field_arithmetic/degree_12_mul.asm index 45016ed15..c01f8f795 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/field_arithmetic/degree_12_mul.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/field_arithmetic/degree_12_mul.asm @@ -1,21 +1,21 @@ -/////////////////////////////////////// -///// GENERAL FP12 MULTIPLICATION ///// -/////////////////////////////////////// +////////////////////////// +//// GENERAL FP12 MULTIPLICATION //// +////////////////////////// -/// inputs: -/// F = f + f'z -/// G = g + g'z -/// -/// output: -/// H = h + h'z = FG -/// -/// h = fg + sh(f'g') -/// h' = (f+f')(g+g') - fg - f'g' -/// -/// memory pointers [ind' = ind+6] -/// {inA: f, inA: f', inB: g, inB':g', out: h, out': h'} -/// -/// f, f', g, g' consist of six elements on the stack +// inputs: +// F = f + f'z +// G = g + g'z +// +// output: +// H = h + h'z = FG +// +// h = fg + sh(f'g') +// h' = (f+f')(g+g') - fg - f'g' +// +// memory pointers [ind' = ind+6] +// {inA: f, inA: f', inB: g, inB':g', out: h, out': h'} +// +// f, f', g, g' consist of six elements on the stack global mul_fp254_12: // stack: inA, inB, out @@ -111,25 +111,25 @@ mul_fp254_12_3: JUMP -////////////////////////////////////// -///// SPARSE FP12 MULTIPLICATION ///// -////////////////////////////////////// +////////////////////////// +//// SPARSE FP12 MULTIPLICATION //// +////////////////////////// -/// input: -/// F = f + f'z -/// G = g0 + (G1)t + (G2)tz -/// -/// output: -/// H = h + h'z = FG -/// = g0 * [f + f'z] + G1 * [sh(f) + sh(f')z] + G2 * [sh2(f') + sh(f)z] -/// -/// h = g0 * f + G1 * sh(f ) + G2 * sh2(f') -/// h' = g0 * f' + G1 * sh(f') + G2 * sh (f ) -/// -/// memory pointers [ind' = ind+6, inB2 = inB1 + 2 = inB + 3] -/// { inA: f, inA': f', inB: g0, inB1: G1, inB2: G2, out: h, out': h'} -/// -/// f, f' consist of six elements; G1, G1' consist of two elements; and g0 of one element +// input: +// F = f + f'z +// G = g0 + (G1)t + (G2)tz +// +// output: +// H = h + h'z = FG +// = g0 * [f + f'z] + G1 * [sh(f) + sh(f')z] + G2 * [sh2(f') + sh(f)z] +// +// h = g0 * f + G1 * sh(f ) + G2 * sh2(f') +// h' = g0 * f' + G1 * sh(f') + G2 * sh (f ) +// +// memory pointers [ind' = ind+6, inB2 = inB1 + 2 = inB + 3] +// { inA: f, inA': f', inB: g0, inB1: G1, inB2: G2, out: h, out': h'} +// +// f, f' consist of six elements; G1, G1' consist of two elements; and g0 of one element global mul_fp254_12_sparse: // stack: inA, inB, out @@ -224,23 +224,23 @@ global mul_fp254_12_sparse: JUMP -///////////////////////// -///// FP12 SQUARING ///// -///////////////////////// +///////////////// +//// FP12 SQUARING //// +///////////////// -/// input: -/// F = f + f'z -/// -/// output: -/// H = h + h'z = FF -/// -/// h = ff + sh(f'f') -/// h' = 2ff' -/// -/// memory pointers [ind' = ind+6] -/// {inp: f, inp: f', out: h, out': h'} -/// -/// f, f' consist of six elements on the stack +// input: +// F = f + f'z +// +// output: +// H = h + h'z = FF +// +// h = ff + sh(f'f') +// h' = 2ff' +// +// memory pointers [ind' = ind+6] +// {inp: f, inp: f', out: h, out': h'} +// +// f, f' consist of six elements on the stack global square_fp254_12: // stack: inp, out diff --git a/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/field_arithmetic/degree_6_mul.asm b/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/field_arithmetic/degree_6_mul.asm index db8b09e0c..00f30e34b 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/field_arithmetic/degree_6_mul.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/field_arithmetic/degree_6_mul.asm @@ -1,62 +1,62 @@ -////////////////////////////////////// -///// GENERAL FP6 MULTIPLICATION ///// -////////////////////////////////////// +////////////////////////// +//// GENERAL FP6 MULTIPLICATION //// +////////////////////////// -/// inputs: -/// C = C0 + C1t + C2t^2 -/// = (c0 + c0_i) + (c1 + c1_i)t + (c2 + c2_i)t^2 -/// -/// D = D0 + D1t + D2t^2 -/// = (d0 + d0_i) + (d1 + d1_i)t + (d2 + d2_i)t^2 -/// -/// output: -/// E = E0 + E1t + E2t^2 = CD -/// = (e0 + e0_i) + (e1 + e1_i)t + (e2 + e2_i)t^2 -/// -/// initial stack: c0, c0_, c1, c1_, c2, c2_, d0, d0_, d1, d1_, d2, d2_, retdest -/// final stack: e0, e0_, e1, e1_, e2, e2_ +// inputs: +// C = C0 + C1t + C2t^2 +// = (c0 + c0_i) + (c1 + c1_i)t + (c2 + c2_i)t^2 +// +// D = D0 + D1t + D2t^2 +// = (d0 + d0_i) + (d1 + d1_i)t + (d2 + d2_i)t^2 +// +// output: +// E = E0 + E1t + E2t^2 = CD +// = (e0 + e0_i) + (e1 + e1_i)t + (e2 + e2_i)t^2 +// +// initial stack: c0, c0_, c1, c1_, c2, c2_, d0, d0_, d1, d1_, d2, d2_, retdest +// final stack: e0, e0_, e1, e1_, e2, e2_ -/// computations: -/// -/// E0 = C0D0 + i9(C1D2 + C2D1) -/// -/// C0D0 = (c0d0 - c0_d0_) + (c0d0_ + c0_d0)i -/// -/// C1D2 = (c1d2 - c1_d2_) + (c1d2_ + c1_d2)i -/// C2D1 = (c2d1 - c2_d1_) + (c2d1_ + c2_d1)i -/// -/// CD12 = C1D2 + C2D1 -/// = (c1d2 + c2d1 - c1_d2_ - c2_d1_) + (c1d2_ + c1_d2 + c2d1_ + c2_d1)i -/// -/// i9(CD12) = (9CD12 - CD12_) + (CD12 + 9CD12_)i -/// -/// e0 = 9CD12 - CD12_ + C0D0 -/// e0_ = 9CD12_ + CD12 + C0D0_ -/// -/// -/// E1 = C0D1 + C1D0 + i9(C2D2) -/// -/// C0D1 = (c0d1 - c0_d1_) + (c0d1_ + c0_d1)i -/// C1D0 = (c1d0 - c1_d0_) + (c1d0_ + c1_d0)i -/// -/// CD01 = c0d1 + c1d0 - (c0_d1_ + c1_d0_) -/// CD01_ = c0d1_ + c0_d1 + c1d0_ + c1_d0 -/// -/// C2D2 = (c2d2 - c2_d2_) + (c2d2_ + c2_d2)i -/// i9(C2D2) = (9C2D2 - C2D2_) + (C2D2 + 9C2D2_)i -/// -/// e1 = 9C2D2 - C2D2_ + CD01 -/// e1_ = C2D2 + 9C2D2_ + CD01_ -/// -/// -/// E2 = C0D2 + C1D1 + C2D0 -/// -/// C0D2 = (c0d2 - c0_d2_) + (c0d2_ + c0_d2)i -/// C1D1 = (c1d1 - c1_d1_) + (c1d1_ + c1_d1)i -/// C2D0 = (c2d0 - c2_d0_) + (c2d0_ + c2_d0)i -/// -/// e2 = c0d2 + c1d1 + c2d0 - (c0_d2_ + c1_d1_ + c2_d0_) -/// e2_ = c0d2_ + c0_d2 + c1d1_ + c1_d1 + c2d0_ + c2_d0 +// computations: +// +// E0 = C0D0 + i9(C1D2 + C2D1) +// +// C0D0 = (c0d0 - c0_d0_) + (c0d0_ + c0_d0)i +// +// C1D2 = (c1d2 - c1_d2_) + (c1d2_ + c1_d2)i +// C2D1 = (c2d1 - c2_d1_) + (c2d1_ + c2_d1)i +// +// CD12 = C1D2 + C2D1 +// = (c1d2 + c2d1 - c1_d2_ - c2_d1_) + (c1d2_ + c1_d2 + c2d1_ + c2_d1)i +// +// i9(CD12) = (9CD12 - CD12_) + (CD12 + 9CD12_)i +// +// e0 = 9CD12 - CD12_ + C0D0 +// e0_ = 9CD12_ + CD12 + C0D0_ +// +// +// E1 = C0D1 + C1D0 + i9(C2D2) +// +// C0D1 = (c0d1 - c0_d1_) + (c0d1_ + c0_d1)i +// C1D0 = (c1d0 - c1_d0_) + (c1d0_ + c1_d0)i +// +// CD01 = c0d1 + c1d0 - (c0_d1_ + c1_d0_) +// CD01_ = c0d1_ + c0_d1 + c1d0_ + c1_d0 +// +// C2D2 = (c2d2 - c2_d2_) + (c2d2_ + c2_d2)i +// i9(C2D2) = (9C2D2 - C2D2_) + (C2D2 + 9C2D2_)i +// +// e1 = 9C2D2 - C2D2_ + CD01 +// e1_ = C2D2 + 9C2D2_ + CD01_ +// +// +// E2 = C0D2 + C1D1 + C2D0 +// +// C0D2 = (c0d2 - c0_d2_) + (c0d2_ + c0_d2)i +// C1D1 = (c1d1 - c1_d1_) + (c1d1_ + c1_d1)i +// C2D0 = (c2d0 - c2_d0_) + (c2d0_ + c2_d0)i +// +// e2 = c0d2 + c1d1 + c2d0 - (c0_d2_ + c1_d1_ + c2_d0_) +// e2_ = c0d2_ + c0_d2 + c1d1_ + c1_d1 + c2d0_ + c2_d0 // cost: 157 global mul_fp254_6: @@ -261,48 +261,48 @@ global mul_fp254_6: JUMP -//////////////////////// -///// FP6 SQUARING ///// -//////////////////////// +//////////////// +//// FP6 SQUARING //// +//////////////// -/// inputs: -/// C = C0 + C1t + C2t^2 -/// = (c0 + c0_i) + (c1 + c1_i)t + (c2 + c2_i)t^2 -/// -/// output: -/// E = E0 + E1t + E2t^2 = C^2 -/// = (e0 + e0_i) + (e1 + e1_i)t + (e2 + e2_i)t^2 -/// -/// initial stack: c0, c0_, c1, c1_, c2, c2_, retdest -/// final stack: e0, e0_, e1, e1_, e2, e2_ +// inputs: +// C = C0 + C1t + C2t^2 +// = (c0 + c0_i) + (c1 + c1_i)t + (c2 + c2_i)t^2 +// +// output: +// E = E0 + E1t + E2t^2 = C^2 +// = (e0 + e0_i) + (e1 + e1_i)t + (e2 + e2_i)t^2 +// +// initial stack: c0, c0_, c1, c1_, c2, c2_, retdest +// final stack: e0, e0_, e1, e1_, e2, e2_ -/// computations: -/// -/// E0 = C0C0 + i9(2C1C2) = (c0+c0_i)^2 + i9(2(c1+c1_i)(c2+c2_i)) -/// = (c0^2 - c0_^2) + (2c0c0_)i + i9[2(c1c2 - c1_c2_) + 2(c1_c2 + c1c2_)i] -/// -/// E1 = 2*C0C1 + i9(C2C2) = 2(c0+c0_i)(c1+c1_i) + i9((c2+c2_i)(c2+c2_i)) -/// = 2(c0c1 - c0_c1_) + 2(c0c1_ + c0_c1)i + i9[(c2^2 - c2_^2) + (2c2c2_)i] -/// -/// E2 = 2*C0C2 + C1C1 -/// = 2(c0c2 - c0_c2_) + 2(c0_c2 + c2c0_)i + (c1^2 - c1_^2) + (2c1c1_)i -/// -/// e0 = (c0^2 - c0_^2) + x0 -/// e0_ = 2c0c0_ + x0_ -/// where x0_, x0 = %i9 c1c2 - c1_c2_, c1_c2 + c1c2_ -/// -/// e1 = 2(c0c1 - c0_c1_) + x1 -/// e1_ = 2(c0c1_ + c0_c1) + x1_ -/// where x1_, x1 = %i9 c2^2 - c2_^2, 2c2c2_ -/// -/// e2 = 2(c0c2 - c0_c2_) + (c1^2 - c1_^2) -/// e2_ = 2(c0_c2 + c2c0_) + 2c1c1_ +// computations: +// +// E0 = C0C0 + i9(2C1C2) = (c0+c0_i)^2 + i9(2(c1+c1_i)(c2+c2_i)) +// = (c0^2 - c0_^2) + (2c0c0_)i + i9[2(c1c2 - c1_c2_) + 2(c1_c2 + c1c2_)i] +// +// E1 = 2*C0C1 + i9(C2C2) = 2(c0+c0_i)(c1+c1_i) + i9((c2+c2_i)(c2+c2_i)) +// = 2(c0c1 - c0_c1_) + 2(c0c1_ + c0_c1)i + i9[(c2^2 - c2_^2) + (2c2c2_)i] +// +// E2 = 2*C0C2 + C1C1 +// = 2(c0c2 - c0_c2_) + 2(c0_c2 + c2c0_)i + (c1^2 - c1_^2) + (2c1c1_)i +// +// e0 = (c0^2 - c0_^2) + x0 +// e0_ = 2c0c0_ + x0_ +// where x0_, x0 = %i9 c1c2 - c1_c2_, c1_c2 + c1c2_ +// +// e1 = 2(c0c1 - c0_c1_) + x1 +// e1_ = 2(c0c1_ + c0_c1) + x1_ +// where x1_, x1 = %i9 c2^2 - c2_^2, 2c2c2_ +// +// e2 = 2(c0c2 - c0_c2_) + (c1^2 - c1_^2) +// e2_ = 2(c0_c2 + c2c0_) + 2c1c1_ // cost: 101 global square_fp254_6: - /// e0 = (c0^2 - c0_^2) + x0 - /// e0_ = 2c0c0_ + x0_ - /// where x0_, x0 = %i9 2(c1c2 - c1_c2_), 2(c1_c2 + c1c2_) + // e0 = (c0^2 - c0_^2) + x0 + // e0_ = 2c0c0_ + x0_ + // where x0_, x0 = %i9 2(c1c2 - c1_c2_), 2(c1_c2 + c1c2_) DUP6 DUP4 MULFP254 @@ -346,9 +346,9 @@ global square_fp254_6: // stack: e0 SWAP3 - /// e1 = 2(c0c1 - c0_c1_) + x1 - /// e1_ = 2(c0c1_ + c0_c1 ) + x1_ - /// where x1_, x1 = %i9 c2^2 - c2_^2, 2c2c2_ + // e1 = 2(c0c1 - c0_c1_) + x1 + // e1_ = 2(c0c1_ + c0_c1 ) + x1_ + // where x1_, x1 = %i9 c2^2 - c2_^2, 2c2c2_ DUP7 DUP9 MULFP254 @@ -391,8 +391,8 @@ global square_fp254_6: ADDFP254 SWAP7 - /// e2 = 2(c0c2 - c0_c2_) + (c1^2 - c1_^2) - /// e2_ = 2(c0_c2 + c2c0_ + c1c1_) + // e2 = 2(c0c2 - c0_c2_) + (c1^2 - c1_^2) + // e2_ = 2(c0_c2 + c2c0_ + c1c1_) DUP1 DUP1 MULFP254 diff --git a/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/field_arithmetic/frobenius.asm b/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/field_arithmetic/frobenius.asm index ee1e46791..81117a3a9 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/field_arithmetic/frobenius.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/field_arithmetic/frobenius.asm @@ -27,10 +27,10 @@ global test_frob_fp254_12_6: %jump(0xdeadbeef) -/// def frob_fp254_12_n(f, f'): -/// g = frob_fp254_6(n, f ) -/// g' = FROB_z[n] * frob_fp254_6(n, f') -/// return g, g' +// def frob_fp254_12_n(f, f'): +// g = frob_fp254_6(n, f ) +// g' = FROB_z[n] * frob_fp254_6(n, f') +// return g, g' %macro frob_fp254_12_1 // stack: ptr @@ -140,14 +140,14 @@ global test_frob_fp254_6_3: %jump(0xdeadbeef) -/// let Z` denote the complex conjugate of Z +// let Z` denote the complex conjugate of Z -/// def frob_fp254_6_n(C0, C1, C2): -/// if n%2: -/// D0, D1, D2 = C0`, FROB_T1[n] * C1`, FROB_T2[n] * C2` -/// else: -/// D0, D1, D2 = C0 , FROB_T1[n] * C1 , FROB_T2[n] * C2 -/// return D0, D1, D2 +// def frob_fp254_6_n(C0, C1, C2): +// if n%2: +// D0, D1, D2 = C0`, FROB_T1[n] * C1`, FROB_T2[n] * C2` +// else: +// D0, D1, D2 = C0 , FROB_T1[n] * C1 , FROB_T2[n] * C2 +// return D0, D1, D2 %macro frob_fp254_6_1 // stack: C0 , C1 , C2 diff --git a/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/field_arithmetic/util.asm b/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/field_arithmetic/util.asm index ee9dd7ffa..7b391e421 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/field_arithmetic/util.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/curve/bn254/field_arithmetic/util.asm @@ -62,7 +62,7 @@ // stack: x0, x1 %endmacro -/// complex conjugate +// complex conjugate %macro conj_fp254_2 // stack: a, b SWAP1 @@ -125,9 +125,9 @@ // stack: z, z_ %endmacro -/// Given z = x + iy: Fp254_2, return complex conjugate z': Fp254_2 -/// where input is represented z.re, z.im and output as z'.im, z'.re -/// cost: 9; note this returns y, x for the output x + yi +// Given z = x + iy: Fp254_2, return complex conjugate z': Fp254_2 +// where input is represented z.re, z.im and output as z'.im, z'.re +// cost: 9; note this returns y, x for the output x + yi %macro i9 // stack: a , b DUP2 @@ -540,8 +540,8 @@ // stack: f: 6, X: 8, f: 6 %endmacro -/// multiply (a + bt + ct^2) by t: -/// t(a + bt + ct^2) = at + bt^2 + ct^3 = (9+i)c + at + bt^2 +// multiply (a + bt + ct^2) by t: +// t(a + bt + ct^2) = at + bt^2 + ct^3 = (9+i)c + at + bt^2 %macro sh_fp254_6 // stack: a, b, c %stack (a: 2, b: 2, c: 2) -> (c, a, b) @@ -669,14 +669,14 @@ // stack: c * f0, c * f1, c * f2, c * f3, c * f4, c * f5 %endmacro -/// cost: -/// -/// G0 + G1t + G2t^2 = (a+bi) * (F0 + F1t + F2t^2) -/// = (a+bi)F0 + (a+bi)F1t + (a+bi)F2t^2 -/// -/// G0 = (a+bi)(f0+f0_i) = (af0 - bf0_) + (bf0 + af0_)i -/// G1 = (a+bi)(f1+f1_i) = (af1 - bf1_) + (bf1 + af1_)i -/// G2 = (a+bi)(f2+f2_i) = (af2 - bf2_) + (bf2 + af2_)i +// cost: +// +// G0 + G1t + G2t^2 = (a+bi) * (F0 + F1t + F2t^2) +// = (a+bi)F0 + (a+bi)F1t + (a+bi)F2t^2 +// +// G0 = (a+bi)(f0+f0_i) = (af0 - bf0_) + (bf0 + af0_)i +// G1 = (a+bi)(f1+f1_i) = (af1 - bf1_) + (bf1 + af1_)i +// G2 = (a+bi)(f2+f2_i) = (af2 - bf2_) + (bf2 + af2_)i %macro scale_fp254_6 // stack: a, b, f0, f0_, f1, f1_, f2, f2_ @@ -759,15 +759,15 @@ // stack: g0, g0_, g1, g1_, g2, g2_ %endmacro -/// cost: 1 i9 (9) + 16 dups + 15 swaps + 12 muls + 6 adds/subs = 58 -/// -/// G0 + G1t + G2t^2 = (a+bi)t * (F0 + F1t + F2t^2) -/// = (c+di)F2 + (a+bi)F0t + (a+bi)F1t^2 -/// where c+di = (a+bi)(9+i) = (9a-b) + (a+9b)i -/// -/// G0 = (c+di)(f2+f2_i) = (cf2 - df2_) + (df2 + cf2_)i -/// G1 = (a+bi)(f0+f0_i) = (af0 - bf0_) + (bf0 + af0_)i -/// G2 = (a+bi)(f1+f1_i) = (af1 - bf1_) + (bf1 + af1_)i +// cost: 1 i9 (9) + 16 dups + 15 swaps + 12 muls + 6 adds/subs = 58 +// +// G0 + G1t + G2t^2 = (a+bi)t * (F0 + F1t + F2t^2) +// = (c+di)F2 + (a+bi)F0t + (a+bi)F1t^2 +// where c+di = (a+bi)(9+i) = (9a-b) + (a+9b)i +// +// G0 = (c+di)(f2+f2_i) = (cf2 - df2_) + (df2 + cf2_)i +// G1 = (a+bi)(f0+f0_i) = (af0 - bf0_) + (bf0 + af0_)i +// G2 = (a+bi)(f1+f1_i) = (af1 - bf1_) + (bf1 + af1_)i %macro scale_fp254_6_sh // stack: a, b, f0, f0_, f1, f1_, f2, f2_ @@ -853,15 +853,15 @@ // stack: g0, g0_, g1, g1_, g2, g2_ %endmacro -/// cost: 1 i9 (9) + 16 dups + 17 swaps + 12 muls + 6 adds/subs = 60 -/// -/// G0 + G1t + G2t^2 = (a+bi)t^2 * (F0 + F1t + F2t^2) -/// = (c+di)F1 + (c+di)F2t + (a+bi)F0t^2 -/// where c+di = (a+bi)(9+i) = (9a-b) + (a+9b)i -/// -/// G0 = (c+di)(f1+f1_i) = (cf1 - df1_) + (df1 + cf1_)i -/// G1 = (a+bi)(f2+f2_i) = (cf2 - df2_) + (df2 + cf2_)i -/// G2 = (a+bi)(f0+f0_i) = (af0 - bf0_) + (bf0 + af0_)i +// cost: 1 i9 (9) + 16 dups + 17 swaps + 12 muls + 6 adds/subs = 60 +// +// G0 + G1t + G2t^2 = (a+bi)t^2 * (F0 + F1t + F2t^2) +// = (c+di)F1 + (c+di)F2t + (a+bi)F0t^2 +// where c+di = (a+bi)(9+i) = (9a-b) + (a+9b)i +// +// G0 = (c+di)(f1+f1_i) = (cf1 - df1_) + (df1 + cf1_)i +// G1 = (a+bi)(f2+f2_i) = (cf2 - df2_) + (df2 + cf2_)i +// G2 = (a+bi)(f0+f0_i) = (af0 - bf0_) + (bf0 + af0_)i %macro scale_fp254_6_sh2 // stack: a, b, f0, f0_, f1, f1_, f2, f2_ @@ -1076,8 +1076,8 @@ // stack: %endmacro -/// moves fp254_12 from src..src+12 to dest..dest+12 -/// these should not overlap. leaves scaled DEST on stack +// moves fp254_12 from src..src+12 to dest..dest+12 +// these should not overlap. leaves scaled DEST on stack %macro move_fp254_12 // stack: src, dest PUSH @SEGMENT_BN_PAIRING diff --git a/evm_arithmetization/src/cpu/kernel/asm/curve/secp256k1/inverse_scalar.asm b/evm_arithmetization/src/cpu/kernel/asm/curve/secp256k1/inverse_scalar.asm index f10242bc3..b3e80c85c 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/curve/secp256k1/inverse_scalar.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/curve/secp256k1/inverse_scalar.asm @@ -1,4 +1,4 @@ -/// Division modulo 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141, the Secp256k1 scalar field order +// Division modulo 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141, the Secp256k1 scalar field order %macro mulmodn_secp_scalar // stack: x, y diff --git a/evm_arithmetization/src/cpu/kernel/asm/curve/secp256k1/moddiv.asm b/evm_arithmetization/src/cpu/kernel/asm/curve/secp256k1/moddiv.asm index f9fbd624b..080e27403 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/curve/secp256k1/moddiv.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/curve/secp256k1/moddiv.asm @@ -1,4 +1,4 @@ -/// Division modulo 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f, the Secp256k1 base field order +// Division modulo 0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f, the Secp256k1 base field order // Returns y * (x^-1) where the inverse is taken modulo N %macro moddiv_secp_base diff --git a/evm_arithmetization/src/cpu/kernel/asm/exp.asm b/evm_arithmetization/src/cpu/kernel/asm/exp.asm index 4b798e841..9e359c494 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/exp.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/exp.asm @@ -1,13 +1,13 @@ -/// Recursive implementation of exp. -/// Equivalent to: -/// def exp(x, e): -/// if e == 0: -/// # The path where JUMPI does not jump to `step_case` -/// return 1 -/// else: -/// # This is under the `step_case` label -/// return (x if e % 2 else 1) * exp(x * x, e // 2) -/// Note that this correctly handles exp(0, 0) == 1. +// Recursive implementation of exp. +// Equivalent to: +// def exp(x, e): +// if e == 0: +// # The path where JUMPI does not jump to `step_case` +// return 1 +// else: +// # This is under the `step_case` label +// return (x if e % 2 else 1) * exp(x * x, e // 2) +// Note that this correctly handles exp(0, 0) == 1. global exp: // stack: x, e, retdest @@ -19,7 +19,7 @@ global exp: // stack: e, retdest pop // stack: retdest - push 1 + PUSH 1 // stack: 1, retdest swap1 // stack: retdest, 1 @@ -29,7 +29,7 @@ step_case: // stack: x, e, retdest push recursion_return // stack: recursion_return, x, e, retdest - push 2 + PUSH 2 // stack: 2, recursion_return, x, e, retdest dup4 // stack: e, 2, recursion_return, x, e, retdest @@ -42,13 +42,13 @@ step_case: %jump(exp) recursion_return: // stack: exp(x * x, e / 2), x, e, retdest - push 2 + PUSH 2 // stack: 2, exp(x * x, e / 2), x, e, retdest dup4 // stack: e, 2, exp(x * x, e / 2), x, e, retdest mod // stack: e % 2, exp(x * x, e / 2), x, e, retdest - push 1 + PUSH 1 // stack: 1, e % 2, exp(x * x, e / 2), x, e, retdest dup4 // stack: x, 1, e % 2, exp(x * x, e / 2), x, e, retdest @@ -56,7 +56,7 @@ recursion_return: // stack: x - 1, e % 2, exp(x * x, e / 2), x, e, retdest mul // stack: (x - 1) * (e % 2), exp(x * x, e / 2), x, e, retdest - push 1 + PUSH 1 // stack: 1, (x - 1) * (e % 2), exp(x * x, e / 2), x, e, retdest add // stack: 1 + (x - 1) * (e % 2), exp(x * x, e / 2), x, e, retdest @@ -74,7 +74,7 @@ recursion_return: global sys_exp: %stack (return_info, x, e) -> (x, e, return_info) - push 0 + PUSH 0 // stack: shift, x, e, return_info %jump(sys_exp_gas_loop_enter) sys_exp_gas_loop: diff --git a/evm_arithmetization/src/cpu/kernel/asm/hash/ripemd/box.asm b/evm_arithmetization/src/cpu/kernel/asm/hash/ripemd/box.asm index 6cb16c6e8..555bd7c82 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/hash/ripemd/box.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/hash/ripemd/box.asm @@ -1,19 +1,19 @@ -/// Note that we unpack STATE: 5 to a, b, c, d, e -/// All additions are u32 -/// -/// def box(a, b, c, d, e, F, K): -/// -/// box = get_box(sides, rounds, boxes) -/// a += F(b, c, d) -/// r = load(r)(box) -/// x = load_offset(r) -/// a += x + K -/// s = load(s)(box) -/// a = rol(s, a) -/// a += e -/// c = rol(10, c) -/// -/// return e, a, b, c, d, F, K +// Note that we unpack STATE: 5 to a, b, c, d, e +// All additions are u32 +// +// def box(a, b, c, d, e, F, K): +// +// box = get_box(sides, rounds, boxes) +// a += F(b, c, d) +// r = load(r)(box) +// x = load_offset(r) +// a += x + K +// s = load(s)(box) +// a = rol(s, a) +// a += e +// c = rol(10, c) +// +// return e, a, b, c, d, F, K global box: // stack: a, b, c, d, e, F, K, boxes, rounds, sides, virt diff --git a/evm_arithmetization/src/cpu/kernel/asm/hash/ripemd/compression.asm b/evm_arithmetization/src/cpu/kernel/asm/hash/ripemd/compression.asm index a83bf8322..ebe403b65 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/hash/ripemd/compression.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/hash/ripemd/compression.asm @@ -1,25 +1,25 @@ -/// _block is stored in memory: its address virt stays on the stack -/// def compress(STATE: 5, _block): -/// -/// STATEL = STATE -/// STATEL = loop(STATEL) -/// -/// STATER = state -/// STATER = loop(STATER) -/// -/// return mix(STATER, STATEL, STATE) -/// -/// -/// def mix(STATER, STATEL, STATE): -/// return -/// u32(s1 + l2 + r3), -/// u32(s2 + l3 + r4), -/// u32(s3 + l4 + r0), -/// u32(s4 + l0 + r1), -/// u32(s0 + l1 + r2) -/// -/// where si, li, ri, oi, VR, RD respectively denote -/// STATE[i], STATEL[i], STATER[i], OUTPUT[i], virt, retdest +// _block is stored in memory: its address virt stays on the stack +// def compress(STATE: 5, _block): +// +// STATEL = STATE +// STATEL = loop(STATEL) +// +// STATER = state +// STATER = loop(STATER) +// +// return mix(STATER, STATEL, STATE) +// +// +// def mix(STATER, STATEL, STATE): +// return +// u32(s1 + l2 + r3), +// u32(s2 + l3 + r4), +// u32(s3 + l4 + r0), +// u32(s4 + l0 + r1), +// u32(s0 + l1 + r2) +// +// where si, li, ri, oi, VR, RD respectively denote +// STATE[i], STATEL[i], STATER[i], OUTPUT[i], virt, retdest global compress: // stack: STATE, virt, retdest @@ -96,21 +96,21 @@ mix: JUMP -/// def loop(STATE: 5): -/// while rounds: -/// update_round_vars() -/// round(STATE: 5, F, K, rounds, sides) -/// -/// def update_round_vars(): -/// F = load(F)(sides, rounds) -/// K = load(K)(sides, rounds) -/// -/// def round(STATE, rounds, sides): -/// while boxes: -/// box(STATE, F, K) -/// boxes -= 1 -/// boxes = 16 -/// rounds -= 1 +// def loop(STATE: 5): +// while rounds: +// update_round_vars() +// round(STATE: 5, F, K, rounds, sides) +// +// def update_round_vars(): +// F = load(F)(sides, rounds) +// K = load(K)(sides, rounds) +// +// def round(STATE, rounds, sides): +// while boxes: +// box(STATE, F, K) +// boxes -= 1 +// boxes = 16 +// rounds -= 1 loop: // stack: STATE, F, K, 16, rounds, sides, virt, retdest diff --git a/evm_arithmetization/src/cpu/kernel/asm/hash/ripemd/functions.asm b/evm_arithmetization/src/cpu/kernel/asm/hash/ripemd/functions.asm index de2fdcf62..40e634080 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/hash/ripemd/functions.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/hash/ripemd/functions.asm @@ -1,5 +1,5 @@ -/// def rol(n, x): -/// return (u32(x << n)) | (x >> (32 - n)) +// def rol(n, x): +// return (u32(x << n)) | (x >> (32 - n)) global rol: // stack: n, x, retdest @@ -61,8 +61,8 @@ global rol: // stack: (rnd==j)*F + acc, rnd %endmacro -/// def F0(x, y, z): -/// return x ^ y ^ z +// def F0(x, y, z): +// return x ^ y ^ z global F0: // stack: x , y , z, retdest @@ -73,8 +73,8 @@ global F0: SWAP1 JUMP -/// def F1(x, y, z): -/// return (x & y) | (u32(~x) & z) +// def F1(x, y, z): +// return (x & y) | (u32(~x) & z) global F1: // stack: x, y, z, retdest @@ -97,8 +97,8 @@ global F1: SWAP1 JUMP -/// def F2(x, y, z): -/// return (x | u32(~y)) ^ z +// def F2(x, y, z): +// return (x | u32(~y)) ^ z global F2: // stack: x , y, z, retdest @@ -113,8 +113,8 @@ global F2: SWAP1 JUMP -/// def F3(x, y, z): -/// return (x & z) | (u32(~z) & y) +// def F3(x, y, z): +// return (x & z) | (u32(~z) & y) global F3: // stack: x, y , z , retdest @@ -133,8 +133,8 @@ global F3: SWAP1 JUMP -/// def F4(x, y, z): -/// return x ^ (y | u32(~z)) +// def F4(x, y, z): +// return x ^ (y | u32(~z)) global F4: // stack: x, y, z, retdest diff --git a/evm_arithmetization/src/cpu/kernel/asm/hash/ripemd/main.asm b/evm_arithmetization/src/cpu/kernel/asm/hash/ripemd/main.asm index 19016127f..11650cc5d 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/hash/ripemd/main.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/hash/ripemd/main.asm @@ -1,19 +1,19 @@ -/// Variables beginning with _ are in memory -/// -/// def ripemd160(_input): -/// STATE, count, _buffer = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0], 0, [0]*64 -/// STATE, count, _buffer = ripemd_update(STATE, count, _buffer, len(input) , bytes = _input ) -/// STATE, count, _buffer = ripemd_update(STATE, count, _buffer, padlength(len(input)), bytes = [0x80]+[0]*63) -/// STATE, count, _buffer = ripemd_update(STATE, count, _buffer, 8, bytes = size(len(_input))) -/// return process(STATE) -/// -/// The hardcoded memory structure, where each register is only a byte, is given as follows -/// { 0-63: buffer, 64-71: bytes(8*len(_input)), 72-135: [0x80]+[0]*63 } -/// -/// ripemd_update receives and return the stack in the form: -/// stack: STATE, count, length, virt -/// where virt is the virtual address of the bytes argument -/// +// Variables beginning with _ are in memory +// +// def ripemd160(_input): +// STATE, count, _buffer = [0x67452301, 0xEFCDAB89, 0x98BADCFE, 0x10325476, 0xC3D2E1F0], 0, [0]*64 +// STATE, count, _buffer = ripemd_update(STATE, count, _buffer, len(input) , bytes = _input ) +// STATE, count, _buffer = ripemd_update(STATE, count, _buffer, padlength(len(input)), bytes = [0x80]+[0]*63) +// STATE, count, _buffer = ripemd_update(STATE, count, _buffer, 8, bytes = size(len(_input))) +// return process(STATE) +// +// The hardcoded memory structure, where each register is only a byte, is given as follows +// { 0-63: buffer, 64-71: bytes(8*len(_input)), 72-135: [0x80]+[0]*63 } +// +// ripemd_update receives and return the stack in the form: +// stack: STATE, count, length, virt +// where virt is the virtual address of the bytes argument +// global ripemd: // stack: virt, length @@ -102,9 +102,9 @@ process: JUMP -/// def padlength(length): -/// t = length % 64 -/// return 56 + 64*(t > 55) - t +// def padlength(length): +// t = length % 64 +// return 56 + 64*(t > 55) - t %macro padlength // stack: count diff --git a/evm_arithmetization/src/cpu/kernel/asm/hash/ripemd/update.asm b/evm_arithmetization/src/cpu/kernel/asm/hash/ripemd/update.asm index c5783cc71..6219ddf29 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/hash/ripemd/update.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/hash/ripemd/update.asm @@ -1,21 +1,21 @@ -/// ripemd_update will receive and return the stack in the form: -/// stack: STATE, count, length, virt -/// -/// def ripemd_update(state, count, buffer, length, bytestring): -/// have = (count // 8) % 64 -/// need = 64 - have -/// shift = 0 -/// P = length >= need and have -/// Q = length >= need -/// if P: -/// update_1() -/// if Q: -/// update_2() -/// R = length > shift -/// if R: -/// buffer_update(virt + shift, have, length - shift) -/// -/// return state, count + 8*length, buffer +// ripemd_update will receive and return the stack in the form: +// stack: STATE, count, length, virt +// +// def ripemd_update(state, count, buffer, length, bytestring): +// have = (count // 8) % 64 +// need = 64 - have +// shift = 0 +// P = length >= need and have +// Q = length >= need +// if P: +// update_1() +// if Q: +// update_2() +// R = length > shift +// if R: +// buffer_update(virt + shift, have, length - shift) +// +// return state, count + 8*length, buffer global ripemd_update: // stack: STATE, count, length, virt, retdest @@ -67,11 +67,11 @@ return_step: JUMP -/// def update_1(): -/// buffer_update(virt, have, need) -/// shift = need -/// have = 0 -/// state = compress(state, buffer) +// def update_1(): +// buffer_update(virt, have, need) +// shift = need +// have = 0 +// state = compress(state, buffer) update_1: // stack: Q, STATE, shift, need, have, count, length, virt, retdest @@ -83,10 +83,10 @@ update_1a: // stack: STATE, 0, update_2, shift = need, need, have = 0, count, length, virt, retdest %jump(compress) -/// def update_2(): -/// while length >= shift + 64: -/// shift += 64 -/// state = compress(state, bytestring[shift-64:]) +// def update_2(): +// while length >= shift + 64: +// shift += 64 +// state = compress(state, bytestring[shift-64:]) update_2: // stack: STATE, shift, need, have, count, length, virt, retdest @@ -108,9 +108,9 @@ update_2: %jump(compress) -/// def buffer_update(get, set, times): -/// for i in range(times): -/// buffer[set+i] = bytestring[get+i] +// def buffer_update(get, set, times): +// for i in range(times): +// buffer[set+i] = bytestring[get+i] buffer_update: // stack: get , set , times , retdest diff --git a/evm_arithmetization/src/cpu/kernel/asm/memory/metadata.asm b/evm_arithmetization/src/cpu/kernel/asm/memory/metadata.asm index 5ac85f1b3..adc6acaf1 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/memory/metadata.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/memory/metadata.asm @@ -277,7 +277,7 @@ global sys_basefee: SWAP1 EXIT_KERNEL -/// Blob-related macros are only available for Ethereum mainnet. +// Blob-related macros are only available for Ethereum mainnet. #[cfg(feature = eth_mainnet)] { global sys_blobhash: diff --git a/evm_arithmetization/src/cpu/kernel/asm/memory/transient_storage.asm b/evm_arithmetization/src/cpu/kernel/asm/memory/transient_storage.asm index 8aa32c3e2..78292e0cd 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/memory/transient_storage.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/memory/transient_storage.asm @@ -1,15 +1,15 @@ // Transient data storage -/// The transient storage is stored in an array. The length of the array is stored in the global metadata. -/// For storage keys, the address and key are stored as two consecutive elements. -/// The array is stored in the SEGMENT_TRANSIENT_STORAGE segment in the kernel memory (context=0). -/// Searching and inserting is done by doing a linear search through the array. -/// If the key isn't found in the array, it is inserted at the end. -/// TODO: Look into using a more efficient data structure. - -/// The initial length, 0, must be scaled by its segment for -/// comparison with the accumulator when iterating through the list. +// The transient storage is stored in an array. The length of the array is stored in the global metadata. +// For storage keys, the address and key are stored as two consecutive elements. +// The array is stored in the SEGMENT_TRANSIENT_STORAGE segment in the kernel memory (context=0). +// Searching and inserting is done by doing a linear search through the array. +// If the key isn't found in the array, it is inserted at the end. +// TODO: Look into using a more efficient data structure. + +// The initial length, 0, must be scaled by its segment for +// comparison with the accumulator when iterating through the list. %macro init_transient_storage_len PUSH @SEGMENT_TRANSIENT_STORAGE %mstore_global_metadata(@GLOBAL_METADATA_TRANSIENT_STORAGE_LEN) @@ -22,9 +22,9 @@ // stack: (is_present, pos, addr, key, val) %endmacro -/// Looks for an address, key pair into the transient storage. -/// Returns 1 and the position in @SEGMENT_TRANSIENT_STORAGE if present, -/// or 0 and @GLOBAL_METADATA_TRANSIENT_STORAGE_LEN if not. +// Looks for an address, key pair into the transient storage. +// Returns 1 and the position in @SEGMENT_TRANSIENT_STORAGE if present, +// or 0 and @GLOBAL_METADATA_TRANSIENT_STORAGE_LEN if not. global search_transient_storage: // stack: addr, key, retdest %mload_global_metadata(@GLOBAL_METADATA_TRANSIENT_STORAGE_LEN) diff --git a/evm_arithmetization/src/cpu/kernel/asm/mpt/linked_list/linked_list.asm b/evm_arithmetization/src/cpu/kernel/asm/mpt/linked_list/linked_list.asm index 650d69db2..29a021b1a 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/mpt/linked_list/linked_list.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/mpt/linked_list/linked_list.asm @@ -1,32 +1,32 @@ -/// Linked lists for accounts and storage slots. -/// The accounts linked list is stored in SEGMENT_ACCOUNTS_LINKED_LIST while the slots -/// are stored in SEGMENT_STORAGE_LINKED_LIST. The length of -/// the segments is stored in the associated global metadata. -/// Both arrays are stored in the kernel memory (context=0). -/// Searching and inserting is done by guessing the predecessor in the list. -/// If the address/storage key isn't found in the array, it is inserted -/// at the correct location. These linked lists are used to keep track of -/// inserted and deleted accounts/slots during the execution, so that the -/// initial and final MPT state tries can be reconstructed at the end of the execution. -/// An empty account linked list is written as -/// [@U256_MAX, _, _, @SEGMENT_ACCOUNTS_LINKED_LIST] in SEGMENT_ACCOUNTS_LINKED_LIST. -/// The linked list is preinitialized by appending accounts to the segment. Each account is encoded -/// using 4 values. -/// The values at the respective positions are: -/// - 0: The account key -/// - 1: A ptr to the payload (the account values) -/// - 2: A ptr to the initial payload. -/// - 3: A ptr (in segment @SEGMENT_ACCOUNTS_LINKED_LIST) to the next node in the list. -/// Similarly, an empty storage linked list is written as -/// [@U256_MAX, _, _, _, @SEGMENT_ACCOUNTS_LINKED_LIST] in SEGMENT_ACCOUNTS_LINKED_LIST. -/// The linked list is preinitialized by appending storage slots to the segment. -/// Each slot is encoded using 5 values. -/// The values at the respective positions are: -/// - 0: The account key -/// - 1: The slot key -/// - 2: The slot value. -/// - 3: The initial slot value. -/// - 4: A ptr (in segment @SEGMENT_ACCOUNTS_LINKED_LIST) to the next node in the list. +// Linked lists for accounts and storage slots. +// The accounts linked list is stored in SEGMENT_ACCOUNTS_LINKED_LIST while the slots +// are stored in SEGMENT_STORAGE_LINKED_LIST. The length of +// the segments is stored in the associated global metadata. +// Both arrays are stored in the kernel memory (context=0). +// Searching and inserting is done by guessing the predecessor in the list. +// If the address/storage key isn't found in the array, it is inserted +// at the correct location. These linked lists are used to keep track of +// inserted and deleted accounts/slots during the execution, so that the +// initial and final MPT state tries can be reconstructed at the end of the execution. +// An empty account linked list is written as +// [@U256_MAX, _, _, @SEGMENT_ACCOUNTS_LINKED_LIST] in SEGMENT_ACCOUNTS_LINKED_LIST. +// The linked list is preinitialized by appending accounts to the segment. Each account is encoded +// using 4 values. +// The values at the respective positions are: +// - 0: The account key +// - 1: A ptr to the payload (the account values) +// - 2: A ptr to the initial payload. +// - 3: A ptr (in segment @SEGMENT_ACCOUNTS_LINKED_LIST) to the next node in the list. +// Similarly, an empty storage linked list is written as +// [@U256_MAX, _, _, _, @SEGMENT_ACCOUNTS_LINKED_LIST] in SEGMENT_ACCOUNTS_LINKED_LIST. +// The linked list is preinitialized by appending storage slots to the segment. +// Each slot is encoded using 5 values. +// The values at the respective positions are: +// - 0: The account key +// - 1: The slot key +// - 2: The slot value. +// - 3: The initial slot value. +// - 4: A ptr (in segment @SEGMENT_ACCOUNTS_LINKED_LIST) to the next node in the list. %macro store_initial_accounts PUSH %%after @@ -34,15 +34,15 @@ %%after: %endmacro -/// Iterates over the initial account linked list and shallow copies -/// the accounts, storing a pointer to the copied account in the node. -/// Computes the length of `SEGMENT_ACCOUNTS_LINKED_LIST` and -/// stores it in `GLOBAL_METADATA_ACCOUNTS_LINKED_LIST_NEXT_AVAILABLE`. -/// It also checks that the next node address is current address + 4 -/// and that all keys are strictly increasing. -/// NOTE: It may be more efficient to check that the next node addres != U256_MAX -/// (i.e. node was not deleted) and ensure that no node with repeated key -/// is ever read. +// Iterates over the initial account linked list and shallow copies +// the accounts, storing a pointer to the copied account in the node. +// Computes the length of `SEGMENT_ACCOUNTS_LINKED_LIST` and +// stores it in `GLOBAL_METADATA_ACCOUNTS_LINKED_LIST_NEXT_AVAILABLE`. +// It also checks that the next node address is current address + 4 +// and that all keys are strictly increasing. +// NOTE: It may be more efficient to check that the next node addres != U256_MAX +// (i.e. node was not deleted) and ensure that no node with repeated key +// is ever read. global store_initial_accounts: // stack: retdest PUSH @ACCOUNTS_LINKED_LISTS_NODE_SIZE @@ -256,8 +256,8 @@ insert_new_account: JUMP -/// Searches the account addr in the linked list. -/// Returns 0 if the account was not found or `original_ptr` if it was already present. +// Searches the account addr in the linked list. +// Returns 0 if the account was not found or `original_ptr` if it was already present. global search_account: // stack: addr_key, retdest PROVER_INPUT(linked_list::search_account) @@ -311,8 +311,8 @@ account_not_found: %%after: %endmacro -/// Removes the address and its value from the access list. -/// Panics if the key is not in the list. +// Removes the address and its value from the access list. +// Panics if the key is not in the list. global remove_account: // stack: addr_key, retdest PROVER_INPUT(linked_list::remove_account) @@ -356,15 +356,15 @@ global remove_account: %endmacro -/// Iterates over the initial account linked list and shallow copies -/// the accounts, storing a pointer to the copied account in the node. -/// Computes the length of `SEGMENT_STORAGE_LINKED_LIST` and -/// checks against `GLOBAL_METADATA_STORAGE_LINKED_LIST_NEXT_AVAILABLE`. -/// It also checks that the next node address is current address + 5 -/// and that all keys are strictly increasing. -/// NOTE: It may be more efficient to check that the next node addres != U256_MAX -/// (i.e. node was not deleted) and ensure that no node with repeated key -/// is ever read. +// Iterates over the initial account linked list and shallow copies +// the accounts, storing a pointer to the copied account in the node. +// Computes the length of `SEGMENT_STORAGE_LINKED_LIST` and +// checks against `GLOBAL_METADATA_STORAGE_LINKED_LIST_NEXT_AVAILABLE`. +// It also checks that the next node address is current address + 5 +// and that all keys are strictly increasing. +// NOTE: It may be more efficient to check that the next node addres != U256_MAX +// (i.e. node was not deleted) and ensure that no node with repeated key +// is ever read. global store_initial_slots: // stack: retdest PUSH @STORAGE_LINKED_LISTS_NODE_SIZE @@ -486,8 +486,8 @@ store_initial_slots_end: %add_const(@SEGMENT_STORAGE_LINKED_LIST) %endmacro -/// Inserts the pair (address_key, storage_key) and a new payload pointer into the linked list if it is not already present, -/// or modifies its payload if it was already present. +// Inserts the pair (address_key, storage_key) and a new payload pointer into the linked list if it is not already present, +// or modifies its payload if it was already present. global insert_slot_with_value: // stack: addr_key, key, value, retdest PROVER_INPUT(linked_list::insert_slot) @@ -638,9 +638,9 @@ slot_found_write_value: // stack: (empty) %endmacro -/// Inserts the pair (address_key, storage_key) and payload pointer into the linked list if it is not already present, -/// or modifies its payload if it was already present. -/// Returns `value` if the storage key was inserted, `old_value` if it was already present. +// Inserts the pair (address_key, storage_key) and payload pointer into the linked list if it is not already present, +// or modifies its payload if it was already present. +// Returns `value` if the storage key was inserted, `old_value` if it was already present. global insert_slot: // stack: addr_key, key, value, retdest PROVER_INPUT(linked_list::insert_slot) @@ -782,8 +782,8 @@ next_node_ok: %stack (addr_key, key, value, retdest) -> (retdest, value) JUMP -/// Searches the pair (address_key, storage_key) in the storage the linked list. -/// Returns `value` if the storage key was inserted, `old_value` if it was already present. +// Searches the pair (address_key, storage_key) in the storage the linked list. +// Returns `value` if the storage key was inserted, `old_value` if it was already present. global search_slot: // stack: addr_key, key, value, retdest PROVER_INPUT(linked_list::search_slot) @@ -859,8 +859,8 @@ slot_found_no_write: %%after: %endmacro -/// Removes the storage key and its value from the list. -/// Panics if the key is not in the list. +// Removes the storage key and its value from the list. +// Panics if the key is not in the list. global remove_slot: // stack: addr_key, key, retdest PROVER_INPUT(linked_list::remove_slot) @@ -898,7 +898,7 @@ global remove_slot: %pop2 JUMP -/// Called when an account is deleted: it deletes all slots associated with the account. +// Called when an account is deleted: it deletes all slots associated with the account. global remove_all_account_slots: // stack: addr_key, retdest PROVER_INPUT(linked_list::remove_address_slots) diff --git a/evm_arithmetization/src/cpu/kernel/asm/shift.asm b/evm_arithmetization/src/cpu/kernel/asm/shift.asm index ee9ccbfae..4a1e00e4e 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/shift.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/shift.asm @@ -1,9 +1,9 @@ -/// Initialise the lookup table of binary powers for doing left/right shifts -/// -/// Specifically, set SHIFT_TABLE_SEGMENT[i] = 2^i for i = 0..255. +// Initialise the lookup table of binary powers for doing left/right shifts +// +// Specifically, set SHIFT_TABLE_SEGMENT[i] = 2^i for i = 0..255. %macro shift_table_init - push @SEGMENT_SHIFT_TABLE // segment, ctx == virt == 0 - push 1 // 2^0 + PUSH @SEGMENT_SHIFT_TABLE // segment, ctx == virt == 0 + PUSH 1 // 2^0 %rep 255 // stack: 2^i, addr_i dup2 diff --git a/evm_arithmetization/src/cpu/kernel/asm/signed.asm b/evm_arithmetization/src/cpu/kernel/asm/signed.asm index a9e9e3648..dfcf10f44 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/signed.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/signed.asm @@ -173,14 +173,14 @@ global _sys_slt: JUMP -/// These are the global entry-points for the signed system -/// calls. They just delegate to a subroutine with the same name -/// preceded by an underscore. -/// -/// NB: The only reason to structure things this way is so that the -/// test suite can call the _sys_opcode versions, since the test_suite -/// uses our interpreter which doesn't handle `EXIT_KERNEL` in a way -/// that allows for easy testing. The cost is two extra JUMPs per call. +// These are the global entry-points for the signed system +// calls. They just delegate to a subroutine with the same name +// preceded by an underscore. +// +// NB: The only reason to structure things this way is so that the +// test suite can call the _sys_opcode versions, since the test_suite +// uses our interpreter which doesn't handle `EXIT_KERNEL` in a way +// that allows for easy testing. The cost is two extra JUMPs per call. global sys_sdiv: %charge_gas_const(@GAS_LOW) diff --git a/evm_arithmetization/src/cpu/kernel/asm/transactions/common_decoding.asm b/evm_arithmetization/src/cpu/kernel/asm/transactions/common_decoding.asm index 6ee92ca2b..4a4518b20 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/transactions/common_decoding.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/transactions/common_decoding.asm @@ -244,7 +244,7 @@ sload_with_addr: SWAP1 JUMP -/// Type-3 transactions specific decoding helper macros. +// Type-3 transactions specific decoding helper macros. #[cfg(feature = eth_mainnet)] { %macro decode_and_store_max_fee_per_blob_gas diff --git a/evm_arithmetization/src/cpu/kernel/asm/util/basic_macros.asm b/evm_arithmetization/src/cpu/kernel/asm/util/basic_macros.asm index 657ee9760..a25c00d87 100644 --- a/evm_arithmetization/src/cpu/kernel/asm/util/basic_macros.asm +++ b/evm_arithmetization/src/cpu/kernel/asm/util/basic_macros.asm @@ -303,9 +303,9 @@ // stack: ceil(x / c), ... %endmacro -/// Same as `%as_u32`, but does not rely on -/// the AND operation. -/// *Note*: This is heavier, `%as_u32` should be preferred. +// Same as `%as_u32`, but does not rely on +// the AND operation. +// *Note*: This is heavier, `%as_u32` should be preferred. %macro as_u32_no_and // stack: word PUSH 0x100000000 diff --git a/evm_arithmetization/src/cpu/kernel/ast2.rs b/evm_arithmetization/src/cpu/kernel/ast2.rs new file mode 100644 index 000000000..76505740a --- /dev/null +++ b/evm_arithmetization/src/cpu/kernel/ast2.rs @@ -0,0 +1,623 @@ +//! Span-preserving AST for use by: +//! - The language server, for syntax highlighting, goto definition, etc. +//! - The rest of the compiler. +//! +//! Built on [`syn`], for simplicity. +//! +//! # Non-goals +//! - Representing trivia such as comments. This must be done in a separate step +//! in the language server, as the implementation complexity is not worth it. +//! - A Concrete Syntax Tree for formatting. +//! - Representing invalid parse trees. + +use derive_quote_to_tokens::ToTokens; +use derive_syn_parse::Parse; +use proc_macro2::TokenStream; +use quote::ToTokens; +use syn::ext::IdentExt as _; +use syn::parse::{Parse, ParseStream, Peek}; +use syn::punctuated::Punctuated; +use syn::{braced, bracketed, parenthesized, token, Token}; + +/// Keywords. +pub mod kw { + macro_rules! keywords { + ($($ident:ident),* $(,)?) => { + $( + ::syn::custom_keyword!($ident); + )* + + /// This is overly strict, but doesn't cost us much. + pub fn peek(input: ::syn::parse::ParseStream) -> bool { + false + $( + || input.peek($ident) + )* + } + }; + } + + keywords! { + all, + any, + BYTES, + cfg, + endmacro, + endrep, + feature, + GLOBAL, + JUMPTABLE, + not, + PROVER_INPUT, + PUSH, + rep, + stack, + } +} + +/// `%`-prefixed keywords. +pub mod pc { + use derive_quote_to_tokens::ToTokens; + use derive_syn_parse::Parse; + use syn::{parse::ParseStream, Token}; + + macro_rules! percent_then { + ($($ident:ident),* $(,)?) => { + $( + #[derive(::derive_syn_parse::Parse, ::derive_quote_to_tokens::ToTokens)] + #[allow(non_camel_case_types, unused)] + pub struct $ident { + pub percent: ::syn::Token![%], + pub $ident: super::kw::$ident, + } + + impl $ident { + pub fn peek(input: ::syn::parse::ParseStream) -> bool { + input.peek(::syn::Token![%]) + && input.peek2(super::kw::$ident) + } + } + )* + }; + } + + percent_then! { + endmacro, + endrep, + rep, + stack, + } + + #[derive(Parse, ToTokens)] + pub struct Macro { + pub percent: Token![%], + pub macro_: Token![macro], + } + + impl Macro { + pub fn peek(input: ParseStream) -> bool { + input.peek(Token![%]) && input.peek2(Token![macro]) + } + } +} + +pub mod pun { + //! Custom punctuation. + //! + //! We take care to preserve round-tripping the printed tokenstream for our + //! tests. + + use derive_quote_to_tokens::ToTokens; + use proc_macro2::{Punct, Spacing}; + use syn::parse::{Parse, ParseStream}; + + #[derive(ToTokens)] + pub struct Percent2 { + punct0: Punct, + punct1: Punct, + } + + impl Parse for Percent2 { + fn parse(input: ParseStream) -> syn::Result { + input.step(|cursor| { + match cursor + .punct() + .and_then(|(p0, next)| next.punct().map(|(p1, n)| (p0, p1, n))) + { + Some((punct0, punct1, n)) + if itertools::all([&punct0, &punct1], |it| it.as_char() == '%') + && punct0.spacing() == Spacing::Joint => + { + Ok((Percent2 { punct0, punct1 }, n)) + } + _ => Err(input.error("expected `%%`")), + } + }) + } + } + + impl Percent2 { + pub fn peek(input: ParseStream) -> bool { + input.fork().parse::().is_ok() + } + } +} + +pub struct File { + pub items: Vec, +} + +impl Parse for File { + fn parse(input: ParseStream) -> syn::Result { + let mut items = vec![]; + while !input.is_empty() { + items.push(input.parse()?) + } + Ok(Self { items }) + } +} + +impl ToTokens for File { + fn to_tokens(&self, tokens: &mut TokenStream) { + let Self { items } = self; + for item in items { + item.to_tokens(tokens); + } + } +} + +fn peek2(token: T) -> impl Fn(ParseStream) -> bool { + move |it| it.peek2(token) +} + +#[derive(ToTokens)] +pub struct Ident(syn::Ident); + +impl Parse for Ident { + fn parse(input: ParseStream) -> syn::Result { + if kw::peek(input) { + return Err(input.error("keywords may not be used as identifiers")); + } + Ok(Self(input.call(syn::Ident::parse_any)?)) + } +} + +impl Ident { + pub fn peek(input: ParseStream) -> bool { + input.fork().parse::().is_ok() + } +} + +pub type Literal = syn::LitInt; + +#[derive(Parse, ToTokens)] +pub struct Variable { + pub dollar: Token![$], + pub ident: Ident, +} + +#[derive(Parse, ToTokens)] +pub struct Constant { + pub at: Token![@], + pub ident: Ident, +} + +#[derive(Parse, ToTokens)] +pub enum Item { + #[peek(Token![#], name = "#[cfg(..)]")] + Cfg(CfgItems), + #[peek_with(pc::Macro::peek, name = "%macro")] + MacroDef(MacroDef), + #[peek_with(pc::rep::peek, name = "%rep")] + Repeat(Repeat), + #[peek_with(pc::stack::peek, name = "%stack")] + Stack(Stack), + #[peek_with(pun::Percent2::peek, name = "a `%%..` macro decl")] + MacroDecl(MacroDecl), + #[peek(Token![%], name = "MacroCall")] + MacroCall(MacroCall), + #[peek(kw::GLOBAL, name = "GLOBAL")] + GlobalDecl(GlobalDecl), + #[peek(kw::BYTES, name = "BYTES")] + Bytes(Bytes), + #[peek(kw::JUMPTABLE, name = "JUMPTABLE")] + Jumptable(Jumptable), + #[peek(kw::PUSH, name = "PUSH")] + Push(Push), + #[peek(kw::PROVER_INPUT, name = "PROVER_INPUT")] + ProverInput(ProverInput), + #[peek_with(peek2(Token![:]), name = "an `ident:` local decl")] + LocalDecl(LocalDecl), + #[peek_with(Ident::peek, name = "an `ident` instruction")] + Instruction(Instruction), +} + +#[derive(Parse, ToTokens)] +pub struct MacroLabel { + pub percent: pun::Percent2, + pub ident: Ident, +} + +#[derive(Parse, ToTokens)] +pub struct MacroDecl { + pub label: MacroLabel, + pub colon: Token![:], +} + +pub struct MacroDef { + pub macro_: pc::Macro, + pub ident: Ident, + pub param_list: Option, + pub items: Vec, + pub end_macro: pc::endmacro, +} + +impl Parse for MacroDef { + fn parse(input: ParseStream) -> syn::Result { + Ok(Self { + macro_: input.parse()?, + ident: input.parse()?, + param_list: match input.peek(token::Paren) { + true => Some(input.parse()?), + false => None, + }, + items: { + let mut items = vec![]; + while !pc::endmacro::peek(input) { + items.push(input.parse()?) + } + items + }, + end_macro: input.parse()?, + }) + } +} + +impl ToTokens for MacroDef { + fn to_tokens(&self, tokens: &mut TokenStream) { + let Self { + macro_, + ident, + param_list, + items, + end_macro, + } = self; + macro_.to_tokens(tokens); + ident.to_tokens(tokens); + if let Some(param_list) = param_list { + param_list.to_tokens(tokens); + } + for item in items { + item.to_tokens(tokens) + } + end_macro.to_tokens(tokens); + } +} + +#[derive(Parse)] +pub struct ParamList { + #[paren] + pub paren: token::Paren, + #[inside(paren)] + #[call(Punctuated::parse_terminated)] + pub args: Punctuated, +} + +impl ToTokens for ParamList { + fn to_tokens(&self, tokens: &mut TokenStream) { + let Self { paren, args } = self; + paren.surround(tokens, |tokens| args.to_tokens(tokens)); + } +} + +#[derive(Parse, ToTokens)] +pub struct MacroCall { + pub percent: Token![%], + pub ident: Ident, + #[peek(token::Paren)] + pub macro_args: Option, +} + +#[derive(Parse)] +pub struct MacroArgs { + #[paren] + pub paren: token::Paren, + #[inside(paren)] + #[call(Punctuated::parse_terminated)] + pub args: Punctuated, +} + +impl ToTokens for MacroArgs { + fn to_tokens(&self, tokens: &mut TokenStream) { + let Self { paren, args } = self; + paren.surround(tokens, |tokens| args.to_tokens(tokens)); + } +} + +#[derive(Parse, ToTokens)] +pub enum Target { + #[peek(syn::LitInt, name = "Literal")] + Literal(Literal), + #[peek_with(Ident::peek, name = "Ident")] + Ident(Ident), + #[peek_with(pun::Percent2::peek, name = "a `%%..` macro label")] + MacroLabel(MacroLabel), + #[peek(Token![$], name = "a `$..` variable")] + Variable(Variable), + #[peek(Token![@], name = "a `@..` constant")] + Constant(Constant), +} + +pub struct Repeat { + pub rep: pc::rep, + pub literal: Literal, + pub items: Vec, + pub endrep: pc::endrep, +} + +impl Parse for Repeat { + fn parse(input: ParseStream) -> syn::Result { + Ok(Self { + rep: input.parse()?, + literal: input.parse()?, + items: { + let mut items = vec![]; + while !pc::endrep::peek(input) { + items.push(input.parse()?) + } + items + }, + endrep: input.parse()?, + }) + } +} + +impl ToTokens for Repeat { + fn to_tokens(&self, tokens: &mut TokenStream) { + let Self { + rep, + literal, + items, + endrep, + } = self; + rep.to_tokens(tokens); + literal.to_tokens(tokens); + for item in items { + item.to_tokens(tokens); + } + endrep.to_tokens(tokens); + } +} + +#[derive(Parse)] +pub struct Stack { + pub stack: pc::stack, + #[paren] + pub placeholders_paren: token::Paren, + #[inside(placeholders_paren)] + #[call(Punctuated::parse_terminated)] + pub placeholders: Punctuated, + pub arrow: Token![->], + #[paren] + pub replacements_paren: token::Paren, + #[inside(replacements_paren)] + #[call(Punctuated::parse_terminated)] + pub replacements: Punctuated, +} + +impl ToTokens for Stack { + fn to_tokens(&self, tokens: &mut TokenStream) { + let Self { + stack, + placeholders_paren, + placeholders, + arrow, + replacements_paren, + replacements, + } = self; + stack.to_tokens(tokens); + placeholders_paren.surround(tokens, |tokens| placeholders.to_tokens(tokens)); + arrow.to_tokens(tokens); + replacements_paren.surround(tokens, |tokens| replacements.to_tokens(tokens)); + } +} + +#[derive(Parse, ToTokens)] +pub enum Placeholder { + #[peek_with(peek2(Token![:]), name = "an `ident:` block")] + Block(Block), + #[peek_with(Ident::peek, name = "an ident")] + Ident(Ident), +} + +#[derive(Parse, ToTokens)] +pub struct Block { + pub ident: Ident, + pub colon: Token![:], + pub number: Literal, +} + +#[derive(Parse, ToTokens)] +pub struct GlobalDecl { + pub global: kw::GLOBAL, + pub ident: Ident, + pub colon: Token![:], +} + +#[derive(Parse, ToTokens)] +pub struct LocalDecl { + pub ident: Ident, + pub colon: Token![:], +} + +#[derive(Parse, ToTokens)] +pub struct Bytes { + pub bytes: kw::BYTES, + #[call(Punctuated::parse_separated_nonempty)] + pub components: Punctuated, +} + +#[derive(Parse, ToTokens)] +pub enum LiteralOrConstant { + #[peek(syn::LitInt, name = "a literal")] + Literal(Literal), + #[peek(Token![@], name = "a `@..` constant")] + Constant(Constant), +} + +#[derive(Parse, ToTokens)] +pub struct Jumptable { + pub jumptable: kw::JUMPTABLE, + #[call(Punctuated::parse_separated_nonempty)] + pub idents: Punctuated, +} + +#[derive(Parse, ToTokens)] +pub struct Push { + pub push: kw::PUSH, + pub target: Target, +} + +#[derive(Parse)] +pub struct ProverInput { + pub prover_input: kw::PROVER_INPUT, + #[paren] + pub paren: token::Paren, + #[inside(paren)] + #[call(Punctuated::parse_separated_nonempty)] + pub function: Punctuated, +} + +impl ToTokens for ProverInput { + fn to_tokens(&self, tokens: &mut TokenStream) { + let Self { + prover_input, + paren, + function, + } = self; + prover_input.to_tokens(tokens); + paren.surround(tokens, |tokens| function.to_tokens(tokens)); + } +} + +#[derive(Parse, ToTokens)] +pub struct Instruction { + pub ident: Ident, +} + +pub struct Cfg { + pub pound: Token![#], + pub bracket: token::Bracket, + pub cfg: kw::cfg, + pub paren: token::Paren, + pub op: Option<(CfgOp, token::Paren)>, + pub feature: kw::feature, + pub eq: Token![=], + pub features: Punctuated, +} + +impl Parse for Cfg { + fn parse(input: ParseStream) -> syn::Result { + let attr; + let mut meta; + Ok(Self { + pound: input.parse()?, + bracket: bracketed!(attr in input), + cfg: attr.parse()?, + paren: parenthesized!(meta in attr), + op: { + match CfgOp::peek(&meta) { + true => Some((meta.parse()?, parenthesized!(meta in meta))), + false => None, + } + }, + feature: meta.parse()?, + eq: meta.parse()?, + features: meta.call(Punctuated::parse_separated_nonempty)?, + }) + } +} + +impl ToTokens for Cfg { + fn to_tokens(&self, tokens: &mut TokenStream) { + let Self { + pound, + bracket, + cfg, + paren, + op, + feature, + eq, + features, + } = self; + pound.to_tokens(tokens); + bracket.surround(tokens, |tokens| { + cfg.to_tokens(tokens); + paren.surround(tokens, |tokens| { + let inner = |tokens: &mut TokenStream| { + feature.to_tokens(tokens); + eq.to_tokens(tokens); + features.to_tokens(tokens); + }; + match op { + Some((op, paren)) => { + op.to_tokens(tokens); + paren.surround(tokens, inner); + } + None => inner(tokens), + } + }); + }); + } +} + +#[derive(Parse, ToTokens)] +pub enum CfgOp { + #[peek(kw::not, name = "not")] + Not(kw::not), + #[peek(kw::all, name = "all")] + All(kw::all), + #[peek(kw::any, name = "any")] + Any(kw::any), +} + +impl CfgOp { + pub fn peek(input: ParseStream) -> bool { + input.fork().parse::().is_ok() + } +} + +pub struct CfgItems { + pub cfg: Cfg, + pub brace: token::Brace, + pub items: Vec, +} + +impl Parse for CfgItems { + fn parse(input: ParseStream) -> syn::Result { + let content; + Ok(Self { + cfg: input.parse()?, + brace: braced!(content in input), + items: { + let mut items = vec![]; + while !content.is_empty() { + items.push(content.parse()?); + } + items + }, + }) + } +} + +impl ToTokens for CfgItems { + fn to_tokens(&self, tokens: &mut TokenStream) { + let Self { cfg, brace, items } = self; + cfg.to_tokens(tokens); + brace.surround(tokens, |tokens| { + for item in items { + item.to_tokens(tokens); + } + }); + } +} diff --git a/evm_arithmetization/src/cpu/kernel/mod.rs b/evm_arithmetization/src/cpu/kernel/mod.rs index 8a2f4317b..dcec9ed3b 100644 --- a/evm_arithmetization/src/cpu/kernel/mod.rs +++ b/evm_arithmetization/src/cpu/kernel/mod.rs @@ -1,6 +1,7 @@ pub mod aggregator; pub mod assembler; mod ast; +pub mod ast2; pub(crate) mod constants; mod cost_estimator; pub(crate) mod keccak_util; diff --git a/evm_arithmetization/tests/parse.rs b/evm_arithmetization/tests/parse.rs new file mode 100644 index 000000000..717e8a038 --- /dev/null +++ b/evm_arithmetization/tests/parse.rs @@ -0,0 +1,42 @@ +use std::fs; + +use anyhow::Context as _; +use camino::Utf8Path; +use evm_arithmetization::cpu::kernel::ast2; +use libtest_mimic::{Arguments, Failed, Trial}; +use pretty_assertions::StrComparison; +use proc_macro2::TokenStream; +use quote::ToTokens; + +fn main() -> anyhow::Result<()> { + let mut trials = vec![]; + let asm_folder = Utf8Path::new(concat!(env!("CARGO_MANIFEST_DIR"), "/src/cpu/kernel/asm/",)); + for entry in glob::glob(&format!("{asm_folder}/**/*.asm"))? { + let path = entry?; + let path = Utf8Path::from_path(&path).context("invalid path")?; + let friendly = path.strip_prefix(asm_folder).unwrap_or(path); + let source = fs::read_to_string(path)?; + + trials.push(Trial::test( + friendly.to_owned(), + move || match syn::parse_str::(&source) { + Ok(file) => { + let source_tokens = source + .parse::() + .expect("lexing must have succeeded if parsing succeeded") + .to_string(); + let parsed_tokens = file.to_token_stream().to_string(); + match source_tokens == parsed_tokens { + true => Ok(()), + false => Err(Failed::from(StrComparison::new( + &source_tokens, + &parsed_tokens, + ))), + } + } + Err(e) => Err(Failed::from(syn_miette::Error::new(e, source).render())), + }, + )); + } + libtest_mimic::run(&Arguments::from_args(), trials).exit() +}