smt-rollup
Version:
Sparse Merkle Tree roll up
831 lines (830 loc) • 119 kB
JSON
{
"contractName": "OptimisticSMTExample",
"abi": [
{
"inputs": [
{
"internalType": "bytes32",
"name": "prev",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "next",
"type": "bytes32"
},
{
"internalType": "bytes32",
"name": "mergedLeaves",
"type": "bytes32"
},
{
"internalType": "bytes32[]",
"name": "leaves",
"type": "bytes32[]"
}
],
"name": "propose",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "initProof",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "bytes32[]",
"name": "leaves",
"type": "bytes32[]"
},
{
"internalType": "bytes32[256][]",
"name": "siblings",
"type": "bytes32[256][]"
}
],
"name": "updateProof",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "verifyProposal",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
}
],
"metadata": "{\"compiler\":{\"version\":\"0.6.0+commit.26b70077\"},\"language\":\"Solidity\",\"output\":{\"abi\":[{\"inputs\":[],\"name\":\"initProof\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32\",\"name\":\"prev\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"next\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32\",\"name\":\"mergedLeaves\",\"type\":\"bytes32\"},{\"internalType\":\"bytes32[]\",\"name\":\"leaves\",\"type\":\"bytes32[]\"}],\"name\":\"propose\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"internalType\":\"bytes32[]\",\"name\":\"leaves\",\"type\":\"bytes32[]\"},{\"internalType\":\"bytes32[256][]\",\"name\":\"siblings\",\"type\":\"bytes32[256][]\"}],\"name\":\"updateProof\",\"outputs\":[],\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"name\":\"verifyProposal\",\"outputs\":[{\"internalType\":\"bool\",\"name\":\"\",\"type\":\"bool\"}],\"stateMutability\":\"view\",\"type\":\"function\"}],\"devdoc\":{\"methods\":{}},\"userdoc\":{\"methods\":{}}},\"settings\":{\"compilationTarget\":{\"/home/wanseob/Projects/wilsonbeam/smt-rollup/contracts/examples/OptimisticSMTExample.sol\":\"OptimisticSMTExample\"},\"evmVersion\":\"istanbul\",\"libraries\":{},\"metadata\":{\"bytecodeHash\":\"ipfs\"},\"optimizer\":{\"enabled\":false,\"runs\":200},\"remappings\":[]},\"sources\":{\"/home/wanseob/Projects/wilsonbeam/smt-rollup/contracts/SMT.sol\":{\"keccak256\":\"0x6da0de244d820286121a3dc7149968c8c6e449ac529e28c2c720247b5e4635c5\",\"urls\":[\"bzz-raw://4e3adc3a46b1974a95a58dc7a7b7ef09eb33a4b07e23091c73dd98fef92b8e63\",\"dweb:/ipfs/QmZ21CJPA6utrtUMoL4esHmFa2hAEQFE5eFjqjN4e9ikBh\"]},\"/home/wanseob/Projects/wilsonbeam/smt-rollup/contracts/examples/OptimisticSMTExample.sol\":{\"keccak256\":\"0x918f0581aa572789c8d6e65d794e0e1646274d5c3a79ec07ae93c0ac52e7b2bd\",\"urls\":[\"bzz-raw://4a985e631d21eaa3614c7daf435561b8180bdc211032069cb49849913be3e041\",\"dweb:/ipfs/QmS8db2ajwAUxPNkEpe4WzUEmRL5zg8UUcpiD3fFHAuVHc\"]}},\"version\":1}",
"bytecode": "0x608060405234801561001057600080fd5b50610a9c806100206000396000f3fe608060405234801561001057600080fd5b506004361061004c5760003560e01c806366760d7d1461005157806367d4862714610073578063a68b404314610149578063e6ad6f95146102d5575b600080fd5b6100596102df565b604051808215151515815260200191505060405180910390f35b6101476004803603608081101561008957600080fd5b81019080803590602001909291908035906020019092919080359060200190929190803590602001906401000000008111156100c457600080fd5b8201836020820111156100d657600080fd5b803590602001918460208302840111640100000000831117156100f857600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929050505061033c565b005b6102d36004803603604081101561015f57600080fd5b810190808035906020019064010000000081111561017c57600080fd5b82018360208201111561018e57600080fd5b803590602001918460208302840111640100000000831117156101b057600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561021057600080fd5b82018360208201111561022257600080fd5b803590602001918461200083028401116401000000008311171561024557600080fd5b9190808060200260200160405190810160405280939291908181526020016000905b828210156102c1578484839050612000020161010080602002604051908101604052809291908261010060200280828437600081840152601f19601f82011690508083019250505050505081526020019060010190610267565b505050505091929192905050506103fb565b005b6102dd610415565b005b60006103376000800160000154600080016001015460008001600201546004604051806060016040529081600082015481526020016001820154815260200160028201548152505061044a909392919063ffffffff16565b905090565b604051806040016040528060405180606001604052808781526020018681526020018581525081526020013373ffffffffffffffffffffffffffffffffffffffff1681525060008082015181600001600082015181600001556020820151816001015560408201518160020155505060208201518160030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555090505050505050565b6104118282600461054f9092919063ffffffff16565b5050565b6104256000800160000154610581565b6004600082015181600001556020820151816001015560408201518160020155905050565b6000838560000151146104c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f53746172746564207769746820646966666572656e7420726f6f74000000000081525060200191505060405180910390fd5b8185604001511461053e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f417070656e64656420646966666572656e74206c65617665730000000000000081525060200191505060405180910390fd5b828560200151149050949350505050565b61055e836001015483836105af565b83600101819055506105748360020154836105dd565b8360020181905550505050565b6105896109d9565b81816000018181525050818160200181815250506000801b816040018181525050919050565b60006105d4604051806060016040528086815260200185815260200184815250610649565b90509392505050565b600082905060008090505b825181101561064257818382815181106105fe57fe5b6020026020010151604051602001808381526020018281526020019250505060405160208183030381529060405280519060200120915080806001019150506105e8565b5092915050565b6000816040015151826020015151146106ad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180610a456022913960400191505060405180910390fd5b60008260000151905060008090505b8360200151518110156107115761070282856020015183815181106106dd57fe5b6020026020010151866040015184815181106106f557fe5b602002602001015161071b565b915080806001019150506106bc565b5080915050919050565b600061072884848461082a565b61077d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526041815260200180610a046041913960600191505060405180910390fd5b6107ab837fb0b4e07bb5592f3d3821b2c1331b436763d7be555cf452d6c6836f74d5201e8560001b84610864565b905080841415610823576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f416c726561647920657869736974696e67206c6561660000000000000000000081525060200191505060405180910390fd5b9392505050565b600061085b84847f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56360001b8561094c565b90509392505050565b60008083905060008560001c905060008090505b6101008161ffff16101561093f5760006002838161089257fe5b0614156108e45782858261ffff1661010081106108ab57fe5b6020020151604051602001808381526020018281526020019250505060405160208183030381529060405280519060200120925061092b565b848161ffff1661010081106108f557fe5b60200201518360405160200180838152602001828152602001925050506040516020818303038152906040528051906020012092505b600182901c91508080600101915050610878565b5081925050509392505050565b60008461095a858585610864565b146109cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f496e76616c6964206d65726b6c652070726f6f6600000000000000000000000081525060200191505060405180910390fd5b60019050949350505050565b6040518060600160405280600080191681526020016000801916815260200160008019168152509056fe4661696c656420746f206275696c64207468652070726576696f757320726f6f74207573696e67206a746865206c65616620616e6420697473207369626c696e67426f74682061727261792073686f756c6420686176652073616d65206c656e677468a26469706673582212206e54ce892d4e3621fdafc0dd1278c50896d321ebb5d55e258d06bb494b55a74964736f6c63430006000033",
"deployedBytecode": "0x608060405234801561001057600080fd5b506004361061004c5760003560e01c806366760d7d1461005157806367d4862714610073578063a68b404314610149578063e6ad6f95146102d5575b600080fd5b6100596102df565b604051808215151515815260200191505060405180910390f35b6101476004803603608081101561008957600080fd5b81019080803590602001909291908035906020019092919080359060200190929190803590602001906401000000008111156100c457600080fd5b8201836020820111156100d657600080fd5b803590602001918460208302840111640100000000831117156100f857600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f82011690508083019250505050505050919291929050505061033c565b005b6102d36004803603604081101561015f57600080fd5b810190808035906020019064010000000081111561017c57600080fd5b82018360208201111561018e57600080fd5b803590602001918460208302840111640100000000831117156101b057600080fd5b919080806020026020016040519081016040528093929190818152602001838360200280828437600081840152601f19601f8201169050808301925050505050505091929192908035906020019064010000000081111561021057600080fd5b82018360208201111561022257600080fd5b803590602001918461200083028401116401000000008311171561024557600080fd5b9190808060200260200160405190810160405280939291908181526020016000905b828210156102c1578484839050612000020161010080602002604051908101604052809291908261010060200280828437600081840152601f19601f82011690508083019250505050505081526020019060010190610267565b505050505091929192905050506103fb565b005b6102dd610415565b005b60006103376000800160000154600080016001015460008001600201546004604051806060016040529081600082015481526020016001820154815260200160028201548152505061044a909392919063ffffffff16565b905090565b604051806040016040528060405180606001604052808781526020018681526020018581525081526020013373ffffffffffffffffffffffffffffffffffffffff1681525060008082015181600001600082015181600001556020820151816001015560408201518160020155505060208201518160030160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555090505050505050565b6104118282600461054f9092919063ffffffff16565b5050565b6104256000800160000154610581565b6004600082015181600001556020820151816001015560408201518160020155905050565b6000838560000151146104c5576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f53746172746564207769746820646966666572656e7420726f6f74000000000081525060200191505060405180910390fd5b8185604001511461053e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f417070656e64656420646966666572656e74206c65617665730000000000000081525060200191505060405180910390fd5b828560200151149050949350505050565b61055e836001015483836105af565b83600101819055506105748360020154836105dd565b8360020181905550505050565b6105896109d9565b81816000018181525050818160200181815250506000801b816040018181525050919050565b60006105d4604051806060016040528086815260200185815260200184815250610649565b90509392505050565b600082905060008090505b825181101561064257818382815181106105fe57fe5b6020026020010151604051602001808381526020018281526020019250505060405160208183030381529060405280519060200120915080806001019150506105e8565b5092915050565b6000816040015151826020015151146106ad576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526022815260200180610a456022913960400191505060405180910390fd5b60008260000151905060008090505b8360200151518110156107115761070282856020015183815181106106dd57fe5b6020026020010151866040015184815181106106f557fe5b602002602001015161071b565b915080806001019150506106bc565b5080915050919050565b600061072884848461082a565b61077d576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401808060200182810382526041815260200180610a046041913960600191505060405180910390fd5b6107ab837fb0b4e07bb5592f3d3821b2c1331b436763d7be555cf452d6c6836f74d5201e8560001b84610864565b905080841415610823576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260168152602001807f416c726561647920657869736974696e67206c6561660000000000000000000081525060200191505060405180910390fd5b9392505050565b600061085b84847f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56360001b8561094c565b90509392505050565b60008083905060008560001c905060008090505b6101008161ffff16101561093f5760006002838161089257fe5b0614156108e45782858261ffff1661010081106108ab57fe5b6020020151604051602001808381526020018281526020019250505060405160208183030381529060405280519060200120925061092b565b848161ffff1661010081106108f557fe5b60200201518360405160200180838152602001828152602001925050506040516020818303038152906040528051906020012092505b600182901c91508080600101915050610878565b5081925050509392505050565b60008461095a858585610864565b146109cd576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260148152602001807f496e76616c6964206d65726b6c652070726f6f6600000000000000000000000081525060200191505060405180910390fd5b60019050949350505050565b6040518060600160405280600080191681526020016000801916815260200160008019168152509056fe4661696c656420746f206275696c64207468652070726576696f757320726f6f74207573696e67206a746865206c65616620616e6420697473207369626c696e67426f74682061727261792073686f756c6420686176652073616d65206c656e677468a26469706673582212206e54ce892d4e3621fdafc0dd1278c50896d321ebb5d55e258d06bb494b55a74964736f6c63430006000033",
"sourceMap": "65:985:2:-:0;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;65:985:2;;;;;;;",
"deployedSourceMap": "65:985:2:-:0;;;;8:9:-1;5:2;;;30:1;27;20:12;5:2;65:985:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;845:203;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;254:354;;;;;;13:3:-1;8;5:12;2:2;;;30:1;27;20:12;2:2;254:354:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;254:354:2;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;254:354:2;;;;;;101:9:-1;95:2;81:12;77:21;67:8;63:36;60:51;39:11;25:12;22:29;11:108;8:2;;;132:1;129;122:12;8:2;254:354:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;254:354:2;;;;;;;;;;;;;;;:::i;:::-;;707:132;;;;;;13:2:-1;8:3;5:11;2:2;;;29:1;26;19:12;2:2;707:132:2;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;707:132:2;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;707:132:2;;;;;;101:9:-1;95:2;81:12;77:21;67:8;63:36;60:51;39:11;25:12;22:29;11:108;8:2;;;132:1;129;122:12;8:2;707:132:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;707:132:2;;;;;;;;;;;;;;;;;21:11:-1;8;5:28;2:2;;;46:1;43;36:12;2:2;707:132:2;;35:9:-1;28:4;12:14;8:25;5:40;2:2;;;58:1;55;48:12;2:2;707:132:2;;;;;;103:9:-1;95:4;81:12;77:23;67:8;63:38;60:53;39:11;25:12;22:29;11:110;8:2;;;134:1;131;124:12;8:2;707:132:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;30:3:-1;22:6;14;1:33;99:1;93:3;85:6;81:16;74:27;137:4;133:9;126:4;121:3;117:14;113:30;106:37;;169:3;161:6;157:16;147:26;;707:132:2;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::i;:::-;;614:87;;;:::i;:::-;;845:203;892:4;915:126;941:8;:13;;:18;;;973:8;:13;;:18;;;1005:8;:13;;:26;;;915:5;:12;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:126;;;;;;:::i;:::-;908:133;;845:203;:::o;254:354::-;542:59;;;;;;;;551:37;;;;;;;;563:4;551:37;;;;569:4;551:37;;;;575:12;551:37;;;542:59;;;;590:10;542:59;;;;;531:8;:70;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;254:354;;;;:::o;707:132::-;802:30;815:6;823:8;802:5;:12;;:30;;;;;:::i;:::-;707:132;;:::o;614:87::-;660:34;675:8;:13;;:18;;;660:14;:34::i;:::-;652:5;:42;;;;;;;;;;;;;;;;;;;;;;;;;;;614:87::o;4292:340:1:-;4437:4;4474;4461;:9;;;:17;4453:57;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4549:12;4528:4;:17;;;:33;4520:71;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4621:4;4608;:9;;;:17;4601:24;;4292:340;;;;;;:::o;4029:257::-;4182:35;4189:4;:9;;;4200:6;4208:8;4182:6;:35::i;:::-;4170:4;:9;;:47;;;;4247:32;4253:4;:17;;;4272:6;4247:5;:32::i;:::-;4227:4;:17;;:52;;;;4029:257;;;:::o;3828:195::-;3890:16;;:::i;:::-;3930:12;3918:4;:9;;:24;;;;;3964:12;3952:4;:9;;:24;;;;;4014:1;4006:10;;3986:4;:17;;:30;;;;;3828:195;;;:::o;3291:224::-;3431:16;3470:38;3477:30;;;;;;;;3484:4;3477:30;;;;3490:6;3477:30;;;;3498:8;3477:30;;;3470:6;:38::i;:::-;3459:49;;3291:224;;;;;:::o;4638:298::-;4737:20;4784:4;4769:19;;4802:6;4811:1;4802:10;;4798:132;4818:6;:13;4814:1;:17;4798:132;;;4894:12;4908:6;4915:1;4908:9;;;;;;;;;;;;;;4877:41;;;;;;;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;4877:41:1;;;4867:52;;;;;;4852:67;;4833:3;;;;;;;4798:132;;;;4638:298;;;;:::o;2795:490::-;2855:7;2945:5;:14;;;:21;2922:5;:12;;;:19;:44;2914:91;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;3046:12;3061:5;:10;;;3046:25;;3135:6;3144:1;3135:10;;3130:128;3151:5;:12;;;:19;3147:1;:23;3130:128;;;3199:48;3206:4;3212:5;:12;;;3225:1;3212:15;;;;;;;;;;;;;;3229:5;:14;;;3244:1;3229:17;;;;;;;;;;;;;;3199:6;:48::i;:::-;3192:55;;3172:4;;;;;;;3130:128;;;;3274:4;3267:11;;;2795:490;;;:::o;2173:616::-;2300:16;2433:39;2451:4;2457;2463:8;2433:17;:39::i;:::-;2425:117;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2644:36;2658:4;361:66;2664:5;;2671:8;2644:13;:36::i;:::-;2633:47;;2747:8;2739:4;:16;;2731:51;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;2173:616;;;;;:::o;1053:211::-;1190:4;1213:44;1225:4;1231;563:66;1237:9;;1248:8;1213:11;:44::i;:::-;1206:51;;1053:211;;;;;:::o;1551:616::-;1686:7;1705:14;1722:5;1705:22;;1737:9;1754:4;1749:10;;1737:22;;1774:8;1785:1;1774:12;;1769:369;1792:15;1788:1;:19;;;1769:369;;;1844:1;1839;1832:4;:8;;;;;;:13;1828:270;;;1934:6;1942:8;1951:1;1942:11;;;;;;;;;;;;;1917:37;;;;;;;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;1917:37:1;;;1907:48;;;;;;1898:57;;1828:270;;;2062:8;2071:1;2062:11;;;;;;;;;;;;;2075:6;2045:37;;;;;;;;;;;;;;;;;;;;;49:4:-1;39:7;30;26:21;22:32;13:7;6:49;2045:37:1;;;2035:48;;;;;;2026:57;;1828:270;2126:1;2118:4;:9;;2111:16;;1809:3;;;;;;;1769:369;;;;2154:6;2147:13;;;;1551:616;;;;;:::o;1270:275::-;1424:4;1488;1448:36;1462:4;1468:5;1475:8;1448:13;:36::i;:::-;:44;1440:77;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;1534:4;1527:11;;1270:275;;;;;;:::o;65:985:2:-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;:::o",
"source": "pragma solidity >= 0.6.0;\n\nimport { SMT256 } from \"../SMT.sol\";\n\ncontract OptimisticSMTExample {\n using SMT256 for *;\n\n struct Proposal {\n SMT256.OPRU opru;\n address proposer;\n }\n\n Proposal proposal;\n SMT256.OPRU proof;\n\n function propose(bytes32 prev, bytes32 next, bytes32 mergedLeaves, bytes32[] memory leaves) public {\n /// Propose an optimistic roll up without any calculation\n /// Challenge system can enforce to include correct leaves. SMT256.merge(bytes32(0), leaves);\n proposal = Proposal(SMT256.OPRU(prev, next, mergedLeaves), msg.sender);\n }\n\n function initProof() public {\n proof = SMT256.newOPRU(proposal.opru.prev);\n }\n\n function updateProof(bytes32[] memory leaves, bytes32[256][] memory siblings) public {\n proof.update(leaves, siblings);\n }\n\n function verifyProposal() public view returns (bool) {\n return proof.verify(\n proposal.opru.prev,\n proposal.opru.next,\n proposal.opru.mergedLeaves\n );\n }\n}",
"sourcePath": "/home/wanseob/Projects/wilsonbeam/smt-rollup/contracts/examples/OptimisticSMTExample.sol",
"ast": {
"absolutePath": "/home/wanseob/Projects/wilsonbeam/smt-rollup/contracts/examples/OptimisticSMTExample.sol",
"exportedSymbols": {
"OptimisticSMTExample": [
615
]
},
"id": 616,
"nodeType": "SourceUnit",
"nodes": [
{
"id": 524,
"literals": [
"solidity",
">=",
"0.6",
".0"
],
"nodeType": "PragmaDirective",
"src": "0:25:2"
},
{
"absolutePath": "/home/wanseob/Projects/wilsonbeam/smt-rollup/contracts/SMT.sol",
"file": "../SMT.sol",
"id": 526,
"nodeType": "ImportDirective",
"scope": 616,
"sourceUnit": 523,
"src": "27:36:2",
"symbolAliases": [
{
"foreign": {
"argumentTypes": null,
"id": 525,
"name": "SMT256",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": null,
"src": "36:6:2",
"typeDescriptions": {
"typeIdentifier": null,
"typeString": null
}
},
"local": null
}
],
"unitAlias": ""
},
{
"abstract": false,
"baseContracts": [],
"contractDependencies": [],
"contractKind": "contract",
"documentation": null,
"fullyImplemented": true,
"id": 615,
"linearizedBaseContracts": [
615
],
"name": "OptimisticSMTExample",
"nodeType": "ContractDefinition",
"nodes": [
{
"id": 528,
"libraryName": {
"contractScope": null,
"id": 527,
"name": "SMT256",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 522,
"src": "107:6:2",
"typeDescriptions": {
"typeIdentifier": "t_contract$_SMT256_$522",
"typeString": "library SMT256"
}
},
"nodeType": "UsingForDirective",
"src": "101:19:2",
"typeName": null
},
{
"canonicalName": "OptimisticSMTExample.Proposal",
"id": 533,
"members": [
{
"constant": false,
"id": 530,
"name": "opru",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 533,
"src": "152:16:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_struct$_OPRU_$84_storage_ptr",
"typeString": "struct SMT256.OPRU"
},
"typeName": {
"contractScope": null,
"id": 529,
"name": "SMT256.OPRU",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 84,
"src": "152:11:2",
"typeDescriptions": {
"typeIdentifier": "t_struct$_OPRU_$84_storage_ptr",
"typeString": "struct SMT256.OPRU"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 532,
"name": "proposer",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 533,
"src": "178:16:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
},
"typeName": {
"id": 531,
"name": "address",
"nodeType": "ElementaryTypeName",
"src": "178:7:2",
"stateMutability": "nonpayable",
"typeDescriptions": {
"typeIdentifier": "t_address",
"typeString": "address"
}
},
"value": null,
"visibility": "internal"
}
],
"name": "Proposal",
"nodeType": "StructDefinition",
"scope": 615,
"src": "126:75:2",
"visibility": "public"
},
{
"constant": false,
"id": 535,
"name": "proposal",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 615,
"src": "207:17:2",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Proposal_$533_storage",
"typeString": "struct OptimisticSMTExample.Proposal"
},
"typeName": {
"contractScope": null,
"id": 534,
"name": "Proposal",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 533,
"src": "207:8:2",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Proposal_$533_storage_ptr",
"typeString": "struct OptimisticSMTExample.Proposal"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 537,
"name": "proof",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 615,
"src": "230:17:2",
"stateVariable": true,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_struct$_OPRU_$84_storage",
"typeString": "struct SMT256.OPRU"
},
"typeName": {
"contractScope": null,
"id": 536,
"name": "SMT256.OPRU",
"nodeType": "UserDefinedTypeName",
"referencedDeclaration": 84,
"src": "230:11:2",
"typeDescriptions": {
"typeIdentifier": "t_struct$_OPRU_$84_storage_ptr",
"typeString": "struct SMT256.OPRU"
}
},
"value": null,
"visibility": "internal"
},
{
"body": {
"id": 562,
"nodeType": "Block",
"src": "353:255:2",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 560,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 549,
"name": "proposal",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 535,
"src": "531:8:2",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Proposal_$533_storage",
"typeString": "struct OptimisticSMTExample.Proposal storage ref"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 553,
"name": "prev",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 539,
"src": "563:4:2",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"argumentTypes": null,
"id": 554,
"name": "next",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 541,
"src": "569:4:2",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
{
"argumentTypes": null,
"id": 555,
"name": "mergedLeaves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 543,
"src": "575:12:2",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
],
"expression": {
"argumentTypes": null,
"id": 551,
"name": "SMT256",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 522,
"src": "551:6:2",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_SMT256_$522_$",
"typeString": "type(library SMT256)"
}
},
"id": 552,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "OPRU",
"nodeType": "MemberAccess",
"referencedDeclaration": 84,
"src": "551:11:2",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_struct$_OPRU_$84_storage_ptr_$",
"typeString": "type(struct SMT256.OPRU storage pointer)"
}
},
"id": 556,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "structConstructorCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "551:37:2",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_struct$_OPRU_$84_memory",
"typeString": "struct SMT256.OPRU memory"
}
},
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 557,
"name": "msg",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 747,
"src": "590:3:2",
"typeDescriptions": {
"typeIdentifier": "t_magic_message",
"typeString": "msg"
}
},
"id": 558,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "sender",
"nodeType": "MemberAccess",
"referencedDeclaration": null,
"src": "590:10:2",
"typeDescriptions": {
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_struct$_OPRU_$84_memory",
"typeString": "struct SMT256.OPRU memory"
},
{
"typeIdentifier": "t_address_payable",
"typeString": "address payable"
}
],
"id": 550,
"name": "Proposal",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 533,
"src": "542:8:2",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_struct$_Proposal_$533_storage_ptr_$",
"typeString": "type(struct OptimisticSMTExample.Proposal storage pointer)"
}
},
"id": 559,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "structConstructorCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "542:59:2",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_struct$_Proposal_$533_memory",
"typeString": "struct OptimisticSMTExample.Proposal memory"
}
},
"src": "531:70:2",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Proposal_$533_storage",
"typeString": "struct OptimisticSMTExample.Proposal storage ref"
}
},
"id": 561,
"nodeType": "ExpressionStatement",
"src": "531:70:2"
}
]
},
"documentation": null,
"functionSelector": "67d48627",
"id": 563,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "propose",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 547,
"nodeType": "ParameterList",
"parameters": [
{
"constant": false,
"id": 539,
"name": "prev",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 563,
"src": "271:12:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 538,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "271:7:2",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 541,
"name": "next",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 563,
"src": "285:12:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 540,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "285:7:2",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 543,
"name": "mergedLeaves",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 563,
"src": "299:20:2",
"stateVariable": false,
"storageLocation": "default",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
},
"typeName": {
"id": 542,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "299:7:2",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"value": null,
"visibility": "internal"
},
{
"constant": false,
"id": 546,
"name": "leaves",
"nodeType": "VariableDeclaration",
"overrides": null,
"scope": 563,
"src": "321:23:2",
"stateVariable": false,
"storageLocation": "memory",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_memory_ptr",
"typeString": "bytes32[]"
},
"typeName": {
"baseType": {
"id": 544,
"name": "bytes32",
"nodeType": "ElementaryTypeName",
"src": "321:7:2",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
},
"id": 545,
"length": null,
"nodeType": "ArrayTypeName",
"src": "321:9:2",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_storage_ptr",
"typeString": "bytes32[]"
}
},
"value": null,
"visibility": "internal"
}
],
"src": "270:75:2"
},
"returnParameters": {
"id": 548,
"nodeType": "ParameterList",
"parameters": [],
"src": "353:0:2"
},
"scope": 615,
"src": "254:354:2",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
},
{
"body": {
"id": 575,
"nodeType": "Block",
"src": "642:59:2",
"statements": [
{
"expression": {
"argumentTypes": null,
"id": 573,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"leftHandSide": {
"argumentTypes": null,
"id": 566,
"name": "proof",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 537,
"src": "652:5:2",
"typeDescriptions": {
"typeIdentifier": "t_struct$_OPRU_$84_storage",
"typeString": "struct SMT256.OPRU storage ref"
}
},
"nodeType": "Assignment",
"operator": "=",
"rightHandSide": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"expression": {
"argumentTypes": null,
"id": 569,
"name": "proposal",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 535,
"src": "675:8:2",
"typeDescriptions": {
"typeIdentifier": "t_struct$_Proposal_$533_storage",
"typeString": "struct OptimisticSMTExample.Proposal storage ref"
}
},
"id": 570,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "opru",
"nodeType": "MemberAccess",
"referencedDeclaration": 530,
"src": "675:13:2",
"typeDescriptions": {
"typeIdentifier": "t_struct$_OPRU_$84_storage",
"typeString": "struct SMT256.OPRU storage ref"
}
},
"id": 571,
"isConstant": false,
"isLValue": true,
"isPure": false,
"lValueRequested": false,
"memberName": "prev",
"nodeType": "MemberAccess",
"referencedDeclaration": 79,
"src": "675:18:2",
"typeDescriptions": {
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
}
],
"expression": {
"argumentTypes": [
{
"typeIdentifier": "t_bytes32",
"typeString": "bytes32"
}
],
"expression": {
"argumentTypes": null,
"id": 567,
"name": "SMT256",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 522,
"src": "660:6:2",
"typeDescriptions": {
"typeIdentifier": "t_type$_t_contract$_SMT256_$522_$",
"typeString": "type(library SMT256)"
}
},
"id": 568,
"isConstant": false,
"isLValue": false,
"isPure": false,
"lValueRequested": false,
"memberName": "newOPRU",
"nodeType": "MemberAccess",
"referencedDeclaration": 411,
"src": "660:14:2",
"typeDescriptions": {
"typeIdentifier": "t_function_internal_pure$_t_bytes32_$returns$_t_struct$_OPRU_$84_memory_ptr_$",
"typeString": "function (bytes32) pure returns (struct SMT256.OPRU memory)"
}
},
"id": 572,
"isConstant": false,
"isLValue": false,
"isPure": false,
"kind": "functionCall",
"lValueRequested": false,
"names": [],
"nodeType": "FunctionCall",
"src": "660:34:2",
"tryCall": false,
"typeDescriptions": {
"typeIdentifier": "t_struct$_OPRU_$84_memory_ptr",
"typeString": "struct SMT256.OPRU memory"
}
},
"src": "652:42:2",
"typeDescriptions": {
"typeIdentifier": "t_struct$_OPRU_$84_storage",
"typeString": "struct SMT256.OPRU storage ref"
}
},
"id": 574,
"nodeType": "ExpressionStatement",
"src": "652:42:2"
}
]
},
"documentation": null,
"functionSelector": "e6ad6f95",
"id": 576,
"implemented": true,
"kind": "function",
"modifiers": [],
"name": "initProof",
"nodeType": "FunctionDefinition",
"overrides": null,
"parameters": {
"id": 564,
"nodeType": "ParameterList",
"parameters": [],
"src": "632:2:2"
},
"returnParameters": {
"id": 565,
"nodeType": "ParameterList",
"parameters": [],
"src": "642:0:2"
},
"scope": 615,
"src": "614:87:2",
"stateMutability": "nonpayable",
"virtual": false,
"visibility": "public"
},
{
"body": {
"id": 594,
"nodeType": "Block",
"src": "792:47:2",
"statements": [
{
"expression": {
"argumentTypes": null,
"arguments": [
{
"argumentTypes": null,
"id": 590,
"name": "leaves",
"nodeType": "Identifier",
"overloadedDeclarations": [],
"referencedDeclaration": 579,
"src": "815:6:2",
"typeDescriptions": {
"typeIdentifier": "t_array$_t_bytes32_$dyn_memory_ptr",
"typeString": "bytes32[] memory"
}
},