Coder Social home page Coder Social logo

panoramix's Introduction

Panoramix

This is an EVM decompiler.

It's is a fork of the Panoramix original repo that's not maintained actively by its author anymore: https://github.com/eveem-org/panoramix.git

The goal of this fork is to maintain Panoramix in a decent shape, fix some crashes, implement missing opcodes... I also got rid of the "tilde" syntax that was using a custom python encoding and use vanilla Python instead. And I made it a proper python package that can be imported. There is also a better support of timeouts, as instead of stopping entirely we will fallback and print whatever we decompiled even if it's not complete.

The code quality is still not great and the software is complex, it's mostly reserved for advanced users.

Installation

$ pip install panoramix-decompiler

Running

You can specify a web3 provider using the environment variable WEB3_PROVIDER_URI. In this case a local provider was set.

$ WEB3_PROVIDER_URI=http://localhost:7545 panoramix 0x0d94D81FD712126E7f320b5B10537D01d6a01563

You can also provide the bytecode for decompilation.

$ panoramix 6004600d60003960046000f30011223344

Examples

I have decompiled all of mainnet, and make sure to decompile again on the latest Panoramix version from time to time.

You can access decompilations using Oko: https://oko.palkeo.com/

Here is an example for cryptokitties: https://oko.palkeo.com/0x06012c8cf97BEaD5deAe237070F9587f8E7A266d/code/

Caveats

Windows is not supported currently.

Changelog

0.5.0

  • Added support for the BASEFEE opcode.
  • Updated bytecode database / ABI definitions.
  • Ability to decompile the Solidity-generated Panic reverts.
  • Lots of simplification / code cleanup.
  • Moved to Poetry as the dependency management tool.

panoramix's People

Contributors

cleanunicorn avatar kolinko avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

panoramix's Issues

wrong log parameters

decompile Wrapped Ether (WETH) contract on main chain.
decompilation = decompile_address('0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2', None)

It gives
log Transfer( address from=amount, address to=caller, uint256 value=recipient) which should be log Transfer( address from=caller, address to=recipient, uint256 value=amount)

I also found the log reco in the trace is strange too.
('log', ('param', 'amount'), 100389287136786176327247604509743168900146139575972864366142685224231313322991, ('param', 'sender'), ('param', 'recipient'))
I guess it should be:
('log', 100389287136786176327247604509743168900146139575972864366142685224231313322991, ('param', 'amount'), ('param', 'sender'), ('param', 'recipient'))

Uncomplete decompilation

Hi,
I was trying some panoramix features when I tried to decompile this smart contract :
https://etherscan.io/address/0x1d3b7e1afcf4afd95f8f28075f2e49a571dedb56#code

Fortunately enough, the owner published the contract source code so I could compare.
I got this result :

image

I think it's fair to say that the output is a bit short considering the bytecode size and compared to the published source code.
The 'bug' can be replicated on etherscan, as they also use panoramix (the result is even shorter):

https://etherscan.io/bytecode-decompiler?a=0x1d3b7e1afcf4afd95f8f28075f2e49a571dedb56

I have no idea what is going on and I'm sure not competent enough to try resolving this.
I really wanted to open an issue here when I saw that the bug was also occuring on etherscan side, if someone can fix this, it will also benefit etherscan and its numerous users.

Unable to decompile

Here's the bytecode:

0xfe6080604052604051610aa6380380610aa683398101604081905261002291610729565b61002c8134610038565b5050505050505061097f565b60008060008060008060007310ed43c718714eb63d5aa57b78b54704e256024e905060006040518060c001604052806000815260200160008152602001600081526020016000815260200160008152602001600081525090506100a2828b8b61012860201b60201c565b6080840152602083018190529082526100bc908b906103c7565b6100d1828b83602001516104f460201b60201c565b60a08401819052606084018290526040840183905283516000819055602085015160018190556002859055600384905560809095015160048190556005839055909e949d50929b5090995090975095509350505050565b604080516002808252606082018352600092839283928392602083019080368337019050509050866001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561018857600080fd5b505afa15801561019c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101c09190610729565b816000815181106101d3576101d3610953565b60200260200101906001600160a01b031690816001600160a01b031681525050858160018151811061020757610207610953565b6001600160a01b03928316602091820292909201015260405163d06ca61f60e01b815260009189169063d06ca61f9061024690899086906004016108d1565b60006040518083038186803b15801561025e57600080fd5b505afa158015610272573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261029a9190810190610759565b90506000816001815181106102b1576102b1610953565b6020026020010151905060005a9050896001600160a01b031663b6f9de958960008730426040518663ffffffff1660e01b81526004016102f4949392919061089c565b6000604051808303818588803b15801561030d57600080fd5b505af1158015610321573d6000803e3d6000fd5b505050505060005a610333908361092e565b6040516370a0823160e01b81523060048201529091508a906000906001600160a01b038316906370a082319060240160206040518083038186803b15801561037a57600080fd5b505afa15801561038e573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906103b2919061083f565b949d949c50919a509298505050505050505050565b60405163095ea7b360e01b81527310ed43c718714eb63d5aa57b78b54704e256024e6004820152600019602482015282906001600160a01b0382169063095ea7b390604401602060405180830381600087803b15801561042657600080fd5b505af1925050508015610456575060408051601f3d908101601f191682019092526104539181019061081d565b60015b6104ee5760405163095ea7b360e01b81527310ed43c718714eb63d5aa57b78b54704e256024e6004820152602481018390526001600160a01b0382169063095ea7b390604401602060405180830381600087803b1580156104b657600080fd5b505af11580156104ca573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906104ee919061081d565b50505050565b604080516002808252606082018352600092839283928392602083019080368337019050509050858160008151811061052f5761052f610953565b60200260200101906001600160a01b031690816001600160a01b031681525050866001600160a01b031663ad5c46486040518163ffffffff1660e01b815260040160206040518083038186803b15801561058857600080fd5b505afa15801561059c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906105c09190610729565b816001815181106105d3576105d3610953565b6001600160a01b03928316602091820292909201015260405163d06ca61f60e01b815260009189169063d06ca61f9061061290899086906004016108d1565b60006040518083038186803b15801561062a57600080fd5b505afa15801561063e573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f191682016040526106669190810190610759565b905060008160018151811061067d5761067d610953565b60200260200101519050600047905060005a60405163791ac94760e01b81529091506001600160a01b038c169063791ac947906106c7908c906000908a90309042906004016108f2565b600060405180830381600087803b1580156106e157600080fd5b505af11580156106f5573d6000803e3d6000fd5b5050505060005a610706908361092e565b90506000610714844761092e565b949d949c50909a509298505050505050505050565b60006020828403121561073b57600080fd5b81516001600160a01b038116811461075257600080fd5b9392505050565b6000602080838503121561076c57600080fd5b82516001600160401b038082111561078357600080fd5b818501915085601f83011261079757600080fd5b8151818111156107a9576107a9610969565b8060051b604051601f19603f830116810181811085821117156107ce576107ce610969565b604052828152858101935084860182860187018a10156107ed57600080fd5b600095505b838610156108105780518552600195909501949386019386016107f2565b5098975050505050505050565b60006020828403121561082f57600080fd5b8151801515811461075257600080fd5b60006020828403121561085157600080fd5b5051919050565b600081518084526020808501945080840160005b838110156108915781516001600160a01b03168752958201959082019060010161086c565b509495945050505050565b8481526080602082015260006108b56080830186610858565b6001600160a01b03949094166040830152506060015292915050565b8281526040602082015260006108ea6040830184610858565b949350505050565b85815284602082015260a06040820152600061091160a0830186610858565b6001600160a01b0394909416606083015250608001529392505050565b60008282101561094e57634e487b7160e01b600052601160045260246000fd5b500390565b634e487b7160e01b600052603260045260246000fd5b634e487b7160e01b600052604160045260246000fd5b6101188061098e6000396000f3fe608060405260043610602a5760003560e01c8063098d322814603557806392093dd614605c57600080fd5b36603057005b600080fd5b348015604057600080fd5b50604960001981565b6040519081526020015b60405180910390f35b348015606757600080fd5b5060b66040805160c08101825260005480825260015460208301819052600254938301849052600354606084018190526004546080850181905260055460a09095018590529295919493909291565b604080519687526020870195909552938501929092526060840152608083015260a082015260c001605356fea2646970667358221220e61b2cbf46961b8942b7c03d52bec7df942b4fe01eddb0595a91c4a994b64ae864736f6c634300080700

