diff --git a/README.md b/README.md index 5d050cc..ec1bcc1 100644 --- a/README.md +++ b/README.md @@ -1,18 +1,57 @@ -# Clique Block Verification -This repo allows you to set up a "Clique" proof of authority Ethereum blockchain with two separate peers who both engage in the sealing of blocks. The instructions are based on the tutorial of [Salanfe](https://hackernoon.com/setup-your-own-private-proof-of-authority-ethereum-network-with-geth-9a0a3750cda8) but has the more complicated parts already initialised. +# Block Validation Scheme +Block validation scheme is a set of smart contract which aim to be able to ensure that block headers submitted to the contract are sealed by an approved partie(s). The motivation behind this is to update the state of a Clique PoA or Istanbul PBFT chain onto any other blockchain. To do this we first need to know which blocks are valid - dependent on the definition of a valid by the underlying consensus algorithm. -Once the network has been launched the tests validate that the blocks have been signed by a known validator. +At this stage a Clique PoA chain is launched and then the block headers updated to the smart contract which is deployed on itself. However in the near future this will be extended to update the Clique header onto any other chain. For a full description and roadmap of the project please refer to the Clearmatics [Ion-Stage-2 Wiki](https://github.com/clearmatics/ion/wiki/Ion-Stage-2---Proposal#validation). -## Launch the Network -In order to run the network first install an instance of [geth](https://geth.ethereum.org/downloads/) the directory structure and accounts have been set up a priori. Hence all that is required to launch the network is to follow these instructions: +## Running the Project +This project contains a number of components: + * Validation smart contract and tests + * Clique _proof of authority_ test network + * Command Line Interface for interacting with the smart contract -### Initialise Nodes +In order to use the smart contracts and run the tests it is necessary to first initialise the test network. + +***Note:*** that as the contract searches for specific parts of the block header that only exist in Clique, Ganache or Ethash chains cannot be used. + +### Initialise the Test Network +The instructions are based on the tutorial of [Salanfe](https://hackernoon.com/setup-your-own-private-proof-of-authority-ethereum-network-with-geth-9a0a3750cda8) but has the more complicated parts already initialised. + +First install an instance of [geth](https://geth.ethereum.org/downloads/) and clone the repo. + +Having cloned and entered the repo: +``` +$ git clone git@github.com:maxrobot/validation.git +$ cd /path/to/validation +``` + +Now run the command: ``` +$ tree -L 1 +``` + +Which hopefully returns this: +``` +├── abi +├── build +├── contracts +├── migrations +├── package.json +├── poa-network +├── README.md +├── src +├── test +└── truffle.js +``` + +#### Initialise Nodes +Network files are found in the `/path/to/validation/poa-network` directory. Enter the poa-network directory and initialise the two nodes which will be sealing blocks: +``` +$ cd /path/to/validation/poa-network $ geth --datadir node1/ init genesis.json $ geth --datadir node2/ init genesis.json ``` -### Launch the Bootnode +#### Launch the Bootnode The boot node tells the peers how to connect with each other. In another terminal instance run: ``` $ bootnode -nodekey boot.key -verbosity 9 -addr :30310 @@ -20,28 +59,64 @@ $ INFO [06-07|12:16:21] UDP listener up self=enode://dc ``` As the peers communicate this terminal should fill with logs. -### Start and Attach to the Nodes -Each node must be launch, either as a background operation or on separate terminal instances. For node 1: +***Note:*** bootnode may not be found if go-ethereum/geth is not installed fully. + +#### Start and Attach to the Nodes +Each node must be launched either as a background operation or on separate terminal instances. Thus from the poa-network directory for node 1 run: ``` $ geth --datadir node1/ --syncmode 'full' --port 30311 --rpc --rpcaddr 'localhost' --rpcport 8501 --bootnodes 'enode://dcb1dbf8d710eb7d10e0e2db1e6d3370c4b048efe47c7a85c4b537b60b5c11832ef25f026915b803e928c1d93f01b853131e412c6308c4c6141d1504c78823c8@127.0.0.1:30310' --networkid 1515 --gasprice '1' -unlock '0x2be5ab0e43b6dc2908d5321cf318f35b80d0c10d' --password node1/password.txt --mine ``` -then attach, +then attach: ``` $ geth attach node1/geth.ipc ``` -node 2: + and again for node 2: ``` $ geth --datadir node2/ --syncmode 'full' --port 30312 --rpc --rpcaddr 'localhost' --rpcport 8502 --bootnodes 'enode://dcb1dbf8d710eb7d10e0e2db1e6d3370c4b048efe47c7a85c4b537b60b5c11832ef25f026915b803e928c1d93f01b853131e412c6308c4c6141d1504c78823c8@127.0.0.1:30310' --networkid 1515 --gasprice '0' -unlock '0x8671e5e08d74f338ee1c462340842346d797afd3' --password node2/password.txt --mine ``` -again attach, +attaching: ``` $ geth attach node2/geth.ipc ``` -Notice that IPC has been used to attach to the nodes, this allows the clique module to be used. +***Note:*** that IPC has been used to attach to the nodes, this allows the clique module to be used. -## Test -After launching the network: +### Testing Contracts +After launching the network, from the root of the repository: ``` $ npm install $ truffle test ``` + +### Ion Command Line Interface +The Ion CLI is a tool for handling the passing of block headers between to blockchains written in Golang to leverage the extensive ethereum libraries. It is not a critical part of the Ion infrastructure rather is just an open utility that people can extend and use as they see fit. + +In its current form the Ion CLI allows the user to connect to two separate blockchains, via RPC, and submit block headers to a validation contract. + +#### Running the CLI +As mentioned in the project description this simple implementation of the validation contract is active only on a single blockchain, however the CLI is simulating the passing of the headers to and from as if it were between separate chains. + +Having followed the instructions on how to setup a Clique blockchain, which is hosted on `127.0.0.1:8502`, and running another chain on `127.0.0.1:8501` we can attach the CLI. + +``` +$ cd /path/to/validation/src +$ make build +``` +Assuming a successful build the tool can be run, +``` +$ ./ion-cli [/path/to/setup.json] +=============================================================== +Ion Command Line Interface + +RPC Client [to]: +Listening on: 127.0.0.1:8501 +User Account: 0x2be5ab0e43b6dc2908d5321cf318f35b80d0c10d +Ion Contract: 0xb9fd43a71c076f02d1dbbf473c389f0eacec559f + +RPC Client [from]: +Listening on: 127.0.0.1:8502 +User Account: 0x8671e5e08d74f338ee1c462340842346d797afd3 +=============================================================== +>>> +``` + + diff --git a/abi/ECVerify.abi b/abi/ECVerify.abi new file mode 100644 index 0000000..0637a08 --- /dev/null +++ b/abi/ECVerify.abi @@ -0,0 +1 @@ +[] \ No newline at end of file diff --git a/abi/ECVerify.bin b/abi/ECVerify.bin new file mode 100644 index 0000000..56887c3 --- /dev/null +++ b/abi/ECVerify.bin @@ -0,0 +1 @@ +604c602c600b82828239805160001a60731460008114601c57601e565bfe5b5030600052607381538281f30073000000000000000000000000000000000000000030146080604052600080fd00a165627a7a72305820acb6e646edaf05c92bfe7c53e47edcf3f96a2d5cf3d55019662508f330c1d89f0029 \ No newline at end of file diff --git a/abi/Migrations.abi b/abi/Migrations.abi new file mode 100644 index 0000000..79cea67 --- /dev/null +++ b/abi/Migrations.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"new_address","type":"address"}],"name":"upgrade","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"last_completed_migration","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":true,"inputs":[],"name":"owner","outputs":[{"name":"","type":"address"}],"payable":false,"stateMutability":"view","type":"function"},{"constant":false,"inputs":[{"name":"completed","type":"uint256"}],"name":"setCompleted","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"}] \ No newline at end of file diff --git a/abi/Migrations.bin b/abi/Migrations.bin new file mode 100644 index 0000000..34c63b9 --- /dev/null +++ b/abi/Migrations.bin @@ -0,0 +1 @@ +608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102f8806100606000396000f300608060405260043610610062576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680630900f01014610067578063445df0ac146100aa5780638da5cb5b146100d5578063fdacd5761461012c575b600080fd5b34801561007357600080fd5b506100a8600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610159565b005b3480156100b657600080fd5b506100bf610241565b6040518082815260200191505060405180910390f35b3480156100e157600080fd5b506100ea610247565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561013857600080fd5b506101576004803603810190808035906020019092919050505061026c565b005b60008060009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141561023d578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b15801561022457600080fd5b505af1158015610238573d6000803e3d6000fd5b505050505b5050565b60015481565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614156102c957806001819055505b505600a165627a7a7230582090db59736857b6a69a78d054d092a30ff8e90f10f6f3bca8afc3d994c885eedd0029 \ No newline at end of file diff --git a/abi/Recover.abi b/abi/Recover.abi new file mode 100644 index 0000000..49fac10 --- /dev/null +++ b/abi/Recover.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"header","type":"bytes"},{"name":"prefixHeader","type":"bytes"},{"name":"prefixExtraData","type":"bytes"}],"name":"ExtractHash","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"header","type":"bytes"},{"name":"sig","type":"bytes"}],"name":"VerifyBlock","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":false,"inputs":[{"name":"data","type":"bytes32"},{"name":"sig","type":"bytes"}],"name":"VerifyHash","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"inputs":[],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"owner","type":"address"}],"name":"broadcastSig","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"header","type":"bytes"},{"indexed":false,"name":"parentHash","type":"bytes"},{"indexed":false,"name":"rootHash","type":"bytes"}],"name":"broadcastHashData","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"blockHash","type":"bytes32"}],"name":"broadcastHash","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"header","type":"bytes"}],"name":"test","type":"event"}] \ No newline at end of file diff --git a/abi/Recover.bin b/abi/Recover.bin new file mode 100644 index 0000000..183887f --- /dev/null +++ b/abi/Recover.bin @@ -0,0 +1 @@ +608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610b11806100606000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063b0e7308f1461005c578063d09ca90414610151578063fdace1be14610200575b600080fd5b34801561006857600080fd5b5061014f600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610277565b005b34801561015d57600080fd5b506101fe600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f016020809104026020016040519081016040528093929190818152602001838380828437820191505050505050919291929050505061055e565b005b34801561020c57600080fd5b506102756004803603810190808035600019169060200190929190803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610840565b005b60008060608060608060606000808b5198508b6040518082805190602001908083835b6020831015156102bf578051825260208201915060208101905060208303925061029a565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902097507fcd7ee33e1a630d6301d87631aab1d4ddce7e1942593cd2689aa989f76d67cf018860405180826000191660001916815260200191505060405180910390a1608d89036040519080825280601f01601f1916602001820160405280156103635781602001602082028038833980820191505090505b509650601f6040519080825280601f01601f19166020018201604052801561039a5781602001602082028038833980820191505090505b50955060416040519080825280601f01601f1916602001820160405280156103d15781602001602082028038833980820191505090505b509450602a6040519080825280601f01601f1916602001820160405280156104085781602001602082028038833980820191505090505b509350610419878d60008a516108b6565b600260218801600260208e016004610bb8fa5061043c868d608c8c0389516108b6565b600160208701600160208d016004610bb8fa5061045f848d602a8c0387516108b6565b61046a878786610971565b9250826040518082805190602001908083835b6020831015156104a2578051825260208201915060208101905060208303925061047d565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902091506104e1858d606b8c0388516108b6565b6104eb8286610a1d565b90507fba2fe28067a0918af64c5359b1579f887bf1479dd3163c7e5d456314168854a581604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1505050505050505050505050565b600080606080856040518082805190602001908083835b60208310151561059a5780518252602082019150602081019050602083039250610575565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902093506105d38486610a1d565b925060206040519080825280601f01601f1916602001820160405280156106095781602001602082028038833980820191505090505b50915060206040519080825280601f01601f1916602001820160405280156106405781602001602082028038833980820191505090505b5090506106518287600460206108b6565b61065f8187605b60206108b6565b7f8511795469a13c04a2bc22c3f1309fc0bd918a0a25a3e7e222a0417b719274c786838360405180806020018060200180602001848103845287818151815260200191508051906020019080838360005b838110156106cb5780820151818401526020810190506106b0565b50505050905090810190601f1680156106f85780820380516001836020036101000a031916815260200191505b50848103835286818151815260200191508051906020019080838360005b83811015610731578082015181840152602081019050610716565b50505050905090810190601f16801561075e5780820380516001836020036101000a031916815260200191505b50848103825285818151815260200191508051906020019080838360005b8381101561079757808201518184015260208101905061077c565b50505050905090810190601f1680156107c45780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a17fba2fe28067a0918af64c5359b1579f887bf1479dd3163c7e5d456314168854a583604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1505050505050565b600061084c8383610a1d565b90507fba2fe28067a0918af64c5359b1579f887bf1479dd3163c7e5d456314168854a581604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1505050565b60008090505b8181101561096a57838184018151811015156108d457fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002858281518110151561092d57fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806001019150506108bc565b5050505050565b606060008060008060008060608a5196508951955060208701945088519350600260208888010101925060028487890101019150816040519080825280601f01601f1916602001820160405280156109d85781602001602082028038833980820191505090505b50905086602082018860208e016004610bb8fa50858582018760208d016004610bb8fa50838382018560208c016004610bb8fa50809750505050505050509392505050565b60008060008060418551141515610a3357600080fd5b6020850151925060408501519150606085015160001a9050601b8160ff161015610a5e57601b810190505b601b8160ff161480610a735750601c8160ff16145b1515610a7e57600080fd5b610a8a86828585610a95565b935050505092915050565b60008060006040518781528660208201528560408201528460608201526020816080836001610bb8fa9250805191505060011515821515141515610ad857600080fd5b80925050509493505050505600a165627a7a7230582084747b0b9ea8d1285e7c7714b82fb8ff314f3245d9b3e8132f7679cf08b7ca2b0029 \ No newline at end of file diff --git a/abi/Validation.abi b/abi/Validation.abi new file mode 100644 index 0000000..0388fd3 --- /dev/null +++ b/abi/Validation.abi @@ -0,0 +1 @@ +[{"constant":false,"inputs":[{"name":"header","type":"bytes"},{"name":"prefixHeader","type":"bytes"},{"name":"prefixExtraData","type":"bytes"}],"name":"ValidateBlock","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"GetValidators","outputs":[{"name":"_validators","type":"address[]"}],"payable":false,"stateMutability":"view","type":"function"},{"inputs":[{"name":"_validators","type":"address[]"}],"payable":false,"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"name":"owner","type":"address"}],"name":"broadcastSig","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"header","type":"bytes"},{"indexed":false,"name":"parentHash","type":"bytes"},{"indexed":false,"name":"rootHash","type":"bytes"}],"name":"broadcastHashData","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"name":"blockHash","type":"bytes32"}],"name":"broadcastHash","type":"event"}] diff --git a/abi/Validation.bin b/abi/Validation.bin new file mode 100644 index 0000000..3513650 --- /dev/null +++ b/abi/Validation.bin @@ -0,0 +1 @@ +608060405234801561001057600080fd5b506040516109d73803806109d7833981018060405281019080805182019291905050506000336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600090505b815181101561017c576001828281518110151561009357fe5b9060200190602002015190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050600160026000848481518110151561011457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808060010191505061007a565b505061084a8061018d6000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063aae933e414610051578063d405af3d14610146575b600080fd5b34801561005d57600080fd5b50610144600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506101b2565b005b34801561015257600080fd5b5061015b610561565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561019e578082015181840152602081019050610183565b505050509050019250505060405180910390f35b60008060608060608060606000808b5198508b6040518082805190602001908083835b6020831015156101fa57805182526020820191506020810190506020830392506101d5565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902097507fcd7ee33e1a630d6301d87631aab1d4ddce7e1942593cd2689aa989f76d67cf018860405180826000191660001916815260200191505060405180910390a1608d89036040519080825280601f01601f19166020018201604052801561029e5781602001602082028038833980820191505090505b509650601f6040519080825280601f01601f1916602001820160405280156102d55781602001602082028038833980820191505090505b50955060416040519080825280601f01601f19166020018201604052801561030c5781602001602082028038833980820191505090505b509450602a6040519080825280601f01601f1916602001820160405280156103435781602001602082028038833980820191505090505b509350610354878d60008a516105ef565b600260218801600260208e016004610bb8fa50610377868d608c8c0389516105ef565b600160208701600160208d016004610bb8fa5061039a848d602a8c0387516105ef565b6103a58787866106aa565b9250826040518082805190602001908083835b6020831015156103dd57805182526020820191506020810190506020830392506103b8565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020915061041c858d606b8c0388516105ef565b6104268286610756565b905060011515600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156104f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f5369676e6572206e6f7420612076616c696461746f722100000000000000000081525060200191505060405180910390fd5b7fba2fe28067a0918af64c5359b1579f887bf1479dd3163c7e5d456314168854a581604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1505050505050505050505050565b606060018054806020026020016040519081016040528092919081815260200182805480156105e557602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161059b575b5050505050905090565b60008090505b818110156106a3578381840181518110151561060d57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002858281518110151561066657fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806001019150506105f5565b5050505050565b606060008060008060008060608a5196508951955060208701945088519350600260208888010101925060028487890101019150816040519080825280601f01601f1916602001820160405280156107115781602001602082028038833980820191505090505b50905086602082018860208e016004610bb8fa50858582018760208d016004610bb8fa50838382018560208c016004610bb8fa50809750505050505050509392505050565b6000806000806041855114151561076c57600080fd5b6020850151925060408501519150606085015160001a9050601b8160ff16101561079757601b810190505b601b8160ff1614806107ac5750601c8160ff16145b15156107b757600080fd5b6107c3868285856107ce565b935050505092915050565b60008060006040518781528660208201528560408201528460608201526020816080836001610bb8fa925080519150506001151582151514151561081157600080fd5b80925050509493505050505600a165627a7a72305820bfdda3defd1a9101b13153fe900905c379572f205ad37b4197c70cdd78be35e20029 \ No newline at end of file diff --git a/build/contracts/ECVerify.json b/build/contracts/ECVerify.json new file mode 100644 index 0000000..2862320 --- /dev/null +++ b/build/contracts/ECVerify.json @@ -0,0 +1,2459 @@ +{ + "contractName": "ECVerify", + "abi": [], + "bytecode": "0x604c602c600b82828239805160001a60731460008114601c57601e565bfe5b5030600052607381538281f30073000000000000000000000000000000000000000030146080604052600080fd00a165627a7a7230582085ce0edcf4382fe98e8e0d5f20cf09c52e92561b6be0cfde3b99fef8304052ce0029", + "deployedBytecode": "0x73000000000000000000000000000000000000000030146080604052600080fd00a165627a7a7230582085ce0edcf4382fe98e8e0d5f20cf09c52e92561b6be0cfde3b99fef8304052ce0029", + "sourceMap": "997:2772:0:-;;132:2:-1;166:7;155:9;146:7;137:37;252:7;246:14;243:1;238:23;232:4;229:33;270:1;265:20;;;;222:63;;265:20;274:9;222:63;;298:9;295:1;288:20;328:4;319:7;311:22;352:7;343;336:24", + "deployedSourceMap": "997:2772:0:-;;;;;;;;", + "source": "pragma solidity ^0.4.18;\n\n//\n// The new assembly support in Solidity makes writing helpers easy.\n// Many have complained how complex it is to use `ecrecover`, especially in conjunction\n// with the `eth_sign` RPC call. Here is a helper, which makes that a matter of a single call.\n//\n// Sample input parameters:\n// (with v=0)\n// \"0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad\",\n// \"0xaca7da997ad177f040240cdccf6905b71ab16b74434388c3a72f34fd25d6439346b2bac274ff29b48b3ea6e2d04c1336eaceafda3c53ab483fc3ff12fac3ebf200\",\n// \"0x0e5cb767cce09a7f3ca594df118aa519be5e2b5a\"\n//\n// (with v=1)\n// \"0x47173285a8d7341e5e972fc677286384f802f8ef42a5ec5f03bbfa254cb01fad\",\n// \"0xdebaaa0cddb321b2dcaaf846d39605de7b97e77ba6106587855b9106cb10421561a22d94fa8b8a687ff9c911c844d1c016d1a685a9166858f9c7c1bc85128aca01\",\n// \"0x8743523d96a1b2cbe0c6909653a56da18ed484af\"\n//\n// (The hash is a hash of \"hello world\".)\n//\n// Written by Alex Beregszaszi (@axic), use it under the terms of the MIT license.\n//\n\nlibrary ECVerify {\n // Duplicate Solidity's ecrecover, but catching the CALL return value\n function safer_ecrecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) constant internal returns (address) {\n // We do our own memory management here. Solidity uses memory offset\n // 0x40 to store the current end of memory. We write past it (as\n // writes are memory extensions), but don't update the offset so\n // Solidity will reuse it. The memory used here is only needed for\n // this context.\n\n // FIXME: inline assembly can't access return values\n bool ret;\n address addr;\n\n assembly {\n let size := mload(0x40)\n mstore(size, hash)\n mstore(add(size, 32), v)\n mstore(add(size, 64), r)\n mstore(add(size, 96), s)\n\n // NOTE: we can reuse the request memory because we deal with\n // the return code\n ret := staticcall(3000, 1, size, 128, size, 32)\n addr := mload(size)\n }\n\n require( ret == true );\n\n return addr;\n }\n\n function ecrecovery(bytes32 hash, bytes sig) internal constant returns (address) {\n bytes32 r;\n bytes32 s;\n uint8 v;\n\n require (sig.length == 65);\n\n // The signature format is a compact form of:\n // {bytes32 r}{bytes32 s}{uint8 v}\n // Compact means, uint8 is not padded to 32 bytes.\n assembly {\n r := mload(add(sig, 32))\n s := mload(add(sig, 64))\n\n // Here we are loading the last 32 bytes. We exploit the fact that\n // 'mload' will pad with zeroes if we overread.\n // There is no 'mload8' to do this, but that would be nicer.\n v := byte(0, mload(add(sig, 96)))\n\n // Alternative solution:\n // 'byte' is not working due to the Solidity parser, so lets\n // use the second best option, 'and'\n // v := and(mload(add(sig, 65)), 255)\n }\n\n // albeit non-transactional signatures are not specified by the YP, one would expect it\n // to match the YP range of [27, 28]\n //\n // geth uses [0, 1] and some clients have followed. This might change, see:\n // https://github.com/ethereum/go-ethereum/issues/2053\n if (v < 27)\n v += 27;\n\n require (v == 27 || v == 28);\n\n /* prefix might be needed for geth only\n * https://github.com/ethereum/go-ethereum/issues/3731\n */\n /* bytes memory prefix = \"\\x19Ethereum Signed Message:\\n32\";\n hash = keccak256(prefix, hash); */\n /* hash = sha3(prefix, hash); */\n\n return safer_ecrecover(hash, v, r, s);\n /* return ecrecover(hash, v, r, s); */\n }\n}\n", + "sourcePath": "/home/user97/go/src/github.com/validation/contracts/ECVerify.sol", + "ast": { + "absolutePath": "/home/user97/go/src/github.com/validation/contracts/ECVerify.sol", + "exportedSymbols": { + "ECVerify": [ + 83 + ] + }, + "id": 84, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + "^", + "0.4", + ".18" + ], + "nodeType": "PragmaDirective", + "src": "0:24:0" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "library", + "documentation": null, + "fullyImplemented": true, + "id": 83, + "linearizedBaseContracts": [ + 83 + ], + "name": "ECVerify", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 29, + "nodeType": "Block", + "src": "1200:899:0", + "statements": [ + { + "assignments": [], + "declarations": [ + { + "constant": false, + "id": 15, + "name": "ret", + "nodeType": "VariableDeclaration", + "scope": 30, + "src": "1595:8:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 14, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1595:4:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 16, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "1595:8:0" + }, + { + "assignments": [], + "declarations": [ + { + "constant": false, + "id": 18, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 30, + "src": "1613:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 17, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1613:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 19, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "1613:12:0" + }, + { + "externalReferences": [ + { + "v": { + "declaration": 5, + "isOffset": false, + "isSlot": false, + "src": "1748:1:0", + "valueSize": 1 + } + }, + { + "hash": { + "declaration": 3, + "isOffset": false, + "isSlot": false, + "src": "1708:4:0", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 7, + "isOffset": false, + "isSlot": false, + "src": "1785:1:0", + "valueSize": 1 + } + }, + { + "s": { + "declaration": 9, + "isOffset": false, + "isSlot": false, + "src": "1822:1:0", + "valueSize": 1 + } + }, + { + "ret": { + "declaration": 15, + "isOffset": false, + "isSlot": false, + "src": "1949:3:0", + "valueSize": 1 + } + }, + { + "addr": { + "declaration": 18, + "isOffset": false, + "isSlot": false, + "src": "2009:4:0", + "valueSize": 1 + } + } + ], + "id": 20, + "nodeType": "InlineAssembly", + "operations": "{\n let size := mload(0x40)\n mstore(size, hash)\n mstore(add(size, 32), v)\n mstore(add(size, 64), r)\n mstore(add(size, 96), s)\n ret := staticcall(3000, 1, size, 128, size, 32)\n addr := mload(size)\n}", + "src": "1636:419:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 24, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 22, + "name": "ret", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 15, + "src": "2057:3:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "74727565", + "id": 23, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2064:4:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "src": "2057:11:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 21, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 418, + 419 + ], + "referencedDeclaration": 418, + "src": "2048:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 25, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2048:22:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 26, + "nodeType": "ExpressionStatement", + "src": "2048:22:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 27, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 18, + "src": "2088:4:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 13, + "id": 28, + "nodeType": "Return", + "src": "2081:11:0" + } + ] + }, + "documentation": null, + "id": 30, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "safer_ecrecover", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 10, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3, + "name": "hash", + "nodeType": "VariableDeclaration", + "scope": 30, + "src": "1119:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1119:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 5, + "name": "v", + "nodeType": "VariableDeclaration", + "scope": 30, + "src": "1133:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 4, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "1133:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 7, + "name": "r", + "nodeType": "VariableDeclaration", + "scope": 30, + "src": "1142:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 6, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1142:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 9, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 30, + "src": "1153:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1153:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1118:45:0" + }, + "payable": false, + "returnParameters": { + "id": 13, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 12, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 30, + "src": "1191:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 11, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1191:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1190:9:0" + }, + "scope": 83, + "src": "1094:1005:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "internal" + }, + { + "body": { + "id": 81, + "nodeType": "Block", + "src": "2186:1581:0", + "statements": [ + { + "assignments": [], + "declarations": [ + { + "constant": false, + "id": 40, + "name": "r", + "nodeType": "VariableDeclaration", + "scope": 82, + "src": "2196:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 39, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2196:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 41, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "2196:9:0" + }, + { + "assignments": [], + "declarations": [ + { + "constant": false, + "id": 43, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 82, + "src": "2215:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 42, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2215:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 44, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "2215:9:0" + }, + { + "assignments": [], + "declarations": [ + { + "constant": false, + "id": 46, + "name": "v", + "nodeType": "VariableDeclaration", + "scope": 82, + "src": "2234:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 45, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "2234:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 47, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "2234:7:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 52, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 49, + "name": "sig", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 34, + "src": "2261:3:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 50, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2261:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "3635", + "id": 51, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2275:2:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_65_by_1", + "typeString": "int_const 65" + }, + "value": "65" + }, + "src": "2261:16:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 48, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 418, + 419 + ], + "referencedDeclaration": 418, + "src": "2252:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 53, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2252:26:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 54, + "nodeType": "ExpressionStatement", + "src": "2252:26:0" + }, + { + "externalReferences": [ + { + "sig": { + "declaration": 34, + "isOffset": false, + "isSlot": false, + "src": "2485:3:0", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 40, + "isOffset": false, + "isSlot": false, + "src": "2470:1:0", + "valueSize": 1 + } + }, + { + "sig": { + "declaration": 34, + "isOffset": false, + "isSlot": false, + "src": "2522:3:0", + "valueSize": 1 + } + }, + { + "s": { + "declaration": 43, + "isOffset": false, + "isSlot": false, + "src": "2507:1:0", + "valueSize": 1 + } + }, + { + "sig": { + "declaration": 34, + "isOffset": false, + "isSlot": false, + "src": "2780:3:0", + "valueSize": 1 + } + }, + { + "v": { + "declaration": 46, + "isOffset": false, + "isSlot": false, + "src": "2757:1:0", + "valueSize": 1 + } + } + ], + "id": 55, + "nodeType": "InlineAssembly", + "operations": "{\n r := mload(add(sig, 32))\n s := mload(add(sig, 64))\n v := byte(0, mload(add(sig, 96)))\n}", + "src": "2447:875:0" + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 58, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 56, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 46, + "src": "3324:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "hexValue": "3237", + "id": 57, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3328:2:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_27_by_1", + "typeString": "int_const 27" + }, + "value": "27" + }, + "src": "3324:6:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 63, + "nodeType": "IfStatement", + "src": "3320:29:0", + "trueBody": { + "expression": { + "argumentTypes": null, + "id": 61, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 59, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 46, + "src": "3342:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "3237", + "id": 60, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3347:2:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_27_by_1", + "typeString": "int_const 27" + }, + "value": "27" + }, + "src": "3342:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "id": 62, + "nodeType": "ExpressionStatement", + "src": "3342:7:0" + } + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 71, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 67, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 65, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 46, + "src": "3369:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "3237", + "id": 66, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3374:2:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_27_by_1", + "typeString": "int_const 27" + }, + "value": "27" + }, + "src": "3369:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 70, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 68, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 46, + "src": "3380:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "3238", + "id": 69, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3385:2:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_28_by_1", + "typeString": "int_const 28" + }, + "value": "28" + }, + "src": "3380:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "3369:18:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 64, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 418, + 419 + ], + "referencedDeclaration": 418, + "src": "3360:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 72, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3360:28:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 73, + "nodeType": "ExpressionStatement", + "src": "3360:28:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 75, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "3699:4:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "argumentTypes": null, + "id": 76, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 46, + "src": "3705:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "argumentTypes": null, + "id": 77, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 40, + "src": "3708:1:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "argumentTypes": null, + "id": 78, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 43, + "src": "3711:1:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 74, + "name": "safer_ecrecover", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "3683:15:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32,uint8,bytes32,bytes32) view returns (address)" + } + }, + "id": 79, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3683:30:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 38, + "id": 80, + "nodeType": "Return", + "src": "3676:37:0" + } + ] + }, + "documentation": null, + "id": 82, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "ecrecovery", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 35, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 32, + "name": "hash", + "nodeType": "VariableDeclaration", + "scope": 82, + "src": "2125:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 31, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2125:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 34, + "name": "sig", + "nodeType": "VariableDeclaration", + "scope": 82, + "src": "2139:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 33, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2139:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2124:25:0" + }, + "payable": false, + "returnParameters": { + "id": 38, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 37, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 82, + "src": "2177:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 36, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2177:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2176:9:0" + }, + "scope": 83, + "src": "2105:1662:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "internal" + } + ], + "scope": 84, + "src": "997:2772:0" + } + ], + "src": "0:3770:0" + }, + "legacyAST": { + "absolutePath": "/home/user97/go/src/github.com/validation/contracts/ECVerify.sol", + "exportedSymbols": { + "ECVerify": [ + 83 + ] + }, + "id": 84, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 1, + "literals": [ + "solidity", + "^", + "0.4", + ".18" + ], + "nodeType": "PragmaDirective", + "src": "0:24:0" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "library", + "documentation": null, + "fullyImplemented": true, + "id": 83, + "linearizedBaseContracts": [ + 83 + ], + "name": "ECVerify", + "nodeType": "ContractDefinition", + "nodes": [ + { + "body": { + "id": 29, + "nodeType": "Block", + "src": "1200:899:0", + "statements": [ + { + "assignments": [], + "declarations": [ + { + "constant": false, + "id": 15, + "name": "ret", + "nodeType": "VariableDeclaration", + "scope": 30, + "src": "1595:8:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "typeName": { + "id": 14, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "1595:4:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 16, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "1595:8:0" + }, + { + "assignments": [], + "declarations": [ + { + "constant": false, + "id": 18, + "name": "addr", + "nodeType": "VariableDeclaration", + "scope": 30, + "src": "1613:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 17, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1613:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 19, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "1613:12:0" + }, + { + "externalReferences": [ + { + "v": { + "declaration": 5, + "isOffset": false, + "isSlot": false, + "src": "1748:1:0", + "valueSize": 1 + } + }, + { + "hash": { + "declaration": 3, + "isOffset": false, + "isSlot": false, + "src": "1708:4:0", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 7, + "isOffset": false, + "isSlot": false, + "src": "1785:1:0", + "valueSize": 1 + } + }, + { + "s": { + "declaration": 9, + "isOffset": false, + "isSlot": false, + "src": "1822:1:0", + "valueSize": 1 + } + }, + { + "ret": { + "declaration": 15, + "isOffset": false, + "isSlot": false, + "src": "1949:3:0", + "valueSize": 1 + } + }, + { + "addr": { + "declaration": 18, + "isOffset": false, + "isSlot": false, + "src": "2009:4:0", + "valueSize": 1 + } + } + ], + "id": 20, + "nodeType": "InlineAssembly", + "operations": "{\n let size := mload(0x40)\n mstore(size, hash)\n mstore(add(size, 32), v)\n mstore(add(size, 64), r)\n mstore(add(size, 96), s)\n ret := staticcall(3000, 1, size, 128, size, 32)\n addr := mload(size)\n}", + "src": "1636:419:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 24, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 22, + "name": "ret", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 15, + "src": "2057:3:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "74727565", + "id": 23, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2064:4:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "src": "2057:11:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 21, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 418, + 419 + ], + "referencedDeclaration": 418, + "src": "2048:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 25, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2048:22:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 26, + "nodeType": "ExpressionStatement", + "src": "2048:22:0" + }, + { + "expression": { + "argumentTypes": null, + "id": 27, + "name": "addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 18, + "src": "2088:4:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 13, + "id": 28, + "nodeType": "Return", + "src": "2081:11:0" + } + ] + }, + "documentation": null, + "id": 30, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "safer_ecrecover", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 10, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 3, + "name": "hash", + "nodeType": "VariableDeclaration", + "scope": 30, + "src": "1119:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 2, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1119:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 5, + "name": "v", + "nodeType": "VariableDeclaration", + "scope": 30, + "src": "1133:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 4, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "1133:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 7, + "name": "r", + "nodeType": "VariableDeclaration", + "scope": 30, + "src": "1142:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 6, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1142:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 9, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 30, + "src": "1153:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 8, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1153:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1118:45:0" + }, + "payable": false, + "returnParameters": { + "id": 13, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 12, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 30, + "src": "1191:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 11, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "1191:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1190:9:0" + }, + "scope": 83, + "src": "1094:1005:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "internal" + }, + { + "body": { + "id": 81, + "nodeType": "Block", + "src": "2186:1581:0", + "statements": [ + { + "assignments": [], + "declarations": [ + { + "constant": false, + "id": 40, + "name": "r", + "nodeType": "VariableDeclaration", + "scope": 82, + "src": "2196:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 39, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2196:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 41, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "2196:9:0" + }, + { + "assignments": [], + "declarations": [ + { + "constant": false, + "id": 43, + "name": "s", + "nodeType": "VariableDeclaration", + "scope": 82, + "src": "2215:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 42, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2215:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 44, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "2215:9:0" + }, + { + "assignments": [], + "declarations": [ + { + "constant": false, + "id": 46, + "name": "v", + "nodeType": "VariableDeclaration", + "scope": 82, + "src": "2234:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "typeName": { + "id": 45, + "name": "uint8", + "nodeType": "ElementaryTypeName", + "src": "2234:5:0", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 47, + "initialValue": null, + "nodeType": "VariableDeclarationStatement", + "src": "2234:7:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 52, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 49, + "name": "sig", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 34, + "src": "2261:3:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 50, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2261:10:0", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "3635", + "id": 51, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2275:2:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_65_by_1", + "typeString": "int_const 65" + }, + "value": "65" + }, + "src": "2261:16:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 48, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 418, + 419 + ], + "referencedDeclaration": 418, + "src": "2252:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 53, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2252:26:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 54, + "nodeType": "ExpressionStatement", + "src": "2252:26:0" + }, + { + "externalReferences": [ + { + "sig": { + "declaration": 34, + "isOffset": false, + "isSlot": false, + "src": "2485:3:0", + "valueSize": 1 + } + }, + { + "r": { + "declaration": 40, + "isOffset": false, + "isSlot": false, + "src": "2470:1:0", + "valueSize": 1 + } + }, + { + "sig": { + "declaration": 34, + "isOffset": false, + "isSlot": false, + "src": "2522:3:0", + "valueSize": 1 + } + }, + { + "s": { + "declaration": 43, + "isOffset": false, + "isSlot": false, + "src": "2507:1:0", + "valueSize": 1 + } + }, + { + "sig": { + "declaration": 34, + "isOffset": false, + "isSlot": false, + "src": "2780:3:0", + "valueSize": 1 + } + }, + { + "v": { + "declaration": 46, + "isOffset": false, + "isSlot": false, + "src": "2757:1:0", + "valueSize": 1 + } + } + ], + "id": 55, + "nodeType": "InlineAssembly", + "operations": "{\n r := mload(add(sig, 32))\n s := mload(add(sig, 64))\n v := byte(0, mload(add(sig, 96)))\n}", + "src": "2447:875:0" + }, + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 58, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 56, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 46, + "src": "3324:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "hexValue": "3237", + "id": 57, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3328:2:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_27_by_1", + "typeString": "int_const 27" + }, + "value": "27" + }, + "src": "3324:6:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 63, + "nodeType": "IfStatement", + "src": "3320:29:0", + "trueBody": { + "expression": { + "argumentTypes": null, + "id": 61, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 59, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 46, + "src": "3342:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "Assignment", + "operator": "+=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "3237", + "id": 60, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3347:2:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_27_by_1", + "typeString": "int_const 27" + }, + "value": "27" + }, + "src": "3342:7:0", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "id": 62, + "nodeType": "ExpressionStatement", + "src": "3342:7:0" + } + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 71, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 67, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 65, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 46, + "src": "3369:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "3237", + "id": 66, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3374:2:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_27_by_1", + "typeString": "int_const 27" + }, + "value": "27" + }, + "src": "3369:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "||", + "rightExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + "id": 70, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 68, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 46, + "src": "3380:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "3238", + "id": 69, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3385:2:0", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_28_by_1", + "typeString": "int_const 28" + }, + "value": "28" + }, + "src": "3380:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "src": "3369:18:0", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + ], + "id": 64, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 418, + 419 + ], + "referencedDeclaration": 418, + "src": "3360:7:0", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$returns$__$", + "typeString": "function (bool) pure" + } + }, + "id": 72, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3360:28:0", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 73, + "nodeType": "ExpressionStatement", + "src": "3360:28:0" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 75, + "name": "hash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 32, + "src": "3699:4:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "argumentTypes": null, + "id": 76, + "name": "v", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 46, + "src": "3705:1:0", + "typeDescriptions": { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + } + }, + { + "argumentTypes": null, + "id": 77, + "name": "r", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 40, + "src": "3708:1:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "argumentTypes": null, + "id": 78, + "name": "s", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 43, + "src": "3711:1:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_uint8", + "typeString": "uint8" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 74, + "name": "safer_ecrecover", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 30, + "src": "3683:15:0", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$_t_uint8_$_t_bytes32_$_t_bytes32_$returns$_t_address_$", + "typeString": "function (bytes32,uint8,bytes32,bytes32) view returns (address)" + } + }, + "id": 79, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3683:30:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "functionReturnParameters": 38, + "id": 80, + "nodeType": "Return", + "src": "3676:37:0" + } + ] + }, + "documentation": null, + "id": 82, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "ecrecovery", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 35, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 32, + "name": "hash", + "nodeType": "VariableDeclaration", + "scope": 82, + "src": "2125:12:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 31, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2125:7:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 34, + "name": "sig", + "nodeType": "VariableDeclaration", + "scope": 82, + "src": "2139:9:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 33, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2139:5:0", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2124:25:0" + }, + "payable": false, + "returnParameters": { + "id": 38, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 37, + "name": "", + "nodeType": "VariableDeclaration", + "scope": 82, + "src": "2177:7:0", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 36, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2177:7:0", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2176:9:0" + }, + "scope": 83, + "src": "2105:1662:0", + "stateMutability": "view", + "superFunction": null, + "visibility": "internal" + } + ], + "scope": 84, + "src": "997:2772:0" + } + ], + "src": "0:3770:0" + }, + "compiler": { + "name": "solc", + "version": "0.4.23+commit.124ca40d.Emscripten.clang" + }, + "networks": {}, + "schemaVersion": "2.0.0", + "updatedAt": "2018-06-23T09:57:05.917Z" +} \ No newline at end of file diff --git a/build/contracts/Migrations.json b/build/contracts/Migrations.json new file mode 100644 index 0000000..bfbfdcc --- /dev/null +++ b/build/contracts/Migrations.json @@ -0,0 +1,1387 @@ +{ + "contractName": "Migrations", + "abi": [ + { + "constant": true, + "inputs": [], + "name": "last_completed_migration", + "outputs": [ + { + "name": "", + "type": "uint256" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "constant": true, + "inputs": [], + "name": "owner", + "outputs": [ + { + "name": "", + "type": "address" + } + ], + "payable": false, + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "constant": false, + "inputs": [ + { + "name": "completed", + "type": "uint256" + } + ], + "name": "setCompleted", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "new_address", + "type": "address" + } + ], + "name": "upgrade", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + } + ], + "bytecode": "0x608060405234801561001057600080fd5b5060008054600160a060020a033316600160a060020a03199091161790556102448061003d6000396000f3006080604052600436106100615763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630900f0108114610066578063445df0ac146100965780638da5cb5b146100bd578063fdacd576146100fb575b600080fd5b34801561007257600080fd5b5061009473ffffffffffffffffffffffffffffffffffffffff60043516610113565b005b3480156100a257600080fd5b506100ab6101c9565b60408051918252519081900360200190f35b3480156100c957600080fd5b506100d26101cf565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561010757600080fd5b506100946004356101eb565b600080543373ffffffffffffffffffffffffffffffffffffffff908116911614156101c5578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b1580156101ac57600080fd5b505af11580156101c0573d6000803e3d6000fd5b505050505b5050565b60015481565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6000543373ffffffffffffffffffffffffffffffffffffffff908116911614156102155760018190555b505600a165627a7a723058209571e5610a57a30a26bdc206db3a5ad080d03e877b8b126f385c002fb707189a0029", + "deployedBytecode": "0x6080604052600436106100615763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630900f0108114610066578063445df0ac146100965780638da5cb5b146100bd578063fdacd576146100fb575b600080fd5b34801561007257600080fd5b5061009473ffffffffffffffffffffffffffffffffffffffff60043516610113565b005b3480156100a257600080fd5b506100ab6101c9565b60408051918252519081900360200190f35b3480156100c957600080fd5b506100d26101cf565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b34801561010757600080fd5b506100946004356101eb565b600080543373ffffffffffffffffffffffffffffffffffffffff908116911614156101c5578190508073ffffffffffffffffffffffffffffffffffffffff1663fdacd5766001546040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050600060405180830381600087803b1580156101ac57600080fd5b505af11580156101c0573d6000803e3d6000fd5b505050505b5050565b60015481565b60005473ffffffffffffffffffffffffffffffffffffffff1681565b6000543373ffffffffffffffffffffffffffffffffffffffff908116911614156102155760018190555b505600a165627a7a723058209571e5610a57a30a26bdc206db3a5ad080d03e877b8b126f385c002fb707189a0029", + "sourceMap": "121:486:1:-;;;276:50;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;303:5:1;:18;;-1:-1:-1;;;;;311:10:1;303:18;-1:-1:-1;;;;;;303:18:1;;;;;;121:486;;;;;;", + "deployedSourceMap": "121:486:1:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;440:165;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;440:165:1;;;;;;;;;169:39;;8:9:-1;5:2;;;30:1;27;20:12;5:2;169:39:1;;;;;;;;;;;;;;;;;;;;145:20;;8:9:-1;5:2;;;30:1;27;20:12;5:2;145:20:1;;;;;;;;;;;;;;;;;;;;;;;330:106;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;330:106:1;;;;;440:165;502:19;259:5;;245:10;259:5;245:19;;;259:5;;245:19;241:26;;;535:11;502:45;;553:8;:21;;;575:24;;553:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;553:47:1;;;;8:9:-1;5:2;;;45:16;42:1;39;24:38;77:16;74:1;67:27;5:2;553:47:1;;;;241:26;440:165;;:::o;169:39::-;;;;:::o;145:20::-;;;;;;:::o;330:106::-;259:5;;245:10;259:5;245:19;;;259:5;;245:19;241:26;;;395:24;:36;;;241:26;330:106;:::o", + "source": "// Copyright (c) 2016-2017 Clearmatics Technologies Ltd\n// SPDX-License-Identifier: LGPL-3.0+\n\npragma solidity ^0.4.18;\n\ncontract Migrations {\n address public owner;\n uint256 public last_completed_migration;\n\n modifier restricted() {\n if (msg.sender == owner) _;\n }\n\n constructor() public {\n owner = msg.sender;\n }\n\n function setCompleted(uint256 completed) public restricted {\n last_completed_migration = completed;\n }\n\n function upgrade(address new_address) public restricted {\n Migrations upgraded = Migrations(new_address);\n upgraded.setCompleted(last_completed_migration);\n }\n}\n", + "sourcePath": "/home/user97/go/src/github.com/validation/contracts/Migrations.sol", + "ast": { + "absolutePath": "/home/user97/go/src/github.com/validation/contracts/Migrations.sol", + "exportedSymbols": { + "Migrations": [ + 140 + ] + }, + "id": 141, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 85, + "literals": [ + "solidity", + "^", + "0.4", + ".18" + ], + "nodeType": "PragmaDirective", + "src": "95:24:1" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 140, + "linearizedBaseContracts": [ + 140 + ], + "name": "Migrations", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 87, + "name": "owner", + "nodeType": "VariableDeclaration", + "scope": 140, + "src": "145:20:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 86, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "145:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 89, + "name": "last_completed_migration", + "nodeType": "VariableDeclaration", + "scope": 140, + "src": "169:39:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 88, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "169:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "body": { + "id": 97, + "nodeType": "Block", + "src": "235:37:1", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 94, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 91, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 802, + "src": "245:3:1", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 92, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "245:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 93, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 87, + "src": "259:5:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "245:19:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 96, + "nodeType": "IfStatement", + "src": "241:26:1", + "trueBody": { + "id": 95, + "nodeType": "PlaceholderStatement", + "src": "266:1:1" + } + } + ] + }, + "documentation": null, + "id": 98, + "name": "restricted", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 90, + "nodeType": "ParameterList", + "parameters": [], + "src": "232:2:1" + }, + "src": "213:59:1", + "visibility": "internal" + }, + { + "body": { + "id": 106, + "nodeType": "Block", + "src": "297:29:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 104, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 101, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 87, + "src": "303:5:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 102, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 802, + "src": "311:3:1", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 103, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "311:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "303:18:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 105, + "nodeType": "ExpressionStatement", + "src": "303:18:1" + } + ] + }, + "documentation": null, + "id": 107, + "implemented": true, + "isConstructor": true, + "isDeclaredConst": false, + "modifiers": [], + "name": "", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 99, + "nodeType": "ParameterList", + "parameters": [], + "src": "287:2:1" + }, + "payable": false, + "returnParameters": { + "id": 100, + "nodeType": "ParameterList", + "parameters": [], + "src": "297:0:1" + }, + "scope": 140, + "src": "276:50:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 118, + "nodeType": "Block", + "src": "389:47:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 116, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 114, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 89, + "src": "395:24:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 115, + "name": "completed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 109, + "src": "422:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "395:36:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 117, + "nodeType": "ExpressionStatement", + "src": "395:36:1" + } + ] + }, + "documentation": null, + "id": 119, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": null, + "id": 112, + "modifierName": { + "argumentTypes": null, + "id": 111, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 98, + "src": "378:10:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "378:10:1" + } + ], + "name": "setCompleted", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 110, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 109, + "name": "completed", + "nodeType": "VariableDeclaration", + "scope": 119, + "src": "352:17:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 108, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "352:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "351:19:1" + }, + "payable": false, + "returnParameters": { + "id": 113, + "nodeType": "ParameterList", + "parameters": [], + "src": "389:0:1" + }, + "scope": 140, + "src": "330:106:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 138, + "nodeType": "Block", + "src": "496:109:1", + "statements": [ + { + "assignments": [ + 127 + ], + "declarations": [ + { + "constant": false, + "id": 127, + "name": "upgraded", + "nodeType": "VariableDeclaration", + "scope": 139, + "src": "502:19:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$140", + "typeString": "contract Migrations" + }, + "typeName": { + "contractScope": null, + "id": 126, + "name": "Migrations", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 140, + "src": "502:10:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$140", + "typeString": "contract Migrations" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 131, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 129, + "name": "new_address", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 121, + "src": "535:11:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 128, + "name": "Migrations", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 140, + "src": "524:10:1", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Migrations_$140_$", + "typeString": "type(contract Migrations)" + } + }, + "id": 130, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "524:23:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$140", + "typeString": "contract Migrations" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "502:45:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 135, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 89, + "src": "575:24:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 132, + "name": "upgraded", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 127, + "src": "553:8:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$140", + "typeString": "contract Migrations" + } + }, + "id": 134, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "setCompleted", + "nodeType": "MemberAccess", + "referencedDeclaration": 119, + "src": "553:21:1", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256) external" + } + }, + "id": 136, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "553:47:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 137, + "nodeType": "ExpressionStatement", + "src": "553:47:1" + } + ] + }, + "documentation": null, + "id": 139, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": null, + "id": 124, + "modifierName": { + "argumentTypes": null, + "id": 123, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 98, + "src": "485:10:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "485:10:1" + } + ], + "name": "upgrade", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 122, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 121, + "name": "new_address", + "nodeType": "VariableDeclaration", + "scope": 139, + "src": "457:19:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 120, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "457:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "456:21:1" + }, + "payable": false, + "returnParameters": { + "id": 125, + "nodeType": "ParameterList", + "parameters": [], + "src": "496:0:1" + }, + "scope": 140, + "src": "440:165:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 141, + "src": "121:486:1" + } + ], + "src": "95:513:1" + }, + "legacyAST": { + "absolutePath": "/home/user97/go/src/github.com/validation/contracts/Migrations.sol", + "exportedSymbols": { + "Migrations": [ + 140 + ] + }, + "id": 141, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 85, + "literals": [ + "solidity", + "^", + "0.4", + ".18" + ], + "nodeType": "PragmaDirective", + "src": "95:24:1" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 140, + "linearizedBaseContracts": [ + 140 + ], + "name": "Migrations", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 87, + "name": "owner", + "nodeType": "VariableDeclaration", + "scope": 140, + "src": "145:20:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 86, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "145:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 89, + "name": "last_completed_migration", + "nodeType": "VariableDeclaration", + "scope": 140, + "src": "169:39:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 88, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "169:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "public" + }, + { + "body": { + "id": 97, + "nodeType": "Block", + "src": "235:37:1", + "statements": [ + { + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "id": 94, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 91, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 802, + "src": "245:3:1", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 92, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "245:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "id": 93, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 87, + "src": "259:5:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "245:19:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "falseBody": null, + "id": 96, + "nodeType": "IfStatement", + "src": "241:26:1", + "trueBody": { + "id": 95, + "nodeType": "PlaceholderStatement", + "src": "266:1:1" + } + } + ] + }, + "documentation": null, + "id": 98, + "name": "restricted", + "nodeType": "ModifierDefinition", + "parameters": { + "id": 90, + "nodeType": "ParameterList", + "parameters": [], + "src": "232:2:1" + }, + "src": "213:59:1", + "visibility": "internal" + }, + { + "body": { + "id": 106, + "nodeType": "Block", + "src": "297:29:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 104, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 101, + "name": "owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 87, + "src": "303:5:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 102, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 802, + "src": "311:3:1", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 103, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "311:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "303:18:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 105, + "nodeType": "ExpressionStatement", + "src": "303:18:1" + } + ] + }, + "documentation": null, + "id": 107, + "implemented": true, + "isConstructor": true, + "isDeclaredConst": false, + "modifiers": [], + "name": "", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 99, + "nodeType": "ParameterList", + "parameters": [], + "src": "287:2:1" + }, + "payable": false, + "returnParameters": { + "id": 100, + "nodeType": "ParameterList", + "parameters": [], + "src": "297:0:1" + }, + "scope": 140, + "src": "276:50:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 118, + "nodeType": "Block", + "src": "389:47:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 116, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 114, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 89, + "src": "395:24:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 115, + "name": "completed", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 109, + "src": "422:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "395:36:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 117, + "nodeType": "ExpressionStatement", + "src": "395:36:1" + } + ] + }, + "documentation": null, + "id": 119, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": null, + "id": 112, + "modifierName": { + "argumentTypes": null, + "id": 111, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 98, + "src": "378:10:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "378:10:1" + } + ], + "name": "setCompleted", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 110, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 109, + "name": "completed", + "nodeType": "VariableDeclaration", + "scope": 119, + "src": "352:17:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 108, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "352:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "351:19:1" + }, + "payable": false, + "returnParameters": { + "id": 113, + "nodeType": "ParameterList", + "parameters": [], + "src": "389:0:1" + }, + "scope": 140, + "src": "330:106:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 138, + "nodeType": "Block", + "src": "496:109:1", + "statements": [ + { + "assignments": [ + 127 + ], + "declarations": [ + { + "constant": false, + "id": 127, + "name": "upgraded", + "nodeType": "VariableDeclaration", + "scope": 139, + "src": "502:19:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$140", + "typeString": "contract Migrations" + }, + "typeName": { + "contractScope": null, + "id": 126, + "name": "Migrations", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 140, + "src": "502:10:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$140", + "typeString": "contract Migrations" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 131, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 129, + "name": "new_address", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 121, + "src": "535:11:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 128, + "name": "Migrations", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 140, + "src": "524:10:1", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_Migrations_$140_$", + "typeString": "type(contract Migrations)" + } + }, + "id": 130, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "typeConversion", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "524:23:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$140", + "typeString": "contract Migrations" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "502:45:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 135, + "name": "last_completed_migration", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 89, + "src": "575:24:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "expression": { + "argumentTypes": null, + "id": 132, + "name": "upgraded", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 127, + "src": "553:8:1", + "typeDescriptions": { + "typeIdentifier": "t_contract$_Migrations_$140", + "typeString": "contract Migrations" + } + }, + "id": 134, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "setCompleted", + "nodeType": "MemberAccess", + "referencedDeclaration": 119, + "src": "553:21:1", + "typeDescriptions": { + "typeIdentifier": "t_function_external_nonpayable$_t_uint256_$returns$__$", + "typeString": "function (uint256) external" + } + }, + "id": 136, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "553:47:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 137, + "nodeType": "ExpressionStatement", + "src": "553:47:1" + } + ] + }, + "documentation": null, + "id": 139, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [ + { + "arguments": null, + "id": 124, + "modifierName": { + "argumentTypes": null, + "id": 123, + "name": "restricted", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 98, + "src": "485:10:1", + "typeDescriptions": { + "typeIdentifier": "t_modifier$__$", + "typeString": "modifier ()" + } + }, + "nodeType": "ModifierInvocation", + "src": "485:10:1" + } + ], + "name": "upgrade", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 122, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 121, + "name": "new_address", + "nodeType": "VariableDeclaration", + "scope": 139, + "src": "457:19:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 120, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "457:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "456:21:1" + }, + "payable": false, + "returnParameters": { + "id": 125, + "nodeType": "ParameterList", + "parameters": [], + "src": "496:0:1" + }, + "scope": 140, + "src": "440:165:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + } + ], + "scope": 141, + "src": "121:486:1" + } + ], + "src": "95:513:1" + }, + "compiler": { + "name": "solc", + "version": "0.4.23+commit.124ca40d.Emscripten.clang" + }, + "networks": { + "1515": { + "events": {}, + "links": {}, + "address": "0xca9e89555adab2252bc02bdfad11e8d391e4cb9f", + "transactionHash": "0xcb11207ddde485a0826fa41a65a0b772f000c6e88428ae68c31a563c86dc6f83" + } + }, + "schemaVersion": "2.0.0", + "updatedAt": "2018-06-22T20:23:18.405Z" +} \ No newline at end of file diff --git a/build/contracts/Recover.json b/build/contracts/Recover.json index 292d9c8..6cf1a30 100644 --- a/build/contracts/Recover.json +++ b/build/contracts/Recover.json @@ -16,13 +16,68 @@ "type": "address" } ], - "name": "testEvent", + "name": "broadcastSig", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "header", + "type": "bytes" + }, + { + "indexed": false, + "name": "parentHash", + "type": "bytes" + }, + { + "indexed": false, + "name": "rootHash", + "type": "bytes" + } + ], + "name": "broadcastHashData", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "blockHash", + "type": "bytes32" + } + ], + "name": "broadcastHash", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "name": "header", + "type": "bytes" + } + ], + "name": "test", "type": "event" }, { "constant": false, - "inputs": [], - "name": "GetOwner", + "inputs": [ + { + "name": "data", + "type": "bytes32" + }, + { + "name": "sig", + "type": "bytes" + } + ], + "name": "VerifyHash", "outputs": [], "payable": false, "stateMutability": "nonpayable", @@ -30,40 +85,82 @@ }, { "constant": false, - "inputs": [], - "name": "Destroy", + "inputs": [ + { + "name": "header", + "type": "bytes" + }, + { + "name": "sig", + "type": "bytes" + } + ], + "name": "VerifyBlock", + "outputs": [], + "payable": false, + "stateMutability": "nonpayable", + "type": "function" + }, + { + "constant": false, + "inputs": [ + { + "name": "header", + "type": "bytes" + }, + { + "name": "prefixHeader", + "type": "bytes" + }, + { + "name": "prefixExtraData", + "type": "bytes" + } + ], + "name": "ExtractHash", "outputs": [], "payable": false, "stateMutability": "nonpayable", "type": "function" } ], - "bytecode": "0x608060405234801561001057600080fd5b5060008054600160a060020a033316600160a060020a03199091161790556101378061003d6000396000f30060806040526004361061004b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630ae50a398114610050578063f58fef8e14610067575b600080fd5b34801561005c57600080fd5b5061006561007c565b005b34801561007357600080fd5b506100656100ca565b6000546040805173ffffffffffffffffffffffffffffffffffffffff9092168252517f2f5b0995274d6e666f9673d35e391cc76e98498ebd9200c9d53ec6251a2551379181900360200190a1565b6000543373ffffffffffffffffffffffffffffffffffffffff9081169116146100f257600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16ff00a165627a7a72305820446df6f24d9bdc351583e21290ccc481179cc62c8a6dc075600d532c50f7df950029", - "deployedBytecode": "0x60806040526004361061004b5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630ae50a398114610050578063f58fef8e14610067575b600080fd5b34801561005c57600080fd5b5061006561007c565b005b34801561007357600080fd5b506100656100ca565b6000546040805173ffffffffffffffffffffffffffffffffffffffff9092168252517f2f5b0995274d6e666f9673d35e391cc76e98498ebd9200c9d53ec6251a2551379181900360200190a1565b6000543373ffffffffffffffffffffffffffffffffffffffff9081169116146100f257600080fd5b3373ffffffffffffffffffffffffffffffffffffffff16ff00a165627a7a72305820446df6f24d9bdc351583e21290ccc481179cc62c8a6dc075600d532c50f7df950029", - "sourceMap": "120:282:0:-;;;191:48;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;217:5:0;:18;;-1:-1:-1;;;;;225:10:0;217:18;-1:-1:-1;;;;;;217:18:0;;;;;;120:282;;;;;;", - "deployedSourceMap": "120:282:0:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;243:59;;8:9:-1;5:2;;;30:1;27;20:12;5:2;243:59:0;;;;;;305:95;;8:9:-1;5:2;;;30:1;27;20:12;5:2;305:95:0;;;;243:59;291:5;;281:16;;;291:5;;;;281:16;;;;;;;;;;;;243:59::o;305:95::-;358:5;;344:10;358:5;344:19;;;358:5;;344:19;335:30;;;;;;384:10;370:26;;", - "source": "// Copyright (c) 2016-2018 Clearmatics Technologies Ltd\n// SPDX-License-Identifier: LGPL-3.0+\npragma solidity ^0.4.18;\n\ncontract Recover {\n\taddress Owner;\n\n\tevent testEvent(address owner);\n\n\tconstructor () public {\n\t\tOwner = msg.sender;\n\t}\n\n function GetOwner() public {\n emit testEvent(Owner);\n }\n\n\tfunction Destroy() public {\n\t\trequire( msg.sender == Owner );\n\n\t\tselfdestruct( msg.sender );\n\t}\n}\n", - "sourcePath": "/home/user97/repos/networks/poa_network/contracts/recover.sol", + "bytecode": "0x608060405234801561001057600080fd5b5060008054600160a060020a033316600160a060020a031990911617905561099b8061003d6000396000f3006080604052600436106100565763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663b0e7308f811461005b578063d09ca90414610132578063fdace1be146101c9575b600080fd5b34801561006757600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261013094369492936024939284019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a9998810197919650918201945092508291508401838280828437509497506102279650505050505050565b005b34801561013e57600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261013094369492936024939284019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a9998810197919650918201945092508291508401838280828437509497506104929650505050505050565b3480156101d557600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526101309583359536956044949193909101919081908401838280828437509497506107179650505050505050565b60008060608060608060606000808b5198508b6040518082805190602001908083835b602083106102695780518252601f19909201916020918201910161024a565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208083529351939d507fcd7ee33e1a630d6301d87631aab1d4ddce7e1942593cd2689aa989f76d67cf0195509083900301925050a1608d89036040519080825280601f01601f1916602001820160405280156102f5578160200160208202803883390190505b5060408051601f808252818301909252919850602082016103e08038833950506040805160418082526080820190925292985090506020820161082080388339505060408051602a808252606082019092529297509050602082016105408038833901905050935061036b878d60008a51610775565b600260218801600260208e016004610bb8fa5061038e868d608c8c038951610775565b600160208701600160208d016004610bb8fa506103b1848d602a8c038751610775565b6103bc878786610828565b9250826040518082805190602001908083835b602083106103ee5780518252601f1990920191602091820191016103cf565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020915061042d858d606b8c038851610775565b61043782866108bf565b6040805173ffffffffffffffffffffffffffffffffffffffff8316815290519192507fba2fe28067a0918af64c5359b1579f887bf1479dd3163c7e5d456314168854a5919081900360200190a1505050505050505050505050565b600080606080856040518082805190602001908083835b602083106104c85780518252601f1990920191602091820191016104a9565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020935061050184866108bf565b604080516020808252818301909252919450808201610400803883395050604080516020808252818301909252929450905080820161040080388339019050509050610551828760046020610775565b61055f8187605b6020610775565b7f8511795469a13c04a2bc22c3f1309fc0bd918a0a25a3e7e222a0417b719274c786838360405180806020018060200180602001848103845287818151815260200191508051906020019080838360005b838110156105c85781810151838201526020016105b0565b50505050905090810190601f1680156105f55780820380516001836020036101000a031916815260200191505b50848103835286518152865160209182019188019080838360005b83811015610628578181015183820152602001610610565b50505050905090810190601f1680156106555780820380516001836020036101000a031916815260200191505b50848103825285518152855160209182019187019080838360005b83811015610688578181015183820152602001610670565b50505050905090810190601f1680156106b55780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a16040805173ffffffffffffffffffffffffffffffffffffffff8516815290517fba2fe28067a0918af64c5359b1579f887bf1479dd3163c7e5d456314168854a59181900360200190a1505050505050565b600061072383836108bf565b6040805173ffffffffffffffffffffffffffffffffffffffff8316815290519192507fba2fe28067a0918af64c5359b1579f887bf1479dd3163c7e5d456314168854a5919081900360200190a1505050565b60005b81811015610821578381840181518110151561079057fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f01000000000000000000000000000000000000000000000000000000000000000285828151811015156107e957fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600101610778565b5050505050565b82518251825160408051600284860180850191820180845260206021909301601f191684018301909452606096959491860193919260229091019190879082801561087d578160200160208202803883390190505b50905086602082018860208e016004610bb8fa50858582018760208d016004610bb8fa50838382018560208c016004610bb8fa509a9950505050505050505050565b600080600080845160411415156108d557600080fd5b50505060208201516040830151606084015160001a601b60ff821610156108fa57601b015b8060ff16601b148061090f57508060ff16601c145b151561091a57600080fd5b61092686828585610930565b9695505050505050565b60008060006040518781528660208201528560408201528460608201526020816080836001610bb8fa9051909250905060018215151461092657600080fd00a165627a7a723058201c3d8664951f67e0da5abb547375de4421117ef8669c4a13b8bfbc0a3c6a14ae0029", + "deployedBytecode": "0x6080604052600436106100565763ffffffff7c0100000000000000000000000000000000000000000000000000000000600035041663b0e7308f811461005b578063d09ca90414610132578063fdace1be146101c9575b600080fd5b34801561006757600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261013094369492936024939284019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a99988101979196509182019450925082915084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a9998810197919650918201945092508291508401838280828437509497506102279650505050505050565b005b34801561013e57600080fd5b506040805160206004803580820135601f810184900484028501840190955284845261013094369492936024939284019190819084018382808284375050604080516020601f89358b018035918201839004830284018301909452808352979a9998810197919650918201945092508291508401838280828437509497506104929650505050505050565b3480156101d557600080fd5b5060408051602060046024803582810135601f81018590048502860185019096528585526101309583359536956044949193909101919081908401838280828437509497506107179650505050505050565b60008060608060608060606000808b5198508b6040518082805190602001908083835b602083106102695780518252601f19909201916020918201910161024a565b51815160209384036101000a6000190180199092169116179052604080519290940182900382208083529351939d507fcd7ee33e1a630d6301d87631aab1d4ddce7e1942593cd2689aa989f76d67cf0195509083900301925050a1608d89036040519080825280601f01601f1916602001820160405280156102f5578160200160208202803883390190505b5060408051601f808252818301909252919850602082016103e08038833950506040805160418082526080820190925292985090506020820161082080388339505060408051602a808252606082019092529297509050602082016105408038833901905050935061036b878d60008a51610775565b600260218801600260208e016004610bb8fa5061038e868d608c8c038951610775565b600160208701600160208d016004610bb8fa506103b1848d602a8c038751610775565b6103bc878786610828565b9250826040518082805190602001908083835b602083106103ee5780518252601f1990920191602091820191016103cf565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020915061042d858d606b8c038851610775565b61043782866108bf565b6040805173ffffffffffffffffffffffffffffffffffffffff8316815290519192507fba2fe28067a0918af64c5359b1579f887bf1479dd3163c7e5d456314168854a5919081900360200190a1505050505050505050505050565b600080606080856040518082805190602001908083835b602083106104c85780518252601f1990920191602091820191016104a9565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020935061050184866108bf565b604080516020808252818301909252919450808201610400803883395050604080516020808252818301909252929450905080820161040080388339019050509050610551828760046020610775565b61055f8187605b6020610775565b7f8511795469a13c04a2bc22c3f1309fc0bd918a0a25a3e7e222a0417b719274c786838360405180806020018060200180602001848103845287818151815260200191508051906020019080838360005b838110156105c85781810151838201526020016105b0565b50505050905090810190601f1680156105f55780820380516001836020036101000a031916815260200191505b50848103835286518152865160209182019188019080838360005b83811015610628578181015183820152602001610610565b50505050905090810190601f1680156106555780820380516001836020036101000a031916815260200191505b50848103825285518152855160209182019187019080838360005b83811015610688578181015183820152602001610670565b50505050905090810190601f1680156106b55780820380516001836020036101000a031916815260200191505b50965050505050505060405180910390a16040805173ffffffffffffffffffffffffffffffffffffffff8516815290517fba2fe28067a0918af64c5359b1579f887bf1479dd3163c7e5d456314168854a59181900360200190a1505050505050565b600061072383836108bf565b6040805173ffffffffffffffffffffffffffffffffffffffff8316815290519192507fba2fe28067a0918af64c5359b1579f887bf1479dd3163c7e5d456314168854a5919081900360200190a1505050565b60005b81811015610821578381840181518110151561079057fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f01000000000000000000000000000000000000000000000000000000000000000285828151811015156107e957fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a905350600101610778565b5050505050565b82518251825160408051600284860180850191820180845260206021909301601f191684018301909452606096959491860193919260229091019190879082801561087d578160200160208202803883390190505b50905086602082018860208e016004610bb8fa50858582018760208d016004610bb8fa50838382018560208c016004610bb8fa509a9950505050505050505050565b600080600080845160411415156108d557600080fd5b50505060208201516040830151606084015160001a601b60ff821610156108fa57601b015b8060ff16601b148061090f57508060ff16601c145b151561091a57600080fd5b61092686828585610930565b9695505050505050565b60008060006040518781528660208201528560408201528460608201526020816080836001610bb8fa9051909250905060018215151461092657600080fd00a165627a7a723058201c3d8664951f67e0da5abb547375de4421117ef8669c4a13b8bfbc0a3c6a14ae0029", + "sourceMap": "146:4124:2:-;;;406:48;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;432:5:2;:18;;-1:-1:-1;;;;;440:10:2;432:18;-1:-1:-1;;;;;;432:18:2;;;;;;146:4124;;;;;;", + "deployedSourceMap": "146:4124:2:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1483:1289;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;1483:1289:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;1483:1289:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1483:1289:2;;;;-1:-1:-1;1483:1289:2;-1:-1:-1;1483:1289:2;;-1:-1:-1;1483:1289:2;;;;;;;;-1:-1:-1;;1483:1289:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1483:1289:2;;;;-1:-1:-1;1483:1289:2;-1:-1:-1;1483:1289:2;;-1:-1:-1;1483:1289:2;;;;;;;;-1:-1:-1;1483:1289:2;;-1:-1:-1;1483:1289:2;;-1:-1:-1;;;;;;;1483:1289:2;;;819:444;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;819:444:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;;819:444:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;819:444:2;;;;-1:-1:-1;819:444:2;-1:-1:-1;819:444:2;;-1:-1:-1;819:444:2;;;;;;;;-1:-1:-1;819:444:2;;-1:-1:-1;819:444:2;;-1:-1:-1;;;;;;;819:444:2;551:141;;8:9:-1;5:2;;;30:1;27;20:12;5:2;-1:-1;551:141:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;551:141:2;;-1:-1:-1;551:141:2;;-1:-1:-1;;;;;;;551:141:2;1483:1289;1572:14;1606:17;1682:24;1737:22;1781:25;1826:22;2432;2506:16;2673;1589:6;:13;1572:30;;1636:6;1626:17;;;;;;;;;;;;;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;299:10;344;;263:2;259:12;;;254:3;250:22;-1:-1;;246:30;311:9;;295:26;;;340:21;;377:20;365:33;;1626:17:2;;;;;;;;;;;;1653:24;;;;;1626:17;;-1:-1:-1;1653:24:2;;-1:-1:-1;1653:24:2;;;;;;-1:-1:-1;;1653:24:2;1729:3;1720:6;:12;1710:23;;;;;;;;;;;;;;;;;;;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;1710:23:2;-1:-1:-1;1764:13:2;;;1774:2;1764:13;;;;;;;;;1682:51;;-1:-1:-1;1764:13:2;;;17:15:-1;;105:10;1764:13:2;88:34:-1;-1:-1;;1809:13:2;;;1819:2;1809:13;;;;;;;;;1737:40;;-1:-1:-1;1819:2:2;-1:-1:-1;1809:13:2;;;17:15:-1;;105:10;1809:13:2;88:34:-1;-1:-1;;1853:13:2;;;1863:2;1853:13;;;;;;;;;1781:41;;-1:-1:-1;1863:2:2;-1:-1:-1;1853:13:2;;;17:15:-1;;105:10;1853:13:2;88:34:-1;136:17;;-1:-1;1853:13:2;1826:40;;1931:55;1943:11;1956:6;1964:1;1967:11;:18;1931:11;:55::i;:::-;2091:1;2086:2;2073:11;2069:20;2066:1;2061:2;2047:12;2043:21;2040:1;2034:4;2023:70;1999:100;2163:60;2175:9;2186:6;2201:3;2194:6;:10;2206:9;:16;2163:11;:60::i;:::-;2324:1;2319:2;2308:9;2304:18;2301:1;2296:2;2279:15;2275:24;2272:1;2266:4;2255:71;2236:94;2369:59;2381:9;2392:6;2407:2;2400:6;:9;2411;:16;2369:11;:59::i;:::-;2457:44;2467:11;2480:9;2491;2457;:44::i;:::-;2432:69;;2535:9;2525:20;;;;;;;;;;;;;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;2525:20:2;;;;;;;;;;;;;;;;2506:39;;2602:66;2614:12;2628:6;2643:3;2636:6;:10;2648:12;:19;2602:11;:66::i;:::-;2692:43;2712:8;2722:12;2692:19;:43::i;:::-;2745:22;;;;;;;;;;2673:62;;-1:-1:-1;2745:22:2;;;;;;;;;;1483:1289;;;;;;;;;;;;:::o;819:444::-;876:16;916;974:23;1017:21;905:6;895:17;;;;;;;;;;;;;36:153:-1;66:2;58:11;;36:153;;176:10;;164:23;;-1:-1;;139:12;;;;98:2;89:12;;;;114;36:153;;;274:1;267:3;263:2;259:12;254:3;250:22;246:30;315:4;311:9;305:3;299:10;295:26;356:4;350:3;344:10;340:21;389:7;380;377:20;372:3;365:33;3:399;;;895:17:2;;;;;;;;;;;;;;;;876:36;;935:34;955:8;965:3;935:19;:34::i;:::-;1000:13;;;1010:2;1000:13;;;;;;;;;916:53;;-1:-1:-1;1000:13:2;;;17:15:-1;;105:10;1000:13:2;88:34:-1;-1:-1;;1041:13:2;;;1051:2;1041:13;;;;;;;;;974:39;;-1:-1:-1;1051:2:2;-1:-1:-1;1041:13:2;;;17:15:-1;;105:10;1041:13:2;88:34:-1;136:17;;-1:-1;1041:13:2;1017:37;;1092:38;1104:10;1116:6;1124:1;1127:2;1092:11;:38::i;:::-;1134:37;1146:8;1156:6;1164:2;1168;1134:11;:37::i;:::-;1181:47;1199:6;1207:10;1219:8;1181:47;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;1181:47:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1181:47:2;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;1181:47:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;-1:-1:-1;1181:47:2;;;;;;;;;;;;;;;;;;;;;;23:1:-1;8:100;33:3;30:1;27:10;8:100;;;90:11;;;84:18;71:11;;;64:39;52:2;45:10;8:100;;;12:14;1181:47:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1237:22;;;;;;;;;;;;;;;;;;;819:444;;;;;;:::o;551:141::-;607:16;626:30;646:4;652:3;626:19;:30::i;:::-;666:22;;;;;;;;;;607:49;;-1:-1:-1;666:22:2;;;;;;;;;;551:141;;;:::o;4112:155::-;4205:6;4200:64;4217:6;4215:1;:8;4200:64;;;4245:5;4257:1;4251:5;:7;4245:14;;;;;;;;;;;;;;;;;;;;4235:4;4240:1;4235:7;;;;;;;;;;;;;;:24;;;;;;;;;;-1:-1:-1;4225:3:2;;4200:64;;;4112:155;;;;;:::o;2775:1056::-;2976:18;;3024:16;;3121;;3348:20;;;3209:1;3166:35;;;3234:53;;;:57;;;3348:20;;;3089:2;3348:20;;;;-1:-1:-1;;3348:20:2;;;;;;;;2870:12;;2976:18;3024:16;3069:22;;;;3121:16;;3166:44;;;;;3234:57;2870:12;;3234:57;3348:20;;;;;;;29:2:-1;21:6;17:15;117:4;105:10;97:6;88:34;136:17;;-1:-1;3348:20:2;;3326:42;;3518:17;3513:2;3505:6;3501:15;3482:17;3477:2;3464:11;3460:20;3457:1;3451:4;3440:96;3424:116;3654:15;3637:14;3629:6;3625:27;3608:15;3603:2;3592:9;3588:18;3585:1;3579:4;3568:102;3552:122;3788:15;3771:14;3763:6;3759:27;3742:15;3737:2;3726:9;3722:18;3719:1;3713:4;3702:102;-1:-1:-1;3821:6:2;2775:1056;-1:-1:-1;;;;;;;;;;2775:1056:2:o;2105:1662:0:-;2177:7;2196:9;2215;2234:7;2261:3;:10;2275:2;2261:16;2252:26;;;;;;;;-1:-1:-1;;;2490:2:0;2481:12;;2475:19;2527:2;2518:12;;2512:19;2785:2;2776:12;;2770:19;2767:1;2762:28;3328:2;3324:6;;;;3320:29;;;3347:2;3342:7;3320:29;3369:1;:7;;3374:2;3369:7;:18;;;;3380:1;:7;;3385:2;3380:7;3369:18;3360:28;;;;;;;;3683:30;3699:4;3705:1;3708;3711;3683:15;:30::i;:::-;3676:37;2105:1662;-1:-1:-1;;;;;;2105:1662:0:o;1094:1005::-;1191:7;1595:8;1613:12;1677:4;1671:11;1708:4;1702;1695:18;1748:1;1743:2;1737:4;1733:13;1726:24;1785:1;1780:2;1774:4;1770:13;1763:24;1822:1;1817:2;1811:4;1807:13;1800:24;1993:2;1987:4;1982:3;1976:4;1973:1;1967:4;1956:40;2017:11;;1949:47;;-1:-1:-1;2017:11:0;-1:-1:-1;2064:4:0;2057:11;;;;2048:22;;;;", + "source": "// Copyright (c) 2016-2018 Clearmatics Technologies Ltd\n// SPDX-License-Identifier: LGPL-3.0+\npragma solidity ^0.4.23;\n\nimport \"./ECVerify.sol\";\n\ncontract Recover {\n\taddress Owner;\n\n\tevent broadcastSig(address owner);\n\tevent broadcastHashData(bytes header, bytes parentHash, bytes rootHash);\n\t/* event test(bytes start, bytes data); */\n\tevent broadcastHash(bytes32 blockHash);\n\tevent test(bytes header);\n\n\tconstructor () public {\n\t\tOwner = msg.sender;\n\t}\n\n\t/*\n\t * @param data \t\t\tdata that has been signed\n\t * @param sig \t\t\tsignature of data\n\t */\n\tfunction VerifyHash(bytes32 data, bytes sig) public {\n\t\taddress sig_addr = ECVerify.ecrecovery(data, sig);\n\n\t\temit broadcastSig(sig_addr);\n\t}\n\n\t/*\n\t* @param header \t\t\theader rlp encoded, with extraData signatures removed\n\t* @param sig \t\t\textraData signatures\n\t*/\n\tfunction VerifyBlock(bytes header, bytes sig) public {\n\t\tbytes32 hashData = keccak256(header);\n\t\taddress sig_addr = ECVerify.ecrecovery(hashData, sig);\n\n\t\tbytes memory parentHash = new bytes(32);\n\t\tbytes memory rootHash = new bytes(32);\n\n\t\t// get parentHash and rootHash\n\t\textractData(parentHash, header, 4, 32);\n\t\textractData(rootHash, header, 91, 32);\n\n\t\temit broadcastHashData(header, parentHash, rootHash);\n\t\temit broadcastSig(sig_addr);\n\t}\n\n\t/*\n\t* @param header \t\t\t\t\theader rlp encoded, with extraData signatures removed\n\t* @param prefixHeader\t\t\tthe new prefix for the signed hash header\n\t* @param prefixExtraData\tthe new prefix for the extraData field\n\t*/\n\tfunction ExtractHash(bytes header, bytes prefixHeader, bytes prefixExtraData) public {\n\t\tuint256 length = header.length;\n\t\tbytes32 blockHash = keccak256(header);\n\n\t\temit broadcastHash(blockHash);\n\n\t\tbytes memory headerStart \t= new bytes(length - 141);\n\t\tbytes memory extraData \t\t= new bytes(31);\n\t\tbytes memory extraDataSig\t= new bytes(65);\n\t\tbytes memory headerEnd \t\t= new bytes(42);\n\n\t\t// Extract the start of the header and replace the length\n\t\textractData(headerStart, header, 0, headerStart.length);\n\t\tassembly {\n let ret := staticcall(3000, 4, add(prefixHeader, 32), 2, add(headerStart, 33), 2)\n }\n\n\t\t// Extract the real extra data and create the signed hash\n\t\textractData(extraData, header, length-140, extraData.length);\n\t\tassembly {\n\t\t\t\t\t let ret := staticcall(3000, 4, add(prefixExtraData, 32), 1, add(extraData, 32), 1)\n\t\t}\n\n\t\t// Extract the end of the header\n\t\textractData(headerEnd, header, length-42, headerEnd.length);\n\t\tbytes memory newHeader = mergeHash(headerStart, extraData, headerEnd);\n\n\t\tbytes32 hashData = keccak256(newHeader);\n\n\t\t// Extract the signature of the hash create above\n\t\textractData(extraDataSig, header, length-107, extraDataSig.length);\n\n\t\taddress sig_addr = ECVerify.ecrecovery(hashData, extraDataSig);\n\n\t\temit broadcastSig(sig_addr);\n\n\t}\n\n\tfunction mergeHash(bytes headerStart, bytes extraData, bytes headerEnd) internal view returns (bytes output) {\n\t\t// Get the lengths sorted because they're needed later...\n\t\tuint256 headerStartLength = headerStart.length;\n\t\tuint256 extraDataLength = extraData.length;\n\t\tuint256 extraDataStart = headerStartLength + 32;\n\t\tuint256 headerEndLength = headerEnd.length;\n\t\tuint256 headerEndStart = extraDataLength + headerStartLength + 32 + 2;\n\t\tuint256 newLength = headerStartLength + extraDataLength + headerEndLength + 2; // extra two is for the prefix\n\t\tbytes memory header = new bytes(newLength);\n\n\n\t\t// Add in the first part of the header\n\t\tassembly {\n\t\t\tlet ret := staticcall(3000, 4, add(headerStart, 32), headerStartLength, add(header, 32), headerStartLength)\n\t\t}\n\t\tassembly {\n\t\t\tlet ret := staticcall(3000, 4, add(extraData, 32), extraDataLength, add(header, extraDataStart), extraDataLength)\n\t\t}\n\t\tassembly {\n\t\t\tlet ret := staticcall(3000, 4, add(headerEnd, 32), headerEndLength, add(header, headerEndStart), headerEndLength)\n\t\t}\n\n\t\toutput = header;\n\t}\n\n\t/*\n\t* @param data\t \t\t\tmemory allocation for the data you need to extract\n\t* @param sig \t\t\tarray from which the data should be extracted\n\t* @param start \t\t\tindex which the data starts within the byte array\n\t* @param length \t\t\ttotal length of the data to be extracted\n\t*/\n\tfunction extractData(bytes data, bytes input, uint start, uint length) private pure {\n\t\tfor (uint i=0; i BlockHeader) public m_blockheaders;\n\tmapping( address => bool ) m_validators;\n\n\t/*\n\t*\t@param _validators\t\t\tlist of validators at block 0\n\t*/\n\tconstructor (address[] _validators) public {\n\t\tOwner = msg.sender;\n\t\tfor (uint i = 0; i < _validators.length; i++) {\n\t\t\tvalidators.push(_validators[i]);\n\t\t\tm_validators[_validators[i]] = true;\n }\n\t}\n\n\t/*\n\t* Returns the validators array\n\t*/\n\tfunction GetValidators() public view returns (address[] _validators) {\n\t\treturn validators;\n\t}\n\n\t/*\n\t* @param header \t\t\t\t\theader rlp encoded, with extraData signatures removed\n\t* @param prefixHeader\t\t\tthe new prefix for the signed hash header\n\t* @param prefixExtraData\tthe new prefix for the extraData field\n\t*/\n\tfunction ValidateBlock(bytes header, bytes prefixHeader, bytes prefixExtraData) public {\n\t\tuint256 length = header.length;\n\t\tbytes32 blockHash = keccak256(header);\n\n\t\temit broadcastHash(blockHash);\n\n\t\tbytes memory headerStart \t= new bytes(length - 141);\n\t\tbytes memory extraData \t\t= new bytes(31);\n\t\tbytes memory extraDataSig\t= new bytes(65);\n\t\tbytes memory headerEnd \t\t= new bytes(42);\n\n\t\t// Extract the start of the header and replace the length\n\t\textractData(headerStart, header, 0, headerStart.length);\n\t\tassembly {\n let ret := staticcall(3000, 4, add(prefixHeader, 32), 2, add(headerStart, 33), 2)\n }\n\n\t\t// Extract the real extra data and create the signed hash\n\t\textractData(extraData, header, length-140, extraData.length);\n\t\tassembly {\n\t\t\t\t\t let ret := staticcall(3000, 4, add(prefixExtraData, 32), 1, add(extraData, 32), 1)\n\t\t}\n\n\t\t// Extract the end of the header\n\t\textractData(headerEnd, header, length-42, headerEnd.length);\n\t\tbytes memory newHeader = mergeHash(headerStart, extraData, headerEnd);\n\n\t\tbytes32 hashData = keccak256(newHeader);\n\n\t\t// Extract the signature of the hash create above\n\t\textractData(extraDataSig, header, length-107, extraDataSig.length);\n\n\t\taddress sig_addr = ECVerify.ecrecovery(hashData, extraDataSig);\n\t\trequire(m_validators[sig_addr]==true, \"Signer not a validator!\");\n\n\t\temit broadcastSig(sig_addr);\n\n\t}\n\n\tfunction mergeHash(bytes headerStart, bytes extraData, bytes headerEnd) internal view returns (bytes output) {\n\t\t// Get the lengths sorted because they're needed later...\n\t\tuint256 headerStartLength = headerStart.length;\n\t\tuint256 extraDataLength = extraData.length;\n\t\tuint256 extraDataStart = headerStartLength + 32;\n\t\tuint256 headerEndLength = headerEnd.length;\n\t\tuint256 headerEndStart = extraDataLength + headerStartLength + 32 + 2;\n\t\tuint256 newLength = headerStartLength + extraDataLength + headerEndLength + 2; // extra two is for the prefix\n\t\tbytes memory header = new bytes(newLength);\n\n\n\t\t// Add in the first part of the header\n\t\tassembly {\n\t\t\tlet ret := staticcall(3000, 4, add(headerStart, 32), headerStartLength, add(header, 32), headerStartLength)\n\t\t}\n\t\tassembly {\n\t\t\tlet ret := staticcall(3000, 4, add(extraData, 32), extraDataLength, add(header, extraDataStart), extraDataLength)\n\t\t}\n\t\tassembly {\n\t\t\tlet ret := staticcall(3000, 4, add(headerEnd, 32), headerEndLength, add(header, headerEndStart), headerEndLength)\n\t\t}\n\n\t\toutput = header;\n\t}\n\n\t/*\n\t* @param data\t \t\t\tmemory allocation for the data you need to extract\n\t* @param sig \t\t\tarray from which the data should be extracted\n\t* @param start \t\t\tindex which the data starts within the byte array\n\t* @param length \t\t\ttotal length of the data to be extracted\n\t*/\n\tfunction extractData(bytes data, bytes input, uint start, uint length) private pure {\n\t\tfor (uint i=0; i struct Validation.BlockHeader)" + }, + "typeName": { + "id": 113, + "keyType": { + "id": 111, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "422:7:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Mapping", + "src": "413:32:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_BlockHeader_$110_storage_$", + "typeString": "mapping(bytes32 => struct Validation.BlockHeader)" + }, + "valueType": { + "contractScope": null, + "id": 112, + "name": "BlockHeader", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 110, + "src": "433:11:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_BlockHeader_$110_storage_ptr", + "typeString": "struct Validation.BlockHeader" + } + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 118, + "name": "m_validators", + "nodeType": "VariableDeclaration", + "scope": 400, + "src": "470:39:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", + "typeString": "mapping(address => bool)" + }, + "typeName": { + "id": 117, + "keyType": { + "id": 115, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "479:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Mapping", + "src": "470:26:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", + "typeString": "mapping(address => bool)" + }, + "valueType": { + "id": 116, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "490:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + }, + "value": null, + "visibility": "internal" + }, + { + "body": { + "id": 158, + "nodeType": "Block", + "src": "618:158:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 127, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 124, + "name": "Owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 88, + "src": "622:5:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 125, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 415, + "src": "630:3:1", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 126, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "630:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "622:18:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 128, + "nodeType": "ExpressionStatement", + "src": "622:18:1" + }, + { + "body": { + "id": 156, + "nodeType": "Block", + "src": "690:83:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 143, + "name": "_validators", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 121, + "src": "711:11:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_memory_ptr", + "typeString": "address[] memory" + } + }, + "id": 145, + "indexExpression": { + "argumentTypes": null, + "id": 144, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 130, + "src": "723:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "711:14:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "argumentTypes": null, + "id": 140, + "name": "validators", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 107, + "src": "695:10:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + } + }, + "id": 142, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "push", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "695:15:1", + "typeDescriptions": { + "typeIdentifier": "t_function_arraypush_nonpayable$_t_address_$returns$_t_uint256_$", + "typeString": "function (address) returns (uint256)" + } + }, + "id": 146, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "695:31:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 147, + "nodeType": "ExpressionStatement", + "src": "695:31:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 154, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 148, + "name": "m_validators", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 118, + "src": "731:12:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", + "typeString": "mapping(address => bool)" + } + }, + "id": 152, + "indexExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 149, + "name": "_validators", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 121, + "src": "744:11:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_memory_ptr", + "typeString": "address[] memory" + } + }, + "id": 151, + "indexExpression": { + "argumentTypes": null, + "id": 150, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 130, + "src": "756:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "744:14:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "731:28:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "74727565", + "id": 153, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "762:4:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "src": "731:35:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 155, + "nodeType": "ExpressionStatement", + "src": "731:35:1" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 136, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 133, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 130, + "src": "661:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 134, + "name": "_validators", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 121, + "src": "665:11:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_memory_ptr", + "typeString": "address[] memory" + } + }, + "id": 135, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "665:18:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "661:22:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 157, + "initializationExpression": { + "assignments": [ + 130 + ], + "declarations": [ + { + "constant": false, + "id": 130, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 159, + "src": "649:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 129, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "649:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 132, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 131, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "658:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "649:10:1" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 138, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "685:3:1", + "subExpression": { + "argumentTypes": null, + "id": 137, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 130, + "src": "685:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 139, + "nodeType": "ExpressionStatement", + "src": "685:3:1" + }, + "nodeType": "ForStatement", + "src": "644:129:1" + } + ] + }, + "documentation": null, + "id": 159, + "implemented": true, + "isConstructor": true, + "isDeclaredConst": false, + "modifiers": [], + "name": "", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 122, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 121, + "name": "_validators", + "nodeType": "VariableDeclaration", + "scope": 159, + "src": "588:21:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_memory_ptr", + "typeString": "address[]" + }, + "typeName": { + "baseType": { + "id": 119, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "588:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 120, + "length": null, + "nodeType": "ArrayTypeName", + "src": "588:9:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", + "typeString": "address[]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "587:23:1" + }, + "payable": false, + "returnParameters": { + "id": 123, + "nodeType": "ParameterList", + "parameters": [], + "src": "618:0:1" + }, + "scope": 400, + "src": "575:201:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 167, + "nodeType": "Block", + "src": "888:25:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 165, + "name": "validators", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 107, + "src": "899:10:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + } + }, + "functionReturnParameters": 164, + "id": 166, + "nodeType": "Return", + "src": "892:17:1" + } + ] + }, + "documentation": null, + "id": 168, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "GetValidators", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 160, + "nodeType": "ParameterList", + "parameters": [], + "src": "841:2:1" + }, + "payable": false, + "returnParameters": { + "id": 164, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 163, + "name": "_validators", + "nodeType": "VariableDeclaration", + "scope": 168, + "src": "865:21:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_memory_ptr", + "typeString": "address[]" + }, + "typeName": { + "baseType": { + "id": 161, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "865:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 162, + "length": null, + "nodeType": "ArrayTypeName", + "src": "865:9:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", + "typeString": "address[]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "864:23:1" + }, + "scope": 400, + "src": "819:94:1", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 297, + "nodeType": "Block", + "src": "1220:1272:1", + "statements": [ + { + "assignments": [ + 178 + ], + "declarations": [ + { + "constant": false, + "id": 178, + "name": "length", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "1224:14:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 177, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1224:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 181, + "initialValue": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 179, + "name": "header", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 170, + "src": "1241:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 180, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "1241:13:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1224:30:1" + }, + { + "assignments": [ + 183 + ], + "declarations": [ + { + "constant": false, + "id": 183, + "name": "blockHash", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "1258:17:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 182, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1258:7:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 187, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 185, + "name": "header", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 170, + "src": "1288:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 184, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 409, + "src": "1278:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_sha3_pure$__$returns$_t_bytes32_$", + "typeString": "function () pure returns (bytes32)" + } + }, + "id": 186, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1278:17:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1258:37:1" + }, + { + "eventCall": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 189, + "name": "blockHash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 183, + "src": "1319:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 188, + "name": "broadcastHash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 104, + "src": "1305:13:1", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$returns$__$", + "typeString": "function (bytes32)" + } + }, + "id": 190, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1305:24:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 191, + "nodeType": "EmitStatement", + "src": "1300:29:1" + }, + { + "assignments": [ + 193 + ], + "declarations": [ + { + "constant": false, + "id": 193, + "name": "headerStart", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "1334:24:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 192, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1334:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 200, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 198, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 196, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 178, + "src": "1372:6:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "313431", + "id": 197, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1381:3:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_141_by_1", + "typeString": "int_const 141" + }, + "value": "141" + }, + "src": "1372:12:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 195, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "1362:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 194, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1366:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 199, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1362:23:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1334:51:1" + }, + { + "assignments": [ + 202 + ], + "declarations": [ + { + "constant": false, + "id": 202, + "name": "extraData", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "1389:22:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 201, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1389:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 207, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "3331", + "id": 205, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1426:2:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_31_by_1", + "typeString": "int_const 31" + }, + "value": "31" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_31_by_1", + "typeString": "int_const 31" + } + ], + "id": 204, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "1416:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 203, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1420:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 206, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1416:13:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1389:40:1" + }, + { + "assignments": [ + 209 + ], + "declarations": [ + { + "constant": false, + "id": 209, + "name": "extraDataSig", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "1433:25:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 208, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1433:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 214, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "3635", + "id": 212, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1471:2:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_65_by_1", + "typeString": "int_const 65" + }, + "value": "65" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_65_by_1", + "typeString": "int_const 65" + } + ], + "id": 211, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "1461:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 210, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1465:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 213, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1461:13:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1433:41:1" + }, + { + "assignments": [ + 216 + ], + "declarations": [ + { + "constant": false, + "id": 216, + "name": "headerEnd", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "1478:22:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 215, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1478:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 221, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "3432", + "id": 219, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1515:2:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_42_by_1", + "typeString": "int_const 42" + }, + "value": "42" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_42_by_1", + "typeString": "int_const 42" + } + ], + "id": 218, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "1505:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 217, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1509:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 220, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1505:13:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1478:40:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 223, + "name": "headerStart", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 193, + "src": "1595:11:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 224, + "name": "header", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 170, + "src": "1608:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "hexValue": "30", + "id": 225, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1616:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 226, + "name": "headerStart", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 193, + "src": "1619:11:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 227, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "1619:18:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 222, + "name": "extractData", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 399, + "src": "1583:11:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_bytes_memory_ptr_$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (bytes memory,bytes memory,uint256,uint256) pure" + } + }, + "id": 228, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1583:55:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 229, + "nodeType": "ExpressionStatement", + "src": "1583:55:1" + }, + { + "externalReferences": [ + { + "prefixHeader": { + "declaration": 172, + "isOffset": false, + "isSlot": false, + "src": "1699:12:1", + "valueSize": 1 + } + }, + { + "headerStart": { + "declaration": 193, + "isOffset": false, + "isSlot": false, + "src": "1725:11:1", + "valueSize": 1 + } + } + ], + "id": 230, + "nodeType": "InlineAssembly", + "operations": "{\n let ret := staticcall(3000, 4, add(prefixHeader, 32), 2, add(headerStart, 33), 2)\n}", + "src": "1642:184:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 232, + "name": "extraData", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 202, + "src": "1827:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 233, + "name": "header", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 170, + "src": "1838:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 236, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 234, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 178, + "src": "1846:6:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "313430", + "id": 235, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1853:3:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_140_by_1", + "typeString": "int_const 140" + }, + "value": "140" + }, + "src": "1846:10:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 237, + "name": "extraData", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 202, + "src": "1858:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 238, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "1858:16:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 231, + "name": "extractData", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 399, + "src": "1815:11:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_bytes_memory_ptr_$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (bytes memory,bytes memory,uint256,uint256) pure" + } + }, + "id": 239, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1815:60:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 240, + "nodeType": "ExpressionStatement", + "src": "1815:60:1" + }, + { + "externalReferences": [ + { + "prefixExtraData": { + "declaration": 174, + "isOffset": false, + "isSlot": false, + "src": "1931:15:1", + "valueSize": 1 + } + }, + { + "extraData": { + "declaration": 202, + "isOffset": false, + "isSlot": false, + "src": "1960:9:1", + "valueSize": 1 + } + } + ], + "id": 241, + "nodeType": "InlineAssembly", + "operations": "{\n let ret := staticcall(3000, 4, add(prefixExtraData, 32), 1, add(extraData, 32), 1)\n}", + "src": "1879:153:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 243, + "name": "headerEnd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 216, + "src": "2033:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 244, + "name": "header", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 170, + "src": "2044:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 247, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 245, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 178, + "src": "2052:6:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "3432", + "id": 246, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2059:2:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_42_by_1", + "typeString": "int_const 42" + }, + "value": "42" + }, + "src": "2052:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 248, + "name": "headerEnd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 216, + "src": "2063:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 249, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2063:16:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 242, + "name": "extractData", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 399, + "src": "2021:11:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_bytes_memory_ptr_$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (bytes memory,bytes memory,uint256,uint256) pure" + } + }, + "id": 250, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2021:59:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 251, + "nodeType": "ExpressionStatement", + "src": "2021:59:1" + }, + { + "assignments": [ + 253 + ], + "declarations": [ + { + "constant": false, + "id": 253, + "name": "newHeader", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "2084:22:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 252, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2084:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 259, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 255, + "name": "headerStart", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 193, + "src": "2119:11:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 256, + "name": "extraData", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 202, + "src": "2132:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 257, + "name": "headerEnd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 216, + "src": "2143:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 254, + "name": "mergeHash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 365, + "src": "2109:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes_memory_ptr_$_t_bytes_memory_ptr_$_t_bytes_memory_ptr_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (bytes memory,bytes memory,bytes memory) view returns (bytes memory)" + } + }, + "id": 258, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2109:44:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2084:69:1" + }, + { + "assignments": [ + 261 + ], + "declarations": [ + { + "constant": false, + "id": 261, + "name": "hashData", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "2158:16:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 260, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2158:7:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 265, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 263, + "name": "newHeader", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "2187:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 262, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 409, + "src": "2177:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_sha3_pure$__$returns$_t_bytes32_$", + "typeString": "function () pure returns (bytes32)" + } + }, + "id": 264, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2177:20:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2158:39:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 267, + "name": "extraDataSig", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 209, + "src": "2266:12:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 268, + "name": "header", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 170, + "src": "2280:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 271, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 269, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 178, + "src": "2288:6:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "313037", + "id": 270, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2295:3:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_107_by_1", + "typeString": "int_const 107" + }, + "value": "107" + }, + "src": "2288:10:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 272, + "name": "extraDataSig", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 209, + "src": "2300:12:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 273, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2300:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 266, + "name": "extractData", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 399, + "src": "2254:11:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_bytes_memory_ptr_$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (bytes memory,bytes memory,uint256,uint256) pure" + } + }, + "id": 274, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2254:66:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 275, + "nodeType": "ExpressionStatement", + "src": "2254:66:1" + }, + { + "assignments": [ + 277 + ], + "declarations": [ + { + "constant": false, + "id": 277, + "name": "sig_addr", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "2325:16:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 276, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2325:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 283, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 280, + "name": "hashData", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 261, + "src": "2364:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "argumentTypes": null, + "id": 281, + "name": "extraDataSig", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 209, + "src": "2374:12:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 278, + "name": "ECVerify", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "2344:8:1", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_ECVerify_$83_$", + "typeString": "type(library ECVerify)" + } + }, + "id": 279, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecrecovery", + "nodeType": "MemberAccess", + "referencedDeclaration": 82, + "src": "2344:19:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$_t_bytes_memory_ptr_$returns$_t_address_$", + "typeString": "function (bytes32,bytes memory) view returns (address)" + } + }, + "id": 282, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2344:43:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2325:62:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 289, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 285, + "name": "m_validators", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 118, + "src": "2399:12:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", + "typeString": "mapping(address => bool)" + } + }, + "id": 287, + "indexExpression": { + "argumentTypes": null, + "id": 286, + "name": "sig_addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 277, + "src": "2412:8:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2399:22:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "74727565", + "id": 288, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2423:4:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "src": "2399:28:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "argumentTypes": null, + "hexValue": "5369676e6572206e6f7420612076616c696461746f7221", + "id": 290, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2429:25:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_ef816ed0202abfa7cc0f5d5cbdb449983f32bdc09af6e4e0cc11d034fd9ef437", + "typeString": "literal_string \"Signer not a validator!\"" + }, + "value": "Signer not a validator!" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_ef816ed0202abfa7cc0f5d5cbdb449983f32bdc09af6e4e0cc11d034fd9ef437", + "typeString": "literal_string \"Signer not a validator!\"" + } + ], + "id": 284, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 418, + 419 + ], + "referencedDeclaration": 419, + "src": "2391:7:1", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 291, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2391:64:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 292, + "nodeType": "ExpressionStatement", + "src": "2391:64:1" + }, + { + "eventCall": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 294, + "name": "sig_addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 277, + "src": "2478:8:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 293, + "name": "broadcastSig", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 92, + "src": "2465:12:1", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$returns$__$", + "typeString": "function (address)" + } + }, + "id": 295, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2465:22:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 296, + "nodeType": "EmitStatement", + "src": "2460:27:1" + } + ] + }, + "documentation": null, + "id": 298, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "ValidateBlock", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 175, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 170, + "name": "header", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "1156:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 169, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1156:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 172, + "name": "prefixHeader", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "1170:18:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 171, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1170:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 174, + "name": "prefixExtraData", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "1190:21:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 173, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1190:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1155:57:1" + }, + "payable": false, + "returnParameters": { + "id": 176, + "nodeType": "ParameterList", + "parameters": [], + "src": "1220:0:1" + }, + "scope": 400, + "src": "1133:1359:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 364, + "nodeType": "Block", + "src": "2604:947:1", + "statements": [ + { + "assignments": [ + 310 + ], + "declarations": [ + { + "constant": false, + "id": 310, + "name": "headerStartLength", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "2668:25:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 309, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2668:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 313, + "initialValue": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 311, + "name": "headerStart", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 300, + "src": "2696:11:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 312, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2696:18:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2668:46:1" + }, + { + "assignments": [ + 315 + ], + "declarations": [ + { + "constant": false, + "id": 315, + "name": "extraDataLength", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "2718:23:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 314, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2718:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 318, + "initialValue": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 316, + "name": "extraData", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 302, + "src": "2744:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 317, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2744:16:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2718:42:1" + }, + { + "assignments": [ + 320 + ], + "declarations": [ + { + "constant": false, + "id": 320, + "name": "extraDataStart", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "2764:22:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 319, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2764:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 324, + "initialValue": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 323, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 321, + "name": "headerStartLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 310, + "src": "2789:17:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "hexValue": "3332", + "id": 322, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2809:2:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "2789:22:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2764:47:1" + }, + { + "assignments": [ + 326 + ], + "declarations": [ + { + "constant": false, + "id": 326, + "name": "headerEndLength", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "2815:23:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 325, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2815:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 329, + "initialValue": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 327, + "name": "headerEnd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 304, + "src": "2841:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 328, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2841:16:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2815:42:1" + }, + { + "assignments": [ + 331 + ], + "declarations": [ + { + "constant": false, + "id": 331, + "name": "headerEndStart", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "2861:22:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 330, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2861:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 339, + "initialValue": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 338, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 336, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 334, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 332, + "name": "extraDataLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 315, + "src": "2886:15:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "id": 333, + "name": "headerStartLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 310, + "src": "2904:17:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2886:35:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "hexValue": "3332", + "id": 335, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2924:2:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "2886:40:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 337, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2929:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "2886:44:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2861:69:1" + }, + { + "assignments": [ + 341 + ], + "declarations": [ + { + "constant": false, + "id": 341, + "name": "newLength", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "2934:17:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 340, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2934:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 349, + "initialValue": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 348, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 346, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 344, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 342, + "name": "headerStartLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 310, + "src": "2954:17:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "id": 343, + "name": "extraDataLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 315, + "src": "2974:15:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2954:35:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "id": 345, + "name": "headerEndLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 326, + "src": "2992:15:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2954:53:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 347, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3010:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "2954:57:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2934:77:1" + }, + { + "assignments": [ + 351 + ], + "declarations": [ + { + "constant": false, + "id": 351, + "name": "header", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "3046:19:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 350, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3046:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 356, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 354, + "name": "newLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 341, + "src": "3078:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 353, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "3068:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 352, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3072:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 355, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3068:20:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3046:42:1" + }, + { + "externalReferences": [ + { + "headerStart": { + "declaration": 300, + "isOffset": false, + "isSlot": false, + "src": "3184:11:1", + "valueSize": 1 + } + }, + { + "header": { + "declaration": 351, + "isOffset": false, + "isSlot": false, + "src": "3225:6:1", + "valueSize": 1 + } + }, + { + "headerStartLength": { + "declaration": 310, + "isOffset": false, + "isSlot": false, + "src": "3202:17:1", + "valueSize": 1 + } + }, + { + "headerStartLength": { + "declaration": 310, + "isOffset": false, + "isSlot": false, + "src": "3238:17:1", + "valueSize": 1 + } + } + ], + "id": 357, + "nodeType": "InlineAssembly", + "operations": "{\n let ret := staticcall(3000, 4, add(headerStart, 32), headerStartLength, add(header, 32), headerStartLength)\n}", + "src": "3135:136:1" + }, + { + "externalReferences": [ + { + "extraData": { + "declaration": 302, + "isOffset": false, + "isSlot": false, + "src": "3312:9:1", + "valueSize": 1 + } + }, + { + "header": { + "declaration": 351, + "isOffset": false, + "isSlot": false, + "src": "3349:6:1", + "valueSize": 1 + } + }, + { + "extraDataStart": { + "declaration": 320, + "isOffset": false, + "isSlot": false, + "src": "3357:14:1", + "valueSize": 1 + } + }, + { + "extraDataLength": { + "declaration": 315, + "isOffset": false, + "isSlot": false, + "src": "3328:15:1", + "valueSize": 1 + } + }, + { + "extraDataLength": { + "declaration": 315, + "isOffset": false, + "isSlot": false, + "src": "3374:15:1", + "valueSize": 1 + } + } + ], + "id": 358, + "nodeType": "InlineAssembly", + "operations": "{\n let ret := staticcall(3000, 4, add(extraData, 32), extraDataLength, add(header, extraDataStart), extraDataLength)\n}", + "src": "3263:142:1" + }, + { + "externalReferences": [ + { + "header": { + "declaration": 351, + "isOffset": false, + "isSlot": false, + "src": "3483:6:1", + "valueSize": 1 + } + }, + { + "headerEndStart": { + "declaration": 331, + "isOffset": false, + "isSlot": false, + "src": "3491:14:1", + "valueSize": 1 + } + }, + { + "headerEnd": { + "declaration": 304, + "isOffset": false, + "isSlot": false, + "src": "3446:9:1", + "valueSize": 1 + } + }, + { + "headerEndLength": { + "declaration": 326, + "isOffset": false, + "isSlot": false, + "src": "3462:15:1", + "valueSize": 1 + } + }, + { + "headerEndLength": { + "declaration": 326, + "isOffset": false, + "isSlot": false, + "src": "3508:15:1", + "valueSize": 1 + } + } + ], + "id": 359, + "nodeType": "InlineAssembly", + "operations": "{\n let ret := staticcall(3000, 4, add(headerEnd, 32), headerEndLength, add(header, headerEndStart), headerEndLength)\n}", + "src": "3397:141:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 362, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 360, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 307, + "src": "3532:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 361, + "name": "header", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 351, + "src": "3541:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "src": "3532:15:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 363, + "nodeType": "ExpressionStatement", + "src": "3532:15:1" + } + ] + }, + "documentation": null, + "id": 365, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "mergeHash", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 305, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 300, + "name": "headerStart", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "2514:17:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 299, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2514:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 302, + "name": "extraData", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "2533:15:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 301, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2533:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 304, + "name": "headerEnd", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "2550:15:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 303, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2550:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2513:53:1" + }, + "payable": false, + "returnParameters": { + "id": 308, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 307, + "name": "output", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "2590:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 306, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2590:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2589:14:1" + }, + "scope": 400, + "src": "2495:1056:1", + "stateMutability": "view", + "superFunction": null, + "visibility": "internal" + }, + { + "body": { + "id": 398, + "nodeType": "Block", + "src": "3916:71:1", + "statements": [ + { + "body": { + "id": 396, + "nodeType": "Block", + "src": "3950:34:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 394, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 386, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 367, + "src": "3955:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 388, + "indexExpression": { + "argumentTypes": null, + "id": 387, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 377, + "src": "3960:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "3955:7:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 389, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 369, + "src": "3965:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 393, + "indexExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 392, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 390, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 371, + "src": "3971:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "id": 391, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 377, + "src": "3977:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3971:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "3965:14:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "3955:24:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 395, + "nodeType": "ExpressionStatement", + "src": "3955:24:1" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 382, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 380, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 377, + "src": "3935:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "id": 381, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 373, + "src": "3937:6:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3935:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 397, + "initializationExpression": { + "assignments": [ + 377 + ], + "declarations": [ + { + "constant": false, + "id": 377, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 399, + "src": "3925:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 376, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3925:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 379, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 378, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3932:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "3925:8:1" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 384, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "3945:3:1", + "subExpression": { + "argumentTypes": null, + "id": 383, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 377, + "src": "3945:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 385, + "nodeType": "ExpressionStatement", + "src": "3945:3:1" + }, + "nodeType": "ForStatement", + "src": "3920:64:1" + } + ] + }, + "documentation": null, + "id": 399, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "extractData", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 374, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 367, + "name": "data", + "nodeType": "VariableDeclaration", + "scope": 399, + "src": "3853:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 366, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3853:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 369, + "name": "input", + "nodeType": "VariableDeclaration", + "scope": 399, + "src": "3865:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 368, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3865:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 371, + "name": "start", + "nodeType": "VariableDeclaration", + "scope": 399, + "src": "3878:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 370, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3878:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 373, + "name": "length", + "nodeType": "VariableDeclaration", + "scope": 399, + "src": "3890:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 372, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3890:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3852:50:1" + }, + "payable": false, + "returnParameters": { + "id": 375, + "nodeType": "ParameterList", + "parameters": [], + "src": "3916:0:1" + }, + "scope": 400, + "src": "3832:155:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "private" + } + ], + "scope": 401, + "src": "146:3844:1" + } + ], + "src": "94:3897:1" + }, + "legacyAST": { + "absolutePath": "/home/user97/go/src/github.com/validation/contracts/Validation.sol", + "exportedSymbols": { + "Validation": [ + 400 + ] + }, + "id": 401, + "nodeType": "SourceUnit", + "nodes": [ + { + "id": 85, + "literals": [ + "solidity", + "^", + "0.4", + ".23" + ], + "nodeType": "PragmaDirective", + "src": "94:24:1" + }, + { + "absolutePath": "/home/user97/go/src/github.com/validation/contracts/ECVerify.sol", + "file": "./ECVerify.sol", + "id": 86, + "nodeType": "ImportDirective", + "scope": 401, + "sourceUnit": 84, + "src": "120:24:1", + "symbolAliases": [], + "unitAlias": "" + }, + { + "baseContracts": [], + "contractDependencies": [], + "contractKind": "contract", + "documentation": null, + "fullyImplemented": true, + "id": 400, + "linearizedBaseContracts": [ + 400 + ], + "name": "Validation", + "nodeType": "ContractDefinition", + "nodes": [ + { + "constant": false, + "id": 88, + "name": "Owner", + "nodeType": "VariableDeclaration", + "scope": 400, + "src": "169:13:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 87, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "169:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + }, + { + "anonymous": false, + "documentation": null, + "id": 92, + "name": "broadcastSig", + "nodeType": "EventDefinition", + "parameters": { + "id": 91, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 90, + "indexed": false, + "name": "owner", + "nodeType": "VariableDeclaration", + "scope": 92, + "src": "205:13:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 89, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "205:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "204:15:1" + }, + "src": "186:34:1" + }, + { + "anonymous": false, + "documentation": null, + "id": 100, + "name": "broadcastHashData", + "nodeType": "EventDefinition", + "parameters": { + "id": 99, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 94, + "indexed": false, + "name": "header", + "nodeType": "VariableDeclaration", + "scope": 100, + "src": "246:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 93, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "246:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 96, + "indexed": false, + "name": "parentHash", + "nodeType": "VariableDeclaration", + "scope": 100, + "src": "260:16:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 95, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "260:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 98, + "indexed": false, + "name": "rootHash", + "nodeType": "VariableDeclaration", + "scope": 100, + "src": "278:14:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 97, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "278:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "245:48:1" + }, + "src": "222:72:1" + }, + { + "anonymous": false, + "documentation": null, + "id": 104, + "name": "broadcastHash", + "nodeType": "EventDefinition", + "parameters": { + "id": 103, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 102, + "indexed": false, + "name": "blockHash", + "nodeType": "VariableDeclaration", + "scope": 104, + "src": "316:17:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 101, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "316:7:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "315:19:1" + }, + "src": "296:39:1" + }, + { + "constant": false, + "id": 107, + "name": "validators", + "nodeType": "VariableDeclaration", + "scope": 400, + "src": "338:20:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[]" + }, + "typeName": { + "baseType": { + "id": 105, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "338:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 106, + "length": null, + "nodeType": "ArrayTypeName", + "src": "338:9:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", + "typeString": "address[]" + } + }, + "value": null, + "visibility": "internal" + }, + { + "canonicalName": "Validation.BlockHeader", + "id": 110, + "members": [ + { + "constant": false, + "id": 109, + "name": "prevBlockHash", + "nodeType": "VariableDeclaration", + "scope": 110, + "src": "385:21:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 108, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "385:7:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": null, + "visibility": "internal" + } + ], + "name": "BlockHeader", + "nodeType": "StructDefinition", + "scope": 400, + "src": "362:48:1", + "visibility": "public" + }, + { + "constant": false, + "id": 114, + "name": "m_blockheaders", + "nodeType": "VariableDeclaration", + "scope": 400, + "src": "413:54:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_BlockHeader_$110_storage_$", + "typeString": "mapping(bytes32 => struct Validation.BlockHeader)" + }, + "typeName": { + "id": 113, + "keyType": { + "id": 111, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "422:7:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "Mapping", + "src": "413:32:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_bytes32_$_t_struct$_BlockHeader_$110_storage_$", + "typeString": "mapping(bytes32 => struct Validation.BlockHeader)" + }, + "valueType": { + "contractScope": null, + "id": 112, + "name": "BlockHeader", + "nodeType": "UserDefinedTypeName", + "referencedDeclaration": 110, + "src": "433:11:1", + "typeDescriptions": { + "typeIdentifier": "t_struct$_BlockHeader_$110_storage_ptr", + "typeString": "struct Validation.BlockHeader" + } + } + }, + "value": null, + "visibility": "public" + }, + { + "constant": false, + "id": 118, + "name": "m_validators", + "nodeType": "VariableDeclaration", + "scope": 400, + "src": "470:39:1", + "stateVariable": true, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", + "typeString": "mapping(address => bool)" + }, + "typeName": { + "id": 117, + "keyType": { + "id": 115, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "479:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Mapping", + "src": "470:26:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", + "typeString": "mapping(address => bool)" + }, + "valueType": { + "id": 116, + "name": "bool", + "nodeType": "ElementaryTypeName", + "src": "490:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + } + }, + "value": null, + "visibility": "internal" + }, + { + "body": { + "id": 158, + "nodeType": "Block", + "src": "618:158:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 127, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 124, + "name": "Owner", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 88, + "src": "622:5:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 125, + "name": "msg", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 415, + "src": "630:3:1", + "typeDescriptions": { + "typeIdentifier": "t_magic_message", + "typeString": "msg" + } + }, + "id": 126, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "sender", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "630:10:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "src": "622:18:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 128, + "nodeType": "ExpressionStatement", + "src": "622:18:1" + }, + { + "body": { + "id": 156, + "nodeType": "Block", + "src": "690:83:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 143, + "name": "_validators", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 121, + "src": "711:11:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_memory_ptr", + "typeString": "address[] memory" + } + }, + "id": 145, + "indexExpression": { + "argumentTypes": null, + "id": 144, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 130, + "src": "723:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "711:14:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "expression": { + "argumentTypes": null, + "id": 140, + "name": "validators", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 107, + "src": "695:10:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + } + }, + "id": 142, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "push", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "695:15:1", + "typeDescriptions": { + "typeIdentifier": "t_function_arraypush_nonpayable$_t_address_$returns$_t_uint256_$", + "typeString": "function (address) returns (uint256)" + } + }, + "id": 146, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "695:31:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 147, + "nodeType": "ExpressionStatement", + "src": "695:31:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 154, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 148, + "name": "m_validators", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 118, + "src": "731:12:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", + "typeString": "mapping(address => bool)" + } + }, + "id": 152, + "indexExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 149, + "name": "_validators", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 121, + "src": "744:11:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_memory_ptr", + "typeString": "address[] memory" + } + }, + "id": 151, + "indexExpression": { + "argumentTypes": null, + "id": 150, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 130, + "src": "756:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "744:14:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "731:28:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "hexValue": "74727565", + "id": 153, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "762:4:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "src": "731:35:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 155, + "nodeType": "ExpressionStatement", + "src": "731:35:1" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 136, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 133, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 130, + "src": "661:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 134, + "name": "_validators", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 121, + "src": "665:11:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_memory_ptr", + "typeString": "address[] memory" + } + }, + "id": 135, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "665:18:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "661:22:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 157, + "initializationExpression": { + "assignments": [ + 130 + ], + "declarations": [ + { + "constant": false, + "id": 130, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 159, + "src": "649:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 129, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "649:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 132, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 131, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "658:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "649:10:1" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 138, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "685:3:1", + "subExpression": { + "argumentTypes": null, + "id": 137, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 130, + "src": "685:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 139, + "nodeType": "ExpressionStatement", + "src": "685:3:1" + }, + "nodeType": "ForStatement", + "src": "644:129:1" + } + ] + }, + "documentation": null, + "id": 159, + "implemented": true, + "isConstructor": true, + "isDeclaredConst": false, + "modifiers": [], + "name": "", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 122, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 121, + "name": "_validators", + "nodeType": "VariableDeclaration", + "scope": 159, + "src": "588:21:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_memory_ptr", + "typeString": "address[]" + }, + "typeName": { + "baseType": { + "id": 119, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "588:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 120, + "length": null, + "nodeType": "ArrayTypeName", + "src": "588:9:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", + "typeString": "address[]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "587:23:1" + }, + "payable": false, + "returnParameters": { + "id": 123, + "nodeType": "ParameterList", + "parameters": [], + "src": "618:0:1" + }, + "scope": 400, + "src": "575:201:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 167, + "nodeType": "Block", + "src": "888:25:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 165, + "name": "validators", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 107, + "src": "899:10:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage", + "typeString": "address[] storage ref" + } + }, + "functionReturnParameters": 164, + "id": 166, + "nodeType": "Return", + "src": "892:17:1" + } + ] + }, + "documentation": null, + "id": 168, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "GetValidators", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 160, + "nodeType": "ParameterList", + "parameters": [], + "src": "841:2:1" + }, + "payable": false, + "returnParameters": { + "id": 164, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 163, + "name": "_validators", + "nodeType": "VariableDeclaration", + "scope": 168, + "src": "865:21:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_memory_ptr", + "typeString": "address[]" + }, + "typeName": { + "baseType": { + "id": 161, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "865:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "id": 162, + "length": null, + "nodeType": "ArrayTypeName", + "src": "865:9:1", + "typeDescriptions": { + "typeIdentifier": "t_array$_t_address_$dyn_storage_ptr", + "typeString": "address[]" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "864:23:1" + }, + "scope": 400, + "src": "819:94:1", + "stateMutability": "view", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 297, + "nodeType": "Block", + "src": "1220:1272:1", + "statements": [ + { + "assignments": [ + 178 + ], + "declarations": [ + { + "constant": false, + "id": 178, + "name": "length", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "1224:14:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 177, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "1224:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 181, + "initialValue": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 179, + "name": "header", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 170, + "src": "1241:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 180, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "1241:13:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1224:30:1" + }, + { + "assignments": [ + 183 + ], + "declarations": [ + { + "constant": false, + "id": 183, + "name": "blockHash", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "1258:17:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 182, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "1258:7:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 187, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 185, + "name": "header", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 170, + "src": "1288:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 184, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 409, + "src": "1278:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_sha3_pure$__$returns$_t_bytes32_$", + "typeString": "function () pure returns (bytes32)" + } + }, + "id": 186, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1278:17:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1258:37:1" + }, + { + "eventCall": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 189, + "name": "blockHash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 183, + "src": "1319:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + ], + "id": 188, + "name": "broadcastHash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 104, + "src": "1305:13:1", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_bytes32_$returns$__$", + "typeString": "function (bytes32)" + } + }, + "id": 190, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1305:24:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 191, + "nodeType": "EmitStatement", + "src": "1300:29:1" + }, + { + "assignments": [ + 193 + ], + "declarations": [ + { + "constant": false, + "id": 193, + "name": "headerStart", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "1334:24:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 192, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1334:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 200, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 198, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 196, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 178, + "src": "1372:6:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "313431", + "id": 197, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1381:3:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_141_by_1", + "typeString": "int_const 141" + }, + "value": "141" + }, + "src": "1372:12:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 195, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "1362:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 194, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1366:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 199, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1362:23:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1334:51:1" + }, + { + "assignments": [ + 202 + ], + "declarations": [ + { + "constant": false, + "id": 202, + "name": "extraData", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "1389:22:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 201, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1389:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 207, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "3331", + "id": 205, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1426:2:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_31_by_1", + "typeString": "int_const 31" + }, + "value": "31" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_31_by_1", + "typeString": "int_const 31" + } + ], + "id": 204, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "1416:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 203, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1420:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 206, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1416:13:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1389:40:1" + }, + { + "assignments": [ + 209 + ], + "declarations": [ + { + "constant": false, + "id": 209, + "name": "extraDataSig", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "1433:25:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 208, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1433:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 214, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "3635", + "id": 212, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1471:2:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_65_by_1", + "typeString": "int_const 65" + }, + "value": "65" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_65_by_1", + "typeString": "int_const 65" + } + ], + "id": 211, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "1461:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 210, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1465:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 213, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1461:13:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1433:41:1" + }, + { + "assignments": [ + 216 + ], + "declarations": [ + { + "constant": false, + "id": 216, + "name": "headerEnd", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "1478:22:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 215, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1478:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 221, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "hexValue": "3432", + "id": 219, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1515:2:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_42_by_1", + "typeString": "int_const 42" + }, + "value": "42" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_rational_42_by_1", + "typeString": "int_const 42" + } + ], + "id": 218, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "1505:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 217, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1509:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 220, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1505:13:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "1478:40:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 223, + "name": "headerStart", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 193, + "src": "1595:11:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 224, + "name": "header", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 170, + "src": "1608:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "hexValue": "30", + "id": 225, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1616:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 226, + "name": "headerStart", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 193, + "src": "1619:11:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 227, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "1619:18:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 222, + "name": "extractData", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 399, + "src": "1583:11:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_bytes_memory_ptr_$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (bytes memory,bytes memory,uint256,uint256) pure" + } + }, + "id": 228, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1583:55:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 229, + "nodeType": "ExpressionStatement", + "src": "1583:55:1" + }, + { + "externalReferences": [ + { + "prefixHeader": { + "declaration": 172, + "isOffset": false, + "isSlot": false, + "src": "1699:12:1", + "valueSize": 1 + } + }, + { + "headerStart": { + "declaration": 193, + "isOffset": false, + "isSlot": false, + "src": "1725:11:1", + "valueSize": 1 + } + } + ], + "id": 230, + "nodeType": "InlineAssembly", + "operations": "{\n let ret := staticcall(3000, 4, add(prefixHeader, 32), 2, add(headerStart, 33), 2)\n}", + "src": "1642:184:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 232, + "name": "extraData", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 202, + "src": "1827:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 233, + "name": "header", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 170, + "src": "1838:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 236, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 234, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 178, + "src": "1846:6:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "313430", + "id": 235, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "1853:3:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_140_by_1", + "typeString": "int_const 140" + }, + "value": "140" + }, + "src": "1846:10:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 237, + "name": "extraData", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 202, + "src": "1858:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 238, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "1858:16:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 231, + "name": "extractData", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 399, + "src": "1815:11:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_bytes_memory_ptr_$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (bytes memory,bytes memory,uint256,uint256) pure" + } + }, + "id": 239, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "1815:60:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 240, + "nodeType": "ExpressionStatement", + "src": "1815:60:1" + }, + { + "externalReferences": [ + { + "prefixExtraData": { + "declaration": 174, + "isOffset": false, + "isSlot": false, + "src": "1931:15:1", + "valueSize": 1 + } + }, + { + "extraData": { + "declaration": 202, + "isOffset": false, + "isSlot": false, + "src": "1960:9:1", + "valueSize": 1 + } + } + ], + "id": 241, + "nodeType": "InlineAssembly", + "operations": "{\n let ret := staticcall(3000, 4, add(prefixExtraData, 32), 1, add(extraData, 32), 1)\n}", + "src": "1879:153:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 243, + "name": "headerEnd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 216, + "src": "2033:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 244, + "name": "header", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 170, + "src": "2044:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 247, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 245, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 178, + "src": "2052:6:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "3432", + "id": 246, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2059:2:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_42_by_1", + "typeString": "int_const 42" + }, + "value": "42" + }, + "src": "2052:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 248, + "name": "headerEnd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 216, + "src": "2063:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 249, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2063:16:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 242, + "name": "extractData", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 399, + "src": "2021:11:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_bytes_memory_ptr_$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (bytes memory,bytes memory,uint256,uint256) pure" + } + }, + "id": 250, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2021:59:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 251, + "nodeType": "ExpressionStatement", + "src": "2021:59:1" + }, + { + "assignments": [ + 253 + ], + "declarations": [ + { + "constant": false, + "id": 253, + "name": "newHeader", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "2084:22:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 252, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2084:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 259, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 255, + "name": "headerStart", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 193, + "src": "2119:11:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 256, + "name": "extraData", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 202, + "src": "2132:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 257, + "name": "headerEnd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 216, + "src": "2143:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 254, + "name": "mergeHash", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 365, + "src": "2109:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes_memory_ptr_$_t_bytes_memory_ptr_$_t_bytes_memory_ptr_$returns$_t_bytes_memory_ptr_$", + "typeString": "function (bytes memory,bytes memory,bytes memory) view returns (bytes memory)" + } + }, + "id": 258, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2109:44:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2084:69:1" + }, + { + "assignments": [ + 261 + ], + "declarations": [ + { + "constant": false, + "id": 261, + "name": "hashData", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "2158:16:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + "typeName": { + "id": 260, + "name": "bytes32", + "nodeType": "ElementaryTypeName", + "src": "2158:7:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 265, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 263, + "name": "newHeader", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 253, + "src": "2187:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "id": 262, + "name": "keccak256", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 409, + "src": "2177:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_sha3_pure$__$returns$_t_bytes32_$", + "typeString": "function () pure returns (bytes32)" + } + }, + "id": 264, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2177:20:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2158:39:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 267, + "name": "extraDataSig", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 209, + "src": "2266:12:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "id": 268, + "name": "header", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 170, + "src": "2280:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 271, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 269, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 178, + "src": "2288:6:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "-", + "rightExpression": { + "argumentTypes": null, + "hexValue": "313037", + "id": 270, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2295:3:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_107_by_1", + "typeString": "int_const 107" + }, + "value": "107" + }, + "src": "2288:10:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 272, + "name": "extraDataSig", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 209, + "src": "2300:12:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 273, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2300:19:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 266, + "name": "extractData", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 399, + "src": "2254:11:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_pure$_t_bytes_memory_ptr_$_t_bytes_memory_ptr_$_t_uint256_$_t_uint256_$returns$__$", + "typeString": "function (bytes memory,bytes memory,uint256,uint256) pure" + } + }, + "id": 274, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2254:66:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 275, + "nodeType": "ExpressionStatement", + "src": "2254:66:1" + }, + { + "assignments": [ + 277 + ], + "declarations": [ + { + "constant": false, + "id": 277, + "name": "sig_addr", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "2325:16:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + }, + "typeName": { + "id": 276, + "name": "address", + "nodeType": "ElementaryTypeName", + "src": "2325:7:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 283, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 280, + "name": "hashData", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 261, + "src": "2364:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + } + }, + { + "argumentTypes": null, + "id": 281, + "name": "extraDataSig", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 209, + "src": "2374:12:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bytes32", + "typeString": "bytes32" + }, + { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + ], + "expression": { + "argumentTypes": null, + "id": 278, + "name": "ECVerify", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 83, + "src": "2344:8:1", + "typeDescriptions": { + "typeIdentifier": "t_type$_t_contract$_ECVerify_$83_$", + "typeString": "type(library ECVerify)" + } + }, + "id": 279, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "ecrecovery", + "nodeType": "MemberAccess", + "referencedDeclaration": 82, + "src": "2344:19:1", + "typeDescriptions": { + "typeIdentifier": "t_function_internal_view$_t_bytes32_$_t_bytes_memory_ptr_$returns$_t_address_$", + "typeString": "function (bytes32,bytes memory) view returns (address)" + } + }, + "id": 282, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2344:43:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2325:62:1" + }, + { + "expression": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "id": 289, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 285, + "name": "m_validators", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 118, + "src": "2399:12:1", + "typeDescriptions": { + "typeIdentifier": "t_mapping$_t_address_$_t_bool_$", + "typeString": "mapping(address => bool)" + } + }, + "id": 287, + "indexExpression": { + "argumentTypes": null, + "id": 286, + "name": "sig_addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 277, + "src": "2412:8:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "2399:22:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "nodeType": "BinaryOperation", + "operator": "==", + "rightExpression": { + "argumentTypes": null, + "hexValue": "74727565", + "id": 288, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "bool", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2423:4:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + "value": "true" + }, + "src": "2399:28:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + { + "argumentTypes": null, + "hexValue": "5369676e6572206e6f7420612076616c696461746f7221", + "id": 290, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "string", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2429:25:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_stringliteral_ef816ed0202abfa7cc0f5d5cbdb449983f32bdc09af6e4e0cc11d034fd9ef437", + "typeString": "literal_string \"Signer not a validator!\"" + }, + "value": "Signer not a validator!" + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_bool", + "typeString": "bool" + }, + { + "typeIdentifier": "t_stringliteral_ef816ed0202abfa7cc0f5d5cbdb449983f32bdc09af6e4e0cc11d034fd9ef437", + "typeString": "literal_string \"Signer not a validator!\"" + } + ], + "id": 284, + "name": "require", + "nodeType": "Identifier", + "overloadedDeclarations": [ + 418, + 419 + ], + "referencedDeclaration": 419, + "src": "2391:7:1", + "typeDescriptions": { + "typeIdentifier": "t_function_require_pure$_t_bool_$_t_string_memory_ptr_$returns$__$", + "typeString": "function (bool,string memory) pure" + } + }, + "id": 291, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2391:64:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 292, + "nodeType": "ExpressionStatement", + "src": "2391:64:1" + }, + { + "eventCall": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 294, + "name": "sig_addr", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 277, + "src": "2478:8:1", + "typeDescriptions": { + "typeIdentifier": "t_address", + "typeString": "address" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_address", + "typeString": "address" + } + ], + "id": 293, + "name": "broadcastSig", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 92, + "src": "2465:12:1", + "typeDescriptions": { + "typeIdentifier": "t_function_event_nonpayable$_t_address_$returns$__$", + "typeString": "function (address)" + } + }, + "id": 295, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "2465:22:1", + "typeDescriptions": { + "typeIdentifier": "t_tuple$__$", + "typeString": "tuple()" + } + }, + "id": 296, + "nodeType": "EmitStatement", + "src": "2460:27:1" + } + ] + }, + "documentation": null, + "id": 298, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": false, + "modifiers": [], + "name": "ValidateBlock", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 175, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 170, + "name": "header", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "1156:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 169, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1156:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 172, + "name": "prefixHeader", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "1170:18:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 171, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1170:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 174, + "name": "prefixExtraData", + "nodeType": "VariableDeclaration", + "scope": 298, + "src": "1190:21:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 173, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "1190:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "1155:57:1" + }, + "payable": false, + "returnParameters": { + "id": 176, + "nodeType": "ParameterList", + "parameters": [], + "src": "1220:0:1" + }, + "scope": 400, + "src": "1133:1359:1", + "stateMutability": "nonpayable", + "superFunction": null, + "visibility": "public" + }, + { + "body": { + "id": 364, + "nodeType": "Block", + "src": "2604:947:1", + "statements": [ + { + "assignments": [ + 310 + ], + "declarations": [ + { + "constant": false, + "id": 310, + "name": "headerStartLength", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "2668:25:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 309, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2668:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 313, + "initialValue": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 311, + "name": "headerStart", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 300, + "src": "2696:11:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 312, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2696:18:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2668:46:1" + }, + { + "assignments": [ + 315 + ], + "declarations": [ + { + "constant": false, + "id": 315, + "name": "extraDataLength", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "2718:23:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 314, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2718:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 318, + "initialValue": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 316, + "name": "extraData", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 302, + "src": "2744:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 317, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2744:16:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2718:42:1" + }, + { + "assignments": [ + 320 + ], + "declarations": [ + { + "constant": false, + "id": 320, + "name": "extraDataStart", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "2764:22:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 319, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2764:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 324, + "initialValue": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 323, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 321, + "name": "headerStartLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 310, + "src": "2789:17:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "hexValue": "3332", + "id": 322, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2809:2:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "2789:22:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2764:47:1" + }, + { + "assignments": [ + 326 + ], + "declarations": [ + { + "constant": false, + "id": 326, + "name": "headerEndLength", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "2815:23:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 325, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2815:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 329, + "initialValue": { + "argumentTypes": null, + "expression": { + "argumentTypes": null, + "id": 327, + "name": "headerEnd", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 304, + "src": "2841:9:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 328, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "memberName": "length", + "nodeType": "MemberAccess", + "referencedDeclaration": null, + "src": "2841:16:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2815:42:1" + }, + { + "assignments": [ + 331 + ], + "declarations": [ + { + "constant": false, + "id": 331, + "name": "headerEndStart", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "2861:22:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 330, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2861:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 339, + "initialValue": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 338, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 336, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 334, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 332, + "name": "extraDataLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 315, + "src": "2886:15:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "id": 333, + "name": "headerStartLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 310, + "src": "2904:17:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2886:35:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "hexValue": "3332", + "id": 335, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2924:2:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_32_by_1", + "typeString": "int_const 32" + }, + "value": "32" + }, + "src": "2886:40:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 337, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "2929:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "2886:44:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2861:69:1" + }, + { + "assignments": [ + 341 + ], + "declarations": [ + { + "constant": false, + "id": 341, + "name": "newLength", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "2934:17:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 340, + "name": "uint256", + "nodeType": "ElementaryTypeName", + "src": "2934:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 349, + "initialValue": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 348, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 346, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 344, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 342, + "name": "headerStartLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 310, + "src": "2954:17:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "id": 343, + "name": "extraDataLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 315, + "src": "2974:15:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2954:35:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "id": 345, + "name": "headerEndLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 326, + "src": "2992:15:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "2954:53:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "hexValue": "32", + "id": 347, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3010:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_2_by_1", + "typeString": "int_const 2" + }, + "value": "2" + }, + "src": "2954:57:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "2934:77:1" + }, + { + "assignments": [ + 351 + ], + "declarations": [ + { + "constant": false, + "id": 351, + "name": "header", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "3046:19:1", + "stateVariable": false, + "storageLocation": "memory", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 350, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3046:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 356, + "initialValue": { + "argumentTypes": null, + "arguments": [ + { + "argumentTypes": null, + "id": 354, + "name": "newLength", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 341, + "src": "3078:9:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + } + ], + "expression": { + "argumentTypes": [ + { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + ], + "id": 353, + "isConstant": false, + "isLValue": false, + "isPure": true, + "lValueRequested": false, + "nodeType": "NewExpression", + "src": "3068:9:1", + "typeDescriptions": { + "typeIdentifier": "t_function_objectcreation_pure$_t_uint256_$returns$_t_bytes_memory_$", + "typeString": "function (uint256) pure returns (bytes memory)" + }, + "typeName": { + "id": 352, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3072:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + } + }, + "id": 355, + "isConstant": false, + "isLValue": false, + "isPure": false, + "kind": "functionCall", + "lValueRequested": false, + "names": [], + "nodeType": "FunctionCall", + "src": "3068:20:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory", + "typeString": "bytes memory" + } + }, + "nodeType": "VariableDeclarationStatement", + "src": "3046:42:1" + }, + { + "externalReferences": [ + { + "headerStart": { + "declaration": 300, + "isOffset": false, + "isSlot": false, + "src": "3184:11:1", + "valueSize": 1 + } + }, + { + "header": { + "declaration": 351, + "isOffset": false, + "isSlot": false, + "src": "3225:6:1", + "valueSize": 1 + } + }, + { + "headerStartLength": { + "declaration": 310, + "isOffset": false, + "isSlot": false, + "src": "3202:17:1", + "valueSize": 1 + } + }, + { + "headerStartLength": { + "declaration": 310, + "isOffset": false, + "isSlot": false, + "src": "3238:17:1", + "valueSize": 1 + } + } + ], + "id": 357, + "nodeType": "InlineAssembly", + "operations": "{\n let ret := staticcall(3000, 4, add(headerStart, 32), headerStartLength, add(header, 32), headerStartLength)\n}", + "src": "3135:136:1" + }, + { + "externalReferences": [ + { + "extraData": { + "declaration": 302, + "isOffset": false, + "isSlot": false, + "src": "3312:9:1", + "valueSize": 1 + } + }, + { + "header": { + "declaration": 351, + "isOffset": false, + "isSlot": false, + "src": "3349:6:1", + "valueSize": 1 + } + }, + { + "extraDataStart": { + "declaration": 320, + "isOffset": false, + "isSlot": false, + "src": "3357:14:1", + "valueSize": 1 + } + }, + { + "extraDataLength": { + "declaration": 315, + "isOffset": false, + "isSlot": false, + "src": "3328:15:1", + "valueSize": 1 + } + }, + { + "extraDataLength": { + "declaration": 315, + "isOffset": false, + "isSlot": false, + "src": "3374:15:1", + "valueSize": 1 + } + } + ], + "id": 358, + "nodeType": "InlineAssembly", + "operations": "{\n let ret := staticcall(3000, 4, add(extraData, 32), extraDataLength, add(header, extraDataStart), extraDataLength)\n}", + "src": "3263:142:1" + }, + { + "externalReferences": [ + { + "header": { + "declaration": 351, + "isOffset": false, + "isSlot": false, + "src": "3483:6:1", + "valueSize": 1 + } + }, + { + "headerEndStart": { + "declaration": 331, + "isOffset": false, + "isSlot": false, + "src": "3491:14:1", + "valueSize": 1 + } + }, + { + "headerEnd": { + "declaration": 304, + "isOffset": false, + "isSlot": false, + "src": "3446:9:1", + "valueSize": 1 + } + }, + { + "headerEndLength": { + "declaration": 326, + "isOffset": false, + "isSlot": false, + "src": "3462:15:1", + "valueSize": 1 + } + }, + { + "headerEndLength": { + "declaration": 326, + "isOffset": false, + "isSlot": false, + "src": "3508:15:1", + "valueSize": 1 + } + } + ], + "id": 359, + "nodeType": "InlineAssembly", + "operations": "{\n let ret := staticcall(3000, 4, add(headerEnd, 32), headerEndLength, add(header, headerEndStart), headerEndLength)\n}", + "src": "3397:141:1" + }, + { + "expression": { + "argumentTypes": null, + "id": 362, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "id": 360, + "name": "output", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 307, + "src": "3532:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "id": 361, + "name": "header", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 351, + "src": "3541:6:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "src": "3532:15:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 363, + "nodeType": "ExpressionStatement", + "src": "3532:15:1" + } + ] + }, + "documentation": null, + "id": 365, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "mergeHash", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 305, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 300, + "name": "headerStart", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "2514:17:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 299, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2514:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 302, + "name": "extraData", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "2533:15:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 301, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2533:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 304, + "name": "headerEnd", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "2550:15:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 303, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2550:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2513:53:1" + }, + "payable": false, + "returnParameters": { + "id": 308, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 307, + "name": "output", + "nodeType": "VariableDeclaration", + "scope": 365, + "src": "2590:12:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 306, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "2590:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "2589:14:1" + }, + "scope": 400, + "src": "2495:1056:1", + "stateMutability": "view", + "superFunction": null, + "visibility": "internal" + }, + { + "body": { + "id": 398, + "nodeType": "Block", + "src": "3916:71:1", + "statements": [ + { + "body": { + "id": 396, + "nodeType": "Block", + "src": "3950:34:1", + "statements": [ + { + "expression": { + "argumentTypes": null, + "id": 394, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 386, + "name": "data", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 367, + "src": "3955:4:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 388, + "indexExpression": { + "argumentTypes": null, + "id": 387, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 377, + "src": "3960:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": true, + "nodeType": "IndexAccess", + "src": "3955:7:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "nodeType": "Assignment", + "operator": "=", + "rightHandSide": { + "argumentTypes": null, + "baseExpression": { + "argumentTypes": null, + "id": 389, + "name": "input", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 369, + "src": "3965:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes memory" + } + }, + "id": 393, + "indexExpression": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 392, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 390, + "name": "start", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 371, + "src": "3971:5:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "+", + "rightExpression": { + "argumentTypes": null, + "id": 391, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 377, + "src": "3977:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3971:7:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "isConstant": false, + "isLValue": true, + "isPure": false, + "lValueRequested": false, + "nodeType": "IndexAccess", + "src": "3965:14:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "src": "3955:24:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes1", + "typeString": "bytes1" + } + }, + "id": 395, + "nodeType": "ExpressionStatement", + "src": "3955:24:1" + } + ] + }, + "condition": { + "argumentTypes": null, + "commonType": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "id": 382, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "leftExpression": { + "argumentTypes": null, + "id": 380, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 377, + "src": "3935:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "nodeType": "BinaryOperation", + "operator": "<", + "rightExpression": { + "argumentTypes": null, + "id": 381, + "name": "length", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 373, + "src": "3937:6:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "src": "3935:8:1", + "typeDescriptions": { + "typeIdentifier": "t_bool", + "typeString": "bool" + } + }, + "id": 397, + "initializationExpression": { + "assignments": [ + 377 + ], + "declarations": [ + { + "constant": false, + "id": 377, + "name": "i", + "nodeType": "VariableDeclaration", + "scope": 399, + "src": "3925:6:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 376, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3925:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "id": 379, + "initialValue": { + "argumentTypes": null, + "hexValue": "30", + "id": 378, + "isConstant": false, + "isLValue": false, + "isPure": true, + "kind": "number", + "lValueRequested": false, + "nodeType": "Literal", + "src": "3932:1:1", + "subdenomination": null, + "typeDescriptions": { + "typeIdentifier": "t_rational_0_by_1", + "typeString": "int_const 0" + }, + "value": "0" + }, + "nodeType": "VariableDeclarationStatement", + "src": "3925:8:1" + }, + "loopExpression": { + "expression": { + "argumentTypes": null, + "id": 384, + "isConstant": false, + "isLValue": false, + "isPure": false, + "lValueRequested": false, + "nodeType": "UnaryOperation", + "operator": "++", + "prefix": false, + "src": "3945:3:1", + "subExpression": { + "argumentTypes": null, + "id": 383, + "name": "i", + "nodeType": "Identifier", + "overloadedDeclarations": [], + "referencedDeclaration": 377, + "src": "3945:1:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "id": 385, + "nodeType": "ExpressionStatement", + "src": "3945:3:1" + }, + "nodeType": "ForStatement", + "src": "3920:64:1" + } + ] + }, + "documentation": null, + "id": 399, + "implemented": true, + "isConstructor": false, + "isDeclaredConst": true, + "modifiers": [], + "name": "extractData", + "nodeType": "FunctionDefinition", + "parameters": { + "id": 374, + "nodeType": "ParameterList", + "parameters": [ + { + "constant": false, + "id": 367, + "name": "data", + "nodeType": "VariableDeclaration", + "scope": 399, + "src": "3853:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 366, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3853:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 369, + "name": "input", + "nodeType": "VariableDeclaration", + "scope": 399, + "src": "3865:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_bytes_memory_ptr", + "typeString": "bytes" + }, + "typeName": { + "id": 368, + "name": "bytes", + "nodeType": "ElementaryTypeName", + "src": "3865:5:1", + "typeDescriptions": { + "typeIdentifier": "t_bytes_storage_ptr", + "typeString": "bytes" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 371, + "name": "start", + "nodeType": "VariableDeclaration", + "scope": 399, + "src": "3878:10:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 370, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3878:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + }, + { + "constant": false, + "id": 373, + "name": "length", + "nodeType": "VariableDeclaration", + "scope": 399, + "src": "3890:11:1", + "stateVariable": false, + "storageLocation": "default", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + }, + "typeName": { + "id": 372, + "name": "uint", + "nodeType": "ElementaryTypeName", + "src": "3890:4:1", + "typeDescriptions": { + "typeIdentifier": "t_uint256", + "typeString": "uint256" + } + }, + "value": null, + "visibility": "internal" + } + ], + "src": "3852:50:1" + }, + "payable": false, + "returnParameters": { + "id": 375, + "nodeType": "ParameterList", + "parameters": [], + "src": "3916:0:1" + }, + "scope": 400, + "src": "3832:155:1", + "stateMutability": "pure", + "superFunction": null, + "visibility": "private" + } + ], + "scope": 401, + "src": "146:3844:1" + } + ], + "src": "94:3897:1" + }, + "compiler": { + "name": "solc", + "version": "0.4.23+commit.124ca40d.Emscripten.clang" + }, + "networks": { + "1515": { + "events": {}, + "links": {}, + "address": "0xb9fd43a71c076f02d1dbbf473c389f0eacec559f", + "transactionHash": "0x92a74f58feb5df718c75e696a2b7fb1489300917803034e1ca1c0df95461e955" + } + }, + "schemaVersion": "2.0.0", + "updatedAt": "2018-06-23T09:57:05.921Z" +} \ No newline at end of file diff --git a/contracts/Validation.sol b/contracts/Validation.sol new file mode 100644 index 0000000..083c4d8 --- /dev/null +++ b/contracts/Validation.sol @@ -0,0 +1,122 @@ +// Copyright (c) 2016-2018 Clearmatics Technologies Ltd +// SPDX-License-Identifier: LGPL-3.0+ +pragma solidity ^0.4.23; + +import "./ECVerify.sol"; + +contract Validation { + address Owner; + + event broadcastSig(address owner); + event broadcastHashData(bytes header, bytes parentHash, bytes rootHash); + event broadcastHash(bytes32 blockHash); + + address[] validators; + + struct BlockHeader { + bytes32 prevBlockHash; + } + + mapping (bytes32 => BlockHeader) public m_blockheaders; + mapping( address => bool ) m_validators; + + /* + * @param _validators list of validators at block 0 + */ + constructor (address[] _validators) public { + Owner = msg.sender; + for (uint i = 0; i < _validators.length; i++) { + validators.push(_validators[i]); + m_validators[_validators[i]] = true; + } + } + + /* + * Returns the validators array + */ + function GetValidators() public view returns (address[] _validators) { + return validators; + } + + /* + * @param header header rlp encoded, with extraData signatures removed + * @param prefixHeader the new prefix for the signed hash header + * @param prefixExtraData the new prefix for the extraData field + */ + function ValidateBlock(bytes header, bytes prefixHeader, bytes prefixExtraData) public { + uint256 length = header.length; + bytes32 blockHash = keccak256(header); + + emit broadcastHash(blockHash); + + bytes memory headerStart = new bytes(length - 141); + bytes memory extraData = new bytes(31); + bytes memory extraDataSig = new bytes(65); + bytes memory headerEnd = new bytes(42); + + // Extract the start of the header and replace the length + extractData(headerStart, header, 0, headerStart.length); + assembly { + let ret := staticcall(3000, 4, add(prefixHeader, 32), 2, add(headerStart, 33), 2) + } + + // Extract the real extra data and create the signed hash + extractData(extraData, header, length-140, extraData.length); + assembly { + let ret := staticcall(3000, 4, add(prefixExtraData, 32), 1, add(extraData, 32), 1) + } + + // Extract the end of the header + extractData(headerEnd, header, length-42, headerEnd.length); + bytes memory newHeader = mergeHash(headerStart, extraData, headerEnd); + + bytes32 hashData = keccak256(newHeader); + + // Extract the signature of the hash create above + extractData(extraDataSig, header, length-107, extraDataSig.length); + + address sig_addr = ECVerify.ecrecovery(hashData, extraDataSig); + require(m_validators[sig_addr]==true, "Signer not a validator!"); + + emit broadcastSig(sig_addr); + + } + + function mergeHash(bytes headerStart, bytes extraData, bytes headerEnd) internal view returns (bytes output) { + // Get the lengths sorted because they're needed later... + uint256 headerStartLength = headerStart.length; + uint256 extraDataLength = extraData.length; + uint256 extraDataStart = headerStartLength + 32; + uint256 headerEndLength = headerEnd.length; + uint256 headerEndStart = extraDataLength + headerStartLength + 32 + 2; + uint256 newLength = headerStartLength + extraDataLength + headerEndLength + 2; // extra two is for the prefix + bytes memory header = new bytes(newLength); + + + // Add in the first part of the header + assembly { + let ret := staticcall(3000, 4, add(headerStart, 32), headerStartLength, add(header, 32), headerStartLength) + } + assembly { + let ret := staticcall(3000, 4, add(extraData, 32), extraDataLength, add(header, extraDataStart), extraDataLength) + } + assembly { + let ret := staticcall(3000, 4, add(headerEnd, 32), headerEndLength, add(header, headerEndStart), headerEndLength) + } + + output = header; + } + + /* + * @param data memory allocation for the data you need to extract + * @param sig array from which the data should be extracted + * @param start index which the data starts within the byte array + * @param length total length of the data to be extracted + */ + function extractData(bytes data, bytes input, uint start, uint length) private pure { + for (uint i=0; i { try { deployer.deploy(Recover) .then(() => Recover.deployed) + .then(() => deployer.deploy(Validation, ["0x2be5ab0e43b6dc2908d5321cf318f35b80d0c10d", "0x8671e5e08d74f338ee1c462340842346d797afd3"])) + .then(() => Validation.deployed) } catch(err) { console.log('ERROR on deploy:',err); } diff --git a/package.json b/package.json index 6e1f49c..ff0734c 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,9 @@ "dependencies": { "babel-preset-node6": "^11.0.0", "crypto-js": "^3.1.9-1", + "elliptic": "^6.4.0", + "ethereumjs-util": "^5.2.0", + "ethjs-util": "^0.1.6", "rlp": "^2.0.0", "solc": "^0.4.23", "solhint": "^1.1.10", diff --git a/poa-network/node1/geth/LOCK b/poa-network/node1/geth/LOCK deleted file mode 100644 index e69de29..0000000 diff --git a/poa-network/node1/geth/chaindata/000002.ldb b/poa-network/node1/geth/chaindata/000002.ldb deleted file mode 100644 index da84b4e..0000000 Binary files a/poa-network/node1/geth/chaindata/000002.ldb and /dev/null differ diff --git a/poa-network/node1/geth/chaindata/000003.log b/poa-network/node1/geth/chaindata/000003.log deleted file mode 100644 index 43e84b6..0000000 Binary files a/poa-network/node1/geth/chaindata/000003.log and /dev/null differ diff --git a/poa-network/node1/geth/chaindata/CURRENT b/poa-network/node1/geth/chaindata/CURRENT deleted file mode 100644 index cacca75..0000000 --- a/poa-network/node1/geth/chaindata/CURRENT +++ /dev/null @@ -1 +0,0 @@ -MANIFEST-000004 diff --git a/poa-network/node1/geth/chaindata/LOCK b/poa-network/node1/geth/chaindata/LOCK deleted file mode 100644 index e69de29..0000000 diff --git a/poa-network/node1/geth/chaindata/LOG b/poa-network/node1/geth/chaindata/LOG deleted file mode 100644 index 3c1eac3..0000000 --- a/poa-network/node1/geth/chaindata/LOG +++ /dev/null @@ -1,16 +0,0 @@ -=============== Jun 18, 2018 (BST) =============== -13:49:18.902555 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed -13:49:18.920597 db@open opening -13:49:18.921692 version@stat F·[] S·0B[] Sc·[] -13:49:18.929190 db@janitor F·2 G·0 -13:49:18.929215 db@open done T·8.580111ms -=============== Jun 18, 2018 (BST) =============== -13:49:19.076657 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed -13:49:19.076783 version@stat F·[] S·0B[] Sc·[] -13:49:19.076793 db@open opening -13:49:19.076832 journal@recovery F·1 -13:49:19.080106 journal@recovery recovering @1 -13:49:19.088013 memdb@flush created L0@2 N·14 S·988B "9\x9c\x91..\x1dj\xe0,v3":"\xdb7C..b\xf5\xdc,v5" -13:49:19.090736 version@stat F·[1] S·988B[988B] Sc·[0.25] -13:49:19.117852 db@janitor F·3 G·0 -13:49:19.117874 db@open done T·41.073175ms diff --git a/poa-network/node1/geth/chaindata/MANIFEST-000004 b/poa-network/node1/geth/chaindata/MANIFEST-000004 deleted file mode 100644 index 5f112cf..0000000 Binary files a/poa-network/node1/geth/chaindata/MANIFEST-000004 and /dev/null differ diff --git a/poa-network/node1/geth/lightchaindata/000001.log b/poa-network/node1/geth/lightchaindata/000001.log deleted file mode 100644 index febc93f..0000000 Binary files a/poa-network/node1/geth/lightchaindata/000001.log and /dev/null differ diff --git a/poa-network/node1/geth/lightchaindata/CURRENT b/poa-network/node1/geth/lightchaindata/CURRENT deleted file mode 100644 index feda7d6..0000000 --- a/poa-network/node1/geth/lightchaindata/CURRENT +++ /dev/null @@ -1 +0,0 @@ -MANIFEST-000000 diff --git a/poa-network/node1/geth/lightchaindata/LOCK b/poa-network/node1/geth/lightchaindata/LOCK deleted file mode 100644 index e69de29..0000000 diff --git a/poa-network/node1/geth/lightchaindata/LOG b/poa-network/node1/geth/lightchaindata/LOG deleted file mode 100644 index 6198740..0000000 --- a/poa-network/node1/geth/lightchaindata/LOG +++ /dev/null @@ -1,6 +0,0 @@ -=============== Jun 18, 2018 (BST) =============== -13:49:18.930679 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed -13:49:18.953306 db@open opening -13:49:18.955219 version@stat F·[] S·0B[] Sc·[] -13:49:18.975683 db@janitor F·2 G·0 -13:49:18.975770 db@open done T·22.275818ms diff --git a/poa-network/node1/geth/lightchaindata/MANIFEST-000000 b/poa-network/node1/geth/lightchaindata/MANIFEST-000000 deleted file mode 100644 index 9d54f67..0000000 Binary files a/poa-network/node1/geth/lightchaindata/MANIFEST-000000 and /dev/null differ diff --git a/poa-network/node1/geth/nodekey b/poa-network/node1/geth/nodekey deleted file mode 100644 index f0e832a..0000000 --- a/poa-network/node1/geth/nodekey +++ /dev/null @@ -1 +0,0 @@ -55b0e096abbed00a2ff7b77c629a15574e8ee2cc3accf6fbb82c67d8acba7c97 \ No newline at end of file diff --git a/poa-network/node1/geth/nodes/000001.log b/poa-network/node1/geth/nodes/000001.log deleted file mode 100644 index e6aee9f..0000000 Binary files a/poa-network/node1/geth/nodes/000001.log and /dev/null differ diff --git a/poa-network/node1/geth/nodes/CURRENT b/poa-network/node1/geth/nodes/CURRENT deleted file mode 100644 index feda7d6..0000000 --- a/poa-network/node1/geth/nodes/CURRENT +++ /dev/null @@ -1 +0,0 @@ -MANIFEST-000000 diff --git a/poa-network/node1/geth/nodes/LOCK b/poa-network/node1/geth/nodes/LOCK deleted file mode 100644 index e69de29..0000000 diff --git a/poa-network/node1/geth/nodes/LOG b/poa-network/node1/geth/nodes/LOG deleted file mode 100644 index ab40441..0000000 --- a/poa-network/node1/geth/nodes/LOG +++ /dev/null @@ -1,6 +0,0 @@ -=============== Jun 18, 2018 (BST) =============== -13:49:21.220200 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed -13:49:21.244211 db@open opening -13:49:21.250135 version@stat F·[] S·0B[] Sc·[] -13:49:21.266058 db@janitor F·2 G·0 -13:49:21.266153 db@open done T·21.892415ms diff --git a/poa-network/node1/geth/nodes/MANIFEST-000000 b/poa-network/node1/geth/nodes/MANIFEST-000000 deleted file mode 100644 index 9d54f67..0000000 Binary files a/poa-network/node1/geth/nodes/MANIFEST-000000 and /dev/null differ diff --git a/poa-network/node1/geth/transactions.rlp b/poa-network/node1/geth/transactions.rlp deleted file mode 100755 index 5e972be..0000000 Binary files a/poa-network/node1/geth/transactions.rlp and /dev/null differ diff --git a/poa-network/node2/geth/LOCK b/poa-network/node2/geth/LOCK deleted file mode 100644 index e69de29..0000000 diff --git a/poa-network/node2/geth/chaindata/000002.ldb b/poa-network/node2/geth/chaindata/000002.ldb deleted file mode 100644 index 9306c97..0000000 Binary files a/poa-network/node2/geth/chaindata/000002.ldb and /dev/null differ diff --git a/poa-network/node2/geth/chaindata/000003.log b/poa-network/node2/geth/chaindata/000003.log deleted file mode 100644 index 59fa9e5..0000000 Binary files a/poa-network/node2/geth/chaindata/000003.log and /dev/null differ diff --git a/poa-network/node2/geth/chaindata/CURRENT b/poa-network/node2/geth/chaindata/CURRENT deleted file mode 100644 index cacca75..0000000 --- a/poa-network/node2/geth/chaindata/CURRENT +++ /dev/null @@ -1 +0,0 @@ -MANIFEST-000004 diff --git a/poa-network/node2/geth/chaindata/LOCK b/poa-network/node2/geth/chaindata/LOCK deleted file mode 100644 index e69de29..0000000 diff --git a/poa-network/node2/geth/chaindata/LOG b/poa-network/node2/geth/chaindata/LOG deleted file mode 100644 index 18694b7..0000000 --- a/poa-network/node2/geth/chaindata/LOG +++ /dev/null @@ -1,16 +0,0 @@ -=============== Jun 18, 2018 (BST) =============== -13:49:18.932537 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed -13:49:18.960656 db@open opening -13:49:18.963041 version@stat F·[] S·0B[] Sc·[] -13:49:18.975695 db@janitor F·2 G·0 -13:49:18.975776 db@open done T·14.761021ms -=============== Jun 18, 2018 (BST) =============== -13:49:19.084033 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed -13:49:19.084126 version@stat F·[] S·0B[] Sc·[] -13:49:19.084133 db@open opening -13:49:19.084165 journal@recovery F·1 -13:49:19.086750 journal@recovery recovering @1 -13:49:19.096014 memdb@flush created L0@2 N·14 S·988B "9\x9c\x91..\x1dj\xe0,v4":"\xdb7C..b\xf5\xdc,v5" -13:49:19.098689 version@stat F·[1] S·988B[988B] Sc·[0.25] -13:49:19.125842 db@janitor F·3 G·0 -13:49:19.125862 db@open done T·41.722393ms diff --git a/poa-network/node2/geth/chaindata/MANIFEST-000004 b/poa-network/node2/geth/chaindata/MANIFEST-000004 deleted file mode 100644 index ebb5815..0000000 Binary files a/poa-network/node2/geth/chaindata/MANIFEST-000004 and /dev/null differ diff --git a/poa-network/node2/geth/lightchaindata/000001.log b/poa-network/node2/geth/lightchaindata/000001.log deleted file mode 100644 index febc93f..0000000 Binary files a/poa-network/node2/geth/lightchaindata/000001.log and /dev/null differ diff --git a/poa-network/node2/geth/lightchaindata/CURRENT b/poa-network/node2/geth/lightchaindata/CURRENT deleted file mode 100644 index feda7d6..0000000 --- a/poa-network/node2/geth/lightchaindata/CURRENT +++ /dev/null @@ -1 +0,0 @@ -MANIFEST-000000 diff --git a/poa-network/node2/geth/lightchaindata/LOCK b/poa-network/node2/geth/lightchaindata/LOCK deleted file mode 100644 index e69de29..0000000 diff --git a/poa-network/node2/geth/lightchaindata/LOG b/poa-network/node2/geth/lightchaindata/LOG deleted file mode 100644 index 07e7319..0000000 --- a/poa-network/node2/geth/lightchaindata/LOG +++ /dev/null @@ -1,6 +0,0 @@ -=============== Jun 18, 2018 (BST) =============== -13:49:18.978525 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed -13:49:18.993361 db@open opening -13:49:19.000791 version@stat F·[] S·0B[] Sc·[] -13:49:19.009215 db@janitor F·2 G·0 -13:49:19.009290 db@open done T·15.873047ms diff --git a/poa-network/node2/geth/lightchaindata/MANIFEST-000000 b/poa-network/node2/geth/lightchaindata/MANIFEST-000000 deleted file mode 100644 index 9d54f67..0000000 Binary files a/poa-network/node2/geth/lightchaindata/MANIFEST-000000 and /dev/null differ diff --git a/poa-network/node2/geth/nodekey b/poa-network/node2/geth/nodekey deleted file mode 100644 index 9aa677d..0000000 --- a/poa-network/node2/geth/nodekey +++ /dev/null @@ -1 +0,0 @@ -28d41ae2d1992b010525be5ecd322efd65855444a4278206bab072577d094ced \ No newline at end of file diff --git a/poa-network/node2/geth/nodes/000001.log b/poa-network/node2/geth/nodes/000001.log deleted file mode 100644 index 1486875..0000000 Binary files a/poa-network/node2/geth/nodes/000001.log and /dev/null differ diff --git a/poa-network/node2/geth/nodes/CURRENT b/poa-network/node2/geth/nodes/CURRENT deleted file mode 100644 index feda7d6..0000000 --- a/poa-network/node2/geth/nodes/CURRENT +++ /dev/null @@ -1 +0,0 @@ -MANIFEST-000000 diff --git a/poa-network/node2/geth/nodes/LOCK b/poa-network/node2/geth/nodes/LOCK deleted file mode 100644 index e69de29..0000000 diff --git a/poa-network/node2/geth/nodes/LOG b/poa-network/node2/geth/nodes/LOG deleted file mode 100644 index f704095..0000000 --- a/poa-network/node2/geth/nodes/LOG +++ /dev/null @@ -1,6 +0,0 @@ -=============== Jun 18, 2018 (BST) =============== -13:49:21.228055 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed -13:49:21.251692 db@open opening -13:49:21.257200 version@stat F·[] S·0B[] Sc·[] -13:49:21.266056 db@janitor F·2 G·0 -13:49:21.266155 db@open done T·14.406188ms diff --git a/poa-network/node2/geth/nodes/MANIFEST-000000 b/poa-network/node2/geth/nodes/MANIFEST-000000 deleted file mode 100644 index 9d54f67..0000000 Binary files a/poa-network/node2/geth/nodes/MANIFEST-000000 and /dev/null differ diff --git a/poa-network/node2/geth/transactions.rlp b/poa-network/node2/geth/transactions.rlp deleted file mode 100755 index e69de29..0000000 diff --git a/src/Makefile b/src/Makefile index 895f467..76bed69 100644 --- a/src/Makefile +++ b/src/Makefile @@ -4,10 +4,10 @@ PACKAGES = $(shell find ./ -type d -not -path "./vendor" -not -path "./vendor/*" SHELL=/bin/bash clean: - @rm -f cli-tool + @rm -f ion-cli -#test: -# @go test ./... -v +test: + @go test ./... -v format: @gofmt -s -w ${GOFILES_NOVENDOR} @@ -19,8 +19,8 @@ coverage: tail -n +2 coverage.out >> coverage-all.out;) go tool cover -html=coverage-all.out -run: - @go build -o cli-tool . +build: + @go build -o ion-cli . check: @if [ -n "$(shell gofmt -l ${GOFILES_NOVENDOR})" ]; then \ diff --git a/src/Validation/Validation.go b/src/Validation/Validation.go new file mode 100644 index 0000000..18e9228 --- /dev/null +++ b/src/Validation/Validation.go @@ -0,0 +1,591 @@ +// Code generated - DO NOT EDIT. +// This file is a generated binding and any manual changes will be lost. + +package Validation + +import ( + "strings" + + ethereum "github.com/ethereum/go-ethereum" + "github.com/ethereum/go-ethereum/accounts/abi" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/event" +) + +// ValidationABI is the input ABI used to generate the binding from. +const ValidationABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"header\",\"type\":\"bytes\"},{\"name\":\"prefixHeader\",\"type\":\"bytes\"},{\"name\":\"prefixExtraData\",\"type\":\"bytes\"}],\"name\":\"ValidateBlock\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"GetValidators\",\"outputs\":[{\"name\":\"_validators\",\"type\":\"address[]\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"_validators\",\"type\":\"address[]\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"broadcastSig\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"header\",\"type\":\"bytes\"},{\"indexed\":false,\"name\":\"parentHash\",\"type\":\"bytes\"},{\"indexed\":false,\"name\":\"rootHash\",\"type\":\"bytes\"}],\"name\":\"broadcastHashData\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"blockHash\",\"type\":\"bytes32\"}],\"name\":\"broadcastHash\",\"type\":\"event\"}]" + +// ValidationBin is the compiled bytecode used for deploying new contracts. +const ValidationBin = `608060405234801561001057600080fd5b506040516109d73803806109d7833981018060405281019080805182019291905050506000336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600090505b815181101561017c576001828281518110151561009357fe5b9060200190602002015190806001815401808255809150509060018203906000526020600020016000909192909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050600160026000848481518110151561011457fe5b9060200190602002015173ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff021916908315150217905550808060010191505061007a565b505061084a8061018d6000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff168063aae933e414610051578063d405af3d14610146575b600080fd5b34801561005d57600080fd5b50610144600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290803590602001908201803590602001908080601f01602080910402602001604051908101604052809392919081815260200183838082843782019150505050505091929192905050506101b2565b005b34801561015257600080fd5b5061015b610561565b6040518080602001828103825283818151815260200191508051906020019060200280838360005b8381101561019e578082015181840152602081019050610183565b505050509050019250505060405180910390f35b60008060608060608060606000808b5198508b6040518082805190602001908083835b6020831015156101fa57805182526020820191506020810190506020830392506101d5565b6001836020036101000a038019825116818451168082178552505050505050905001915050604051809103902097507fcd7ee33e1a630d6301d87631aab1d4ddce7e1942593cd2689aa989f76d67cf018860405180826000191660001916815260200191505060405180910390a1608d89036040519080825280601f01601f19166020018201604052801561029e5781602001602082028038833980820191505090505b509650601f6040519080825280601f01601f1916602001820160405280156102d55781602001602082028038833980820191505090505b50955060416040519080825280601f01601f19166020018201604052801561030c5781602001602082028038833980820191505090505b509450602a6040519080825280601f01601f1916602001820160405280156103435781602001602082028038833980820191505090505b509350610354878d60008a516105ef565b600260218801600260208e016004610bb8fa50610377868d608c8c0389516105ef565b600160208701600160208d016004610bb8fa5061039a848d602a8c0387516105ef565b6103a58787866106aa565b9250826040518082805190602001908083835b6020831015156103dd57805182526020820191506020810190506020830392506103b8565b6001836020036101000a0380198251168184511680821785525050505050509050019150506040518091039020915061041c858d606b8c0388516105ef565b6104268286610756565b905060011515600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1615151415156104f0576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260178152602001807f5369676e6572206e6f7420612076616c696461746f722100000000000000000081525060200191505060405180910390fd5b7fba2fe28067a0918af64c5359b1579f887bf1479dd3163c7e5d456314168854a581604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a1505050505050505050505050565b606060018054806020026020016040519081016040528092919081815260200182805480156105e557602002820191906000526020600020905b8160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001906001019080831161059b575b5050505050905090565b60008090505b818110156106a3578381840181518110151561060d57fe5b9060200101517f010000000000000000000000000000000000000000000000000000000000000090047f010000000000000000000000000000000000000000000000000000000000000002858281518110151561066657fe5b9060200101907effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916908160001a90535080806001019150506105f5565b5050505050565b606060008060008060008060608a5196508951955060208701945088519350600260208888010101925060028487890101019150816040519080825280601f01601f1916602001820160405280156107115781602001602082028038833980820191505090505b50905086602082018860208e016004610bb8fa50858582018760208d016004610bb8fa50838382018560208c016004610bb8fa50809750505050505050509392505050565b6000806000806041855114151561076c57600080fd5b6020850151925060408501519150606085015160001a9050601b8160ff16101561079757601b810190505b601b8160ff1614806107ac5750601c8160ff16145b15156107b757600080fd5b6107c3868285856107ce565b935050505092915050565b60008060006040518781528660208201528560408201528460608201526020816080836001610bb8fa925080519150506001151582151514151561081157600080fd5b80925050509493505050505600a165627a7a72305820bfdda3defd1a9101b13153fe900905c379572f205ad37b4197c70cdd78be35e20029` + +// DeployValidation deploys a new Ethereum contract, binding an instance of Validation to it. +func DeployValidation(auth *bind.TransactOpts, backend bind.ContractBackend, _validators []common.Address) (common.Address, *types.Transaction, *Validation, error) { + parsed, err := abi.JSON(strings.NewReader(ValidationABI)) + if err != nil { + return common.Address{}, nil, nil, err + } + address, tx, contract, err := bind.DeployContract(auth, parsed, common.FromHex(ValidationBin), backend, _validators) + if err != nil { + return common.Address{}, nil, nil, err + } + return address, tx, &Validation{ValidationCaller: ValidationCaller{contract: contract}, ValidationTransactor: ValidationTransactor{contract: contract}, ValidationFilterer: ValidationFilterer{contract: contract}}, nil +} + +// Validation is an auto generated Go binding around an Ethereum contract. +type Validation struct { + ValidationCaller // Read-only binding to the contract + ValidationTransactor // Write-only binding to the contract + ValidationFilterer // Log filterer for contract events +} + +// ValidationCaller is an auto generated read-only Go binding around an Ethereum contract. +type ValidationCaller struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ValidationTransactor is an auto generated write-only Go binding around an Ethereum contract. +type ValidationTransactor struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ValidationFilterer is an auto generated log filtering Go binding around an Ethereum contract events. +type ValidationFilterer struct { + contract *bind.BoundContract // Generic contract wrapper for the low level calls +} + +// ValidationSession is an auto generated Go binding around an Ethereum contract, +// with pre-set call and transact options. +type ValidationSession struct { + Contract *Validation // Generic contract binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ValidationCallerSession is an auto generated read-only Go binding around an Ethereum contract, +// with pre-set call options. +type ValidationCallerSession struct { + Contract *ValidationCaller // Generic contract caller binding to set the session for + CallOpts bind.CallOpts // Call options to use throughout this session +} + +// ValidationTransactorSession is an auto generated write-only Go binding around an Ethereum contract, +// with pre-set transact options. +type ValidationTransactorSession struct { + Contract *ValidationTransactor // Generic contract transactor binding to set the session for + TransactOpts bind.TransactOpts // Transaction auth options to use throughout this session +} + +// ValidationRaw is an auto generated low-level Go binding around an Ethereum contract. +type ValidationRaw struct { + Contract *Validation // Generic contract binding to access the raw methods on +} + +// ValidationCallerRaw is an auto generated low-level read-only Go binding around an Ethereum contract. +type ValidationCallerRaw struct { + Contract *ValidationCaller // Generic read-only contract binding to access the raw methods on +} + +// ValidationTransactorRaw is an auto generated low-level write-only Go binding around an Ethereum contract. +type ValidationTransactorRaw struct { + Contract *ValidationTransactor // Generic write-only contract binding to access the raw methods on +} + +// NewValidation creates a new instance of Validation, bound to a specific deployed contract. +func NewValidation(address common.Address, backend bind.ContractBackend) (*Validation, error) { + contract, err := bindValidation(address, backend, backend, backend) + if err != nil { + return nil, err + } + return &Validation{ValidationCaller: ValidationCaller{contract: contract}, ValidationTransactor: ValidationTransactor{contract: contract}, ValidationFilterer: ValidationFilterer{contract: contract}}, nil +} + +// NewValidationCaller creates a new read-only instance of Validation, bound to a specific deployed contract. +func NewValidationCaller(address common.Address, caller bind.ContractCaller) (*ValidationCaller, error) { + contract, err := bindValidation(address, caller, nil, nil) + if err != nil { + return nil, err + } + return &ValidationCaller{contract: contract}, nil +} + +// NewValidationTransactor creates a new write-only instance of Validation, bound to a specific deployed contract. +func NewValidationTransactor(address common.Address, transactor bind.ContractTransactor) (*ValidationTransactor, error) { + contract, err := bindValidation(address, nil, transactor, nil) + if err != nil { + return nil, err + } + return &ValidationTransactor{contract: contract}, nil +} + +// NewValidationFilterer creates a new log filterer instance of Validation, bound to a specific deployed contract. +func NewValidationFilterer(address common.Address, filterer bind.ContractFilterer) (*ValidationFilterer, error) { + contract, err := bindValidation(address, nil, nil, filterer) + if err != nil { + return nil, err + } + return &ValidationFilterer{contract: contract}, nil +} + +// bindValidation binds a generic wrapper to an already deployed contract. +func bindValidation(address common.Address, caller bind.ContractCaller, transactor bind.ContractTransactor, filterer bind.ContractFilterer) (*bind.BoundContract, error) { + parsed, err := abi.JSON(strings.NewReader(ValidationABI)) + if err != nil { + return nil, err + } + return bind.NewBoundContract(address, parsed, caller, transactor, filterer), nil +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Validation *ValidationRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _Validation.Contract.ValidationCaller.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Validation *ValidationRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Validation.Contract.ValidationTransactor.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Validation *ValidationRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Validation.Contract.ValidationTransactor.contract.Transact(opts, method, params...) +} + +// Call invokes the (constant) contract method with params as input values and +// sets the output to result. The result type might be a single field for simple +// returns, a slice of interfaces for anonymous returns and a struct for named +// returns. +func (_Validation *ValidationCallerRaw) Call(opts *bind.CallOpts, result interface{}, method string, params ...interface{}) error { + return _Validation.Contract.contract.Call(opts, result, method, params...) +} + +// Transfer initiates a plain transaction to move funds to the contract, calling +// its default method if one is available. +func (_Validation *ValidationTransactorRaw) Transfer(opts *bind.TransactOpts) (*types.Transaction, error) { + return _Validation.Contract.contract.Transfer(opts) +} + +// Transact invokes the (paid) contract method with params as input values. +func (_Validation *ValidationTransactorRaw) Transact(opts *bind.TransactOpts, method string, params ...interface{}) (*types.Transaction, error) { + return _Validation.Contract.contract.Transact(opts, method, params...) +} + +// GetValidators is a free data retrieval call binding the contract method 0xd405af3d. +// +// Solidity: function GetValidators() constant returns(_validators address[]) +func (_Validation *ValidationCaller) GetValidators(opts *bind.CallOpts) ([]common.Address, error) { + var ( + ret0 = new([]common.Address) + ) + out := ret0 + err := _Validation.contract.Call(opts, out, "GetValidators") + return *ret0, err +} + +// GetValidators is a free data retrieval call binding the contract method 0xd405af3d. +// +// Solidity: function GetValidators() constant returns(_validators address[]) +func (_Validation *ValidationSession) GetValidators() ([]common.Address, error) { + return _Validation.Contract.GetValidators(&_Validation.CallOpts) +} + +// GetValidators is a free data retrieval call binding the contract method 0xd405af3d. +// +// Solidity: function GetValidators() constant returns(_validators address[]) +func (_Validation *ValidationCallerSession) GetValidators() ([]common.Address, error) { + return _Validation.Contract.GetValidators(&_Validation.CallOpts) +} + +// ValidateBlock is a paid mutator transaction binding the contract method 0xaae933e4. +// +// Solidity: function ValidateBlock(header bytes, prefixHeader bytes, prefixExtraData bytes) returns() +func (_Validation *ValidationTransactor) ValidateBlock(opts *bind.TransactOpts, header []byte, prefixHeader []byte, prefixExtraData []byte) (*types.Transaction, error) { + return _Validation.contract.Transact(opts, "ValidateBlock", header, prefixHeader, prefixExtraData) +} + +// ValidateBlock is a paid mutator transaction binding the contract method 0xaae933e4. +// +// Solidity: function ValidateBlock(header bytes, prefixHeader bytes, prefixExtraData bytes) returns() +func (_Validation *ValidationSession) ValidateBlock(header []byte, prefixHeader []byte, prefixExtraData []byte) (*types.Transaction, error) { + return _Validation.Contract.ValidateBlock(&_Validation.TransactOpts, header, prefixHeader, prefixExtraData) +} + +// ValidateBlock is a paid mutator transaction binding the contract method 0xaae933e4. +// +// Solidity: function ValidateBlock(header bytes, prefixHeader bytes, prefixExtraData bytes) returns() +func (_Validation *ValidationTransactorSession) ValidateBlock(header []byte, prefixHeader []byte, prefixExtraData []byte) (*types.Transaction, error) { + return _Validation.Contract.ValidateBlock(&_Validation.TransactOpts, header, prefixHeader, prefixExtraData) +} + +// ValidationBroadcastHashIterator is returned from FilterBroadcastHash and is used to iterate over the raw logs and unpacked data for BroadcastHash events raised by the Validation contract. +type ValidationBroadcastHashIterator struct { + Event *ValidationBroadcastHash // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ValidationBroadcastHashIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ValidationBroadcastHash) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ValidationBroadcastHash) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ValidationBroadcastHashIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ValidationBroadcastHashIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ValidationBroadcastHash represents a BroadcastHash event raised by the Validation contract. +type ValidationBroadcastHash struct { + BlockHash [32]byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBroadcastHash is a free log retrieval operation binding the contract event 0xcd7ee33e1a630d6301d87631aab1d4ddce7e1942593cd2689aa989f76d67cf01. +// +// Solidity: event broadcastHash(blockHash bytes32) +func (_Validation *ValidationFilterer) FilterBroadcastHash(opts *bind.FilterOpts) (*ValidationBroadcastHashIterator, error) { + + logs, sub, err := _Validation.contract.FilterLogs(opts, "broadcastHash") + if err != nil { + return nil, err + } + return &ValidationBroadcastHashIterator{contract: _Validation.contract, event: "broadcastHash", logs: logs, sub: sub}, nil +} + +// WatchBroadcastHash is a free log subscription operation binding the contract event 0xcd7ee33e1a630d6301d87631aab1d4ddce7e1942593cd2689aa989f76d67cf01. +// +// Solidity: event broadcastHash(blockHash bytes32) +func (_Validation *ValidationFilterer) WatchBroadcastHash(opts *bind.WatchOpts, sink chan<- *ValidationBroadcastHash) (event.Subscription, error) { + + logs, sub, err := _Validation.contract.WatchLogs(opts, "broadcastHash") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ValidationBroadcastHash) + if err := _Validation.contract.UnpackLog(event, "broadcastHash", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ValidationBroadcastHashDataIterator is returned from FilterBroadcastHashData and is used to iterate over the raw logs and unpacked data for BroadcastHashData events raised by the Validation contract. +type ValidationBroadcastHashDataIterator struct { + Event *ValidationBroadcastHashData // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ValidationBroadcastHashDataIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ValidationBroadcastHashData) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ValidationBroadcastHashData) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ValidationBroadcastHashDataIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ValidationBroadcastHashDataIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ValidationBroadcastHashData represents a BroadcastHashData event raised by the Validation contract. +type ValidationBroadcastHashData struct { + Header []byte + ParentHash []byte + RootHash []byte + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBroadcastHashData is a free log retrieval operation binding the contract event 0x8511795469a13c04a2bc22c3f1309fc0bd918a0a25a3e7e222a0417b719274c7. +// +// Solidity: event broadcastHashData(header bytes, parentHash bytes, rootHash bytes) +func (_Validation *ValidationFilterer) FilterBroadcastHashData(opts *bind.FilterOpts) (*ValidationBroadcastHashDataIterator, error) { + + logs, sub, err := _Validation.contract.FilterLogs(opts, "broadcastHashData") + if err != nil { + return nil, err + } + return &ValidationBroadcastHashDataIterator{contract: _Validation.contract, event: "broadcastHashData", logs: logs, sub: sub}, nil +} + +// WatchBroadcastHashData is a free log subscription operation binding the contract event 0x8511795469a13c04a2bc22c3f1309fc0bd918a0a25a3e7e222a0417b719274c7. +// +// Solidity: event broadcastHashData(header bytes, parentHash bytes, rootHash bytes) +func (_Validation *ValidationFilterer) WatchBroadcastHashData(opts *bind.WatchOpts, sink chan<- *ValidationBroadcastHashData) (event.Subscription, error) { + + logs, sub, err := _Validation.contract.WatchLogs(opts, "broadcastHashData") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ValidationBroadcastHashData) + if err := _Validation.contract.UnpackLog(event, "broadcastHashData", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} + +// ValidationBroadcastSigIterator is returned from FilterBroadcastSig and is used to iterate over the raw logs and unpacked data for BroadcastSig events raised by the Validation contract. +type ValidationBroadcastSigIterator struct { + Event *ValidationBroadcastSig // Event containing the contract specifics and raw log + + contract *bind.BoundContract // Generic contract to use for unpacking event data + event string // Event name to use for unpacking event data + + logs chan types.Log // Log channel receiving the found contract events + sub ethereum.Subscription // Subscription for errors, completion and termination + done bool // Whether the subscription completed delivering logs + fail error // Occurred error to stop iteration +} + +// Next advances the iterator to the subsequent event, returning whether there +// are any more events found. In case of a retrieval or parsing error, false is +// returned and Error() can be queried for the exact failure. +func (it *ValidationBroadcastSigIterator) Next() bool { + // If the iterator failed, stop iterating + if it.fail != nil { + return false + } + // If the iterator completed, deliver directly whatever's available + if it.done { + select { + case log := <-it.logs: + it.Event = new(ValidationBroadcastSig) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + default: + return false + } + } + // Iterator still in progress, wait for either a data or an error event + select { + case log := <-it.logs: + it.Event = new(ValidationBroadcastSig) + if err := it.contract.UnpackLog(it.Event, it.event, log); err != nil { + it.fail = err + return false + } + it.Event.Raw = log + return true + + case err := <-it.sub.Err(): + it.done = true + it.fail = err + return it.Next() + } +} + +// Error returns any retrieval or parsing error occurred during filtering. +func (it *ValidationBroadcastSigIterator) Error() error { + return it.fail +} + +// Close terminates the iteration process, releasing any pending underlying +// resources. +func (it *ValidationBroadcastSigIterator) Close() error { + it.sub.Unsubscribe() + return nil +} + +// ValidationBroadcastSig represents a BroadcastSig event raised by the Validation contract. +type ValidationBroadcastSig struct { + Owner common.Address + Raw types.Log // Blockchain specific contextual infos +} + +// FilterBroadcastSig is a free log retrieval operation binding the contract event 0xba2fe28067a0918af64c5359b1579f887bf1479dd3163c7e5d456314168854a5. +// +// Solidity: event broadcastSig(owner address) +func (_Validation *ValidationFilterer) FilterBroadcastSig(opts *bind.FilterOpts) (*ValidationBroadcastSigIterator, error) { + + logs, sub, err := _Validation.contract.FilterLogs(opts, "broadcastSig") + if err != nil { + return nil, err + } + return &ValidationBroadcastSigIterator{contract: _Validation.contract, event: "broadcastSig", logs: logs, sub: sub}, nil +} + +// WatchBroadcastSig is a free log subscription operation binding the contract event 0xba2fe28067a0918af64c5359b1579f887bf1479dd3163c7e5d456314168854a5. +// +// Solidity: event broadcastSig(owner address) +func (_Validation *ValidationFilterer) WatchBroadcastSig(opts *bind.WatchOpts, sink chan<- *ValidationBroadcastSig) (event.Subscription, error) { + + logs, sub, err := _Validation.contract.WatchLogs(opts, "broadcastSig") + if err != nil { + return nil, err + } + return event.NewSubscription(func(quit <-chan struct{}) error { + defer sub.Unsubscribe() + for { + select { + case log := <-logs: + // New log arrived, parse the event and forward to the user + event := new(ValidationBroadcastSig) + if err := _Validation.contract.UnpackLog(event, "broadcastSig", log); err != nil { + return err + } + event.Raw = log + + select { + case sink <- event: + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + case err := <-sub.Err(): + return err + case <-quit: + return nil + } + } + }), nil +} diff --git a/src/block.json b/src/block.json new file mode 100644 index 0000000..6bf6cd4 --- /dev/null +++ b/src/block.json @@ -0,0 +1,22 @@ +{ + "parentHash": "0xad34f0f919e4b06b18b0c674b8b9f6738a4878c76e837c8f31a2079f21dced1c", + "difficulty": "2", + "extraData": "0xd78301080a846765746887676f312e392e33856c696e75780000000000000000e0ac79c5577889dfb5745ace9c5dfebe1a11bb19ced9b98b427e7bd4c85765ce17154e658440915743ec442fb64756483bc592616754d13a3c62fce5a56ac9f501", + "gasLimit": "16614106", + "gasUsed": "0", + "hash": "0xd1d7abeb1345861e0103a24a239c178ccf930b069e50f2697d82fdd3496746ab", + "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", + "miner": "0x0000000000000000000000000000000000000000", + "mixHash": "0x0000000000000000000000000000000000000000000000000000000000000000", + "nonce": "0x0000000000000000", + "number": "10", + "receiptsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "sha3Uncles": "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", + "size": "606", + "stateRoot": "0xdb37435caa1fca7e1aa5b4da1c69fdf1d127232519eb3b1b5069825e6c62f5dc", + "timestamp": "1529396972", + "totalDifficulty": "21", + "transactions": [], + "transactionsRoot": "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", + "uncles": [] +} diff --git a/src/cli-tool b/src/cli-tool deleted file mode 100755 index 3aee91b..0000000 Binary files a/src/cli-tool and /dev/null differ diff --git a/src/cli/cli.go b/src/cli/cli.go index 322b3b3..9fa7e02 100644 --- a/src/cli/cli.go +++ b/src/cli/cli.go @@ -3,31 +3,121 @@ package cli import ( - // "strings" + "fmt" + "log" + "strconv" "github.com/abiosoft/ishell" - // "gitlab.clearmatics.net/dev/boe-poc/src/api" - // "gitlab.clearmatics.net/dev/boe-poc/src/config" + "github.com/ethereum/go-ethereum/accounts/abi/bind" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/ethclient" + + "github.com/validation/src/Validation" + "github.com/validation/src/config" ) -func Launch() { +// Launch - definition of commands and creates the iterface +func Launch(setup config.Setup) { // by default, new shell includes 'exit', 'help' and 'clear' commands. shell := ishell.New() - // display welcome info. - shell.Println("Block Validation CLI Tool") + // Connect to the RPC Client + client, err := ethclient.Dial("http://" + setup.AddrTo + ":" + setup.PortTo) + if err != nil { + log.Fatalf("could not create RPC client: %v", err) + } + + // Initialise the contract + address := common.HexToAddress(setup.Ion) + validation, err := Validation.NewValidation(address, client) + if err != nil { + log.Fatal(err) + } + + printInfo(setup) + + // Get the latest block number + shell.AddCmd(&ishell.Cmd{ + Name: "latestBlock", + Help: "Returns latest block number, arguments: latestBlock", + Func: func(c *ishell.Context) { + c.Println("===============================================================") + c.Println("Get latest block number:") + latestBlock(client) + c.Println("===============================================================") + }, + }) - // display specific account balance + // Get block N shell.AddCmd(&ishell.Cmd{ Name: "getBlock", - Help: "get an ethereum block from a chain", + Help: "Returns a block header, arguments: getBlock [integer]", + Func: func(c *ishell.Context) { + c.Println("===============================================================") + if len(c.Args) == 0 { + c.Println("Input argument required, e.g.: getBlock 10") + } else if len(c.Args) > 1 { + c.Println("Only enter single argument") + } else { + getBlock(client, c.Args[0]) + } + c.Println("===============================================================") + }, + }) + + shell.AddCmd(&ishell.Cmd{ + Name: "getValidators", + Help: "Queries the validator contract for the whitelist of validators", + Func: func(c *ishell.Context) { + c.Println("===============================================================") + result, err := validation.GetValidators(&bind.CallOpts{}) + if err != nil { + fmt.Printf("Error: %s", err) + return + } + c.Println("Validators Whitelist:") + c.Printf("%x\n", result) + + c.Println("===============================================================") + }, + }) + + // Get block N and spew out the RLP encoded block + shell.AddCmd(&ishell.Cmd{ + Name: "rlpBlock", + Help: "Returns RLP encoded block header, arguments: rlpBlock [integer]", + Func: func(c *ishell.Context) { + c.Println("===============================================================") + if len(c.Args) == 0 { + c.Println("Input argument required, e.g.: rlpBlock 10") + } else if len(c.Args) > 1 { + c.Println("Only enter single argument") + } else { + c.Println("RLP encode block: " + c.Args[0]) + rlpEncodeBlock(client, c.Args[0]) + } + c.Println("===============================================================") + }, + }) + + shell.AddCmd(&ishell.Cmd{ + Name: "submitRlpBlock", + Help: "Returns the RLP block header, signed block prefix, extra data prefix and submits to validation contract, arguments: submitRlpBlock [integer]", Func: func(c *ishell.Context) { c.Println("===============================================================") - c.Println("Get block:") - if len(c.Args) > 1 { + if len(c.Args) == 0 { + c.Println("Choose a block.") + } else if len(c.Args) > 1 { c.Println("Too many arguments entered.") } else { - c.Println(c.Args[0]) + c.Println("RLP encode block: " + c.Args[0]) + encodedBlock, prefixBlock, prefixExtra := calculateRlpEncoding(client, c.Args[0]) + res, err := validation.ValidateBlock(&bind.TransactOpts{}, encodedBlock, prefixBlock, prefixExtra) + if err != nil { + c.Printf("Error: %s", err) + return + } + c.Printf("Error: %s", res) } c.Println("===============================================================") }, @@ -36,3 +126,28 @@ func Launch() { // run shell shell.Run() } + +func printInfo(setup config.Setup) { + // display welcome info. + fmt.Println("===============================================================") + fmt.Println("Ion Command Line Interface\n") + fmt.Println("RPC Client [to]:") + fmt.Println("Listening on: " + setup.AddrTo + ":" + setup.PortTo) + fmt.Println("User Account: " + setup.AccountTo) + fmt.Println("Ion Contract: " + setup.Ion) + fmt.Println("\nRPC Client [from]: ") + fmt.Println("Listening on: " + setup.AddrFrom + ":" + setup.PortFrom) + fmt.Println("User Account: " + setup.AccountFrom) + fmt.Println("===============================================================") +} + +func strToHex(input string) (output string) { + val, err := strconv.Atoi(input) + if err != nil { + fmt.Println("please input decimal:", err) + return + } + output = strconv.FormatInt(int64(val), 16) + + return "0x" + output +} diff --git a/src/cli/cli_test.go b/src/cli/cli_test.go new file mode 100644 index 0000000..e8461de --- /dev/null +++ b/src/cli/cli_test.go @@ -0,0 +1,29 @@ +// Copyright (c) 2018 Clearmatics Technologies Ltd + +package cli_test + +import ( + "runtime" + "strings" + "testing" + + "github.com/stretchr/testify/assert" + + "github.com/validation/src/config" +) + +func Test_Read_ValidSetupJson(t *testing.T) { + path := findPath() + "../setup.json" + setup := config.Read(path) + + assert.Equal(t, "8501", setup.PortTo) + assert.Equal(t, "127.0.0.1", setup.AddrTo) + assert.Equal(t, "8502", setup.PortFrom) + assert.Equal(t, "127.0.0.1", setup.AddrFrom) +} + +func findPath() string { + _, path, _, _ := runtime.Caller(0) + pathSlice := strings.Split(path, "/") + return strings.Trim(path, pathSlice[len(pathSlice)-1]) +} diff --git a/src/cli/rpc.go b/src/cli/rpc.go new file mode 100644 index 0000000..9a16103 --- /dev/null +++ b/src/cli/rpc.go @@ -0,0 +1,162 @@ +// Copyright (c) 2018 Clearmatics Technologies Ltd + +package cli + +import ( + "context" + "encoding/hex" + "encoding/json" + "fmt" + "math/big" + "reflect" + + "github.com/ethereum/go-ethereum/ethclient" + "github.com/ethereum/go-ethereum/rlp" +) + +type Header struct { + ParentHash string `json:"parentHash"` + UncleHash string `json:"sha3Uncles"` + Coinbase string `json:"miner"` + Root string `json:"stateRoot"` + TxHash string `json:"transactionsRoot"` + ReceiptHash string `json:"receiptsRoot"` + Bloom string `json:"logsBloom"` + Difficulty string `json:"difficulty"` + Number string `json:"number"` + GasLimit string `json:"gasLimit"` + GasUsed string `json:"gasUsed"` + Time string `json:"timestamp"` + Extra string `json:"extraData"` + MixDigest string `json:"mixHash"` + Nonce string `json:"nonce"` +} + +func latestBlock(client *ethclient.Client) { + // var lastBlock Block + lastBlock, err := client.HeaderByNumber(context.Background(), nil) + if err != nil { + fmt.Println("can't get latest block:", err) + return + } + // Print events from the subscription as they arrive. + fmt.Printf("latest block: %v\n", lastBlock.Number) +} + +func getBlock(client *ethclient.Client, block string) { + // var blockHeader Header + blockNum := new(big.Int) + blockNum.SetString(block, 10) + + lastBlock, err := client.HeaderByNumber(context.Background(), blockNum) + if err != nil { + fmt.Println("can't get requested block:", err) + return + } + // Marshal into a JSON + b, err := json.MarshalIndent(lastBlock, "", " ") + if err != nil { + fmt.Printf("Error: %s", err) + return + } + fmt.Println("Block:", block) + fmt.Println(string(b)) +} + +// func rlpEncodeBlock(client *rpc.Client, block string) { +func rlpEncodeBlock(client *ethclient.Client, block string) { + var blockHeader Header + blockNum := new(big.Int) + blockNum.SetString(block, 10) + + lastBlock, err := client.HeaderByNumber(context.Background(), blockNum) + if err != nil { + fmt.Println("can't get requested block:", err) + return + } + + // Marshal into a JSON + b, err := json.MarshalIndent(lastBlock, "", " ") + if err != nil { + fmt.Printf("Error: %s", err) + return + } + err = json.Unmarshal([]byte(b), &blockHeader) + if err != nil { + fmt.Printf("Error: %s", err) + return + } + + // fmt.Printf("%+v\n", blockHeader) + blockInterface := GenerateInterface(blockHeader) + encodedBlock := EncodeBlock(blockInterface) + fmt.Printf("%+x\n", encodedBlock) +} + +// func calculateRlpEncoding(client *ethclient.Client, block string) { +func calculateRlpEncoding(client *ethclient.Client, block string) (rlpBlock []byte, prefixBlock []byte, prefixExtra []byte) { + var blockHeader Header + blockNum := new(big.Int) + blockNum.SetString(block, 10) + + lastBlock, err := client.HeaderByNumber(context.Background(), blockNum) + if err != nil { + fmt.Println("can't get requested block:", err) + return + } + + // Marshal into a JSON + b, err := json.MarshalIndent(lastBlock, "", " ") + if err != nil { + fmt.Printf("Error: %s", err) + return + } + err = json.Unmarshal([]byte(b), &blockHeader) + if err != nil { + fmt.Printf("Error: %s", err) + return + } + + // Generate an interface to encode the standard block header + blockInterface := GenerateInterface(blockHeader) + encodedBlock := EncodeBlock(blockInterface) + fmt.Printf("\n%+x\n", encodedBlock) + + // Generate an interface to encode the blockheader without the signature in the extraData + blockHeader.Extra = blockHeader.Extra[:len(blockHeader.Extra)-130] + blockInterface = GenerateInterface(blockHeader) + encodedBlock = EncodeBlock(blockInterface) + prefixBlock = encodedBlock[1:3] + fmt.Printf("\n%+x\n", prefixBlock) + + // Generate an interface to encode the blockheader without the signature in the extraData + encExtra, _ := hex.DecodeString(blockHeader.Extra[2:]) + encodedBlock = EncodeBlock(encExtra) + prefixExtra = encodedBlock[0:1] + fmt.Printf("\n%+x\n", prefixExtra) + + return encodedBlock, prefixBlock, prefixExtra + +} + +// Creates an interface for a block +func GenerateInterface(blockHeader Header) (rest interface{}) { + blockInterface := []interface{}{} + s := reflect.ValueOf(&blockHeader).Elem() + + // Append items into the interface + for i := 0; i < s.NumField(); i++ { + f := s.Field(i).String() + element, _ := hex.DecodeString(f[2:]) + blockInterface = append(blockInterface, element) + } + + return blockInterface +} + +// Encodes a block +func EncodeBlock(blockInterface interface{}) (h []byte) { + h, _ = rlp.EncodeToBytes(blockInterface) + + return h +} diff --git a/src/cli/rpc_test.go b/src/cli/rpc_test.go new file mode 100644 index 0000000..6ec7ebf --- /dev/null +++ b/src/cli/rpc_test.go @@ -0,0 +1,19 @@ +// Copyright (c) 2018 Clearmatics Technologies Ltd + +package cli_test + +// func Test_EncodeBlock(t *testing.T) { +// // read a fake block +// raw, _ := ioutil.ReadFile("../block.json") +// +// const expectedRlpHex = "f90256a0ad34f0f919e4b06b18b0c674b8b9f6738a4878c76e837c8f31a2079f21dced1ca01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a0db37435caa1fca7e1aa5b4da1c69fdf1d127232519eb3b1b5069825e6c62f5dca056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020a83fd82da80845b28beecb861d78301080a846765746887676f312e392e33856c696e75780000000000000000e0ac79c5577889dfb5745ace9c5dfebe1a11bb19ced9b98b427e7bd4c85765ce17154e658440915743ec442fb64756483bc592616754d13a3c62fce5a56ac9f501a00000000000000000000000000000000000000000000000000000000000000000880000000000000000" +// +// var marshalledBlock cli.Header +// json.Unmarshal(raw, &marshalledBlock) +// +// // Now RLP encode the block +// blockInterface := cli.GenerateInterface(marshalledBlock) +// fmt.Printf("%+v\n", marshalledBlock.Extra) +// hash := cli.EncodeBlock(blockInterface) +// assert.Equal(t, expectedRlpHex, hex.EncodeToString(hash)) +// } diff --git a/src/config/config.go b/src/config/config.go index 7f92938..5c777af 100644 --- a/src/config/config.go +++ b/src/config/config.go @@ -10,10 +10,13 @@ import ( // Settings type Setup struct { - Port_to string `json:"rpc-port-to"` - Addr_to string `json:"rpc-addr-to"` - Port_from string `json:"rpc-port-from"` - Addr_from string `json:"rpc-addr-from"` + PortTo string `json:"rpc-port-to"` + AddrTo string `json:"rpc-addr-to"` + AccountTo string `json:"account-to"` + PortFrom string `json:"rpc-port-from"` + AddrFrom string `json:"rpc-addr-from"` + AccountFrom string `json:"account-from"` + Ion string `json:"ion-addr"` } func Read(config string) (setup Setup) { diff --git a/src/config/config_test.go b/src/config/config_test.go index 5807d0e..c6b4e17 100644 --- a/src/config/config_test.go +++ b/src/config/config_test.go @@ -3,24 +3,24 @@ package config_test import ( - "github.com/stretchr/testify/assert" "runtime" "strings" "testing" - "gitlab.clearmatics.net/dev/boe-poc/src/config" -) + "github.com/stretchr/testify/assert" -func Test_ParseParameters_ValidUserFile(t *testing.T) { - path := findPath() + "../user.json" - commandLine := []string{path} + "github.com/validation/src/config" +) - setup := config.ParseParameters(commandLine) +func Test_Read_ValidSetupJson(t *testing.T) { + path := findPath() + "../setup.json" + setup := config.Read(path) - assert.Equal(t, "http://rt-poc2-2.azurewebsites.net", setup.APIURL) - assert.Equal(t, "password", setup.Grant_type) - assert.Equal(t, "svcp93lXc&", setup.Password) - assert.Equal(t, "user1@scheme1.co.uk", setup.User) + assert.Equal(t, "8501", setup.PortTo) + assert.Equal(t, "127.0.0.1", setup.AddrTo) + assert.Equal(t, "8502", setup.PortFrom) + assert.Equal(t, "127.0.0.1", setup.AddrFrom) + assert.Equal(t, "0xb9fd43a71c076f02d1dbbf473c389f0eacec559f", setup.Ion) } func findPath() string { diff --git a/src/main.go b/src/main.go index 750f381..2cea175 100644 --- a/src/main.go +++ b/src/main.go @@ -3,22 +3,24 @@ package main import ( + "flag" "fmt" "os" - "flag" "github.com/validation/src/cli" "github.com/validation/src/config" ) -var configFile = flag.String("config", "", "Description:\n path to the configuration file") +var configFile = flag.String("config", "setup.json", "Description:\n path to the configuration file") func main() { flag.Parse() if *configFile != "" { setup := config.Read(*configFile) - cli.Launch() + + // Launch the CLI + cli.Launch(setup) } else { fmt.Print("Error: empty config!\n") os.Exit(3) diff --git a/src/setup.json b/src/setup.json index 953a7cd..9ab7dff 100644 --- a/src/setup.json +++ b/src/setup.json @@ -1,6 +1,9 @@ { "rpc-addr-to":"127.0.0.1", - "rpc-port-to":8501, + "rpc-port-to":"8501", + "account-to":"0x2be5ab0e43b6dc2908d5321cf318f35b80d0c10d", "rpc-addr-from":"127.0.0.1", - "rpc-port-from":8502 + "rpc-port-from":"8502", + "account-from":"0x8671e5e08d74f338ee1c462340842346d797afd3", + "ion-addr":"0xb9fd43a71c076f02d1dbbf473c389f0eacec559f" } diff --git a/test/validation.js b/test/validation.js new file mode 100644 index 0000000..f6074fa --- /dev/null +++ b/test/validation.js @@ -0,0 +1,455 @@ +// Copyright (c) 2016-2018 Clearmatics Technologies Ltd +// SPDX-License-Identifier: LGPL-3.0+ + +const Util = require('ethereumjs-util'); +const Web3 = require('web3'); +const Web3Utils = require('web3-utils'); +const Web3Abi = require('web3-eth-abi'); +const Web3Accounts = require('web3-eth-accounts'); +const rlp = require('rlp'); + +const Validation = artifacts.require("Validation"); +const Recover = artifacts.require("Recover"); + +const web3 = new Web3(); + +web3.setProvider(new web3.providers.HttpProvider('http://localhost:8501')); + +function hexToBytes(hex) { + for (var bytes = [], c = 0; c < hex.length; c += 2) + bytes.push(parseInt(hex.substr(c, 2), 16)); + return bytes; +} + +function bytesToHex(bytes) { + for (var hex = [], i = 0; i < bytes.length; i++) { + hex.push((bytes[i] >>> 4).toString(16)); + hex.push((bytes[i] & 0xF).toString(16)); + } + return hex.join(""); +} + +contract('validation.js', (accounts) => { + const joinHex = arr => '0x' + arr.map(el => el.slice(2)).join(''); + + const watchEvent = (eventObj) => new Promise((resolve,reject) => eventObj.watch((error,event) => error ? reject(error) : resolve(event))); + + const validators = ["0x2be5ab0e43b6dc2908d5321cf318f35b80d0c10d", "0x8671e5e08d74f338ee1c462340842346d797afd3"]; + + it('Test: GetValidators()', async () => { + const validation = await Validation.new(validators); + const accounts = web3.eth.accounts; + const signer = accounts[0]; + + const validatorsReceipt = await validation.GetValidators(); + assert.equal(validators[0], validatorsReceipt[0]) + }) + + it('Test: Authentic Submission - ValidateBlock()', async () => { + const validation = await Validation.new(validators); + const accounts = web3.eth.accounts; + const signer = accounts[0]; + + // Get a single block + const block = web3.eth.getBlock(10); + + // Decompose the values in the block to hash + const parentHash = block.parentHash; + const sha3Uncles = block.sha3Uncles; + const coinbase = block.miner; + const root = block.stateRoot; + const txHash = block.transactionsRoot; + const receiptHash = block.receiptsRoot; + const logsBloom = block.logsBloom; + const difficulty = Web3Utils.toBN(block.difficulty); + const number = Web3Utils.toBN(block.number); + const gasLimit = block.gasLimit; + const gasUsed = block.gasUsed; + const timestamp = Web3Utils.toBN(block.timestamp); + const extraData = block.extraData; + const mixHash = block.mixHash; + const nonce = block.nonce; + + // Remove last 65 Bytes of extraData + const extraBytes = hexToBytes(extraData); + const extraBytesShort = extraBytes.splice(1, extraBytes.length-66); + const extraDataSignature = '0x' + bytesToHex(extraBytes.splice(extraBytes.length-65)); + const extraDataShort = '0x' + bytesToHex(extraBytesShort); + + const blockHeader = [ + parentHash, + sha3Uncles, + coinbase, + root, + txHash, + receiptHash, + logsBloom, + difficulty, + number, + gasLimit, + gasUsed, + timestamp, + extraData, + mixHash, + nonce + ]; + + const header = [ + parentHash, + sha3Uncles, + coinbase, + root, + txHash, + receiptHash, + logsBloom, + difficulty, + number, + gasLimit, + gasUsed, + timestamp, + extraDataShort, + mixHash, + nonce + ]; + + const encodedBlockHeader = '0x' + rlp.encode(blockHeader).toString('hex'); + const blockHeaderHash = Web3Utils.sha3(encodedBlockHeader); + assert.equal(block.hash, blockHeaderHash); + + const encodedHeader = '0x' + rlp.encode(header).toString('hex'); + const headerHash = Web3Utils.sha3(encodedHeader); + + // The new prefixes should be calculated off chain + const prefixHeader = '0x0214'; + const prefixExtraData = '0xa0'; + + const ecrecoveryReceipt = await validation.ValidateBlock(encodedBlockHeader, prefixHeader, prefixExtraData); + const recoveredBlockHash = ecrecoveryReceipt.logs[0].args['blockHash']; + const recoveredSignature = ecrecoveryReceipt.logs[1].args['owner']; + assert.equal(block.hash, recoveredBlockHash) + assert.equal(recoveredSignature, signer); + + }) + + it('Test: Authentic Submission Off-Chain - ValidateBlock()', async () => { + const validation = await Validation.new(validators); + const accounts = web3.eth.accounts; + const signer = accounts[0]; + + // Get a single block + const block = web3.eth.getBlock(10); + + // Decompose the values in the block to hash + const parentHash = block.parentHash; + const sha3Uncles = block.sha3Uncles; + const coinbase = block.miner; + const root = block.stateRoot; + const txHash = block.transactionsRoot; + const receiptHash = block.receiptsRoot; + const logsBloom = block.logsBloom; + const difficulty = Web3Utils.toBN(block.difficulty); + const number = Web3Utils.toBN(block.number); + const gasLimit = block.gasLimit; + const gasUsed = block.gasUsed; + const timestamp = Web3Utils.toBN(block.timestamp); + const extraData = block.extraData; + const mixHash = block.mixHash; + const nonce = block.nonce; + + // Create new signed hash + const extraBytes = hexToBytes(extraData); + const extraBytesShort = extraBytes.splice(1, extraBytes.length-66); + const extraDataSignature = '0x' + bytesToHex(extraBytes.splice(extraBytes.length-65)); + const extraDataShort = '0x' + bytesToHex(extraBytesShort); + + // Make some changes to the block + const newTxHash = Web3Utils.sha3("Test Data"); + const header = [ + parentHash, + sha3Uncles, + coinbase, + root, + txHash, + receiptHash, + logsBloom, + difficulty, + number, + gasLimit, + gasUsed, + timestamp, + extraDataShort, + mixHash, + nonce + ]; + + // Encode and sign the new header + const encodedHeader = '0x' + rlp.encode(header).toString('hex'); + const headerHash = Util.sha3(encodedHeader); + + const privateKey = Buffer.from('e176c157b5ae6413726c23094bb82198eb283030409624965231606ec0fbe65b', 'hex') + + const sig = Util.ecsign(headerHash, privateKey) + if (this._chainId > 0) { + sig.v += this._chainId * 2 + 8 + } + + const pubKey = Util.ecrecover(headerHash, sig.v, sig.r, sig.s); + const addrBuf = Util.pubToAddress(pubKey); + const addr = Util.bufferToHex(addrBuf); + + const vPseudo = new Buffer(0); + const newSigBytes = Buffer.concat([sig.r, sig.s]); + const newSig = newSigBytes.toString('hex') + '00'; + + // Append signature to the end of extraData + const sigBytes = hexToBytes(newSig.toString('hex')); + const newExtraDataBytes = extraBytesShort.concat(sigBytes); + const newExtraData = '0x' + bytesToHex(newExtraDataBytes); + + const newBlockHeader = [ + parentHash, + sha3Uncles, + coinbase, + root, + txHash, + receiptHash, + logsBloom, + difficulty, + number, + gasLimit, + gasUsed, + timestamp, + newExtraData, + mixHash, + nonce + ]; + + const encodedBlockHeader = '0x' + rlp.encode(newBlockHeader).toString('hex'); + const blockHeaderHash = Web3Utils.sha3(encodedBlockHeader); + assert.equal(block.hash, blockHeaderHash); + + // The new prefixes should be calculated off chain + const prefixHeader = '0x0214'; + const prefixExtraData = '0xa0'; + + const ecrecoveryReceipt = await validation.ValidateBlock(encodedBlockHeader, prefixHeader, prefixExtraData); + const recoveredBlockHash = ecrecoveryReceipt.logs[0].args['blockHash']; + const recoveredSignature = ecrecoveryReceipt.logs[1].args['owner']; + assert.equal(block.hash, recoveredBlockHash) + assert.equal(recoveredSignature, signer); + }) + + it('Test: Inauthentic Block Submission Off-Chain - ValidateBlock()', async () => { + const validation = await Validation.new(validators); + const accounts = web3.eth.accounts; + const signer = accounts[0]; + + // Get a single block + const block = web3.eth.getBlock(10); + + // Decompose the values in the block to hash + const parentHash = block.parentHash; + const sha3Uncles = block.sha3Uncles; + const coinbase = block.miner; + const root = block.stateRoot; + const txHash = block.transactionsRoot; + const receiptHash = block.receiptsRoot; + const logsBloom = block.logsBloom; + const difficulty = Web3Utils.toBN(block.difficulty); + const number = Web3Utils.toBN(block.number); + const gasLimit = block.gasLimit; + const gasUsed = block.gasUsed; + const timestamp = Web3Utils.toBN(block.timestamp); + const extraData = block.extraData; + const mixHash = block.mixHash; + const nonce = block.nonce; + + // Create new signed hash + const extraBytes = hexToBytes(extraData); + const extraBytesShort = extraBytes.splice(1, extraBytes.length-66); + const extraDataSignature = '0x' + bytesToHex(extraBytes.splice(extraBytes.length-65)); + const extraDataShort = '0x' + bytesToHex(extraBytesShort); + + // Make some changes to the block + const newTxHash = Web3Utils.sha3("Test Data"); + const header = [ + parentHash, + sha3Uncles, + coinbase, + root, + newTxHash, + receiptHash, + logsBloom, + difficulty, + number, + gasLimit, + gasUsed, + timestamp, + extraDataShort, + mixHash, + nonce + ]; + + // Encode and sign the new header + const encodedHeader = '0x' + rlp.encode(header).toString('hex'); + const headerHash = Util.sha3(encodedHeader); + + const privateKey = Buffer.from('e176c157b5ae6413726c23094bb82198eb283030409624965231606ec0fbe65b', 'hex') + + const sig = Util.ecsign(headerHash, privateKey) + if (this._chainId > 0) { + sig.v += this._chainId * 2 + 8 + } + + const pubKey = Util.ecrecover(headerHash, sig.v, sig.r, sig.s); + const addrBuf = Util.pubToAddress(pubKey); + const addr = Util.bufferToHex(addrBuf); + + const vPseudo = new Buffer(0); + const newSigBytes = Buffer.concat([sig.r, sig.s]); + const newSig = newSigBytes.toString('hex') + '00'; + + // Append signature to the end of extraData + const sigBytes = hexToBytes(newSig.toString('hex')); + const newExtraDataBytes = extraBytesShort.concat(sigBytes); + const newExtraData = '0x' + bytesToHex(newExtraDataBytes); + + const newBlockHeader = [ + parentHash, + sha3Uncles, + coinbase, + root, + newTxHash, + receiptHash, + logsBloom, + difficulty, + number, + gasLimit, + gasUsed, + timestamp, + newExtraData, + mixHash, + nonce + ]; + + const encodedBlockHeader = '0x' + rlp.encode(newBlockHeader).toString('hex'); + const blockHeaderHash = Web3Utils.sha3(encodedBlockHeader); + + // The new prefixes should be calculated off chain + const prefixHeader = '0x0214'; + const prefixExtraData = '0xa0'; + + const ecrecoveryReceipt = await validation.ValidateBlock(encodedBlockHeader, prefixHeader, prefixExtraData); + const recoveredBlockHash = ecrecoveryReceipt.logs[0].args['blockHash']; + const recoveredSignature = ecrecoveryReceipt.logs[1].args['owner']; + assert.equal(recoveredSignature, signer); + }) + + it('Test: Authentic Block Unkown Validator Submission - ValidateBlock()', async () => { + const validation = await Validation.new(validators); + const accounts = web3.eth.accounts; + const signer = accounts[0]; + + // Get a single block + const block = web3.eth.getBlock(10); + + // Decompose the values in the block to hash + const parentHash = block.parentHash; + const sha3Uncles = block.sha3Uncles; + const coinbase = block.miner; + const root = block.stateRoot; + const txHash = block.transactionsRoot; + const receiptHash = block.receiptsRoot; + const logsBloom = block.logsBloom; + const difficulty = Web3Utils.toBN(block.difficulty); + const number = Web3Utils.toBN(block.number); + const gasLimit = block.gasLimit; + const gasUsed = block.gasUsed; + const timestamp = Web3Utils.toBN(block.timestamp); + const extraData = block.extraData; + const mixHash = block.mixHash; + const nonce = block.nonce; + + // Create new signed hash + const extraBytes = hexToBytes(extraData); + const extraBytesShort = extraBytes.splice(1, extraBytes.length-66); + const extraDataSignature = '0x' + bytesToHex(extraBytes.splice(extraBytes.length-65)); + const extraDataShort = '0x' + bytesToHex(extraBytesShort); + + // Make some changes to the block + const newTxHash = Web3Utils.sha3("Test Data"); + const header = [ + parentHash, + sha3Uncles, + coinbase, + root, + newTxHash, + receiptHash, + logsBloom, + difficulty, + number, + gasLimit, + gasUsed, + timestamp, + extraDataShort, + mixHash, + nonce + ]; + + // Encode and sign the new header + const encodedHeader = '0x' + rlp.encode(header).toString('hex'); + const headerHash = Util.sha3(encodedHeader); + + const privateKey = Buffer.from('4f35bad50b8b07fff875ec9d4dec6034b1cb0f7d283db4ce7df8fcfaa2030308', 'hex') + + const sig = Util.ecsign(headerHash, privateKey) + if (this._chainId > 0) { + sig.v += this._chainId * 2 + 8 + } + + const pubKey = Util.ecrecover(headerHash, sig.v, sig.r, sig.s); + const addrBuf = Util.pubToAddress(pubKey); + const addr = Util.bufferToHex(addrBuf); + + const vPseudo = new Buffer(0); + const newSigBytes = Buffer.concat([sig.r, sig.s]); + const newSig = newSigBytes.toString('hex') + '00'; + + // Append signature to the end of extraData + const sigBytes = hexToBytes(newSig.toString('hex')); + const newExtraDataBytes = extraBytesShort.concat(sigBytes); + const newExtraData = '0x' + bytesToHex(newExtraDataBytes); + + const newBlockHeader = [ + parentHash, + sha3Uncles, + coinbase, + root, + newTxHash, + receiptHash, + logsBloom, + difficulty, + number, + gasLimit, + gasUsed, + timestamp, + newExtraData, + mixHash, + nonce + ]; + + const encodedBlockHeader = '0x' + rlp.encode(newBlockHeader).toString('hex'); + const blockHeaderHash = Web3Utils.sha3(encodedBlockHeader); + + // The new prefixes should be calculated off chain + const prefixHeader = '0x0214'; + const prefixExtraData = '0xa0'; + + try { + const ecrecoveryReceipt = await validation.ValidateBlock(encodedBlockHeader, prefixHeader, prefixExtraData); + } catch (err) { + assert.isDefined(err, "transaction should have thrown"); + } + }) + +});