diff --git a/crates/core/tests/test_decompile.rs b/crates/core/tests/test_decompile.rs index 081505d6..102fa462 100644 --- a/crates/core/tests/test_decompile.rs +++ b/crates/core/tests/test_decompile.rs @@ -152,6 +152,23 @@ mod integration_tests { } } + #[tokio::test] + async fn test_decompile_base_edge_case_abi() { + let _ = decompile(DecompilerArgs { + target: String::from("0x6080604052600436101561001257600080fd5b6000803560e01c8062fdd58e1461327e57806301ffc9a7146131f557806302fa7c471461317957806306fdde03146130a25780630a7e2ac914612c2d5780630e89341c14612b4c5780631916558714612b2f57806322dcb0a714612ad15780632a55205a14612a175780632eb2c2d61461299557806347df1fdf146128a15780634e1273f4146127655780634f558e79146127395780635f453050146123f357806365e909d6146122025780636b915fe3146121ac57806371130b331461204e578063715018a614611ff157806371b38f0714611f675780637e608e9114611e4757806382f57d2714611de75780638da5cb5b14611dc05780639351f4ed1461128157806395d89b41146111995780639852595c146111605780639b642de1146110f65780639ebeef5914610fc7578063a22cb46514610e28578063a3f8eace14610dfc578063aada600b14610907578063aeb61fea1461077b578063b390c0ab14610529578063b8f7300314610410578063bd85b039146103e6578063df745d2814610380578063e33b7de314610361578063e985e9c51461030c578063ef8d10f5146102bf578063f242432a146102675763f2fde38b146101d457600080fd5b34610264576020366003190112610264576101ed6132a6565b6101f56136d4565b6001600160a01b038116156102105761020d9061372c565b80f35b60405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608490fd5b80fd5b50346102645760a0366003190112610264576102816132a6565b6102896132bc565b90608435916001600160401b0383116102bb576102ad61020d9336906004016134fd565b916064359160443591614ac3565b8380fd5b5034610264576020366003190112610264576102f46040610308926102e2614a2e565b50600435815261013160205220613cbe565b604051918291602083526020830190613654565b0390f35b5034610264576040366003190112610264576103266132a6565b60406103306132bc565b926001600160a01b0380931681526066602052209116600052602052602060ff604060002054166040519015158152f35b5034610264578060031936011261026457602061013554604051908152f35b5034610264576020366003190112610264576004356001600160401b0381116103e2576103b19036906004016133f0565b825b8181106103be578380f35b806103dc6103d76103d26001948688613ea7565b6139d5565b614483565b016103b3565b5080fd5b50346102645760203660031901126102645760406020916004358152609783522054604051908152f35b50346102645760603660031901126102645760043561042d6132bc565b604435916001600160601b0383168093036105245761044a6136d4565b610458612710841115613bbd565b6001600160a01b038092169283156104df577fe361b60b9164428d036a601ec08552e653bfe8c44389b8a4ebfd47281eb8741a936060936040519061049c8261330c565b828252602082019084825285895260fc60205260408920925116906001600160601b0360a01b905160a01b1617905560405192835260208301526040820152a180f35b60405162461bcd60e51b815260206004820152601b60248201527f455243323938313a20496e76616c696420706172616d657465727300000000006044820152606490fd5b600080fd5b50346102645761053836613420565b909160ff610130541615610769573315610718576105558361445e565b61055e8361445e565b938260405161056c8161336c565b52825b8251811015610616576105828184613820565b5161058d8288613820565b5190808652609760208181526040882054928484106105c0578852526040862091900390556105bb906137fb565b61056f565b60405162461bcd60e51b815260048101839052602860248201527f455243313135353a206275726e20616d6f756e74206578636565647320746f74604482015267616c537570706c7960c01b6064820152608490fd5b838286818352602060658152604084203360005281526040600020548281106106c757829084865260658352604086203360005283520360406000205583604051848152838382015233907fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f6260403392a4836040516106948161336c565b526040519283528201527fde3ca466246b0da455138dbea78dacd91d3c40dc98d5846ff0193bf67c24b0e760403392a280f35b60405162461bcd60e51b8152600481018390526024808201527f455243313135353a206275726e20616d6f756e7420657863656564732062616c604482015263616e636560e01b6064820152608490fd5b60405162461bcd60e51b815260206004820152602360248201527f455243313135353a206275726e2066726f6d20746865207a65726f206164647260448201526265737360e81b6064820152608490fd5b60405163fa32799b60e01b8152600490fd5b5034610264576003196040368201126103e2576004356001600160401b0360243581811161090357604081600401948236030112610903576107bb6136d4565b61012f548310156108f1578285526101319360209480865263ffffffff604088205460401c166108df576107ee82613ec4565b848752855260408620600581016108058380613895565b91908683116108cb5761081883836139a1565b908952878920895b8381106108b15750505050906024600661083d9301930190613895565b92831161089d5761084e83836139a1565b908552838520855b83811061088b57867f71c8525fc38b77b64a66d848a818337505e69f1eacce1994cc6ca727e16d78c28787604051908152a180f35b82358282015591850191600101610856565b634e487b7160e01b86526041600452602486fd5b6001908a6108be856139d5565b9401938184015501610820565b634e487b7160e01b8a52604160045260248afd5b60405163fa2844a560e01b8152600490fd5b60405163c1ab6dc160e01b8152600490fd5b8480fd5b5034610264576003196040368201126103e2576001600160401b03602435116103e2576101209060243536030112610264576109416136d4565b61012f5460043510156108f157600435815261013160205261096560408220613cbe565b63ffffffff604082015116610100820151918115159081610d7d575b506108df576109ab6109976084602435016138ca565b6109a560a4602435016138ca565b90613e72565b60043583526101316020526040832063ffffffff6109cd6024356004016138ca565b1663ffffffff19825416178155610a0c6109ea60248035016138ca565b825467ffffffff00000000191660209190911b67ffffffff0000000016178255565b610a3d610a1d6044602435016138ca565b825463ffffffff60401b191660409190911b63ffffffff60401b16178255565b606460243501356001820155610a9f6002820163ffffffff610a636084602435016138ca565b1663ffffffff19825416178155610a7e60a4602435016138ca565b67ffffffff0000000082549160201b169067ffffffff000000001916179055565b60c460243501356003820155610abf60e4602435016024356004016138db565b906001600160401b03821161089d578190610aea82610ae160048701546132d2565b60048701613924565b8690601f8311600114610d11578792610d06575b50508160011b916000199060031b1c19161760048201555b6005810190610b3061010460243501602435600401613880565b91610b3b8380613895565b91906001600160401b038311610cf257610b5583836139a1565b90875260208720875b838110610cd757505050506006610b7b9101916020810190613895565b91906001600160401b03831161089d57610b9583836139a1565b90855260208520855b838110610cc3578686610bda876004358452610131602052604084209063ffffffff60401b82549160401b169063ffffffff60401b1916179055565b60408220600581018251908151916001600160401b03831161089d57602090610c0384846139a1565b0190855260208520855b838110610ca65760208601518051889160068801906001600160401b038311610c9257602090610c3d84846139a1565b0190835260208320835b838110610c7e57847f4040cd6ff4eef67e86ab078c16c2514c123f7b8782aa574307eaf34c726f3ef560206040516004358152a180f35b600190602084519401938184015501610c47565b634e487b7160e01b84526041600452602484fd5b60019060206001600160a01b038551169401938184015501610c0d565b600190602084359401938184015501610b9e565b6001906020610ce5856139d5565b9401938184015501610b5e565b634e487b7160e01b88526041600452602488fd5b013590503880610afe565b60048501885260208820889450915b601f1984168510610d65576001945083601f19811610610d4b575b505050811b016004820155610b16565b0135600019600384901b60f8161c19169055388080610d3b565b81810135835560209485019460019093019201610d20565b9050610d8d6024356004016138ca565b63ffffffff8083511691161490811591610dd6575b8115610db0575b5038610981565b905063ffffffff8060a0610dc860a4602435016138ca565b930151169116141538610da9565b9050610de66084602435016138ca565b63ffffffff806080840151169116141590610da2565b5034610264576020366003190112610264576020610e20610e1b6132a6565b614a7b565b604051908152f35b503461026457604036600319011261026457610e426132a6565b60243590811515809203610524576daaeb6d7670e522a718067333cd4e803b610f23575b506001600160a01b031690813314610ecc5733835260666020526040832082600052602052604060002060ff1981541660ff83161790556040519081527f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c3160203392a380f35b60405162461bcd60e51b815260206004820152602960248201527f455243313135353a2073657474696e6720617070726f76616c20737461747573604482015268103337b91039b2b63360b91b6064820152608490fd5b604051633185c44d60e21b81523060048201526001600160a01b038316602482015290602090829060449082905afa908115610fbc578491610f8e575b5015610f6c5738610e66565b604051633b79c77360e21b81526001600160a01b039091166004820152602490fd5b610faf915060203d8111610fb5575b610fa78183613387565b810190614aab565b38610f60565b503d610f9d565b6040513d86823e3d90fd5b503461026457806003193601126102645761012f54610fe581613436565b90610ff36040519283613387565b808252601f1961100282613436565b01835b8181106110cc575050825b81811061108c57505060405190602092838301848452825180915260408401948060408360051b870101940192955b82871061104c5785850386f35b909192938280600192603f1989820301855287519082806110768451604085526040850190613654565b930151910152960192019601959291909261103f565b806110c79185528060206101318152604087206110b36110ac8489613820565b5191613cbe565b90526110bf8287613820565b5101526137fb565b611010565b6020906040516110db8161330c565b6110e3614a2e565b8152828781830152828701015201611005565b5034610264576020366003190112610264576004356001600160401b0380821161115c573660238301121561115c57816004013590811161115c57366024828401011161115c5761020d916111579161114d6136d4565b60243692016134c6565b613a8a565b8280fd5b50346102645760203660031901126102645760406020916001600160a01b036111876132a6565b16815261013483522054604051908152f35b5034610264578060031936011261026457604051600061012e80546111bd816132d2565b8085529160019180831690811561125757506001146111fb575b610308856111e781870382613387565b6040519182916020835260208301906133cb565b600090815292507fbdaadd9f750d0166045bf387a364eadd28ba243e04512a47282aa5147a68e37f5b82841061123f5750505081016020016111e7826103086111d7565b80546020858701810191909152909301928101611224565b869550610308969350602092506111e794915060ff191682840152151560051b82010192936111d7565b5034610264576003199061014036830112610264576004356001600160401b0381116103e2576112b59036906004016134fd565b906024356001600160401b0381116103e2576112d59036906004016134fd565b926044356001600160401b03811161115c576112f59036906004016134fd565b926064356001600160401b0381116102bb576113159036906004016133f0565b90926040366083190112610903576001600160401b0360c435116109035760409060c435360301126102bb5760e435928315158403610903576001600160a01b0361010435166101043503610903576001600160a01b036101243516610124350361090357845460ff8160081c161596878098611db3575b8015611d9c575b15611d405760ff19821660011787556113c79188611d2f575b5061115760ff885460081c166113c281613a2a565b613a2a565b6113db60ff865460081c166113c281613a2a565b6113e43361372c565b60648211611d1d576113fa60c435600401613ec4565b845b8281106119c457505061012f55611418600460c4350180613895565b906001600160401b0382116119875761143082613960565b6101368552845b82811061199b57505050611455602460c4350160c435600401613895565b906001600160401b0382116119875761146d826139e9565b6101378552845b828110611965575050508051906001600160401b038211610c9257819061149d61012d546132d2565b601f8111611916575b50602090601f831160011461188c578592611881575b50508160011b916000199060031b1c19161761012d555b83516001600160401b03811161186d576114ef61012e546132d2565b601f8111611813575b506020601f821160011461178c5783949582939492611781575b50508160011b916000199060031b1c19161761012e555b6101309060ff8019835416911515161790556084356001600160a01b03811681036103e25760a435906001600160601b038216820361115c579061156c91613c1c565b6115786101043561372c565b610124356001600160a01b03161580156117795781905b61159f60ff845460081c16613a2a565b6daaeb6d7670e522a718067333cd4e91823b6115f8575b505050906115c15780f35b61ff001981541681557f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb3847402498602060405160018152a180f35b60405163c3c5a54760e01b815230600482015260208160248188885af190811561176e578591611750575b506115b657156116a2575090818193923b156103e257604051633e9f1edf60e11b8152306004820152610124356001600160a01b031660248201529082908290604490829084905af1801561169757611683575b50505b903880806115b6565b61168c9061333d565b6103e2578138611677565b6040513d84823e3d90fd5b61170a5790818193923b156103e25760405163a0af290360e01b8152306004820152610124356001600160a01b031660248201529082908290604490829084905af18015611697576116f6575b505061167a565b6116ff9061333d565b6103e25781386116ef565b803b156103e257818091602460405180948193632210724360e11b83523060048401525af1801561169757611741575b509061167a565b61174a9061333d565b3861173a565b611768915060203d8111610fb557610fa78183613387565b38611623565b6040513d87823e3d90fd5b60019061158f565b015190503880611512565b61012e84527fbdaadd9f750d0166045bf387a364eadd28ba243e04512a47282aa5147a68e37f90845b601f19841681106117fb575060019394959683601f198116106117e2575b505050811b0161012e55611529565b015160001960f88460031b161c191690553880806117d3565b9091602060018192858b0151815501930191016117b5565b61185d9061012e85527fbdaadd9f750d0166045bf387a364eadd28ba243e04512a47282aa5147a68e37f601f840160051c81019160208510611863575b601f0160051c019061390d565b386114f8565b9091508190611850565b634e487b7160e01b83526041600452602483fd5b0151905038806114bc565b925061012d85527f193a3ae4da5049eb74cee39e4cf5827f7ce7b1d1d1775ef1c6311eb60558e6d59085935b601f19841685106118fb576001945083601f198116106118e2575b505050811b0161012d556114d3565b015160001960f88460031b161c191690553880806118d3565b818101518355602094850194600190930192909101906118b8565b61195f9061012d87527f193a3ae4da5049eb74cee39e4cf5827f7ce7b1d1d1775ef1c6311eb60558e6d5601f850160051c8101916020861061186357601f0160051c019061390d565b386114a6565b600190602083359301928160008051602061554e833981519152015501611474565b634e487b7160e01b85526041600452602485fd5b60019060206119a9846139d5565b9301928160008051602061556e833981519152015501611437565b6119e66119e06119d583868661385d565b610100810190613880565b80613895565b9050611d02575b6080611a04816119fe84878761385d565b016138ca565b90611a1a60a0926109a5846119fe878a8a61385d565b611ae1611a2884878761385d565b91848a52610131602052610a7e60408b209463ffffffff80611a49876138ca565b169063ffffffff199182895416178855611a8a611a68602089016138ca565b895467ffffffff00000000191660209190911b67ffffffff0000000016178955565b611ab9611a99604089016138ca565b895463ffffffff60401b191660409190911b63ffffffff60401b16178955565b60608701356001890155611ad2600289019588016138ca565b169084541617835584016138ca565b60c08101356003830155611af860e08201826138db565b906001600160401b0382116108cb57611b1882610ae160048701546132d2565b8990601f8311600114611c9157611b559392918b9183611c86575b50508160011b916000199060031b1c1916176004840155610100810190613880565b611b5f8180613895565b906001600160401b0382116108cb576005840190611b7d83836139a1565b908a5260208a208a5b838110611c6b5750505050806020611b9f920190613895565b916001600160401b038311611c575760060190611bbc83836139a1565b90885260208820885b838110611c43575050508187525061013160205260408620805463ffffffff60401b1916905560019080611c07611bfd82878761385d565b60e08101906138db565b9081604051928392833781018a81520390207f2031bb75fe7acfeb75a155106919ca62ef2e240732a3bf6035ce09f71698833e8980a3016113fc565b600190602084359401938184015501611bc5565b634e487b7160e01b89526041600452602489fd5b6001906020611c79856139d5565b9401938184015501611b86565b013590503880611b33565b600485018b5260208b20918b5b601f1985168110611cea5750918391600193611b559695601f19811610611cd0575b505050811b0160048401556119d5565b0135600019600384901b60f8161c19169055388080611cc0565b90926020600181928686013581550194019101611c9e565b611d18611d136119d583868661385d565b613ec4565b6119ed565b604051633a4733d960e11b8152600490fd5b61ffff1916610101178755386113ad565b60405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608490fd5b50303b1580156113945750600160ff831614611394565b50600160ff83161061138d565b503461026457806003193601126102645760206001600160a01b0360c95416604051908152f35b50604036600319011261026457600435611dff613630565b90808352610131602052611e1560408420613cbe565b916060830151611e355763ffffffff602061020d94015116913433614612565b604051634d0ee1f560e11b8152600490fd5b5034610264576003196020368201811361115c576001600160401b03916004358381116109035760408160040192823603011261090357611e866136d4565b611e8f82613ec4565b611e998280613895565b90858211611f5357611eaa82613960565b6101368752865b828110611f2b57505050906024611ec9920190613895565b928311610c9257611ed9836139e9565b90835b838110611f0b57847fb855aa79dff5fe918a28a8a1d8101db624120176786f8e2658f354b0e68654d08180a180f35b823560008051602061554e83398151915282015591810191600101611edc565b60019086611f38846139d5565b9301928160008051602061556e833981519152015501611eb1565b634e487b7160e01b87526041600452602487fd5b503461026457602036600319011261026457600435611f846136d4565b808252610131602052604082209081549063ffffffff92838316156108f15763ffffffff198316604093841c949094169384179055815190815263ffffffff90921660208301527fe7ff034533cbe8553f05d7bfe28543225de5f9589f0637e2e851c8fad322fd4991a180f35b503461026457806003193601126102645761200a6136d4565b806001600160a01b0360c9546001600160601b0360a01b811660c955167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b50608036600319011261026457600435612066613630565b61206e61361d565b906064356001600160401b0381116109035761208e9036906004016133f0565b8486526020610131815260019081604089200154938415611e3557604051828101903360601b825263ffffffff60e01b8960e01b166034820152601881526120d58161330c565b519020906120e285613436565b946120f06040519687613387565b8086528386019060051b8201913683116121a85785949392915b828210612196575050509389935b612143575b50505050036121315761020d923433614612565b6040516309bde33960e01b8152600490fd5b9091929381518510156121905761215a8583613820565b51908181101561217f578a52825261217660408a205b946137fb565b92919082612118565b908a52825261217660408a20612170565b9361211d565b8135815286955090840190840161210a565b8b80fd5b506060366003190112610264576121c16132a6565b602435906121cd61361d565b8284526101316020526121e260408520613cbe565b926060840151611e355763ffffffff602061020d95015116923490614612565b5034610264576060366003190112610264576024356001600160401b0381116103e2576122339036906004016133f0565b906044356001600160401b0381116102bb576122539036906004016133f0565b9161225c6136d4565b61012f5460043510156108f15784918484036123e1579060049492943586526101316020526040862086925b8584106122c357877f71cc7095cc35ed4701c217a8efb440732eb0737da67f6548c008ac26fba954646040888a82519182526020820152a180f35b909192939582549063ffffffff6122f16122e66122e1898c8a613ea7565b6138ca565b828560401c16613f5d565b921680151590816123d1575b506123bf5761232a61234492859063ffffffff60401b82549160401b169063ffffffff60401b1916179055565b63ffffffff61233d6122e1888b89613ea7565b1690613eb7565b936123536103d2828885613ea7565b63ffffffff6123666122e1848b89613ea7565b16604051918260208101106001600160401b036020850111176123ab579161239f9160019493602083016040528c835260043590613f75565b01959395929190612288565b634e487b7160e01b8b52604160045260248bfd5b6040516352df9fe560e01b8152600490fd5b905063ffffffff831611386122fd565b60405163e6dcad7760e01b8152600490fd5b5034610264576003196020368201126103e2576001600160401b03600435116103e25761012090600435360301126102645761242d6136d4565b6124456119e061010460043501600435600401613880565b905061271c575b61246b61245d6084600435016138ca565b6109a560a4600435016138ca565b61012f548082526101316020526040822063ffffffff61248f6004356004016138ca565b1663ffffffff198254161781556124ad6109ea6024600435016138ca565b6124be610a1d6044600435016138ca565b6064600435013560018201556124ff6002820163ffffffff6124e46084600435016138ca565b1663ffffffff19825416178155610a7e60a4600435016138ca565b60c46004350135600382015561251f60e4600435016004356004016138db565b906001600160401b03821161198757819061254182610ae160048701546132d2565b8590601f83116001146126b05786926126a5575b50508160011b916000199060031b1c19161760048201555b600581019061258761010460043501600435600401613880565b916125928380613895565b91906001600160401b038311611f53576125ac83836139a1565b90865260208620865b83811061268a575050505060066125d29101916020810190613895565b91906001600160401b038311611987576125ec83836139a1565b90845260208420845b8381106126765785858082526101316020526040822063ffffffff60401b19815416905561262561012f546137fb565b61012f5561263d60e4600435016004356004016138db565b9081604051928392833781018481520390207f2031bb75fe7acfeb75a155106919ca62ef2e240732a3bf6035ce09f71698833e8380a380f35b6001906020843594019381840155016125f5565b6001906020612698856139d5565b94019381840155016125b5565b013590503880612555565b60048501875260208720879450915b601f1984168510612704576001945083601f198116106126ea575b505050811b01600482015561256d565b0135600019600384901b60f8161c191690553880806126da565b818101358355602094850194600190930192016126bf565b612734611d1361010460043501600435600401613880565b61244c565b503461026457602036600319011261026457604060209160043581526097835220541515604051908152f35b5034610264576040366003190112610264576001600160401b0360043581811161115c576127979036906004016135af565b9060243590811161115c576127b090369060040161344d565b815181510361284a578151926127c584613436565b936127d36040519586613387565b8085526127e2601f1991613436565b013660208601375b8251811015612834578061281f6001600160a01b0361280c61282f9487613820565b51166128188386613820565b5190613776565b6128298287613820565b526137fb565b6127ea565b604051602080825281906103089082018761351b565b60405162461bcd60e51b815260206004820152602960248201527f455243313135353a206163636f756e747320616e6420696473206c656e677468604482015268040dad2e6dac2e8c6d60bb1b6064820152608490fd5b50346102645780600319360112610264576128ba614a15565b50604051906128c88261330c565b604051908161013681815491828652602080960190855260008051602061556e83398151915292855b878282106129765750505061290892500382613387565b83526040519081809261013790858254918281520191845260008051602061554e833981519152935b868282106129605750505061294892500382613387565b8183015261030860405192828493845283019061354f565b8554845260019586019587955093019201612931565b85546001600160a01b03168452600195860195879550930192016128f1565b50346102645760a0366003190112610264576129af6132a6565b6129b76132bc565b6001600160401b039190604435838111610903576129d990369060040161344d565b606435848111612a13576129f190369060040161344d565b91608435948511612a1357612a0d61020d9536906004016134fd565b93615033565b8580fd5b5034610264576040612a2836613420565b9290815260fc6020522060405190612a3f8261330c565b54916001600160a01b03918284169384825260a01c60208201529215612aa4575b612a7b612710916001600160601b036020860151169061384a565b0491511661030860405192839283602090939291936001600160a01b0360408201951681520152565b9150612710612a7b604051612ab88161330c565b60fb54848116825260a01c602082015293915050612a60565b5034610264578060031936011261026457612aea6136d4565b7f1509137b40df48e8ef9596f9db16b632b15353d0e0688d9f23221953eb0328dd602061013080549060ff8083161516809260ff19161790556040519015158152a180f35b50346102645760203660031901126102645761020d6103d76132a6565b5034610264576020806003193601126103e257604051918281606754612b71816132d2565b93848452600191868382169182600014612c0b575050600114612bb1575b5050612b9d92500383613387565b6103086040519282849384528301906133cb565b90859250606782527f9787eeb91fe3101235e4a76063c7023ecb40f923f97916639c598592fa30d6ae5b858310612bf3575050612b9d93508201013880612b8f565b80548389018501528794508693909201918101612bdb565b9250935050612b9d94915060ff191682840152151560051b8201013880612b8f565b5034610264576020366003190112610264576004356001600160401b0381116103e257612c5e9036906004016133f0565b9190612c686136d4565b61012f549282915b818310612c8057838561012f5580f35b612c916119e06119d585858561385d565b905061308c575b612ca383838361385d565b94610120958681360312612a13576040519687018781106001600160401b03821117611f5357604052612cd581613643565b8752612ce360208201613643565b6020880152612cf460408201613643565b60408801526060908181013582890152608091612d12838301613643565b838a015260a090612d24828401613643565b828b015260c09283810135848c01526001600160401b0360e08201351161308457612d553660e083013583016134fd565b60e08c0152610100810135906001600160401b03821161308857016040813603126130845760405190612d878261330c565b80356001600160401b0381116121a857612da490369083016135af565b825260208101356001600160401b0381116121a85793612ea7938d93612dd663ffffffff948f9b9a999836910161344d565b6020820152610100850152612df683888601511684848701511690613e72565b826040899a80828801528a815261013160205220978186511692821993848b5416178a55612e47836020890151168b9067ffffffff0000000082549160201b169067ffffffff000000001916179055565b6040878101518b5463ffffffff60401b191690851690911b63ffffffff60401b16178a5586015160018a01556002890195015116908454161783558c01511667ffffffff0000000082549160201b169067ffffffff000000001916179055565b880151600382015560e08801518051906001600160401b038211611c57578190612ed882610ae160048701546132d2565b602090601f8311600114613015578a9261300a575b50508160011b916000199060031b1c19161760048201555b61010088015180518051906001600160401b0382116108cb5760206005850191612f2f84846139a1565b01908a5260208a208a5b838110612fed5750505050602001518051916001600160401b038311611c575760066020910191612f6a84846139a1565b0190885260208820885b838110612fd9575050505060e06001612f8f612fa8936137fb565b96019701516020604051928284809451938492016133a8565b81010390207f2031bb75fe7acfeb75a155106919ca62ef2e240732a3bf6035ce09f71698833e8680a3939193612c70565b600190602084519401938184015501612f74565b60019060206001600160a01b038551169401938184015501612f39565b015190503880612eed565b9250600484018a5260208a20908a935b601f1984168510613069576001945083601f19811610613050575b505050811b016004820155612f05565b015160001960f88460031b161c19169055388080613040565b81810151835560209485019460019093019290910190613025565b8980fd5b8a80fd5b61309d611d136119d585858561385d565b612c98565b5034610264578060031936011261026457604051908061012d908154906130c8826132d2565b8086529260019280841690811561314c57506001146130f2575b610308866111e781880382613387565b815292507f193a3ae4da5049eb74cee39e4cf5827f7ce7b1d1d1775ef1c6311eb60558e6d55b8284106131345750505081016020016111e782610308386130e2565b80546020858701810191909152909301928101613118565b9050869550610308969350602092506111e794915060ff191682840152151560051b8201019293386130e2565b5034610264576040366003190112610264576131936132a6565b6024356001600160601b038116918282036102bb577f8039bd6e4e7dba001c8840eb2e118d9d131246faa7d0d04335f7305127ec0b10926131de6040936131d86136d4565b83613c1c565b6001600160a01b038351921682526020820152a180f35b50346102645760203660031901126102645760043563ffffffff60e01b81168091036103e25760209063152a902d60e11b811490811561323b575b506040519015158152f35b636cdb3d1360e11b81149150811561326d575b811561325c575b5082613230565b6301ffc9a760e01b14905082613255565b6303a24d0760e21b8114915061324e565b5034610264576040366003190112610264576020610e2061329d6132a6565b60243590613776565b600435906001600160a01b038216820361052457565b602435906001600160a01b038216820361052457565b90600182811c92168015613302575b60208310146132ec57565b634e487b7160e01b600052602260045260246000fd5b91607f16916132e1565b604081019081106001600160401b0382111761332757604052565b634e487b7160e01b600052604160045260246000fd5b6001600160401b03811161332757604052565b61012081019081106001600160401b0382111761332757604052565b602081019081106001600160401b0382111761332757604052565b90601f801991011681019081106001600160401b0382111761332757604052565b60005b8381106133bb5750506000910152565b81810151838201526020016133ab565b906020916133e4815180928185528580860191016133a8565b601f01601f1916010190565b9181601f84011215610524578235916001600160401b038311610524576020808501948460051b01011161052457565b6040906003190112610524576004359060243590565b6001600160401b0381116133275760051b60200190565b81601f820112156105245780359161346483613436565b926134726040519485613387565b808452602092838086019260051b820101928311610524578301905b82821061349c575050505090565b8135815290830190830161348e565b6001600160401b03811161332757601f01601f191660200190565b9291926134d2826134ab565b916134e06040519384613387565b829481845281830111610524578281602093846000960137010152565b9080601f8301121561052457816020613518933591016134c6565b90565b90815180825260208080930193019160005b82811061353b575050505090565b83518552938101939281019260010161352d565b9190916040830192815190604081528151809552606081019260208093016000965b80881061358f5750506135189495508201519181840391015261351b565b909484806001926001600160a01b03895116815201960197019690613571565b81601f82011215610524578035916135c683613436565b926135d46040519485613387565b808452602092838086019260051b820101928311610524578301905b8282106135fe575050505090565b81356001600160a01b03811681036105245781529083019083016135f0565b6044359063ffffffff8216820361052457565b6024359063ffffffff8216820361052457565b359063ffffffff8216820361052457565b906135189163ffffffff8082511683528060208301511660208401528060408301511660408401526060820151606084015280608083015116608084015260a08201511660a083015260c081015160c08301526136c060e08201516101208060e08601528401906133cb565b91610100809201519181840391015261354f565b6001600160a01b0360c9541633036136e857565b606460405162461bcd60e51b815260206004820152602060248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152fd5b60c954906001600160a01b0380911691826001600160601b0360a01b82161760c955167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0600080a3565b6001600160a01b03169081156137a357600052606560205260406000209060005260205260406000205490565b60405162461bcd60e51b815260206004820152602a60248201527f455243313135353a2061646472657373207a65726f206973206e6f742061207660448201526930b634b21037bbb732b960b11b6064820152608490fd5b600019811461380a5760010190565b634e487b7160e01b600052601160045260246000fd5b80518210156138345760209160051b010190565b634e487b7160e01b600052603260045260246000fd5b8181029291811591840414171561380a57565b91908110156138345760051b8101359061011e1981360301821215610524570190565b903590603e1981360301821215610524570190565b903590601e198136030182121561052457018035906001600160401b03821161052457602001918160051b3603831361052457565b3563ffffffff811681036105245790565b903590601e198136030182121561052457018035906001600160401b0382116105245760200191813603831361052457565b818110613918575050565b6000815560010161390d565b9190601f811161393357505050565b61395e926000526020600020906020601f840160051c8301931061186357601f0160051c019061390d565b565b600160401b8111613327576101369081549080835581811061398157505050565b61395e9260005260008051602061556e833981519152918201910161390d565b90600160401b8111613327578154908083558181106139bf57505050565b61395e926000526020600020918201910161390d565b356001600160a01b03811681036105245790565b600160401b81116133275761013790815490808355818110613a0a57505050565b61395e9260005260008051602061554e833981519152918201910161390d565b15613a3157565b60405162461bcd60e51b815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201526a6e697469616c697a696e6760a81b6064820152608490fd5b9081516001600160401b03811161332757613aa66067546132d2565b601f8111613b6e575b50602080601f8311600114613aec5750819293600092613ae1575b50508160011b916000199060031b1c191617606755565b015190503880613aca565b90601f1983169460676000527f9787eeb91fe3101235e4a76063c7023ecb40f923f97916639c598592fa30d6ae926000905b878210613b56575050836001959610613b3d575b505050811b01606755565b015160001960f88460031b161c19169055388080613b32565b80600185968294968601518155019501930190613b1e565b613bb79060676000527f9787eeb91fe3101235e4a76063c7023ecb40f923f97916639c598592fa30d6ae601f840160051c8101916020851061186357601f0160051c019061390d565b38613aaf565b15613bc457565b60405162461bcd60e51b815260206004820152602a60248201527f455243323938313a20726f79616c7479206665652077696c6c206578636565646044820152692073616c65507269636560b01b6064820152608490fd5b906001600160a01b036001600160601b03821692613c3e612710851115613bbd565b16918215613c79576020604051613c548161330c565b848152015260a01b73ffffffffffffffffffffffffffffffffffffffff19161760fb55565b60405162461bcd60e51b815260206004820152601960248201527f455243323938313a20696e76616c6964207265636569766572000000000000006044820152606490fd5b906040918251613ccd81613350565b8093825463ffffffff918282168452826020928181851c1684870152821c168185015260019283860154606086015260028601548181166080870152831c1660a0850152600385015460c085015260048501815190816000825492613d31846132d2565b93848452878982169182600014613e52575050600114613e11575b50613d5992500382613387565b60e085015280519460058101613d6e8761330c565b82519081858254918281520191600052856000209060005b8888838310613df657505050505090613da481600694930382613387565b87520190518093838354928381520192600052836000209160005b818110613de3575050505090613ddc836101009594930383613387565b8401520152565b8354855293850193928201928201613dbf565b84546001600160a01b03168652909401939283019201613d86565b915050600052818480600020876000915b858310613e39575050613d59935082010138613d4c565b8091929450548385880101520191018590878593613e22565b60ff191685820152613d5995151560051b8501019250389150613d4c9050565b9063ffffffff8091169182613e8657505050565b168110613e95574211613e9557565b60405163427f0ccd60e11b8152600490fd5b91908110156138345760051b0190565b9190820180921161380a57565b600090613ed18180613895565b91602081019150613ee28282613895565b841480159150613f53575b613f0b57839291905b828510613f1d575050506064915003613f0b57565b604051630d5ca8b560e31b8152600490fd5b909192613f3485613f2e8585613895565b90613ea7565b35908115613f0b57600191613f4891613eb7565b940193929190613ef6565b5060048311613eed565b91909163ffffffff8080941691160191821161380a57565b93909192936001600160a01b03811694851561418657613f948461445e565b93613f9e8661445e565b9660005b8651811015613fe95780613fb9613fe4928b613820565b51613fc4828a613820565b516000526097602052613fdd6040600020918254613eb7565b90556137fb565b613fa2565b50929591945092955082600052602093606585526040958660002084600052865286600020614019848254613eb7565b9055836000885187815285898201527fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f628a3392a43b61405b575b505050505050565b61409e9285926000885180968195829463f23a6e6160e01b9a8b85523360048601528560248601526044850152606484015260a0608484015260a48301906133cb565b03925af160009181614157575b506141295750506001906140bd61423e565b6308c379a0146140f5575b506140da57505b388080808080614053565b5162461bcd60e51b8152806140f1600482016142ca565b0390fd5b6140fd61425c565b908161410957506140c8565b6140f1845192839262461bcd60e51b8452600484015260248301906133cb565b6001600160e01b03191603905061414057506140cf565b5162461bcd60e51b8152806140f1600482016141f5565b614178919250843d861161417f575b6141708183613387565b8101906141d5565b90386140ab565b503d614166565b60405162461bcd60e51b815260206004820152602160248201527f455243313135353a206d696e7420746f20746865207a65726f206164647265736044820152607360f81b6064820152608490fd5b9081602091031261052457516001600160e01b0319811681036105245790565b60809060208152602860208201527f455243313135353a204552433131353552656365697665722072656a656374656040820152676420746f6b656e7360c01b60608201520190565b60009060033d1161424b57565b905060046000803e60005160e01c90565b600060443d1061351857604051600319913d83016004833e81516001600160401b03918282113d6024840111176142b9578184019485519384116142c1573d850101602084870101116142b9575061351892910160200190613387565b949350505050565b50949350505050565b60809060208152603460208201527f455243313135353a207472616e7366657220746f206e6f6e2d4552433131353560408201527f526563656976657220696d706c656d656e74657200000000000000000000000060608201520190565b9491909293813b61433b57505050505050565b600060209461438d966040519788968795869363f23a6e6160e01b9c8d86526001600160a01b03968780921660048801521660248601526044850152606484015260a0608484015260a48301906133cb565b0393165af16000918161443e575b5061441657505060016143ac61423e565b6308c379a0146143df575b6143c657388080808080614053565b60405162461bcd60e51b8152806140f1600482016142ca565b6143e761425c565b806143f257506143b7565b60405162461bcd60e51b8152602060048201529081906140f19060248301906133cb565b6001600160e01b031916146140cf5760405162461bcd60e51b8152806140f1600482016141f5565b61445791925060203d811161417f576141708183613387565b903861439b565b6040519061446b8261330c565b60018252602082016020368237825115613834575290565b61448c81614a7b565b80614495575050565b6101356144a3828254613eb7565b90556001600160a01b038216600090808252610134602052604082208381540190558247106145b2578180808581945af1903d156145ac573d906144e6826134ab565b916144f46040519384613387565b825260203d92013e5b1561454157604080516001600160a01b0393909316835260208301919091527fdf20fd1e76bc69d672e4814fafb2c449bba3a5369d8359adf9e05e6fde87b05691a1565b60405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608490fd5b506144fd565b60405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606490fd5b9190916001600160401b038080941691160191821161380a57565b939061012f548310156108f157600090838252602095610131875260409384842090600393848301549463ffffffff9261464f848c16809861384a565b83036149ed57888554858d8183169283151594856149d0575b50505050506149bf5783168015159081614985575b50614974576002840154838116801515908161496a575b50614959578b1c8316801515908161494f575b5061493e5781614789575b5050928661476993614714846146f58c7f2e8ac5177a616f2aec08c3048f5021e4e9743ece034e8d83ba5caf76688bb4759d9c9b996147849b98548b1c16613f5d565b63ffffffff60401b82549160401b169063ffffffff60401b1916179055565b8184526101328b528584206001600160a01b0382169b8c86525285842080546001600160401b03614747868284166145f7565b16906001600160401b0319161790558551936147628561336c565b8452613f75565b5191825263ffffffff90921660208201529081906040820190565b0390a2565b60058401805490929015614854578b918354938960068801945b8682106147fb575050505050505092866147699361471461478497946146f58c7f2e8ac5177a616f2aec08c3048f5021e4e9743ece034e8d83ba5caf76688bb4759d9c9b995b96999b9c509c505094975050936146b2565b908561484b8e8e610133600196606461483d614831896001600160a01b038e6148258f84906149fd565b9054911b1c16996149fd565b9054908d1b1c8d61384a565b049583525220918254613eb7565b9055018e6147a3565b9150506101369a99989796959a908154918c5b8381106148ae57505050509285614769936147147f2e8ac5177a616f2aec08c3048f5021e4e9743ece034e8d83ba5caf76688bb4759a9b9c946146f58b6147849a996147e9565b815481101561492a576001600160a01b038160008051602061556e833981519152015416610137805483101561491557908f8b8f9161013361490d93600197968352606461483d8860008051602061554e83398151915201548c61384a565b905501614867565b50634e487b7160e01b8f52603260045260248ffd5b634e487b7160e01b8e52603260045260248efd5b875163914edb0f60e01b8152600490fd5b90504211386146a7565b885163914edb0f60e01b8152600490fd5b9050421038614694565b8751636c80554560e11b8152600490fd5b90508988526101328c528888206001600160a01b03871689528c526001600160401b036149b788828c8c2054166145f7565b16113861467d565b88516352df9fe560e01b8152600490fd5b83949550906149e193911c16613f5d565b161138858d828d614668565b885162bfc92160e01b8152600490fd5b80548210156138345760005260206000200190600090565b60405190614a228261330c565b60606020838281520152565b60405190614a3b82613350565b8160008082528060208301528060408301528060608301528060808301528060a083015260c0820152606060e0820152610100614a76614a15565b910152565b6001600160a01b0316600052610133602052604060002054610134602052604060002054810390811161380a5790565b90816020910312610524575180151581036105245790565b94939291906daaeb6d7670e522a718067333cd4e803b614d1a575b506001600160a01b0395868116963388148015614cf1575b614aff90614f17565b8216801597614b0e8915614f7a565b614b178561445e565b614b208761445e565b998215614c91575b614bc2575b5061395e97985060008581527fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62602091606583526040818180932086825285528a82822054614b7e82821015614fd4565b8b8352606587528383208884528752038282205589815260658552818120878252855220614bad8a8254613eb7565b9055888151938985528401523392a433614328565b969492909795939160005b8851811015614c7c57614be0818a613820565b51614beb828d613820565b5181600052609791602092808452604093846000205492848410614c275790614c22969594939291600052520390600020556137fb565b614bcd565b855162461bcd60e51b815260048101839052602860248201527f455243313135353a206275726e20616d6f756e74206578636565647320746f74604482015267616c537570706c7960c01b6064820152608490fd5b5091939598509193955061395e968897614b2d565b98959260009895929794919897885b8c8b51821015614ce057908b614cc482614cbd81614cdb96613820565b5192613820565b518c526097602052613fdd60408d20918254613eb7565b614ca0565b505092959891949750929598614b28565b50876000526066602052604060002033600052602052614aff60ff604060002054169050614af6565b6001600160a01b038088169033821480614db4575050604051633185c44d60e21b81523060048201523360248201529160209150829060449082905afa908115614da857600091614d8a575b5015614d725738614ade565b604051633b79c77360e21b8152336004820152602490fd5b614da2915060203d8111610fb557610fa78183613387565b38614d66565b6040513d6000823e3d90fd5b91989250908015614eee575b614dc990614f17565b8216801597614dd88915614f7a565b614de18561445e565b614dea8761445e565b998215614eac575b614e47575061395e97985060008581527fc3d58168c5ae7397731d063d5bbf3d657854427343f4c083240f7aacaa2d0f62602091606583526040818180932086825285528a82822054614b7e82821015614fd4565b969492909795939160005b8851811015614c7c57614e65818a613820565b51614e70828d613820565b5181600052609791602092808452604093846000205492848410614c275790614ea7969594939291600052520390600020556137fb565b614e52565b98959260009895929794919897885b8c8b51821015614edd57908b614cc482614cbd81614ed896613820565b614ebb565b505092959891949750929598614df2565b50876000526066602052604060002033600052602052614dc960ff604060002054169050614dc0565b15614f1e57565b60405162461bcd60e51b815260206004820152602e60248201527f455243313135353a2063616c6c6572206973206e6f7420746f6b656e206f776e60448201526d195c881bdc88185c1c1c9bdd995960921b6064820152608490fd5b15614f8157565b60405162461bcd60e51b815260206004820152602560248201527f455243313135353a207472616e7366657220746f20746865207a65726f206164604482015264647265737360d81b6064820152608490fd5b15614fdb57565b60405162461bcd60e51b815260206004820152602a60248201527f455243313135353a20696e73756666696369656e742062616c616e636520666f60448201526939103a3930b739b332b960b11b6064820152608490fd5b9190946daaeb6d7670e522a718067333cd4e803b6153b2575b506001600160a01b03809316923384148015615389575b61506c90614f17565b82518551036153335786169586156150848115614f7a565b84156152f3575b615284575b60005b835181101561511c57806150aa6151179286613820565b51613fdd6150b8838a613820565b5191806000526065602090808252604092836000208c60005283528584600020546150e582821015614fd4565b826000528385528d86600020906000528552038460002055600052815281600020908d60005252600020918254613eb7565b615093565b509492939095604095818688518981527f4a39dc06d4c0dbc64b70af90fd698a233a518aa5d07e595d983b8c0526c8f7fb6151598b83018961351b565b9180830360208201528061516e33948a61351b565b0390a43b61517e57505050505050565b6151be60006020946151e06151d1958a519889978896879563bc197c8160e01b9d8e8852336004890152602488015260a0604488015260a487019061351b565b600319938487830301606488015261351b565b918483030160848501526133cb565b03925af160009181615264575b5061524f57505060016151fe61423e565b6308c379a014615219575b6140da5750388080808080614053565b61522161425c565b8061522c5750615209565b825162461bcd60e51b8152602060048201529081906140f19060248301906133cb565b6001600160e01b0319160361414057506140cf565b61527d91925060203d811161417f576141708183613387565b90386151ed565b94919395929060005b85518110156152e7576152a08187613820565b516152ab828a613820565b5181600052609791602092808452604093846000205492848410614c2757906152e2969594939291600052520390600020556137fb565b61528d565b50909295939194615090565b959160009793959491885b875181101561532557806153156153209289613820565b51614cc4828b613820565b6152fe565b50919495939750919561508b565b60405162461bcd60e51b815260206004820152602860248201527f455243313135353a2069647320616e6420616d6f756e7473206c656e677468206044820152670dad2e6dac2e8c6d60c31b6064820152608490fd5b5083600052606660205260406000203360005260205261506c60ff604060002054169050615063565b6001600160a01b038085169033821480615428575050604051633185c44d60e21b81523060048201523360248201529160209150829060449082905afa908115614da85760009161540a575b5015614d72573861504c565b615422915060203d8111610fb557610fa78183613387565b386153fe565b91955091508015615524575b61543d90614f17565b82518551036153335786169586156154558115614f7a565b84156154ef575b615480575b60005b835181101561511c57806150aa61547b9286613820565b615464565b94919395929060005b85518110156154e35761549c8187613820565b516154a7828a613820565b5181600052609791602092808452604093846000205492848410614c2757906154de969594939291600052520390600020556137fb565b615489565b50909295939194615461565b959160009793959491885b875181101561551657806153156155119289613820565b6154fa565b50919495939750919561545c565b5083600052606660205260406000203360005260205261543d60ff60406000205416905061543456fe43dc304bb3613567eca51c4fb9e7f3128bc51bba882a32550e891d6cbd8a0fa139da2db355130acf428d669fbf1c14faa9d51399a25b793fc254bbbde66f02e2a2646970667358221220d59f690968b93a30540bb3900c196ac0fcd571daf23b9d1bae9d8428cae989cd64736f6c63430008110033"), + rpc_url: String::from(""), + default: true, + skip_resolving: true, + include_solidity: true, + include_yul: false, + output: String::from(""), + name: String::from(""), + timeout: 10000, + }) + .await + .expect("failed to decompile"); + } + #[tokio::test] #[ignore] async fn heavy_integration_test() { diff --git a/crates/decompile/src/core/out/abi.rs b/crates/decompile/src/core/out/abi.rs index d49d5440..301ca497 100644 --- a/crates/decompile/src/core/out/abi.rs +++ b/crates/decompile/src/core/out/abi.rs @@ -1,3 +1,4 @@ +use alloy_dyn_abi::DynSolType; use hashbrown::HashMap; use std::time::Instant; @@ -55,7 +56,9 @@ pub fn build_abi( name: format!("arg{i}"), internal_type: None, ty: match f.resolved_function { - Some(ref sig) => to_abi_string(&sig.inputs()[i]), + Some(ref sig) => { + to_abi_string(sig.inputs().get(i).unwrap_or(&DynSolType::Bytes)) + } None => arg .potential_types() .first() @@ -63,7 +66,9 @@ pub fn build_abi( .to_string(), }, components: match f.resolved_function { - Some(ref sig) => to_components(&sig.inputs()[i]), + Some(ref sig) => { + to_components(sig.inputs().get(i).unwrap_or(&DynSolType::Bytes)) + } None => vec![], }, })