Commit bf9a6979 authored by clabby's avatar clabby Committed by GitHub

feat(ctb): Optimistic large preimages (#8947)

* init keccak proposals

* merklelization

* merk fixes

* Preimage parts, challenge tests

* Tests

* bindings + snapshots

* lint

* tests

* bind

* :broom:, checks, tests

* Contiguous state tests

* :broom:, r4r

* review

* rabbit

* @refcell review

* bindings

* bindings

* @tynes review

* @inphi review
parent 58c9b324
...@@ -20,3 +20,6 @@ ...@@ -20,3 +20,6 @@
[submodule "packages/contracts-bedrock/lib/solady"] [submodule "packages/contracts-bedrock/lib/solady"]
path = packages/contracts-bedrock/lib/solady path = packages/contracts-bedrock/lib/solady
url = https://github.com/Vectorized/solady url = https://github.com/Vectorized/solady
[submodule "packages/contracts-bedrock/lib/lib-keccak"]
path = packages/contracts-bedrock/lib/lib-keccak
url = https://github.com/ethereum-optimism/lib-keccak
...@@ -31,7 +31,7 @@ var ( ...@@ -31,7 +31,7 @@ var (
// AlphabetVMMetaData contains all meta data concerning the AlphabetVM contract. // AlphabetVMMetaData contains all meta data concerning the AlphabetVM contract.
var AlphabetVMMetaData = &bind.MetaData{ var AlphabetVMMetaData = &bind.MetaData{
ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"_absolutePrestate\",\"type\":\"bytes32\",\"internalType\":\"Claim\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"oracle\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"contractIPreimageOracle\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"step\",\"inputs\":[{\"name\":\"_stateData\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"_localContext\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"postState_\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"}]", ABI: "[{\"type\":\"constructor\",\"inputs\":[{\"name\":\"_absolutePrestate\",\"type\":\"bytes32\",\"internalType\":\"Claim\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"oracle\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"contractIPreimageOracle\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"step\",\"inputs\":[{\"name\":\"_stateData\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"_localContext\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"postState_\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"}]",
Bin: "0x60a060405234801561001057600080fd5b50604051610c23380380610c2383398101604081905261002f91610090565b608081905260405161004090610083565b604051809103906000f08015801561005c573d6000803e3d6000fd5b50600080546001600160a01b0319166001600160a01b0392909216919091179055506100a9565b61065c806105c783390190565b6000602082840312156100a257600080fd5b5051919050565b6080516105046100c3600039600060af01526105046000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80637dc0d1d01461003b578063e14ced3214610085575b600080fd5b60005461005b9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b610098610093366004610395565b6100a6565b60405190815260200161007c565b600080600060087f0000000000000000000000000000000000000000000000000000000000000000901b600889896040516100e2929190610409565b6040518091039020901b036101d9576000805473ffffffffffffffffffffffffffffffffffffffff1663e03110e161011b60048861029f565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526004810191909152600060248201526044016040805180830381865afa158015610175573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101999190610419565b50640ffffffff0607c82901c169350905063ffffffff608082901c1660006101c38a8c018c61043d565b90506101cf8582610485565b9350505050610206565b6101e58789018961049d565b9092509050816101f4816104bf565b9250508080610202906104bf565b9150505b6040805160208101849052908101829052606001604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01000000000000000000000000000000000000000000000000000000000000001798975050505050505050565b7f01000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831617610345818360408051600093845233602052918152606090922091527effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01000000000000000000000000000000000000000000000000000000000000001790565b9392505050565b60008083601f84011261035e57600080fd5b50813567ffffffffffffffff81111561037657600080fd5b60208301915083602082850101111561038e57600080fd5b9250929050565b6000806000806000606086880312156103ad57600080fd5b853567ffffffffffffffff808211156103c557600080fd5b6103d189838a0161034c565b909750955060208801359150808211156103ea57600080fd5b506103f78882890161034c565b96999598509660400135949350505050565b8183823760009101908152919050565b6000806040838503121561042c57600080fd5b505080516020909101519092909150565b60006020828403121561044f57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000821982111561049857610498610456565b500190565b600080604083850312156104b057600080fd5b50508035926020909101359150565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036104f0576104f0610456565b506001019056fea164736f6c634300080f000a608060405234801561001057600080fd5b5061063c806100206000396000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c8063e03110e111610050578063e03110e114610106578063e15926111461012e578063fef2b4ed1461014357600080fd5b806352f0f3ad1461007757806361238bde1461009d5780638542cf50146100c8575b600080fd5b61008a6100853660046104df565b610163565b6040519081526020015b60405180910390f35b61008a6100ab36600461051a565b600160209081526000928352604080842090915290825290205481565b6100f66100d636600461051a565b600260209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610094565b61011961011436600461051a565b610238565b60408051928352602083019190915201610094565b61014161013c36600461053c565b610329565b005b61008a6101513660046105b8565b60006020819052908152604090205481565b600061016f8686610432565b905061017c836008610600565b8211806101895750602083115b156101c0576040517ffe25498700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000602081815260c085901b82526008959095528251828252600286526040808320858452875280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081179091558484528752808320948352938652838220558181529384905292205592915050565b6000828152600260209081526040808320848452909152812054819060ff166102c1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f7072652d696d616765206d757374206578697374000000000000000000000000604482015260640160405180910390fd5b50600083815260208181526040909120546102dd816008610600565b6102e8856020610600565b1061030657836102f9826008610600565b6103039190610618565b91505b506000938452600160209081526040808620948652939052919092205492909150565b604435600080600883018611156103485763fe2549876000526004601cfd5b60c083901b6080526088838682378087017ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80151908490207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f02000000000000000000000000000000000000000000000000000000000000001760008181526002602090815260408083208b8452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915584845282528083209a83529981528982209390935590815290819052959095209190915550505050565b7f01000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8316176104d8818360408051600093845233602052918152606090922091527effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01000000000000000000000000000000000000000000000000000000000000001790565b9392505050565b600080600080600060a086880312156104f757600080fd5b505083359560208501359550604085013594606081013594506080013592509050565b6000806040838503121561052d57600080fd5b50508035926020909101359150565b60008060006040848603121561055157600080fd5b83359250602084013567ffffffffffffffff8082111561057057600080fd5b818601915086601f83011261058457600080fd5b81358181111561059357600080fd5b8760208285010111156105a557600080fd5b6020830194508093505050509250925092565b6000602082840312156105ca57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115610613576106136105d1565b500190565b60008282101561062a5761062a6105d1565b50039056fea164736f6c634300080f000a", Bin: "0x60a060405234801561001057600080fd5b506040516132f03803806132f083398101604081905261002f91610090565b608081905260405161004090610083565b604051809103906000f08015801561005c573d6000803e3d6000fd5b50600080546001600160a01b0319166001600160a01b0392909216919091179055506100a9565b612d29806105c783390190565b6000602082840312156100a257600080fd5b5051919050565b6080516105046100c3600039600060af01526105046000f3fe608060405234801561001057600080fd5b50600436106100365760003560e01c80637dc0d1d01461003b578063e14ced3214610085575b600080fd5b60005461005b9073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b610098610093366004610395565b6100a6565b60405190815260200161007c565b600080600060087f0000000000000000000000000000000000000000000000000000000000000000901b600889896040516100e2929190610409565b6040518091039020901b036101d9576000805473ffffffffffffffffffffffffffffffffffffffff1663e03110e161011b60048861029f565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b1681526004810191909152600060248201526044016040805180830381865afa158015610175573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101999190610419565b50640ffffffff0607c82901c169350905063ffffffff608082901c1660006101c38a8c018c61043d565b90506101cf8582610485565b9350505050610206565b6101e58789018961049d565b9092509050816101f4816104bf565b9250508080610202906104bf565b9150505b6040805160208101849052908101829052606001604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe081840301815291905280516020909101207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01000000000000000000000000000000000000000000000000000000000000001798975050505050505050565b7f01000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831617610345818360408051600093845233602052918152606090922091527effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01000000000000000000000000000000000000000000000000000000000000001790565b9392505050565b60008083601f84011261035e57600080fd5b50813567ffffffffffffffff81111561037657600080fd5b60208301915083602082850101111561038e57600080fd5b9250929050565b6000806000806000606086880312156103ad57600080fd5b853567ffffffffffffffff808211156103c557600080fd5b6103d189838a0161034c565b909750955060208801359150808211156103ea57600080fd5b506103f78882890161034c565b96999598509660400135949350505050565b8183823760009101908152919050565b6000806040838503121561042c57600080fd5b505080516020909101519092909150565b60006020828403121561044f57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b6000821982111561049857610498610456565b500190565b600080604083850312156104b057600080fd5b50508035926020909101359150565b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff82036104f0576104f0610456565b506001019056fea164736f6c634300080f000a60806040523480156200001157600080fd5b5060005b6200002360016010620000db565b811015620000be5760038160108110620000415762000041620000f5565b015460038260108110620000595762000059620000f5565b01546040805160208101939093528201526060016040516020818303038152906040528051906020012060038260016200009491906200010b565b60108110620000a757620000a7620000f5565b015580620000b58162000126565b91505062000015565b5062000142565b634e487b7160e01b600052601160045260246000fd5b600082821015620000f057620000f0620000c5565b500390565b634e487b7160e01b600052603260045260246000fd5b60008219821115620001215762000121620000c5565b500190565b6000600182016200013b576200013b620000c5565b5060010190565b612bd780620001526000396000f3fe608060405234801561001057600080fd5b50600436106101515760003560e01c80639f99ef82116100cd578063e03110e111610081578063ec5efcbc11610066578063ec5efcbc14610304578063faf37bc714610317578063fef2b4ed1461032a57600080fd5b8063e03110e1146102c9578063e1592611146102f157600080fd5b8063b4801e61116100b2578063b4801e6114610299578063c3a079ed146102ac578063d18534b5146102b657600080fd5b80639f99ef821461025b578063b2e67ba81461026e57600080fd5b806352f0f3ad116101245780636551927b116101095780636551927b146101df5780637ac547671461020a5780638542cf501461021d57600080fd5b806352f0f3ad146101a157806361238bde146101b457600080fd5b80630359a563146101565780632055b36b1461017c5780633909af5c146101845780634d52b4c914610199575b600080fd5b61016961016436600461224e565b61034a565b6040519081526020015b60405180910390f35b610169601081565b610197610192366004612449565b610482565b005b6101696106d0565b6101696101af366004612535565b6106eb565b6101696101c2366004612570565b600160209081526000928352604080842090915290825290205481565b6101696101ed36600461224e565b601460209081526000928352604080842090915290825290205481565b610169610218366004612592565b6107c0565b61024b61022b366004612570565b600260209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610173565b6101976102693660046125ed565b6107d7565b61016961027c36600461224e565b601560209081526000928352604080842090915290825290205481565b6101696102a736600461267e565b610cc5565b6101696201518081565b6101976102c4366004612449565b610cf7565b6102dc6102d7366004612570565b6110a5565b60408051928352602083019190915201610173565b6101976102ff3660046126b1565b611196565b6101976103123660046126fd565b61129f565b610197610325366004612796565b611419565b610169610338366004612592565b60006020819052908152604090205481565b73ffffffffffffffffffffffffffffffffffffffff82166000908152601460209081526040808320848452909152812054819061038d9060601c63ffffffff1690565b63ffffffff16905060005b601081101561047a57816001166001036104205773ffffffffffffffffffffffffffffffffffffffff85166000908152601360209081526040808320878452909152902081601081106103ed576103ed6127d2565b01546040805160208101929092528101849052606001604051602081830303815290604052805190602001209250610461565b8260038260108110610434576104346127d2565b01546040805160208101939093528201526060016040516020818303038152906040528051906020012092505b60019190911c908061047281612830565b915050610398565b505092915050565b600061048e8a8a61034a565b90506104b186868360208b01356104ac6104a78d612868565b6114e2565b611522565b80156104cf57506104cf83838360208801356104ac6104a78a612868565b610505576040517f09bde33900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b86604001358860405160200161051b9190612937565b6040516020818303038152906040528051906020012014610568576040517f1968a90200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b83602001358760200135600161057e9190612975565b146105b5576040517f9a3b119900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105fd886105c3868061298d565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061158392505050565b610606886116de565b83604001358860405160200161061c9190612937565b6040516020818303038152906040528051906020012003610669576040517f9843145b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505073ffffffffffffffffffffffffffffffffffffffff9590951660009081526014602090815260408083209683529590529390932080547fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000016600117905550505050565b60016106de60106002612b14565b6106e89190612b20565b81565b60006106f78686611f7a565b9050610704836008612975565b8211806107115750602083115b15610748576040517ffe25498700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000602081815260c085901b82526008959095528251828252600286526040808320858452875280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081179091558484528752808320948352938652838220558181529384905292205592915050565b600381601081106107d057600080fd5b0154905081565b606081156107f0576107e98686612027565b905061082a565b85858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509293505050505b3360009081526013602090815260408083208a845290915280822081516102008101928390529160109082845b8154815260200190600101908083116108575750503360009081526014602090815260408083208f845290915290205493945061089992508391506120b09050565b63ffffffff166000036108d8576040517f87138d5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108e28160c01c90565b67ffffffffffffffff1615610923576040517f475a253500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006109358260a01c63ffffffff1690565b67ffffffffffffffff16905060006109538360401c63ffffffff1690565b63ffffffff169050600882108015610969575080155b156109f05760006109808460801c63ffffffff1690565b905060008160c01b6000528b356008528351905080601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008f8152602001908152602001600020819055505050610aa5565b60088210158015610a0e575080610a08600884612b20565b92508210155b8015610a225750610a1f8982612975565b82105b15610aa5576000610a338284612b20565b905089610a41826020612975565b10158015610a4d575086155b15610a84576040517ffe25498700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081526015602090815260408083208f84529091529020908b013590555b6000610ab78460601c63ffffffff1690565b63ffffffff169050855160208701608882048a1415608883061715610ae4576307b1daf16000526004601cfd5b60405160c8810160405260005b83811015610b94578083018051835260208101516020840152604081015160408401526060810151606084015260808101516080840152508460888301526088810460051b8d013560a883015260c882206001860195508560005b610200811015610b89576001821615610b695782818d0152610b89565b8b81015160009081526020938452604090209260019290921c9101610b4c565b505050608801610af1565b50505050600160106002610ba89190612b14565b610bb29190612b20565b811115610beb576040517f6229572300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081526013602090815260408083208f84529091529020610c119086601061219b565b50610c71610c1f838c612975565b60401b7fffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffff606084901b167fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff8716171790565b93508615610c9c5777ffffffffffffffffffffffffffffffffffffffffffffffff84164260c01b1793505b50503360009081526014602090815260408083209c83529b905299909920555050505050505050565b60136020528260005260406000206020528160005260406000208160108110610ced57600080fd5b0154925083915050565b73ffffffffffffffffffffffffffffffffffffffff891660009081526014602090815260408083208b845290915290205467ffffffffffffffff811615610d6a576040517fc334f06900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62015180610d788260c01c90565b610d8c9067ffffffffffffffff1642612b20565b11610dc3576040517f55d4cbf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610dcf8b8b61034a565b9050610de887878360208c01356104ac6104a78e612868565b8015610e065750610e0684848360208901356104ac6104a78b612868565b610e3c576040517f09bde33900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b876040013589604051602001610e529190612937565b6040516020818303038152906040528051906020012014610e9f576040517f1968a90200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b846020013588602001356001610eb59190612975565b141580610ee757506001610ecf8360601c63ffffffff1690565b610ed99190612b37565b63ffffffff16856020013514155b15610f1e576040517f9a3b119900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610f308360801c63ffffffff1690565b63ffffffff16905080610f498460401c63ffffffff1690565b63ffffffff1614610f86576040517f7b1dafd100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610f948a6105c3888061298d565b610f9d8a6116de565b6000610fa88b6120bc565b90506000610fbc8560a01c63ffffffff1690565b67ffffffffffffffff169050600160026000848152602001908152602001600020600083815260200190815260200160002060006101000a81548160ff021916908315150217905550601560008f73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008e8152602001908152602001600020546001600084815260200190815260200160002060008381526020019081526020016000208190555082600080848152602001908152602001600020819055505050505050505050505050505050565b6000828152600260209081526040808320848452909152812054819060ff1661112e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f7072652d696d616765206d757374206578697374000000000000000000000000604482015260640160405180910390fd5b506000838152602081815260409091205461114a816008612975565b611155856020612975565b106111735783611166826008612975565b6111709190612b20565b91505b506000938452600160209081526040808620948652939052919092205492909150565b604435600080600883018611156111b55763fe2549876000526004601cfd5b60c083901b6080526088838682378087017ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80151908490207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f02000000000000000000000000000000000000000000000000000000000000001760008181526002602090815260408083208b8452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915584845282528083209a83529981528982209390935590815290819052959095209190915550505050565b60006112ab868661034a565b90506112c483838360208801356104ac6104a78a612868565b6112fa576040517f09bde33900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b602084013515611336576040517f9a3b119900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61133e6121d9565b61134c816105c3878061298d565b611355816116de565b84604001358160405160200161136b9190612937565b60405160208183030381529060405280519060200120036113b8576040517f9843145b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505073ffffffffffffffffffffffffffffffffffffffff9290921660009081526014602090815260408083209383529290522080547fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000016600117905550565b611424816008612b5c565b63ffffffff168263ffffffff1610611468576040517ffe25498700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081526014602090815260408083209583529490529290922080547fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff1660a09290921b7fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff169190911760809290921b919091179055565b600081600001518260200151836040015160405160200161150593929190612b84565b604051602081830303815290604052805190602001209050919050565b60008160005b6010811015611576578060051b880135600186831c166001811461155b576000848152602083905260409020935061156c565b600082815260208590526040902093505b5050600101611528565b5090931495945050505050565b608881511461159157600080fd5b6020810160208301611612565b8260031b8201518060001a8160011a60081b178160021a60101b8260031a60181b17178160041a60201b8260051a60281b178260061a60301b8360071a60381b171717905061160c816115f7868560059190911b015190565b1867ffffffffffffffff16600586901b840152565b50505050565b61161e6000838361159e565b61162a6001838361159e565b6116366002838361159e565b6116426003838361159e565b61164e6004838361159e565b61165a6005838361159e565b6116666006838361159e565b6116726007838361159e565b61167e6008838361159e565b61168a6009838361159e565b611696600a838361159e565b6116a2600b838361159e565b6116ae600c838361159e565b6116ba600d838361159e565b6116c6600e838361159e565b6116d2600f838361159e565b61160c6010838361159e565b6040805178010000000000008082800000000000808a8000000080008000602082015279808b00000000800000018000000080008081800000000000800991810191909152788a00000000000000880000000080008009000000008000000a60608201527b8000808b800000000000008b8000000000008089800000000000800360808201527f80000000000080028000000000000080000000000000800a800000008000000a60a08201527f800000008000808180000000000080800000000080000001800000008000800860c082015260009060e00160405160208183030381529060405290506020820160208201611e5a565b6102808101516101e082015161014083015160a0840151845118189118186102a082015161020083015161016084015160c0850151602086015118189118186102c083015161022084015161018085015160e0860151604087015118189118186102e08401516102408501516101a0860151610100870151606088015118189118186103008501516102608601516101c0870151610120880151608089015118189118188084603f1c6118918660011b67ffffffffffffffff1690565b18188584603f1c6118ac8660011b67ffffffffffffffff1690565b18188584603f1c6118c78660011b67ffffffffffffffff1690565b181895508483603f1c6118e48560011b67ffffffffffffffff1690565b181894508387603f1c6119018960011b67ffffffffffffffff1690565b60208b01518b51861867ffffffffffffffff168c5291189190911897508118600181901b603f9190911c18935060c08801518118601481901c602c9190911b1867ffffffffffffffff1660208901526101208801518718602c81901c60149190911b1867ffffffffffffffff1660c08901526102c08801518618600381901c603d9190911b1867ffffffffffffffff166101208901526101c08801518718601981901c60279190911b1867ffffffffffffffff166102c08901526102808801518218602e81901c60129190911b1867ffffffffffffffff166101c089015260408801518618600281901c603e9190911b1867ffffffffffffffff166102808901526101808801518618601581901c602b9190911b1867ffffffffffffffff1660408901526101a08801518518602781901c60199190911b1867ffffffffffffffff166101808901526102608801518718603881901c60089190911b1867ffffffffffffffff166101a08901526102e08801518518600881901c60389190911b1867ffffffffffffffff166102608901526101e08801518218601781901c60299190911b1867ffffffffffffffff166102e089015260808801518718602581901c601b9190911b1867ffffffffffffffff166101e08901526103008801518718603281901c600e9190911b1867ffffffffffffffff1660808901526102a08801518118603e81901c60029190911b1867ffffffffffffffff166103008901526101008801518518600981901c60379190911b1867ffffffffffffffff166102a08901526102008801518118601381901c602d9190911b1867ffffffffffffffff1661010089015260a08801518218601c81901c60249190911b1867ffffffffffffffff1661020089015260608801518518602481901c601c9190911b1867ffffffffffffffff1660a08901526102408801518518602b81901c60159190911b1867ffffffffffffffff1660608901526102208801518618603181901c600f9190911b1867ffffffffffffffff166102408901526101608801518118603681901c600a9190911b1867ffffffffffffffff166102208901525060e08701518518603a81901c60069190911b1867ffffffffffffffff166101608801526101408701518118603d81901c60039190911b1867ffffffffffffffff1660e0880152505067ffffffffffffffff81166101408601525050505050565b611c81816117d4565b805160208201805160408401805160608601805160808801805167ffffffffffffffff871986168a188116808c528619851689188216909952831982169095188516909552841988169091188316909152941990921618811690925260a08301805160c0808601805160e0880180516101008a0180516101208c018051861985168a188d16909a528319821686188c16909652801989169092188a169092528619861618881690529219909216909218841690526101408401805161016086018051610180880180516101a08a0180516101c08c0180518619851689188d169099528319821686188c16909652801988169092188a169092528519851618881690529119909116909118841690526101e08401805161020086018051610220880180516102408a0180516102608c0180518619851689188d169099528319821686188c16909652801988169092188a16909252851985161888169052911990911690911884169052610280840180516102a0860180516102c0880180516102e08a0180516103008c0180518619851689188d169099528319821686188c16909652801988169092188a16909252851985161888169052911990911690911884169052600386901b850151901c908118909116825261160c565b611e6660008284611c78565b611e7260018284611c78565b611e7e60028284611c78565b611e8a60038284611c78565b611e9660048284611c78565b611ea260058284611c78565b611eae60068284611c78565b611eba60078284611c78565b611ec660088284611c78565b611ed260098284611c78565b611ede600a8284611c78565b611eea600b8284611c78565b611ef6600c8284611c78565b611f02600d8284611c78565b611f0e600e8284611c78565b611f1a600f8284611c78565b611f2660108284611c78565b611f3260118284611c78565b611f3e60128284611c78565b611f4a60138284611c78565b611f5660148284611c78565b611f6260158284611c78565b611f6e60168284611c78565b61160c60178284611c78565b7f01000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831617612020818360408051600093845233602052918152606090922091527effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01000000000000000000000000000000000000000000000000000000000000001790565b9392505050565b6060604051905081602082018181018286833760888306808015612085576088829003850160808582017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01536001845160001a1784538652612097565b60018353608060878401536088850186525b5050505050601f19603f82510116810160405292915050565b60801c63ffffffff1690565b600061213f565b66ff00ff00ff00ff8160081c1667ff00ff00ff00ff006120ed8360081b67ffffffffffffffff1690565b1617905065ffff0000ffff8160101c1667ffff0000ffff000061211a8360101b67ffffffffffffffff1690565b1617905060008160201c6121388360201b67ffffffffffffffff1690565b1792915050565b60808201516020830190612157906120c3565b6120c3565b6040820151612165906120c3565b60401b1761217d61215260018460059190911b015190565b825160809190911b9061218f906120c3565b60c01b17179392505050565b82601081019282156121c9579160200282015b828111156121c95782518255916020019190600101906121ae565b506121d59291506121f1565b5090565b60405180602001604052806121ec612206565b905290565b5b808211156121d557600081556001016121f2565b6040518061032001604052806019906020820280368337509192915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461224957600080fd5b919050565b6000806040838503121561226157600080fd5b61226a83612225565b946020939093013593505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610320810167ffffffffffffffff811182821017156122cb576122cb612278565b60405290565b6040516060810167ffffffffffffffff811182821017156122cb576122cb612278565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561233b5761233b612278565b604052919050565b600061032080838503121561235757600080fd5b604051602080820167ffffffffffffffff838210818311171561237c5761237c612278565b8160405283955087601f88011261239257600080fd5b61239a6122a7565b94870194915081888611156123ae57600080fd5b875b868110156123d657803583811681146123c95760008081fd5b84529284019284016123b0565b50909352509295945050505050565b6000606082840312156123f757600080fd5b50919050565b60008083601f84011261240f57600080fd5b50813567ffffffffffffffff81111561242757600080fd5b6020830191508360208260051b850101111561244257600080fd5b9250929050565b60008060008060008060008060006103e08a8c03121561246857600080fd5b6124718a612225565b985060208a013597506124878b60408c01612343565b96506103608a013567ffffffffffffffff808211156124a557600080fd5b6124b18d838e016123e5565b97506103808c01359150808211156124c857600080fd5b6124d48d838e016123fd565b90975095506103a08c01359150808211156124ee57600080fd5b6124fa8d838e016123e5565b94506103c08c013591508082111561251157600080fd5b5061251e8c828d016123fd565b915080935050809150509295985092959850929598565b600080600080600060a0868803121561254d57600080fd5b505083359560208501359550604085013594606081013594506080013592509050565b6000806040838503121561258357600080fd5b50508035926020909101359150565b6000602082840312156125a457600080fd5b5035919050565b60008083601f8401126125bd57600080fd5b50813567ffffffffffffffff8111156125d557600080fd5b60208301915083602082850101111561244257600080fd5b6000806000806000806080878903121561260657600080fd5b86359550602087013567ffffffffffffffff8082111561262557600080fd5b6126318a838b016125ab565b9097509550604089013591508082111561264a57600080fd5b5061265789828a016123fd565b9094509250506060870135801515811461267057600080fd5b809150509295509295509295565b60008060006060848603121561269357600080fd5b61269c84612225565b95602085013595506040909401359392505050565b6000806000604084860312156126c657600080fd5b83359250602084013567ffffffffffffffff8111156126e457600080fd5b6126f0868287016125ab565b9497909650939450505050565b60008060008060006080868803121561271557600080fd5b61271e86612225565b945060208601359350604086013567ffffffffffffffff8082111561274257600080fd5b61274e89838a016123e5565b9450606088013591508082111561276457600080fd5b50612771888289016123fd565b969995985093965092949392505050565b803563ffffffff8116811461224957600080fd5b6000806000606084860312156127ab57600080fd5b833592506127bb60208501612782565b91506127c960408501612782565b90509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361286157612861612801565b5060010190565b60006060823603121561287a57600080fd5b6128826122d1565b823567ffffffffffffffff8082111561289a57600080fd5b9084019036601f8301126128ad57600080fd5b81356020828211156128c1576128c1612278565b6128f1817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f850116016122f4565b9250818352368183860101111561290757600080fd5b81818501828501376000918301810191909152908352848101359083015250604092830135928101929092525090565b81516103208201908260005b601981101561296c57825167ffffffffffffffff16825260209283019290910190600101612943565b50505092915050565b6000821982111561298857612988612801565b500190565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126129c257600080fd5b83018035915067ffffffffffffffff8211156129dd57600080fd5b60200191503681900382131561244257600080fd5b600181815b80851115612a4b57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115612a3157612a31612801565b80851615612a3e57918102915b93841c93908002906129f7565b509250929050565b600082612a6257506001612b0e565b81612a6f57506000612b0e565b8160018114612a855760028114612a8f57612aab565b6001915050612b0e565b60ff841115612aa057612aa0612801565b50506001821b612b0e565b5060208310610133831016604e8410600b8410161715612ace575081810a612b0e565b612ad883836129f2565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115612b0a57612b0a612801565b0290505b92915050565b60006120208383612a53565b600082821015612b3257612b32612801565b500390565b600063ffffffff83811690831681811015612b5457612b54612801565b039392505050565b600063ffffffff808316818516808303821115612b7b57612b7b612801565b01949350505050565b6000845160005b81811015612ba55760208188018101518583015201612b8b565b81811115612bb4576000828501525b509190910192835250602082015260400191905056fea164736f6c634300080f000a",
} }
// AlphabetVMABI is the input ABI used to generate the binding from. // AlphabetVMABI is the input ABI used to generate the binding from.
......
...@@ -28,10 +28,22 @@ var ( ...@@ -28,10 +28,22 @@ var (
_ = event.NewSubscription _ = event.NewSubscription
) )
// LibKeccakStateMatrix is an auto generated low-level Go binding around an user-defined struct.
type LibKeccakStateMatrix struct {
State [25]uint64
}
// PreimageOracleLeaf is an auto generated low-level Go binding around an user-defined struct.
type PreimageOracleLeaf struct {
Input []byte
Index *big.Int
StateCommitment [32]byte
}
// PreimageOracleMetaData contains all meta data concerning the PreimageOracle contract. // PreimageOracleMetaData contains all meta data concerning the PreimageOracle contract.
var PreimageOracleMetaData = &bind.MetaData{ var PreimageOracleMetaData = &bind.MetaData{
ABI: "[{\"type\":\"function\",\"name\":\"loadKeccak256PreimagePart\",\"inputs\":[{\"name\":\"_partOffset\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_preimage\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"loadLocalData\",\"inputs\":[{\"name\":\"_ident\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_localContext\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_word\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_size\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_partOffset\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"key_\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"preimageLengths\",\"inputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"preimagePartOk\",\"inputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"preimageParts\",\"inputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"readPreimage\",\"inputs\":[{\"name\":\"_key\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_offset\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"dat_\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"datLen_\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"error\",\"name\":\"PartOffsetOOB\",\"inputs\":[]}]", ABI: "[{\"type\":\"constructor\",\"inputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"CHALLENGE_PERIOD\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"KECCAK_TREE_DEPTH\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"MAX_LEAF_COUNT\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"addLeavesLPP\",\"inputs\":[{\"name\":\"_uuid\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_input\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"_stateCommitments\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"},{\"name\":\"_finalize\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"challengeFirstLPP\",\"inputs\":[{\"name\":\"_claimant\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_uuid\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_postState\",\"type\":\"tuple\",\"internalType\":\"structPreimageOracle.Leaf\",\"components\":[{\"name\":\"input\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"index\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"stateCommitment\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"_postStateProof\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"challengeLPP\",\"inputs\":[{\"name\":\"_claimant\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_uuid\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_stateMatrix\",\"type\":\"tuple\",\"internalType\":\"structLibKeccak.StateMatrix\",\"components\":[{\"name\":\"state\",\"type\":\"uint64[25]\",\"internalType\":\"uint64[25]\"}]},{\"name\":\"_preState\",\"type\":\"tuple\",\"internalType\":\"structPreimageOracle.Leaf\",\"components\":[{\"name\":\"input\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"index\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"stateCommitment\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"_preStateProof\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"},{\"name\":\"_postState\",\"type\":\"tuple\",\"internalType\":\"structPreimageOracle.Leaf\",\"components\":[{\"name\":\"input\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"index\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"stateCommitment\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"_postStateProof\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"getTreeRootLPP\",\"inputs\":[{\"name\":\"_owner\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_uuid\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"treeRoot_\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"initLPP\",\"inputs\":[{\"name\":\"_uuid\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_partOffset\",\"type\":\"uint32\",\"internalType\":\"uint32\"},{\"name\":\"_claimedSize\",\"type\":\"uint32\",\"internalType\":\"uint32\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"loadKeccak256PreimagePart\",\"inputs\":[{\"name\":\"_partOffset\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_preimage\",\"type\":\"bytes\",\"internalType\":\"bytes\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"loadLocalData\",\"inputs\":[{\"name\":\"_ident\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_localContext\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_word\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_size\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_partOffset\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"key_\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"preimageLengths\",\"inputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"preimagePartOk\",\"inputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"preimageParts\",\"inputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"proposalBranches\",\"inputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"proposalMetadata\",\"inputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"LPPMetaData\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"proposalParts\",\"inputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"readPreimage\",\"inputs\":[{\"name\":\"_key\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"_offset\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"dat_\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"},{\"name\":\"datLen_\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"squeezeLPP\",\"inputs\":[{\"name\":\"_claimant\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"_uuid\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"_stateMatrix\",\"type\":\"tuple\",\"internalType\":\"structLibKeccak.StateMatrix\",\"components\":[{\"name\":\"state\",\"type\":\"uint64[25]\",\"internalType\":\"uint64[25]\"}]},{\"name\":\"_preState\",\"type\":\"tuple\",\"internalType\":\"structPreimageOracle.Leaf\",\"components\":[{\"name\":\"input\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"index\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"stateCommitment\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"_preStateProof\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"},{\"name\":\"_postState\",\"type\":\"tuple\",\"internalType\":\"structPreimageOracle.Leaf\",\"components\":[{\"name\":\"input\",\"type\":\"bytes\",\"internalType\":\"bytes\"},{\"name\":\"index\",\"type\":\"uint256\",\"internalType\":\"uint256\"},{\"name\":\"stateCommitment\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}]},{\"name\":\"_postStateProof\",\"type\":\"bytes32[]\",\"internalType\":\"bytes32[]\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"zeroHashes\",\"inputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\",\"internalType\":\"bytes32\"}],\"stateMutability\":\"view\"},{\"type\":\"error\",\"name\":\"ActiveProposal\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"AlreadyFinalized\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"BadProposal\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidInputSize\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidPreimage\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"InvalidProof\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"NotInitialized\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"PartOffsetOOB\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"PostStateMatches\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"StatesNotContiguous\",\"inputs\":[]},{\"type\":\"error\",\"name\":\"TreeSizeOverflow\",\"inputs\":[]}]",
Bin: "0x608060405234801561001057600080fd5b5061063c806100206000396000f3fe608060405234801561001057600080fd5b50600436106100725760003560e01c8063e03110e111610050578063e03110e114610106578063e15926111461012e578063fef2b4ed1461014357600080fd5b806352f0f3ad1461007757806361238bde1461009d5780638542cf50146100c8575b600080fd5b61008a6100853660046104df565b610163565b6040519081526020015b60405180910390f35b61008a6100ab36600461051a565b600160209081526000928352604080842090915290825290205481565b6100f66100d636600461051a565b600260209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610094565b61011961011436600461051a565b610238565b60408051928352602083019190915201610094565b61014161013c36600461053c565b610329565b005b61008a6101513660046105b8565b60006020819052908152604090205481565b600061016f8686610432565b905061017c836008610600565b8211806101895750602083115b156101c0576040517ffe25498700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000602081815260c085901b82526008959095528251828252600286526040808320858452875280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081179091558484528752808320948352938652838220558181529384905292205592915050565b6000828152600260209081526040808320848452909152812054819060ff166102c1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f7072652d696d616765206d757374206578697374000000000000000000000000604482015260640160405180910390fd5b50600083815260208181526040909120546102dd816008610600565b6102e8856020610600565b1061030657836102f9826008610600565b6103039190610618565b91505b506000938452600160209081526040808620948652939052919092205492909150565b604435600080600883018611156103485763fe2549876000526004601cfd5b60c083901b6080526088838682378087017ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80151908490207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f02000000000000000000000000000000000000000000000000000000000000001760008181526002602090815260408083208b8452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915584845282528083209a83529981528982209390935590815290819052959095209190915550505050565b7f01000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8316176104d8818360408051600093845233602052918152606090922091527effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01000000000000000000000000000000000000000000000000000000000000001790565b9392505050565b600080600080600060a086880312156104f757600080fd5b505083359560208501359550604085013594606081013594506080013592509050565b6000806040838503121561052d57600080fd5b50508035926020909101359150565b60008060006040848603121561055157600080fd5b83359250602084013567ffffffffffffffff8082111561057057600080fd5b818601915086601f83011261058457600080fd5b81358181111561059357600080fd5b8760208285010111156105a557600080fd5b6020830194508093505050509250925092565b6000602082840312156105ca57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115610613576106136105d1565b500190565b60008282101561062a5761062a6105d1565b50039056fea164736f6c634300080f000a", Bin: "0x60806040523480156200001157600080fd5b5060005b6200002360016010620000db565b811015620000be5760038160108110620000415762000041620000f5565b015460038260108110620000595762000059620000f5565b01546040805160208101939093528201526060016040516020818303038152906040528051906020012060038260016200009491906200010b565b60108110620000a757620000a7620000f5565b015580620000b58162000126565b91505062000015565b5062000142565b634e487b7160e01b600052601160045260246000fd5b600082821015620000f057620000f0620000c5565b500390565b634e487b7160e01b600052603260045260246000fd5b60008219821115620001215762000121620000c5565b500190565b6000600182016200013b576200013b620000c5565b5060010190565b612bd780620001526000396000f3fe608060405234801561001057600080fd5b50600436106101515760003560e01c80639f99ef82116100cd578063e03110e111610081578063ec5efcbc11610066578063ec5efcbc14610304578063faf37bc714610317578063fef2b4ed1461032a57600080fd5b8063e03110e1146102c9578063e1592611146102f157600080fd5b8063b4801e61116100b2578063b4801e6114610299578063c3a079ed146102ac578063d18534b5146102b657600080fd5b80639f99ef821461025b578063b2e67ba81461026e57600080fd5b806352f0f3ad116101245780636551927b116101095780636551927b146101df5780637ac547671461020a5780638542cf501461021d57600080fd5b806352f0f3ad146101a157806361238bde146101b457600080fd5b80630359a563146101565780632055b36b1461017c5780633909af5c146101845780634d52b4c914610199575b600080fd5b61016961016436600461224e565b61034a565b6040519081526020015b60405180910390f35b610169601081565b610197610192366004612449565b610482565b005b6101696106d0565b6101696101af366004612535565b6106eb565b6101696101c2366004612570565b600160209081526000928352604080842090915290825290205481565b6101696101ed36600461224e565b601460209081526000928352604080842090915290825290205481565b610169610218366004612592565b6107c0565b61024b61022b366004612570565b600260209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610173565b6101976102693660046125ed565b6107d7565b61016961027c36600461224e565b601560209081526000928352604080842090915290825290205481565b6101696102a736600461267e565b610cc5565b6101696201518081565b6101976102c4366004612449565b610cf7565b6102dc6102d7366004612570565b6110a5565b60408051928352602083019190915201610173565b6101976102ff3660046126b1565b611196565b6101976103123660046126fd565b61129f565b610197610325366004612796565b611419565b610169610338366004612592565b60006020819052908152604090205481565b73ffffffffffffffffffffffffffffffffffffffff82166000908152601460209081526040808320848452909152812054819061038d9060601c63ffffffff1690565b63ffffffff16905060005b601081101561047a57816001166001036104205773ffffffffffffffffffffffffffffffffffffffff85166000908152601360209081526040808320878452909152902081601081106103ed576103ed6127d2565b01546040805160208101929092528101849052606001604051602081830303815290604052805190602001209250610461565b8260038260108110610434576104346127d2565b01546040805160208101939093528201526060016040516020818303038152906040528051906020012092505b60019190911c908061047281612830565b915050610398565b505092915050565b600061048e8a8a61034a565b90506104b186868360208b01356104ac6104a78d612868565b6114e2565b611522565b80156104cf57506104cf83838360208801356104ac6104a78a612868565b610505576040517f09bde33900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b86604001358860405160200161051b9190612937565b6040516020818303038152906040528051906020012014610568576040517f1968a90200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b83602001358760200135600161057e9190612975565b146105b5576040517f9a3b119900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105fd886105c3868061298d565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061158392505050565b610606886116de565b83604001358860405160200161061c9190612937565b6040516020818303038152906040528051906020012003610669576040517f9843145b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505073ffffffffffffffffffffffffffffffffffffffff9590951660009081526014602090815260408083209683529590529390932080547fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000016600117905550505050565b60016106de60106002612b14565b6106e89190612b20565b81565b60006106f78686611f7a565b9050610704836008612975565b8211806107115750602083115b15610748576040517ffe25498700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000602081815260c085901b82526008959095528251828252600286526040808320858452875280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081179091558484528752808320948352938652838220558181529384905292205592915050565b600381601081106107d057600080fd5b0154905081565b606081156107f0576107e98686612027565b905061082a565b85858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509293505050505b3360009081526013602090815260408083208a845290915280822081516102008101928390529160109082845b8154815260200190600101908083116108575750503360009081526014602090815260408083208f845290915290205493945061089992508391506120b09050565b63ffffffff166000036108d8576040517f87138d5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108e28160c01c90565b67ffffffffffffffff1615610923576040517f475a253500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006109358260a01c63ffffffff1690565b67ffffffffffffffff16905060006109538360401c63ffffffff1690565b63ffffffff169050600882108015610969575080155b156109f05760006109808460801c63ffffffff1690565b905060008160c01b6000528b356008528351905080601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008f8152602001908152602001600020819055505050610aa5565b60088210158015610a0e575080610a08600884612b20565b92508210155b8015610a225750610a1f8982612975565b82105b15610aa5576000610a338284612b20565b905089610a41826020612975565b10158015610a4d575086155b15610a84576040517ffe25498700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081526015602090815260408083208f84529091529020908b013590555b6000610ab78460601c63ffffffff1690565b63ffffffff169050855160208701608882048a1415608883061715610ae4576307b1daf16000526004601cfd5b60405160c8810160405260005b83811015610b94578083018051835260208101516020840152604081015160408401526060810151606084015260808101516080840152508460888301526088810460051b8d013560a883015260c882206001860195508560005b610200811015610b89576001821615610b695782818d0152610b89565b8b81015160009081526020938452604090209260019290921c9101610b4c565b505050608801610af1565b50505050600160106002610ba89190612b14565b610bb29190612b20565b811115610beb576040517f6229572300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081526013602090815260408083208f84529091529020610c119086601061219b565b50610c71610c1f838c612975565b60401b7fffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffff606084901b167fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff8716171790565b93508615610c9c5777ffffffffffffffffffffffffffffffffffffffffffffffff84164260c01b1793505b50503360009081526014602090815260408083209c83529b905299909920555050505050505050565b60136020528260005260406000206020528160005260406000208160108110610ced57600080fd5b0154925083915050565b73ffffffffffffffffffffffffffffffffffffffff891660009081526014602090815260408083208b845290915290205467ffffffffffffffff811615610d6a576040517fc334f06900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62015180610d788260c01c90565b610d8c9067ffffffffffffffff1642612b20565b11610dc3576040517f55d4cbf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610dcf8b8b61034a565b9050610de887878360208c01356104ac6104a78e612868565b8015610e065750610e0684848360208901356104ac6104a78b612868565b610e3c576040517f09bde33900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b876040013589604051602001610e529190612937565b6040516020818303038152906040528051906020012014610e9f576040517f1968a90200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b846020013588602001356001610eb59190612975565b141580610ee757506001610ecf8360601c63ffffffff1690565b610ed99190612b37565b63ffffffff16856020013514155b15610f1e576040517f9a3b119900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610f308360801c63ffffffff1690565b63ffffffff16905080610f498460401c63ffffffff1690565b63ffffffff1614610f86576040517f7b1dafd100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610f948a6105c3888061298d565b610f9d8a6116de565b6000610fa88b6120bc565b90506000610fbc8560a01c63ffffffff1690565b67ffffffffffffffff169050600160026000848152602001908152602001600020600083815260200190815260200160002060006101000a81548160ff021916908315150217905550601560008f73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008e8152602001908152602001600020546001600084815260200190815260200160002060008381526020019081526020016000208190555082600080848152602001908152602001600020819055505050505050505050505050505050565b6000828152600260209081526040808320848452909152812054819060ff1661112e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f7072652d696d616765206d757374206578697374000000000000000000000000604482015260640160405180910390fd5b506000838152602081815260409091205461114a816008612975565b611155856020612975565b106111735783611166826008612975565b6111709190612b20565b91505b506000938452600160209081526040808620948652939052919092205492909150565b604435600080600883018611156111b55763fe2549876000526004601cfd5b60c083901b6080526088838682378087017ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80151908490207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f02000000000000000000000000000000000000000000000000000000000000001760008181526002602090815260408083208b8452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915584845282528083209a83529981528982209390935590815290819052959095209190915550505050565b60006112ab868661034a565b90506112c483838360208801356104ac6104a78a612868565b6112fa576040517f09bde33900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b602084013515611336576040517f9a3b119900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61133e6121d9565b61134c816105c3878061298d565b611355816116de565b84604001358160405160200161136b9190612937565b60405160208183030381529060405280519060200120036113b8576040517f9843145b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505073ffffffffffffffffffffffffffffffffffffffff9290921660009081526014602090815260408083209383529290522080547fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000016600117905550565b611424816008612b5c565b63ffffffff168263ffffffff1610611468576040517ffe25498700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081526014602090815260408083209583529490529290922080547fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff1660a09290921b7fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff169190911760809290921b919091179055565b600081600001518260200151836040015160405160200161150593929190612b84565b604051602081830303815290604052805190602001209050919050565b60008160005b6010811015611576578060051b880135600186831c166001811461155b576000848152602083905260409020935061156c565b600082815260208590526040902093505b5050600101611528565b5090931495945050505050565b608881511461159157600080fd5b6020810160208301611612565b8260031b8201518060001a8160011a60081b178160021a60101b8260031a60181b17178160041a60201b8260051a60281b178260061a60301b8360071a60381b171717905061160c816115f7868560059190911b015190565b1867ffffffffffffffff16600586901b840152565b50505050565b61161e6000838361159e565b61162a6001838361159e565b6116366002838361159e565b6116426003838361159e565b61164e6004838361159e565b61165a6005838361159e565b6116666006838361159e565b6116726007838361159e565b61167e6008838361159e565b61168a6009838361159e565b611696600a838361159e565b6116a2600b838361159e565b6116ae600c838361159e565b6116ba600d838361159e565b6116c6600e838361159e565b6116d2600f838361159e565b61160c6010838361159e565b6040805178010000000000008082800000000000808a8000000080008000602082015279808b00000000800000018000000080008081800000000000800991810191909152788a00000000000000880000000080008009000000008000000a60608201527b8000808b800000000000008b8000000000008089800000000000800360808201527f80000000000080028000000000000080000000000000800a800000008000000a60a08201527f800000008000808180000000000080800000000080000001800000008000800860c082015260009060e00160405160208183030381529060405290506020820160208201611e5a565b6102808101516101e082015161014083015160a0840151845118189118186102a082015161020083015161016084015160c0850151602086015118189118186102c083015161022084015161018085015160e0860151604087015118189118186102e08401516102408501516101a0860151610100870151606088015118189118186103008501516102608601516101c0870151610120880151608089015118189118188084603f1c6118918660011b67ffffffffffffffff1690565b18188584603f1c6118ac8660011b67ffffffffffffffff1690565b18188584603f1c6118c78660011b67ffffffffffffffff1690565b181895508483603f1c6118e48560011b67ffffffffffffffff1690565b181894508387603f1c6119018960011b67ffffffffffffffff1690565b60208b01518b51861867ffffffffffffffff168c5291189190911897508118600181901b603f9190911c18935060c08801518118601481901c602c9190911b1867ffffffffffffffff1660208901526101208801518718602c81901c60149190911b1867ffffffffffffffff1660c08901526102c08801518618600381901c603d9190911b1867ffffffffffffffff166101208901526101c08801518718601981901c60279190911b1867ffffffffffffffff166102c08901526102808801518218602e81901c60129190911b1867ffffffffffffffff166101c089015260408801518618600281901c603e9190911b1867ffffffffffffffff166102808901526101808801518618601581901c602b9190911b1867ffffffffffffffff1660408901526101a08801518518602781901c60199190911b1867ffffffffffffffff166101808901526102608801518718603881901c60089190911b1867ffffffffffffffff166101a08901526102e08801518518600881901c60389190911b1867ffffffffffffffff166102608901526101e08801518218601781901c60299190911b1867ffffffffffffffff166102e089015260808801518718602581901c601b9190911b1867ffffffffffffffff166101e08901526103008801518718603281901c600e9190911b1867ffffffffffffffff1660808901526102a08801518118603e81901c60029190911b1867ffffffffffffffff166103008901526101008801518518600981901c60379190911b1867ffffffffffffffff166102a08901526102008801518118601381901c602d9190911b1867ffffffffffffffff1661010089015260a08801518218601c81901c60249190911b1867ffffffffffffffff1661020089015260608801518518602481901c601c9190911b1867ffffffffffffffff1660a08901526102408801518518602b81901c60159190911b1867ffffffffffffffff1660608901526102208801518618603181901c600f9190911b1867ffffffffffffffff166102408901526101608801518118603681901c600a9190911b1867ffffffffffffffff166102208901525060e08701518518603a81901c60069190911b1867ffffffffffffffff166101608801526101408701518118603d81901c60039190911b1867ffffffffffffffff1660e0880152505067ffffffffffffffff81166101408601525050505050565b611c81816117d4565b805160208201805160408401805160608601805160808801805167ffffffffffffffff871986168a188116808c528619851689188216909952831982169095188516909552841988169091188316909152941990921618811690925260a08301805160c0808601805160e0880180516101008a0180516101208c018051861985168a188d16909a528319821686188c16909652801989169092188a169092528619861618881690529219909216909218841690526101408401805161016086018051610180880180516101a08a0180516101c08c0180518619851689188d169099528319821686188c16909652801988169092188a169092528519851618881690529119909116909118841690526101e08401805161020086018051610220880180516102408a0180516102608c0180518619851689188d169099528319821686188c16909652801988169092188a16909252851985161888169052911990911690911884169052610280840180516102a0860180516102c0880180516102e08a0180516103008c0180518619851689188d169099528319821686188c16909652801988169092188a16909252851985161888169052911990911690911884169052600386901b850151901c908118909116825261160c565b611e6660008284611c78565b611e7260018284611c78565b611e7e60028284611c78565b611e8a60038284611c78565b611e9660048284611c78565b611ea260058284611c78565b611eae60068284611c78565b611eba60078284611c78565b611ec660088284611c78565b611ed260098284611c78565b611ede600a8284611c78565b611eea600b8284611c78565b611ef6600c8284611c78565b611f02600d8284611c78565b611f0e600e8284611c78565b611f1a600f8284611c78565b611f2660108284611c78565b611f3260118284611c78565b611f3e60128284611c78565b611f4a60138284611c78565b611f5660148284611c78565b611f6260158284611c78565b611f6e60168284611c78565b61160c60178284611c78565b7f01000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831617612020818360408051600093845233602052918152606090922091527effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01000000000000000000000000000000000000000000000000000000000000001790565b9392505050565b6060604051905081602082018181018286833760888306808015612085576088829003850160808582017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01536001845160001a1784538652612097565b60018353608060878401536088850186525b5050505050601f19603f82510116810160405292915050565b60801c63ffffffff1690565b600061213f565b66ff00ff00ff00ff8160081c1667ff00ff00ff00ff006120ed8360081b67ffffffffffffffff1690565b1617905065ffff0000ffff8160101c1667ffff0000ffff000061211a8360101b67ffffffffffffffff1690565b1617905060008160201c6121388360201b67ffffffffffffffff1690565b1792915050565b60808201516020830190612157906120c3565b6120c3565b6040820151612165906120c3565b60401b1761217d61215260018460059190911b015190565b825160809190911b9061218f906120c3565b60c01b17179392505050565b82601081019282156121c9579160200282015b828111156121c95782518255916020019190600101906121ae565b506121d59291506121f1565b5090565b60405180602001604052806121ec612206565b905290565b5b808211156121d557600081556001016121f2565b6040518061032001604052806019906020820280368337509192915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461224957600080fd5b919050565b6000806040838503121561226157600080fd5b61226a83612225565b946020939093013593505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610320810167ffffffffffffffff811182821017156122cb576122cb612278565b60405290565b6040516060810167ffffffffffffffff811182821017156122cb576122cb612278565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561233b5761233b612278565b604052919050565b600061032080838503121561235757600080fd5b604051602080820167ffffffffffffffff838210818311171561237c5761237c612278565b8160405283955087601f88011261239257600080fd5b61239a6122a7565b94870194915081888611156123ae57600080fd5b875b868110156123d657803583811681146123c95760008081fd5b84529284019284016123b0565b50909352509295945050505050565b6000606082840312156123f757600080fd5b50919050565b60008083601f84011261240f57600080fd5b50813567ffffffffffffffff81111561242757600080fd5b6020830191508360208260051b850101111561244257600080fd5b9250929050565b60008060008060008060008060006103e08a8c03121561246857600080fd5b6124718a612225565b985060208a013597506124878b60408c01612343565b96506103608a013567ffffffffffffffff808211156124a557600080fd5b6124b18d838e016123e5565b97506103808c01359150808211156124c857600080fd5b6124d48d838e016123fd565b90975095506103a08c01359150808211156124ee57600080fd5b6124fa8d838e016123e5565b94506103c08c013591508082111561251157600080fd5b5061251e8c828d016123fd565b915080935050809150509295985092959850929598565b600080600080600060a0868803121561254d57600080fd5b505083359560208501359550604085013594606081013594506080013592509050565b6000806040838503121561258357600080fd5b50508035926020909101359150565b6000602082840312156125a457600080fd5b5035919050565b60008083601f8401126125bd57600080fd5b50813567ffffffffffffffff8111156125d557600080fd5b60208301915083602082850101111561244257600080fd5b6000806000806000806080878903121561260657600080fd5b86359550602087013567ffffffffffffffff8082111561262557600080fd5b6126318a838b016125ab565b9097509550604089013591508082111561264a57600080fd5b5061265789828a016123fd565b9094509250506060870135801515811461267057600080fd5b809150509295509295509295565b60008060006060848603121561269357600080fd5b61269c84612225565b95602085013595506040909401359392505050565b6000806000604084860312156126c657600080fd5b83359250602084013567ffffffffffffffff8111156126e457600080fd5b6126f0868287016125ab565b9497909650939450505050565b60008060008060006080868803121561271557600080fd5b61271e86612225565b945060208601359350604086013567ffffffffffffffff8082111561274257600080fd5b61274e89838a016123e5565b9450606088013591508082111561276457600080fd5b50612771888289016123fd565b969995985093965092949392505050565b803563ffffffff8116811461224957600080fd5b6000806000606084860312156127ab57600080fd5b833592506127bb60208501612782565b91506127c960408501612782565b90509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361286157612861612801565b5060010190565b60006060823603121561287a57600080fd5b6128826122d1565b823567ffffffffffffffff8082111561289a57600080fd5b9084019036601f8301126128ad57600080fd5b81356020828211156128c1576128c1612278565b6128f1817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f850116016122f4565b9250818352368183860101111561290757600080fd5b81818501828501376000918301810191909152908352848101359083015250604092830135928101929092525090565b81516103208201908260005b601981101561296c57825167ffffffffffffffff16825260209283019290910190600101612943565b50505092915050565b6000821982111561298857612988612801565b500190565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126129c257600080fd5b83018035915067ffffffffffffffff8211156129dd57600080fd5b60200191503681900382131561244257600080fd5b600181815b80851115612a4b57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115612a3157612a31612801565b80851615612a3e57918102915b93841c93908002906129f7565b509250929050565b600082612a6257506001612b0e565b81612a6f57506000612b0e565b8160018114612a855760028114612a8f57612aab565b6001915050612b0e565b60ff841115612aa057612aa0612801565b50506001821b612b0e565b5060208310610133831016604e8410600b8410161715612ace575081810a612b0e565b612ad883836129f2565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115612b0a57612b0a612801565b0290505b92915050565b60006120208383612a53565b600082821015612b3257612b32612801565b500390565b600063ffffffff83811690831681811015612b5457612b54612801565b039392505050565b600063ffffffff808316818516808303821115612b7b57612b7b612801565b01949350505050565b6000845160005b81811015612ba55760208188018101518583015201612b8b565b81811115612bb4576000828501525b509190910192835250602082015260400191905056fea164736f6c634300080f000a",
} }
// PreimageOracleABI is the input ABI used to generate the binding from. // PreimageOracleABI is the input ABI used to generate the binding from.
...@@ -201,6 +213,130 @@ func (_PreimageOracle *PreimageOracleTransactorRaw) Transact(opts *bind.Transact ...@@ -201,6 +213,130 @@ func (_PreimageOracle *PreimageOracleTransactorRaw) Transact(opts *bind.Transact
return _PreimageOracle.Contract.contract.Transact(opts, method, params...) return _PreimageOracle.Contract.contract.Transact(opts, method, params...)
} }
// CHALLENGEPERIOD is a free data retrieval call binding the contract method 0xc3a079ed.
//
// Solidity: function CHALLENGE_PERIOD() view returns(uint256)
func (_PreimageOracle *PreimageOracleCaller) CHALLENGEPERIOD(opts *bind.CallOpts) (*big.Int, error) {
var out []interface{}
err := _PreimageOracle.contract.Call(opts, &out, "CHALLENGE_PERIOD")
if err != nil {
return *new(*big.Int), err
}
out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
return out0, err
}
// CHALLENGEPERIOD is a free data retrieval call binding the contract method 0xc3a079ed.
//
// Solidity: function CHALLENGE_PERIOD() view returns(uint256)
func (_PreimageOracle *PreimageOracleSession) CHALLENGEPERIOD() (*big.Int, error) {
return _PreimageOracle.Contract.CHALLENGEPERIOD(&_PreimageOracle.CallOpts)
}
// CHALLENGEPERIOD is a free data retrieval call binding the contract method 0xc3a079ed.
//
// Solidity: function CHALLENGE_PERIOD() view returns(uint256)
func (_PreimageOracle *PreimageOracleCallerSession) CHALLENGEPERIOD() (*big.Int, error) {
return _PreimageOracle.Contract.CHALLENGEPERIOD(&_PreimageOracle.CallOpts)
}
// KECCAKTREEDEPTH is a free data retrieval call binding the contract method 0x2055b36b.
//
// Solidity: function KECCAK_TREE_DEPTH() view returns(uint256)
func (_PreimageOracle *PreimageOracleCaller) KECCAKTREEDEPTH(opts *bind.CallOpts) (*big.Int, error) {
var out []interface{}
err := _PreimageOracle.contract.Call(opts, &out, "KECCAK_TREE_DEPTH")
if err != nil {
return *new(*big.Int), err
}
out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
return out0, err
}
// KECCAKTREEDEPTH is a free data retrieval call binding the contract method 0x2055b36b.
//
// Solidity: function KECCAK_TREE_DEPTH() view returns(uint256)
func (_PreimageOracle *PreimageOracleSession) KECCAKTREEDEPTH() (*big.Int, error) {
return _PreimageOracle.Contract.KECCAKTREEDEPTH(&_PreimageOracle.CallOpts)
}
// KECCAKTREEDEPTH is a free data retrieval call binding the contract method 0x2055b36b.
//
// Solidity: function KECCAK_TREE_DEPTH() view returns(uint256)
func (_PreimageOracle *PreimageOracleCallerSession) KECCAKTREEDEPTH() (*big.Int, error) {
return _PreimageOracle.Contract.KECCAKTREEDEPTH(&_PreimageOracle.CallOpts)
}
// MAXLEAFCOUNT is a free data retrieval call binding the contract method 0x4d52b4c9.
//
// Solidity: function MAX_LEAF_COUNT() view returns(uint256)
func (_PreimageOracle *PreimageOracleCaller) MAXLEAFCOUNT(opts *bind.CallOpts) (*big.Int, error) {
var out []interface{}
err := _PreimageOracle.contract.Call(opts, &out, "MAX_LEAF_COUNT")
if err != nil {
return *new(*big.Int), err
}
out0 := *abi.ConvertType(out[0], new(*big.Int)).(**big.Int)
return out0, err
}
// MAXLEAFCOUNT is a free data retrieval call binding the contract method 0x4d52b4c9.
//
// Solidity: function MAX_LEAF_COUNT() view returns(uint256)
func (_PreimageOracle *PreimageOracleSession) MAXLEAFCOUNT() (*big.Int, error) {
return _PreimageOracle.Contract.MAXLEAFCOUNT(&_PreimageOracle.CallOpts)
}
// MAXLEAFCOUNT is a free data retrieval call binding the contract method 0x4d52b4c9.
//
// Solidity: function MAX_LEAF_COUNT() view returns(uint256)
func (_PreimageOracle *PreimageOracleCallerSession) MAXLEAFCOUNT() (*big.Int, error) {
return _PreimageOracle.Contract.MAXLEAFCOUNT(&_PreimageOracle.CallOpts)
}
// GetTreeRootLPP is a free data retrieval call binding the contract method 0x0359a563.
//
// Solidity: function getTreeRootLPP(address _owner, uint256 _uuid) view returns(bytes32 treeRoot_)
func (_PreimageOracle *PreimageOracleCaller) GetTreeRootLPP(opts *bind.CallOpts, _owner common.Address, _uuid *big.Int) ([32]byte, error) {
var out []interface{}
err := _PreimageOracle.contract.Call(opts, &out, "getTreeRootLPP", _owner, _uuid)
if err != nil {
return *new([32]byte), err
}
out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte)
return out0, err
}
// GetTreeRootLPP is a free data retrieval call binding the contract method 0x0359a563.
//
// Solidity: function getTreeRootLPP(address _owner, uint256 _uuid) view returns(bytes32 treeRoot_)
func (_PreimageOracle *PreimageOracleSession) GetTreeRootLPP(_owner common.Address, _uuid *big.Int) ([32]byte, error) {
return _PreimageOracle.Contract.GetTreeRootLPP(&_PreimageOracle.CallOpts, _owner, _uuid)
}
// GetTreeRootLPP is a free data retrieval call binding the contract method 0x0359a563.
//
// Solidity: function getTreeRootLPP(address _owner, uint256 _uuid) view returns(bytes32 treeRoot_)
func (_PreimageOracle *PreimageOracleCallerSession) GetTreeRootLPP(_owner common.Address, _uuid *big.Int) ([32]byte, error) {
return _PreimageOracle.Contract.GetTreeRootLPP(&_PreimageOracle.CallOpts, _owner, _uuid)
}
// PreimageLengths is a free data retrieval call binding the contract method 0xfef2b4ed. // PreimageLengths is a free data retrieval call binding the contract method 0xfef2b4ed.
// //
// Solidity: function preimageLengths(bytes32 ) view returns(uint256) // Solidity: function preimageLengths(bytes32 ) view returns(uint256)
...@@ -294,6 +430,99 @@ func (_PreimageOracle *PreimageOracleCallerSession) PreimageParts(arg0 [32]byte, ...@@ -294,6 +430,99 @@ func (_PreimageOracle *PreimageOracleCallerSession) PreimageParts(arg0 [32]byte,
return _PreimageOracle.Contract.PreimageParts(&_PreimageOracle.CallOpts, arg0, arg1) return _PreimageOracle.Contract.PreimageParts(&_PreimageOracle.CallOpts, arg0, arg1)
} }
// ProposalBranches is a free data retrieval call binding the contract method 0xb4801e61.
//
// Solidity: function proposalBranches(address , uint256 , uint256 ) view returns(bytes32)
func (_PreimageOracle *PreimageOracleCaller) ProposalBranches(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int, arg2 *big.Int) ([32]byte, error) {
var out []interface{}
err := _PreimageOracle.contract.Call(opts, &out, "proposalBranches", arg0, arg1, arg2)
if err != nil {
return *new([32]byte), err
}
out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte)
return out0, err
}
// ProposalBranches is a free data retrieval call binding the contract method 0xb4801e61.
//
// Solidity: function proposalBranches(address , uint256 , uint256 ) view returns(bytes32)
func (_PreimageOracle *PreimageOracleSession) ProposalBranches(arg0 common.Address, arg1 *big.Int, arg2 *big.Int) ([32]byte, error) {
return _PreimageOracle.Contract.ProposalBranches(&_PreimageOracle.CallOpts, arg0, arg1, arg2)
}
// ProposalBranches is a free data retrieval call binding the contract method 0xb4801e61.
//
// Solidity: function proposalBranches(address , uint256 , uint256 ) view returns(bytes32)
func (_PreimageOracle *PreimageOracleCallerSession) ProposalBranches(arg0 common.Address, arg1 *big.Int, arg2 *big.Int) ([32]byte, error) {
return _PreimageOracle.Contract.ProposalBranches(&_PreimageOracle.CallOpts, arg0, arg1, arg2)
}
// ProposalMetadata is a free data retrieval call binding the contract method 0x6551927b.
//
// Solidity: function proposalMetadata(address , uint256 ) view returns(bytes32)
func (_PreimageOracle *PreimageOracleCaller) ProposalMetadata(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) ([32]byte, error) {
var out []interface{}
err := _PreimageOracle.contract.Call(opts, &out, "proposalMetadata", arg0, arg1)
if err != nil {
return *new([32]byte), err
}
out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte)
return out0, err
}
// ProposalMetadata is a free data retrieval call binding the contract method 0x6551927b.
//
// Solidity: function proposalMetadata(address , uint256 ) view returns(bytes32)
func (_PreimageOracle *PreimageOracleSession) ProposalMetadata(arg0 common.Address, arg1 *big.Int) ([32]byte, error) {
return _PreimageOracle.Contract.ProposalMetadata(&_PreimageOracle.CallOpts, arg0, arg1)
}
// ProposalMetadata is a free data retrieval call binding the contract method 0x6551927b.
//
// Solidity: function proposalMetadata(address , uint256 ) view returns(bytes32)
func (_PreimageOracle *PreimageOracleCallerSession) ProposalMetadata(arg0 common.Address, arg1 *big.Int) ([32]byte, error) {
return _PreimageOracle.Contract.ProposalMetadata(&_PreimageOracle.CallOpts, arg0, arg1)
}
// ProposalParts is a free data retrieval call binding the contract method 0xb2e67ba8.
//
// Solidity: function proposalParts(address , uint256 ) view returns(bytes32)
func (_PreimageOracle *PreimageOracleCaller) ProposalParts(opts *bind.CallOpts, arg0 common.Address, arg1 *big.Int) ([32]byte, error) {
var out []interface{}
err := _PreimageOracle.contract.Call(opts, &out, "proposalParts", arg0, arg1)
if err != nil {
return *new([32]byte), err
}
out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte)
return out0, err
}
// ProposalParts is a free data retrieval call binding the contract method 0xb2e67ba8.
//
// Solidity: function proposalParts(address , uint256 ) view returns(bytes32)
func (_PreimageOracle *PreimageOracleSession) ProposalParts(arg0 common.Address, arg1 *big.Int) ([32]byte, error) {
return _PreimageOracle.Contract.ProposalParts(&_PreimageOracle.CallOpts, arg0, arg1)
}
// ProposalParts is a free data retrieval call binding the contract method 0xb2e67ba8.
//
// Solidity: function proposalParts(address , uint256 ) view returns(bytes32)
func (_PreimageOracle *PreimageOracleCallerSession) ProposalParts(arg0 common.Address, arg1 *big.Int) ([32]byte, error) {
return _PreimageOracle.Contract.ProposalParts(&_PreimageOracle.CallOpts, arg0, arg1)
}
// ReadPreimage is a free data retrieval call binding the contract method 0xe03110e1. // ReadPreimage is a free data retrieval call binding the contract method 0xe03110e1.
// //
// Solidity: function readPreimage(bytes32 _key, uint256 _offset) view returns(bytes32 dat_, uint256 datLen_) // Solidity: function readPreimage(bytes32 _key, uint256 _offset) view returns(bytes32 dat_, uint256 datLen_)
...@@ -339,6 +568,121 @@ func (_PreimageOracle *PreimageOracleCallerSession) ReadPreimage(_key [32]byte, ...@@ -339,6 +568,121 @@ func (_PreimageOracle *PreimageOracleCallerSession) ReadPreimage(_key [32]byte,
return _PreimageOracle.Contract.ReadPreimage(&_PreimageOracle.CallOpts, _key, _offset) return _PreimageOracle.Contract.ReadPreimage(&_PreimageOracle.CallOpts, _key, _offset)
} }
// ZeroHashes is a free data retrieval call binding the contract method 0x7ac54767.
//
// Solidity: function zeroHashes(uint256 ) view returns(bytes32)
func (_PreimageOracle *PreimageOracleCaller) ZeroHashes(opts *bind.CallOpts, arg0 *big.Int) ([32]byte, error) {
var out []interface{}
err := _PreimageOracle.contract.Call(opts, &out, "zeroHashes", arg0)
if err != nil {
return *new([32]byte), err
}
out0 := *abi.ConvertType(out[0], new([32]byte)).(*[32]byte)
return out0, err
}
// ZeroHashes is a free data retrieval call binding the contract method 0x7ac54767.
//
// Solidity: function zeroHashes(uint256 ) view returns(bytes32)
func (_PreimageOracle *PreimageOracleSession) ZeroHashes(arg0 *big.Int) ([32]byte, error) {
return _PreimageOracle.Contract.ZeroHashes(&_PreimageOracle.CallOpts, arg0)
}
// ZeroHashes is a free data retrieval call binding the contract method 0x7ac54767.
//
// Solidity: function zeroHashes(uint256 ) view returns(bytes32)
func (_PreimageOracle *PreimageOracleCallerSession) ZeroHashes(arg0 *big.Int) ([32]byte, error) {
return _PreimageOracle.Contract.ZeroHashes(&_PreimageOracle.CallOpts, arg0)
}
// AddLeavesLPP is a paid mutator transaction binding the contract method 0x9f99ef82.
//
// Solidity: function addLeavesLPP(uint256 _uuid, bytes _input, bytes32[] _stateCommitments, bool _finalize) returns()
func (_PreimageOracle *PreimageOracleTransactor) AddLeavesLPP(opts *bind.TransactOpts, _uuid *big.Int, _input []byte, _stateCommitments [][32]byte, _finalize bool) (*types.Transaction, error) {
return _PreimageOracle.contract.Transact(opts, "addLeavesLPP", _uuid, _input, _stateCommitments, _finalize)
}
// AddLeavesLPP is a paid mutator transaction binding the contract method 0x9f99ef82.
//
// Solidity: function addLeavesLPP(uint256 _uuid, bytes _input, bytes32[] _stateCommitments, bool _finalize) returns()
func (_PreimageOracle *PreimageOracleSession) AddLeavesLPP(_uuid *big.Int, _input []byte, _stateCommitments [][32]byte, _finalize bool) (*types.Transaction, error) {
return _PreimageOracle.Contract.AddLeavesLPP(&_PreimageOracle.TransactOpts, _uuid, _input, _stateCommitments, _finalize)
}
// AddLeavesLPP is a paid mutator transaction binding the contract method 0x9f99ef82.
//
// Solidity: function addLeavesLPP(uint256 _uuid, bytes _input, bytes32[] _stateCommitments, bool _finalize) returns()
func (_PreimageOracle *PreimageOracleTransactorSession) AddLeavesLPP(_uuid *big.Int, _input []byte, _stateCommitments [][32]byte, _finalize bool) (*types.Transaction, error) {
return _PreimageOracle.Contract.AddLeavesLPP(&_PreimageOracle.TransactOpts, _uuid, _input, _stateCommitments, _finalize)
}
// ChallengeFirstLPP is a paid mutator transaction binding the contract method 0xec5efcbc.
//
// Solidity: function challengeFirstLPP(address _claimant, uint256 _uuid, (bytes,uint256,bytes32) _postState, bytes32[] _postStateProof) returns()
func (_PreimageOracle *PreimageOracleTransactor) ChallengeFirstLPP(opts *bind.TransactOpts, _claimant common.Address, _uuid *big.Int, _postState PreimageOracleLeaf, _postStateProof [][32]byte) (*types.Transaction, error) {
return _PreimageOracle.contract.Transact(opts, "challengeFirstLPP", _claimant, _uuid, _postState, _postStateProof)
}
// ChallengeFirstLPP is a paid mutator transaction binding the contract method 0xec5efcbc.
//
// Solidity: function challengeFirstLPP(address _claimant, uint256 _uuid, (bytes,uint256,bytes32) _postState, bytes32[] _postStateProof) returns()
func (_PreimageOracle *PreimageOracleSession) ChallengeFirstLPP(_claimant common.Address, _uuid *big.Int, _postState PreimageOracleLeaf, _postStateProof [][32]byte) (*types.Transaction, error) {
return _PreimageOracle.Contract.ChallengeFirstLPP(&_PreimageOracle.TransactOpts, _claimant, _uuid, _postState, _postStateProof)
}
// ChallengeFirstLPP is a paid mutator transaction binding the contract method 0xec5efcbc.
//
// Solidity: function challengeFirstLPP(address _claimant, uint256 _uuid, (bytes,uint256,bytes32) _postState, bytes32[] _postStateProof) returns()
func (_PreimageOracle *PreimageOracleTransactorSession) ChallengeFirstLPP(_claimant common.Address, _uuid *big.Int, _postState PreimageOracleLeaf, _postStateProof [][32]byte) (*types.Transaction, error) {
return _PreimageOracle.Contract.ChallengeFirstLPP(&_PreimageOracle.TransactOpts, _claimant, _uuid, _postState, _postStateProof)
}
// ChallengeLPP is a paid mutator transaction binding the contract method 0x3909af5c.
//
// Solidity: function challengeLPP(address _claimant, uint256 _uuid, (uint64[25]) _stateMatrix, (bytes,uint256,bytes32) _preState, bytes32[] _preStateProof, (bytes,uint256,bytes32) _postState, bytes32[] _postStateProof) returns()
func (_PreimageOracle *PreimageOracleTransactor) ChallengeLPP(opts *bind.TransactOpts, _claimant common.Address, _uuid *big.Int, _stateMatrix LibKeccakStateMatrix, _preState PreimageOracleLeaf, _preStateProof [][32]byte, _postState PreimageOracleLeaf, _postStateProof [][32]byte) (*types.Transaction, error) {
return _PreimageOracle.contract.Transact(opts, "challengeLPP", _claimant, _uuid, _stateMatrix, _preState, _preStateProof, _postState, _postStateProof)
}
// ChallengeLPP is a paid mutator transaction binding the contract method 0x3909af5c.
//
// Solidity: function challengeLPP(address _claimant, uint256 _uuid, (uint64[25]) _stateMatrix, (bytes,uint256,bytes32) _preState, bytes32[] _preStateProof, (bytes,uint256,bytes32) _postState, bytes32[] _postStateProof) returns()
func (_PreimageOracle *PreimageOracleSession) ChallengeLPP(_claimant common.Address, _uuid *big.Int, _stateMatrix LibKeccakStateMatrix, _preState PreimageOracleLeaf, _preStateProof [][32]byte, _postState PreimageOracleLeaf, _postStateProof [][32]byte) (*types.Transaction, error) {
return _PreimageOracle.Contract.ChallengeLPP(&_PreimageOracle.TransactOpts, _claimant, _uuid, _stateMatrix, _preState, _preStateProof, _postState, _postStateProof)
}
// ChallengeLPP is a paid mutator transaction binding the contract method 0x3909af5c.
//
// Solidity: function challengeLPP(address _claimant, uint256 _uuid, (uint64[25]) _stateMatrix, (bytes,uint256,bytes32) _preState, bytes32[] _preStateProof, (bytes,uint256,bytes32) _postState, bytes32[] _postStateProof) returns()
func (_PreimageOracle *PreimageOracleTransactorSession) ChallengeLPP(_claimant common.Address, _uuid *big.Int, _stateMatrix LibKeccakStateMatrix, _preState PreimageOracleLeaf, _preStateProof [][32]byte, _postState PreimageOracleLeaf, _postStateProof [][32]byte) (*types.Transaction, error) {
return _PreimageOracle.Contract.ChallengeLPP(&_PreimageOracle.TransactOpts, _claimant, _uuid, _stateMatrix, _preState, _preStateProof, _postState, _postStateProof)
}
// InitLPP is a paid mutator transaction binding the contract method 0xfaf37bc7.
//
// Solidity: function initLPP(uint256 _uuid, uint32 _partOffset, uint32 _claimedSize) returns()
func (_PreimageOracle *PreimageOracleTransactor) InitLPP(opts *bind.TransactOpts, _uuid *big.Int, _partOffset uint32, _claimedSize uint32) (*types.Transaction, error) {
return _PreimageOracle.contract.Transact(opts, "initLPP", _uuid, _partOffset, _claimedSize)
}
// InitLPP is a paid mutator transaction binding the contract method 0xfaf37bc7.
//
// Solidity: function initLPP(uint256 _uuid, uint32 _partOffset, uint32 _claimedSize) returns()
func (_PreimageOracle *PreimageOracleSession) InitLPP(_uuid *big.Int, _partOffset uint32, _claimedSize uint32) (*types.Transaction, error) {
return _PreimageOracle.Contract.InitLPP(&_PreimageOracle.TransactOpts, _uuid, _partOffset, _claimedSize)
}
// InitLPP is a paid mutator transaction binding the contract method 0xfaf37bc7.
//
// Solidity: function initLPP(uint256 _uuid, uint32 _partOffset, uint32 _claimedSize) returns()
func (_PreimageOracle *PreimageOracleTransactorSession) InitLPP(_uuid *big.Int, _partOffset uint32, _claimedSize uint32) (*types.Transaction, error) {
return _PreimageOracle.Contract.InitLPP(&_PreimageOracle.TransactOpts, _uuid, _partOffset, _claimedSize)
}
// LoadKeccak256PreimagePart is a paid mutator transaction binding the contract method 0xe1592611. // LoadKeccak256PreimagePart is a paid mutator transaction binding the contract method 0xe1592611.
// //
// Solidity: function loadKeccak256PreimagePart(uint256 _partOffset, bytes _preimage) returns() // Solidity: function loadKeccak256PreimagePart(uint256 _partOffset, bytes _preimage) returns()
...@@ -380,3 +724,24 @@ func (_PreimageOracle *PreimageOracleSession) LoadLocalData(_ident *big.Int, _lo ...@@ -380,3 +724,24 @@ func (_PreimageOracle *PreimageOracleSession) LoadLocalData(_ident *big.Int, _lo
func (_PreimageOracle *PreimageOracleTransactorSession) LoadLocalData(_ident *big.Int, _localContext [32]byte, _word [32]byte, _size *big.Int, _partOffset *big.Int) (*types.Transaction, error) { func (_PreimageOracle *PreimageOracleTransactorSession) LoadLocalData(_ident *big.Int, _localContext [32]byte, _word [32]byte, _size *big.Int, _partOffset *big.Int) (*types.Transaction, error) {
return _PreimageOracle.Contract.LoadLocalData(&_PreimageOracle.TransactOpts, _ident, _localContext, _word, _size, _partOffset) return _PreimageOracle.Contract.LoadLocalData(&_PreimageOracle.TransactOpts, _ident, _localContext, _word, _size, _partOffset)
} }
// SqueezeLPP is a paid mutator transaction binding the contract method 0xd18534b5.
//
// Solidity: function squeezeLPP(address _claimant, uint256 _uuid, (uint64[25]) _stateMatrix, (bytes,uint256,bytes32) _preState, bytes32[] _preStateProof, (bytes,uint256,bytes32) _postState, bytes32[] _postStateProof) returns()
func (_PreimageOracle *PreimageOracleTransactor) SqueezeLPP(opts *bind.TransactOpts, _claimant common.Address, _uuid *big.Int, _stateMatrix LibKeccakStateMatrix, _preState PreimageOracleLeaf, _preStateProof [][32]byte, _postState PreimageOracleLeaf, _postStateProof [][32]byte) (*types.Transaction, error) {
return _PreimageOracle.contract.Transact(opts, "squeezeLPP", _claimant, _uuid, _stateMatrix, _preState, _preStateProof, _postState, _postStateProof)
}
// SqueezeLPP is a paid mutator transaction binding the contract method 0xd18534b5.
//
// Solidity: function squeezeLPP(address _claimant, uint256 _uuid, (uint64[25]) _stateMatrix, (bytes,uint256,bytes32) _preState, bytes32[] _preStateProof, (bytes,uint256,bytes32) _postState, bytes32[] _postStateProof) returns()
func (_PreimageOracle *PreimageOracleSession) SqueezeLPP(_claimant common.Address, _uuid *big.Int, _stateMatrix LibKeccakStateMatrix, _preState PreimageOracleLeaf, _preStateProof [][32]byte, _postState PreimageOracleLeaf, _postStateProof [][32]byte) (*types.Transaction, error) {
return _PreimageOracle.Contract.SqueezeLPP(&_PreimageOracle.TransactOpts, _claimant, _uuid, _stateMatrix, _preState, _preStateProof, _postState, _postStateProof)
}
// SqueezeLPP is a paid mutator transaction binding the contract method 0xd18534b5.
//
// Solidity: function squeezeLPP(address _claimant, uint256 _uuid, (uint64[25]) _stateMatrix, (bytes,uint256,bytes32) _preState, bytes32[] _preStateProof, (bytes,uint256,bytes32) _postState, bytes32[] _postStateProof) returns()
func (_PreimageOracle *PreimageOracleTransactorSession) SqueezeLPP(_claimant common.Address, _uuid *big.Int, _stateMatrix LibKeccakStateMatrix, _preState PreimageOracleLeaf, _preStateProof [][32]byte, _postState PreimageOracleLeaf, _postStateProof [][32]byte) (*types.Transaction, error) {
return _PreimageOracle.Contract.SqueezeLPP(&_PreimageOracle.TransactOpts, _claimant, _uuid, _stateMatrix, _preState, _preStateProof, _postState, _postStateProof)
}
...@@ -9,11 +9,11 @@ import ( ...@@ -9,11 +9,11 @@ import (
"github.com/ethereum-optimism/optimism/op-bindings/solc" "github.com/ethereum-optimism/optimism/op-bindings/solc"
) )
const PreimageOracleStorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contract\":\"src/cannon/PreimageOracle.sol:PreimageOracle\",\"label\":\"preimageLengths\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_mapping(t_bytes32,t_uint256)\"},{\"astId\":1001,\"contract\":\"src/cannon/PreimageOracle.sol:PreimageOracle\",\"label\":\"preimageParts\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes32))\"},{\"astId\":1002,\"contract\":\"src/cannon/PreimageOracle.sol:PreimageOracle\",\"label\":\"preimagePartOk\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_mapping(t_bytes32,t_mapping(t_uint256,t_bool))\"}],\"types\":{\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_mapping(t_bytes32,t_mapping(t_uint256,t_bool))\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e mapping(uint256 =\u003e bool))\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_mapping(t_uint256,t_bool)\"},\"t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes32))\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e mapping(uint256 =\u003e bytes32))\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_mapping(t_uint256,t_bytes32)\"},\"t_mapping(t_bytes32,t_uint256)\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e uint256)\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_uint256\"},\"t_mapping(t_uint256,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(uint256 =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_uint256\",\"value\":\"t_bool\"},\"t_mapping(t_uint256,t_bytes32)\":{\"encoding\":\"mapping\",\"label\":\"mapping(uint256 =\u003e bytes32)\",\"numberOfBytes\":\"32\",\"key\":\"t_uint256\",\"value\":\"t_bytes32\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"}}}" const PreimageOracleStorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contract\":\"src/cannon/PreimageOracle.sol:PreimageOracle\",\"label\":\"preimageLengths\",\"offset\":0,\"slot\":\"0\",\"type\":\"t_mapping(t_bytes32,t_uint256)\"},{\"astId\":1001,\"contract\":\"src/cannon/PreimageOracle.sol:PreimageOracle\",\"label\":\"preimageParts\",\"offset\":0,\"slot\":\"1\",\"type\":\"t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes32))\"},{\"astId\":1002,\"contract\":\"src/cannon/PreimageOracle.sol:PreimageOracle\",\"label\":\"preimagePartOk\",\"offset\":0,\"slot\":\"2\",\"type\":\"t_mapping(t_bytes32,t_mapping(t_uint256,t_bool))\"},{\"astId\":1003,\"contract\":\"src/cannon/PreimageOracle.sol:PreimageOracle\",\"label\":\"zeroHashes\",\"offset\":0,\"slot\":\"3\",\"type\":\"t_array(t_bytes32)16_storage\"},{\"astId\":1004,\"contract\":\"src/cannon/PreimageOracle.sol:PreimageOracle\",\"label\":\"proposalBranches\",\"offset\":0,\"slot\":\"19\",\"type\":\"t_mapping(t_address,t_mapping(t_uint256,t_array(t_bytes32)16_storage))\"},{\"astId\":1005,\"contract\":\"src/cannon/PreimageOracle.sol:PreimageOracle\",\"label\":\"proposalMetadata\",\"offset\":0,\"slot\":\"20\",\"type\":\"t_mapping(t_address,t_mapping(t_uint256,t_userDefinedValueType(LPPMetaData)1007))\"},{\"astId\":1006,\"contract\":\"src/cannon/PreimageOracle.sol:PreimageOracle\",\"label\":\"proposalParts\",\"offset\":0,\"slot\":\"21\",\"type\":\"t_mapping(t_address,t_mapping(t_uint256,t_bytes32))\"}],\"types\":{\"t_address\":{\"encoding\":\"inplace\",\"label\":\"address\",\"numberOfBytes\":\"20\"},\"t_array(t_bytes32)16_storage\":{\"encoding\":\"inplace\",\"label\":\"bytes32[16]\",\"numberOfBytes\":\"512\",\"base\":\"t_bytes32\"},\"t_bool\":{\"encoding\":\"inplace\",\"label\":\"bool\",\"numberOfBytes\":\"1\"},\"t_bytes32\":{\"encoding\":\"inplace\",\"label\":\"bytes32\",\"numberOfBytes\":\"32\"},\"t_mapping(t_address,t_mapping(t_uint256,t_array(t_bytes32)16_storage))\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e mapping(uint256 =\u003e bytes32[16]))\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_mapping(t_uint256,t_array(t_bytes32)16_storage)\"},\"t_mapping(t_address,t_mapping(t_uint256,t_bytes32))\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e mapping(uint256 =\u003e bytes32))\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_mapping(t_uint256,t_bytes32)\"},\"t_mapping(t_address,t_mapping(t_uint256,t_userDefinedValueType(LPPMetaData)1007))\":{\"encoding\":\"mapping\",\"label\":\"mapping(address =\u003e mapping(uint256 =\u003e LPPMetaData))\",\"numberOfBytes\":\"32\",\"key\":\"t_address\",\"value\":\"t_mapping(t_uint256,t_userDefinedValueType(LPPMetaData)1007)\"},\"t_mapping(t_bytes32,t_mapping(t_uint256,t_bool))\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e mapping(uint256 =\u003e bool))\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_mapping(t_uint256,t_bool)\"},\"t_mapping(t_bytes32,t_mapping(t_uint256,t_bytes32))\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e mapping(uint256 =\u003e bytes32))\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_mapping(t_uint256,t_bytes32)\"},\"t_mapping(t_bytes32,t_uint256)\":{\"encoding\":\"mapping\",\"label\":\"mapping(bytes32 =\u003e uint256)\",\"numberOfBytes\":\"32\",\"key\":\"t_bytes32\",\"value\":\"t_uint256\"},\"t_mapping(t_uint256,t_array(t_bytes32)16_storage)\":{\"encoding\":\"mapping\",\"label\":\"mapping(uint256 =\u003e bytes32[16])\",\"numberOfBytes\":\"32\",\"key\":\"t_uint256\",\"value\":\"t_array(t_bytes32)16_storage\"},\"t_mapping(t_uint256,t_bool)\":{\"encoding\":\"mapping\",\"label\":\"mapping(uint256 =\u003e bool)\",\"numberOfBytes\":\"32\",\"key\":\"t_uint256\",\"value\":\"t_bool\"},\"t_mapping(t_uint256,t_bytes32)\":{\"encoding\":\"mapping\",\"label\":\"mapping(uint256 =\u003e bytes32)\",\"numberOfBytes\":\"32\",\"key\":\"t_uint256\",\"value\":\"t_bytes32\"},\"t_mapping(t_uint256,t_userDefinedValueType(LPPMetaData)1007)\":{\"encoding\":\"mapping\",\"label\":\"mapping(uint256 =\u003e LPPMetaData)\",\"numberOfBytes\":\"32\",\"key\":\"t_uint256\",\"value\":\"t_userDefinedValueType(LPPMetaData)1007\"},\"t_uint256\":{\"encoding\":\"inplace\",\"label\":\"uint256\",\"numberOfBytes\":\"32\"},\"t_userDefinedValueType(LPPMetaData)1007\":{\"encoding\":\"inplace\",\"label\":\"LPPMetaData\",\"numberOfBytes\":\"32\"}}}"
var PreimageOracleStorageLayout = new(solc.StorageLayout) var PreimageOracleStorageLayout = new(solc.StorageLayout)
var PreimageOracleDeployedBin = "0x608060405234801561001057600080fd5b50600436106100725760003560e01c8063e03110e111610050578063e03110e114610106578063e15926111461012e578063fef2b4ed1461014357600080fd5b806352f0f3ad1461007757806361238bde1461009d5780638542cf50146100c8575b600080fd5b61008a6100853660046104df565b610163565b6040519081526020015b60405180910390f35b61008a6100ab36600461051a565b600160209081526000928352604080842090915290825290205481565b6100f66100d636600461051a565b600260209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610094565b61011961011436600461051a565b610238565b60408051928352602083019190915201610094565b61014161013c36600461053c565b610329565b005b61008a6101513660046105b8565b60006020819052908152604090205481565b600061016f8686610432565b905061017c836008610600565b8211806101895750602083115b156101c0576040517ffe25498700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000602081815260c085901b82526008959095528251828252600286526040808320858452875280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081179091558484528752808320948352938652838220558181529384905292205592915050565b6000828152600260209081526040808320848452909152812054819060ff166102c1576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f7072652d696d616765206d757374206578697374000000000000000000000000604482015260640160405180910390fd5b50600083815260208181526040909120546102dd816008610600565b6102e8856020610600565b1061030657836102f9826008610600565b6103039190610618565b91505b506000938452600160209081526040808620948652939052919092205492909150565b604435600080600883018611156103485763fe2549876000526004601cfd5b60c083901b6080526088838682378087017ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80151908490207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f02000000000000000000000000000000000000000000000000000000000000001760008181526002602090815260408083208b8452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915584845282528083209a83529981528982209390935590815290819052959095209190915550505050565b7f01000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8316176104d8818360408051600093845233602052918152606090922091527effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01000000000000000000000000000000000000000000000000000000000000001790565b9392505050565b600080600080600060a086880312156104f757600080fd5b505083359560208501359550604085013594606081013594506080013592509050565b6000806040838503121561052d57600080fd5b50508035926020909101359150565b60008060006040848603121561055157600080fd5b83359250602084013567ffffffffffffffff8082111561057057600080fd5b818601915086601f83011261058457600080fd5b81358181111561059357600080fd5b8760208285010111156105a557600080fd5b6020830194508093505050509250925092565b6000602082840312156105ca57600080fd5b5035919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60008219821115610613576106136105d1565b500190565b60008282101561062a5761062a6105d1565b50039056fea164736f6c634300080f000a" var PreimageOracleDeployedBin = "0x608060405234801561001057600080fd5b50600436106101515760003560e01c80639f99ef82116100cd578063e03110e111610081578063ec5efcbc11610066578063ec5efcbc14610304578063faf37bc714610317578063fef2b4ed1461032a57600080fd5b8063e03110e1146102c9578063e1592611146102f157600080fd5b8063b4801e61116100b2578063b4801e6114610299578063c3a079ed146102ac578063d18534b5146102b657600080fd5b80639f99ef821461025b578063b2e67ba81461026e57600080fd5b806352f0f3ad116101245780636551927b116101095780636551927b146101df5780637ac547671461020a5780638542cf501461021d57600080fd5b806352f0f3ad146101a157806361238bde146101b457600080fd5b80630359a563146101565780632055b36b1461017c5780633909af5c146101845780634d52b4c914610199575b600080fd5b61016961016436600461224e565b61034a565b6040519081526020015b60405180910390f35b610169601081565b610197610192366004612449565b610482565b005b6101696106d0565b6101696101af366004612535565b6106eb565b6101696101c2366004612570565b600160209081526000928352604080842090915290825290205481565b6101696101ed36600461224e565b601460209081526000928352604080842090915290825290205481565b610169610218366004612592565b6107c0565b61024b61022b366004612570565b600260209081526000928352604080842090915290825290205460ff1681565b6040519015158152602001610173565b6101976102693660046125ed565b6107d7565b61016961027c36600461224e565b601560209081526000928352604080842090915290825290205481565b6101696102a736600461267e565b610cc5565b6101696201518081565b6101976102c4366004612449565b610cf7565b6102dc6102d7366004612570565b6110a5565b60408051928352602083019190915201610173565b6101976102ff3660046126b1565b611196565b6101976103123660046126fd565b61129f565b610197610325366004612796565b611419565b610169610338366004612592565b60006020819052908152604090205481565b73ffffffffffffffffffffffffffffffffffffffff82166000908152601460209081526040808320848452909152812054819061038d9060601c63ffffffff1690565b63ffffffff16905060005b601081101561047a57816001166001036104205773ffffffffffffffffffffffffffffffffffffffff85166000908152601360209081526040808320878452909152902081601081106103ed576103ed6127d2565b01546040805160208101929092528101849052606001604051602081830303815290604052805190602001209250610461565b8260038260108110610434576104346127d2565b01546040805160208101939093528201526060016040516020818303038152906040528051906020012092505b60019190911c908061047281612830565b915050610398565b505092915050565b600061048e8a8a61034a565b90506104b186868360208b01356104ac6104a78d612868565b6114e2565b611522565b80156104cf57506104cf83838360208801356104ac6104a78a612868565b610505576040517f09bde33900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b86604001358860405160200161051b9190612937565b6040516020818303038152906040528051906020012014610568576040517f1968a90200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b83602001358760200135600161057e9190612975565b146105b5576040517f9a3b119900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6105fd886105c3868061298d565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061158392505050565b610606886116de565b83604001358860405160200161061c9190612937565b6040516020818303038152906040528051906020012003610669576040517f9843145b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505073ffffffffffffffffffffffffffffffffffffffff9590951660009081526014602090815260408083209683529590529390932080547fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000016600117905550505050565b60016106de60106002612b14565b6106e89190612b20565b81565b60006106f78686611f7a565b9050610704836008612975565b8211806107115750602083115b15610748576040517ffe25498700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000602081815260c085901b82526008959095528251828252600286526040808320858452875280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660019081179091558484528752808320948352938652838220558181529384905292205592915050565b600381601081106107d057600080fd5b0154905081565b606081156107f0576107e98686612027565b905061082a565b85858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509293505050505b3360009081526013602090815260408083208a845290915280822081516102008101928390529160109082845b8154815260200190600101908083116108575750503360009081526014602090815260408083208f845290915290205493945061089992508391506120b09050565b63ffffffff166000036108d8576040517f87138d5c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6108e28160c01c90565b67ffffffffffffffff1615610923576040517f475a253500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006109358260a01c63ffffffff1690565b67ffffffffffffffff16905060006109538360401c63ffffffff1690565b63ffffffff169050600882108015610969575080155b156109f05760006109808460801c63ffffffff1690565b905060008160c01b6000528b356008528351905080601560003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008f8152602001908152602001600020819055505050610aa5565b60088210158015610a0e575080610a08600884612b20565b92508210155b8015610a225750610a1f8982612975565b82105b15610aa5576000610a338284612b20565b905089610a41826020612975565b10158015610a4d575086155b15610a84576040517ffe25498700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081526015602090815260408083208f84529091529020908b013590555b6000610ab78460601c63ffffffff1690565b63ffffffff169050855160208701608882048a1415608883061715610ae4576307b1daf16000526004601cfd5b60405160c8810160405260005b83811015610b94578083018051835260208101516020840152604081015160408401526060810151606084015260808101516080840152508460888301526088810460051b8d013560a883015260c882206001860195508560005b610200811015610b89576001821615610b695782818d0152610b89565b8b81015160009081526020938452604090209260019290921c9101610b4c565b505050608801610af1565b50505050600160106002610ba89190612b14565b610bb29190612b20565b811115610beb576040517f6229572300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081526013602090815260408083208f84529091529020610c119086601061219b565b50610c71610c1f838c612975565b60401b7fffffffffffffffffffffffffffffffffffffffff00000000ffffffffffffffff606084901b167fffffffffffffffffffffffffffffffff0000000000000000ffffffffffffffff8716171790565b93508615610c9c5777ffffffffffffffffffffffffffffffffffffffffffffffff84164260c01b1793505b50503360009081526014602090815260408083209c83529b905299909920555050505050505050565b60136020528260005260406000206020528160005260406000208160108110610ced57600080fd5b0154925083915050565b73ffffffffffffffffffffffffffffffffffffffff891660009081526014602090815260408083208b845290915290205467ffffffffffffffff811615610d6a576040517fc334f06900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b62015180610d788260c01c90565b610d8c9067ffffffffffffffff1642612b20565b11610dc3576040517f55d4cbf900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610dcf8b8b61034a565b9050610de887878360208c01356104ac6104a78e612868565b8015610e065750610e0684848360208901356104ac6104a78b612868565b610e3c576040517f09bde33900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b876040013589604051602001610e529190612937565b6040516020818303038152906040528051906020012014610e9f576040517f1968a90200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b846020013588602001356001610eb59190612975565b141580610ee757506001610ecf8360601c63ffffffff1690565b610ed99190612b37565b63ffffffff16856020013514155b15610f1e576040517f9a3b119900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610f308360801c63ffffffff1690565b63ffffffff16905080610f498460401c63ffffffff1690565b63ffffffff1614610f86576040517f7b1dafd100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610f948a6105c3888061298d565b610f9d8a6116de565b6000610fa88b6120bc565b90506000610fbc8560a01c63ffffffff1690565b67ffffffffffffffff169050600160026000848152602001908152602001600020600083815260200190815260200160002060006101000a81548160ff021916908315150217905550601560008f73ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008e8152602001908152602001600020546001600084815260200190815260200160002060008381526020019081526020016000208190555082600080848152602001908152602001600020819055505050505050505050505050505050565b6000828152600260209081526040808320848452909152812054819060ff1661112e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f7072652d696d616765206d757374206578697374000000000000000000000000604482015260640160405180910390fd5b506000838152602081815260409091205461114a816008612975565b611155856020612975565b106111735783611166826008612975565b6111709190612b20565b91505b506000938452600160209081526040808620948652939052919092205492909150565b604435600080600883018611156111b55763fe2549876000526004601cfd5b60c083901b6080526088838682378087017ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80151908490207effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f02000000000000000000000000000000000000000000000000000000000000001760008181526002602090815260408083208b8452825280832080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016600190811790915584845282528083209a83529981528982209390935590815290819052959095209190915550505050565b60006112ab868661034a565b90506112c483838360208801356104ac6104a78a612868565b6112fa576040517f09bde33900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b602084013515611336576040517f9a3b119900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61133e6121d9565b61134c816105c3878061298d565b611355816116de565b84604001358160405160200161136b9190612937565b60405160208183030381529060405280519060200120036113b8576040517f9843145b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5050505073ffffffffffffffffffffffffffffffffffffffff9290921660009081526014602090815260408083209383529290522080547fffffffffffffffffffffffffffffffffffffffffffffffff000000000000000016600117905550565b611424816008612b5c565b63ffffffff168263ffffffff1610611468576040517ffe25498700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3360009081526014602090815260408083209583529490529290922080547fffffffffffffffff0000000000000000ffffffffffffffffffffffffffffffff1660a09290921b7fffffffffffffffffffffffff00000000ffffffffffffffffffffffffffffffff169190911760809290921b919091179055565b600081600001518260200151836040015160405160200161150593929190612b84565b604051602081830303815290604052805190602001209050919050565b60008160005b6010811015611576578060051b880135600186831c166001811461155b576000848152602083905260409020935061156c565b600082815260208590526040902093505b5050600101611528565b5090931495945050505050565b608881511461159157600080fd5b6020810160208301611612565b8260031b8201518060001a8160011a60081b178160021a60101b8260031a60181b17178160041a60201b8260051a60281b178260061a60301b8360071a60381b171717905061160c816115f7868560059190911b015190565b1867ffffffffffffffff16600586901b840152565b50505050565b61161e6000838361159e565b61162a6001838361159e565b6116366002838361159e565b6116426003838361159e565b61164e6004838361159e565b61165a6005838361159e565b6116666006838361159e565b6116726007838361159e565b61167e6008838361159e565b61168a6009838361159e565b611696600a838361159e565b6116a2600b838361159e565b6116ae600c838361159e565b6116ba600d838361159e565b6116c6600e838361159e565b6116d2600f838361159e565b61160c6010838361159e565b6040805178010000000000008082800000000000808a8000000080008000602082015279808b00000000800000018000000080008081800000000000800991810191909152788a00000000000000880000000080008009000000008000000a60608201527b8000808b800000000000008b8000000000008089800000000000800360808201527f80000000000080028000000000000080000000000000800a800000008000000a60a08201527f800000008000808180000000000080800000000080000001800000008000800860c082015260009060e00160405160208183030381529060405290506020820160208201611e5a565b6102808101516101e082015161014083015160a0840151845118189118186102a082015161020083015161016084015160c0850151602086015118189118186102c083015161022084015161018085015160e0860151604087015118189118186102e08401516102408501516101a0860151610100870151606088015118189118186103008501516102608601516101c0870151610120880151608089015118189118188084603f1c6118918660011b67ffffffffffffffff1690565b18188584603f1c6118ac8660011b67ffffffffffffffff1690565b18188584603f1c6118c78660011b67ffffffffffffffff1690565b181895508483603f1c6118e48560011b67ffffffffffffffff1690565b181894508387603f1c6119018960011b67ffffffffffffffff1690565b60208b01518b51861867ffffffffffffffff168c5291189190911897508118600181901b603f9190911c18935060c08801518118601481901c602c9190911b1867ffffffffffffffff1660208901526101208801518718602c81901c60149190911b1867ffffffffffffffff1660c08901526102c08801518618600381901c603d9190911b1867ffffffffffffffff166101208901526101c08801518718601981901c60279190911b1867ffffffffffffffff166102c08901526102808801518218602e81901c60129190911b1867ffffffffffffffff166101c089015260408801518618600281901c603e9190911b1867ffffffffffffffff166102808901526101808801518618601581901c602b9190911b1867ffffffffffffffff1660408901526101a08801518518602781901c60199190911b1867ffffffffffffffff166101808901526102608801518718603881901c60089190911b1867ffffffffffffffff166101a08901526102e08801518518600881901c60389190911b1867ffffffffffffffff166102608901526101e08801518218601781901c60299190911b1867ffffffffffffffff166102e089015260808801518718602581901c601b9190911b1867ffffffffffffffff166101e08901526103008801518718603281901c600e9190911b1867ffffffffffffffff1660808901526102a08801518118603e81901c60029190911b1867ffffffffffffffff166103008901526101008801518518600981901c60379190911b1867ffffffffffffffff166102a08901526102008801518118601381901c602d9190911b1867ffffffffffffffff1661010089015260a08801518218601c81901c60249190911b1867ffffffffffffffff1661020089015260608801518518602481901c601c9190911b1867ffffffffffffffff1660a08901526102408801518518602b81901c60159190911b1867ffffffffffffffff1660608901526102208801518618603181901c600f9190911b1867ffffffffffffffff166102408901526101608801518118603681901c600a9190911b1867ffffffffffffffff166102208901525060e08701518518603a81901c60069190911b1867ffffffffffffffff166101608801526101408701518118603d81901c60039190911b1867ffffffffffffffff1660e0880152505067ffffffffffffffff81166101408601525050505050565b611c81816117d4565b805160208201805160408401805160608601805160808801805167ffffffffffffffff871986168a188116808c528619851689188216909952831982169095188516909552841988169091188316909152941990921618811690925260a08301805160c0808601805160e0880180516101008a0180516101208c018051861985168a188d16909a528319821686188c16909652801989169092188a169092528619861618881690529219909216909218841690526101408401805161016086018051610180880180516101a08a0180516101c08c0180518619851689188d169099528319821686188c16909652801988169092188a169092528519851618881690529119909116909118841690526101e08401805161020086018051610220880180516102408a0180516102608c0180518619851689188d169099528319821686188c16909652801988169092188a16909252851985161888169052911990911690911884169052610280840180516102a0860180516102c0880180516102e08a0180516103008c0180518619851689188d169099528319821686188c16909652801988169092188a16909252851985161888169052911990911690911884169052600386901b850151901c908118909116825261160c565b611e6660008284611c78565b611e7260018284611c78565b611e7e60028284611c78565b611e8a60038284611c78565b611e9660048284611c78565b611ea260058284611c78565b611eae60068284611c78565b611eba60078284611c78565b611ec660088284611c78565b611ed260098284611c78565b611ede600a8284611c78565b611eea600b8284611c78565b611ef6600c8284611c78565b611f02600d8284611c78565b611f0e600e8284611c78565b611f1a600f8284611c78565b611f2660108284611c78565b611f3260118284611c78565b611f3e60128284611c78565b611f4a60138284611c78565b611f5660148284611c78565b611f6260158284611c78565b611f6e60168284611c78565b61160c60178284611c78565b7f01000000000000000000000000000000000000000000000000000000000000007effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff831617612020818360408051600093845233602052918152606090922091527effffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f01000000000000000000000000000000000000000000000000000000000000001790565b9392505050565b6060604051905081602082018181018286833760888306808015612085576088829003850160808582017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff01536001845160001a1784538652612097565b60018353608060878401536088850186525b5050505050601f19603f82510116810160405292915050565b60801c63ffffffff1690565b600061213f565b66ff00ff00ff00ff8160081c1667ff00ff00ff00ff006120ed8360081b67ffffffffffffffff1690565b1617905065ffff0000ffff8160101c1667ffff0000ffff000061211a8360101b67ffffffffffffffff1690565b1617905060008160201c6121388360201b67ffffffffffffffff1690565b1792915050565b60808201516020830190612157906120c3565b6120c3565b6040820151612165906120c3565b60401b1761217d61215260018460059190911b015190565b825160809190911b9061218f906120c3565b60c01b17179392505050565b82601081019282156121c9579160200282015b828111156121c95782518255916020019190600101906121ae565b506121d59291506121f1565b5090565b60405180602001604052806121ec612206565b905290565b5b808211156121d557600081556001016121f2565b6040518061032001604052806019906020820280368337509192915050565b803573ffffffffffffffffffffffffffffffffffffffff8116811461224957600080fd5b919050565b6000806040838503121561226157600080fd5b61226a83612225565b946020939093013593505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604051610320810167ffffffffffffffff811182821017156122cb576122cb612278565b60405290565b6040516060810167ffffffffffffffff811182821017156122cb576122cb612278565b604051601f82017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016810167ffffffffffffffff8111828210171561233b5761233b612278565b604052919050565b600061032080838503121561235757600080fd5b604051602080820167ffffffffffffffff838210818311171561237c5761237c612278565b8160405283955087601f88011261239257600080fd5b61239a6122a7565b94870194915081888611156123ae57600080fd5b875b868110156123d657803583811681146123c95760008081fd5b84529284019284016123b0565b50909352509295945050505050565b6000606082840312156123f757600080fd5b50919050565b60008083601f84011261240f57600080fd5b50813567ffffffffffffffff81111561242757600080fd5b6020830191508360208260051b850101111561244257600080fd5b9250929050565b60008060008060008060008060006103e08a8c03121561246857600080fd5b6124718a612225565b985060208a013597506124878b60408c01612343565b96506103608a013567ffffffffffffffff808211156124a557600080fd5b6124b18d838e016123e5565b97506103808c01359150808211156124c857600080fd5b6124d48d838e016123fd565b90975095506103a08c01359150808211156124ee57600080fd5b6124fa8d838e016123e5565b94506103c08c013591508082111561251157600080fd5b5061251e8c828d016123fd565b915080935050809150509295985092959850929598565b600080600080600060a0868803121561254d57600080fd5b505083359560208501359550604085013594606081013594506080013592509050565b6000806040838503121561258357600080fd5b50508035926020909101359150565b6000602082840312156125a457600080fd5b5035919050565b60008083601f8401126125bd57600080fd5b50813567ffffffffffffffff8111156125d557600080fd5b60208301915083602082850101111561244257600080fd5b6000806000806000806080878903121561260657600080fd5b86359550602087013567ffffffffffffffff8082111561262557600080fd5b6126318a838b016125ab565b9097509550604089013591508082111561264a57600080fd5b5061265789828a016123fd565b9094509250506060870135801515811461267057600080fd5b809150509295509295509295565b60008060006060848603121561269357600080fd5b61269c84612225565b95602085013595506040909401359392505050565b6000806000604084860312156126c657600080fd5b83359250602084013567ffffffffffffffff8111156126e457600080fd5b6126f0868287016125ab565b9497909650939450505050565b60008060008060006080868803121561271557600080fd5b61271e86612225565b945060208601359350604086013567ffffffffffffffff8082111561274257600080fd5b61274e89838a016123e5565b9450606088013591508082111561276457600080fd5b50612771888289016123fd565b969995985093965092949392505050565b803563ffffffff8116811461224957600080fd5b6000806000606084860312156127ab57600080fd5b833592506127bb60208501612782565b91506127c960408501612782565b90509250925092565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b60007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff820361286157612861612801565b5060010190565b60006060823603121561287a57600080fd5b6128826122d1565b823567ffffffffffffffff8082111561289a57600080fd5b9084019036601f8301126128ad57600080fd5b81356020828211156128c1576128c1612278565b6128f1817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f850116016122f4565b9250818352368183860101111561290757600080fd5b81818501828501376000918301810191909152908352848101359083015250604092830135928101929092525090565b81516103208201908260005b601981101561296c57825167ffffffffffffffff16825260209283019290910190600101612943565b50505092915050565b6000821982111561298857612988612801565b500190565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126129c257600080fd5b83018035915067ffffffffffffffff8211156129dd57600080fd5b60200191503681900382131561244257600080fd5b600181815b80851115612a4b57817fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115612a3157612a31612801565b80851615612a3e57918102915b93841c93908002906129f7565b509250929050565b600082612a6257506001612b0e565b81612a6f57506000612b0e565b8160018114612a855760028114612a8f57612aab565b6001915050612b0e565b60ff841115612aa057612aa0612801565b50506001821b612b0e565b5060208310610133831016604e8410600b8410161715612ace575081810a612b0e565b612ad883836129f2565b807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff04821115612b0a57612b0a612801565b0290505b92915050565b60006120208383612a53565b600082821015612b3257612b32612801565b500390565b600063ffffffff83811690831681811015612b5457612b54612801565b039392505050565b600063ffffffff808316818516808303821115612b7b57612b7b612801565b01949350505050565b6000845160005b81811015612ba55760208188018101518583015201612b8b565b81811115612bb4576000828501525b509190910192835250602082015260400191905056fea164736f6c634300080f000a"
func init() { func init() {
......
...@@ -31,7 +31,7 @@ var ( ...@@ -31,7 +31,7 @@ var (
// WETH9MetaData contains all meta data concerning the WETH9 contract. // WETH9MetaData contains all meta data concerning the WETH9 contract.
var WETH9MetaData = &bind.MetaData{ var WETH9MetaData = &bind.MetaData{
ABI: "[{\"type\":\"fallback\",\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"allowance\",\"inputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"approve\",\"inputs\":[{\"name\":\"guy\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"wad\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"balanceOf\",\"inputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"decimals\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"deposit\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"name\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"symbol\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"totalSupply\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"transfer\",\"inputs\":[{\"name\":\"dst\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"wad\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferFrom\",\"inputs\":[{\"name\":\"src\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"dst\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"wad\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdraw\",\"inputs\":[{\"name\":\"wad\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"Approval\",\"inputs\":[{\"name\":\"src\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"guy\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"wad\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Deposit\",\"inputs\":[{\"name\":\"dst\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"wad\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Transfer\",\"inputs\":[{\"name\":\"src\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"dst\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"wad\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Withdrawal\",\"inputs\":[{\"name\":\"src\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"wad\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false}]", ABI: "[{\"type\":\"fallback\",\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"allowance\",\"inputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"approve\",\"inputs\":[{\"name\":\"guy\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"wad\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"balanceOf\",\"inputs\":[{\"name\":\"\",\"type\":\"address\",\"internalType\":\"address\"}],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"decimals\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint8\",\"internalType\":\"uint8\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"deposit\",\"inputs\":[],\"outputs\":[],\"stateMutability\":\"payable\"},{\"type\":\"function\",\"name\":\"name\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"symbol\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"string\",\"internalType\":\"string\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"totalSupply\",\"inputs\":[],\"outputs\":[{\"name\":\"\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"stateMutability\":\"view\"},{\"type\":\"function\",\"name\":\"transfer\",\"inputs\":[{\"name\":\"dst\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"wad\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"transferFrom\",\"inputs\":[{\"name\":\"src\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"dst\",\"type\":\"address\",\"internalType\":\"address\"},{\"name\":\"wad\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[{\"name\":\"\",\"type\":\"bool\",\"internalType\":\"bool\"}],\"stateMutability\":\"nonpayable\"},{\"type\":\"function\",\"name\":\"withdraw\",\"inputs\":[{\"name\":\"wad\",\"type\":\"uint256\",\"internalType\":\"uint256\"}],\"outputs\":[],\"stateMutability\":\"nonpayable\"},{\"type\":\"event\",\"name\":\"Approval\",\"inputs\":[{\"name\":\"src\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"guy\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"wad\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Deposit\",\"inputs\":[{\"name\":\"dst\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"wad\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Transfer\",\"inputs\":[{\"name\":\"src\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"dst\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"wad\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false},{\"type\":\"event\",\"name\":\"Withdrawal\",\"inputs\":[{\"name\":\"src\",\"type\":\"address\",\"indexed\":true,\"internalType\":\"address\"},{\"name\":\"wad\",\"type\":\"uint256\",\"indexed\":false,\"internalType\":\"uint256\"}],\"anonymous\":false}]",
Bin: "0x60c0604052600d60808190526c2bb930b83832b21022ba3432b960991b60a090815261002e916000919061007a565b50604080518082019091526004808252630ae8aa8960e31b602090920191825261005a9160019161007a565b506002805460ff1916601217905534801561007457600080fd5b50610115565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100bb57805160ff19168380011785556100e8565b828001600101855582156100e8579182015b828111156100e85782518255916020019190600101906100cd565b506100f49291506100f8565b5090565b61011291905b808211156100f457600081556001016100fe565b90565b6107f9806101246000396000f3fe6080604052600436106100bc5760003560e01c8063313ce56711610074578063a9059cbb1161004e578063a9059cbb146102cb578063d0e30db0146100bc578063dd62ed3e14610311576100bc565b8063313ce5671461024b57806370a082311461027657806395d89b41146102b6576100bc565b806318160ddd116100a557806318160ddd146101aa57806323b872dd146101d15780632e1a7d4d14610221576100bc565b806306fdde03146100c6578063095ea7b314610150575b6100c4610359565b005b3480156100d257600080fd5b506100db6103a8565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101155781810151838201526020016100fd565b50505050905090810190601f1680156101425780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015c57600080fd5b506101966004803603604081101561017357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610454565b604080519115158252519081900360200190f35b3480156101b657600080fd5b506101bf6104c7565b60408051918252519081900360200190f35b3480156101dd57600080fd5b50610196600480360360608110156101f457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013590911690604001356104cb565b34801561022d57600080fd5b506100c46004803603602081101561024457600080fd5b503561066b565b34801561025757600080fd5b50610260610700565b6040805160ff9092168252519081900360200190f35b34801561028257600080fd5b506101bf6004803603602081101561029957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610709565b3480156102c257600080fd5b506100db61071b565b3480156102d757600080fd5b50610196600480360360408110156102ee57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610793565b34801561031d57600080fd5b506101bf6004803603604081101561033457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160200135166107a7565b33600081815260036020908152604091829020805434908101909155825190815291517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c9281900390910190a2565b6000805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561044c5780601f106104215761010080835404028352916020019161044c565b820191906000526020600020905b81548152906001019060200180831161042f57829003601f168201915b505050505081565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b4790565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120548211156104fd57600080fd5b73ffffffffffffffffffffffffffffffffffffffff84163314801590610573575073ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14155b156105ed5773ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020548211156105b557600080fd5b73ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020805483900390555b73ffffffffffffffffffffffffffffffffffffffff808516600081815260036020908152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35060019392505050565b3360009081526003602052604090205481111561068757600080fd5b33600081815260036020526040808220805485900390555183156108fc0291849190818181858888f193505050501580156106c6573d6000803e3d6000fd5b5060408051828152905133917f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65919081900360200190a250565b60025460ff1681565b60036020526000908152604090205481565b60018054604080516020600284861615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561044c5780601f106104215761010080835404028352916020019161044c565b60006107a03384846104cb565b9392505050565b60046020908152600092835260408084209091529082529020548156fea265627a7a72315820815b4d576ed6382f69c32a261321b184a7fbc2b81b87c3a52e66efdb3ee9602164736f6c63430005110032", Bin: "0x60c0604052600d60808190526c2bb930b83832b21022ba3432b960991b60a090815261002e916000919061007a565b50604080518082019091526004808252630ae8aa8960e31b602090920191825261005a9160019161007a565b506002805460ff1916601217905534801561007457600080fd5b50610115565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106100bb57805160ff19168380011785556100e8565b828001600101855582156100e8579182015b828111156100e85782518255916020019190600101906100cd565b506100f49291506100f8565b5090565b61011291905b808211156100f457600081556001016100fe565b90565b6107f9806101246000396000f3fe6080604052600436106100bc5760003560e01c8063313ce56711610074578063a9059cbb1161004e578063a9059cbb146102cb578063d0e30db0146100bc578063dd62ed3e14610311576100bc565b8063313ce5671461024b57806370a082311461027657806395d89b41146102b6576100bc565b806318160ddd116100a557806318160ddd146101aa57806323b872dd146101d15780632e1a7d4d14610221576100bc565b806306fdde03146100c6578063095ea7b314610150575b6100c4610359565b005b3480156100d257600080fd5b506100db6103a8565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101155781810151838201526020016100fd565b50505050905090810190601f1680156101425780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015c57600080fd5b506101966004803603604081101561017357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610454565b604080519115158252519081900360200190f35b3480156101b657600080fd5b506101bf6104c7565b60408051918252519081900360200190f35b3480156101dd57600080fd5b50610196600480360360608110156101f457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013590911690604001356104cb565b34801561022d57600080fd5b506100c46004803603602081101561024457600080fd5b503561066b565b34801561025757600080fd5b50610260610700565b6040805160ff9092168252519081900360200190f35b34801561028257600080fd5b506101bf6004803603602081101561029957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610709565b3480156102c257600080fd5b506100db61071b565b3480156102d757600080fd5b50610196600480360360408110156102ee57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610793565b34801561031d57600080fd5b506101bf6004803603604081101561033457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160200135166107a7565b33600081815260036020908152604091829020805434908101909155825190815291517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c9281900390910190a2565b6000805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561044c5780601f106104215761010080835404028352916020019161044c565b820191906000526020600020905b81548152906001019060200180831161042f57829003601f168201915b505050505081565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b4790565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120548211156104fd57600080fd5b73ffffffffffffffffffffffffffffffffffffffff84163314801590610573575073ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14155b156105ed5773ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020548211156105b557600080fd5b73ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020805483900390555b73ffffffffffffffffffffffffffffffffffffffff808516600081815260036020908152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35060019392505050565b3360009081526003602052604090205481111561068757600080fd5b33600081815260036020526040808220805485900390555183156108fc0291849190818181858888f193505050501580156106c6573d6000803e3d6000fd5b5060408051828152905133917f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65919081900360200190a250565b60025460ff1681565b60036020526000908152604090205481565b60018054604080516020600284861615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561044c5780601f106104215761010080835404028352916020019161044c565b60006107a03384846104cb565b9392505050565b60046020908152600092835260408084209091529082529020548156fea265627a7a723158201668ab2847c86647a20370de3c85906542e9da3d84f500326fc63321f2774e9264736f6c63430005110032",
} }
// WETH9ABI is the input ABI used to generate the binding from. // WETH9ABI is the input ABI used to generate the binding from.
......
...@@ -13,7 +13,7 @@ const WETH9StorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contract\":\"src ...@@ -13,7 +13,7 @@ const WETH9StorageLayoutJSON = "{\"storage\":[{\"astId\":1000,\"contract\":\"src
var WETH9StorageLayout = new(solc.StorageLayout) var WETH9StorageLayout = new(solc.StorageLayout)
var WETH9DeployedBin = "0x6080604052600436106100bc5760003560e01c8063313ce56711610074578063a9059cbb1161004e578063a9059cbb146102cb578063d0e30db0146100bc578063dd62ed3e14610311576100bc565b8063313ce5671461024b57806370a082311461027657806395d89b41146102b6576100bc565b806318160ddd116100a557806318160ddd146101aa57806323b872dd146101d15780632e1a7d4d14610221576100bc565b806306fdde03146100c6578063095ea7b314610150575b6100c4610359565b005b3480156100d257600080fd5b506100db6103a8565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101155781810151838201526020016100fd565b50505050905090810190601f1680156101425780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015c57600080fd5b506101966004803603604081101561017357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610454565b604080519115158252519081900360200190f35b3480156101b657600080fd5b506101bf6104c7565b60408051918252519081900360200190f35b3480156101dd57600080fd5b50610196600480360360608110156101f457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013590911690604001356104cb565b34801561022d57600080fd5b506100c46004803603602081101561024457600080fd5b503561066b565b34801561025757600080fd5b50610260610700565b6040805160ff9092168252519081900360200190f35b34801561028257600080fd5b506101bf6004803603602081101561029957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610709565b3480156102c257600080fd5b506100db61071b565b3480156102d757600080fd5b50610196600480360360408110156102ee57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610793565b34801561031d57600080fd5b506101bf6004803603604081101561033457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160200135166107a7565b33600081815260036020908152604091829020805434908101909155825190815291517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c9281900390910190a2565b6000805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561044c5780601f106104215761010080835404028352916020019161044c565b820191906000526020600020905b81548152906001019060200180831161042f57829003601f168201915b505050505081565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b4790565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120548211156104fd57600080fd5b73ffffffffffffffffffffffffffffffffffffffff84163314801590610573575073ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14155b156105ed5773ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020548211156105b557600080fd5b73ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020805483900390555b73ffffffffffffffffffffffffffffffffffffffff808516600081815260036020908152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35060019392505050565b3360009081526003602052604090205481111561068757600080fd5b33600081815260036020526040808220805485900390555183156108fc0291849190818181858888f193505050501580156106c6573d6000803e3d6000fd5b5060408051828152905133917f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65919081900360200190a250565b60025460ff1681565b60036020526000908152604090205481565b60018054604080516020600284861615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561044c5780601f106104215761010080835404028352916020019161044c565b60006107a03384846104cb565b9392505050565b60046020908152600092835260408084209091529082529020548156fea265627a7a72315820815b4d576ed6382f69c32a261321b184a7fbc2b81b87c3a52e66efdb3ee9602164736f6c63430005110032" var WETH9DeployedBin = "0x6080604052600436106100bc5760003560e01c8063313ce56711610074578063a9059cbb1161004e578063a9059cbb146102cb578063d0e30db0146100bc578063dd62ed3e14610311576100bc565b8063313ce5671461024b57806370a082311461027657806395d89b41146102b6576100bc565b806318160ddd116100a557806318160ddd146101aa57806323b872dd146101d15780632e1a7d4d14610221576100bc565b806306fdde03146100c6578063095ea7b314610150575b6100c4610359565b005b3480156100d257600080fd5b506100db6103a8565b6040805160208082528351818301528351919283929083019185019080838360005b838110156101155781810151838201526020016100fd565b50505050905090810190601f1680156101425780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561015c57600080fd5b506101966004803603604081101561017357600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610454565b604080519115158252519081900360200190f35b3480156101b657600080fd5b506101bf6104c7565b60408051918252519081900360200190f35b3480156101dd57600080fd5b50610196600480360360608110156101f457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135811691602081013590911690604001356104cb565b34801561022d57600080fd5b506100c46004803603602081101561024457600080fd5b503561066b565b34801561025757600080fd5b50610260610700565b6040805160ff9092168252519081900360200190f35b34801561028257600080fd5b506101bf6004803603602081101561029957600080fd5b503573ffffffffffffffffffffffffffffffffffffffff16610709565b3480156102c257600080fd5b506100db61071b565b3480156102d757600080fd5b50610196600480360360408110156102ee57600080fd5b5073ffffffffffffffffffffffffffffffffffffffff8135169060200135610793565b34801561031d57600080fd5b506101bf6004803603604081101561033457600080fd5b5073ffffffffffffffffffffffffffffffffffffffff813581169160200135166107a7565b33600081815260036020908152604091829020805434908101909155825190815291517fe1fffcc4923d04b559f4d29a8bfc6cda04eb5b0d3c460751c2402c5c5cc9109c9281900390910190a2565b6000805460408051602060026001851615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561044c5780601f106104215761010080835404028352916020019161044c565b820191906000526020600020905b81548152906001019060200180831161042f57829003601f168201915b505050505081565b33600081815260046020908152604080832073ffffffffffffffffffffffffffffffffffffffff8716808552908352818420869055815186815291519394909390927f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925928290030190a350600192915050565b4790565b73ffffffffffffffffffffffffffffffffffffffff83166000908152600360205260408120548211156104fd57600080fd5b73ffffffffffffffffffffffffffffffffffffffff84163314801590610573575073ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff14155b156105ed5773ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020548211156105b557600080fd5b73ffffffffffffffffffffffffffffffffffffffff841660009081526004602090815260408083203384529091529020805483900390555b73ffffffffffffffffffffffffffffffffffffffff808516600081815260036020908152604080832080548890039055938716808352918490208054870190558351868152935191937fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef929081900390910190a35060019392505050565b3360009081526003602052604090205481111561068757600080fd5b33600081815260036020526040808220805485900390555183156108fc0291849190818181858888f193505050501580156106c6573d6000803e3d6000fd5b5060408051828152905133917f7fcf532c15f0a6db0bd6d0e038bea71d30d808c7d98cb3bf7268a95bf5081b65919081900360200190a250565b60025460ff1681565b60036020526000908152604090205481565b60018054604080516020600284861615610100027fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0190941693909304601f8101849004840282018401909252818152929183018282801561044c5780601f106104215761010080835404028352916020019161044c565b60006107a03384846104cb565b9392505050565b60046020908152600092835260408084209091529082529020548156fea265627a7a723158201668ab2847c86647a20370de3c85906542e9da3d84f500326fc63321f2774e9264736f6c63430005110032"
func init() { func init() {
......
...@@ -15,6 +15,7 @@ remappings = [ ...@@ -15,6 +15,7 @@ remappings = [
'@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts', '@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts',
'@rari-capital/solmate/=lib/solmate', '@rari-capital/solmate/=lib/solmate',
'@cwia/=lib/clones-with-immutable-args/src', '@cwia/=lib/clones-with-immutable-args/src',
'@lib-keccak/=lib/lib-keccak/contracts/lib',
'forge-std/=lib/forge-std/src', 'forge-std/=lib/forge-std/src',
'ds-test/=lib/forge-std/lib/ds-test/src', 'ds-test/=lib/forge-std/lib/ds-test/src',
'safe-contracts/=lib/safe-contracts/contracts', 'safe-contracts/=lib/safe-contracts/contracts',
......
Subproject commit 59dcbd7b0de1fd00b44f4ce41e99a7f990564d11
...@@ -1091,6 +1091,18 @@ ...@@ -1091,6 +1091,18 @@
"length": 22, "length": 22,
"filename_relative": "src/dispute/FaultDisputeGame.sol" "filename_relative": "src/dispute/FaultDisputeGame.sol"
}, },
{
"id": "037c6a008887de2859c40f66cb99806d2e25ea8d4b0658d3fdc448e77c20439b",
"impact": "Medium",
"confidence": "Medium",
"check": "uninitialized-local",
"description": "PreimageOracle.challengeFirstLPP(address,uint256,PreimageOracle.Leaf,bytes32[]).stateMatrix (src/cannon/PreimageOracle.sol#357) is a local variable never initialized\n",
"type": "variable",
"name": "stateMatrix",
"start": 16305,
"length": 40,
"filename_relative": "src/cannon/PreimageOracle.sol"
},
{ {
"id": "8c229f5475784b2e9526e30d55b066e479489bca4b07c4f062b42b5b70100794", "id": "8c229f5475784b2e9526e30d55b066e479489bca4b07c4f062b42b5b70100794",
"impact": "Medium", "impact": "Medium",
......
[ [
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "CHALLENGE_PERIOD",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "KECCAK_TREE_DEPTH",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "MAX_LEAF_COUNT",
"outputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_uuid",
"type": "uint256"
},
{
"internalType": "bytes",
"name": "_input",
"type": "bytes"
},
{
"internalType": "bytes32[]",
"name": "_stateCommitments",
"type": "bytes32[]"
},
{
"internalType": "bool",
"name": "_finalize",
"type": "bool"
}
],
"name": "addLeavesLPP",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_claimant",
"type": "address"
},
{
"internalType": "uint256",
"name": "_uuid",
"type": "uint256"
},
{
"components": [
{
"internalType": "bytes",
"name": "input",
"type": "bytes"
},
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "stateCommitment",
"type": "bytes32"
}
],
"internalType": "struct PreimageOracle.Leaf",
"name": "_postState",
"type": "tuple"
},
{
"internalType": "bytes32[]",
"name": "_postStateProof",
"type": "bytes32[]"
}
],
"name": "challengeFirstLPP",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_claimant",
"type": "address"
},
{
"internalType": "uint256",
"name": "_uuid",
"type": "uint256"
},
{
"components": [
{
"internalType": "uint64[25]",
"name": "state",
"type": "uint64[25]"
}
],
"internalType": "struct LibKeccak.StateMatrix",
"name": "_stateMatrix",
"type": "tuple"
},
{
"components": [
{
"internalType": "bytes",
"name": "input",
"type": "bytes"
},
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "stateCommitment",
"type": "bytes32"
}
],
"internalType": "struct PreimageOracle.Leaf",
"name": "_preState",
"type": "tuple"
},
{
"internalType": "bytes32[]",
"name": "_preStateProof",
"type": "bytes32[]"
},
{
"components": [
{
"internalType": "bytes",
"name": "input",
"type": "bytes"
},
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "stateCommitment",
"type": "bytes32"
}
],
"internalType": "struct PreimageOracle.Leaf",
"name": "_postState",
"type": "tuple"
},
{
"internalType": "bytes32[]",
"name": "_postStateProof",
"type": "bytes32[]"
}
],
"name": "challengeLPP",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "_owner",
"type": "address"
},
{
"internalType": "uint256",
"name": "_uuid",
"type": "uint256"
}
],
"name": "getTreeRootLPP",
"outputs": [
{
"internalType": "bytes32",
"name": "treeRoot_",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "_uuid",
"type": "uint256"
},
{
"internalType": "uint32",
"name": "_partOffset",
"type": "uint32"
},
{
"internalType": "uint32",
"name": "_claimedSize",
"type": "uint32"
}
],
"name": "initLPP",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {
...@@ -123,6 +371,83 @@ ...@@ -123,6 +371,83 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "proposalBranches",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "proposalMetadata",
"outputs": [
{
"internalType": "LPPMetaData",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
},
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "proposalParts",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{ {
"inputs": [ "inputs": [
{ {
...@@ -152,9 +477,162 @@ ...@@ -152,9 +477,162 @@
"stateMutability": "view", "stateMutability": "view",
"type": "function" "type": "function"
}, },
{
"inputs": [
{
"internalType": "address",
"name": "_claimant",
"type": "address"
},
{
"internalType": "uint256",
"name": "_uuid",
"type": "uint256"
},
{
"components": [
{
"internalType": "uint64[25]",
"name": "state",
"type": "uint64[25]"
}
],
"internalType": "struct LibKeccak.StateMatrix",
"name": "_stateMatrix",
"type": "tuple"
},
{
"components": [
{
"internalType": "bytes",
"name": "input",
"type": "bytes"
},
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "stateCommitment",
"type": "bytes32"
}
],
"internalType": "struct PreimageOracle.Leaf",
"name": "_preState",
"type": "tuple"
},
{
"internalType": "bytes32[]",
"name": "_preStateProof",
"type": "bytes32[]"
},
{
"components": [
{
"internalType": "bytes",
"name": "input",
"type": "bytes"
},
{
"internalType": "uint256",
"name": "index",
"type": "uint256"
},
{
"internalType": "bytes32",
"name": "stateCommitment",
"type": "bytes32"
}
],
"internalType": "struct PreimageOracle.Leaf",
"name": "_postState",
"type": "tuple"
},
{
"internalType": "bytes32[]",
"name": "_postStateProof",
"type": "bytes32[]"
}
],
"name": "squeezeLPP",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "zeroHashes",
"outputs": [
{
"internalType": "bytes32",
"name": "",
"type": "bytes32"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "ActiveProposal",
"type": "error"
},
{
"inputs": [],
"name": "AlreadyFinalized",
"type": "error"
},
{
"inputs": [],
"name": "BadProposal",
"type": "error"
},
{
"inputs": [],
"name": "InvalidInputSize",
"type": "error"
},
{
"inputs": [],
"name": "InvalidPreimage",
"type": "error"
},
{
"inputs": [],
"name": "InvalidProof",
"type": "error"
},
{
"inputs": [],
"name": "NotInitialized",
"type": "error"
},
{ {
"inputs": [], "inputs": [],
"name": "PartOffsetOOB", "name": "PartOffsetOOB",
"type": "error" "type": "error"
},
{
"inputs": [],
"name": "PostStateMatches",
"type": "error"
},
{
"inputs": [],
"name": "StatesNotContiguous",
"type": "error"
},
{
"inputs": [],
"name": "TreeSizeOverflow",
"type": "error"
} }
] ]
\ No newline at end of file
...@@ -19,5 +19,33 @@ ...@@ -19,5 +19,33 @@
"offset": 0, "offset": 0,
"slot": "2", "slot": "2",
"type": "mapping(bytes32 => mapping(uint256 => bool))" "type": "mapping(bytes32 => mapping(uint256 => bool))"
},
{
"bytes": "512",
"label": "zeroHashes",
"offset": 0,
"slot": "3",
"type": "bytes32[16]"
},
{
"bytes": "32",
"label": "proposalBranches",
"offset": 0,
"slot": "19",
"type": "mapping(address => mapping(uint256 => bytes32[16]))"
},
{
"bytes": "32",
"label": "proposalMetadata",
"offset": 0,
"slot": "20",
"type": "mapping(address => mapping(uint256 => LPPMetaData))"
},
{
"bytes": "32",
"label": "proposalParts",
"offset": 0,
"slot": "21",
"type": "mapping(address => mapping(uint256 => bytes32))"
} }
] ]
\ No newline at end of file
...@@ -3,18 +3,77 @@ pragma solidity 0.8.15; ...@@ -3,18 +3,77 @@ pragma solidity 0.8.15;
import { IPreimageOracle } from "./interfaces/IPreimageOracle.sol"; import { IPreimageOracle } from "./interfaces/IPreimageOracle.sol";
import { PreimageKeyLib } from "./PreimageKeyLib.sol"; import { PreimageKeyLib } from "./PreimageKeyLib.sol";
import "./libraries/CannonErrors.sol"; import { LibKeccak } from "@lib-keccak/LibKeccak.sol";
import "src/cannon/libraries/CannonErrors.sol";
import "src/cannon/libraries/CannonTypes.sol";
/// @title PreimageOracle /// @title PreimageOracle
/// @notice A contract for storing permissioned pre-images. /// @notice A contract for storing permissioned pre-images.
/// @custom:attribution Solady <https://github.com/Vectorized/solady/blob/main/src/utils/MerkleProofLib.sol#L13-L43>
/// @custom:attribution Beacon Deposit Contract <0x00000000219ab540356cbb839cbe05303d7705fa>
contract PreimageOracle is IPreimageOracle { contract PreimageOracle is IPreimageOracle {
////////////////////////////////////////////////////////////////
// Constants //
////////////////////////////////////////////////////////////////
/// @notice The depth of the keccak256 merkle tree. Supports up to 65,536 keccak blocks, or ~8.91MB preimages.
uint256 public constant KECCAK_TREE_DEPTH = 16;
/// @notice The maximum number of keccak blocks that can fit into the merkle tree.
uint256 public constant MAX_LEAF_COUNT = 2 ** KECCAK_TREE_DEPTH - 1;
/// @notice The duration of the large preimage proposal challenge period.
uint256 public constant CHALLENGE_PERIOD = 1 days;
////////////////////////////////////////////////////////////////
// Authorized Preimage Parts //
////////////////////////////////////////////////////////////////
/// @notice Mapping of pre-image keys to pre-image lengths. /// @notice Mapping of pre-image keys to pre-image lengths.
mapping(bytes32 => uint256) public preimageLengths; mapping(bytes32 => uint256) public preimageLengths;
/// @notice Mapping of pre-image keys to pre-image parts. /// @notice Mapping of pre-image keys to pre-image offsets to pre-image parts.
mapping(bytes32 => mapping(uint256 => bytes32)) public preimageParts; mapping(bytes32 => mapping(uint256 => bytes32)) public preimageParts;
/// @notice Mapping of pre-image keys to pre-image part offsets. /// @notice Mapping of pre-image keys to pre-image part offsets to preimage preparedness.
mapping(bytes32 => mapping(uint256 => bool)) public preimagePartOk; mapping(bytes32 => mapping(uint256 => bool)) public preimagePartOk;
////////////////////////////////////////////////////////////////
// Large Preimage Proposals //
////////////////////////////////////////////////////////////////
/// @notice A raw leaf of the large preimage proposal merkle tree.
struct Leaf {
/// @notice The input absorbed for the block, exactly 136 bytes.
bytes input;
/// @notice The index of the block in the absorption process.
uint256 index;
/// @notice The hash of the internal state after absorbing the input.
bytes32 stateCommitment;
}
/// @notice Static padding hashes. These values are persisted in storage, but are entirely immutable
/// after the constructor's execution.
bytes32[KECCAK_TREE_DEPTH] public zeroHashes;
/// @notice Mapping of claimants to proposal UUIDs to the current branch path of the merkleization process.
mapping(address => mapping(uint256 => bytes32[KECCAK_TREE_DEPTH])) public proposalBranches;
/// @notice Mapping of claimants to proposal UUIDs to the timestamp of creation of the proposal as well as the
/// challenged status.
mapping(address => mapping(uint256 => LPPMetaData)) public proposalMetadata;
/// @notice Mapping of claimants to proposal UUIDs to the preimage part picked up during the absorbtion process.
mapping(address => mapping(uint256 => bytes32)) public proposalParts;
////////////////////////////////////////////////////////////////
// Constructor //
////////////////////////////////////////////////////////////////
constructor() {
// Compute hashes in empty sparse Merkle tree. The first hash is not set, and kept as zero as the identity.
for (uint256 height = 0; height < KECCAK_TREE_DEPTH - 1; height++) {
zeroHashes[height + 1] = keccak256(abi.encodePacked(zeroHashes[height], zeroHashes[height]));
}
}
////////////////////////////////////////////////////////////////
// Standard Preimage Route (External) //
////////////////////////////////////////////////////////////////
/// @inheritdoc IPreimageOracle /// @inheritdoc IPreimageOracle
function readPreimage(bytes32 _key, uint256 _offset) external view returns (bytes32 dat_, uint256 datLen_) { function readPreimage(bytes32 _key, uint256 _offset) external view returns (bytes32 dat_, uint256 datLen_) {
require(preimagePartOk[_key][_offset], "pre-image must exist"); require(preimagePartOk[_key][_offset], "pre-image must exist");
...@@ -106,4 +165,308 @@ contract PreimageOracle is IPreimageOracle { ...@@ -106,4 +165,308 @@ contract PreimageOracle is IPreimageOracle {
preimageParts[key][_partOffset] = part; preimageParts[key][_partOffset] = part;
preimageLengths[key] = size; preimageLengths[key] = size;
} }
////////////////////////////////////////////////////////////////
// Large Preimage Proposals (External) //
////////////////////////////////////////////////////////////////
/// @notice Initialize a large preimage proposal. Must be called before adding any leaves.
function initLPP(uint256 _uuid, uint32 _partOffset, uint32 _claimedSize) external {
if (_partOffset >= _claimedSize + 8) revert PartOffsetOOB();
LPPMetaData metaData = proposalMetadata[msg.sender][_uuid];
proposalMetadata[msg.sender][_uuid] = metaData.setPartOffset(_partOffset).setClaimedSize(_claimedSize);
}
/// @notice Adds a contiguous list of keccak state matrices to the merkle tree.
function addLeavesLPP(
uint256 _uuid,
bytes calldata _input,
bytes32[] calldata _stateCommitments,
bool _finalize
)
external
{
// If we're finalizing, pad the input for the submitter. If not, copy the input into memory verbatim.
bytes memory input;
if (_finalize) {
input = LibKeccak.pad(_input);
} else {
input = _input;
}
// Pull storage variables onto the stack / into memory for operations.
bytes32[KECCAK_TREE_DEPTH] memory branch = proposalBranches[msg.sender][_uuid];
LPPMetaData metaData = proposalMetadata[msg.sender][_uuid];
// Revert if the proposal has not been initialized. 0-size preimages are *not* allowed.
if (metaData.claimedSize() == 0) revert NotInitialized();
// Revert if the proposal has already been finalized. No leaves can be added after this point.
if (metaData.timestamp() != 0) revert AlreadyFinalized();
// Check if the part offset is present in the input data being posted. If it is, assign the part to the mapping.
uint256 offset = metaData.partOffset();
uint256 currentSize = metaData.bytesProcessed();
if (offset < 8 && currentSize == 0) {
uint32 claimedSize = metaData.claimedSize();
bytes32 preimagePart;
assembly {
mstore(0x00, shl(192, claimedSize))
mstore(0x08, calldataload(_input.offset))
preimagePart := mload(offset)
}
proposalParts[msg.sender][_uuid] = preimagePart;
} else if (offset >= 8 && (offset = offset - 8) >= currentSize && offset < currentSize + _input.length) {
uint256 relativeOffset = offset - currentSize;
// Revert if the full preimage part is not available in the data we're absorbing. The submitter must
// supply data that contains the full preimage part so that no partial preimage parts are stored in the
// oracle. Partial parts are *only* allowed at the tail end of the preimage, where no more data is available
// to be absorbed.
if (relativeOffset + 32 >= _input.length && !_finalize) revert PartOffsetOOB();
// If the preimage part is in the data we're about to absorb, persist the part to the caller's large
// preimaage metadata.
bytes32 preimagePart;
assembly {
preimagePart := calldataload(add(_input.offset, relativeOffset))
}
proposalParts[msg.sender][_uuid] = preimagePart;
}
uint256 blocksProcessed = metaData.blocksProcessed();
assembly {
let inputLen := mload(input)
let inputPtr := add(input, 0x20)
// The input length must be a multiple of 136 bytes
// The input lenth / 136 must be equal to the number of state commitments.
if or(mod(inputLen, 136), iszero(eq(_stateCommitments.length, div(inputLen, 136)))) {
// Store "InvalidInputSize()" error selector
mstore(0x00, 0x7b1daf1)
revert(0x1C, 0x04)
}
// Allocate a hashing buffer the size of the leaf preimage.
let hashBuf := mload(0x40)
mstore(0x40, add(hashBuf, 0xC8))
for { let i := 0 } lt(i, inputLen) { i := add(i, 136) } {
// Copy the leaf preimage into the hashing buffer.
let inputStartPtr := add(inputPtr, i)
mstore(hashBuf, mload(inputStartPtr))
mstore(add(hashBuf, 0x20), mload(add(inputStartPtr, 0x20)))
mstore(add(hashBuf, 0x40), mload(add(inputStartPtr, 0x40)))
mstore(add(hashBuf, 0x60), mload(add(inputStartPtr, 0x60)))
mstore(add(hashBuf, 0x80), mload(add(inputStartPtr, 0x80)))
mstore(add(hashBuf, 136), blocksProcessed)
mstore(add(hashBuf, 168), calldataload(add(_stateCommitments.offset, shl(0x05, div(i, 136)))))
// Hash the leaf preimage to get the node to add.
let node := keccak256(hashBuf, 0xC8)
// Increment the number of blocks processed.
blocksProcessed := add(blocksProcessed, 0x01)
// Add the node to the tree.
let size := blocksProcessed
for { let height := 0x00 } lt(height, shl(0x05, KECCAK_TREE_DEPTH)) { height := add(height, 0x20) } {
if and(size, 0x01) {
mstore(add(branch, height), node)
break
}
// Hash the node at `height` in the branch and the node together.
mstore(0x00, mload(add(branch, height)))
mstore(0x20, node)
node := keccak256(0x00, 0x40)
size := shr(0x01, size)
}
}
}
// Do not allow for posting preimages larger than the merkle tree can support.
if (blocksProcessed > MAX_LEAF_COUNT) revert TreeSizeOverflow();
// Perist the branch to storage.
proposalBranches[msg.sender][_uuid] = branch;
// Update the proposal metadata.
metaData =
metaData.setBlocksProcessed(uint32(blocksProcessed)).setBytesProcessed(uint32(_input.length + currentSize));
if (_finalize) metaData = metaData.setTimestamp(uint64(block.timestamp));
proposalMetadata[msg.sender][_uuid] = metaData;
}
/// @notice Challenge a keccak256 block that was committed to in the merkle tree.
function challengeLPP(
address _claimant,
uint256 _uuid,
LibKeccak.StateMatrix memory _stateMatrix,
Leaf calldata _preState,
bytes32[] calldata _preStateProof,
Leaf calldata _postState,
bytes32[] calldata _postStateProof
)
external
{
// Verify that both leaves are present in the merkle tree.
bytes32 root = getTreeRootLPP(_claimant, _uuid);
if (
!(
_verify(_preStateProof, root, _preState.index, _hashLeaf(_preState))
&& _verify(_postStateProof, root, _postState.index, _hashLeaf(_postState))
)
) revert InvalidProof();
// Verify that the prestate passed matches the intermediate state claimed in the leaf.
if (keccak256(abi.encode(_stateMatrix)) != _preState.stateCommitment) revert InvalidPreimage();
// Verify that the pre/post state are contiguous.
if (_preState.index + 1 != _postState.index) revert StatesNotContiguous();
// Absorb and permute the input bytes.
LibKeccak.absorb(_stateMatrix, _postState.input);
LibKeccak.permutation(_stateMatrix);
// Verify that the post state hash doesn't match the expected hash.
if (keccak256(abi.encode(_stateMatrix)) == _postState.stateCommitment) revert PostStateMatches();
// Mark the keccak claim as countered.
proposalMetadata[_claimant][_uuid] = proposalMetadata[_claimant][_uuid].setCountered(true);
}
/// @notice Challenge the first keccak256 block that was absorbed.
function challengeFirstLPP(
address _claimant,
uint256 _uuid,
Leaf calldata _postState,
bytes32[] calldata _postStateProof
)
external
{
// Verify that the leaf is present in the merkle tree.
bytes32 root = getTreeRootLPP(_claimant, _uuid);
if (!_verify(_postStateProof, root, _postState.index, _hashLeaf(_postState))) revert InvalidProof();
// The poststate index must be 0 in order to challenge it with this function.
if (_postState.index != 0) revert StatesNotContiguous();
// Absorb and permute the input bytes into a fresh state matrix.
LibKeccak.StateMatrix memory stateMatrix;
LibKeccak.absorb(stateMatrix, _postState.input);
LibKeccak.permutation(stateMatrix);
// Verify that the post state hash doesn't match the expected hash.
if (keccak256(abi.encode(stateMatrix)) == _postState.stateCommitment) revert PostStateMatches();
// Mark the keccak claim as countered.
proposalMetadata[_claimant][_uuid] = proposalMetadata[_claimant][_uuid].setCountered(true);
}
/// @notice Finalize a large preimage proposal after the challenge period has passed.
function squeezeLPP(
address _claimant,
uint256 _uuid,
LibKeccak.StateMatrix memory _stateMatrix,
Leaf calldata _preState,
bytes32[] calldata _preStateProof,
Leaf calldata _postState,
bytes32[] calldata _postStateProof
)
external
{
LPPMetaData metaData = proposalMetadata[_claimant][_uuid];
// Check if the proposal was countered.
if (metaData.countered()) revert BadProposal();
// Check if the challenge period has passed since the proposal was finalized.
if (block.timestamp - metaData.timestamp() <= CHALLENGE_PERIOD) revert ActiveProposal();
// Verify that both leaves are present in the merkle tree.
bytes32 root = getTreeRootLPP(_claimant, _uuid);
if (
!(
_verify(_preStateProof, root, _preState.index, _hashLeaf(_preState))
&& _verify(_postStateProof, root, _postState.index, _hashLeaf(_postState))
)
) revert InvalidProof();
// Verify that the prestate passed matches the intermediate state claimed in the leaf.
if (keccak256(abi.encode(_stateMatrix)) != _preState.stateCommitment) revert InvalidPreimage();
// Verify that the pre/post state are contiguous.
if (_preState.index + 1 != _postState.index || _postState.index != metaData.blocksProcessed() - 1) {
revert StatesNotContiguous();
}
// The claimed size must match the actual size of the preimage.
uint256 claimedSize = metaData.claimedSize();
if (metaData.bytesProcessed() != claimedSize) revert InvalidInputSize();
// Absorb and permute the input bytes. We perform no final verification on the state matrix here, since the
// proposal has passed the challenge period and is considered valid.
LibKeccak.absorb(_stateMatrix, _postState.input);
LibKeccak.permutation(_stateMatrix);
bytes32 finalDigest = LibKeccak.squeeze(_stateMatrix);
// Write the preimage part to the authorized preimage parts mapping.
uint256 partOffset = metaData.partOffset();
preimagePartOk[finalDigest][partOffset] = true;
preimageParts[finalDigest][partOffset] = proposalParts[_claimant][_uuid];
preimageLengths[finalDigest] = claimedSize;
}
/// @notice Gets the current merkle root of the large preimage proposal tree.
function getTreeRootLPP(address _owner, uint256 _uuid) public view returns (bytes32 treeRoot_) {
uint256 size = proposalMetadata[_owner][_uuid].blocksProcessed();
for (uint256 height = 0; height < KECCAK_TREE_DEPTH; height++) {
if ((size & 1) == 1) {
treeRoot_ = keccak256(abi.encode(proposalBranches[_owner][_uuid][height], treeRoot_));
} else {
treeRoot_ = keccak256(abi.encode(treeRoot_, zeroHashes[height]));
}
size >>= 1;
}
}
/// Check if leaf` at `index` verifies against the Merkle `root` and `branch`.
/// https://github.com/ethereum/consensus-specs/blob/dev/specs/phase0/beacon-chain.md#is_valid_merkle_branch
function _verify(
bytes32[] calldata _proof,
bytes32 _root,
uint256 _index,
bytes32 _leaf
)
internal
pure
returns (bool isValid_)
{
/// @solidity memory-safe-assembly
assembly {
function hashTwo(a, b) -> hash {
mstore(0x00, a)
mstore(0x20, b)
hash := keccak256(0x00, 0x40)
}
let value := _leaf
for { let i := 0x00 } lt(i, KECCAK_TREE_DEPTH) { i := add(i, 0x01) } {
let branchValue := calldataload(add(_proof.offset, shl(0x05, i)))
switch and(shr(i, _index), 0x01)
case 1 { value := hashTwo(branchValue, value) }
default { value := hashTwo(value, branchValue) }
}
isValid_ := eq(value, _root)
}
}
/// @notice Hashes leaf data for the preimage proposals tree
function _hashLeaf(Leaf memory _leaf) internal pure returns (bytes32 leaf_) {
leaf_ = keccak256(abi.encodePacked(_leaf.input, _leaf.index, _leaf.stateCommitment));
}
} }
...@@ -3,3 +3,33 @@ pragma solidity 0.8.15; ...@@ -3,3 +3,33 @@ pragma solidity 0.8.15;
/// @notice Thrown when a passed part offset is out of bounds. /// @notice Thrown when a passed part offset is out of bounds.
error PartOffsetOOB(); error PartOffsetOOB();
/// @notice Thrown when a merkle proof fails to verify.
error InvalidProof();
/// @notice Thrown when the prestate preimage doesn't match the claimed preimage.
error InvalidPreimage();
/// @notice Thrown when a leaf with an invalid input size is added.
error InvalidInputSize();
/// @notice Thrown when the pre and post states passed aren't contiguous.
error StatesNotContiguous();
/// @notice Thrown when the permutation yields the expected result.
error PostStateMatches();
/// @notice Thrown when the preimage is too large to fit in the tree.
error TreeSizeOverflow();
/// @notice Thrown when the preimage proposal has already been finalized.
error AlreadyFinalized();
/// @notice Thrown when the proposal has not matured past the challenge period.
error ActiveProposal();
/// @notice Thrown when attempting to finalize a proposal that has been challenged.
error BadProposal();
/// @notice Thrown when attempting to add leaves to a preimage proposal that has not been initialized.
error NotInitialized();
// SPDX-License-Identifier: MIT
pragma solidity 0.8.15;
using LPPMetadataLib for LPPMetaData global;
/// @notice Packed LPP metadata.
/// ┌─────────────┬────────────────────────────────────────────┐
/// │ Bit Offsets │ Description │
/// ├─────────────┼────────────────────────────────────────────┤
/// │ [0, 64) │ Timestamp (Finalized - All data available) │
/// │ [64, 96) │ Part Offset │
/// │ [96, 128) │ Claimed Size │
/// │ [128, 160) │ Blocks Processed (Inclusive of Padding) │
/// │ [160, 192) │ Bytes Processed (Non-inclusive of Padding) │
/// │ [192, 256) │ Countered │
/// └─────────────┴────────────────────────────────────────────┘
type LPPMetaData is bytes32;
/// @notice LPP metadata UDT extension functions.
library LPPMetadataLib {
uint256 private constant U64_MASK = 0xFFFFFFFFFFFFFFFF;
uint256 private constant U32_MASK = 0xFFFFFFFF;
function setTimestamp(LPPMetaData _self, uint64 _timestamp) internal pure returns (LPPMetaData self_) {
assembly {
self_ := or(shl(192, _timestamp), and(_self, not(shl(192, U64_MASK))))
}
}
function setPartOffset(LPPMetaData _self, uint32 _partOffset) internal pure returns (LPPMetaData self_) {
assembly {
self_ := or(shl(160, _partOffset), and(_self, not(shl(160, U32_MASK))))
}
}
function setClaimedSize(LPPMetaData _self, uint32 _claimedSize) internal pure returns (LPPMetaData self_) {
assembly {
self_ := or(shl(128, _claimedSize), and(_self, not(shl(128, U32_MASK))))
}
}
function setBlocksProcessed(LPPMetaData _self, uint32 _blocksProcessed) internal pure returns (LPPMetaData self_) {
assembly {
self_ := or(shl(96, _blocksProcessed), and(_self, not(shl(96, U32_MASK))))
}
}
function setBytesProcessed(LPPMetaData _self, uint32 _bytesProcessed) internal pure returns (LPPMetaData self_) {
assembly {
self_ := or(shl(64, _bytesProcessed), and(_self, not(shl(64, U32_MASK))))
}
}
function setCountered(LPPMetaData _self, bool _countered) internal pure returns (LPPMetaData self_) {
assembly {
self_ := or(_countered, and(_self, not(U64_MASK)))
}
}
function timestamp(LPPMetaData _self) internal pure returns (uint64 timestamp_) {
assembly {
timestamp_ := shr(192, _self)
}
}
function partOffset(LPPMetaData _self) internal pure returns (uint64 partOffset_) {
assembly {
partOffset_ := and(shr(160, _self), U32_MASK)
}
}
function claimedSize(LPPMetaData _self) internal pure returns (uint32 claimedSize_) {
assembly {
claimedSize_ := and(shr(128, _self), U32_MASK)
}
}
function blocksProcessed(LPPMetaData _self) internal pure returns (uint32 blocksProcessed_) {
assembly {
blocksProcessed_ := and(shr(96, _self), U32_MASK)
}
}
function bytesProcessed(LPPMetaData _self) internal pure returns (uint32 bytesProcessed_) {
assembly {
bytesProcessed_ := and(shr(64, _self), U32_MASK)
}
}
function countered(LPPMetaData _self) internal pure returns (bool countered_) {
assembly {
countered_ := and(_self, U64_MASK)
}
}
}
// SPDX-License-Identifier: MIT // SPDX-License-Identifier: MIT
pragma solidity 0.8.15; pragma solidity 0.8.15;
import { Test } from "forge-std/Test.sol"; import { Test, console2 as console } from "forge-std/Test.sol";
import { PreimageOracle } from "src/cannon/PreimageOracle.sol"; import { PreimageOracle } from "src/cannon/PreimageOracle.sol";
import { PreimageKeyLib } from "src/cannon/PreimageKeyLib.sol"; import { PreimageKeyLib } from "src/cannon/PreimageKeyLib.sol";
import { LibKeccak } from "@lib-keccak/LibKeccak.sol";
import { Bytes } from "src/libraries/Bytes.sol";
import "src/cannon/libraries/CannonErrors.sol"; import "src/cannon/libraries/CannonErrors.sol";
import "src/cannon/libraries/CannonTypes.sol";
contract PreimageOracle_Test is Test { contract PreimageOracle_Test is Test {
PreimageOracle oracle; PreimageOracle oracle;
...@@ -160,3 +163,836 @@ contract PreimageOracle_Test is Test { ...@@ -160,3 +163,836 @@ contract PreimageOracle_Test is Test {
oracle.readPreimage(key, offset); oracle.readPreimage(key, offset);
} }
} }
contract PreimageOracle_LargePreimageProposals_Test is Test {
uint256 internal constant TEST_UUID = 0xFACADE;
PreimageOracle internal oracle;
/// @notice Sets up the testing suite.
function setUp() public {
oracle = new PreimageOracle();
vm.label(address(oracle), "PreimageOracle");
}
/// @notice Tests that the `initLPP` function reverts when the part offset is out of bounds of the full preimage.
function test_initLPP_partOffsetOOB_reverts() public {
// Allocate the preimage data.
bytes memory data = new bytes(136);
for (uint256 i; i < data.length; i++) {
data[i] = 0xFF;
}
// Initialize the proposal.
vm.expectRevert(PartOffsetOOB.selector);
oracle.initLPP(TEST_UUID, 136 + 8, uint32(data.length));
}
/// @notice Gas snapshot for `addLeaves`
function test_addLeaves_gasSnapshot() public {
// Allocate the preimage data.
bytes memory data = new bytes(136 * 500);
for (uint256 i; i < data.length; i++) {
data[i] = 0xFF;
}
// Initialize the proposal.
oracle.initLPP(TEST_UUID, 0, uint32(data.length));
// Add the leaves to the tree (2 keccak blocks.)
LibKeccak.StateMatrix memory stateMatrix;
bytes32[] memory stateCommitments = _generateStateCommitments(stateMatrix, data);
// Allocate the calldata so it isn't included in the gas measurement.
bytes memory cd = abi.encodeCall(oracle.addLeavesLPP, (TEST_UUID, data, stateCommitments, true));
uint256 gas = gasleft();
(bool success,) = address(oracle).call(cd);
uint256 gasUsed = gas - gasleft();
assertTrue(success);
console.log("Gas used: %d", gasUsed);
console.log("Gas per byte (%d bytes streamed): %d", data.length, gasUsed / data.length);
console.log("Gas for 4MB: %d", (gasUsed / data.length) * 4000000);
}
/// @notice Tests that leaves can be added the large preimage proposal mapping and proven to be contained within
/// the computed merkle root.
function test_addLeaves_multipleParts_succeeds() public {
// Allocate the preimage data.
bytes memory data = new bytes(136 * 3);
for (uint256 i; i < data.length; i++) {
data[i] = 0xFF;
}
// Initialize the proposal.
oracle.initLPP(TEST_UUID, 0, uint32(data.length));
// Add the leaves to the tree (2 keccak blocks.)
LibKeccak.StateMatrix memory stateMatrix;
bytes32[] memory stateCommitments = _generateStateCommitments(stateMatrix, data);
uint256 midPoint = stateCommitments.length / 2;
bytes32[] memory commitmentsA = new bytes32[](midPoint);
bytes32[] memory commitmentsB = new bytes32[](midPoint);
for (uint256 i = 0; i < midPoint; i++) {
commitmentsA[i] = stateCommitments[i];
commitmentsB[i] = stateCommitments[i + midPoint];
}
oracle.addLeavesLPP(TEST_UUID, Bytes.slice(data, 0, 136 * 2), commitmentsA, false);
// MetaData assertions
LPPMetaData metaData = oracle.proposalMetadata(address(this), TEST_UUID);
assertEq(metaData.timestamp(), 0);
assertEq(metaData.partOffset(), 0);
assertEq(metaData.claimedSize(), data.length);
assertEq(metaData.blocksProcessed(), 2);
assertEq(metaData.bytesProcessed(), 136 * 2);
assertFalse(metaData.countered());
oracle.addLeavesLPP(TEST_UUID, Bytes.slice(data, 136 * 2, 136), commitmentsB, true);
// MetaData assertions
metaData = oracle.proposalMetadata(address(this), TEST_UUID);
assertEq(metaData.timestamp(), 1);
assertEq(metaData.partOffset(), 0);
assertEq(metaData.claimedSize(), data.length);
assertEq(metaData.blocksProcessed(), 4);
assertEq(metaData.bytesProcessed(), data.length);
assertFalse(metaData.countered());
// Preimage part assertions
bytes32 expectedPart = bytes32((~uint256(0) & ~(uint256(type(uint64).max) << 192)) | (data.length << 192));
assertEq(oracle.proposalParts(address(this), TEST_UUID), expectedPart);
// Should revert if we try to add new leaves.
vm.expectRevert(AlreadyFinalized.selector);
oracle.addLeavesLPP(TEST_UUID, data, stateCommitments, true);
}
/// @notice Tests that leaves cannot be added until the large preimage proposal has been initialized.
function test_addLeaves_notInitialized_reverts() public {
// Allocate the preimage data.
bytes memory data = new bytes(136 * 500);
// Add the leaves to the tree (2 keccak blocks.)
LibKeccak.StateMatrix memory stateMatrix;
bytes32[] memory stateCommitments = _generateStateCommitments(stateMatrix, data);
// Allocate the calldata so it isn't included in the gas measurement.
vm.expectRevert(NotInitialized.selector);
oracle.addLeavesLPP(TEST_UUID, data, stateCommitments, true);
}
/// @notice Tests that leaves can be added the large preimage proposal mapping and finalized to be added to the
/// authorized mappings.
function test_squeeze_challengePeriodPassed_succeeds() public {
// Allocate the preimage data.
bytes memory data = new bytes(136);
for (uint256 i; i < data.length; i++) {
data[i] = 0xFF;
}
// Initialize the proposal.
oracle.initLPP(TEST_UUID, 0, uint32(data.length));
// Add the leaves to the tree (2 keccak blocks.)
LibKeccak.StateMatrix memory stateMatrix;
bytes32[] memory stateCommitments = _generateStateCommitments(stateMatrix, data);
oracle.addLeavesLPP(TEST_UUID, data, stateCommitments, true);
// Construct the leaf preimage data for the blocks added.
LibKeccak.StateMatrix memory matrix;
PreimageOracle.Leaf[] memory leaves = _generateLeaves(matrix, data);
// Create a proof array with 16 elements.
bytes32[] memory preProof = new bytes32[](16);
preProof[0] = _hashLeaf(leaves[1]);
bytes32[] memory postProof = new bytes32[](16);
postProof[0] = _hashLeaf(leaves[0]);
for (uint256 i = 1; i < preProof.length; i++) {
bytes32 zeroHash = oracle.zeroHashes(i);
preProof[i] = zeroHash;
postProof[i] = zeroHash;
}
vm.warp(block.timestamp + oracle.CHALLENGE_PERIOD() + 1 seconds);
// Finalize the proposal.
oracle.squeezeLPP({
_claimant: address(this),
_uuid: TEST_UUID,
_stateMatrix: _stateMatrixAtBlockIndex(data, 1),
_preState: leaves[0],
_preStateProof: preProof,
_postState: leaves[1],
_postStateProof: postProof
});
bytes32 finalDigest = keccak256(data);
bytes32 expectedPart = bytes32((~uint256(0) & ~(uint256(type(uint64).max) << 192)) | (data.length << 192));
assertTrue(oracle.preimagePartOk(finalDigest, 0));
assertEq(oracle.preimageLengths(finalDigest), data.length);
assertEq(oracle.preimageParts(finalDigest, 0), expectedPart);
}
/// @notice Tests that a proposal cannot be finalized until it has passed the challenge period.
function test_squeeze_proposalChallenged_reverts() public {
// Allocate the preimage data.
bytes memory data = new bytes(136);
for (uint256 i; i < data.length; i++) {
data[i] = 0xFF;
}
bytes memory phonyData = new bytes(136);
// Initialize the proposal.
oracle.initLPP(TEST_UUID, 0, uint32(data.length));
// Add the leaves to the tree with mismatching state commitments.
LibKeccak.StateMatrix memory stateMatrix;
bytes32[] memory stateCommitments = _generateStateCommitments(stateMatrix, data);
oracle.addLeavesLPP(TEST_UUID, phonyData, stateCommitments, true);
// Construct the leaf preimage data for the blocks added.
LibKeccak.StateMatrix memory matrix;
PreimageOracle.Leaf[] memory leaves = _generateLeaves(matrix, phonyData);
leaves[0].stateCommitment = stateCommitments[0];
leaves[1].stateCommitment = stateCommitments[1];
// Create a proof array with 16 elements.
bytes32[] memory preProof = new bytes32[](16);
preProof[0] = _hashLeaf(leaves[1]);
bytes32[] memory postProof = new bytes32[](16);
postProof[0] = _hashLeaf(leaves[0]);
for (uint256 i = 1; i < preProof.length; i++) {
bytes32 zeroHash = oracle.zeroHashes(i);
preProof[i] = zeroHash;
postProof[i] = zeroHash;
}
// Should succeed since the commitment was wrong.
oracle.challengeFirstLPP({
_claimant: address(this),
_uuid: TEST_UUID,
_postState: leaves[0],
_postStateProof: preProof
});
LPPMetaData metaData = oracle.proposalMetadata(address(this), TEST_UUID);
assertTrue(metaData.countered());
vm.warp(block.timestamp + oracle.CHALLENGE_PERIOD() + 1 seconds);
// Finalize the proposal.
vm.expectRevert(BadProposal.selector);
oracle.squeezeLPP({
_claimant: address(this),
_uuid: TEST_UUID,
_stateMatrix: _stateMatrixAtBlockIndex(data, 1),
_preState: leaves[0],
_preStateProof: preProof,
_postState: leaves[1],
_postStateProof: postProof
});
}
/// @notice Tests that a proposal cannot be finalized until it has passed the challenge period.
function test_squeeze_challengePeriodActive_reverts() public {
// Allocate the preimage data.
bytes memory data = new bytes(136);
for (uint256 i; i < data.length; i++) {
data[i] = 0xFF;
}
// Initialize the proposal.
oracle.initLPP(TEST_UUID, 0, uint32(data.length));
// Add the leaves to the tree (2 keccak blocks.)
LibKeccak.StateMatrix memory stateMatrix;
bytes32[] memory stateCommitments = _generateStateCommitments(stateMatrix, data);
oracle.addLeavesLPP(TEST_UUID, data, stateCommitments, true);
// Construct the leaf preimage data for the blocks added.
LibKeccak.StateMatrix memory matrix;
PreimageOracle.Leaf[] memory leaves = _generateLeaves(matrix, data);
// Finalize the proposal.
vm.expectRevert(ActiveProposal.selector);
oracle.squeezeLPP({
_claimant: address(this),
_uuid: TEST_UUID,
_stateMatrix: _stateMatrixAtBlockIndex(data, 1),
_preState: leaves[0],
_preStateProof: new bytes32[](16),
_postState: leaves[1],
_postStateProof: new bytes32[](16)
});
}
/// @notice Tests that a proposal cannot be finalized until it has passed the challenge period.
function test_squeeze_incompleteAbsorbtion_reverts() public {
// Allocate the preimage data.
bytes memory data = new bytes(136);
for (uint256 i; i < data.length; i++) {
data[i] = 0xFF;
}
// Initialize the proposal.
oracle.initLPP(TEST_UUID, 0, uint32(data.length));
// Construct the leaf preimage data for the blocks added.
LibKeccak.StateMatrix memory matrix;
PreimageOracle.Leaf[] memory leaves = _generateLeaves(matrix, data);
// Finalize the proposal.
vm.expectRevert(ActiveProposal.selector);
oracle.squeezeLPP({
_claimant: address(this),
_uuid: TEST_UUID,
_stateMatrix: _stateMatrixAtBlockIndex(data, 1),
_preState: leaves[0],
_preStateProof: new bytes32[](16),
_postState: leaves[1],
_postStateProof: new bytes32[](16)
});
}
/// @notice Tests that the `squeeze` function reverts when the passed states are not contiguous.
function test_squeeze_statesNotContiguous_reverts() public {
// Allocate the preimage data.
bytes memory data = new bytes(136);
for (uint256 i; i < data.length; i++) {
data[i] = 0xFF;
}
// Initialize the proposal.
oracle.initLPP(TEST_UUID, 0, uint32(data.length));
// Add the leaves to the tree (2 keccak blocks.)
LibKeccak.StateMatrix memory stateMatrix;
bytes32[] memory stateCommitments = _generateStateCommitments(stateMatrix, data);
oracle.addLeavesLPP(TEST_UUID, data, stateCommitments, true);
// Construct the leaf preimage data for the blocks added.
LibKeccak.StateMatrix memory matrix;
PreimageOracle.Leaf[] memory leaves = _generateLeaves(matrix, data);
// Create a proof array with 16 elements.
bytes32[] memory preProof = new bytes32[](16);
preProof[0] = _hashLeaf(leaves[1]);
bytes32[] memory postProof = new bytes32[](16);
postProof[0] = _hashLeaf(leaves[0]);
for (uint256 i = 1; i < preProof.length; i++) {
bytes32 zeroHash = oracle.zeroHashes(i);
preProof[i] = zeroHash;
postProof[i] = zeroHash;
}
vm.warp(block.timestamp + oracle.CHALLENGE_PERIOD() + 1 seconds);
// Finalize the proposal.
vm.expectRevert(StatesNotContiguous.selector);
oracle.squeezeLPP({
_claimant: address(this),
_uuid: TEST_UUID,
_stateMatrix: _stateMatrixAtBlockIndex(data, 2),
_preState: leaves[1],
_preStateProof: postProof,
_postState: leaves[0],
_postStateProof: preProof
});
}
/// @notice Tests that the `squeeze` function reverts when the post state passed
function test_squeeze_invalidPreimage_reverts() public {
// Allocate the preimage data.
bytes memory data = new bytes(136);
for (uint256 i; i < data.length; i++) {
data[i] = 0xFF;
}
// Initialize the proposal.
oracle.initLPP(TEST_UUID, 0, uint32(data.length));
// Add the leaves to the tree (2 keccak blocks.)
LibKeccak.StateMatrix memory stateMatrix;
bytes32[] memory stateCommitments = _generateStateCommitments(stateMatrix, data);
oracle.addLeavesLPP(TEST_UUID, data, stateCommitments, true);
// Construct the leaf preimage data for the blocks added.
LibKeccak.StateMatrix memory matrix;
PreimageOracle.Leaf[] memory leaves = _generateLeaves(matrix, data);
// Create a proof array with 16 elements.
bytes32[] memory preProof = new bytes32[](16);
preProof[0] = _hashLeaf(leaves[1]);
bytes32[] memory postProof = new bytes32[](16);
postProof[0] = _hashLeaf(leaves[0]);
for (uint256 i = 1; i < preProof.length; i++) {
bytes32 zeroHash = oracle.zeroHashes(i);
preProof[i] = zeroHash;
postProof[i] = zeroHash;
}
vm.warp(block.timestamp + oracle.CHALLENGE_PERIOD() + 1 seconds);
// Finalize the proposal.
vm.expectRevert(InvalidPreimage.selector);
oracle.squeezeLPP({
_claimant: address(this),
_uuid: TEST_UUID,
_stateMatrix: _stateMatrixAtBlockIndex(data, 2),
_preState: leaves[0],
_preStateProof: preProof,
_postState: leaves[1],
_postStateProof: postProof
});
}
/// @notice Tests that the `squeeze` function reverts when the claimed size is not equal to the bytes processed.
function test_squeeze_invalidClaimedSize_reverts() public {
// Allocate the preimage data.
bytes memory data = new bytes(136);
for (uint256 i; i < data.length; i++) {
data[i] = 0xFF;
}
// Initialize the proposal.
oracle.initLPP(TEST_UUID, 0, uint32(data.length) - 1);
// Add the leaves to the tree (2 keccak blocks.)
LibKeccak.StateMatrix memory stateMatrix;
bytes32[] memory stateCommitments = _generateStateCommitments(stateMatrix, data);
oracle.addLeavesLPP(TEST_UUID, data, stateCommitments, true);
// Construct the leaf preimage data for the blocks added.
LibKeccak.StateMatrix memory matrix;
PreimageOracle.Leaf[] memory leaves = _generateLeaves(matrix, data);
// Create a proof array with 16 elements.
bytes32[] memory preProof = new bytes32[](16);
preProof[0] = _hashLeaf(leaves[1]);
bytes32[] memory postProof = new bytes32[](16);
postProof[0] = _hashLeaf(leaves[0]);
for (uint256 i = 1; i < preProof.length; i++) {
bytes32 zeroHash = oracle.zeroHashes(i);
preProof[i] = zeroHash;
postProof[i] = zeroHash;
}
vm.warp(block.timestamp + oracle.CHALLENGE_PERIOD() + 1 seconds);
vm.expectRevert(InvalidInputSize.selector);
oracle.squeezeLPP({
_claimant: address(this),
_uuid: TEST_UUID,
_stateMatrix: _stateMatrixAtBlockIndex(data, 1),
_preState: leaves[0],
_preStateProof: preProof,
_postState: leaves[1],
_postStateProof: postProof
});
}
/// @notice Tests that a valid leaf cannot be countered with the `challengeFirst` function.
function test_challengeFirst_validCommitment_reverts() public {
// Allocate the preimage data.
bytes memory data = new bytes(136);
for (uint256 i; i < data.length; i++) {
data[i] = 0xFF;
}
// Initialize the proposal.
oracle.initLPP(TEST_UUID, 0, uint32(data.length));
// Add the leaves to the tree with mismatching state commitments.
LibKeccak.StateMatrix memory stateMatrix;
bytes32[] memory stateCommitments = _generateStateCommitments(stateMatrix, data);
oracle.addLeavesLPP(TEST_UUID, data, stateCommitments, true);
// Construct the leaf preimage data for the blocks added.
LibKeccak.StateMatrix memory matrix;
PreimageOracle.Leaf[] memory leaves = _generateLeaves(matrix, data);
// Create a proof array with 16 elements.
bytes32[] memory p = new bytes32[](16);
p[0] = _hashLeaf(leaves[1]);
for (uint256 i = 1; i < p.length; i++) {
p[i] = oracle.zeroHashes(i);
}
vm.expectRevert(PostStateMatches.selector);
oracle.challengeFirstLPP({
_claimant: address(this),
_uuid: TEST_UUID,
_postState: leaves[0],
_postStateProof: p
});
LPPMetaData metaData = oracle.proposalMetadata(address(this), TEST_UUID);
assertFalse(metaData.countered());
}
/// @notice Tests that an invalid leaf cannot be countered with `challengeFirst` if it is not the first leaf.
function test_challengeFirst_statesNotContiguous_reverts() public {
// Allocate the preimage data.
bytes memory data = new bytes(136);
for (uint256 i; i < data.length; i++) {
data[i] = 0xFF;
}
bytes memory phonyData = new bytes(136);
// Initialize the proposal.
oracle.initLPP(TEST_UUID, 0, uint32(data.length));
// Add the leaves to the tree with mismatching state commitments.
LibKeccak.StateMatrix memory stateMatrix;
bytes32[] memory stateCommitments = _generateStateCommitments(stateMatrix, data);
oracle.addLeavesLPP(TEST_UUID, phonyData, stateCommitments, true);
// Construct the leaf preimage data for the blocks added.
LibKeccak.StateMatrix memory matrix;
PreimageOracle.Leaf[] memory leaves = _generateLeaves(matrix, phonyData);
leaves[0].stateCommitment = stateCommitments[0];
leaves[1].stateCommitment = stateCommitments[1];
// Create a proof array with 16 elements.
bytes32[] memory p = new bytes32[](16);
p[0] = _hashLeaf(leaves[0]);
for (uint256 i = 1; i < p.length; i++) {
p[i] = oracle.zeroHashes(i);
}
// Should succeed since the commitment was wrong.
vm.expectRevert(StatesNotContiguous.selector);
oracle.challengeFirstLPP({
_claimant: address(this),
_uuid: TEST_UUID,
_postState: leaves[1],
_postStateProof: p
});
}
/// @notice Tests that an invalid leaf can be countered with the `challengeFirst` function.
function test_challengeFirst_invalidCommitment_succeeds() public {
// Allocate the preimage data.
bytes memory data = new bytes(136);
for (uint256 i; i < data.length; i++) {
data[i] = 0xFF;
}
bytes memory phonyData = new bytes(136);
// Initialize the proposal.
oracle.initLPP(TEST_UUID, 0, uint32(data.length));
// Add the leaves to the tree with mismatching state commitments.
LibKeccak.StateMatrix memory stateMatrix;
bytes32[] memory stateCommitments = _generateStateCommitments(stateMatrix, data);
oracle.addLeavesLPP(TEST_UUID, phonyData, stateCommitments, true);
// Construct the leaf preimage data for the blocks added.
LibKeccak.StateMatrix memory matrix;
PreimageOracle.Leaf[] memory leaves = _generateLeaves(matrix, phonyData);
leaves[0].stateCommitment = stateCommitments[0];
leaves[1].stateCommitment = stateCommitments[1];
// Create a proof array with 16 elements.
bytes32[] memory p = new bytes32[](16);
p[0] = _hashLeaf(leaves[1]);
for (uint256 i = 1; i < p.length; i++) {
p[i] = oracle.zeroHashes(i);
}
// Should succeed since the commitment was wrong.
oracle.challengeFirstLPP({
_claimant: address(this),
_uuid: TEST_UUID,
_postState: leaves[0],
_postStateProof: p
});
LPPMetaData metaData = oracle.proposalMetadata(address(this), TEST_UUID);
assertTrue(metaData.countered());
}
/// @notice Tests that a valid leaf cannot be countered with the `challenge` function in the middle of the tree.
function test_challenge_validCommitment_reverts() public {
// Allocate the preimage data.
bytes memory data = new bytes(136);
for (uint256 i; i < data.length; i++) {
data[i] = 0xFF;
}
// Initialize the proposal.
oracle.initLPP(TEST_UUID, 0, uint32(data.length));
// Add the leaves to the tree with mismatching state commitments.
LibKeccak.StateMatrix memory stateMatrix;
bytes32[] memory stateCommitments = _generateStateCommitments(stateMatrix, data);
oracle.addLeavesLPP(TEST_UUID, data, stateCommitments, true);
// Construct the leaf preimage data for the blocks added.
LibKeccak.StateMatrix memory matrix;
PreimageOracle.Leaf[] memory leaves = _generateLeaves(matrix, data);
// Create a proof array with 16 elements.
bytes32[] memory preProof = new bytes32[](16);
preProof[0] = _hashLeaf(leaves[1]);
bytes32[] memory postProof = new bytes32[](16);
postProof[0] = _hashLeaf(leaves[0]);
for (uint256 i = 1; i < preProof.length; i++) {
bytes32 zeroHash = oracle.zeroHashes(i);
preProof[i] = zeroHash;
postProof[i] = zeroHash;
}
LibKeccak.StateMatrix memory preMatrix = _stateMatrixAtBlockIndex(data, 1);
vm.expectRevert(PostStateMatches.selector);
oracle.challengeLPP({
_claimant: address(this),
_uuid: TEST_UUID,
_stateMatrix: preMatrix,
_preState: leaves[0],
_preStateProof: preProof,
_postState: leaves[1],
_postStateProof: postProof
});
LPPMetaData metaData = oracle.proposalMetadata(address(this), TEST_UUID);
assertFalse(metaData.countered());
}
/// @notice Tests that an invalid leaf can not be countered with non-contiguous states.
function test_challenge_statesNotContiguous_reverts() public {
// Allocate the preimage data.
bytes memory data = new bytes(136 * 2);
for (uint256 i; i < data.length; i++) {
data[i] = 0xFF;
}
bytes memory phonyData = new bytes(136 * 2);
for (uint256 i = 0; i < phonyData.length / 2; i++) {
data[i] = 0xFF;
}
// Initialize the proposal.
oracle.initLPP(TEST_UUID, 0, uint32(data.length));
// Add the leaves to the tree with mismatching state commitments.
LibKeccak.StateMatrix memory stateMatrix;
bytes32[] memory stateCommitments = _generateStateCommitments(stateMatrix, data);
oracle.addLeavesLPP(TEST_UUID, phonyData, stateCommitments, true);
// Construct the leaf preimage data for the blocks added.
LibKeccak.StateMatrix memory matrix;
PreimageOracle.Leaf[] memory leaves = _generateLeaves(matrix, phonyData);
leaves[0].stateCommitment = stateCommitments[0];
leaves[1].stateCommitment = stateCommitments[1];
leaves[2].stateCommitment = stateCommitments[2];
// Create a proof array with 16 elements.
bytes32[] memory preProof = new bytes32[](16);
preProof[0] = _hashLeaf(leaves[1]);
preProof[1] = keccak256(abi.encode(_hashLeaf(leaves[2]), bytes32(0)));
bytes32[] memory postProof = new bytes32[](16);
postProof[0] = _hashLeaf(leaves[0]);
postProof[1] = keccak256(abi.encode(_hashLeaf(leaves[2]), bytes32(0)));
for (uint256 i = 2; i < preProof.length; i++) {
bytes32 zeroHash = oracle.zeroHashes(i);
preProof[i] = zeroHash;
postProof[i] = zeroHash;
}
LibKeccak.StateMatrix memory preMatrix = _stateMatrixAtBlockIndex(data, 2);
vm.expectRevert(StatesNotContiguous.selector);
oracle.challengeLPP({
_claimant: address(this),
_uuid: TEST_UUID,
_stateMatrix: preMatrix,
_preState: leaves[1],
_preStateProof: postProof,
_postState: leaves[0],
_postStateProof: preProof
});
}
/// @notice Tests that an invalid leaf can not be countered with an incorrect prestate matrix reveal.
function test_challenge_invalidPreimage_reverts() public {
// Allocate the preimage data.
bytes memory data = new bytes(136 * 2);
for (uint256 i; i < data.length; i++) {
data[i] = 0xFF;
}
bytes memory phonyData = new bytes(136 * 2);
for (uint256 i = 0; i < phonyData.length / 2; i++) {
data[i] = 0xFF;
}
// Initialize the proposal.
oracle.initLPP(TEST_UUID, 0, uint32(data.length));
// Add the leaves to the tree with mismatching state commitments.
LibKeccak.StateMatrix memory stateMatrix;
bytes32[] memory stateCommitments = _generateStateCommitments(stateMatrix, data);
oracle.addLeavesLPP(TEST_UUID, phonyData, stateCommitments, true);
// Construct the leaf preimage data for the blocks added.
LibKeccak.StateMatrix memory matrix;
PreimageOracle.Leaf[] memory leaves = _generateLeaves(matrix, phonyData);
leaves[0].stateCommitment = stateCommitments[0];
leaves[1].stateCommitment = stateCommitments[1];
leaves[2].stateCommitment = stateCommitments[2];
// Create a proof array with 16 elements.
bytes32[] memory preProof = new bytes32[](16);
preProof[0] = _hashLeaf(leaves[1]);
preProof[1] = keccak256(abi.encode(_hashLeaf(leaves[2]), bytes32(0)));
bytes32[] memory postProof = new bytes32[](16);
postProof[0] = _hashLeaf(leaves[0]);
postProof[1] = keccak256(abi.encode(_hashLeaf(leaves[2]), bytes32(0)));
for (uint256 i = 2; i < preProof.length; i++) {
bytes32 zeroHash = oracle.zeroHashes(i);
preProof[i] = zeroHash;
postProof[i] = zeroHash;
}
LibKeccak.StateMatrix memory preMatrix = _stateMatrixAtBlockIndex(data, 2);
vm.expectRevert(InvalidPreimage.selector);
oracle.challengeLPP({
_claimant: address(this),
_uuid: TEST_UUID,
_stateMatrix: preMatrix,
_preState: leaves[0],
_preStateProof: preProof,
_postState: leaves[1],
_postStateProof: postProof
});
}
/// @notice Tests that an invalid leaf can be countered with the `challenge` function in the middle of the tree.
function test_challenge_invalidCommitment_succeeds() public {
// Allocate the preimage data.
bytes memory data = new bytes(136 * 2);
for (uint256 i; i < data.length; i++) {
data[i] = 0xFF;
}
bytes memory phonyData = new bytes(136 * 2);
for (uint256 i = 0; i < phonyData.length / 2; i++) {
data[i] = 0xFF;
}
// Initialize the proposal.
oracle.initLPP(TEST_UUID, 0, uint32(data.length));
// Add the leaves to the tree with mismatching state commitments.
LibKeccak.StateMatrix memory stateMatrix;
bytes32[] memory stateCommitments = _generateStateCommitments(stateMatrix, data);
oracle.addLeavesLPP(TEST_UUID, phonyData, stateCommitments, true);
// Construct the leaf preimage data for the blocks added.
LibKeccak.StateMatrix memory matrix;
PreimageOracle.Leaf[] memory leaves = _generateLeaves(matrix, phonyData);
leaves[0].stateCommitment = stateCommitments[0];
leaves[1].stateCommitment = stateCommitments[1];
leaves[2].stateCommitment = stateCommitments[2];
// Create a proof array with 16 elements.
bytes32[] memory preProof = new bytes32[](16);
preProof[0] = _hashLeaf(leaves[1]);
preProof[1] = keccak256(abi.encode(_hashLeaf(leaves[2]), bytes32(0)));
bytes32[] memory postProof = new bytes32[](16);
postProof[0] = _hashLeaf(leaves[0]);
postProof[1] = keccak256(abi.encode(_hashLeaf(leaves[2]), bytes32(0)));
for (uint256 i = 2; i < preProof.length; i++) {
bytes32 zeroHash = oracle.zeroHashes(i);
preProof[i] = zeroHash;
postProof[i] = zeroHash;
}
LibKeccak.StateMatrix memory preMatrix = _stateMatrixAtBlockIndex(data, 1);
oracle.challengeLPP({
_claimant: address(this),
_uuid: TEST_UUID,
_stateMatrix: preMatrix,
_preState: leaves[0],
_preStateProof: preProof,
_postState: leaves[1],
_postStateProof: postProof
});
LPPMetaData metaData = oracle.proposalMetadata(address(this), TEST_UUID);
assertTrue(metaData.countered());
}
/// @notice Hashes leaf data for the preimage proposals tree
function _hashLeaf(PreimageOracle.Leaf memory _leaf) internal pure returns (bytes32 leaf_) {
leaf_ = keccak256(abi.encodePacked(_leaf.input, _leaf.index, _leaf.stateCommitment));
}
/// @notice Helper to construct the keccak merkle tree's leaves from a given input `_data`.
function _generateLeaves(
LibKeccak.StateMatrix memory _stateMatrix,
bytes memory _data
)
internal
pure
returns (PreimageOracle.Leaf[] memory leaves_)
{
bytes memory data = LibKeccak.padMemory(_data);
uint256 numLeaves = data.length / LibKeccak.BLOCK_SIZE_BYTES;
leaves_ = new PreimageOracle.Leaf[](numLeaves);
for (uint256 i = 0; i < numLeaves; i++) {
bytes memory blockSlice = Bytes.slice(data, i * LibKeccak.BLOCK_SIZE_BYTES, LibKeccak.BLOCK_SIZE_BYTES);
LibKeccak.absorb(_stateMatrix, blockSlice);
LibKeccak.permutation(_stateMatrix);
bytes32 stateCommitment = keccak256(abi.encode(_stateMatrix));
leaves_[i] = PreimageOracle.Leaf({ input: blockSlice, index: i, stateCommitment: stateCommitment });
}
}
/// @notice Helper to get the keccak state matrix before applying the block at `_blockIndex` within `_data`.
function _stateMatrixAtBlockIndex(
bytes memory _data,
uint256 _blockIndex
)
internal
pure
returns (LibKeccak.StateMatrix memory matrix_)
{
bytes memory data = LibKeccak.padMemory(_data);
for (uint256 i = 0; i < _blockIndex; i++) {
bytes memory blockSlice = Bytes.slice(data, i * LibKeccak.BLOCK_SIZE_BYTES, LibKeccak.BLOCK_SIZE_BYTES);
LibKeccak.absorb(matrix_, blockSlice);
LibKeccak.permutation(matrix_);
}
}
/// @notice Helper to construct the keccak state commitments for each block processed in the input `_data`.
function _generateStateCommitments(
LibKeccak.StateMatrix memory _stateMatrix,
bytes memory _data
)
internal
pure
returns (bytes32[] memory stateCommitments_)
{
bytes memory data = LibKeccak.padMemory(_data);
uint256 numCommitments = data.length / LibKeccak.BLOCK_SIZE_BYTES;
stateCommitments_ = new bytes32[](numCommitments);
for (uint256 i = 0; i < numCommitments; i++) {
bytes memory blockSlice = Bytes.slice(data, i * LibKeccak.BLOCK_SIZE_BYTES, LibKeccak.BLOCK_SIZE_BYTES);
LibKeccak.absorb(_stateMatrix, blockSlice);
LibKeccak.permutation(_stateMatrix);
stateCommitments_[i] = keccak256(abi.encode(_stateMatrix));
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment