diff --git a/Cargo.lock b/Cargo.lock index 5e54b9da..e85321c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" dependencies = [ "gimli", ] @@ -87,7 +87,7 @@ dependencies = [ "indexmap 1.9.3", "indoc", "insta", - "itertools", + "itertools 0.10.5", "miette 7.2.0", "num-bigint", "ordinal", @@ -110,7 +110,7 @@ dependencies = [ "aiken-project", "crossbeam-channel", "indoc", - "itertools", + "itertools 0.10.5", "lsp-server", "lsp-types", "miette 7.2.0", @@ -141,7 +141,7 @@ dependencies = [ "indexmap 1.9.3", "indoc", "insta", - "itertools", + "itertools 0.10.5", "miette 7.2.0", "notify", "num-bigint", @@ -180,47 +180,48 @@ checksum = "5c6cb57a04249c6480766f7f7cef5467412af1490f8d1e243141daddada3264f" [[package]] name = "anstream" -version = "0.6.13" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d96bd03f33fe50a863e394ee9718a706f988b9079b20c3784fb726e7678b62fb" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" dependencies = [ "anstyle", "anstyle-parse", "anstyle-query", "anstyle-wincon", "colorchoice", + "is_terminal_polyfill", "utf8parse", ] [[package]] name = "anstyle" -version = "1.0.6" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" [[package]] name = "anstyle-parse" -version = "0.2.3" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.2" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" dependencies = [ "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.2" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" dependencies = [ "anstyle", "windows-sys 0.52.0", @@ -258,7 +259,7 @@ dependencies = [ "proc-macro2", "quote", "serde", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] @@ -289,15 +290,15 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1fdabc7756949593fe60f30ec81974b613357de856987752631dea1e3394c80" +checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" -version = "0.3.71" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" dependencies = [ "addr2line", "cc", @@ -379,9 +380,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "block-buffer" @@ -394,9 +395,9 @@ dependencies = [ [[package]] name = "blst" -version = "0.3.11" +version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c94087b935a822949d3291a9989ad2b2051ea141eda0fd4e478a75f6aa3e604b" +checksum = "4378725facc195f1a538864863f6de233b500a8862747e7f165078a419d5e874" dependencies = [ "cc", "glob", @@ -406,9 +407,9 @@ dependencies = [ [[package]] name = "bstr" -version = "1.9.1" +version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05efc5cfd9110c8416e471df0e96702d58690178e206e61b7173706673c93706" +checksum = "40723b8fb387abc38f4f4a37c09073622e41dd12327033091ef8950659e6dc0c" dependencies = [ "memchr", "serde", @@ -416,9 +417,9 @@ dependencies = [ [[package]] name = "built" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41bfbdb21256b87a8b5e80fab81a8eed158178e812fd7ba451907518b2742f16" +checksum = "236e6289eda5a812bc6b53c3b024039382a2895fbbeef2d748b2931546d392c4" dependencies = [ "git2", ] @@ -437,9 +438,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" [[package]] name = "bzip2" @@ -464,13 +465,12 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.95" +version = "1.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d32a725bc159af97c3e629873bb9f88fb8cf8a4867175f76dc987815ea07c83b" +checksum = "504bdec147f2cc13c8b57ed9401fd8a147cc66b67ad5cb241394244f2c947549" dependencies = [ "jobserver", "libc", - "once_cell", ] [[package]] @@ -528,9 +528,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.4" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +checksum = "0fbb260a053428790f3de475e304ff84cdbc4face759ea7a3e64c1edd938a7fc" dependencies = [ "clap_builder", "clap_derive", @@ -538,9 +538,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.2" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +checksum = "64b17d7ea74e9f833c7dbf2cbe4fb12ff26783eda4782a8975b72f895c9b4d99" dependencies = [ "anstream", "anstyle", @@ -553,36 +553,36 @@ dependencies = [ [[package]] name = "clap_complete" -version = "4.5.2" +version = "4.5.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd79504325bf38b10165b02e89b4347300f855f273c4cb30c4a3209e6583275e" +checksum = "a8670053e87c316345e384ca1f3eba3006fc6355ed8b8a1140d104e109e3df34" dependencies = [ "clap", ] [[package]] name = "clap_derive" -version = "4.5.4" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] name = "clap_lex" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" [[package]] name = "colorchoice" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" [[package]] name = "console" @@ -650,18 +650,18 @@ checksum = "19d374276b40fb8bbdee95aef7c7fa6b5316ec764510eb64b8dd0e2ed0d7e7f5" [[package]] name = "crc32fast" -version = "1.4.0" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b3855a8a784b474f333699ef2bbca9db2c4a1f6d9088a90a2d25b1eb53111eaa" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" dependencies = [ "cfg-if", ] [[package]] name = "crossbeam-channel" -version = "0.5.12" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" dependencies = [ "crossbeam-utils", ] @@ -687,9 +687,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.19" +version = "0.8.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" +checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" [[package]] name = "crossterm" @@ -700,7 +700,7 @@ dependencies = [ "bitflags 1.3.2", "crossterm_winapi", "libc", - "mio", + "mio 0.8.11", "parking_lot", "signal-hook", "signal-hook-mio", @@ -829,9 +829,9 @@ dependencies = [ [[package]] name = "either" -version = "1.11.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "elliptic-curve" @@ -875,9 +875,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.8" +version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" dependencies = [ "libc", "windows-sys 0.52.0", @@ -919,9 +919,9 @@ checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" -version = "1.0.29" +version = "1.0.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4556222738635b7a3417ae6130d8f52201e45a0c4d1a907f0826383adb5f85e7" +checksum = "7f211bbe8e69bbd0cfdea405084f128ae8b4aaa6b0b522fc8f2b009084797920" dependencies = [ "crc32fast", "miniz_oxide", @@ -1032,7 +1032,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] @@ -1078,9 +1078,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.14" +version = "0.2.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94b22e06ecb0110981051723910cbf0b5f5e09a2062dd7663334ee79a9d1286c" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", @@ -1089,17 +1089,17 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "git2" -version = "0.18.3" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "232e6a7bfe35766bf715e55a88b39a700596c0ccfd88cd3680b4cdb40d66ef70" +checksum = "b903b73e45dc0c6c596f2d37eccece7c1c8bb6e4407b001096387c63d0d93724" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "libc", "libgit2-sys", "log", @@ -1148,7 +1148,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap 2.2.6", + "indexmap 2.3.0", "slab", "tokio", "tokio-util", @@ -1253,9 +1253,9 @@ dependencies = [ [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "httpdate" @@ -1274,9 +1274,9 @@ dependencies = [ [[package]] name = "hyper" -version = "0.14.28" +version = "0.14.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" +checksum = "a152ddd61dfaec7273fe8419ab357f33aee0d914c5f4efbf0d96fa749eea5ec9" dependencies = [ "bytes", "futures-channel", @@ -1347,9 +1347,9 @@ dependencies = [ [[package]] name = "indexmap" -version = "2.2.6" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "de3fc2e30ba82dd1b3911c8de1ffc143c74a914a14e99514d7637e3099df5ea0" dependencies = [ "equivalent", "hashbrown 0.14.5", @@ -1408,9 +1408,9 @@ dependencies = [ [[package]] name = "insta" -version = "1.38.0" +version = "1.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3eab73f58e59ca6526037208f0e98851159ec1633cf17b6cd2e1f2c3fd5d53cc" +checksum = "810ae6042d48e2c9e9215043563a58a80b877bc863228a74cf10c49d4620a6f5" dependencies = [ "console", "lazy_static", @@ -1433,6 +1433,12 @@ 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" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" + [[package]] name = "itertools" version = "0.10.5" @@ -1442,6 +1448,15 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + [[package]] name = "itoa" version = "1.0.11" @@ -1450,9 +1465,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" dependencies = [ "libc", ] @@ -1480,15 +1495,6 @@ dependencies = [ "signature", ] -[[package]] -name = "keccak" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" -dependencies = [ - "cpufeatures", -] - [[package]] name = "kqueue" version = "1.0.8" @@ -1511,21 +1517,21 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.153" +version = "0.2.155" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" +checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libgit2-sys" -version = "0.16.2+1.7.2" +version = "0.17.0+1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee4126d8b4ee5c9d9ea891dd875cfdc1e9d0950437179104b183d7d8a74d24e8" +checksum = "10472326a8a6477c3c20a64547b0059e4b0d086869eee31e6d7da728a8eb7224" dependencies = [ "cc", "libc", @@ -1545,15 +1551,15 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "libc", ] [[package]] name = "libz-sys" -version = "1.1.16" +version = "1.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e143b5e666b2695d28f6bca6497720813f699c9602dd7f5cac91008b8ada7f9" +checksum = "c15da26e5af7e25c90b37a2d75cdbf940cf4a55316de9d84c679c9b8bfabf82e" dependencies = [ "cc", "libc", @@ -1569,9 +1575,9 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lock_api" @@ -1585,9 +1591,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "lsp-server" @@ -1616,9 +1622,9 @@ dependencies = [ [[package]] name = "memchr" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "miette" @@ -1660,7 +1666,7 @@ checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] @@ -1671,7 +1677,7 @@ checksum = "dcf09caffaac8068c346b6df2a7fc27a177fd20b39421a39ce0a211bde679a6c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] @@ -1682,9 +1688,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "mime_guess" -version = "2.0.4" +version = "2.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4192263c238a5f0d0c6bfd21f336a313a4ce1c450542449ca191bb657b4642ef" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" dependencies = [ "mime", "unicase", @@ -1719,9 +1725,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", ] @@ -1739,12 +1745,23 @@ dependencies = [ ] [[package]] -name = "native-tls" -version = "0.2.11" +name = "mio" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +checksum = "4569e456d394deccd22ce1c1913e6ea0e54519f577285001215d33557431afe4" +dependencies = [ + "hermit-abi 0.3.9", + "libc", + "wasi", + "windows-sys 0.52.0", +] + +[[package]] +name = "native-tls" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" dependencies = [ - "lazy_static", "libc", "log", "openssl", @@ -1781,7 +1798,7 @@ version = "6.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "crossbeam-channel", "filetime", "fsevent-sys", @@ -1789,18 +1806,17 @@ dependencies = [ "kqueue", "libc", "log", - "mio", + "mio 0.8.11", "walkdir", "windows-sys 0.48.0", ] [[package]] name = "num-bigint" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "608e7659b5c3d7cba262d894801b9ec9d00de989e8a82bd4bef91d08da45cdc0" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" dependencies = [ - "autocfg", "num-integer", "num-traits", ] @@ -1822,9 +1838,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" dependencies = [ "autocfg", "libm", @@ -1842,9 +1858,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.2" +version = "0.36.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" dependencies = [ "memchr", ] @@ -1857,11 +1873,11 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "openssl" -version = "0.10.64" +version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" +checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cfg-if", "foreign-types", "libc", @@ -1878,7 +1894,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] @@ -1889,9 +1905,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.102" +version = "0.9.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" +checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" dependencies = [ "cc", "libc", @@ -1925,25 +1941,23 @@ checksum = "caff54706df99d2a78a5a4e3455ff45448d81ef1bb63c22cd14052ca0e993a3f" [[package]] name = "pallas-addresses" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a186bac65200a9b720326082b2bd64fe2f0f9284e8709c70fa16d9f9aeed89e6" +version = "0.29.0" +source = "git+https://github.com/KtorZ/pallas.git?rev=8ea5a1adc9919b70b213dfe597e920d6e113120c#8ea5a1adc9919b70b213dfe597e920d6e113120c" dependencies = [ "base58", "bech32", "crc", + "cryptoxide", "hex", "pallas-codec", "pallas-crypto", - "sha3", "thiserror", ] [[package]] name = "pallas-codec" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4530d1a558070d6b46bfd68cfd77f3a7b2cff3b4426b32ad9f02ff270387b248" +version = "0.29.0" +source = "git+https://github.com/KtorZ/pallas.git?rev=8ea5a1adc9919b70b213dfe597e920d6e113120c#8ea5a1adc9919b70b213dfe597e920d6e113120c" dependencies = [ "hex", "minicbor", @@ -1954,9 +1968,8 @@ dependencies = [ [[package]] name = "pallas-crypto" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12dd0ccf9909e47c1273000eb11945b3d909356c0f0fd2a380f49ced849d2c77" +version = "0.29.0" +source = "git+https://github.com/KtorZ/pallas.git?rev=8ea5a1adc9919b70b213dfe597e920d6e113120c#8ea5a1adc9919b70b213dfe597e920d6e113120c" dependencies = [ "cryptoxide", "hex", @@ -1968,9 +1981,8 @@ dependencies = [ [[package]] name = "pallas-primitives" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb19819e37c14cafa0a5bba51cd2966b07b72399a8096910f48e34d49c05adf1" +version = "0.29.0" +source = "git+https://github.com/KtorZ/pallas.git?rev=8ea5a1adc9919b70b213dfe597e920d6e113120c#8ea5a1adc9919b70b213dfe597e920d6e113120c" dependencies = [ "base58", "bech32", @@ -1984,11 +1996,11 @@ dependencies = [ [[package]] name = "pallas-traverse" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebf62cdadb4d9d15b390fd540fc639fcbeaf3875a6bee490c104d305426cb262" +version = "0.29.0" +source = "git+https://github.com/KtorZ/pallas.git?rev=8ea5a1adc9919b70b213dfe597e920d6e113120c#8ea5a1adc9919b70b213dfe597e920d6e113120c" dependencies = [ "hex", + "itertools 0.13.0", "pallas-addresses", "pallas-codec", "pallas-crypto", @@ -2000,9 +2012,9 @@ dependencies = [ [[package]] name = "parking_lot" -version = "0.12.2" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" dependencies = [ "lock_api", "parking_lot_core", @@ -2016,9 +2028,9 @@ checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.5.1", + "redox_syscall 0.5.3", "smallvec", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -2044,7 +2056,7 @@ version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "31f2f4539bffe53fc4b4da301df49d114b845b077bd5727b7fe2bd9d8df2ae68" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", ] [[package]] @@ -2061,9 +2073,9 @@ dependencies = [ [[package]] name = "peg" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a625d12ad770914cbf7eff6f9314c3ef803bfe364a1b20bc36ddf56673e71e5" +checksum = "295283b02df346d1ef66052a757869b2876ac29a6bb0ac3f5f7cd44aebe40e8f" dependencies = [ "peg-macros", "peg-runtime", @@ -2071,9 +2083,9 @@ dependencies = [ [[package]] name = "peg-macros" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f241d42067ed3ab6a4fece1db720838e1418f36d868585a27931f95d6bc03582" +checksum = "bdad6a1d9cf116a059582ce415d5f5566aabcd4008646779dab7fdc2a9a9d426" dependencies = [ "peg-runtime", "proc-macro2", @@ -2123,7 +2135,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] @@ -2139,12 +2151,12 @@ dependencies = [ [[package]] name = "petgraph" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" +checksum = "b4c5cc86750666a3ed20bdaf5ca2a0344f9c67674cae0515bec2da16fbaa47db" dependencies = [ "fixedbitset", - "indexmap 2.2.6", + "indexmap 2.3.0", ] [[package]] @@ -2183,9 +2195,12 @@ checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" [[package]] name = "ppv-lite86" -version = "0.2.17" +version = "0.2.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] [[package]] name = "pretty" @@ -2211,22 +2226,22 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.81" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1597b0c024618f09a9c3b8655b7e430397a36d23fdafec26d6965e9eec3eba" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] [[package]] name = "proptest" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31b476131c3c86cb68032fdc5cb6d5a1045e3e42d96b69fa599fd77701e1f5bf" +checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" dependencies = [ "bit-set", "bit-vec", - "bitflags 2.5.0", + "bitflags 2.6.0", "lazy_static", "num-traits", "rand", @@ -2253,7 +2268,7 @@ version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57206b407293d2bcd3af849ce869d52068623f19e1b5ff8e8778e3309439682b" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "memchr", "unicase", ] @@ -2343,11 +2358,11 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.5.1" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e" +checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", ] [[package]] @@ -2363,9 +2378,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.4" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", @@ -2375,9 +2390,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", @@ -2386,9 +2401,9 @@ dependencies = [ [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "reqwest" @@ -2442,9 +2457,9 @@ dependencies = [ [[package]] name = "rustc-demangle" -version = "0.1.23" +version = "0.1.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" [[package]] name = "rustix" @@ -2452,7 +2467,7 @@ version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", @@ -2470,9 +2485,9 @@ dependencies = [ [[package]] name = "rustversion" -version = "1.0.15" +version = "1.0.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80af6f9131f277a45a3fba6ce8e2258037bb0477a67e610d3c1fe046ab31de47" +checksum = "955d28af4278de8121b7ebeb796b6a45735dc01436d898801014aced2773a3d6" [[package]] name = "rusty-fork" @@ -2488,9 +2503,9 @@ dependencies = [ [[package]] name = "ryu" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e86697c916019a8588c99b5fac3cead74ec0b4b819707a682fd4d23fa0ce1ba1" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" [[package]] name = "same-file" @@ -2550,11 +2565,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.10.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "770452e37cad93e0a50d5abc3990d2bc351c36d0328f86cefec2f2fb206eaef6" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", "core-foundation", "core-foundation-sys", "libc", @@ -2563,9 +2578,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.10.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41f3cc463c0ef97e11c3461a9d3787412d30e8e7eb907c79180c4a57bf7c04ef" +checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" dependencies = [ "core-foundation-sys", "libc", @@ -2582,32 +2597,33 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.199" +version = "1.0.205" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c9f6e76df036c77cd94996771fb40db98187f096dd0b9af39c6c6e452ba966a" +checksum = "e33aedb1a7135da52b7c21791455563facbbcc43d0f0f66165b42c21b3dfb150" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.199" +version = "1.0.205" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "11bd257a6541e141e42ca6d24ae26f7714887b47e89aa739099104c7e4d3b7fc" +checksum = "692d6f5ac90220161d6774db30c662202721e64aed9058d2c394f451261420c1" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] name = "serde_json" -version = "1.0.116" +version = "1.0.122" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e17db7126d17feb94eb3fad46bf1a96b034e8aacbc2e775fe81505f8b0b2813" +checksum = "784b6203951c57ff748476b126ccb5e8e2959a5c19e5c617ab1956be3dbc68da" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.3.0", "itoa", + "memchr", "ryu", "serde", ] @@ -2620,14 +2636,14 @@ checksum = "6c64451ba24fc7a6a2d60fc75dd9c83c90903b19028d4eff35e88fc1e86564e9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] name = "serde_spanned" -version = "0.6.5" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" +checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" dependencies = [ "serde", ] @@ -2666,16 +2682,6 @@ dependencies = [ "digest", ] -[[package]] -name = "sha3" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" -dependencies = [ - "digest", - "keccak", -] - [[package]] name = "signal-hook" version = "0.3.17" @@ -2688,12 +2694,12 @@ dependencies = [ [[package]] name = "signal-hook-mio" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29ad2e15f37ec9a6cc544097b78a1ec90001e9f71b81338ca39f430adaca99af" +checksum = "34db1a06d485c9142248b7a054f034b349b212551f3dfd19c94d45a754a217cd" dependencies = [ "libc", - "mio", + "mio 0.8.11", "signal-hook", ] @@ -2718,9 +2724,9 @@ dependencies = [ [[package]] name = "similar" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa42c91313f1d05da9b26f267f931cf178d4aba455b4c4622dd7355eb80c6640" +checksum = "1de1d4f81173b03af4c0cbed3c898f6bff5b870e4a7f5d6f4057d62a7a4b686e" [[package]] name = "slab" @@ -2745,9 +2751,9 @@ checksum = "b7c388c1b5e93756d0c740965c41e8822f866621d41acbdf6336a6a168f8840c" [[package]] name = "socket2" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" dependencies = [ "libc", "windows-sys 0.52.0", @@ -2812,9 +2818,9 @@ dependencies = [ [[package]] name = "subtle" -version = "2.5.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "supports-color" @@ -2860,9 +2866,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.60" +version = "2.0.72" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "909518bc7b1c9b779f1bbf07f2929d35af9f0f37e47c6e9ef7f9dddc1e1821f3" +checksum = "dc4b9b9bf2add8093d3f2c0204471e951b2285580335de42f9d2534f3ae7a8af" dependencies = [ "proc-macro2", "quote", @@ -2898,14 +2904,15 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.10.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if", "fastrand", + "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2931,22 +2938,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.59" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0126ad08bff79f29fc3ae6a55cc72352056dfff61e3ff8bb7129476d44b23aa" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.59" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cd413b5d558b4c5bf3680e324a6fa5014e7b7c067a51e69dbdf47eb7148b66" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] @@ -2979,9 +2986,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" dependencies = [ "tinyvec_macros", ] @@ -2994,32 +3001,31 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.37.0" +version = "1.39.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" +checksum = "daa4fb1bc778bd6f04cbfc4bb2d06a7396a8f299dc33ea1900cedaa316f467b1" dependencies = [ "backtrace", "bytes", "libc", - "mio", - "num_cpus", + "mio 1.0.1", "parking_lot", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] @@ -3034,16 +3040,15 @@ dependencies = [ [[package]] name = "tokio-util" -version = "0.7.10" +version = "0.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5419f34732d9eb6ee4c3578b7989078579b7f039cbbb9ca2c4da015749371e15" +checksum = "9cf6b47b3771c49ac75ad09a6162f53ad4b8088b76ac60e8ec1455b31a189fe1" dependencies = [ "bytes", "futures-core", "futures-sink", "pin-project-lite", "tokio", - "tracing", ] [[package]] @@ -3060,9 +3065,9 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.5" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] @@ -3073,7 +3078,7 @@ version = "0.19.15" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" dependencies = [ - "indexmap 2.2.6", + "indexmap 2.3.0", "serde", "serde_spanned", "toml_datetime", @@ -3105,7 +3110,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] @@ -3191,9 +3196,9 @@ checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unicode-width" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" [[package]] name = "uplc" @@ -3204,7 +3209,7 @@ dependencies = [ "hex", "indexmap 1.9.3", "indoc", - "itertools", + "itertools 0.10.5", "k256", "miette 5.10.0", "num-bigint", @@ -3230,9 +3235,9 @@ dependencies = [ [[package]] name = "url" -version = "2.5.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", @@ -3248,9 +3253,9 @@ checksum = "daf8dba3b7eb870caf1ddeed7bc9d2a049f3cfdfae7cb521b087cc33ae4c49da" [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "vcpkg" @@ -3260,15 +3265,15 @@ checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" [[package]] name = "vec1" -version = "1.12.0" +version = "1.12.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb60dcfffc189bfd4e2a81333c268619fee9db53da71bce2bcbd8e129c56936" +checksum = "eab68b56840f69efb0fefbe3ab6661499217ffdc58e2eef7c3f6f69835386322" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "vte" @@ -3283,9 +3288,9 @@ dependencies = [ [[package]] name = "vte_generate_state_changes" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d257817081c7dffcdbab24b9e62d2def62e2ff7d00b1c20062551e6cccc145ff" +checksum = "2e369bee1b05d510a7b4ed645f5faa90619e05437111783ea5848f28d97d3c2e" dependencies = [ "proc-macro2", "quote", @@ -3346,7 +3351,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", "wasm-bindgen-shared", ] @@ -3380,7 +3385,7 @@ checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -3419,11 +3424,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3447,7 +3452,16 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -3467,18 +3481,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -3489,9 +3503,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -3501,9 +3515,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -3513,15 +3527,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -3531,9 +3545,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -3543,9 +3557,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -3555,9 +3569,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -3567,9 +3581,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" @@ -3604,29 +3618,30 @@ checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" [[package]] name = "zerocopy" -version = "0.7.32" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74d4d3961e53fa4c9a25a8637fc2bfaf2595b3d3ae34875568a5cf64787716be" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" dependencies = [ + "byteorder", "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.7.32" +version = "0.7.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ce1b18ccd8e73a9321186f97e46f9f04b778851177567b1975109d26a08d2a6" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] name = "zeroize" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "525b4ec142c6b68a2d10f01f7bbf6755599ca3f81ea53b8431b7dd348f5fdb2d" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" dependencies = [ "zeroize_derive", ] @@ -3639,7 +3654,7 @@ checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" dependencies = [ "proc-macro2", "quote", - "syn 2.0.60", + "syn 2.0.72", ] [[package]] @@ -3683,9 +3698,9 @@ dependencies = [ [[package]] name = "zstd-sys" -version = "2.0.10+zstd.1.5.6" +version = "2.0.13+zstd.1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa" +checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" dependencies = [ "cc", "pkg-config", diff --git a/Cargo.toml b/Cargo.toml index a20b5ec2..02633e06 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,11 +49,11 @@ x86_64-unknown-linux-gnu = "ubuntu-22.04" walkdir = "2.3.2" insta = { version = "1.30.0", features = ["yaml", "json", "redactions"] } miette = { version = "7.2.0", features = ["fancy"] } -pallas-addresses = "0.22.0" -pallas-codec = { version = "0.22.0", features = ["num-bigint"] } -pallas-crypto = "0.22.0" -pallas-primitives = "0.22.0" -pallas-traverse = "0.22.0" +pallas-addresses = { git = "https://github.com/KtorZ/pallas.git", rev = "8ea5a1adc9919b70b213dfe597e920d6e113120c" } +pallas-codec = { git = "https://github.com/KtorZ/pallas.git", rev = "8ea5a1adc9919b70b213dfe597e920d6e113120c", features = ["num-bigint"] } +pallas-crypto = { git = "https://github.com/KtorZ/pallas.git", rev = "8ea5a1adc9919b70b213dfe597e920d6e113120c" } +pallas-primitives = { git = "https://github.com/KtorZ/pallas.git", rev = "8ea5a1adc9919b70b213dfe597e920d6e113120c" } +pallas-traverse = { git = "https://github.com/KtorZ/pallas.git", rev = "8ea5a1adc9919b70b213dfe597e920d6e113120c" } [profile.dev.package.insta] opt-level = 3 diff --git a/crates/aiken/src/cmd/tx/simulate.rs b/crates/aiken/src/cmd/tx/simulate.rs index 0b11ab4d..c1b070e5 100644 --- a/crates/aiken/src/cmd/tx/simulate.rs +++ b/crates/aiken/src/cmd/tx/simulate.rs @@ -1,7 +1,7 @@ use miette::IntoDiagnostic; use owo_colors::{OwoColorize, Stream::Stderr}; use pallas_primitives::{ - babbage::{Redeemer, TransactionInput, TransactionOutput}, + conway::{Redeemer, TransactionInput, TransactionOutput}, Fragment, }; use pallas_traverse::{Era, MultiEraTx}; @@ -101,7 +101,7 @@ pub fn exec( }) .collect(); - if let Some(tx_babbage) = tx.as_babbage() { + if let Some(tx_conway) = tx.as_conway() { let slot_config = SlotConfig { zero_time, zero_slot, @@ -120,7 +120,7 @@ pub fn exec( }; let result = tx::eval_phase_two( - tx_babbage, + tx_conway, &resolved_inputs, None, None, diff --git a/crates/uplc/src/flat.rs b/crates/uplc/src/flat.rs index e71d2896..78a5e051 100644 --- a/crates/uplc/src/flat.rs +++ b/crates/uplc/src/flat.rs @@ -1,13 +1,3 @@ -use num_bigint::BigInt; -use pallas_codec::flat::{ - de::{self, Decode, Decoder}, - en::{self, Encode, Encoder}, - Flat, -}; -use pallas_primitives::{babbage::PlutusData, Fragment}; - -use std::{collections::VecDeque, fmt::Debug, rc::Rc}; - use crate::{ ast::{ Constant, DeBruijn, FakeNamedDeBruijn, Name, NamedDeBruijn, Program, Term, Type, Unique, @@ -15,6 +5,14 @@ use crate::{ builtins::DefaultFunction, machine::runtime::Compressable, }; +use num_bigint::BigInt; +use pallas_codec::flat::{ + de::{self, Decode, Decoder}, + en::{self, Encode, Encoder}, + Flat, +}; +use pallas_primitives::{conway::PlutusData, Fragment}; +use std::{collections::VecDeque, fmt::Debug, rc::Rc}; const BUILTIN_TAG_WIDTH: u32 = 7; const CONST_TAG_WIDTH: u32 = 4; diff --git a/crates/uplc/src/machine/value.rs b/crates/uplc/src/machine/value.rs index 0bab4679..9a301eac 100644 --- a/crates/uplc/src/machine/value.rs +++ b/crates/uplc/src/machine/value.rs @@ -1,14 +1,12 @@ -use std::{collections::VecDeque, mem::size_of, ops::Deref, rc::Rc}; - +use super::{runtime::BuiltinRuntime, Error}; use crate::{ ast::{Constant, NamedDeBruijn, Term, Type}, builtins::DefaultFunction, }; use num_bigint::BigInt; use num_traits::{Signed, ToPrimitive, Zero}; -use pallas_primitives::babbage::{self, PlutusData}; - -use super::{runtime::BuiltinRuntime, Error}; +use pallas_primitives::conway::{self, PlutusData}; +use std::{collections::VecDeque, mem::size_of, ops::Deref, rc::Rc}; pub(super) type Env = Rc>; @@ -398,44 +396,41 @@ pub fn integer_log2(i: BigInt) -> i64 { } } -pub fn from_pallas_bigint(n: &babbage::BigInt) -> BigInt { +pub fn from_pallas_bigint(n: &conway::BigInt) -> BigInt { match n { - babbage::BigInt::Int(i) => i128::from(*i).into(), - babbage::BigInt::BigUInt(bytes) => BigInt::from_bytes_be(num_bigint::Sign::Plus, bytes), - babbage::BigInt::BigNInt(bytes) => { - BigInt::from_bytes_be(num_bigint::Sign::Minus, bytes) - 1 - } + conway::BigInt::Int(i) => i128::from(*i).into(), + conway::BigInt::BigUInt(bytes) => BigInt::from_bytes_be(num_bigint::Sign::Plus, bytes), + conway::BigInt::BigNInt(bytes) => BigInt::from_bytes_be(num_bigint::Sign::Minus, bytes) - 1, } } -pub fn to_pallas_bigint(n: &BigInt) -> babbage::BigInt { +pub fn to_pallas_bigint(n: &BigInt) -> conway::BigInt { if let Some(i) = n.to_i128() { if let Ok(i) = i.try_into() { let pallas_int: pallas_codec::utils::Int = i; - return babbage::BigInt::Int(pallas_int); + return conway::BigInt::Int(pallas_int); } } if n.is_positive() { let (_, bytes) = n.to_bytes_be(); - babbage::BigInt::BigUInt(bytes.into()) + conway::BigInt::BigUInt(bytes.into()) } else { // Note that this would break if n == 0 // BUT n == 0 always fits into 64bits and hence would end up in the first branch. let n: BigInt = n + 1; let (_, bytes) = n.to_bytes_be(); - babbage::BigInt::BigNInt(bytes.into()) + conway::BigInt::BigNInt(bytes.into()) } } #[cfg(test)] mod tests { - use num_bigint::BigInt; - use crate::{ ast::Constant, machine::value::{integer_log2, Value}, }; + use num_bigint::BigInt; #[test] fn to_ex_mem_bigint() { diff --git a/crates/uplc/src/optimize/shrinker.rs b/crates/uplc/src/optimize/shrinker.rs index b30bdf1d..7913ad1e 100644 --- a/crates/uplc/src/optimize/shrinker.rs +++ b/crates/uplc/src/optimize/shrinker.rs @@ -1,18 +1,14 @@ -use std::{cmp::Ordering, iter, ops::Neg, rc::Rc, vec}; - -use indexmap::IndexMap; -use itertools::Itertools; - -use pallas_primitives::babbage::{BigInt, PlutusData}; - +use super::interner::CodeGenInterner; use crate::{ ast::{Constant, Data, Name, NamedDeBruijn, Program, Term, Type}, builder::{CONSTR_FIELDS_EXPOSER, CONSTR_INDEX_EXPOSER}, builtins::DefaultFunction, machine::cost_model::ExBudget, }; - -use super::interner::CodeGenInterner; +use indexmap::IndexMap; +use itertools::Itertools; +use pallas_primitives::conway::{BigInt, PlutusData}; +use std::{cmp::Ordering, iter, ops::Neg, rc::Rc, vec}; #[derive(Eq, Hash, PartialEq, Clone, Debug, PartialOrd)] pub enum ScopePath { @@ -1981,18 +1977,15 @@ fn pop_lambdas_and_get_names(term: &Term) -> (Vec>, &Term) #[cfg(test)] mod tests { - - use pallas_primitives::babbage::{BigInt, PlutusData}; - use pretty_assertions::assert_eq; - + use super::NO_INLINE; use crate::{ ast::{Constant, Data, Name, NamedDeBruijn, Program, Term}, builder::{CONSTR_FIELDS_EXPOSER, CONSTR_INDEX_EXPOSER}, builtins::DefaultFunction, optimize::interner::CodeGenInterner, }; - - use super::NO_INLINE; + use pallas_primitives::conway::{BigInt, PlutusData}; + use pretty_assertions::assert_eq; fn compare_optimization( mut expected: Program, diff --git a/crates/uplc/src/pretty.rs b/crates/uplc/src/pretty.rs index 1da5c6be..8f989f17 100644 --- a/crates/uplc/src/pretty.rs +++ b/crates/uplc/src/pretty.rs @@ -1,10 +1,12 @@ use crate::{ ast::{Constant, Program, Term, Type}, flat::Binder, - machine::runtime::{convert_tag_to_constr, Compressable}, - machine::value::from_pallas_bigint, + machine::{ + runtime::{convert_tag_to_constr, Compressable}, + value::from_pallas_bigint, + }, }; -use pallas_primitives::babbage::{Constr, PlutusData}; +use pallas_primitives::conway::{Constr, PlutusData}; use pretty::RcDoc; use std::ascii::escape_default; diff --git a/crates/uplc/src/tx.rs b/crates/uplc/src/tx.rs index 3cd6457c..98d15ef6 100644 --- a/crates/uplc/src/tx.rs +++ b/crates/uplc/src/tx.rs @@ -1,20 +1,17 @@ -use pallas_primitives::{ - babbage::{CostMdls, MintedTx, Redeemer, TransactionInput, TransactionOutput}, - Fragment, -}; -use pallas_traverse::{Era, MultiEraTx}; - -use error::Error; -pub use phase_one::eval_phase_one; -pub use script_context::{ResolvedInput, SlotConfig}; - use crate::{ ast::{DeBruijn, Program}, machine::cost_model::ExBudget, PlutusData, }; - +use error::Error; use eval::get_script_and_datum_lookup_table; +use pallas_primitives::{ + conway::{CostMdls, MintedTx, Redeemer, TransactionInput, TransactionOutput}, + Fragment, +}; +use pallas_traverse::{Era, MultiEraTx}; +pub use phase_one::eval_phase_one; +pub use script_context::{ResolvedInput, SlotConfig}; pub mod error; pub mod eval; @@ -53,14 +50,21 @@ pub fn eval_phase_two( let mut remaining_budget = *initial_budget.unwrap_or(&ExBudget::default()); - for redeemer in rs.iter() { - with_redeemer(redeemer); + for (redeemer_key, redeemer_value) in rs.iter() { + let redeemer = Redeemer { + tag: redeemer_key.tag, + index: redeemer_key.index, + data: redeemer_value.data.clone(), + ex_units: redeemer_value.ex_units, + }; + + with_redeemer(&redeemer); let redeemer = eval::eval_redeemer( tx, utxos, slot_config, - redeemer, + &redeemer, &lookup_table, cost_mdls, &remaining_budget, @@ -119,7 +123,10 @@ pub fn eval_phase_two_raw( }; match multi_era_tx { - MultiEraTx::Babbage(tx) => { + MultiEraTx::Babbage(_) => { + todo!("convert Babbage's tx into Conway's") + } + MultiEraTx::Conway(tx) => { match eval_phase_two( &tx, &utxos, @@ -136,15 +143,7 @@ pub fn eval_phase_two_raw( Err(err) => Err(err), } } - // MultiEraTx::AlonzoCompatible(tx, _) => match eval_tx(&tx, &utxos, &sc) { - // Ok(redeemers) => Ok(redeemers - // .iter() - // .map(|r| r.encode_fragment().unwrap()) - // .collect()), - // Err(_) => Err(()), - // }, - // TODO: I probably did a mistake here with using MintedTx which is only compatible with Babbage tx. - _ => todo!("Wrong era. Please use babbage"), + _ => todo!("Wrong era. Please use a more recent transaction format"), } } diff --git a/crates/uplc/src/tx/error.rs b/crates/uplc/src/tx/error.rs index 5189bdba..745e91cf 100644 --- a/crates/uplc/src/tx/error.rs +++ b/crates/uplc/src/tx/error.rs @@ -2,6 +2,7 @@ use crate::{ machine::{self, cost_model::ExBudget}, TransactionInput, }; +use pallas_primitives::conway::Language; #[derive(thiserror::Error, Debug, miette::Diagnostic)] pub enum Error { @@ -30,10 +31,8 @@ pub enum Error { ResolvedInputNotFound(TransactionInput), #[error("A key hash cannot be the hash of a script.")] ScriptKeyHash, - #[error("PlutusV1 cost model not found.")] - V1CostModelNotFound, - #[error("PlutusV2 cost model not found.")] - V2CostModelNotFound, + #[error("Cost model not found for language: {:?}.", .0)] + CostModelNotFound(Language), #[error("Wrong era, Please use Babbage or Alonzo: {0}")] WrongEra(#[from] pallas_codec::minicbor::decode::Error), #[error("Byron address not allowed in Plutus.")] diff --git a/crates/uplc/src/tx/eval.rs b/crates/uplc/src/tx/eval.rs index 60306b55..fee67505 100644 --- a/crates/uplc/src/tx/eval.rs +++ b/crates/uplc/src/tx/eval.rs @@ -1,46 +1,24 @@ use super::{ - script_context::{ - ResolvedInput, ScriptContext, ScriptPurpose, SlotConfig, TimeRange, TxInInfo, TxInfo, - TxInfoV1, TxInfoV2, TxOut, - }, - to_plutus_data::{MintValue, ToPlutusData}, + script_context::{ResolvedInput, ScriptContext, ScriptPurpose, SlotConfig, TxInfo}, + to_plutus_data::ToPlutusData, Error, }; use crate::{ ast::{FakeNamedDeBruijn, NamedDeBruijn, Program}, machine::cost_model::ExBudget, + tx::script_context::{TxInfoV1, TxInfoV2, TxInfoV3}, PlutusData, }; -use itertools::Itertools; use pallas_addresses::{Address, ScriptHash, StakePayload}; -use pallas_codec::utils::{KeyValuePairs, MaybeIndefArray}; +use pallas_codec::utils::{Bytes, NonEmptyKeyValuePairs, NonEmptySet}; use pallas_crypto::hash::Hash; -use pallas_primitives::{ - babbage::{ - Certificate, CostMdls, DatumHash, DatumOption, ExUnits, Mint, MintedTx, NativeScript, - PlutusV1Script, PlutusV2Script, PolicyId, PseudoScript, Redeemer, RedeemerTag, - RewardAccount, StakeCredential, TransactionInput, TransactionOutput, Value, Withdrawals, - }, - conway::Language, +use pallas_primitives::conway::{ + Certificate, CostMdls, CostModel, DatumHash, DatumOption, ExUnits, Language, Mint, MintedTx, + NativeScript, PlutusV1Script, PlutusV2Script, PlutusV3Script, PolicyId, PseudoScript, Redeemer, + RedeemerTag, RewardAccount, StakeCredential, TransactionInput, TransactionOutput, Withdrawals, }; use pallas_traverse::{ComputeHash, OriginalHash}; -use std::{cmp::Ordering, collections::HashMap, convert::TryInto, ops::Deref, vec}; - -pub fn slot_to_begin_posix_time(slot: u64, sc: &SlotConfig) -> u64 { - let ms_after_begin = (slot - sc.zero_slot) * sc.slot_length as u64; - sc.zero_time + ms_after_begin -} - -fn slot_range_to_posix_time_range(slot_range: TimeRange, sc: &SlotConfig) -> TimeRange { - TimeRange { - lower_bound: slot_range - .lower_bound - .map(|lower_bound| slot_to_begin_posix_time(lower_bound, sc)), - upper_bound: slot_range - .upper_bound - .map(|upper_bound| slot_to_begin_posix_time(upper_bound, sc)), - } -} +use std::{collections::HashMap, convert::TryInto, vec}; fn redeemer_tag_to_string(redeemer_tag: &RedeemerTag) -> String { match redeemer_tag { @@ -48,54 +26,7 @@ fn redeemer_tag_to_string(redeemer_tag: &RedeemerTag) -> String { RedeemerTag::Mint => "Mint".to_string(), RedeemerTag::Cert => "Cert".to_string(), RedeemerTag::Reward => "Reward".to_string(), - } -} - -fn sort_mint(mint: &Mint) -> Mint { - let mut mint_vec = vec![]; - - for m in mint.deref().iter().sorted() { - mint_vec.push(( - m.0, - KeyValuePairs::Indef(m.1.deref().clone().into_iter().sorted().clone().collect()), - )); - } - - KeyValuePairs::Indef(mint_vec) -} - -fn sort_value(value: &Value) -> Value { - match value { - Value::Coin(_) => value.clone(), - Value::Multiasset(coin, ma) => { - let mut ma_vec = vec![]; - - for m in ma.deref().iter().sorted() { - ma_vec.push(( - m.0, - KeyValuePairs::Indef( - m.1.deref().clone().into_iter().sorted().clone().collect(), - ), - )); - } - - Value::Multiasset(*coin, KeyValuePairs::Indef(ma_vec)) - } - } -} - -fn sort_tx_out_value(tx_output: &TransactionOutput) -> TransactionOutput { - match tx_output { - TransactionOutput::Legacy(output) => { - let mut new_output = output.clone(); - new_output.amount = sort_value(&output.amount); - TransactionOutput::Legacy(new_output) - } - TransactionOutput::PostAlonzo(output) => { - let mut new_output = output.clone(); - new_output.value = sort_value(&output.value); - TransactionOutput::PostAlonzo(new_output) - } + tag => todo!("redeemer_tag_to_string for {tag:?}"), } } @@ -104,6 +35,7 @@ pub enum ScriptVersion { Native(NativeScript), V1(PlutusV1Script), V2(PlutusV2Script), + V3(PlutusV3Script), } #[derive(Debug, PartialEq, Clone)] @@ -123,107 +55,22 @@ impl DataLookupTable { } } -pub fn get_tx_in_info_v1( - inputs: &[TransactionInput], - utxos: &[ResolvedInput], -) -> Result, Error> { - inputs - .iter() - .sorted() - .map(|input| { - let utxo = match utxos.iter().find(|utxo| utxo.input == *input) { - Some(resolved) => resolved, - None => return Err(Error::ResolvedInputNotFound(input.clone())), - }; - let address = Address::from_bytes(match &utxo.output { - TransactionOutput::Legacy(output) => output.address.as_ref(), - TransactionOutput::PostAlonzo(output) => output.address.as_ref(), - }) - .unwrap(); - - match address { - Address::Byron(_) => { - return Err(Error::ByronAddressNotAllowed); - } - Address::Stake(_) => { - return Err(Error::NoPaymentCredential); - } - _ => {} - }; - - match &utxo.output { - TransactionOutput::Legacy(_) => {} - TransactionOutput::PostAlonzo(output) => { - if let Some(DatumOption::Data(_)) = output.datum_option { - return Err(Error::InlineDatumNotAllowed); - } - - if output.script_ref.is_some() { - return Err(Error::ScriptAndInputRefNotAllowed); - } - } - } - - Ok(TxInInfo { - out_ref: utxo.input.clone(), - resolved: TxOut::V1(sort_tx_out_value(&utxo.output)), - }) - }) - .collect() -} - -fn get_tx_in_info_v2( - inputs: &[TransactionInput], - utxos: &[ResolvedInput], -) -> Result, Error> { - inputs - .iter() - .sorted() - .map(|input| { - let utxo = match utxos.iter().find(|utxo| utxo.input == *input) { - Some(resolved) => resolved, - None => return Err(Error::ResolvedInputNotFound(input.clone())), - }; - let address = Address::from_bytes(match &utxo.output { - TransactionOutput::Legacy(output) => output.address.as_ref(), - TransactionOutput::PostAlonzo(output) => output.address.as_ref(), - }) - .unwrap(); - - match address { - Address::Byron(_) => { - return Err(Error::ByronAddressNotAllowed); - } - Address::Stake(_) => { - return Err(Error::NoPaymentCredential); - } - _ => {} - }; - - Ok(TxInInfo { - out_ref: utxo.input.clone(), - resolved: TxOut::V2(sort_tx_out_value(&utxo.output)), - }) - }) - .collect() -} - fn get_script_purpose( redeemer: &Redeemer, inputs: &[TransactionInput], mint: &Option, - dcert: &Option>, + dcert: &Option>, wdrl: &Option, ) -> Result { // sorting according to specs section 4.1: https://hydra.iohk.io/build/18583827/download/1/alonzo-changes.pdf - let tag = redeemer.tag.clone(); + let tag = redeemer.tag; let index = redeemer.index; match tag { RedeemerTag::Mint => { // sort lexical by policy id let mut policy_ids = mint .as_ref() - .unwrap_or(&KeyValuePairs::Indef(vec![])) + .unwrap_or(&NonEmptyKeyValuePairs::Indef(vec![])) .iter() .map(|(policy_id, _)| *policy_id) .collect::>(); @@ -246,7 +93,7 @@ fn get_script_purpose( // sort lexical by reward account let mut reward_accounts = wdrl .as_ref() - .unwrap_or(&KeyValuePairs::Indef(vec![])) + .unwrap_or(&NonEmptyKeyValuePairs::Indef(vec![])) .iter() .map(|(racnt, _)| racnt.clone()) .collect::>(); @@ -269,215 +116,15 @@ fn get_script_purpose( } RedeemerTag::Cert => { // sort by order given in the tx (just take it as it is basically) - match dcert - .as_ref() - .unwrap_or(&MaybeIndefArray::Indef(vec![])) - .get(index as usize) - { + match dcert.as_deref().unwrap_or(&vec![]).get(index as usize) { Some(cert) => Ok(ScriptPurpose::Certifying(cert.clone())), None => Err(Error::ExtraneousRedeemer), } } + tag => todo!("get_script_purpose for {tag:?}"), } } -fn get_tx_info_v1( - tx: &MintedTx, - utxos: &[ResolvedInput], - slot_config: &SlotConfig, -) -> Result { - let body = tx.transaction_body.clone(); - - if body.reference_inputs.is_some() { - return Err(Error::ScriptAndInputRefNotAllowed); - } - - let inputs = get_tx_in_info_v1(&body.inputs, utxos)?; - - let outputs = body - .outputs - .iter() - .cloned() - .map(|output| TxOut::V1(sort_tx_out_value(&output.into()))) - .collect(); - - let fee = Value::Coin(body.fee); - - let mint = sort_mint(&body.mint.clone().unwrap_or(KeyValuePairs::Indef(vec![]))); - - let dcert = body.certificates.clone().unwrap_or_default(); - - let wdrl = body - .withdrawals - .clone() - .unwrap_or(KeyValuePairs::Indef(vec![])) - .deref() - .clone() - .into_iter() - .sorted() - .map(|(reward_account, coin)| (Address::from_bytes(&reward_account).unwrap(), coin)) - .collect_vec(); - - let valid_range = slot_range_to_posix_time_range( - TimeRange { - lower_bound: body.validity_interval_start, - upper_bound: body.ttl, - }, - slot_config, - ); - - let signatories = body - .required_signers - .clone() - .unwrap_or_default() - .into_iter() - .sorted() - .collect(); - - let data = tx - .transaction_witness_set - .plutus_data - .as_ref() - .unwrap_or(&vec![]) - .iter() - .map(|d| (d.original_hash(), d.clone().unwrap())) - .sorted() - .collect(); - - let id = tx.transaction_body.original_hash(); - - Ok(TxInfo::V1(TxInfoV1 { - inputs, - outputs, - fee, - mint: MintValue { mint_value: mint }, - dcert, - wdrl, - valid_range, - signatories, - data, - id, - })) -} - -fn get_tx_info_v2( - tx: &MintedTx, - utxos: &[ResolvedInput], - slot_config: &SlotConfig, -) -> Result { - let body = tx.transaction_body.clone(); - - let inputs = get_tx_in_info_v2(&body.inputs, utxos)?; - - let reference_inputs = - get_tx_in_info_v2(&body.reference_inputs.clone().unwrap_or_default(), utxos)?; - - let outputs = body - .outputs - .iter() - .cloned() - .map(|output| TxOut::V2(sort_tx_out_value(&output.into()))) - .collect(); - - let fee = Value::Coin(body.fee); - - let mint = sort_mint(&body.mint.clone().unwrap_or(KeyValuePairs::Indef(vec![]))); - - let dcert = body.certificates.clone().unwrap_or_default(); - - let wdrl = KeyValuePairs::Indef( - body.withdrawals - .clone() - .unwrap_or(KeyValuePairs::Indef(vec![])) - .deref() - .clone() - .into_iter() - .sorted() - .map(|(reward_account, coin)| (Address::from_bytes(&reward_account).unwrap(), coin)) - .collect(), - ); - - let valid_range = slot_range_to_posix_time_range( - TimeRange { - lower_bound: body.validity_interval_start, - upper_bound: body.ttl, - }, - slot_config, - ); - - let signatories = body - .required_signers - .clone() - .unwrap_or_default() - .into_iter() - .sorted() - .collect(); - - let redeemers = KeyValuePairs::Indef( - tx.transaction_witness_set - .redeemer - .as_ref() - .unwrap_or(&MaybeIndefArray::Indef(vec![])) - .iter() - .sorted_by(|a, b| -> Ordering { - if a.tag == b.tag { - a.index.cmp(&b.index) - } else { - match (&a.tag, &b.tag) { - (RedeemerTag::Spend, _) => Ordering::Greater, - (RedeemerTag::Mint, RedeemerTag::Spend) => Ordering::Less, - (RedeemerTag::Mint, _) => Ordering::Greater, - (RedeemerTag::Cert, RedeemerTag::Reward) => Ordering::Greater, - (RedeemerTag::Cert, _) => Ordering::Less, - (RedeemerTag::Reward, _) => Ordering::Less, - } - } - }) - .map(|r| { - ( - get_script_purpose( - r, - &tx.transaction_body.inputs, - &tx.transaction_body.mint, - &tx.transaction_body.certificates, - &tx.transaction_body.withdrawals, - ) - .unwrap(), - r.clone(), - ) - }) - .collect(), - ); - - let data = KeyValuePairs::Indef( - tx.transaction_witness_set - .plutus_data - .as_ref() - .unwrap_or(&vec![]) - .iter() - .map(|d| (d.original_hash(), d.clone().unwrap())) - .sorted() - .collect(), - ); - - let id = tx.transaction_body.original_hash(); - - Ok(TxInfo::V2(TxInfoV2 { - inputs, - reference_inputs, - outputs, - fee, - mint: MintValue { mint_value: mint }, - dcert, - wdrl, - valid_range, - signatories, - redeemers, - data, - id, - })) -} - fn get_execution_purpose( utxos: &[ResolvedInput], script_purpose: &ScriptPurpose, @@ -643,24 +290,35 @@ pub fn get_script_and_datum_lookup_table( .transaction_witness_set .plutus_data .clone() + .map(|s| s.to_vec()) .unwrap_or_default(); let scripts_native_witnesses = tx .transaction_witness_set .native_script .clone() + .map(|s| s.to_vec()) .unwrap_or_default(); let scripts_v1_witnesses = tx .transaction_witness_set .plutus_v1_script .clone() + .map(|s| s.to_vec()) .unwrap_or_default(); let scripts_v2_witnesses = tx .transaction_witness_set .plutus_v2_script .clone() + .map(|s| s.to_vec()) + .unwrap_or_default(); + + let scripts_v3_witnesses = tx + .transaction_witness_set + .plutus_v3_script + .clone() + .map(|s| s.to_vec()) .unwrap_or_default(); for plutus_data in plutus_data_witnesses.iter() { @@ -682,6 +340,10 @@ pub fn get_script_and_datum_lookup_table( scripts.insert(script.compute_hash(), ScriptVersion::V2(script.clone())); } + for script in scripts_v3_witnesses.iter() { + scripts.insert(script.compute_hash(), ScriptVersion::V3(script.clone())); + } + // discovery in utxos (script ref) for utxo in utxos.iter() { @@ -699,6 +361,9 @@ pub fn get_script_and_datum_lookup_table( PseudoScript::PlutusV2Script(v2) => { scripts.insert(v2.compute_hash(), ScriptVersion::V2(v2.clone())); } + PseudoScript::PlutusV3Script(v3) => { + scripts.insert(v3.compute_hash(), ScriptVersion::V3(v3.clone())); + } } } } @@ -708,6 +373,49 @@ pub fn get_script_and_datum_lookup_table( DataLookupTable { datum, scripts } } +fn mk_redeemer_with_datum( + cost_mdl_opt: Option<&CostModel>, + initial_budget: &ExBudget, + lang: &Language, + datum: PlutusData, + (redeemer, purpose): (&Redeemer, ScriptPurpose), + tx_info: TxInfo, + program: Program, +) -> Result { + let script_context = ScriptContext { tx_info, purpose }; + + let program = program + .apply_data(datum) + .apply_data(redeemer.data.clone()) + .apply_data(script_context.to_plutus_data()); + + let mut eval_result = if let Some(costs) = cost_mdl_opt { + program.eval_as(lang, costs, Some(initial_budget)) + } else { + program.eval_version(ExBudget::default(), lang) + }; + + let cost = eval_result.cost(); + let logs = eval_result.logs(); + + match eval_result.result() { + Ok(_) => (), + Err(err) => return Err(Error::Machine(err, cost, logs)), + } + + let new_redeemer = Redeemer { + tag: redeemer.tag, + index: redeemer.index, + data: redeemer.data.clone(), + ex_units: ExUnits { + mem: cost.mem as u64, + steps: cost.cpu as u64, + }, + }; + + Ok(new_redeemer) +} + pub fn eval_redeemer( tx: &MintedTx, utxos: &[ResolvedInput], @@ -726,114 +434,73 @@ pub fn eval_redeemer( &tx.transaction_body.withdrawals, )?; + let program = |script: Bytes| { + let mut buffer = Vec::new(); + Program::::from_cbor(&script, &mut buffer) + .map(Into::>::into) + }; + let execution_purpose: ExecutionPurpose = get_execution_purpose(utxos, &purpose, lookup_table)?; match execution_purpose { ExecutionPurpose::WithDatum(script_version, datum) => match script_version { - ScriptVersion::V1(script) => { - let tx_info = get_tx_info_v1(tx, utxos, slot_config)?; - let script_context = ScriptContext { tx_info, purpose }; + ScriptVersion::V1(script) => mk_redeemer_with_datum( + cost_mdls_opt + .map(|cost_mdls| { + cost_mdls + .plutus_v1 + .as_ref() + .ok_or(Error::CostModelNotFound(Language::PlutusV1)) + }) + .transpose()?, + initial_budget, + &Language::PlutusV1, + datum, + (redeemer, purpose), + TxInfoV1::from_transaction(tx, utxos, slot_config)?, + program(script.0)?, + ), - let program: Program = { - let mut buffer = Vec::new(); + ScriptVersion::V2(script) => mk_redeemer_with_datum( + cost_mdls_opt + .map(|cost_mdls| { + cost_mdls + .plutus_v2 + .as_ref() + .ok_or(Error::CostModelNotFound(Language::PlutusV2)) + }) + .transpose()?, + initial_budget, + &Language::PlutusV2, + datum, + (redeemer, purpose), + TxInfoV2::from_transaction(tx, utxos, slot_config)?, + program(script.0)?, + ), - let prog = Program::::from_cbor(&script.0, &mut buffer)?; + ScriptVersion::V3(script) => mk_redeemer_with_datum( + cost_mdls_opt + .map(|cost_mdls| { + cost_mdls + .plutus_v3 + .as_ref() + .ok_or(Error::CostModelNotFound(Language::PlutusV3)) + }) + .transpose()?, + initial_budget, + &Language::PlutusV2, + datum, + (redeemer, purpose), + TxInfoV3::from_transaction(tx, utxos, slot_config)?, + program(script.0)?, + ), - prog.into() - }; - - let program = program - .apply_data(datum) - .apply_data(redeemer.data.clone()) - .apply_data(script_context.to_plutus_data()); - - let mut eval_result = if let Some(cost_mdls) = cost_mdls_opt { - let costs = if let Some(costs) = &cost_mdls.plutus_v1 { - costs - } else { - return Err(Error::V1CostModelNotFound); - }; - - program.eval_as(&Language::PlutusV1, costs, Some(initial_budget)) - } else { - program.eval_version(ExBudget::default(), &Language::PlutusV1) - }; - - let cost = eval_result.cost(); - let logs = eval_result.logs(); - - match eval_result.result() { - Ok(_) => (), - Err(err) => return Err(Error::Machine(err, cost, logs)), - } - - let new_redeemer = Redeemer { - tag: redeemer.tag.clone(), - index: redeemer.index, - data: redeemer.data.clone(), - ex_units: ExUnits { - mem: cost.mem as u32, - steps: cost.cpu as u64, - }, - }; - - Ok(new_redeemer) - } - ScriptVersion::V2(script) => { - let tx_info = get_tx_info_v2(tx, utxos, slot_config)?; - let script_context = ScriptContext { tx_info, purpose }; - - let program: Program = { - let mut buffer = Vec::new(); - - let prog = Program::::from_cbor(&script.0, &mut buffer)?; - - prog.into() - }; - - let program = program - .apply_data(datum) - .apply_data(redeemer.data.clone()) - .apply_data(script_context.to_plutus_data()); - - let mut eval_result = if let Some(cost_mdls) = cost_mdls_opt { - let costs = if let Some(costs) = &cost_mdls.plutus_v2 { - costs - } else { - return Err(Error::V2CostModelNotFound); - }; - - program.eval_as(&Language::PlutusV2, costs, Some(initial_budget)) - } else { - program.eval(ExBudget::default()) - }; - - let cost = eval_result.cost(); - let logs = eval_result.logs(); - - match eval_result.result() { - Ok(_) => (), - Err(err) => return Err(Error::Machine(err, cost, logs)), - } - - let new_redeemer = Redeemer { - tag: redeemer.tag.clone(), - index: redeemer.index, - data: redeemer.data.clone(), - ex_units: ExUnits { - mem: cost.mem as u32, - steps: cost.cpu as u64, - }, - }; - - Ok(new_redeemer) - } ScriptVersion::Native(_) => Err(Error::NativeScriptPhaseTwo), }, ExecutionPurpose::NoDatum(script_version) => match script_version { ScriptVersion::V1(script) => { - let tx_info = get_tx_info_v1(tx, utxos, slot_config)?; + let tx_info = TxInfoV1::from_transaction(tx, utxos, slot_config)?; let script_context = ScriptContext { tx_info, purpose }; let program: Program = { @@ -852,7 +519,7 @@ pub fn eval_redeemer( let costs = if let Some(costs) = &cost_mdls.plutus_v1 { costs } else { - return Err(Error::V1CostModelNotFound); + return Err(Error::CostModelNotFound(Language::PlutusV1)); }; program.eval_as(&Language::PlutusV1, costs, Some(initial_budget)) @@ -869,11 +536,11 @@ pub fn eval_redeemer( } let new_redeemer = Redeemer { - tag: redeemer.tag.clone(), + tag: redeemer.tag, index: redeemer.index, data: redeemer.data.clone(), ex_units: ExUnits { - mem: cost.mem as u32, + mem: cost.mem as u64, steps: cost.cpu as u64, }, }; @@ -881,7 +548,7 @@ pub fn eval_redeemer( Ok(new_redeemer) } ScriptVersion::V2(script) => { - let tx_info = get_tx_info_v2(tx, utxos, slot_config)?; + let tx_info = TxInfoV2::from_transaction(tx, utxos, slot_config)?; let script_context = ScriptContext { tx_info, purpose }; let program: Program = { @@ -900,7 +567,7 @@ pub fn eval_redeemer( let costs = if let Some(costs) = &cost_mdls.plutus_v2 { costs } else { - return Err(Error::V2CostModelNotFound); + return Err(Error::CostModelNotFound(Language::PlutusV2)); }; program.eval_as(&Language::PlutusV2, costs, Some(initial_budget)) @@ -917,17 +584,18 @@ pub fn eval_redeemer( } let new_redeemer = Redeemer { - tag: redeemer.tag.clone(), + tag: redeemer.tag, index: redeemer.index, data: redeemer.data.clone(), ex_units: ExUnits { - mem: cost.mem as u32, + mem: cost.mem as u64, steps: cost.cpu as u64, }, }; Ok(new_redeemer) } + ScriptVersion::V3(_script) => todo!(), ScriptVersion::Native(_) => Err(Error::NativeScriptPhaseTwo), }, } diff --git a/crates/uplc/src/tx/phase_one.rs b/crates/uplc/src/tx/phase_one.rs index 5adb5e04..6cc8121f 100644 --- a/crates/uplc/src/tx/phase_one.rs +++ b/crates/uplc/src/tx/phase_one.rs @@ -3,20 +3,14 @@ use super::{ eval::{DataLookupTable, ScriptVersion}, script_context::{ResolvedInput, ScriptPurpose}, }; +use itertools::Itertools; use pallas_addresses::{Address, ScriptHash, ShelleyPaymentPart, StakePayload}; -use pallas_codec::utils::{KeyValuePairs, MaybeIndefArray}; -use pallas_primitives::babbage::{ - Certificate, MintedTx, PolicyId, RedeemerTag, RewardAccount, StakeCredential, TransactionOutput, +use pallas_primitives::conway::{ + Certificate, MintedTx, PolicyId, RedeemerTag, RedeemersKey, RewardAccount, StakeCredential, + TransactionOutput, }; use std::collections::HashMap; -// TODO: include in pallas eventually? -#[derive(Debug, PartialEq, Clone)] -struct RedeemerPtr { - tag: RedeemerTag, - index: u32, -} - type AlonzoScriptsNeeded = Vec<(ScriptPurpose, ScriptHash)>; // subset of phase-1 ledger checks related to scripts @@ -98,49 +92,55 @@ pub fn scripts_needed( let mut reward = txb .withdrawals - .as_ref() - .unwrap_or(&KeyValuePairs::Indef(vec![])) - .iter() - .filter_map(|(acnt, _)| { - let address = Address::from_bytes(acnt).unwrap(); + .as_deref() + .map(|w| { + w.iter() + .filter_map(|(acnt, _)| { + let address = Address::from_bytes(acnt).unwrap(); - if let Address::Stake(a) = address { - if let StakePayload::Script(h) = a.payload() { - let cred = StakeCredential::Scripthash(*h); - return Some((ScriptPurpose::Rewarding(cred), *h)); - } - } + if let Address::Stake(a) = address { + if let StakePayload::Script(h) = a.payload() { + let cred = StakeCredential::Scripthash(*h); + return Some((ScriptPurpose::Rewarding(cred), *h)); + } + } - None + None + }) + .collect::() }) - .collect::(); + .unwrap_or_default(); let mut cert = txb .certificates - .clone() - .unwrap_or_default() - .iter() - .filter_map(|cert| { - // only Dereg and Deleg certs can require scripts - match cert { - Certificate::StakeDeregistration(StakeCredential::Scripthash(h)) => { - Some((ScriptPurpose::Certifying(cert.clone()), *h)) - } - Certificate::StakeDelegation(StakeCredential::Scripthash(h), _) => { - Some((ScriptPurpose::Certifying(cert.clone()), *h)) - } - _ => None, - } + .as_deref() + .map(|m| { + m.iter() + .filter_map(|cert| { + // only Dereg and Deleg certs can require scripts + match cert { + Certificate::StakeDeregistration(StakeCredential::Scripthash(h)) => { + Some((ScriptPurpose::Certifying(cert.clone()), *h)) + } + Certificate::StakeDelegation(StakeCredential::Scripthash(h), _) => { + Some((ScriptPurpose::Certifying(cert.clone()), *h)) + } + _ => None, + } + }) + .collect::() }) - .collect::(); + .unwrap_or_default(); let mut mint = txb .mint - .as_ref() - .unwrap_or(&KeyValuePairs::Indef(vec![])) - .iter() - .map(|(policy_id, _)| (ScriptPurpose::Minting(*policy_id), *policy_id)) - .collect::(); + .as_deref() + .map(|m| { + m.iter() + .map(|(policy_id, _)| (ScriptPurpose::Minting(*policy_id), *policy_id)) + .collect::() + }) + .unwrap_or_default(); needed.append(&mut spend); needed.append(&mut reward); @@ -159,52 +159,50 @@ pub fn has_exact_set_of_redeemers( let mut redeemers_needed = Vec::new(); for (script_purpose, script_hash) in needed { - let redeemer_ptr = build_redeemer_ptr(tx, script_purpose)?; + let redeemer_key = build_redeemer_key(tx, script_purpose)?; let script = tx_scripts.get(script_hash); - if let (Some(ptr), Some(script)) = (redeemer_ptr, script) { + if let (Some(key), Some(script)) = (redeemer_key, script) { match script { ScriptVersion::V1(_) => { - redeemers_needed.push((ptr, script_purpose.clone(), *script_hash)) + redeemers_needed.push((key, script_purpose.clone(), *script_hash)) } ScriptVersion::V2(_) => { - redeemers_needed.push((ptr, script_purpose.clone(), *script_hash)) + redeemers_needed.push((key, script_purpose.clone(), *script_hash)) + } + ScriptVersion::V3(_) => { + redeemers_needed.push((key, script_purpose.clone(), *script_hash)) } ScriptVersion::Native(_) => (), } } } - let wits_redeemer_ptrs: Vec = tx + let wits_redeemer_keys: Vec<&RedeemersKey> = tx .transaction_witness_set .redeemer - .as_ref() - .unwrap_or(&MaybeIndefArray::Indef(vec![])) - .iter() - .map(|r| RedeemerPtr { - tag: r.tag.clone(), - index: r.index, - }) - .collect(); + .as_deref() + .map(|m| m.iter().map(|(k, _)| k).collect()) + .unwrap_or_default(); - let needed_redeemer_ptrs: Vec = + let needed_redeemer_keys: Vec = redeemers_needed.iter().map(|x| x.0.clone()).collect(); let missing: Vec<_> = redeemers_needed .into_iter() - .filter(|x| !wits_redeemer_ptrs.contains(&x.0)) + .filter(|x| !wits_redeemer_keys.contains(&&x.0)) .map(|x| { format!( - "[Missing (redeemer_ptr: {:?}, script_purpose: {:?}, script_hash: {})]", + "[Missing (redeemer_key: {:?}, script_purpose: {:?}, script_hash: {})]", x.0, x.1, x.2, ) }) .collect(); - let extra: Vec<_> = wits_redeemer_ptrs + let extra: Vec<_> = wits_redeemer_keys .into_iter() - .filter(|x| !needed_redeemer_ptrs.contains(x)) - .map(|x| format!("[Extraneous (redeemer_ptr: {x:?})]")) + .filter(|x| !needed_redeemer_keys.contains(x)) + .map(|x| format!("[Extraneous (redeemer_key: {x:?})]")) .collect(); if !missing.is_empty() || !extra.is_empty() { @@ -217,66 +215,62 @@ pub fn has_exact_set_of_redeemers( /// builds a redeemer pointer (tag, index) from a script purpose by setting the tag /// according to the type of the script purpose, and the index according to the /// placement of script purpose inside its container. -fn build_redeemer_ptr( +fn build_redeemer_key( tx: &MintedTx, script_purpose: &ScriptPurpose, -) -> Result, Error> { +) -> Result, Error> { let tx_body = tx.transaction_body.clone(); match script_purpose { ScriptPurpose::Minting(hash) => { - let mut policy_ids = tx_body + let policy_ids: Vec<&PolicyId> = tx_body .mint - .as_ref() - .unwrap_or(&KeyValuePairs::Indef(vec![])) - .iter() - .map(|(policy_id, _)| *policy_id) - .collect::>(); + .as_deref() + .map(|m| m.iter().map(|(policy_id, _)| policy_id).sorted().collect()) + .unwrap_or_default(); - policy_ids.sort(); + let redeemer_key = + policy_ids + .iter() + .position(|x| x == &hash) + .map(|index| RedeemersKey { + tag: RedeemerTag::Mint, + index: index as u32, + }); - let maybe_idx = policy_ids.iter().position(|x| x == hash); - - match maybe_idx { - Some(idx) => Ok(Some(RedeemerPtr { - tag: RedeemerTag::Mint, - index: idx as u32, - })), - None => Ok(None), - } + Ok(redeemer_key) } + ScriptPurpose::Spending(txin) => { - let mut inputs = tx_body.inputs.to_vec(); - inputs.sort_by( - |i_a, i_b| match i_a.transaction_id.cmp(&i_b.transaction_id) { - std::cmp::Ordering::Less => std::cmp::Ordering::Less, - std::cmp::Ordering::Equal => i_a.index.cmp(&i_b.index), - std::cmp::Ordering::Greater => std::cmp::Ordering::Greater, - }, - ); - - let maybe_idx = inputs.iter().position(|x| x == txin); - - match maybe_idx { - Some(idx) => Ok(Some(RedeemerPtr { - tag: RedeemerTag::Spend, - index: idx as u32, - })), - None => Ok(None), - } - } - ScriptPurpose::Rewarding(racnt) => { - let mut reward_accounts = tx_body - .withdrawals - .as_ref() - .unwrap_or(&KeyValuePairs::Indef(vec![])) + let redeemer_key = tx_body + .inputs .iter() - .map(|(acnt, _)| acnt.clone()) - .collect::>(); + .sorted_by( + |i_a, i_b| match i_a.transaction_id.cmp(&i_b.transaction_id) { + std::cmp::Ordering::Less => std::cmp::Ordering::Less, + std::cmp::Ordering::Equal => i_a.index.cmp(&i_b.index), + std::cmp::Ordering::Greater => std::cmp::Ordering::Greater, + }, + ) + .position(|x| x == txin) + .map(|index| RedeemersKey { + tag: RedeemerTag::Spend, + index: index as u32, + }); + + Ok(redeemer_key) + } + + ScriptPurpose::Rewarding(racnt) => { + let mut reward_accounts: Vec<&RewardAccount> = tx_body + .withdrawals + .as_deref() + .map(|m| m.iter().map(|(acnt, _)| acnt).collect()) + .unwrap_or_default(); reward_accounts.sort(); - let mut maybe_idx = None; + let mut redeemer_key = None; for (idx, x) in reward_accounts.iter().enumerate() { let cred = match Address::from_bytes(x).unwrap() { @@ -288,33 +282,28 @@ fn build_redeemer_ptr( }; if cred == Some(racnt.to_owned()) { - maybe_idx = Some(idx); + redeemer_key = Some(RedeemersKey { + tag: RedeemerTag::Reward, + index: idx as u32, + }); } } - match maybe_idx { - Some(idx) => Ok(Some(RedeemerPtr { - tag: RedeemerTag::Reward, - index: idx as u32, - })), - None => Ok(None), - } + Ok(redeemer_key) } - ScriptPurpose::Certifying(d) => { - let maybe_idx = tx_body - .certificates - .as_ref() - .unwrap_or(&MaybeIndefArray::Indef(vec![])) - .iter() - .position(|x| x == d); - match maybe_idx { - Some(idx) => Ok(Some(RedeemerPtr { + ScriptPurpose::Certifying(d) => { + let redeemer_key = tx_body + .certificates + .as_deref() + .map(|m| m.iter().position(|x| x == d)) + .unwrap_or_default() + .map(|index| RedeemersKey { tag: RedeemerTag::Cert, - index: idx as u32, - })), - None => Ok(None), - } + index: index as u32, + }); + + Ok(redeemer_key) } } } diff --git a/crates/uplc/src/tx/script_context.rs b/crates/uplc/src/tx/script_context.rs index 840480da..95108729 100644 --- a/crates/uplc/src/tx/script_context.rs +++ b/crates/uplc/src/tx/script_context.rs @@ -1,12 +1,20 @@ -use pallas_addresses::Address; -use pallas_codec::utils::KeyValuePairs; +use super::{to_plutus_data::MintValue, Error}; +use itertools::Itertools; +use pallas_addresses::{Address, StakePayload}; +use pallas_codec::utils::{KeyValuePairs, NonEmptyKeyValuePairs, NonEmptySet}; use pallas_crypto::hash::Hash; -use pallas_primitives::babbage::{ - AddrKeyhash, Certificate, Coin, DatumHash, PlutusData, PolicyId, Redeemer, StakeCredential, - TransactionInput, TransactionOutput, Value, +use pallas_primitives::{ + alonzo, + conway::{ + AddrKeyhash, Certificate, Coin, DatumHash, DatumOption, Mint, MintedTransactionBody, + MintedTransactionOutput, MintedTx, MintedWitnessSet, PlutusData, PolicyId, + PostAlonzoTransactionOutput, PseudoDatumOption, Redeemer, RedeemerTag, RedeemersKey, + RequiredSigners, RewardAccount, StakeCredential, TransactionInput, TransactionOutput, + Value, + }, }; - -use super::to_plutus_data::MintValue; +use pallas_traverse::OriginalHash; +use std::{cmp::Ordering, ops::Deref}; #[derive(Debug, PartialEq, Clone)] pub struct ResolvedInput { @@ -47,6 +55,31 @@ pub struct TxInfoV1 { pub id: Hash<32>, } +impl TxInfoV1 { + pub fn from_transaction( + tx: &MintedTx, + utxos: &[ResolvedInput], + slot_config: &SlotConfig, + ) -> Result { + if tx.transaction_body.reference_inputs.is_some() { + return Err(Error::ScriptAndInputRefNotAllowed); + } + + Ok(TxInfo::V1(TxInfoV1 { + inputs: get_tx_in_info_v1(&tx.transaction_body.inputs, utxos)?, + outputs: get_outputs_info(TxOut::V1, &tx.transaction_body.outputs[..]), + fee: get_fee_info(&tx.transaction_body.fee), + mint: get_mint_info(&tx.transaction_body.mint), + dcert: get_certificates_info(&tx.transaction_body.certificates), + wdrl: get_withdrawal_info(&tx.transaction_body.withdrawals), + valid_range: get_validity_range_info(&tx.transaction_body, slot_config), + signatories: get_signatories_info(&tx.transaction_body.required_signers), + data: get_data_info(&tx.transaction_witness_set), + id: tx.transaction_body.original_hash(), + })) + } +} + #[derive(Debug, PartialEq, Clone)] pub struct TxInfoV2 { pub inputs: Vec, @@ -63,6 +96,59 @@ pub struct TxInfoV2 { pub id: Hash<32>, } +impl TxInfoV2 { + pub fn from_transaction( + tx: &MintedTx, + utxos: &[ResolvedInput], + slot_config: &SlotConfig, + ) -> Result { + let inputs = get_tx_in_info_v2(&tx.transaction_body.inputs, utxos)?; + let dcert = get_certificates_info(&tx.transaction_body.certificates); + let wdrl = KeyValuePairs::from(get_withdrawal_info(&tx.transaction_body.withdrawals)); + let mint = get_mint_info(&tx.transaction_body.mint); + + let redeemers = get_redeemers_info( + &tx.transaction_witness_set, + script_purpose_builder(&inputs[..], &mint, &dcert, &wdrl), + )?; + + let reference_inputs = tx + .transaction_body + .reference_inputs + .clone() + .map(|refs| get_tx_in_info_v2(&refs[..], utxos)) + .transpose()? + .unwrap_or_default(); + + Ok(TxInfo::V2(TxInfoV2 { + inputs, + reference_inputs, + outputs: get_outputs_info(TxOut::V2, &tx.transaction_body.outputs[..]), + fee: get_fee_info(&tx.transaction_body.fee), + mint, + dcert, + wdrl, + valid_range: get_validity_range_info(&tx.transaction_body, slot_config), + signatories: get_signatories_info(&tx.transaction_body.required_signers), + data: KeyValuePairs::from(get_data_info(&tx.transaction_witness_set)), + redeemers, + id: tx.transaction_body.original_hash(), + })) + } +} + +pub struct TxInfoV3 {} + +impl TxInfoV3 { + pub fn from_transaction( + _tx: &MintedTx, + _utxos: &[ResolvedInput], + _slot_config: &SlotConfig, + ) -> Result { + todo!("TxInfoV3") + } +} + #[derive(Debug, PartialEq, Clone)] pub enum TxInfo { V1(TxInfoV1), @@ -97,3 +183,353 @@ impl Default for SlotConfig { } } } + +// --------------------- Translations + +pub fn get_tx_in_info_v1( + inputs: &[TransactionInput], + utxos: &[ResolvedInput], +) -> Result, Error> { + inputs + .iter() + .sorted() + .map(|input| { + let utxo = match utxos.iter().find(|utxo| utxo.input == *input) { + Some(resolved) => resolved, + None => return Err(Error::ResolvedInputNotFound(input.clone())), + }; + let address = Address::from_bytes(match &utxo.output { + TransactionOutput::Legacy(output) => output.address.as_ref(), + TransactionOutput::PostAlonzo(output) => output.address.as_ref(), + }) + .unwrap(); + + match address { + Address::Byron(_) => { + return Err(Error::ByronAddressNotAllowed); + } + Address::Stake(_) => { + return Err(Error::NoPaymentCredential); + } + _ => {} + }; + + match &utxo.output { + TransactionOutput::Legacy(_) => {} + TransactionOutput::PostAlonzo(output) => { + if let Some(DatumOption::Data(_)) = output.datum_option { + return Err(Error::InlineDatumNotAllowed); + } + + if output.script_ref.is_some() { + return Err(Error::ScriptAndInputRefNotAllowed); + } + } + } + + Ok(TxInInfo { + out_ref: utxo.input.clone(), + resolved: TxOut::V1(sort_tx_out_value(&utxo.output)), + }) + }) + .collect() +} + +fn get_tx_in_info_v2( + inputs: &[TransactionInput], + utxos: &[ResolvedInput], +) -> Result, Error> { + inputs + .iter() + .sorted() + .map(|input| { + let utxo = match utxos.iter().find(|utxo| utxo.input == *input) { + Some(resolved) => resolved, + None => return Err(Error::ResolvedInputNotFound(input.clone())), + }; + let address = Address::from_bytes(match &utxo.output { + TransactionOutput::Legacy(output) => output.address.as_ref(), + TransactionOutput::PostAlonzo(output) => output.address.as_ref(), + }) + .unwrap(); + + match address { + Address::Byron(_) => { + return Err(Error::ByronAddressNotAllowed); + } + Address::Stake(_) => { + return Err(Error::NoPaymentCredential); + } + _ => {} + }; + + Ok(TxInInfo { + out_ref: utxo.input.clone(), + resolved: TxOut::V2(sort_tx_out_value(&utxo.output)), + }) + }) + .collect() +} + +fn get_mint_info(mint: &Option) -> MintValue { + MintValue { + mint_value: mint + .as_ref() + .map(sort_mint) + .unwrap_or(NonEmptyKeyValuePairs::Indef(vec![])), + } +} + +fn get_outputs_info( + to_tx_out: fn(TransactionOutput) -> TxOut, + outputs: &[MintedTransactionOutput], +) -> Vec { + outputs + .iter() + .cloned() + .map(|output| to_tx_out(sort_tx_out_value(&output.into()))) + .collect() +} + +fn get_fee_info(fee: &Coin) -> Value { + Value::Coin(*fee) +} + +fn get_certificates_info(certificates: &Option>) -> Vec { + certificates.clone().map(|s| s.to_vec()).unwrap_or_default() +} + +fn get_withdrawal_info( + withdrawals: &Option>, +) -> Vec<(Address, Coin)> { + withdrawals + .clone() + .map(|w| { + w.into_iter() + .sorted() + .map(|(reward_account, coin)| (Address::from_bytes(&reward_account).unwrap(), coin)) + .collect() + }) + .unwrap_or_default() +} + +fn get_validity_range_info(body: &MintedTransactionBody, slot_config: &SlotConfig) -> TimeRange { + fn slot_to_begin_posix_time(slot: u64, sc: &SlotConfig) -> u64 { + let ms_after_begin = (slot - sc.zero_slot) * sc.slot_length as u64; + sc.zero_time + ms_after_begin + } + + fn slot_range_to_posix_time_range(slot_range: TimeRange, sc: &SlotConfig) -> TimeRange { + TimeRange { + lower_bound: slot_range + .lower_bound + .map(|lower_bound| slot_to_begin_posix_time(lower_bound, sc)), + upper_bound: slot_range + .upper_bound + .map(|upper_bound| slot_to_begin_posix_time(upper_bound, sc)), + } + } + + slot_range_to_posix_time_range( + TimeRange { + lower_bound: body.validity_interval_start, + upper_bound: body.ttl, + }, + slot_config, + ) +} + +fn get_signatories_info(signers: &Option) -> Vec { + signers + .as_deref() + .map(|s| s.iter().cloned().sorted().collect()) + .unwrap_or_default() +} + +fn get_data_info(witness_set: &MintedWitnessSet) -> Vec<(DatumHash, PlutusData)> { + witness_set + .plutus_data + .as_deref() + .map(|s| { + s.iter() + .cloned() + .map(|d| (d.original_hash(), d.clone().unwrap())) + .sorted() + .collect() + }) + .unwrap_or_default() +} + +fn get_redeemers_info<'a>( + witness_set: &'a MintedWitnessSet, + to_script_purpose: impl Fn(&'a RedeemersKey) -> Result, +) -> Result, Error> { + Ok(KeyValuePairs::from( + witness_set + .redeemer + .as_deref() + .map(|m| { + m.iter() + .sorted_by(|a, b| sort_redeemers(&a.0, &b.0)) + .map(|(redeemer_key, redeemer_value)| { + let redeemer = Redeemer { + tag: redeemer_key.tag, + index: redeemer_key.index, + data: redeemer_value.data.clone(), + ex_units: redeemer_value.ex_units, + }; + + to_script_purpose(redeemer_key).map(|purpose| (purpose, redeemer)) + }) + .collect::, _>>() + }) + .transpose()? + .unwrap_or_default(), + )) +} + +fn script_purpose_builder<'a>( + inputs: &'a [TxInInfo], + mint: &'a MintValue, + dcert: &'a [Certificate], + wdrl: &'a KeyValuePairs, +) -> impl Fn(&'a RedeemersKey) -> Result { + move |redeemer: &'a RedeemersKey| { + let tag = redeemer.tag; + let index = redeemer.index as usize; + match tag { + RedeemerTag::Mint => mint + .mint_value + .get(index) + .map(|(policy_id, _)| ScriptPurpose::Minting(*policy_id)), + RedeemerTag::Spend => inputs + .get(index) + .cloned() + .map(|i| ScriptPurpose::Spending(i.out_ref)), + RedeemerTag::Cert => dcert.get(index).cloned().map(ScriptPurpose::Certifying), + RedeemerTag::Reward => wdrl + .get(index) + .cloned() + .map(|(address, _)| match address { + Address::Stake(stake_address) => match stake_address.payload() { + StakePayload::Script(script_hash) => Ok(ScriptPurpose::Rewarding( + StakeCredential::Scripthash(*script_hash), + )), + StakePayload::Stake(_) => Err(Error::ScriptKeyHash), + }, + _ => Err(Error::BadWithdrawalAddress), + }) + .transpose()?, + tag => todo!("get_script_purpose for {tag:?}"), + } + .ok_or(Error::ExtraneousRedeemer) + } +} + +fn from_alonzo_value(value: &alonzo::Value) -> Value { + match value { + alonzo::Value::Coin(coin) => Value::Coin(*coin), + alonzo::Value::Multiasset(coin, assets) if assets.is_empty() => Value::Coin(*coin), + alonzo::Value::Multiasset(coin, assets) => Value::Multiasset( + *coin, + NonEmptyKeyValuePairs::try_from( + assets + .iter() + .cloned() + .map(|(policy_id, tokens)| { + ( + policy_id, + NonEmptyKeyValuePairs::try_from( + tokens + .iter() + .cloned() + .map(|(asset_name, quantity)| { + ( + asset_name, + quantity.try_into().expect("0 Ada in output value?"), + ) + }) + .collect_vec(), + ) + .expect("empty tokens under a policy?"), + ) + }) + .collect_vec(), + ) + .expect("assets cannot be empty due to pattern-guard"), + ), + } +} + +// --------------------- Sorting + +fn sort_tx_out_value(tx_output: &TransactionOutput) -> TransactionOutput { + match tx_output { + TransactionOutput::Legacy(output) => { + let new_output = PostAlonzoTransactionOutput { + address: output.address.clone(), + value: sort_value(&from_alonzo_value(&output.amount)), + datum_option: output.datum_hash.map(PseudoDatumOption::Hash), + script_ref: None, + }; + TransactionOutput::PostAlonzo(new_output) + } + TransactionOutput::PostAlonzo(output) => { + let mut new_output = output.clone(); + new_output.value = sort_value(&output.value); + TransactionOutput::PostAlonzo(new_output) + } + } +} + +fn sort_mint(mint: &Mint) -> Mint { + let mut mint_vec = vec![]; + + for m in mint.deref().iter().sorted() { + mint_vec.push(( + m.0, + NonEmptyKeyValuePairs::Indef( + m.1.deref().clone().into_iter().sorted().clone().collect(), + ), + )); + } + + NonEmptyKeyValuePairs::Indef(mint_vec) +} + +fn sort_value(value: &Value) -> Value { + match value { + Value::Coin(_) => value.clone(), + Value::Multiasset(coin, ma) => { + let mut ma_vec = vec![]; + for m in ma.deref().iter().sorted() { + ma_vec.push(( + m.0, + NonEmptyKeyValuePairs::Indef( + m.1.deref().clone().into_iter().sorted().clone().collect(), + ), + )); + } + Value::Multiasset(*coin, NonEmptyKeyValuePairs::Indef(ma_vec)) + } + } +} + +fn sort_redeemers(a: &RedeemersKey, b: &RedeemersKey) -> Ordering { + fn redeemer_tag_as_usize(tag: &RedeemerTag) -> usize { + match tag { + RedeemerTag::Spend => 0, + RedeemerTag::Mint => 1, + RedeemerTag::Cert => 2, + RedeemerTag::Reward => 3, + RedeemerTag::Vote => 4, + RedeemerTag::Propose => 5, + } + } + + if a.tag == b.tag { + a.index.cmp(&b.index) + } else { + redeemer_tag_as_usize(&a.tag).cmp(&redeemer_tag_as_usize(&b.tag)) + } +} diff --git a/crates/uplc/src/tx/tests.rs b/crates/uplc/src/tx/tests.rs index 3978288b..74e5e372 100644 --- a/crates/uplc/src/tx/tests.rs +++ b/crates/uplc/src/tx/tests.rs @@ -1,14 +1,12 @@ +use super::{eval_phase_two, ResolvedInput, SlotConfig}; +use crate::machine::cost_model::ExBudget; use pallas_codec::utils::MaybeIndefArray; use pallas_primitives::{ - babbage::{CostMdls, TransactionInput, TransactionOutput}, + conway::{CostMdls, TransactionInput, TransactionOutput}, Fragment, }; use pallas_traverse::{Era, MultiEraTx}; -use crate::machine::cost_model::ExBudget; - -use super::{eval_phase_two, ResolvedInput, SlotConfig}; - #[test] fn test_eval_0() { /* @@ -227,6 +225,7 @@ fn test_eval_0() { let cost_mdl = CostMdls { plutus_v1: None, plutus_v2: Some(costs), + plutus_v3: None, }; let initial_budget = ExBudget { @@ -234,11 +233,12 @@ fn test_eval_0() { mem: 14000000, }; - let multi_era_tx = MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes) + let multi_era_tx = MultiEraTx::decode_for_era(Era::Conway, &tx_bytes) + .or_else(|_| MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes)) .or_else(|_| MultiEraTx::decode_for_era(Era::Alonzo, &tx_bytes)) .unwrap(); match multi_era_tx { - MultiEraTx::Babbage(tx) => { + MultiEraTx::Conway(tx) => { let redeemers = eval_phase_two( &tx, &utxos, @@ -497,6 +497,7 @@ fn test_eval_1() { let cost_mdl = CostMdls { plutus_v1: None, plutus_v2: Some(costs), + plutus_v3: None, }; let initial_budget = ExBudget { @@ -504,11 +505,13 @@ fn test_eval_1() { mem: 14000000, }; - let multi_era_tx = MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes) + let multi_era_tx = MultiEraTx::decode_for_era(Era::Conway, &tx_bytes) + .or_else(|_| MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes)) .or_else(|_| MultiEraTx::decode_for_era(Era::Alonzo, &tx_bytes)) .unwrap(); + match multi_era_tx { - MultiEraTx::Babbage(tx) => { + MultiEraTx::Conway(tx) => { let redeemers = eval_phase_two( &tx, &utxos, @@ -606,6 +609,7 @@ fn test_eval_2() { let cost_mdl = CostMdls { plutus_v1: Some(costs), plutus_v2: None, + plutus_v3: None, }; let initial_budget = ExBudget { @@ -613,11 +617,12 @@ fn test_eval_2() { mem: 14000000, }; - let multi_era_tx = MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes) + let multi_era_tx = MultiEraTx::decode_for_era(Era::Conway, &tx_bytes) + .or_else(|_| MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes)) .or_else(|_| MultiEraTx::decode_for_era(Era::Alonzo, &tx_bytes)) .unwrap(); match multi_era_tx { - MultiEraTx::Babbage(tx) => { + MultiEraTx::Conway(tx) => { let redeemers = eval_phase_two( &tx, &utxos, @@ -874,6 +879,7 @@ fn test_eval_3() { let cost_mdl = CostMdls { plutus_v1: None, plutus_v2: Some(costs), + plutus_v3: None, }; let initial_budget = ExBudget { @@ -881,11 +887,12 @@ fn test_eval_3() { mem: 14000000, }; - let multi_era_tx = MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes) + let multi_era_tx = MultiEraTx::decode_for_era(Era::Conway, &tx_bytes) + .or_else(|_| MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes)) .or_else(|_| MultiEraTx::decode_for_era(Era::Alonzo, &tx_bytes)) .unwrap(); match multi_era_tx { - MultiEraTx::Babbage(tx) => { + MultiEraTx::Conway(tx) => { let redeemers = eval_phase_two( &tx, &utxos, @@ -980,6 +987,7 @@ fn test_eval_4() { let cost_mdl = CostMdls { plutus_v1: Some(costs), plutus_v2: None, + plutus_v3: None, }; let initial_budget = ExBudget { @@ -987,11 +995,12 @@ fn test_eval_4() { mem: 14000000, }; - let multi_era_tx = MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes) + let multi_era_tx = MultiEraTx::decode_for_era(Era::Conway, &tx_bytes) + .or_else(|_| MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes)) .or_else(|_| MultiEraTx::decode_for_era(Era::Alonzo, &tx_bytes)) .unwrap(); match multi_era_tx { - MultiEraTx::Babbage(tx) => { + MultiEraTx::Conway(tx) => { assert!(eval_phase_two( &tx, &utxos, @@ -1063,6 +1072,7 @@ fn test_eval_5() { let cost_mdl = CostMdls { plutus_v1: Some(costs), plutus_v2: None, + plutus_v3: None, }; let initial_budget = ExBudget { @@ -1070,11 +1080,12 @@ fn test_eval_5() { mem: 14000000, }; - let multi_era_tx = MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes) + let multi_era_tx = MultiEraTx::decode_for_era(Era::Conway, &tx_bytes) + .or_else(|_| MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes)) .or_else(|_| MultiEraTx::decode_for_era(Era::Alonzo, &tx_bytes)) .unwrap(); match multi_era_tx { - MultiEraTx::Babbage(tx) => { + MultiEraTx::Conway(tx) => { let redeemers = eval_phase_two( &tx, &utxos, @@ -1171,6 +1182,7 @@ fn test_eval_6() { let cost_mdl = CostMdls { plutus_v1: Some(costs), plutus_v2: None, + plutus_v3: None, }; let initial_budget = ExBudget { @@ -1178,11 +1190,12 @@ fn test_eval_6() { mem: 14000000, }; - let multi_era_tx = MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes) + let multi_era_tx = MultiEraTx::decode_for_era(Era::Conway, &tx_bytes) + .or_else(|_| MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes)) .or_else(|_| MultiEraTx::decode_for_era(Era::Alonzo, &tx_bytes)) .unwrap(); match multi_era_tx { - MultiEraTx::Babbage(tx) => { + MultiEraTx::Conway(tx) => { let redeemers = eval_phase_two( &tx, &utxos, @@ -1279,6 +1292,7 @@ fn test_eval_7() { let cost_mdl = CostMdls { plutus_v1: Some(costs), plutus_v2: None, + plutus_v3: None, }; let initial_budget = ExBudget { @@ -1286,11 +1300,12 @@ fn test_eval_7() { mem: 14000000, }; - let multi_era_tx = MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes) + let multi_era_tx = MultiEraTx::decode_for_era(Era::Conway, &tx_bytes) + .or_else(|_| MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes)) .or_else(|_| MultiEraTx::decode_for_era(Era::Alonzo, &tx_bytes)) .unwrap(); match multi_era_tx { - MultiEraTx::Babbage(tx) => { + MultiEraTx::Conway(tx) => { let redeemers = eval_phase_two( &tx, &utxos, @@ -1538,6 +1553,7 @@ fn test_eval_8() { let cost_mdl = CostMdls { plutus_v1: None, plutus_v2: Some(costs), + plutus_v3: None, }; let initial_budget = ExBudget { @@ -1545,11 +1561,12 @@ fn test_eval_8() { mem: 14000000, }; - let multi_era_tx = MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes) + let multi_era_tx = MultiEraTx::decode_for_era(Era::Conway, &tx_bytes) + .or_else(|_| MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes)) .or_else(|_| MultiEraTx::decode_for_era(Era::Alonzo, &tx_bytes)) .unwrap(); match multi_era_tx { - MultiEraTx::Babbage(tx) => { + MultiEraTx::Conway(tx) => { let redeemers = eval_phase_two( &tx, &utxos, @@ -1593,12 +1610,13 @@ fn test_eval_8() { fn eval_missing_redeemer() { let tx_bytes = hex::decode("84a30082825820275b5da338c8b899035081eb34bfa950b634911a5dd3271b3ad6cf4c2bba0c5000825820275b5da338c8b899035081eb34bfa950b634911a5dd3271b3ad6cf4c2bba0c50010181825839000af00cc47500bb64cfffb783e8c42f746b4e8b8a70ede9c08c7113acf3bde34d1041f5a2076ef9aa6cf4539ab1a96ed462a0300acbdb65d51a02cf47c8021a00028d89a1068149480100002221200101f5f6").unwrap(); - let multi_era_tx = MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes) + let multi_era_tx = MultiEraTx::decode_for_era(Era::Conway, &tx_bytes) + .or_else(|_| MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes)) .or_else(|_| MultiEraTx::decode_for_era(Era::Alonzo, &tx_bytes)) .unwrap(); let inputs = multi_era_tx - .as_babbage() + .as_conway() .unwrap() .transaction_body .inputs @@ -1641,6 +1659,7 @@ fn eval_missing_redeemer() { let cost_mdl = CostMdls { plutus_v1: Some(costs), plutus_v2: None, + plutus_v3: None, }; let initial_budget = ExBudget { @@ -1648,12 +1667,13 @@ fn eval_missing_redeemer() { mem: 14000000, }; - let multi_era_tx = MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes) + let multi_era_tx = MultiEraTx::decode_for_era(Era::Conway, &tx_bytes) + .or_else(|_| MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes)) .or_else(|_| MultiEraTx::decode_for_era(Era::Alonzo, &tx_bytes)) .unwrap(); match multi_era_tx { - MultiEraTx::Babbage(tx) => { + MultiEraTx::Conway(tx) => { eval_phase_two( &tx, &utxos, @@ -1673,12 +1693,13 @@ fn eval_missing_redeemer() { fn eval_extraneous_redeemer() { let tx_bytes = hex::decode("84a70082825820275b5da338c8b899035081eb34bfa950b634911a5dd3271b3ad6cf4c2bba0c5000825820275b5da338c8b899035081eb34bfa950b634911a5dd3271b3ad6cf4c2bba0c50010181825839000af00cc47500bb64cfffb783e8c42f746b4e8b8a70ede9c08c7113acf3bde34d1041f5a2076ef9aa6cf4539ab1a96ed462a0300acbdb65d51a02cf2b47021a0002aa0a0b5820fc54f302cff3a8a1cb374f5e4979e18a1d3627dcf4539637b03f5959eb8565bf0d81825820275b5da338c8b899035081eb34bfa950b634911a5dd3271b3ad6cf4c2bba0c500110825839000af00cc47500bb64cfffb783e8c42f746b4e8b8a70ede9c08c7113acf3bde34d1041f5a2076ef9aa6cf4539ab1a96ed462a0300acbdb65d51a02af51c2111a0003ff0fa40081825820065dd553fbe4e240a8f819bb9e333a7483de4a22b65c7fb6a95ce9450f84dff758402c26125a057a696079d08f2c8c9d2b8ccda9fe7cf7360c1a86712b85a91db82a3b80996b30ba6f4b2f969c93eb50694e0f6ea0bcf129080dcc07ecd9e605f00a049fd87980ff0582840000d879808219044c1a000382d48401001864821903e81903e8068149480100002221200101f5f6").unwrap(); - let multi_era_tx = MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes) + let multi_era_tx = MultiEraTx::decode_for_era(Era::Conway, &tx_bytes) + .or_else(|_| MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes)) .or_else(|_| MultiEraTx::decode_for_era(Era::Alonzo, &tx_bytes)) .unwrap(); let inputs = multi_era_tx - .as_babbage() + .as_conway() .unwrap() .transaction_body .inputs @@ -1721,6 +1742,7 @@ fn eval_extraneous_redeemer() { let cost_mdl = CostMdls { plutus_v1: Some(costs), plutus_v2: None, + plutus_v3: None, }; let initial_budget = ExBudget { @@ -1728,12 +1750,13 @@ fn eval_extraneous_redeemer() { mem: 14000000, }; - let multi_era_tx = MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes) + let multi_era_tx = MultiEraTx::decode_for_era(Era::Conway, &tx_bytes) + .or_else(|_| MultiEraTx::decode_for_era(Era::Babbage, &tx_bytes)) .or_else(|_| MultiEraTx::decode_for_era(Era::Alonzo, &tx_bytes)) .unwrap(); match multi_era_tx { - MultiEraTx::Babbage(tx) => { + MultiEraTx::Conway(tx) => { assert!(eval_phase_two( &tx, &utxos, diff --git a/crates/uplc/src/tx/to_plutus_data.rs b/crates/uplc/src/tx/to_plutus_data.rs index e96ee842..79701b8f 100644 --- a/crates/uplc/src/tx/to_plutus_data.rs +++ b/crates/uplc/src/tx/to_plutus_data.rs @@ -1,17 +1,14 @@ +use super::script_context::{ScriptContext, ScriptPurpose, TimeRange, TxInInfo, TxInfo, TxOut}; +use crate::machine::runtime::{convert_constr_to_tag, ANY_TAG}; use pallas_addresses::{Address, ShelleyDelegationPart, ShelleyPaymentPart, StakePayload}; use pallas_codec::utils::{AnyUInt, Bytes, Int, KeyValuePairs}; use pallas_crypto::hash::Hash; -use pallas_primitives::babbage::{AssetName, BigInt, Constr, Mint, PlutusData, ScriptRef}; -use pallas_primitives::babbage::{ - Certificate, DatumOption, PseudoScript, Redeemer, StakeCredential, TransactionInput, - TransactionOutput, Value, +use pallas_primitives::conway::{ + AssetName, BigInt, Certificate, Constr, DatumOption, Mint, PlutusData, PseudoScript, Redeemer, + ScriptRef, StakeCredential, TransactionInput, TransactionOutput, Value, }; use pallas_traverse::ComputeHash; -use crate::machine::runtime::{convert_constr_to_tag, ANY_TAG}; - -use super::script_context::{ScriptContext, ScriptPurpose, TimeRange, TxInInfo, TxInfo, TxOut}; - fn wrap_with_constr(index: u64, data: PlutusData) -> PlutusData { let converted = convert_constr_to_tag(index); PlutusData::Constr(Constr { @@ -235,7 +232,8 @@ impl ToPlutusData for Value { for (policy_id, assets) in multiassets.iter() { let mut assets_vec = vec![]; for (asset, amount) in assets.iter() { - assets_vec.push((asset.to_plutus_data(), amount.to_plutus_data())); + assets_vec + .push((asset.to_plutus_data(), u64::from(amount).to_plutus_data())); } data_vec.push(( policy_id.to_plutus_data(), @@ -262,7 +260,7 @@ impl ToPlutusData for MintValue { for (policy_id, assets) in self.mint_value.iter() { let mut assets_vec = vec![]; for (asset, amount) in assets.iter() { - assets_vec.push((asset.to_plutus_data(), amount.to_plutus_data())); + assets_vec.push((asset.to_plutus_data(), i64::from(amount).to_plutus_data())); } data_vec.push(( policy_id.to_plutus_data(), @@ -282,6 +280,7 @@ impl ToPlutusData for ScriptRef { } PseudoScript::PlutusV1Script(plutus_v1) => plutus_v1.compute_hash().to_plutus_data(), PseudoScript::PlutusV2Script(plutus_v2) => plutus_v2.compute_hash().to_plutus_data(), + PseudoScript::PlutusV3Script(plutus_v3) => plutus_v3.compute_hash().to_plutus_data(), } } } @@ -290,16 +289,17 @@ impl ToPlutusData for TxOut { fn to_plutus_data(&self) -> PlutusData { match self { TxOut::V1(output) => match output { - TransactionOutput::Legacy(legacy_output) => wrap_multiple_with_constr( - 0, - vec![ - Address::from_bytes(&legacy_output.address) - .unwrap() - .to_plutus_data(), - legacy_output.amount.to_plutus_data(), - legacy_output.datum_hash.to_plutus_data(), - ], - ), + // TransactionOutput::Legacy(legacy_output) => wrap_multiple_with_constr( + // 0, + // vec![ + // Address::from_bytes(&legacy_output.address) + // .unwrap() + // .to_plutus_data(), + // legacy_output.amount.to_plutus_data(), + // legacy_output.datum_hash.to_plutus_data(), + // ], + // ), + TransactionOutput::Legacy(..) => todo!("TransactionOutput::Legacy"), TransactionOutput::PostAlonzo(post_alonzo_output) => wrap_multiple_with_constr( 0, vec![ @@ -315,20 +315,21 @@ impl ToPlutusData for TxOut { ), }, TxOut::V2(output) => match output { - TransactionOutput::Legacy(legacy_output) => wrap_multiple_with_constr( - 0, - vec![ - Address::from_bytes(&legacy_output.address) - .unwrap() - .to_plutus_data(), - legacy_output.amount.to_plutus_data(), - match legacy_output.datum_hash { - Some(hash) => wrap_with_constr(1, hash.to_plutus_data()), - _ => empty_constr(0), - }, - None::.to_plutus_data(), - ], - ), + // TransactionOutput::Legacy(legacy_output) => wrap_multiple_with_constr( + // 0, + // vec![ + // Address::from_bytes(&legacy_output.address) + // .unwrap() + // .to_plutus_data(), + // legacy_output.amount.to_plutus_data(), + // match legacy_output.datum_hash { + // Some(hash) => wrap_with_constr(1, hash.to_plutus_data()), + // _ => empty_constr(0), + // }, + // None::.to_plutus_data(), + // ], + // ), + TransactionOutput::Legacy(..) => todo!("TransactionOutput::Legacy"), TransactionOutput::PostAlonzo(post_alonzo_output) => wrap_multiple_with_constr( 0, vec![ @@ -401,8 +402,18 @@ impl ToPlutusData for Certificate { 4, vec![pool_keyhash.to_plutus_data(), epoch.to_plutus_data()], ), - Certificate::GenesisKeyDelegation(_, _, _) => empty_constr(5), - Certificate::MoveInstantaneousRewardsCert(_) => empty_constr(6), + _ => todo!("other certificates"), // Reg(StakeCredential, Coin), + // UnReg(StakeCredential, Coin), + // VoteDeleg(StakeCredential, DRep), + // StakeVoteDeleg(StakeCredential, PoolKeyhash, DRep), + // StakeRegDeleg(StakeCredential, PoolKeyhash, Coin), + // VoteRegDeleg(StakeCredential, DRep, Coin), + // StakeVoteRegDeleg(StakeCredential, PoolKeyhash, DRep, Coin), + // AuthCommitteeHot(CommitteeColdCredential, CommitteeHotCredential), + // ResignCommitteeCold(CommitteeColdCredential, Nullable), + // RegDRepCert(DRepCredential, Coin, Nullable), + // UnRegDRepCert(DRepCredential, Coin), + // UpdateDRepCert(StakeCredential, Nullable), } } }