UNPKG

@cartesi/arbitration

Version:
721 lines 114 kB
{ "address": "0x7A94F2D64cafAb906E0a4F4753F6d103Dc218cc4", "abi": [ { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "_index", "type": "uint256" }, { "indexed": false, "internalType": "uint8", "name": "_state", "type": "uint8" } ], "name": "ChallengeEnded", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "_index", "type": "uint256" }, { "indexed": false, "internalType": "uint256", "name": "_timeOfDivergence", "type": "uint256" }, { "indexed": false, "internalType": "bytes32", "name": "_hashAtDivergenceTime", "type": "bytes32" }, { "indexed": false, "internalType": "bytes32", "name": "_hashRigthAfterDivergenceTime", "type": "bytes32" } ], "name": "DivergenceFound", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "_index", "type": "uint256" } ], "name": "HashesPosted", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "_index", "type": "uint256" } ], "name": "PartitionCreated", "type": "event" }, { "anonymous": false, "inputs": [ { "indexed": false, "internalType": "uint256", "name": "_index", "type": "uint256" } ], "name": "QueryPosted", "type": "event" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" } ], "name": "claimVictoryByTime", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [], "name": "currentIndex", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" } ], "name": "divergenceTime", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" } ], "name": "getCurrentState", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" } ], "name": "getCurrentStateDeadline", "outputs": [ { "internalType": "uint256", "name": "time", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_roundDuration", "type": "uint256" }, { "internalType": "uint256", "name": "_timeToStartMachine", "type": "uint256" }, { "internalType": "uint256", "name": "_partitionSize", "type": "uint256" }, { "internalType": "uint256", "name": "_maxCycle", "type": "uint256" }, { "internalType": "uint256", "name": "_picoSecondsToRunInsn", "type": "uint256" } ], "name": "getMaxInstanceDuration", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" } ], "name": "getNonce", "outputs": [ { "internalType": "uint256", "name": "currentNonce", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" } ], "name": "getPartitionGameIndex", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" } ], "name": "getQuerySize", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" }, { "internalType": "address", "name": "", "type": "address" } ], "name": "getState", "outputs": [ { "internalType": "address", "name": "_challenger", "type": "address" }, { "internalType": "address", "name": "_claimer", "type": "address" }, { "internalType": "uint256[]", "name": "_queryArray", "type": "uint256[]" }, { "internalType": "bool[]", "name": "_submittedArray", "type": "bool[]" }, { "internalType": "bytes32[]", "name": "_hashArray", "type": "bytes32[]" }, { "internalType": "bytes32", "name": "_currentState", "type": "bytes32" }, { "internalType": "uint256[]", "name": "_uintValues", "type": "uint256[]" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "", "type": "uint256" }, { "internalType": "address", "name": "", "type": "address" } ], "name": "getSubInstances", "outputs": [ { "internalType": "address[]", "name": "", "type": "address[]" }, { "internalType": "uint256[]", "name": "", "type": "uint256[]" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [ { "internalType": "address", "name": "_challenger", "type": "address" }, { "internalType": "address", "name": "_claimer", "type": "address" }, { "internalType": "bytes32", "name": "_initialHash", "type": "bytes32" }, { "internalType": "bytes32", "name": "_claimerFinalHash", "type": "bytes32" }, { "internalType": "uint256", "name": "_finalTime", "type": "uint256" }, { "internalType": "uint256", "name": "_querySize", "type": "uint256" }, { "internalType": "uint256", "name": "_roundDuration", "type": "uint256" } ], "name": "instantiate", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" } ], "name": "isActive", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" }, { "internalType": "address", "name": "_user", "type": "address" } ], "name": "isConcerned", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "x", "type": "uint256" } ], "name": "log2OverTwo", "outputs": [ { "internalType": "uint256", "name": "y", "type": "uint256" } ], "stateMutability": "pure", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" }, { "internalType": "uint256", "name": "queryPiece", "type": "uint256" }, { "internalType": "uint256", "name": "leftPoint", "type": "uint256" }, { "internalType": "uint256", "name": "rightPoint", "type": "uint256" } ], "name": "makeQuery", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" }, { "internalType": "uint256", "name": "_divergenceTime", "type": "uint256" } ], "name": "presentDivergence", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" }, { "internalType": "uint256", "name": "i", "type": "uint256" } ], "name": "queryArray", "outputs": [ { "internalType": "uint256", "name": "", "type": "uint256" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" }, { "internalType": "uint256[]", "name": "postedTimes", "type": "uint256[]" }, { "internalType": "bytes32[]", "name": "postedHashes", "type": "bytes32[]" } ], "name": "replyQuery", "outputs": [], "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" } ], "name": "stateIsChallengerWon", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" } ], "name": "stateIsClaimerWon", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" } ], "name": "stateIsDivergenceFound", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" } ], "name": "stateIsWaitingHashes", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" } ], "name": "stateIsWaitingQuery", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" }, { "internalType": "uint256", "name": "key", "type": "uint256" } ], "name": "timeHash", "outputs": [ { "internalType": "bytes32", "name": "", "type": "bytes32" } ], "stateMutability": "view", "type": "function" }, { "inputs": [ { "internalType": "uint256", "name": "_index", "type": "uint256" }, { "internalType": "uint256", "name": "key", "type": "uint256" } ], "name": "timeSubmitted", "outputs": [ { "internalType": "bool", "name": "", "type": "bool" } ], "stateMutability": "view", "type": "function" } ], "transactionHash": "0x71076733f0b278b18e020080cfc6c068dfad811a65e41c4cb5457fc9901d3730", "receipt": { "to": null, "from": "0x18930e8a66a1DbE21D00581216789AAB7460Afd0", "contractAddress": "0x7A94F2D64cafAb906E0a4F4753F6d103Dc218cc4", "transactionIndex": 0, "gasUsed": "2299924", "logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "blockHash": "0x9f0f14c8a587d54d38ad6bb0a5e453cee898ba19bff2212388a71506a17d3938", "transactionHash": "0x71076733f0b278b18e020080cfc6c068dfad811a65e41c4cb5457fc9901d3730", "logs": [], "blockNumber": 7117913, "cumulativeGasUsed": "2299924", "status": 1, "byzantium": true }, "args": [], "solcInputHash": "1f1c67ab264115ec013a38f727f2ffe8", "metadata": "{\"compiler\":{\"version\":\"0.7.4+commit.3f05b770\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint8\",\"name\":\"_state\",\"type\":\"uint8\"}],\"name\":\"ChallengeEnded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_timeOfDivergence\",\"type\":\"uint256\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_hashAtDivergenceTime\",\"type\":\"bytes32\"},{\"indexed\":false,\"internalType\":\"bytes32\",\"name\":\"_hashRigthAfterDivergenceTime\",\"type\":\"bytes32\"}],\"name\":\"DivergenceFound\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"HashesPosted\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"PartitionCreated\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"QueryPosted\",\"type\":\"event\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"claimVictoryByTime\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"currentIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"divergenceTime\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getCurrentState\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getCurrentStateDeadline\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"time\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_roundDuration\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_timeToStartMachine\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_partitionSize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_maxCycle\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_picoSecondsToRunInsn\",\"type\":\"uint256\"}],\"name\":\"getMaxInstanceDuration\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getNonce\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"currentNonce\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getPartitionGameIndex\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getQuerySize\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"getState\",\"outputs\":[{\"internalType\":\"address\",\"name\":\"_challenger\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_claimer\",\"type\":\"address\"},{\"internalType\":\"uint256[]\",\"name\":\"_queryArray\",\"type\":\"uint256[]\"},{\"internalType\":\"bool[]\",\"name\":\"_submittedArray\",\"type\":\"bool[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"_hashArray\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes32\",\"name\":\"_currentState\",\"type\":\"bytes32\"},{\"internalType\":\"uint256[]\",\"name\":\"_uintValues\",\"type\":\"uint256[]\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"\",\"type\":\"address\"}],\"name\":\"getSubInstances\",\"outputs\":[{\"internalType\":\"address[]\",\"name\":\"\",\"type\":\"address[]\"},{\"internalType\":\"uint256[]\",\"name\":\"\",\"type\":\"uint256[]\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"address\",\"name\":\"_challenger\",\"type\":\"address\"},{\"internalType\":\"address\",\"name\":\"_claimer\",\"type\":\"address\"},{\"internalType\":\"bytes32\",\"name\":\"_initialHash\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"_claimerFinalHash\",\"type\":\"bytes32\"},{\"internalType\":\"uint256\",\"name\":\"_finalTime\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_querySize\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_roundDuration\",\"type\":\"uint256\"}],\"name\":\"instantiate\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"isActive\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"internalType\":\"address\",\"name\":\"_user\",\"type\":\"address\"}],\"name\":\"isConcerned\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"x\",\"type\":\"uint256\"}],\"name\":\"log2OverTwo\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"y\",\"type\":\"uint256\"}],\"stateMutability\":\"pure\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"queryPiece\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"leftPoint\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"rightPoint\",\"type\":\"uint256\"}],\"name\":\"makeQuery\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"_divergenceTime\",\"type\":\"uint256\"}],\"name\":\"presentDivergence\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"i\",\"type\":\"uint256\"}],\"name\":\"queryArray\",\"outputs\":[{\"internalType\":\"uint256\",\"name\":\"\",\"type\":\"uint256\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"internalType\":\"uint256[]\",\"name\":\"postedTimes\",\"type\":\"uint256[]\"},{\"internalType\":\"bytes32[]\",\"name\":\"postedHashes\",\"type\":\"bytes32[]\"}],\"name\":\"replyQuery\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"stateIsChallengerWon\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"stateIsClaimerWon\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"stateIsDivergenceFound\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"stateIsWaitingHashes\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"stateIsWaitingQuery\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"key\",\"type\":\"uint256\"}],\"name\":\"timeHash\",\"outputs\":[{\"internalType\":\"bytes32\",\"name\":\"\",\"type\":\"bytes32\"}],\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"uint256\",\"name\":\"_index\",\"type\":\"uint256\"},{\"internalType\":\"uint256\",\"name\":\"key\",\"type\":\"uint256\"}],\"name\":\"timeSubmitted\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"kind\":\"dev\",\"methods\":{\"getMaxInstanceDuration(uint256,uint256,uint256,uint256,uint256)\":{\"params\":{\"_maxCycle\":\"number of instructions until the machine is forcibly halted\",\"_picoSecondsToRunInsn\":\"time the offchain will take to run one instruction\"}},\"instantiate(address,address,bytes32,bytes32,uint256,uint256,uint256)\":{\"params\":{\"_challenger\":\"address of the challenger.\",\"_claimer\":\"address of the claimer.\",\"_claimerFinalHash\":\"final hash claimed by claimer\",\"_finalTime\":\"max cycle of the machine for that computation\",\"_initialHash\":\"hash in which both claimer and challenger agree on\",\"_querySize\":\"size of postedHashes and postedTimes\",\"_roundDuration\":\"duration of the round (security param)\"},\"returns\":{\"_0\":\"Partition index.\"}},\"makeQuery(uint256,uint256,uint256,uint256)\":{\"params\":{\"leftPoint\":\"confirmation of the leftPoint of the interval to be split. Should be an aggreement point.\",\"queryPiece\":\"is the index of queryArray corresponding to the left limit of the next interval to be queried.\",\"rightPoint\":\"confirmation of the rightPoint of the interval to be split. Should be a disagreement point.\"}},\"presentDivergence(uint256,uint256)\":{\"params\":{\"_divergenceTime\":\"The time when the divergence happended. It should be a point of aggreement, while _divergenceTime + 1 should be a point of disagreement (both queried).\"}},\"replyQuery(uint256,uint256[],bytes32[])\":{\"params\":{\"postedHashes\":\"An array (of size querySize) with the hashes corresponding to the queried times\",\"postedTimes\":\"An array (of size querySize) with the times that have been queried.\"}}},\"version\":1},\"userdoc\":{\"kind\":\"user\",\"methods\":{\"claimVictoryByTime(uint256)\":{\"notice\":\"Claim victory for opponent timeout.\"},\"instantiate(address,address,bytes32,bytes32,uint256,uint256,uint256)\":{\"notice\":\"Instantiate a partition instance.\"},\"makeQuery(uint256,uint256,uint256,uint256)\":{\"notice\":\"Makes a query (only challenger can call it).\"},\"presentDivergence(uint256,uint256)\":{\"notice\":\"Present a precise time of divergence (can only be called by challenger).\"},\"replyQuery(uint256,uint256[],bytes32[])\":{\"notice\":\"Answer the query (only claimer can call it).\"}},\"version\":1}},\"settings\":{\"compilationTarget\":{\"contracts/PartitionInstantiator.sol\":\"PartitionInstantiator\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\",\"useLiteralContent\":true},\"optimizer\":{\"enabled\":true,\"runs\":200},\"remappings\":[]},\"sources\":{\"@cartesi/util/contracts/Decorated.sol\":{\"content\":\"// Copyright 2020 Cartesi Pte. Ltd.\\n\\n// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.7.0;\\n\\n\\ncontract Decorated {\\n // This contract defines several modifiers but does not use\\n // them - they will be used in derived contracts.\\n modifier onlyBy(address user) {\\n require(msg.sender == user, \\\"Cannot be called by user\\\");\\n _;\\n }\\n\\n modifier onlyAfter(uint256 time) {\\n require(block.timestamp > time, \\\"Cannot be called now\\\");\\n _;\\n }\\n}\\n\",\"keccak256\":\"0xdbba019b8f7f93b212a5bbae402ee988321c4fa82ed2b4c9e55b4d7ddf35dcc3\",\"license\":\"Apache-2.0\"},\"@cartesi/util/contracts/Instantiator.sol\":{\"content\":\"// Copyright 2020 Cartesi Pte. Ltd.\\n\\n// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\n\\npragma solidity ^0.7.0;\\n\\n\\ninterface Instantiator {\\n\\n modifier onlyInstantiated(uint256 _index) virtual;\\n\\n modifier onlyActive(uint256 _index) virtual;\\n\\n modifier increasesNonce(uint256 _index) virtual;\\n\\n function isActive(uint256 _index) external view returns (bool);\\n\\n function getNonce(uint256 _index) external view returns (uint256);\\n\\n function isConcerned(uint256 _index, address _user) external view returns (bool);\\n\\n function getSubInstances(uint256 _index, address) external view returns (address[] memory _addresses, uint256[] memory _indices);\\n}\\n\",\"keccak256\":\"0x416e612dc09b10765de32ec06cf0a7ee4e050e16db8bf3b8ad832a6082b7dfd6\",\"license\":\"Apache-2.0\"},\"@cartesi/util/contracts/InstantiatorImpl.sol\":{\"content\":\"// Copyright 2020 Cartesi Pte. Ltd.\\n\\n// SPDX-License-Identifier: Apache-2.0\\n// Licensed under the Apache License, Version 2.0 (the \\\"License\\\"); you may not use\\n// this file except in compliance with the License. You may obtain a copy of the\\n// License at http://www.apache.org/licenses/LICENSE-2.0\\n\\n// Unless required by applicable law or agreed to in writing, software distributed\\n// under the License is distributed on an \\\"AS IS\\\" BASIS, WITHOUT WARRANTIES OR\\n// CONDITIONS OF ANY KIND, either express or implied. See the License for the\\n// specific language governing permissions and limitations under the License.\\n\\npragma solidity ^0.7.0;\\n\\nimport \\\"./Instantiator.sol\\\";\\n\\nabstract contract InstantiatorImpl is Instantiator {\\n uint256 public currentIndex = 0;\\n\\n mapping(uint256 => bool) internal active;\\n mapping(uint256 => uint256) internal nonce;\\n\\n modifier onlyInstantiated(uint256 _index) override {\\n require(currentIndex > _index, \\\"Index not instantiated\\\");\\n _;\\n }\\n\\n modifier onlyActive(uint256 _index) override {\\n require(currentIndex > _index, \\\"Index not instantiated\\\");\\n require(isActive(_index), \\\"Index inactive\\\");\\n _;\\n }\\n\\n modifier increasesNonce(uint256 _index) override {\\n nonce[_index]++;\\n _;\\n }\\n\\n function isActive(uint256 _index) public override view returns (bool) {\\n return (active[_index]);\\n }\\n\\n function getNonce(uint256 _index)\\n public\\n override\\n view\\n onlyActive(_index)\\n returns (uint256 currentNonce)\\n {\\n return nonce[_index];\\n }\\n\\n function deactivate(uint256 _index) internal {\\n active[_index] = false;\\n nonce[_index] = 0;\\n }\\n}\\n\",\"keccak256\":\"0x8f8e29b807e5c55198206a370b4d8751cbd98a663e3f89faff274e2f9d7cae75\",\"license\":\"Apache-2.0\"},\"contracts/PartitionInstantiator.sol\":{\"content\":\"// Copyright (C) 2020 Cartesi Pte. Ltd.\\n\\n// SPDX-License-Identifier: GPL-3.0-only\\n// This program is free software: you can redistribute it and/or modify it under\\n// the terms of the GNU General Public License as published by the Free Software\\n// Foundation, either version 3 of the License, or (at your option) any later\\n// version.\\n\\n// This program is distributed in the hope that it will be useful, but WITHOUT ANY\\n// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A\\n// PARTICULAR PURPOSE. See the GNU General Public License for more details.\\n\\n// You should have received a copy of the GNU General Public License\\n// along with this program. If not, see <https://www.gnu.org/licenses/>.\\n\\n// Note: This component currently has dependencies that are licensed under the GNU\\n// GPL, version 3, and so you should treat this component as a whole as being under\\n// the GPL version 3. But all Cartesi-written code in this component is licensed\\n// under the Apache License, version 2, or a compatible permissive license, and can\\n// be used independently under the Apache v2 license. After this component is\\n// rewritten, the entire component will be released under the Apache v2 license.\\n\\n/// @title Partition instantiator\\npragma solidity ^0.7.0;\\n\\nimport \\\"@cartesi/util/contracts/InstantiatorImpl.sol\\\";\\nimport \\\"@cartesi/util/contracts/Decorated.sol\\\";\\nimport \\\"./PartitionInterface.sol\\\";\\n\\ncontract PartitionInstantiator is\\n InstantiatorImpl,\\n Decorated,\\n PartitionInterface\\n{\\n uint256 constant MAX_QUERY_SIZE = 20;\\n\\n // IMPLEMENT GARBAGE COLLECTOR AFTER AN INSTACE IS FINISHED!\\n struct PartitionCtx {\\n address challenger;\\n address claimer;\\n uint256 finalTime; // hashes provided between 0 and finalTime (inclusive)\\n mapping(uint256 => bool) timeSubmitted; // marks a time as submitted\\n mapping(uint256 => bytes32) timeHash; // hashes are signed by claimer\\n uint256 querySize;\\n uint256[] queryArray;\\n uint256 timeOfLastMove;\\n uint256 roundDuration;\\n uint256 partitionGameIndex; // number of interactions that already happened in the partition interaction\\n state currentState;\\n uint256 divergenceTime;\\n }\\n\\n //Swap internal/private when done with testing\\n mapping(uint256 => PartitionCtx) internal instance;\\n\\n // These are the possible states and transitions of the contract.\\n //\\n // +---+\\n // | |\\n // +---+\\n // |\\n // | instantiate\\n // v\\n // +---------------+ claimVictoryByTimeout +---------------+\\n // | WaitingHashes |------------------------>| ChallengerWon |\\n // +---------------+ +---------------+\\n // | ^\\n // replyQuery | | makeQuery\\n // v |\\n // +--------------+ claimVictoryByTimeout +------------+\\n // | WaitingQuery |------------------------->| ClaimerWon |\\n // +--------------+ +------------+\\n // |\\n // | presentDivergence\\n // v\\n // +-----------------+\\n // | DivergenceFound |\\n // +-----------------+\\n //\\n\\n event PartitionCreated(uint256 _index);\\n event QueryPosted(uint256 _index);\\n event HashesPosted(uint256 _index);\\n event ChallengeEnded(uint256 _index, uint8 _state);\\n event DivergenceFound(\\n uint256 _index,\\n uint256 _timeOfDivergence,\\n bytes32 _hashAtDivergenceTime,\\n bytes32 _hashRigthAfterDivergenceTime\\n );\\n\\n /// @notice Instantiate a partition instance.\\n /// @param _challenger address of the challenger.\\n /// @param _claimer address of the claimer.\\n /// @param _initialHash hash in which both claimer and challenger agree on\\n /// @param _claimerFinalHash final hash claimed by claimer\\n /// @param _finalTime max cycle of the machine for that computation\\n /// @param _querySize size of postedHashes and postedTimes\\n /// @param _roundDuration duration of the round (security param)\\n /// @return Partition index.\\n function instantiate(\\n address _challenger,\\n address _claimer,\\n bytes32 _initialHash,\\n bytes32 _claimerFinalHash,\\n uint256 _finalTime,\\n uint256 _querySize,\\n uint256 _roundDuration\\n ) public override returns (uint256) {\\n require(\\n _challenger != _claimer,\\n \\\"Challenger and claimer have the same address\\\"\\n );\\n require(_finalTime > 0, \\\"Final Time has to be bigger than zero\\\");\\n require(_querySize > 2, \\\"Query Size must be bigger than 2\\\");\\n require(\\n _querySize < MAX_QUERY_SIZE,\\n \\\"Query Size must be less than max\\\"\\n );\\n require(\\n _roundDuration > 50,\\n \\\"Round Duration has to be greater than 50 seconds\\\"\\n );\\n instance[currentIndex].challenger = _challenger;\\n instance[currentIndex].claimer = _claimer;\\n instance[currentIndex].finalTime = _finalTime;\\n instance[currentIndex].timeSubmitted[0] = true;\\n instance[currentIndex].timeSubmitted[_finalTime] = true;\\n instance[currentIndex].timeHash[0] = _initialHash;\\n instance[currentIndex].timeHash[_finalTime] = _claimerFinalHash;\\n instance[currentIndex].querySize = _querySize;\\n // Creates queryArray with the correct size\\n instance[currentIndex].queryArray = new uint256[](\\n instance[currentIndex].querySize\\n );\\n // slice the interval, placing the separators in queryArray\\n slice(currentIndex, 0, instance[currentIndex].finalTime);\\n instance[currentIndex].roundDuration = _roundDuration;\\n instance[currentIndex].timeOfLastMove = block.timestamp;\\n instance[currentIndex].currentState = state.WaitingHashes;\\n emit PartitionCreated(currentIndex);\\n emit QueryPosted(currentIndex);\\n\\n active[currentIndex] = true;\\n return currentIndex++;\\n }\\n\\n /// @notice Answer the query (only claimer can call it).\\n /// @param postedTimes An array (of size querySize) with the times that have\\n /// been queried.\\n /// @param postedHashes An array (of size querySize) with the hashes\\n /// corresponding to the queried times\\n function replyQuery(\\n uint256 _index,\\n uint256[] memory postedTimes,\\n bytes32[] memory postedHashes\\n )\\n public\\n onlyInstantiated(_index)\\n onlyBy(instance[_index].claimer)\\n increasesNonce(_index)\\n {\\n require(\\n instance[_index].currentState == state.WaitingHashes,\\n \\\"CurrentState is not WaitingHashes, cannot replyQuery\\\"\\n );\\n require(\\n postedTimes.length == instance[_index].querySize,\\n \\\"postedTimes.length != querySize\\\"\\n );\\n require(\\n postedHashes.length == instance[_index].querySize,\\n \\\"postedHashes.length != querySize\\\"\\n );\\n for (uint256 i = 0; i < instance[_index].querySize; i++) {\\n // make sure the claimer knows the current query\\n require(\\n postedTimes[i] == instance[_index].queryArray[i],\\n \\\"postedTimes[i] != queryArray[i]\\\"\\n );\\n // cannot rewrite previous answer\\n if (!instance[_index].timeSubmitted[postedTimes[i]]) {\\n instance[_index].timeSubmitted[postedTimes[i]] = true;\\n instance[_index].timeHash[postedTimes[i]] = postedHashes[i];\\n }\\n }\\n instance[_index].currentState = state.WaitingQuery;\\n instance[_index].timeOfLastMove = block.timestamp;\\n instance[_index].partitionGameIndex++;\\n emit HashesPosted(_index);\\n }\\n\\n /// @notice Makes a query (only challenger can call it).\\n /// @param queryPiece is the index of queryArray corresponding to the left\\n /// limit of the next interval to be queried.\\n /// @param leftPoint confirmation of the leftPoint of the interval to be\\n /// split. Should be an aggreement point.\\n /// @param rightPoint confirmation of the rightPoint of the interval to be\\n /// split. Should be a disagreement point.\\n function makeQuery(\\n uint256 _index,\\n uint256 queryPiece,\\n uint256 leftPoint,\\n uint256 rightPoint\\n )\\n public\\n onlyInstantiated(_index)\\n onlyBy(instance[_index].challenger)\\n increasesNonce(_index)\\n {\\n require(\\n instance[_index].currentState == state.WaitingQuery,\\n \\\"CurrentState is not WaitingQuery, cannot makeQuery\\\"\\n );\\n require(\\n queryPiece < instance[_index].querySize - 1,\\n \\\"queryPiece is bigger than querySize - 1\\\"\\n );\\n // make sure the challenger knows the previous query\\n require(\\n leftPoint == instance[_index].queryArray[queryPiece],\\n \\\"leftPoint != queryArray[queryPiece]\\\"\\n );\\n require(\\n rightPoint == instance[_index].queryArray[queryPiece + 1],\\n \\\"rightPoint != queryArray[queryPiece]\\\"\\n );\\n // no unitary queries. in unitary case, present divergence instead.\\n // by avoiding unitary queries one forces the contest to end\\n require(rightPoint - leftPoint > 1, \\\"Interval is less than one\\\");\\n slice(_index, leftPoint, rightPoint);\\n instance[_index].currentState = state.WaitingHashes;\\n instance[_index].timeOfLastMove = block.timestamp;\\n emit QueryPosted(_index);\\n }\\n\\n /// @notice Claim victory for opponent timeout.\\n function claimVictoryByTime(uint256 _index)\\n public\\n onlyInstantiated(_index)\\n increasesNonce(_index)\\n {\\n bool afterDeadline = (block.timestamp >\\n instance[_index].timeOfLastMove +\\n getMaxStateDuration(\\n instance[_index].currentState,\\n instance[_index].roundDuration,\\n 40, // time to build machine for the first time\\n instance[_index].querySize,\\n instance[_index].partitionGameIndex,\\n instance[_index].finalTime,\\n 500 // 500 pico seconds per instruction\\n ));\\n\\n if (\\n (msg.sender == instance[_index].challenger) &&\\n (instance[_index].currentState == state.WaitingHashes) &&\\n afterDeadline\\n ) {\\n instance[_index].currentState = state.ChallengerWon;\\n deactivate(_index);\\n emit ChallengeEnded(_index, uint8(instance[_index].currentState));\\n return;\\n }\\n if (\\n (msg.sender == instance[_index].claimer) &&\\n (instance[_index].currentState == state.WaitingQuery) &&\\n afterDeadline\\n ) {\\n instance[_index].currentState = state.ClaimerWon;\\n deactivate(_index);\\n emit ChallengeEnded(_index, uint8(instance[_index].currentState));\\n return;\\n }\\n revert(\\\"Fail to ClaimVictoryByTime in current condition\\\");\\n }\\n\\n /// @notice Present a precise time of divergence (can only be called by\\n /// challenger).\\n /// @param _divergenceTime The time when the divergence happended. It\\n /// should be a point of aggreement, while _divergenceTime + 1 should be a\\n /// point of disagreement (both queried).\\n function presentDivergence(uint256 _index, uint256 _divergenceTime)\\n public\\n onlyInstantiated(_index)\\n onlyBy(instance[_index].challenger)\\n increasesNonce(_index)\\n {\\n require(\\n _divergenceTime < instance[_index].finalTime,\\n \\\"divergence time has to be less than finalTime\\\"\\n );\\n require(\\n instance[_index].timeSubmitted[_divergenceTime],\\n \\\"divergenceTime has to have been submitted\\\"\\n );\\n require(\\n instance[_index].timeSubmitted[_divergenceTime + 1],\\n \\\"divergenceTime + 1 has to have been submitted\\\"\\n );\\n\\n instance[_index].divergenceTime = _divergenceTime;\\n instance[_index].currentState = state.DivergenceFound;\\n deactivate(_index);\\n emit ChallengeEnded(_index, uint8(instance[_index].currentState));\\n emit DivergenceFound(\\n _index,\\n instance[_index].divergenceTime,\\n instance[_index].timeHash[instance[_index].divergenceTime],\\n instance[_index].timeHash[instance[_index].divergenceTime + 1]\\n );\\n }\\n\\n /// @notice Get the worst case scenario duration for a specific state\\n /// @param _roundDuration security parameter, the max time an agent\\n // has to react and submit one simple transaction\\n /// @param _timeToStartMachine time to build the machine for the first time\\n /// @param _partitionSize size of partition, how many instructions the\\n // will run to reach the necessary hash\\n /// @param _partitionGameIndex number of interactions that already happened\\n // in the partition interaction\\n /// @param _maxCycle number of instructions until the machine is forcibly halted\\n /// @param _picoSecondsToRunInsn time the offchain will take to run one instruction\\n function getMaxStateDuration(\\n state _state,\\n uint256 _roundDuration,\\n uint256 _timeToStartMachine,\\n uint256 _partitionSize,\\n uint256 _partitionGameIndex,\\n uint256 _maxCycle,\\n uint256 _picoSecondsToRunInsn\\n ) private pure returns (uint256) {\\n // TO-DO: when we have DUMP then we can remove the partitionSize - 1 multiplier\\n uint256 currentPartitionSize = _maxCycle /\\n (_partitionSize**_partitionGameIndex);\\n\\n if (_partitionGameIndex != 0) {\\n currentPartitionSize = currentPartitionSize * (_partitionSize - 1);\\n }\\n\\n if (_state == state.WaitingQuery) {\\n return\\n _timeToStartMachine +\\n ((currentPartitionSize * _picoSecondsToRunInsn) / 1e12) +\\n _roundDuration;\\n }\\n if (_state == state.WaitingHashes) {\\n return\\n _timeToStartMachine +\\n ((currentPartitionSize * _picoSecondsToRunInsn) / 1e12) +\\n _roundDuration;\\n }\\n if (\\n _state == state.ClaimerWon ||\\n _state == state.ChallengerWon ||\\n _state == state.DivergenceFound\\n ) {\\n return 0; // final state\\n }\\n require(false, \\\"Unrecognized state\\\");\\n }\\n\\n /// @notice Get the worst case scenario duration for an instance of this contract\\n /// @param _roundDuration security parameter, the max time an agent\\n // has to react and submit one simple transaction\\n /// @param _timeToStartMachine time to build the machine for the first time\\n /// @param _partitionSize size of partition, how many instructions the\\n // will run to reach the necessary hash\\n /// @param _maxCycle number of instructions until the machine is forcibly halted\\n /// @param _picoSecondsToRunInsn time the offchain will take to run one instruction\\n function getMaxInstanceDuration(\\n uint256 _roundDuration,\\n uint256 _timeToStartMachine,\\n uint256 _partitionSize,\\n uint256 _maxCycle,\\n uint256 _picoSecondsToRunInsn\\n ) public override pure returns (uint256) {\\n uint256 waitingQueryDuration = getMaxStateDuration(\\n state.WaitingQuery,\\n _roundDuration,\\n _timeToStartMachine,\\n _partitionSize,\\n 0, //_partitionGameIndex \\\"worst case\\\" is zero\\n _maxCycle,\\n _picoSecondsToRunInsn\\n );\\n\\n uint256 waitingHashesDuration = getMaxStateDuration(\\n state.WaitingHashes,\\n _roundDuration,\\n _timeToStartMachine,\\n _partitionSize,\\n 0, //_partitionGameIndex \\\"worst case\\\" is zero\\n _maxCycle,