I run the command:

panoramix bytecode...

and I get the following:

10:34:54 panoramix.decompiler Running light execution to find functions.
10:34:54 panoramix.utils.signatures Cache for PABI found.
10:34:54 panoramix.decompiler Parsing _fallback()...
10:34:54 panoramix.decompiler Functions decompilation finished, now doing post-processing.
# Palkeoramix decompiler. 

def _fallback() payable: # default function
  revert


10:34:54 panoramix.decompiler Running light execution to find functions.
10:34:54 panoramix.utils.signatures Cache for PABI found.
# No code found for this contract.

Well done

Look forward to your reply soon please

AssertionError

(venv) root@ccedc66751ef:~# panoramix 0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806312424e3f14610051578063485cc9551461005b578063a98ad46c1461006e578063ea5a94511461009d575b600080fd5b6100596100b0565b005b610059610069366004610282565b61013c565b600054610081906001600160a01b031681565b6040516001600160a01b03909116815260200160405180910390f35b600154610081906001600160a01b031681565b60005460015460405163095ea7b360e01b81526001600160a01b039182166004820152600019602482015291169063095ea7b390604401602060405180830381600087803b15801561010157600080fd5b505af1158015610115573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101399190610259565b50565b6000546001600160a01b0316156101905760405162461bcd60e51b81526020600482015260146024820152731a185cc81899595b881a5b9a5d1a585b1a5e995960621b604482015260640160405180910390fd5b600080546001600160a01b038481166001600160a01b031992831681179093556001805491851691909216811790915560405163095ea7b360e01b81526004810191909152600019602482015263095ea7b390604401602060405180830381600087803b15801561020057600080fd5b505af1158015610214573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102389190610259565b505050565b80356001600160a01b038116811461025457600080fd5b919050565b60006020828403121561026b57600080fd5b8151801515811461027b57600080fd5b9392505050565b6000806040838503121561029557600080fd5b61029e8361023d565b91506102ac6020840161023d565b9050925092905056fea2646970667358221220c266ebfb30e19154d308f53792ac0de7308c65a210a9175fa1b8d35634b6338d64736f6c63430008070033

