From 093ddf32d8aff3d8fd99048caa7f2bcec4c71f7d Mon Sep 17 00:00:00 2001 From: Chris Smith <1979423+chris13524@users.noreply.github.com> Date: Tue, 7 Jan 2025 11:57:02 -0800 Subject: [PATCH] fix: update yttrium and smart sessions (#886) * fix: update yttrium and smart sessions * fix: add permitERC4337Paymaster field and fix build * chore: fix build & tests * chore: bump yttrium * chore: bump yttrium & alloy * chore: bump yttrium --- Cargo.lock | 310 ++++++++++----------- Cargo.toml | 4 +- src/handlers/chain_agnostic/route.rs | 74 ++--- src/handlers/wallet/get_calls_status.rs | 6 +- src/handlers/wallet/prepare_calls.rs | 59 ++-- src/handlers/wallet/send_prepared_calls.rs | 14 + src/utils/sessions.rs | 8 +- 7 files changed, 252 insertions(+), 223 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9988696a8..a0fb03221 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -131,29 +131,29 @@ dependencies = [ [[package]] name = "alloy" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02b0561294ccedc6181e5528b850b4579e3fbde696507baa00109bfd9054c5bb" +checksum = "bbcc41e8a11a4975b18ec6afba2cc48d591fa63336a4c526dacb50479a8d6b35" dependencies = [ - "alloy-consensus 0.7.3", - "alloy-contract 0.7.3", + "alloy-consensus 0.9.2", + "alloy-contract 0.9.2", "alloy-core", - "alloy-eips 0.7.3", - "alloy-genesis 0.7.3", - "alloy-json-rpc 0.7.3", - "alloy-network 0.7.3", + "alloy-eips 0.9.2", + "alloy-genesis 0.9.2", + "alloy-json-rpc 0.9.2", + "alloy-network 0.9.2", "alloy-node-bindings", - "alloy-provider 0.7.3", - "alloy-rpc-client 0.7.3", - "alloy-rpc-types 0.7.3", - "alloy-serde 0.7.3", - "alloy-signer 0.7.3", + "alloy-provider 0.9.2", + "alloy-rpc-client 0.9.2", + "alloy-rpc-types 0.9.2", + "alloy-serde 0.9.2", + "alloy-signer 0.9.2", "alloy-signer-aws", "alloy-signer-gcp", "alloy-signer-ledger", "alloy-signer-local", - "alloy-transport 0.7.3", - "alloy-transport-http 0.7.3", + "alloy-transport 0.9.2", + "alloy-transport-http 0.9.2", ] [[package]] @@ -183,14 +183,14 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a101d4d016f47f13890a74290fdd17b05dd175191d9337bc600791fb96e4dea8" +checksum = "f4138dc275554afa6f18c4217262ac9388790b2fc393c2dfe03c51d357abf013" dependencies = [ - "alloy-eips 0.7.3", + "alloy-eips 0.9.2", "alloy-primitives", "alloy-rlp", - "alloy-serde 0.7.3", + "alloy-serde 0.9.2", "alloy-trie", "auto_impl", "c-kzg", @@ -200,15 +200,15 @@ dependencies = [ [[package]] name = "alloy-consensus-any" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa60357dda9a3d0f738f18844bd6d0f4a5924cc5cf00bfad2ff1369897966123" +checksum = "0fa04e1882c31288ce1028fdf31b6ea94cfa9eafa2e497f903ded631c8c6a42c" dependencies = [ - "alloy-consensus 0.7.3", - "alloy-eips 0.7.3", + "alloy-consensus 0.9.2", + "alloy-eips 0.9.2", "alloy-primitives", "alloy-rlp", - "alloy-serde 0.7.3", + "alloy-serde 0.9.2", "serde", ] @@ -234,19 +234,19 @@ dependencies = [ [[package]] name = "alloy-contract" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2869e4fb31331d3b8c58c7db567d1e4e4e94ef64640beda3b6dd9b7045690941" +checksum = "5f21886c1fea0626f755a49b2ac653b396fb345233f6170db2da3d0ada31560c" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", - "alloy-network 0.7.3", - "alloy-network-primitives 0.7.3", + "alloy-network 0.9.2", + "alloy-network-primitives 0.9.2", "alloy-primitives", - "alloy-provider 0.7.3", - "alloy-rpc-types-eth 0.7.3", + "alloy-provider 0.9.2", + "alloy-rpc-types-eth 0.9.2", "alloy-sol-types", - "alloy-transport 0.7.3", + "alloy-transport 0.9.2", "futures", "futures-util", "thiserror 2.0.3", @@ -254,9 +254,9 @@ dependencies = [ [[package]] name = "alloy-core" -version = "0.8.12" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8316d83e590f4163b221b8180008f302bda5cf5451202855cdd323e588849c" +checksum = "c618bd382f0bc2ac26a7e4bfae01c9b015ca8f21b37ca40059ae35a7e62b3dc6" dependencies = [ "alloy-dyn-abi", "alloy-json-abi", @@ -267,9 +267,9 @@ dependencies = [ [[package]] name = "alloy-dyn-abi" -version = "0.8.12" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef2364c782a245cf8725ea6dbfca5f530162702b5d685992ea03ce64529136cc" +checksum = "41056bde53ae10ffbbf11618efbe1e0290859e5eab0fe9ef82ebdb62f12a866f" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -307,9 +307,9 @@ dependencies = [ [[package]] name = "alloy-eip7702" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f6cee6a35793f3db8a5ffe60e86c695f321d081a567211245f503e8c498fce8" +checksum = "cabf647eb4650c91a9d38cb6f972bb320009e7e9d61765fb688a86f1563b33e8" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -337,15 +337,15 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b6755b093afef5925f25079dd5a7c8d096398b804ba60cb5275397b06b31689" +checksum = "52dd5869ed09e399003e0e0ec6903d981b2a92e74c5d37e6b40890bad2517526" dependencies = [ "alloy-eip2930", - "alloy-eip7702 0.4.1", + "alloy-eip7702 0.5.0", "alloy-primitives", "alloy-rlp", - "alloy-serde 0.7.3", + "alloy-serde 0.9.2", "c-kzg", "derive_more 1.0.0", "once_cell", @@ -366,21 +366,22 @@ dependencies = [ [[package]] name = "alloy-genesis" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeec8e6eab6e52b7c9f918748c9b811e87dbef7312a2e3a2ca1729a92966a6af" +checksum = "e7d2a7fe5c1a9bd6793829ea21a636f30fc2b3f5d2e7418ba86d96e41dd1f460" dependencies = [ + "alloy-eips 0.9.2", "alloy-primitives", - "alloy-serde 0.7.3", + "alloy-serde 0.9.2", "alloy-trie", "serde", ] [[package]] name = "alloy-json-abi" -version = "0.8.12" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b84c506bf264110fa7e90d9924f742f40ef53c6572ea56a0b0bd714a567ed389" +checksum = "c357da577dfb56998d01f574d81ad7a1958d248740a7981b205d69d65a7da404" dependencies = [ "alloy-primitives", "alloy-sol-type-parser", @@ -404,9 +405,9 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fa077efe0b834bcd89ff4ba547f48fb081e4fdc3673dd7da1b295a2cf2bb7b7" +checksum = "2008bedb8159a255b46b7c8614516eda06679ea82f620913679afbd8031fea72" dependencies = [ "alloy-primitives", "alloy-sol-types", @@ -439,20 +440,20 @@ dependencies = [ [[package]] name = "alloy-network" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "209a1882a08e21aca4aac6e2a674dc6fcf614058ef8cb02947d63782b1899552" +checksum = "4556f01fe41d0677495df10a648ddcf7ce118b0e8aa9642a0e2b6dd1fb7259de" dependencies = [ - "alloy-consensus 0.7.3", + "alloy-consensus 0.9.2", "alloy-consensus-any", - "alloy-eips 0.7.3", - "alloy-json-rpc 0.7.3", - "alloy-network-primitives 0.7.3", + "alloy-eips 0.9.2", + "alloy-json-rpc 0.9.2", + "alloy-network-primitives 0.9.2", "alloy-primitives", "alloy-rpc-types-any", - "alloy-rpc-types-eth 0.7.3", - "alloy-serde 0.7.3", - "alloy-signer 0.7.3", + "alloy-rpc-types-eth 0.9.2", + "alloy-serde 0.9.2", + "alloy-signer 0.9.2", "alloy-sol-types", "async-trait", "auto_impl", @@ -476,24 +477,24 @@ dependencies = [ [[package]] name = "alloy-network-primitives" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20219d1ad261da7a6331c16367214ee7ded41d001fabbbd656fbf71898b2773" +checksum = "f31c3c6b71340a1d076831823f09cb6e02de01de5c6630a9631bdb36f947ff80" dependencies = [ - "alloy-consensus 0.7.3", - "alloy-eips 0.7.3", + "alloy-consensus 0.9.2", + "alloy-eips 0.9.2", "alloy-primitives", - "alloy-serde 0.7.3", + "alloy-serde 0.9.2", "serde", ] [[package]] name = "alloy-node-bindings" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bffcf33dd319f21cd6f066d81cbdef0326d4bdaaf7cfe91110bc090707858e9f" +checksum = "4520cd4bc5cec20c32c98e4bc38914c7fb96bf4a712105e44da186a54e65e3ba" dependencies = [ - "alloy-genesis 0.7.3", + "alloy-genesis 0.9.2", "alloy-primitives", "k256", "rand", @@ -568,26 +569,26 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9eefa6f4c798ad01f9b4202d02cea75f5ec11fa180502f4701e2b47965a8c0bb" +checksum = "5a22c4441b3ebe2d77fa9cf629ba68c3f713eb91779cff84275393db97eddd82" dependencies = [ "alloy-chains", - "alloy-consensus 0.7.3", - "alloy-eips 0.7.3", - "alloy-json-rpc 0.7.3", - "alloy-network 0.7.3", - "alloy-network-primitives 0.7.3", + "alloy-consensus 0.9.2", + "alloy-eips 0.9.2", + "alloy-json-rpc 0.9.2", + "alloy-network 0.9.2", + "alloy-network-primitives 0.9.2", "alloy-node-bindings", "alloy-primitives", - "alloy-rpc-client 0.7.3", + "alloy-rpc-client 0.9.2", "alloy-rpc-types-anvil", - "alloy-rpc-types-eth 0.7.3", + "alloy-rpc-types-eth 0.9.2", "alloy-rpc-types-trace", - "alloy-signer 0.7.3", + "alloy-signer 0.9.2", "alloy-signer-local", - "alloy-transport 0.7.3", - "alloy-transport-http 0.7.3", + "alloy-transport 0.9.2", + "alloy-transport-http 0.9.2", "async-stream", "async-trait", "auto_impl", @@ -653,14 +654,14 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed30bf1041e84cabc5900f52978ca345dd9969f2194a945e6fdec25b0620705c" +checksum = "d06a292b37e182e514903ede6e623b9de96420e8109ce300da288a96d88b7e4b" dependencies = [ - "alloy-json-rpc 0.7.3", + "alloy-json-rpc 0.9.2", "alloy-primitives", - "alloy-transport 0.7.3", - "alloy-transport-http 0.7.3", + "alloy-transport 0.9.2", + "alloy-transport-http 0.9.2", "futures", "pin-project 1.1.7", "reqwest 0.12.9", @@ -687,38 +688,38 @@ dependencies = [ [[package]] name = "alloy-rpc-types" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ab686b0fa475d2a4f5916c5f07797734a691ec58e44f0f55d4746ea39cbcefb" +checksum = "9383845dd924939e7ab0298bbfe231505e20928907d7905aa3bf112287305e06" dependencies = [ "alloy-primitives", - "alloy-rpc-types-eth 0.7.3", + "alloy-rpc-types-eth 0.9.2", "alloy-rpc-types-trace", - "alloy-serde 0.7.3", + "alloy-serde 0.9.2", "serde", ] [[package]] name = "alloy-rpc-types-anvil" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d33bc190844626c08e21897736dbd7956ab323c09e6f141b118d1c8b7aff689e" +checksum = "11495cb8c8d3141fc27556a4c9188b81531ad5ec3076a0394c61a6dcfbce9f34" dependencies = [ "alloy-primitives", - "alloy-rpc-types-eth 0.7.3", - "alloy-serde 0.7.3", + "alloy-rpc-types-eth 0.9.2", + "alloy-serde 0.9.2", "serde", ] [[package]] name = "alloy-rpc-types-any" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "200661999b6e235d9840be5d60a6e8ae2f0af9eb2a256dd378786744660e36ec" +checksum = "ca445cef0eb6c2cf51cfb4e214fbf1ebd00893ae2e6f3b944c8101b07990f988" dependencies = [ "alloy-consensus-any", - "alloy-rpc-types-eth 0.7.3", - "alloy-serde 0.7.3", + "alloy-rpc-types-eth 0.9.2", + "alloy-serde 0.9.2", ] [[package]] @@ -744,33 +745,33 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0600b8b5e2dc0cab12cbf91b5a885c35871789fb7b3a57b434bd4fced5b7a8b" +checksum = "0938bc615c02421bd86c1733ca7205cc3d99a122d9f9bff05726bd604b76a5c2" dependencies = [ - "alloy-consensus 0.7.3", + "alloy-consensus 0.9.2", "alloy-consensus-any", - "alloy-eips 0.7.3", - "alloy-network-primitives 0.7.3", + "alloy-eips 0.9.2", + "alloy-network-primitives 0.9.2", "alloy-primitives", "alloy-rlp", - "alloy-serde 0.7.3", + "alloy-serde 0.9.2", "alloy-sol-types", - "derive_more 1.0.0", "itertools 0.13.0", "serde", "serde_json", + "thiserror 2.0.3", ] [[package]] name = "alloy-rpc-types-trace" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e073ab0e67429c60be281e181731132fd07d82e091c10c29ace6935101034bb" +checksum = "cd38207e056cc7d1372367fbb4560ddf9107cbd20731743f641246bf0dede149" dependencies = [ "alloy-primitives", - "alloy-rpc-types-eth 0.7.3", - "alloy-serde 0.7.3", + "alloy-rpc-types-eth 0.9.2", + "alloy-serde 0.9.2", "serde", "serde_json", "thiserror 2.0.3", @@ -789,9 +790,9 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afa753a97002a33b2ccb707d9f15f31c81b8c1b786c95b73cc62bb1d1fd0c3f" +checksum = "ae0465c71d4dced7525f408d84873aeebb71faf807d22d74c4a426430ccd9b55" dependencies = [ "alloy-primitives", "serde", @@ -814,9 +815,9 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2cbff01a673936c2efd7e00d4c0e9a4dbbd6d600e2ce298078d33efbb19cd7" +checksum = "9bfa395ad5cc952c82358d31e4c68b27bf4a89a5456d9b27e226e77dac50e4ff" dependencies = [ "alloy-dyn-abi", "alloy-primitives", @@ -830,14 +831,14 @@ dependencies = [ [[package]] name = "alloy-signer-aws" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71ce77227fdb9059fd7a3b38a8679c0dae95d81886ee8c13ef8ad99d74866bbd" +checksum = "0eb06810c34427d499863817eb506acf57cb9ded9224b374116cae4e22dbd4e9" dependencies = [ - "alloy-consensus 0.7.3", - "alloy-network 0.7.3", + "alloy-consensus 0.9.2", + "alloy-network 0.9.2", "alloy-primitives", - "alloy-signer 0.7.3", + "alloy-signer 0.9.2", "async-trait", "aws-sdk-kms", "k256", @@ -848,14 +849,14 @@ dependencies = [ [[package]] name = "alloy-signer-gcp" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7622438a51e1fa6379cad6bff52e0cde88b0d4e5e3f2f15e5feebdee527ef5f2" +checksum = "d629e63fec8802ad53706d46e8eceeeae2b135c6648d0de41669a523bf17df4a" dependencies = [ - "alloy-consensus 0.7.3", - "alloy-network 0.7.3", + "alloy-consensus 0.9.2", + "alloy-network 0.9.2", "alloy-primitives", - "alloy-signer 0.7.3", + "alloy-signer 0.9.2", "async-trait", "gcloud-sdk", "k256", @@ -866,15 +867,15 @@ dependencies = [ [[package]] name = "alloy-signer-ledger" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7b56789cbd13bace37acd7afd080aa7002ed65ab84f0220cd0c32e162b0afd6" +checksum = "b426789566a19252cb46b757d91543a6f8e70330c72f312b86c5878595d092ef" dependencies = [ - "alloy-consensus 0.7.3", + "alloy-consensus 0.9.2", "alloy-dyn-abi", - "alloy-network 0.7.3", + "alloy-network 0.9.2", "alloy-primitives", - "alloy-signer 0.7.3", + "alloy-signer 0.9.2", "alloy-sol-types", "async-trait", "coins-ledger", @@ -886,14 +887,14 @@ dependencies = [ [[package]] name = "alloy-signer-local" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd6d988cb6cd7d2f428a74476515b1a6e901e08c796767f9f93311ab74005c8b" +checksum = "fbdc63ce9eda1283fcbaca66ba4a414b841c0e3edbeef9c86a71242fc9e84ccc" dependencies = [ - "alloy-consensus 0.7.3", - "alloy-network 0.7.3", + "alloy-consensus 0.9.2", + "alloy-network 0.9.2", "alloy-primitives", - "alloy-signer 0.7.3", + "alloy-signer 0.9.2", "async-trait", "coins-bip32 0.12.0", "coins-bip39 0.12.0", @@ -904,9 +905,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro" -version = "0.8.12" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9343289b4a7461ed8bab8618504c995c049c082b70c7332efd7b32125633dc05" +checksum = "d9d64f851d95619233f74b310f12bcf16e0cbc27ee3762b6115c14a84809280a" dependencies = [ "alloy-sol-macro-expander", "alloy-sol-macro-input", @@ -918,9 +919,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-expander" -version = "0.8.12" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4222d70bec485ceccc5d8fd4f2909edd65b5d5e43d4aca0b5dcee65d519ae98f" +checksum = "6bf7ed1574b699f48bf17caab4e6e54c6d12bc3c006ab33d58b1e227c1c3559f" dependencies = [ "alloy-json-abi", "alloy-sol-macro-input", @@ -937,9 +938,9 @@ dependencies = [ [[package]] name = "alloy-sol-macro-input" -version = "0.8.12" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e17f2677369571b976e51ea1430eb41c3690d344fef567b840bfc0b01b6f83a" +checksum = "8c02997ccef5f34f9c099277d4145f183b422938ed5322dc57a089fe9b9ad9ee" dependencies = [ "alloy-json-abi", "const-hex", @@ -954,9 +955,9 @@ dependencies = [ [[package]] name = "alloy-sol-type-parser" -version = "0.8.12" +version = "0.8.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa64d80ae58ffaafdff9d5d84f58d03775f66c84433916dc9a64ed16af5755da" +checksum = "1eda2711ab2e1fb517fc6e2ffa9728c9a232e296d16810810e6957b781a1b8bc" dependencies = [ "serde", "winnow", @@ -964,9 +965,9 @@ dependencies = [ [[package]] name = "alloy-sol-types" -version = "0.8.12" +version = "0.8.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6520d427d4a8eb7aa803d852d7a52ceb0c519e784c292f64bb339e636918cf27" +checksum = "1174cafd6c6d810711b4e00383037bdb458efc4fe3dbafafa16567e0320c54d8" dependencies = [ "alloy-json-abi", "alloy-primitives", @@ -996,11 +997,11 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d69d36982b9e46075ae6b792b0f84208c6c2c15ad49f6c500304616ef67b70e0" +checksum = "d17722a198f33bbd25337660787aea8b8f57814febb7c746bc30407bdfc39448" dependencies = [ - "alloy-json-rpc 0.7.3", + "alloy-json-rpc 0.9.2", "base64 0.22.1", "futures-util", "futures-utils-wasm", @@ -1031,12 +1032,12 @@ dependencies = [ [[package]] name = "alloy-transport-http" -version = "0.7.3" +version = "0.9.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e02ffd5d93ffc51d72786e607c97de3b60736ca3e636ead0ec1f7dce68ea3fd" +checksum = "6e1509599021330a31c4a6816b655e34bf67acb1cc03c564e09fd8754ff6c5de" dependencies = [ - "alloy-json-rpc 0.7.3", - "alloy-transport 0.7.3", + "alloy-json-rpc 0.9.2", + "alloy-transport 0.9.2", "reqwest 0.12.9", "serde_json", "tower 0.5.1", @@ -3270,9 +3271,9 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "erc6492" version = "0.1.0" -source = "git+https://github.com/reown-com/erc6492.git?rev=3e764e1#3e764e12892a41a524de3f3d4082cef91970dff4" +source = "git+https://github.com/reown-com/erc6492.git?rev=703016d#703016d44241365a80b0548c3ab51854808c839a" dependencies = [ - "alloy 0.7.3", + "alloy 0.9.2", ] [[package]] @@ -7554,7 +7555,7 @@ dependencies = [ name = "rpc-proxy" version = "0.155.0" dependencies = [ - "alloy 0.7.3", + "alloy 0.9.2", "anyhow", "async-trait", "async-tungstenite", @@ -8750,9 +8751,9 @@ dependencies = [ [[package]] name = "syn-solidity" -version = "0.8.12" +version = "0.8.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f76fe0a3e1476bdaa0775b9aec5b869ed9520c2b2fedfe9c6df3618f8ea6290b" +checksum = "31e89d8bf2768d277f40573c83a02a099e96d96dd3104e13ea676194e61ac4b0" dependencies = [ "paste", "proc-macro2 1.0.89", @@ -10398,15 +10399,14 @@ dependencies = [ [[package]] name = "yttrium" version = "0.1.0" -source = "git+https://github.com/reown-com/yttrium.git?rev=befa0cb#befa0cb4769684ec48a16303c773c8477da926cd" +source = "git+https://github.com/reown-com/yttrium.git?rev=4f9def1#4f9def10e9f954e1e4ac0a0ea0743e47e28ef586" dependencies = [ - "alloy 0.7.3", - "alloy-provider 0.7.3", + "alloy 0.9.2", + "alloy-provider 0.9.2", "async-trait", "dotenvy", "erc6492", "eyre", - "fastlz-rs", "futures", "getrandom", "hex", diff --git a/Cargo.toml b/Cargo.toml index 63e04792d..90a641bd2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,7 +13,7 @@ build = "build.rs" [dependencies] wc = { git = "https://github.com/WalletConnect/utils-rs.git", tag = "v0.9.0", features = ["alloc", "analytics", "future", "http", "metrics", "geoip", "geoblock", "rate_limit"] } relay_rpc = { git = "https://github.com/WalletConnect/WalletConnectRust.git", tag = "v0.32.0", features = ["cacao"] } -yttrium = { git = "https://github.com/reown-com/yttrium.git", rev = "befa0cb" } +yttrium = { git = "https://github.com/reown-com/yttrium.git", rev = "4f9def1" } # Async async-trait = "0.1.82" @@ -81,7 +81,7 @@ rand = "0.8.5" rand_core = "0.6" prometheus-http-query = "0.6.6" ethers = { version = "2.0.11", git = "https://github.com/gakonst/ethers-rs" } # using Git version because crates.io version fails clippy -alloy = { version = "0.7.3", features = ["providers", "json-rpc"] } +alloy = { version = "0.9.2", features = ["providers", "json-rpc"] } fastlz-rs = "0.0.3" bytes = "1.7.1" diff --git a/src/handlers/chain_agnostic/route.rs b/src/handlers/chain_agnostic/route.rs index b0e79547e..900c3b9b7 100644 --- a/src/handlers/chain_agnostic/route.rs +++ b/src/handlers/chain_agnostic/route.rs @@ -29,10 +29,10 @@ use { uuid::Uuid, wc::future::FutureExt, yttrium::chain_abstraction::api::{ - route::{ - BridgingError, FundingMetadata, InitialTransactionMetadata, Metadata, RouteQueryParams, - RouteRequest, RouteResponse, RouteResponseAvailable, RouteResponseError, - RouteResponseNotRequired, RouteResponseSuccess, + prepare::{ + BridgingError, FundingMetadata, InitialTransactionMetadata, Metadata, PrepareRequest, + PrepareResponse, PrepareResponseAvailable, PrepareResponseError, + PrepareResponseNotRequired, PrepareResponseSuccess, RouteQueryParams, }, Transaction, }, @@ -54,7 +54,7 @@ struct QuoteRoute { pub async fn handler( state: State>, query_params: Query, - Json(request_payload): Json, + Json(request_payload): Json, ) -> Result { handler_internal(state, query_params, request_payload) .with_metrics(HANDLER_TASK_METRICS.with_name("ca_route")) @@ -65,7 +65,7 @@ pub async fn handler( async fn handler_internal( state: State>, Query(query_params): Query, - request_payload: RouteRequest, + request_payload: PrepareRequest, ) -> Result { state .validate_project_access_and_quota(query_params.project_id.as_ref()) @@ -95,8 +95,8 @@ async fn handler_internal( .await?; initial_transaction.nonce = intial_transaction_nonce; - let no_bridging_needed_response: Json = Json(RouteResponse::Success( - RouteResponseSuccess::NotRequired(RouteResponseNotRequired { + let no_bridging_needed_response: Json = Json(PrepareResponse::Success( + PrepareResponseSuccess::NotRequired(PrepareResponseNotRequired { initial_transaction: initial_transaction.clone(), transactions: vec![], }), @@ -249,7 +249,7 @@ async fn handler_internal( ) .await? else { - return Ok(Json(RouteResponse::Error(RouteResponseError { + return Ok(Json(PrepareResponse::Error(PrepareResponseError { error: BridgingError::InsufficientFunds, })) .into_response()); @@ -275,7 +275,7 @@ async fn handler_internal( ) .await?; let Some(best_route) = quotes.first() else { - return Ok(Json(RouteResponse::Error(RouteResponseError { + return Ok(Json(PrepareResponse::Error(PrepareResponseError { error: BridgingError::NoRoutesAvailable, })) .into_response()); @@ -297,7 +297,7 @@ async fn handler_internal( "The current bridging asset balance on {} is {} less than the required topup amount:{}. The bridging fee is:{}", from_address, current_bridging_asset_balance, required_topup_amount, bridging_fee ); - return Ok(Json(RouteResponse::Error(RouteResponseError { + return Ok(Json(PrepareResponse::Error(PrepareResponseError { error: BridgingError::InsufficientFunds, })) .into_response()); @@ -318,7 +318,7 @@ async fn handler_internal( ) .await?; let Some(best_route) = quotes.first() else { - return Ok(Json(RouteResponse::Error(RouteResponseError { + return Ok(Json(PrepareResponse::Error(PrepareResponseError { error: BridgingError::NoRoutesAvailable, })) .into_response()); @@ -435,30 +435,32 @@ async fn handler_internal( .metrics .add_irn_latency(irn_call_start, OperationType::Set); - return Ok(Json(RouteResponse::Success(RouteResponseSuccess::Available( - RouteResponseAvailable { - orchestration_id, - initial_transaction, - transactions: routes, - metadata: Metadata { - funding_from: vec![FundingMetadata { - chain_id: bridge_chain_id, - token_contract: bridge_contract, - symbol: bridge_token_symbol, - amount: bridging_amount, - bridging_fee: final_bridging_fee, - decimals: bridge_decimals, - }], - check_in: STATUS_POLLING_INTERVAL, - initial_transaction: InitialTransactionMetadata { - transfer_to: asset_transfer_receiver, - amount: asset_transfer_value, - token_contract: to_address, - symbol: initial_tx_token_symbol, - decimals: initial_tx_token_decimals, + return Ok( + Json(PrepareResponse::Success(PrepareResponseSuccess::Available( + PrepareResponseAvailable { + orchestration_id, + initial_transaction, + transactions: routes, + metadata: Metadata { + funding_from: vec![FundingMetadata { + chain_id: bridge_chain_id, + token_contract: bridge_contract, + symbol: bridge_token_symbol, + amount: bridging_amount, + bridging_fee: final_bridging_fee, + decimals: bridge_decimals, + }], + check_in: STATUS_POLLING_INTERVAL, + initial_transaction: InitialTransactionMetadata { + transfer_to: asset_transfer_receiver, + amount: asset_transfer_value, + token_contract: to_address, + symbol: initial_tx_token_symbol, + decimals: initial_tx_token_decimals, + }, }, }, - }, - ))) - .into_response()); + ))) + .into_response(), + ); } diff --git a/src/handlers/wallet/get_calls_status.rs b/src/handlers/wallet/get_calls_status.rs index ea35091f3..c4887ed04 100644 --- a/src/handlers/wallet/get_calls_status.rs +++ b/src/handlers/wallet/get_calls_status.rs @@ -321,9 +321,9 @@ mod tests { }; use yttrium::{ config::Config, + execution::{send::safe_test::send_transactions, Execution}, smart_accounts::safe::{get_account_address, Owners}, test_helpers::{anvil_faucet, use_faucet}, - transaction::{send::safe_test::send_transactions, Transaction}, }; #[tokio::test] @@ -357,7 +357,7 @@ mod tests { ) .await; - let transaction = vec![Transaction { + let transaction = vec![Execution { to: destination.address(), value: Uint::from(1), data: Bytes::new(), @@ -425,7 +425,7 @@ mod tests { ) .await; - let transaction = vec![Transaction { + let transaction = vec![Execution { to: destination.address(), value: Uint::from(1), data: Bytes::new(), diff --git a/src/handlers/wallet/prepare_calls.rs b/src/handlers/wallet/prepare_calls.rs index 8381b3037..d9acb8957 100644 --- a/src/handlers/wallet/prepare_calls.rs +++ b/src/handlers/wallet/prepare_calls.rs @@ -6,7 +6,7 @@ use crate::handlers::sessions::get::{ use crate::handlers::wallet::types::SignatureRequestType; use crate::{handlers::HANDLER_TASK_METRICS, state::AppState}; use alloy::network::{Ethereum, Network}; -use alloy::primitives::{address, bytes, keccak256, Address, Bytes, FixedBytes, B256, U256, U64}; +use alloy::primitives::{bytes, keccak256, Address, Bytes, FixedBytes, B256, U256, U64}; use alloy::providers::{Provider, ReqwestProvider}; use alloy::sol_types::SolCall; use alloy::sol_types::SolValue; @@ -24,14 +24,15 @@ use yttrium::erc7579::accounts::safe::encode_validator_key; use yttrium::erc7579::smart_sessions::ISmartSession::isPermissionEnabledReturn; use yttrium::erc7579::smart_sessions::{ enableSessionSigCall, encode_use_signature, EnableSession, ISmartSession, SmartSessionMode, + SMART_SESSIONS_ADDRESS, }; use yttrium::smart_accounts::account_address::AccountAddress; use yttrium::{ bundler::{config::BundlerConfig, pimlico::client::BundlerClient}, chain::ChainId, entry_point::{EntryPointConfig, EntryPointVersion}, + execution::Execution, smart_accounts::{nonce::get_nonce_with_key, safe::get_call_data}, - transaction::Transaction, user_operation::{user_operation_hash::UserOperationHash, UserOperationV07}, }; @@ -42,7 +43,7 @@ pub type PrepareCallsRequest = Vec; pub struct PrepareCallsRequestItem { from: AccountAddress, chain_id: U64, - calls: Vec, + calls: Vec, capabilities: Capabilities, } @@ -101,9 +102,6 @@ pub enum PrepareCallsError { #[error("Permission context signature decompression error: {0}")] PermissionContextSignatureDecompression(fastlz_rs::DecompressError), - #[error("Unsupported permission context mode: USE")] - PermissionContextUnsupportedModeUse, - #[error("Invalid permission context mode")] PermissionContextInvalidMode, @@ -375,13 +373,12 @@ pub struct EnableSessionData { } pub struct DecodedSmartSessionSignature { - pub permission_id: FixedBytes<32>, - pub enable_session_data: EnableSessionData, + pub mode: SmartSessionMode, + pub permission_id: B256, + pub signature: Bytes, + pub enable_session_data: Option, } -// https://github.com/rhinestonewtf/module-sdk/blob/main/src/module/smart-sessions/constants.ts#L3 -const SMART_SESSIONS_ADDRESS: Address = address!("DDFF43A42726df11E34123f747bDce0f755F784d"); - // https://github.com/rhinestonewtf/module-sdk/blob/18ef7ca998c0d0a596572f18575e1b4967d9227b/src/module/smart-sessions/usage.ts#L209 pub fn decode_smart_session_signature( signature: &[u8], @@ -395,16 +392,23 @@ pub fn decode_smart_session_signature( match mode { SmartSessionMode::Use => { - let _permission_id: B256 = signature + let permission_id: B256 = signature .get(1..33) .ok_or(PrepareCallsError::PermissionContextNotLongEnough)? .try_into() // this error shouldn't happen .map_err(|_| PrepareCallsError::PermissionContextNotLongEnough)?; - // TODO compressed data next + let signature = signature + .get(33..) + .ok_or(PrepareCallsError::PermissionContextNotLongEnough)? + .to_vec() + .into(); - // https://github.com/rhinestonewtf/module-sdk/blob/18ef7ca998c0d0a596572f18575e1b4967d9227b/src/module/smart-sessions/usage.ts#L221 - // We aren't implementing this currently because it doesn't return the needed value (enableSessionData) - Err(PrepareCallsError::PermissionContextUnsupportedModeUse) + Ok(DecodedSmartSessionSignature { + mode, + permission_id, + signature, + enable_session_data: None, // TODO bad practice to not enforce this as part of the enum variant + }) } SmartSessionMode::Enable | SmartSessionMode::UnsafeEnable => { let compressed_data = signature @@ -416,7 +420,7 @@ pub fn decode_smart_session_signature( let enableSessionSigCall { session: enable_session, - signature: _, + signature, } = enableSessionSigCall::abi_decode_raw(&data, true) .map_err(PrepareCallsError::PermissionContextAbiDecode)?; let is_kernel = account_type == AccountType::Kernel; @@ -443,8 +447,10 @@ pub fn decode_smart_session_signature( ); Ok(DecodedSmartSessionSignature { + mode, permission_id, - enable_session_data: EnableSessionData { + signature, + enable_session_data: Some(EnableSessionData { // enable_session, enable_session: EnableSession { chainDigestIndex: enable_session.chainDigestIndex, @@ -453,7 +459,7 @@ pub fn decode_smart_session_signature( permissionEnableSig: permission_enable_sig, // TODO skip all this and just pass-through as-is }, validator, - }, + }), }) } } @@ -592,10 +598,15 @@ where N: Network, { let DecodedSmartSessionSignature { + mode, permission_id, + signature: _, enable_session_data, } = decode_smart_session_signature(signature, account_type)?; + assert_eq!(mode, SmartSessionMode::Enable); + let enable_session_data = enable_session_data.unwrap(); + const DUMMY_ECDSA_SIGNATURE: Bytes = bytes!("e8b94748580ca0b4993c9a1b86b5be851bfc076ff5ce3a1ff65bf16392acfcb800f9b4f1aef1555c7fce5599fffb17e7c635502154a0333ba21f3ae491839af51c"); const DUMMY_PASSKEY_SIGNATURE: Bytes = bytes!("00000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001200000000000000000000000000000000000000000000000000000000000000001635bc6d0f68ff895cae8a288ecf7542a6a9cd555df784b73e1e2ea7e9104b1db15e9015d280cb19527881c625fee43fd3a405d5b0d199a8c8e6589a7381209e40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002549960de5880e8c687434170f6476605b8fe4aeb9a28632c7995cf3ba831d97631d0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000f47b2274797065223a22776562617574686e2e676574222c226368616c6c656e6765223a22746278584e465339585f3442797231634d77714b724947422d5f3330613051685a36793775634d30424f45222c226f726967696e223a22687474703a2f2f6c6f63616c686f73743a33303030222c2263726f73734f726967696e223a66616c73652c20226f746865725f6b6579735f63616e5f62655f61646465645f68657265223a22646f206e6f7420636f6d7061726520636c69656e74446174614a534f4e20616761696e737420612074656d706c6174652e205365652068747470733a2f2f676f6f2e676c2f796162506578227d000000000000000000000000"); let signature = decode_signers( @@ -627,7 +638,7 @@ where #[cfg(test)] mod tests { use super::*; - use alloy::primitives::{bytes, fixed_bytes}; + use alloy::primitives::{address, bytes, fixed_bytes}; use yttrium::erc7579::smart_sessions::{ ActionData, ChainDigest, ERC7739Data, PolicyData, Session, }; @@ -639,7 +650,7 @@ mod tests { fixed_bytes!("2ec3eb29f3b075c8fed3fb0585947b5f1ae50c2fbe2f8274918bed889f69e342"), bytes!("00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000041e8b94748580ca0b4993c9a1b86b5be851bfc076ff5ce3a1ff65bf16392acfcb800f9b4f1aef1555c7fce5599fffb17e7c635502154a0333ba21f3ae491839af51c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041e8b94748580ca0b4993c9a1b86b5be851bfc076ff5ce3a1ff65bf16392acfcb800f9b4f1aef1555c7fce5599fffb17e7c635502154a0333ba21f3ae491839af51c00000000000000000000000000000000000000000000000000000000000000") ), - bytes!("002ec3eb29f3b075c8fed3fb0585947b5f1ae50c2fbe2f8274918bed889f69e3420000e015000020e0151e010180e0151fe0173f0100022003e013000040e0131c200000c02003e013001f41e8b94748580ca0b4993c9a1b86b5be851bfc076ff5ce3a1ff65bf16392acfc1fb800f9b4f1aef1555c7fce5599fffb17e7c635502154a0333ba21f3ae491839a01f51ce0135de01900e0587f"), + bytes!("002ec3eb29f3b075c8fed3fb0585947b5f1ae50c2fbe2f8274918bed889f69e34200000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000041e8b94748580ca0b4993c9a1b86b5be851bfc076ff5ce3a1ff65bf16392acfcb800f9b4f1aef1555c7fce5599fffb17e7c635502154a0333ba21f3ae491839af51c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041e8b94748580ca0b4993c9a1b86b5be851bfc076ff5ce3a1ff65bf16392acfcb800f9b4f1aef1555c7fce5599fffb17e7c635502154a0333ba21f3ae491839af51c00000000000000000000000000000000000000000000000000000000000000"), ); } @@ -677,13 +688,14 @@ mod tests { ], } ], + permitERC4337Paymaster: false, }, permissionEnableSig: bytes!("821a568f5940148c20779e18f7fa0547c4f53f388eb684678f92774152a728a73be1f82e3f3f37a54f20e686e2a9711c280871aef1f7aa796b790ade00c0f01020"), }, validator: address!("9388056f9cecfa536e70649154db93485a1f3448"), } )), - bytes!("000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000004c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000014a34d921018061556bee2f63850c0762c9e7af9ad05895078ad8287f4cadc56f347a000000000000000000000000207b90941d9cff79a750c1e5c05ddaa17ea01b9f00000000000000000000000000000000000000000000000000000000000000c031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000120000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001c0000000000000000000000000000000000000000000000000000000000000002b020079b1cf6cb04b0e7a626c98053b3ad29d3a93527700bae0435ac2bccb87c2ef2db5e215fac4dec876f40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020efef39a1000000000000000000000000000000000000000000000000000000000000000000000000000000002e65bafa07238666c3b239e94f32dad3cdd6498d0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000009a6c4974dce237e01ff35c602ca9555a3c0fa5ef0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002000000000000000000000000066f8671c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000559388056f9cecfa536e70649154db93485a1f3448821a568f5940148c20779e18f7fa0547c4f53f388eb684678f92774152a728a73be1f82e3f3f37a54f20e686e2a9711c280871aef1f7aa796b790ade00c0f010200000000000000000000000000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000041e8b94748580ca0b4993c9a1b86b5be851bfc076ff5ce3a1ff65bf16392acfcb800f9b4f1aef1555c7fce5599fffb17e7c635502154a0333ba21f3ae491839af51c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041e8b94748580ca0b4993c9a1b86b5be851bfc076ff5ce3a1ff65bf16392acfcb800f9b4f1aef1555c7fce5599fffb17e7c635502154a0333ba21f3ae491839af51c00000000000000000000000000000000000000000000000000000000000000"), + bytes!("000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000004e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000042000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000014a34d921018061556bee2f63850c0762c9e7af9ad05895078ad8287f4cadc56f347a000000000000000000000000207b90941d9cff79a750c1e5c05ddaa17ea01b9f00000000000000000000000000000000000000000000000000000000000000e031000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000140000000000000000000000000000000000000000000000000000000000000016000000000000000000000000000000000000000000000000000000000000001e00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002b020079b1cf6cb04b0e7a626c98053b3ad29d3a93527700bae0435ac2bccb87c2ef2db5e215fac4dec876f40000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000600000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000020efef39a1000000000000000000000000000000000000000000000000000000000000000000000000000000002e65bafa07238666c3b239e94f32dad3cdd6498d0000000000000000000000000000000000000000000000000000000000000060000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000200000000000000000000000009a6c4974dce237e01ff35c602ca9555a3c0fa5ef0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000002000000000000000000000000066f8671c0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000559388056f9cecfa536e70649154db93485a1f3448821a568f5940148c20779e18f7fa0547c4f53f388eb684678f92774152a728a73be1f82e3f3f37a54f20e686e2a9711c280871aef1f7aa796b790ade00c0f010200000000000000000000000000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000c00000000000000000000000000000000000000000000000000000000000000041e8b94748580ca0b4993c9a1b86b5be851bfc076ff5ce3a1ff65bf16392acfcb800f9b4f1aef1555c7fce5599fffb17e7c635502154a0333ba21f3ae491839af51c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000041e8b94748580ca0b4993c9a1b86b5be851bfc076ff5ce3a1ff65bf16392acfcb800f9b4f1aef1555c7fce5599fffb17e7c635502154a0333ba21f3ae491839af51c00000000000000000000000000000000000000000000000000000000000000"), ); } @@ -721,13 +733,14 @@ mod tests { ], } ], + permitERC4337Paymaster: false }, permissionEnableSig: bytes!("f0c9cba469e26f15ae4c098ff1b474b48673bb75d32e7e360391cb6e6db11c931dcc81986a86b380fcd480464b5f504fd5fa527fd9437e46ea75098adce216c81f"), }, validator: address!("9388056f9cecfa536e70649154db93485a1f3448"), } ).unwrap(), - bytes!("010000e015000040e0151e0104c0e0151fe018000080e0162100e0e0151f0004e0151e020000012003e011001f014a3464b2d184c4b8517d7f2f59bab7e6269b6aa524e268fcd1eec34a9c8e2702d7389fe0033c12207b90941d9cff79a750c1e5c05ddaa17ea01be0041fe00a0001c031e00a14e02100010120e0152b0001e1169f0001e1179f1f2b02001b60aa8eb31e11c41279f6a102026edeeb848ec600bae0435ac2bccb870bc2ef2db5e215fac4dec876f4e0158ae02d00e016bf0100602003e05300e2151f21f203efef39a12007e01c00132e65bafa07238666c3b239e94f32dad3cdd6498de01638e017dfe0189fe0035f139a6c4974dce237e01ff35c602ca9555a3c0fa5efe0031fe00a00e1177fe0045f0366f864d5e00a43e013001f559388056f9cecfa536e70649154db93485a1f3448f0c9cba469e26f15ae4c091f8ff1b474b48673bb75d32e7e360391cb6e6db11c931dcc81986a86b380fcd48015464b5f504fd5fa527fd9437e46ea75098adce216c81fe01371e004000001e4175fe004dfe00a000002e00a13e00300e1173fe3177f1f41e8b94748580ca0b4993c9a1b86b5be851bfc076ff5ce3a1ff65bf16392acfc1fb800f9b4f1aef1555c7fce5599fffb17e7c635502154a0333ba21f3ae491839a01f51ce0038de02900e0587f"), + bytes!("010000e015000040e0151e0104e0e0151fe018000080e01621e0165f010420e0163f0001e0141f1f014a3464b2d184c4b8517d7f2f59bab7e6269b6aa524e268fcd1eec34a9c8e2702d7389fe0033f12207b90941d9cff79a750c1e5c05ddaa17ea01be0041fe00a0001e031e00a14e021000001e1167f010160e0154b0001e1163fe018001f2b02001b60aa8eb31e11c41279f6a102026edeeb848ec600bae0435ac2bccb870bc2ef2db5e215fac4dec876f4e0184ce02a00e016ff0000e016ffe03800e2153f221203efef39a12007e01c00132e65bafa07238666c3b239e94f32dad3cdd6498de01638e017dfe0189fe0035f139a6c4974dce237e01ff35c602ca9555a3c0fa5efe0031fe00a00e1177fe0045f0366f864d5e00a43e013001f559388056f9cecfa536e70649154db93485a1f3448f0c9cba469e26f15ae4c091f8ff1b474b48673bb75d32e7e360391cb6e6db11c931dcc81986a86b380fcd48015464b5f504fd5fa527fd9437e46ea75098adce216c81fe01371e004000001e4177fe004dfe00a000002e00a13e00300e1173f00c0e0032ce00a001f41e8b94748580ca0b4993c9a1b86b5be851bfc076ff5ce3a1ff65bf16392acfc1fb800f9b4f1aef1555c7fce5599fffb17e7c635502154a0333ba21f3ae491839a01f51ce00a54e02200e0587f"), ); } } diff --git a/src/handlers/wallet/send_prepared_calls.rs b/src/handlers/wallet/send_prepared_calls.rs index 730816267..3a50dff33 100644 --- a/src/handlers/wallet/send_prepared_calls.rs +++ b/src/handlers/wallet/send_prepared_calls.rs @@ -28,6 +28,7 @@ use uuid::Uuid; use wc::future::FutureExt; use yttrium::bundler::client::BundlerClient; use yttrium::bundler::config::BundlerConfig; +use yttrium::erc7579::smart_sessions::SmartSessionMode; use yttrium::{ chain::ChainId, entry_point::{EntryPointConfig, EntryPointVersion}, @@ -64,6 +65,7 @@ pub enum SendPreparedCallsError { #[error("Permission context not long enough")] PermissionContextNotLongEnough, + #[error("Unsupported permission context mode: USE")] PermissionContextUnsupportedModeUse, @@ -388,11 +390,23 @@ async fn handler_internal( .map_err(SendPreparedCallsError::SplitPermissionsContextAndCheckValidator)?; let DecodedSmartSessionSignature { + mode, permission_id, + signature: _, enable_session_data, } = decode_smart_session_signature(signature, account_type) .map_err(SendPreparedCallsError::DecodeSmartSessionSignature)?; + let enable_session_data = match mode { + SmartSessionMode::Enable | SmartSessionMode::UnsafeEnable => { + // TODO refactor enum to avoid unwrap + enable_session_data.unwrap() + } + SmartSessionMode::Use => { + return Err(SendPreparedCallsError::PermissionContextUnsupportedModeUse) + } + }; + let signature = encode_use_or_enable_smart_session_signature( provider.clone(), permission_id, diff --git a/src/utils/sessions.rs b/src/utils/sessions.rs index 9ffae72d3..539b2bb1a 100644 --- a/src/utils/sessions.rs +++ b/src/utils/sessions.rs @@ -122,13 +122,13 @@ mod tests { use { super::*, alloy::primitives::address, - yttrium::{smart_accounts::safe::get_call_data, transaction::Transaction}, + yttrium::{execution::Execution, smart_accounts::safe::get_call_data}, }; #[test] // Check for the packed calldata format for a single transaction fn single_execution_call_data_value() { - let encoded_data = get_call_data(vec![Transaction { + let encoded_data = get_call_data(vec![Execution { to: address!("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), value: U256::from(1010101), data: Bytes::new(), @@ -141,12 +141,12 @@ mod tests { // Check for the regular calldata format for multiple transactions fn multiple_execution_call_data_value() { let encoded_data = get_call_data(vec![ - Transaction { + Execution { to: address!("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), value: U256::from(1010101), data: Bytes::new(), }, - Transaction { + Execution { to: address!("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaab"), value: U256::from(2020202), data: Bytes::new(),