2023-06-21 19:56:08,285 ccedc66751ef panoramix.decompiler[252114] INFO Running light execution to find functions.
2023-06-21 19:56:08,287 ccedc66751ef panoramix.utils.supplement[252114] INFO Loading /root/.python/venv/lib/python3.11/site-packages/panoramix/data/abi_dump.xz into /root/.cache/panoramix/abi_db.shelve...
Traceback (most recent call last):
File "/root/.python/venv/bin/panoramix", line 8, in
sys.exit(main())
^^^^^^
File "/root/.python/venv/lib/python3.11/site-packages/panoramix/main.py", line 79, in main
print_decompilation(args.address_or_bytecode, args)
File "/root/.python/venv/lib/python3.11/site-packages/panoramix/main.py", line 53, in print_decompilation
decompilation = decompile_bytecode(this_addr, function_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.python/venv/lib/python3.11/site-packages/panoramix/decompiler.py", line 45, in decompile_bytecode
return _decompile_with_loader(loader, only_func_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.python/venv/lib/python3.11/site-packages/panoramix/decompiler.py", line 123, in _decompile_with_loader
loader.run(VM(loader, just_fdests=True))
File "/root/.python/venv/lib/python3.11/site-packages/panoramix/loader.py", line 137, in run
make_abi(self.hash_targets)
File "/root/.python/venv/lib/python3.11/site-packages/panoramix/utils/signatures.py", line 159, in make_abi
sig = fetch_sig(h)
^^^^^^^^^^^^
File "/root/.python/venv/lib/python3.11/site-packages/panoramix/utils/helpers.py", line 151, in wrapper
ret = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/root/.python/venv/lib/python3.11/site-packages/panoramix/utils/supplement.py", line 68, in fetch_sig
check_supplements()
File "/root/.python/venv/lib/python3.11/site-packages/panoramix/utils/supplement.py", line 61, in check_supplements
assert abi_path().is_file()
AssertionError

out of range exception

Here is an interesting contract that causes an exception

0x60806040526004361061007f5760003560e01c806360b25bb71161004e57806360b25bb71461060f578063c0ee0b8a14610624578063e1f21c6714610644578063ea8a1af01461066457610086565b8063089c67be146105825780631e1763d3146105a45780632e1a7d4d146105cf57806349df728c146105ef57610086565b3661008657005b34801561009257600080fd5b5060005a90504760006100a3610679565b6100ab610a76565b60008035610100810260f890811c8352602083905260408084205463010000008402831c855281852054915164010000000085029573ffffffffffffffffffffffffffffffffffffffff92831694620100008702811c94939093169287901c916004600582376020850260156004830137604060006020870260040183895af460005192506020518a01995080600081146101455761014a565b600080fd5b5050811590506102d35773ffffffffffffffffffffffffffffffffffffffff83161561029457600060405160046009823760208402602087026015016004830137604060006020860260040183885af460005192506020518b019a5080600081146101455750508115905061028957600b602086020335670de0b6b3a7640000830204600b6020858801020335670de0b6b3a7640000830204818110600181146101f35761020a565b670de0b6b3a764000082600b60208b020335020494505b5050506040516004600d823760208602601560048301378260208088020360048301015260008060208802600401838a5af48080156101455750505060405160046011823760208402602087026015016004830137816020808602036004830101526000806020860260040183885af48080156101455750505061028e565b600098505b506102ce565b6040516004600d82376020850260156004830137816020808702036004830101526000806020870260040183895af4808015610145575050505b6102d8565b600097505b884710156102e557600080fd5b7fff0000000000000000000000000000000000000000000000000000000000000086161561057657600061032c5a8c600c6000369050020103615208016175308b02610a87565b61a410610aaa9091010460010190508015610574577f01000000000000000000000000000000000000000000000000000000000000007fff00000000000000000000000000000000000000000000000000000000000000881614156103995761039481610aa3565b610574565b7f02000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000088161415610489576040517fd8ccd0f30000000000000000000000000000000000000000000000000000000081526eb3f879cb30fe243b4dfee438691c0490819063d8ccd0f3906104309085906004016112ad565b602060405180830381600087803b15801561044a57600080fd5b505af115801561045e573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061048291908101906111ef565b5050610574565b7f03000000000000000000000000000000000000000000000000000000000000007fff0000000000000000000000000000000000000000000000000000000000000088161415610574576040517fd8ccd0f30000000000000000000000000000000000000000000000000000000081526d4946c0e9f43f4dee607b0ef1fa1c90819063d8ccd0f39061051f9085906004016112ad565b602060405180830381600087803b15801561053957600080fd5b505af115801561054d573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052506105719190810190611227565b50505b505b50505050505050505050005b34801561058e57600080fd5b506105a261059d366004611183565b610b83565b005b3480156105b057600080fd5b506105b9610c25565b6040516105c691906112ad565b60405180910390f35b3480156105db57600080fd5b506105a26105ea36600461120f565b610c2f565b3480156105fb57600080fd5b506105a261060a366004611082565b610c77565b34801561061b57600080fd5b506105a2610de5565b34801561063057600080fd5b506105a261063f3660046110fd565b610c1f565b34801561065057600080fd5b506105a261065f3660046110bd565b610e2d565b34801561067057600080fd5b506105a2611068565b73ff1b9745f68f84f036e5e92c920038d895fb701a33141561069a57610a74565b73ff28319a7cd2136ea7283e7cdb0675b50ac29dd23314156106bb57610a74565b73ff3769cdbd31893ef1b10a01ee0d8bd1f37738993314156106dc57610a74565b73ff49432a1ea8ac6d12285099ba426d1f16f23c8d3314156106fd57610a74565b73ff59364722a4622a8d33623548926375b1b0776733141561071e57610a74565b73ff6d62bc882c2fca5af5cbfe1e6c10b97ba251a433141561073f57610a74565b73ff7baf00edf054e249e9f498aa51d1934b8d352633141561076057610a74565b73ff86c0aa0cc44c3b054c5fdb25f85d555c1d2c3a33141561078157610a74565b73ff910355ad1d3d12e8be75a512553e479726ab453314156107a257610a74565b73ffa5bfe92b6791dad23c7837abb790b48c2f89953314156107c357610a74565b73ffbfdb803d38d794b5785ee0ac09f83b429d11b53314156107e457610a74565b73ffcdfd98c455c29818697ab2eeafccbc4e59fd3d33141561080557610a74565b73ffdce1ae835d35bb603c95163e510bb2604a1a4133141561082657610a74565b73ffe1c5696d924438fba5274d7b5d8ffa29239a6f33141561084757610a74565b73fff66732389866aeaf8f7305da53f442c29e1b8f33141561086857610a74565b73fff804bd7487b4e2aadb32def0efc9c3127687a233141561088957610a74565b73fffb0526a6eb87e85ba0bacb38dd5b53e9bfc0973314156108aa57610a74565b73fffc4a1c98687254c7cf6b1a3bc27db464f3600b3314156108cb57610a74565b73fffdcbe1e77fbf1d0ba78fc39ce4ab0bf5c9f94c3314156108ec57610a74565b73fffef0974279825a633a295d7ebc3f7afeb33c1733141561090d57610a74565b7321f179df331cdc8583373ca5925bf386880cf49e33141561092e57610a74565b73228e402a8eeedd5d1062287bfb1fa0c87df6f69c33141561094f57610a74565b7323e28b5adbdf08319b4919471cdb0551f0c64dfe33141561097057610a74565b7324df3880dde1f005548ba9334547d7f317f13d2933141561099157610a74565b732560a6b230badbac68cb6667e202cf0c1caa17b73314156109b257610a74565b7326afd91411226d4c2a13b8c8b5547cb6ac1c6cdc3314156109d357610a74565b732762c99f14e987ec71346e33735959b7d91803113314156109f457610a74565b732886f28a2c58a3ddf7a4847ced88720125d63b80331415610a1557610a74565b73299db3a6e900681c2436417ef8d13d2af0531f7e331415610a3657610a74565b7330906c083e2ad69c9dcc5b753b86a14f7065d22b331415610a5757610a74565b73ffff46e05a09314daae9176fc32dba0f4172dcdb331415610145575b565b6302625a00451115610a7457600080fd5b6000828210610a9857506000610a9d565b508082035b92915050565b603254603354826001838303011115610b7e57600182015b600184840101811015610b765761ffff811115610af65780605a5260836057523060565261d9946042526000806000806000601a6060205af1505b60ff811115610b23578060595260826057523060565261d894604252600080600080600060196060205af1505b607f811115610b50578060585260816057523060565261d794604252600080600080600060186060205af1505b806057523060565261d694604252600080600080600060176060205af150600101610abb565b508183016032555b505050565b610b8b610679565b610b93610a76565b8060015b81600101811015610c1f57838360018303818110610bb157fe5b9050602002016020610bc69190810190611082565b600082815260208190526040902080547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055600101610b97565b50505050565b6032546033540390565b610c37610679565b610c3f610a76565b8015610c7457604051339082156108fc029083906000818181858888f19350505050158015610c72573d6000803e3d6000fd5b505b50565b610c7f610679565b610c87610a76565b6040517f70a08231000000000000000000000000000000000000000000000000000000008152819060009073ffffffffffffffffffffffffffffffffffffffff8316906370a0823190610cde90309060040161123f565b60206040518083038186803b158015610cf657600080fd5b505afa158015610d0a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610d2e9190810190611227565b90508015610b7e576040517fa9059cbb00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff83169063a9059cbb90610d8a9033908590600401611287565b602060405180830381600087803b158015610da457600080fd5b505af1158015610db8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610ddc91908101906111ef565b610b7e57600080fd5b6d3318585733ff600052601b6005f360645230605652607a606053607360615360005b6035811015610e2157602460606000f050600101610e08565b50603354603501603355565b610e35610679565b610e3d610a76565b6040517fdd62ed3e000000000000000000000000000000000000000000000000000000008152839060009073ffffffffffffffffffffffffffffffffffffffff83169063dd62ed3e90610e969030908890600401611260565b60206040518083038186803b158015610eae57600080fd5b505afa158015610ec2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610ee69190810190611227565b1115610f95576040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82169063095ea7b390610f41908690600090600401611287565b602060405180830381600087803b158015610f5b57600080fd5b505af1158015610f6f573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250610f9391908101906111ef565b505b8115610c1f576040517f095ea7b300000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff82169063095ea7b39061100f9086907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff90600401611287565b602060405180830381600087803b15801561102957600080fd5b505af115801561103d573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525061106191908101906111ef565b5050505050565b611070610679565b611078610a76565b610a746001610aa3565b600060208284031215611093578081fd5b813573ffffffffffffffffffffffffffffffffffffffff811681146110b6578182fd5b9392505050565b6000806000606084860312156110d1578182fd5b83356110dc816112b6565b925060208401356110ec816112b6565b929592945050506040919091013590565b60008060008060608587031215611112578081fd5b843561111d816112b6565b935060208501359250604085013567ffffffffffffffff80821115611140578283fd5b81870188601f820112611151578384fd5b8035925081831115611161578384fd5b886020848301011115611172578384fd5b959894975050602090940194505050565b60008060208385031215611195578182fd5b823567ffffffffffffffff808211156111ac578384fd5b81850186601f8201126111bd578485fd5b80359250818311156111cd578485fd5b86602080850283010111156111e0578485fd5b60200196919550909350505050565b600060208284031215611200578081fd5b815180151581146110b6578182fd5b600060208284031215611220578081fd5b5035919050565b600060208284031215611238578081fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff91909116815260200190565b73ffffffffffffffffffffffffffffffffffffffff92831681529116602082015260400190565b73ffffffffffffffffffffffffffffffffffffffff929092168252602082015260400190565b90815260200190565b73ffffffffffffffffffffffffffffffffffffffff81168114610c7457600080fdfea2646970667358221220c1832e3242d91ef8aae6990349b7b52d24c516d44126c99b392798ff337e5ff464736f6c63430006000033

and the traceback:

10:35:42 panoramix.decompiler Problem with _fallback()
Traceback (most recent call last):
  File "/home/edgar/.local/lib/python3.8/site-packages/panoramix/decompiler.py", line 177, in _decompile_with_loader
    trace = dec()
  File "/home/edgar/.local/lib/python3.8/site-packages/timeout_decorator/timeout_decorator.py", line 81, in new_function
    return function(*args, **kwargs)
  File "/home/edgar/.local/lib/python3.8/site-packages/panoramix/decompiler.py", line 160, in dec
    trace = VM(loader).run(target, stack=stack, timeout=60)
  File "/home/edgar/.local/lib/python3.8/site-packages/panoramix/vm.py", line 237, in run
    self.expand_trace(root)
  File "/home/edgar/.local/lib/python3.8/site-packages/panoramix/vm.py", line 282, in expand_trace
    node.run()
  File "/home/edgar/.local/lib/python3.8/site-packages/panoramix/vm.py", line 170, in run
    self.trace = self.vm._run(self.start, self.safe, self.stack, self.condition)
  File "/home/edgar/.local/lib/python3.8/site-packages/panoramix/vm.py", line 391, in _run
    self.apply_stack(trace, line)
  File "/home/edgar/.local/lib/python3.8/site-packages/panoramix/vm.py", line 579, in apply_stack
    stack.dup(param)
  File "/home/edgar/.local/lib/python3.8/site-packages/panoramix/stack.py", line 88, in dup
    self.stack.append(self.stack[-idx])
IndexError: list index out of range
10:35:42 panoramix.decompiler Functions decompilation finished, now doing post-processing.

Issue Decompiling Contract 0x8ad599c3a0ff1de082011efddc58f1908eb6e6d8: VM stopped prematurely. Node count 10068 and seconds 1. Problem with unknown128acb08(?)

VM stopped prematurely. Node count 10068 and seconds 1.
Problem with unknown128acb08(?)
Traceback (most recent call last):
  File "/home/jeremy/.local/lib/python3.8/site-packages/panoramix/decompiler.py", line 177, in _decompile_with_loader
    trace = dec()
  File "/home/jeremy/.local/lib/python3.8/site-packages/timeout_decorator/timeout_decorator.py", line 82, in new_function
    return function(*args, **kwargs)
  File "/home/jeremy/.local/lib/python3.8/site-packages/panoramix/decompiler.py", line 169, in dec
    trace = make_whiles(trace)
  File "/home/jeremy/.local/lib/python3.8/site-packages/panoramix/whiles.py", line 99, in make_whiles
    trace = simplify_trace(trace)
  File "/home/jeremy/.local/lib/python3.8/site-packages/panoramix/simplify.py", line 157, in simplify_trace
    trace = rewrite_trace(trace, split_setmem)
  File "/home/jeremy/.local/lib/python3.8/site-packages/panoramix/utils/helpers.py", line 207, in rewrite_trace
    ("if", cond, rewrite_trace(if_true, f), rewrite_trace(if_false, f))
  File "/home/jeremy/.local/lib/python3.8/site-packages/panoramix/utils/helpers.py", line 207, in rewrite_trace
    ("if", cond, rewrite_trace(if_true, f), rewrite_trace(if_false, f))
  File "/home/jeremy/.local/lib/python3.8/site-packages/panoramix/utils/helpers.py", line 207, in rewrite_trace
    ("if", cond, rewrite_trace(if_true, f), rewrite_trace(if_false, f))
  [Previous line repeated 18 more times]
  File "/home/jeremy/.local/lib/python3.8/site-packages/panoramix/utils/helpers.py", line 203, in rewrite_trace
    res.extend(f(line))
  File "/home/jeremy/.local/lib/python3.8/site-packages/panoramix/core/memloc.py", line 268, in split_setmem
    post_split = split_or(mem_val)
  File "/home/jeremy/.local/lib/python3.8/site-packages/panoramix/core/memloc.py", line 160, in split_or
    new_memloc = apply_mask_to_range(m.idx, size, offset)
  File "/home/jeremy/.local/lib/python3.8/site-packages/panoramix/core/memloc.py", line 54, in apply_mask_to_range
    assert safe_le_op(add_op(size_bytes, offset_bytes), range_len) is True, (
AssertionError: (('add', 32, ('mul', -1, ('add', 32, ('mul', -1, ('mem', ('range', ('var', '_830'), 32)))))), 0, 32)
VM stopped prematurely. Node count 11535 and seconds 1.

Weak documentation

Hi, can you pls provide some documentation on how to get an output from panoramix. I am using subprocess to run the command, and wanting to retrieve decompiled functions form it. Everything is ok except I am getting some strange output.

Code:

@app.route("/", methods=["POST"])
def index():
    try:
        data = flask.request.json
        address = data['address']
        process = subprocess.run(['panoramix', address], capture_output=True)
        print(process)
        return address
    except Exception as e:
        return flask.Response(status=400)

Output I want:

Output I get:

CompletedProcess(args=['panoramix', '0x06012c8cf97bead5deae237070f9587f8e7a266d'], returncode=1, stdout=b'', stderr=b'13:09:54 panoramix.loader Fetching code for 0x06012c8cf97bead5deae237
070f9587f8e7a266d...\nTraceback (most recent call last):\n  File "/app/.heroku/python/bin/panoramix", line 8, in <module>\n    sys.exit(main())\n  File "/app/.heroku/python/lib/python3.10/site-packages/panoramix/__main__.py", line 1
13, in main\n    print_decompilation(sys.argv[1])\n  File "/app/.heroku/python/lib/python3.10/site-packages/panoramix/__main__.py", line 79, in print_decompilation\n    decompilation = decompile_address(this_addr, function_name)\n  
File "/app/.heroku/python/lib/python3.10/site-packages/panoramix/decompiler.py", line 50, in decompile_address\n    loader.load_addr(address)\n  File "/app/.heroku/python/lib/python3.10/site-packages/panoramix/loader.py", line 103, 
in load_addr\n    code = w3.eth.getCode(Web3.toChecksumAddress(address)).hex()[2:]\n  File "/app/.heroku/python/lib/python3.10/site-packages/web3/module.py", line 57, in caller\n    result = w3.manager.request_blocking(method_str,\n
  File "/app/.heroku/python/lib/python3.10/site-packages/web3/manager.py", line 197, in request_blocking\n    response = self._make_request(method, params)\n  File "/app/.heroku/python/lib/python3.10/site-packages/web3/manager.py", 
line 150, in _make_request\n    return request_func(method, params)\n  File "/app/.heroku/python/lib/python3.10/site-packages/web3/middleware/formatting.py", line 94, in middleware\n    response = make_request(method, params)\n  Fil
e "/app/.heroku/python/lib/python3.10/site-packages/web3/middleware/gas_price_strategy.py", line 90, in middleware\n    return make_request(method, params)\n  File "/app/.heroku/python/lib/python3.10/site-packages/web3/middleware/fo
rmatting.py", line 94, in middleware\n    response = make_request(method, params)\n  File "/app/.heroku/python/lib/python3.10/site-packages/web3/middleware/attrdict.py", line 33, in middleware\n    response = make_request(method, pa
rams)\n  File "/app/.heroku/python/lib/python3.10/site-packages/web3/middleware/formatting.py", line 94, in middleware\n    response = make_request(method, params)\n  File "/app/.heroku/python/lib/python3.10/site-packages/web3/middl
eware/formatting.py", line 94, in middleware\n    response = make_request(method, params)\n  File "/app/.heroku/python/lib/python3.10/site-packages/web3/middleware/formatting.py", line 94, in middleware\n    response = make_request(
method, params)\n  File "/app/.heroku/python/lib/python3.10/site-packages/web3/middleware/buffered_gas_estimate.py", line 40, in middleware\n    return make_request(method, params)\n  File "/app/.heroku/python/lib/python3.10/site-pa
ckages/web3/providers/auto.py", line 94, in make_request\n    return self._proxy_request(method, params)\n  File "/app/.heroku/python/lib/python3.10/site-packages/web3/providers/auto.py", line 106, in _proxy_request\n    raise Canno
tHandleRequest(\nweb3.exceptions.CannotHandleRequest: Could not discover provider while making request: method:eth_getCode\nparams:[\'0x06012c8cf97BEaD5deAe237070F9587f8E7A266d\', \'latest\']\n\n')

Timeout Error and TypeError

Panoramix Issue

We use python 3.8.13 versions and the environment is Linux Ubuntu20.04

  1. Timeout Error

    1. We found that Panoramix often throws timeout exceptions when the number of contract parameters is high in the decompiled expressions. We found that the complexity of algorithm parsing in this part of the code processing logic grows exponentially with the number of parameters, and when the number of parameters is large, the speed of code processing increases greatly, leading to timeout exceptions.
    for a given expression, returns variants of it with each value being 0 or 2^256-1
    
    e.g. for ('ADD', ('mem', 64), ('mem', 256))
         returns
            ('ADD', 0, 0),
            ('ADD', 0, MAX_number),
            ('ADD', MAX_number, 0),
            ('ADD', MAX_number, MAX_number)

    b. 我们在测试这个代码的时候遇到了这类错误

    1. f0d0c1fab0a0f508730ed3ff0e6750bf7411db09_DocVerify.sol/DocVerify.bin-runtime

    2. e4564de79f316b5556eaf1bdae221f3770cc3716_AppProxyUpgradeable.sol/ACL.bin-runtime

    3. 6446ab35c012b10ad7aafc39148da321d7985a0b_RFIStake.sol/ReflectiveStake.bin-runtime

  2. TypeError: can only concatenate tuple (not ""int"") to tuple

    1. We found that the error was a code conversion error

      02:59:16 panoramix.decompiler Running light execution to find functions.
      02:59:16 panoramix.utils.signatures Cache for PABI found.
      02:59:16 panoramix.decompiler Parsing getBySemanticVersion(uint16[3] _semanticVersion)...
      02:59:17 panoramix.decompiler Parsing EVMSCRIPT_REGISTRY_APP_ID()...
      02:59:17 panoramix.decompiler Parsing newVersion(uint16[3] _newSemanticVersion, address _contractAddress, bytes _contentURI)...
      02:59:17 panoramix.vm VM stopped prematurely. Node count 10047 and seconds 0.
      02:59:19 panoramix.decompiler Parsing getByVersionId(uint256 _versionId)...
      02:59:20 panoramix.decompiler Parsing appId()...
      02:59:20 panoramix.decompiler Parsing getInitializationBlock()...
      02:59:20 panoramix.decompiler Parsing getLatestForContractAddress(address _contractAddress)...
      02:59:21 panoramix.decompiler Parsing EVMSCRIPT_REGISTRY_APP()...
      02:59:21 panoramix.decompiler Parsing canPerform(address _sender, bytes32 _role, uint256[] _params)...
      02:59:21 panoramix.decompiler Parsing isValidBump(uint16[3] _oldVersion, uint16[3] _newVersion)...
      02:59:21 panoramix.decompiler Parsing CREATE_VERSION_ROLE()...
      02:59:21 panoramix.decompiler Parsing getLatest()...
      02:59:21 panoramix.decompiler Parsing getVersionsCount()...
      02:59:21 panoramix.decompiler Parsing kernel()...
      02:59:21 panoramix.decompiler Parsing getExecutor(bytes _script)...
      02:59:22 panoramix.decompiler Parsing _fallback()...
      02:59:22 panoramix.decompiler Functions decompilation finished, now doing post-processing.
      02:59:22 panoramix.contract Storage postprocessing failed. This is very bad!
      Traceback (most recent call last):
        File ""/home/liux/.local/lib/python3.8/site-packages/panoramix/contract.py"", line 82, in postprocess
          self.stor_defs = sparser.rewrite_functions(self.functions)
        File ""/home/liux/.local/lib/python3.8/site-packages/panoramix/sparser.py"", line 157, in rewrite_functions
          storages_assoc = _sparser(storages)
        File ""/home/liux/.local/lib/python3.8/site-packages/panoramix/sparser.py"", line 538, in _sparser
          offset += 256 * m.num
      TypeError: can only concatenate tuple (not ""int"") to tuple
      "

Decompiled contract contains escape characters to highlight syntax

Panoramix produces decompiled contracts that contain escape characters to make the output look better in terminal, however, when redirecting it to the file, the code is hard to read. Unfortunately, this syntax highlighting is very tightly integrated in current version of panoramix so after a while I gave up on modifying the code. For those like me, who had the same issues I would recommend to strip escape characters out with sed.

panoramix contractAddress | sed 's/\x1B\[[0-9;]\{1,\}[A-Za-z]//g' > decompiled-contract

If anybody else has a better approach or you recommend other decompilation tool, let me know!

HASH: Out of overflow pages. Increase page size

panoramix 0x9Db7378614d8d9D7149c4eE4763F88c38F9B1517

---->

Traceback (most recent call last):
File "/opt/homebrew/bin/panoramix", line 8, in
sys.exit(main())
^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/panoramix/main.py", line 79, in main
print_decompilation(args.address_or_bytecode, args)
File "/opt/homebrew/lib/python3.11/site-packages/panoramix/main.py", line 51, in print_decompilation
decompilation = decompile_address(this_addr, function_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/panoramix/decompiler.py", line 51, in decompile_address
return _decompile_with_loader(loader, only_func_name)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/panoramix/decompiler.py", line 123, in _decompile_with_loader
loader.run(VM(loader, just_fdests=True))
File "/opt/homebrew/lib/python3.11/site-packages/panoramix/loader.py", line 137, in run
make_abi(self.hash_targets)
File "/opt/homebrew/lib/python3.11/site-packages/panoramix/utils/signatures.py", line 159, in make_abi
sig = fetch_sig(h)
^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/panoramix/utils/helpers.py", line 151, in wrapper
ret = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/lib/python3.11/site-packages/panoramix/utils/supplement.py", line 68, in fetch_sig
check_supplements()
File "/opt/homebrew/lib/python3.11/site-packages/panoramix/utils/supplement.py", line 59, in check_supplements
out[selector] = abi
~~~^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.11.3/Frameworks/Python.framework/Versions/3.11/lib/python3.11/shelve.py", line 125, in setitem
self.dict[key.encode(self.keyencoding)] = f.getvalue()
~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
_dbm.error: cannot add item to database

Failures running the tool in Windows

I'm having problems running this in Windows. I get a failure to decompile any of the bytecode, as compared with running it on Linux using the same input, which has no problem.

panoramix.exe 608060405260006002556012600560006101000a81548160ff021916908360ff1602179055506032600e556005600f556032601460006101000a81548163ffffffff021916908363ffffffff1602179055506001601460046101000a81548160ff0219169083151502179055503480156200007957600080fd5b50622625a033600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506000600560009054906101000a900460ff1660ff16600a0a8202905062000133816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054620002c060201b62001e371790919060201c565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506200019181600254620002c060201b62001e371790919060201c565b600281905550620001a8336200034960201b60201c565b3373ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a3505043601581905550426016819055506040518060400160405280600e81526020017f426f676765642046696e616e6365000000000000000000000000000000000000815250600390805190602001906200026b929190620004ec565b506040518060400160405280600381526020017f424f47000000000000000000000000000000000000000000000000000000000081525060049080519060200190620002b9929190620004ec565b50620005a2565b6000808284019050838110156200033f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b6200035a816200037460201b60201c565b62000371576200037081620003cd60201b60201c565b5b50565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff169050919050565b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff021916908315150217905550600780549050600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055506007819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060086000815480929190600101919050555050565b828054600181600116156101000203166002900490600052602060002090601f01602090048101928262000524576000855562000570565b82601f106200053f57805160ff191683800117855562000570565b8280016001018555821562000570579182015b828111156200056f57825182559160200191906001019062000552565b5b5090506200057f919062000583565b5090565b5b808211156200059e57600081600090555060010162000584565b5090565b6137d480620005b26000396000f3fe608060405234801561001057600080fd5b50600436106102955760003560e01c80635fe8e7cc11610167578063986f3a75116100ce578063b2d4a6f111610087578063b2d4a6f114610d41578063b331108614610d8f578063cbb47d4614610dad578063d4d7b19a14610e05578063dd62ed3e14610e5f578063f2fde38b14610ed757610295565b8063986f3a7514610bf95780639b652d0214610c2d5780639f5a9b7c14610c4d578063a22d483214610c6b578063a694fc3a14610caf578063a9059cbb14610cdd57610295565b80637d8cf4b6116101205780637d8cf4b614610a77578063893d20e814610a815780638d5f81e214610ab557806391c05b0b14610ae957806393005dc214610b1757806395d89b4114610b7657610295565b80635fe8e7cc14610922578063626e1ae71461098157806370a082311461099f578063715018a6146109f757806373889f4a14610a015780637a76646014610a1f57610295565b806326c932601161020b57806342966c68116101c457806342966c68146107fe578063482cd6c51461082c5780634af5da321461084a5780634e0a2d631461086857806351d19a4e146108ac57806351f4ae63146108ca57610295565b806326c93260146106695780632e17de78146106b75780632f54bf6e146106e5578063313ce5671461073f5780633bbac579146107605780633f5ea35c146107ba57610295565b8063176345141161025d578063176345141461042557806318160ddd14610443578063189d165e146104615780631e89d5451461048f578063224b2a5b146105db57806323b872dd146105e557610295565b806306fdde031461029a5780630917e7761461031d578063095ea7b31461033b5780630e53c3341461039f578063131b9c04146103cd575b600080fd5b6102a2610f1b565b6040518080602001828103825283818151815260200191508051906020019080838360005b838110156102e25780820151818401526020810190506102c7565b50505050905090810190601f16801561030f5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610325610fbd565b6040518082815260200191505060405180910390f35b6103876004803603604081101561035157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610fc7565b60405180821515815260200191505060405180910390f35b6103cb600480360360208110156103b557600080fd5b8101908080359060200190929190505050610fdb565b005b61040f600480360360208110156103e357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611005565b6040518082815260200191505060405180910390f35b61042d61106b565b6040518082815260200191505060405180910390f35b61044b611071565b6040518082815260200191505060405180910390f35b61048d6004803603602081101561047757600080fd5b810190808035906020019092919050505061107b565b005b6105d9600480360360408110156104a557600080fd5b81019080803590602001906401000000008111156104c257600080fd5b8201836020820111156104d457600080fd5b803590602001918460208302840111640100000000831117156104f657600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561055657600080fd5b82018360208201111561056857600080fd5b8035906020019184602083028401116401000000008311171561058a57600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192905050506110a4565b005b6105e361114e565b005b610651600480360360608110156105fb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611159565b60405180821515815260200191505060405180910390f35b6106b56004803603604081101561067f57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019092919050505061116f565b005b6106e3600480360360208110156106cd57600080fd5b8101908080359060200190929190505050611173565b005b610727600480360360208110156106fb57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611199565b60405180821515815260200191505060405180910390f35b6107476111f3565b604051808260ff16815260200191505060405180910390f35b6107a26004803603602081101561077657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061120a565b60405180821515815260200191505060405180910390f35b6107fc600480360360208110156107d057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611263565b005b61082a6004803603602081101561081457600080fd5b8101908080359060200190929190505050611493565b005b6108346114eb565b6040518082815260200191505060405180910390f35b6108526114f5565b6040518082815260200191505060405180910390f35b6108aa6004803603602081101561087e57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506114ff565b005b6108b4611642565b6040518082815260200191505060405180910390f35b61090c600480360360208110156108e057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061164c565b6040518082815260200191505060405180910390f35b61092a61165e565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561096d578082015181840152602081019050610952565b505050509050019250505060405180910390f35b6109896116ec565b6040518082815260200191505060405180910390f35b6109e1600480360360208110156109b557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506116f6565b6040518082815260200191505060405180910390f35b6109ff611758565b005b610a09611776565b6040518082815260200191505060405180910390f35b610a6160048036036020811015610a3557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611780565b6040518082815260200191505060405180910390f35b610a7f6117cc565b005b610a8961188e565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610abd6118b8565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610b1560048036036020811015610aff57600080fd5b81019080803590602001909291905050506118e2565b005b610b1f6119d6565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b83811015610b62578082015181840152602081019050610b47565b505050509050019250505060405180910390f35b610b7e611a64565b6040518080602001828103825283818151815260200191508051906020019080838360005b83811015610bbe578082015181840152602081019050610ba3565b50505050905090810190601f168015610beb5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610c2b60048036036020811015610c0f57600080fd5b81019080803563ffffffff169060200190929190505050611b06565b005b610c35611bcb565b60405180821515815260200191505060405180910390f35b610c55611bd4565b6040518082815260200191505060405180910390f35b610cad60048036036020811015610c8157600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611bde565b005b610cdb60048036036020811015610cc557600080fd5b8101908080359060200190929190505050611caa565b005b610d2960048036036040811015610cf357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611cd0565b60405180821515815260200191505060405180910390f35b610d8d60048036036040811015610d5757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611ce5565b005b610d97611ce9565b6040518082815260200191505060405180910390f35b610def60048036036020811015610dc357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611cef565b6040518082815260200191505060405180910390f35b610e4760048036036020811015610e1b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d01565b60405180821515815260200191505060405180910390f35b610ec160048036036040811015610e7557600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611d5a565b6040518082815260200191505060405180910390f35b610f1960048036036020811015610eed57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611de1565b005b606060038054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610fb35780601f10610f8857610100808354040283529160200191610fb3565b820191906000526020600020905b815481529060010190602001808311610f9657829003601f168201915b5050505050905090565b6000600b54905090565b6000610fd38383611ebf565b905092915050565b610fe433611199565b610fed57600080fd5b6001811015610ffb57600080fd5b80600f8190555050565b600061106461101383611f4c565b600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154611e3790919063ffffffff16565b9050919050565b60155481565b6000600254905090565b61108433611199565b61108d57600080fd5b6064811061109a57600080fd5b80600e8190555050565b80518251146110fe576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602681526020018061372c6026913960400191505060405180910390fd5b60005b82518110156111495761113b3384838151811061111a57fe5b602002602001015184848151811061112e57fe5b60200260200101516120c3565b508080600101915050611101565b505050565b6111573361260c565b565b60006111668484846120c3565b90509392505050565b5050565b600960149054906101000a900460ff1661118c57600080fd5b61119633826127c0565b50565b6000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16149050919050565b6000600560009054906101000a900460ff16905090565b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff169050919050565b61126c33611199565b61127557600080fd5b61127e8161120a565b61128757600080fd5b6000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff021916908315150217905550601360008154809291906001900391905055506000601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154905060126001601280549050038154811061135157fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166012828154811061138957fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508060116000601284815481106113e357fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550601280548061145a57fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff021916905590555050565b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156114de57600080fd5b6114e833826129ff565b50565b6000600e54905090565b6000600f54905090565b61150833611199565b61151157600080fd5b61151a81612b30565b61152357600080fd5b6001601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff021916908315150217905550601280549050601160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055506012819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060136000815480929190600101919050555050565b6000601354905090565b6000611657826116f6565b9050919050565b606060078054806020026020016040519081016040528092919081815260200182805480156116e257602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611698575b5050505050905090565b6000600c54905090565b600061175161170483611f4c565b6000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e3790919063ffffffff16565b9050919050565b61176133611199565b61176a57600080fd5b6117746000611de1565b565b6000600854905090565b6000600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001549050919050565b6117d533611199565b6117de57600080fd5b60005b60078054905081101561188b5760006118306007838154811061180057fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16611780565b9050600081111561187d5761187c6007838154811061184b57fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16826127c0565b5b5080806001019150506117e1565b50565b6000600560019054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6000600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16905090565b6118eb3361260c565b806000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054101561193657600080fd5b611987816000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b7b90919063ffffffff16565b6000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506119d33382612bc5565b50565b60606012805480602002602001604051908101604052809291908181526020018280548015611a5a57602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019060010190808311611a10575b5050505050905090565b606060048054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611afc5780601f10611ad157610100808354040283529160200191611afc565b820191906000526020600020905b815481529060010190602001808311611adf57829003601f168201915b5050505050905090565b611b0f33611199565b611b1857600080fd5b600a8163ffffffff16118015611b3557506103e88163ffffffff16105b611ba7576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260138152602001807f496e76616c6964206d61782074782073697a650000000000000000000000000081525060200191505060405180910390fd5b80601460006101000a81548163ffffffff021916908363ffffffff16021790555050565b60006001905090565b6000601054905090565b611be733611199565b611bf057600080fd5b6000600b5414611c4b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252602c815260200180613773602c913960400191505060405180910390fd5b80600960006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506001600960146101000a81548160ff02191690831515021790555050565b600960149054906101000a900460ff16611cc357600080fd5b611ccd3382612c39565b50565b6000611cdd3384846120c3565b905092915050565b5050565b60165481565b6000611cfa82611f4c565b9050919050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160009054906101000a900460ff169050919050565b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054905092915050565b611dea33611199565b611df357600080fd5b80600560016101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600080828401905083811015611eb5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600081600160003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b6000600c54600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101541480611fe257506000600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154145b15611ff057600090506120be565b6000612049600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010154600c54612b7b90919063ffffffff16565b905060006120b6600b546120a8600a60008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000015485612e4790919063ffffffff16565b612ecd90919063ffffffff16565b905080925050505b919050565b60008073ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161415612167576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f43616e2774207472616e736665722066726f6d207a65726f000000000000000081525060200191505060405180910390fd5b600073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561220a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f43616e2774207472616e7366657220746f207a65726f0000000000000000000081525060200191505060405180910390fd5b61221382612f17565b61221c8461260c565b816000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205410156122d0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f4e6f7420656e6f7567682062616c616e6365000000000000000000000000000081525060200191505060405180910390fd5b3373ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff161461244a576123c9826040518060400160405280601481526020017f4e6f7420656e6f75676820616c6c6f77616e6365000000000000000000000000815250600160008873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020546130169092919063ffffffff16565b600160008673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055505b600061245685846130d6565b90506124a9816000808873ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b7b90919063ffffffff16565b6000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061253c816000808773ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e3790919063ffffffff16565b6000808673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061258785613173565b6125908461318d565b61259b8585856131a7565b8373ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef836040518082815260200191505060405180910390a360019150509392505050565b600061261782611780565b1461277457600061262782611f4c565b905061267a816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054611e3790919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555061271181600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060020154611e3790919063ffffffff16565b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206002018190555061276c81600d54611e3790919063ffffffff16565b600d81905550505b600c54600a60008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001018190555050565b80600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154101561280f57600080fd5b6128188261260c565b61286d81600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154612b7b90919063ffffffff16565b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600001819055506128c881600b54612b7b90919063ffffffff16565b600b81905550600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a9059cbb83836040518363ffffffff1660e01b8152600401808373ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561296157600080fd5b505af1158015612975573d6000803e3d6000fd5b505050506040513d602081101561298b57600080fd5b8101908080519060200190929190505050506129a6826132df565b7f0f5bb82176feb1b5e747e28471aa92156a04d9f3ab9f45f28e2d704232b93f758282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b6000811415612a0d57612b2c565b612a2281600254612b7b90919063ffffffff16565b600281905550612a3d81601054611e3790919063ffffffff16565b601081905550612a94816000808573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054612b7b90919063ffffffff16565b6000808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055507fcc16f5dbb4873280815c1ee09dbd06736cffcc184412cf7a71a0fdb75d397ca58282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15b5050565b6000807fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47060001b90506000833f90506000801b8114158015612b725750818114155b92505050919050565b6000612bbd83836040518060400160405280601e81526020017f536166654d6174683a207375627472616374696f6e206f766572666c6f770000815250613016565b905092915050565b612bda81600c54611e3790919063ffffffff16565b600c819055507f63be20cc905d5ba0cf65db405c4999f99f2575e521875f13a8009d6eed7a09d98282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b600960009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166323b872dd8330846040518463ffffffff1660e01b8152600401808473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019350505050602060405180830381600087803b158015612cea57600080fd5b505af1158015612cfe573d6000803e3d6000fd5b505050506040513d6020811015612d1457600080fd5b810190808051906020019092919050505050612d2f8261260c565b612d8481600a60008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000154611e3790919063ffffffff16565b600a60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000181905550612ddf81600b54611e3790919063ffffffff16565b600b81905550612dee826132f9565b7f9e71bc8eea02a63969f509818f2dafb9254532904319f9dbda79b67bd34a5f3d8282604051808373ffffffffffffffffffffffffffffffffffffffff1681526020018281526020019250505060405180910390a15050565b600080831415612e5a5760009050612ec7565b6000828402905082848281612e6b57fe5b0414612ec2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001806137526021913960400191505060405180910390fd5b809150505b92915050565b6000612f0f83836040518060400160405280601a81526020017f536166654d6174683a206469766973696f6e206279207a65726f000000000000815250613313565b905092915050565b601460049054906101000a900460ff1615612f5c5760008114612f3b576000612f3e565b60015b601460046101000a81548160ff021916908315150217905550613013565b612f9d6103e8612f8f601460009054906101000a900463ffffffff1663ffffffff16600254612e4790919063ffffffff16565b612ecd90919063ffffffff16565b811115613012576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f54782073697a652065786365656473206c696d6974000000000000000000000081525060200191505060405180910390fd5b5b50565b60008383111582906130c3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561308857808201518184015260208101905061306d565b50505050905090810190601f1680156130b55780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385039050809150509392505050565b6000806131026103e86130f4600e5486612e4790919063ffffffff16565b612ecd90919063ffffffff16565b905061313984613134600f546131266001600f540386612e4790919063ffffffff16565b612ecd90919063ffffffff16565b612bc5565b61315784613152600f5484612ecd90919063ffffffff16565b6129ff565b61316a8184612b7b90919063ffffffff16565b91505092915050565b61317c816133d9565b61318a5761318981613400565b5b50565b61319681611d01565b6131a4576131a38161360c565b5b50565b60006131b1611642565b14156131bc576132da565b60005b6012805490508110156132d857601281815481106131d957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663a50e1b3e338686866040518563ffffffff1660e01b8152600401808573ffffffffffffffffffffffffffffffffffffffff1681526020018473ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff168152602001828152602001945050505050600060405180830381600087803b1580156132b057600080fd5b505af19250505080156132c1575060015b6132ca576132cb565b5b80806001019150506131bf565b505b505050565b6132e8816133d9565b6132f6576132f581613400565b5b50565b61330281611d01565b6133105761330f8161360c565b5b50565b600080831182906133bf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825283818151815260200191508051906020019080838360005b83811015613384578082015181840152602081019050613369565b50505050905090810190601f1680156133b15780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5060008385816133cb57fe5b049050809150509392505050565b6000806133e5836116f6565b11806133f9575060006133f783611780565b115b9050919050565b6000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff0219169083151502179055506000600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206001015490506007600160078054905003815481106134b757fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff16600782815481106134ef57fe5b9060005260206000200160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600780548061354257fe5b6001900381819060005260206000200160006101000a81549073ffffffffffffffffffffffffffffffffffffffff0219169055905580600660006007848154811061358957fe5b9060005260206000200160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060010181905550600860008154809291906001900391905055505050565b6001600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060000160006101000a81548160ff021916908315150217905550600780549050600660008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020600101819055506007819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506008600081548092919060010191905055505056fe4163636f756e7473202620616d6f756e7473206d7573742062652073616d65206c656e677468536166654d6174683a206d756c7469706c69636174696f6e206f766572666c6f7743616e6e6f74206368616e67652070616972207768696c7374207468657265206973204c50207374616b6564a264697066735822122021090a7080e27c6e0415bd6ff4122ed57b15d2e306e411ebe1cf44898cb0385a64736f6c63430007060033

RESULT:

`21:39:52 panoramix.decompiler Running light execution to find functions.
21:39:52 panoramix.utils.signatures Cache for PABI found.
21:39:52 panoramix.decompiler Parsing _fallback()...
21:39:52 panoramix.decompiler Problem with _fallback()
Traceback (most recent call last):
File "c:\users\sam\appdata\local\programs\python\python39\lib\site-packages\panoramix\decompiler.py", line 177, in _decompile_with_loader
trace = dec()
File "c:\users\sam\appdata\local\programs\python\python39\lib\site-packages\timeout_decorator\timeout_decorator.py", line 75, in new_function
old = signal.signal(signal.SIGALRM, handler)
AttributeError: module 'signal' has no attribute 'SIGALRM'
21:39:52 panoramix.decompiler Functions decompilation finished, now doing post-processing.

Palkeoramix decompiler.

I failed with these:

- _fallback()

All the rest is below.

`

a Mainnet contract that fails

Here's a contract on mainnet that fails: 0x236C5285cA0AF7d946222296257BEAb4B6B4e099

Error message:

... # Decompilation aborted, sorry: ("decompilation didn't finish",)

Any idea what could go wrong?

bytecode:

0x608060405234801561001057600080fd5b50600436106102275760003560e01c80636e3126ef11610130578063c1b80083116100b8578063e5aa2ed01161007c578063e5aa2ed0146108f2578063e85d3bec14610934578063f167a1b814610952578063f6d5924d1461099e578063fe4f5890146109ee57610227565b8063c1b8008314610804578063c234f25a14610854578063d2c00e2414610872578063d41fb39c14610890578063d544e010146108ae57610227565b80638d8900bd116100ff5780638d8900bd1461070e57806391223d691461072c5780639f18050114610784578063afd8b1d1146107a2578063b5647d07146107e657610227565b80636e3126ef1461065e57806371c7132e1461067c578063803c6ee6146106d2578063822c530e146106f057610227565b80634635a4f4116101b35780635f1b0b98116101825780635f1b0b9814610552578063610a714a146105705780636531fe7b146105a85780636614f010146105c657806369cb99451461061457610227565b80634635a4f41461041e57806350473b681461048957806351e59ffb146104dc578063579e3cb31461053457610227565b806330d1c515116101fa57806330d1c5151461032d5780633523af481461034b57806337345e631461036957806338d65d11146103bc5780633bd2b97f1461040057610227565b80631f5b30051461022c57806326defa731461027557806328f2d589146102b95780632af8afca1461030f575b600080fd5b6102586004803603602081101561024257600080fd5b8101908080359060200190929190505050610a26565b604051808381526020018281526020019250505060405180910390f35b6102b76004803603602081101561028b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b9a565b005b6102f9600480360360608110156102cf57600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050610c78565b6040518082815260200191505060405180910390f35b610317610d3c565b6040518082815260200191505060405180910390f35b610335610dea565b6040518082815260200191505060405180910390f35b610353610e99565b6040518082815260200191505060405180910390f35b61039f6004803603604081101561037f57600080fd5b810190808035906020019092919080359060200190929190505050610f77565b604051808381526020018281526020019250505060405180910390f35b6103fe600480360360208110156103d257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506110a2565b005b610408611181565b6040518082815260200191505060405180910390f35b61045e6004803603606081101561043457600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050611230565b6040518085815260200184815260200183815260200182815260200194505050505060405180910390f35b6104bf6004803603604081101561049f57600080fd5b810190808035906020019092919080359060200190929190505050611383565b604051808381526020018281526020019250505060405180910390f35b61051e600480360360208110156104f257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611476565b6040518082815260200191505060405180910390f35b61053c61148e565b6040518082815260200191505060405180910390f35b61055a61157d565b6040518082815260200191505060405180910390f35b6105a66004803603604081101561058657600080fd5b81019080803590602001909291908035906020019092919050505061162c565b005b6105b06119b6565b6040518082815260200191505060405180910390f35b610612600480360360408110156105dc57600080fd5b8101908080359060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506119bc565b005b61061c611be3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b610666611c09565b6040518082815260200191505060405180910390f35b6106bc6004803603606081101561069257600080fd5b81019080803590602001909291908035906020019092919080359060200190929190505050611cd8565b6040518082815260200191505060405180910390f35b6106da611e85565b6040518082815260200191505060405180910390f35b6106f8611f34565b6040518082815260200191505060405180910390f35b610716611fe3565b6040518082815260200191505060405180910390f35b61076e6004803603602081101561074257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612095565b6040518082815260200191505060405180910390f35b61078c6120ad565b6040518082815260200191505060405180910390f35b6107e4600480360360208110156107b857600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061215f565b005b6107ee61223d565b6040518082815260200191505060405180910390f35b61083a6004803603604081101561081a57600080fd5b8101908080359060200190929190803590602001909291905050506122ef565b604051808215151515815260200191505060405180910390f35b61085c6123e8565b6040518082815260200191505060405180910390f35b61087a612497565b6040518082815260200191505060405180910390f35b610898612546565b6040518082815260200191505060405180910390f35b6108f0600480360360208110156108c457600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506125f5565b005b61091e6004803603602081101561090857600080fd5b81019080803590602001909291905050506126d3565b6040518082815260200191505060405180910390f35b61093c612799565b6040518082815260200191505060405180910390f35b6109886004803603604081101561096857600080fd5b810190808035906020019092919080359060200190929190505050612888565b6040518082815260200191505060405180910390f35b6109ca600480360360208110156109b457600080fd5b8101908080359060200190929190505050612954565b60405180848152602001838152602001828152602001935050505060405180910390f35b610a2460048036036040811015610a0457600080fd5b810190808035906020019092919080359060200190929190505050612a68565b005b600080610a7960016004541460018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414612e20565b610ace576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806135a76025913960400191505060405180910390fd5b60008390506000600854851215610ae9576008549150610afa565b600754851315610af95760075491505b5b60008083128015610b1057506006548360000312155b90508015610b2f5760016b033b2e3c9fd0803ce8000000039150610b8b565b600083128015610b51575060016b033b2e3c9fd0803ce8000000036000038313155b15610b7b57610b7460065460016b033b2e3c9fd0803ce800000003600003612e2d565b9150610b8a565b610b8760065484612e2d565b91505b5b81600194509450505050915091565b60016000803373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414610c31576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260298152602001806135cc6029913960400191505060405180910390fd5b60016000808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000208190555050565b6000610cca60016004541460018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414612e20565b610d1f576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806135a76025913960400191505060405180910390fd5b6000610d2c858585611230565b9350505050809150509392505050565b6000610d8e60016004541460018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414612e20565b610de3576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806135a76025913960400191505060405180910390fd5b6001905090565b6000610e3c60016004541460018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414612e20565b610e91576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806135a76025913960400191505060405180910390fd5b600e54905090565b6000610eeb60016004541460018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414612e20565b610f40576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260258152602001806135a76025913960400191505060405180910390fd5b6000610f4e42600e54612ebb565b9050600954811015610f64576000915050610f74565b610f7081600954612ebb565b9150505b90565b600080610fca60016004541460018060003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205414612e20565b61101f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180

Panoramix fails to work not in main thread (and does not work in Windows)

ERROR:panoramix.decompiler:Problem with name()
Traceback (most recent call last):
File "/opt/homebrew/lib/python3.9/site-packages/panoramix/decompiler.py", line 177, in _decompile_with_loader
trace = dec()
File "/opt/homebrew/lib/python3.9/site-packages/timeout_decorator/timeout_decorator.py", line 75, in new_function
old = signal.signal(signal.SIGALRM, handler)
File "/opt/homebrew/Cellar/[email protected]/3.9.5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/signal.py", line 47, in signal
handler = _signal.signal(_enum_to_int(signalnum), _enum_to_int(handler))
ValueError: signal only works in main thread of the main interpreter

This happens because panoramix in one place uses timeout-decorator library.
Precisely here in panoramix/decompiler.py

def _decompile_with_loader(loader, only_func_name=None) -> Decompilation:
    ...
      @timeout_decorator.timeout(60 * 3, timeout_exception=TimeoutInterrupt)
      def dec():
        trace = VM(loader).run(target, stack=stack, timeout=60)

timeout_decorator project actually describes this problem here:

Multithreading
By default, timeout-decorator uses signals to limit the execution time of the given function. This appoach does not work if your function is executed not in a main thread (for example if it’s a worker thread of the web application). There is alternative timeout strategy for this case - by using multiprocessing. To use it, just pass use_signals=False to the timeout decorator function:

But just adding use_signals=False would not work as the object is sophisticated enough and can not be pickled which is required by the multiprocessing module

So the full solution to this problem is:

  1. pip install wrapt_timeout_decorator

  2. add to panoramix/decompiler.py

from wrapt_timeout_decorator import timeout
  1. replace
def _decompile_with_loader(loader, only_func_name=None) -> Decompilation:
    ...
      @timeout_decorator.timeout(60 * 3, timeout_exception=TimeoutInterrupt)
      def dec():
        trace = VM(loader).run(target, stack=stack, timeout=60)

with

def _decompile_with_loader(loader, only_func_name=None) -> Decompilation:
    ...
      @timeout(60 * 3, timeout_exception=TimeoutInterrupt, use_signals=False)
      def dec():
        trace = VM(loader).run(target, stack=stack, timeout=60)

This solves the failure to work not in main thread problem and should also solve not working in Windows problem (although I can not test the second statement)

I can submit a pull request, just let me know

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.