diff --git a/sharding/contracts/sharding_manager.go b/sharding/contracts/sharding_manager.go index b68e7f480..3c147f0ba 100644 --- a/sharding/contracts/sharding_manager.go +++ b/sharding/contracts/sharding_manager.go @@ -16,10 +16,10 @@ import ( ) // SMCABI is the input ABI used to generate the binding from. -const SMCABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"currentVote\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_shardId\",\"type\":\"uint256\"},{\"name\":\"_period\",\"type\":\"uint256\"},{\"name\":\"_index\",\"type\":\"uint256\"},{\"name\":\"_chunkRoot\",\"type\":\"bytes32\"}],\"name\":\"submitVote\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"deregisterNotary\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_shardId\",\"type\":\"uint256\"},{\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"hasVoted\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"registerNotary\",\"outputs\":[],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"}],\"name\":\"notaryRegistry\",\"outputs\":[{\"name\":\"deregisteredPeriod\",\"type\":\"uint256\"},{\"name\":\"poolIndex\",\"type\":\"uint256\"},{\"name\":\"deposited\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_shardId\",\"type\":\"uint256\"},{\"name\":\"_period\",\"type\":\"uint256\"},{\"name\":\"_chunkRoot\",\"type\":\"bytes32\"}],\"name\":\"addHeader\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"lastSubmittedCollation\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"lastApprovedCollation\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"releaseNotary\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"notaryPool\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_shardId\",\"type\":\"uint256\"},{\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getNotaryInCommittee\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_shardId\",\"type\":\"uint256\"}],\"name\":\"getVoteCount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"},{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"collationRecords\",\"outputs\":[{\"name\":\"chunkRoot\",\"type\":\"bytes32\"},{\"name\":\"proposer\",\"type\":\"address\"},{\"name\":\"isElected\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"notaryPoolLength\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"shardId\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"chunkRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"proposerAddress\",\"type\":\"address\"}],\"name\":\"HeaderAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"notary\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"poolIndex\",\"type\":\"uint256\"}],\"name\":\"NotaryRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"notary\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"poolIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"deregisteredPeriod\",\"type\":\"uint256\"}],\"name\":\"NotaryDeregistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"notary\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"poolIndex\",\"type\":\"uint256\"}],\"name\":\"NotaryReleased\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"shardId\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"chunkRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"notaryAddress\",\"type\":\"address\"}],\"name\":\"VoteSubmitted\",\"type\":\"event\"}]" +const SMCABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"currentVote\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_shardId\",\"type\":\"uint256\"},{\"name\":\"_period\",\"type\":\"uint256\"},{\"name\":\"_index\",\"type\":\"uint256\"},{\"name\":\"_chunkRoot\",\"type\":\"bytes32\"}],\"name\":\"submitVote\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"deregisterNotary\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_shardId\",\"type\":\"uint256\"},{\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"hasVoted\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"registerNotary\",\"outputs\":[],\"payable\":true,\"stateMutability\":\"payable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"address\"}],\"name\":\"notaryRegistry\",\"outputs\":[{\"name\":\"deregisteredPeriod\",\"type\":\"uint256\"},{\"name\":\"poolIndex\",\"type\":\"uint256\"},{\"name\":\"balance\",\"type\":\"uint256\"},{\"name\":\"deposited\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"_shardId\",\"type\":\"uint256\"},{\"name\":\"_period\",\"type\":\"uint256\"},{\"name\":\"_chunkRoot\",\"type\":\"bytes32\"}],\"name\":\"addHeader\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"lastSubmittedCollation\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"lastApprovedCollation\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"releaseNotary\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"notaryPool\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_shardId\",\"type\":\"uint256\"},{\"name\":\"_index\",\"type\":\"uint256\"}],\"name\":\"getNotaryInCommittee\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"_shardId\",\"type\":\"uint256\"}],\"name\":\"getVoteCount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"},{\"name\":\"\",\"type\":\"uint256\"}],\"name\":\"collationRecords\",\"outputs\":[{\"name\":\"chunkRoot\",\"type\":\"bytes32\"},{\"name\":\"proposer\",\"type\":\"address\"},{\"name\":\"isElected\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"notaryPoolLength\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"shardId\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"chunkRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"proposerAddress\",\"type\":\"address\"}],\"name\":\"HeaderAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"notary\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"poolIndex\",\"type\":\"uint256\"}],\"name\":\"NotaryRegistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"notary\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"poolIndex\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"deregisteredPeriod\",\"type\":\"uint256\"}],\"name\":\"NotaryDeregistered\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"notary\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"poolIndex\",\"type\":\"uint256\"}],\"name\":\"NotaryReleased\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"shardId\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"chunkRoot\",\"type\":\"bytes32\"},{\"indexed\":false,\"name\":\"period\",\"type\":\"uint256\"},{\"indexed\":false,\"name\":\"notaryAddress\",\"type\":\"address\"}],\"name\":\"VoteSubmitted\",\"type\":\"event\"}]" // SMCBin is the compiled bytecode used for deploying new contracts. -const SMCBin = `0x608060405234801561001057600080fd5b50610ca0806100206000396000f3006080604052600436106100da5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630c8da4cc81146100df5780634f33ffa01461010957806358377bd11461012c57806364390ff11461014157806368e9513e146101705780636bdd32711461017857806375bd9912146101b957806383ceeabe146101d757806397d369a2146101ef5780639910851d14610207578063a81f45101461021c578063b09f427e14610250578063b2c2f2e81461026b578063e9e0b68314610283578063f6f67d36146102c6575b600080fd5b3480156100eb57600080fd5b506100f76004356102db565b60408051918252519081900360200190f35b34801561011557600080fd5b5061012a6004356024356044356064356102ed565b005b34801561013857600080fd5b5061012a610493565b34801561014d57600080fd5b5061015c6004356024356105be565b604080519115158252519081900360200190f35b61012a6105e1565b34801561018457600080fd5b50610199600160a060020a0360043516610790565b604080519384526020840192909252151582820152519081900360600190f35b3480156101c557600080fd5b5061012a6004356024356044356107b3565b3480156101e357600080fd5b506100f7600435610905565b3480156101fb57600080fd5b506100f7600435610917565b34801561021357600080fd5b5061012a610929565b34801561022857600080fd5b50610234600435610a55565b60408051600160a060020a039092168252519081900360200190f35b34801561025c57600080fd5b50610234600435602435610a7d565b34801561027757600080fd5b506100f7600435610b12565b34801561028f57600080fd5b5061029e600435602435610b27565b60408051938452600160a060020a039092166020840152151582820152519081900360600190f35b3480156102d257600080fd5b506100f7610b71565b60036020526000908152604090205481565b60008085101580156102ff5750606485105b151561030a57600080fd5b60054304841461031957600080fd5b600085815260056020526040902054841461033357600080fd5b6087831061034057600080fd5b6000858152600460209081526040808320878452909152902054821461036557600080fd5b600160a060020a03331660009081526001602052604090206002015460ff16151561038f57600080fd5b61039985846105be565b156103a357600080fd5b33600160a060020a03166103b78685610a7d565b600160a060020a0316146103ca57600080fd5b6103d48584610b77565b6103dd85610b12565b9050605a8110610441576000858152600660209081526040808320879055600482528083208784529091529020600101805474ff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000001790555b6040805183815260208101869052600160a060020a03331681830152905186917fc99370212b708f699fb6945a17eb34d0fc1ccd5b45d88f4d9682593a45d6e833919081900360600190a25050505050565b33600160a060020a038116600090815260016020819052604082209081015460029091015490919060ff1615156104c957600080fd5b82600160a060020a03166000838154811015156104e257fe5b600091825260209091200154600160a060020a03161461050157600080fd5b610509610b9b565b50600160a060020a0382166000908152600160205260409020600543049081905561053382610bbe565b600080548390811061054157fe5b600091825260209182902001805473ffffffffffffffffffffffffffffffffffffffff191690556002805460001901905560408051600160a060020a0386168152918201849052818101839052517f90e5afdc8fd31453dcf6e37154fa117ddf3b0324c96c65015563df9d5e4b5a759181900360600190a1505050565b60009182526003602052604090912054600160ff9290920360020a900481161490565b33600160a060020a03811660009081526001602052604081206002015460ff161561060b57600080fd5b34683635c9adc5dea000001461062057600080fd5b610628610b9b565b610630610c2f565b156106935750600254600080546001810182559080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56301805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384161790556106dc565b61069b610c36565b9050816000828154811015156106ad57fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a031602179055505b60028054600190810182556040805160608101825260008082526020808301878152838501868152600160a060020a038a168452918690529390912091518255915192810192909255519101805460ff1916911515919091179055600a5481106107485760018101600a555b60408051600160a060020a03841681526020810183905281517fa4fe15c53db34d35a5117acc26c27a2653dc68e2dadfc21ed211e38b7864d7a7929181900390910190a15050565b600160208190526000918252604090912080549181015460029091015460ff1683565b600083101580156107c45750606483105b15156107cf57600080fd5b6005430482146107de57600080fd5b60008381526005602052604090205482116107f857600080fd5b610800610b9b565b604080516060808201835283825233600160a060020a03908116602080850182815260008688018181528b8252600484528882208b8352845288822097518855915160019097018054925173ffffffffffffffffffffffffffffffffffffffff19909316979095169690961774ff000000000000000000000000000000000000000019167401000000000000000000000000000000000000000091151591909102179092558784526005808352858520439190910490556003825284842093909355835185815290810186905280840192909252915185927f2d0a86178d2fd307b47be157a766e6bee19bc26161c32f9781ee0e818636f09c928290030190a2505050565b60056020526000908152604090205481565b60066020526000908152604090205481565b33600160a060020a038116600090815260016020819052604090912080820154600290910154909160ff90911615151461096257600080fd5b600160a060020a038216600090815260016020526040902054151561098657600080fd5b600160a060020a038216600090815260016020526040902054613f000160054304116109b157600080fd5b600160a060020a03821660008181526001602081905260408083208381559182018390556002909101805460ff1916905551683635c9adc5dea000009082818181858883f19350505050158015610a0c573d6000803e3d6000fd5b5060408051600160a060020a03841681526020810183905281517faee20171b64b7f3360a142659094ce929970d6963dcea8c34a9bf1ece8033680929181900390910190a15050565b6000805482908110610a6357fe5b600091825260209091200154600160a060020a0316905081565b60008080808080600543049450600b54851115610a9e57600a549350610aa4565b60095493505b6040805160001960058802018040808352602083018b90528284018c90529251918290036060019091209094509092508490811515610adf57fe5b069050600081815481101515610af157fe5b600091825260209091200154600160a060020a031698975050505050505050565b60009081526003602052604090205460ff1690565b600460209081526000928352604080842090915290825290208054600190910154600160a060020a0381169074010000000000000000000000000000000000000000900460ff1683565b60025481565b600091825260036020526040909120805460ff9290920360020a9091176001019055565b600b546005430490811015610baf57610bbb565b600a54600955600b8190555b50565b6008546007541415610c0457600780546001810182556000919091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801819055610c23565b806007600854815481101515610c1657fe5b6000918252602090912001555b50600880546001019055565b6008541590565b60006001600854111515610c4957600080fd5b600880546000190190819055600780549091908110610c6457fe5b90600052602060002001549050905600a165627a7a723058208dd9521bbeeb6bf4ded3b387567171f24e70da42c28607921836570ab0a254470029` +const SMCBin = `0x608060405234801561001057600080fd5b50610ccd806100206000396000f3006080604052600436106100da5763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416630c8da4cc81146100df5780634f33ffa01461010957806358377bd11461012c57806364390ff11461014157806368e9513e146101705780636bdd32711461017857806375bd9912146101c157806383ceeabe146101df57806397d369a2146101f75780639910851d1461020f578063a81f451014610224578063b09f427e14610258578063b2c2f2e814610273578063e9e0b6831461028b578063f6f67d36146102ce575b600080fd5b3480156100eb57600080fd5b506100f76004356102e3565b60408051918252519081900360200190f35b34801561011557600080fd5b5061012a6004356024356044356064356102f5565b005b34801561013857600080fd5b5061012a61049b565b34801561014d57600080fd5b5061015c6004356024356105c6565b604080519115158252519081900360200190f35b61012a6105e9565b34801561018457600080fd5b50610199600160a060020a03600435166107ac565b6040805194855260208501939093528383019190915215156060830152519081900360800190f35b3480156101cd57600080fd5b5061012a6004356024356044356107d7565b3480156101eb57600080fd5b506100f7600435610929565b34801561020357600080fd5b506100f760043561093b565b34801561021b57600080fd5b5061012a61094d565b34801561023057600080fd5b5061023c600435610a82565b60408051600160a060020a039092168252519081900360200190f35b34801561026457600080fd5b5061023c600435602435610aaa565b34801561027f57600080fd5b506100f7600435610b3f565b34801561029757600080fd5b506102a6600435602435610b54565b60408051938452600160a060020a039092166020840152151582820152519081900360600190f35b3480156102da57600080fd5b506100f7610b9e565b60036020526000908152604090205481565b60008085101580156103075750606485105b151561031257600080fd5b60054304841461032157600080fd5b600085815260056020526040902054841461033b57600080fd5b6087831061034857600080fd5b6000858152600460209081526040808320878452909152902054821461036d57600080fd5b600160a060020a03331660009081526001602052604090206003015460ff16151561039757600080fd5b6103a185846105c6565b156103ab57600080fd5b33600160a060020a03166103bf8685610aaa565b600160a060020a0316146103d257600080fd5b6103dc8584610ba4565b6103e585610b3f565b9050605a8110610449576000858152600660209081526040808320879055600482528083208784529091529020600101805474ff00000000000000000000000000000000000000001916740100000000000000000000000000000000000000001790555b6040805183815260208101869052600160a060020a03331681830152905186917fc99370212b708f699fb6945a17eb34d0fc1ccd5b45d88f4d9682593a45d6e833919081900360600190a25050505050565b33600160a060020a038116600090815260016020819052604082209081015460039091015490919060ff1615156104d157600080fd5b82600160a060020a03166000838154811015156104ea57fe5b600091825260209091200154600160a060020a03161461050957600080fd5b610511610bc8565b50600160a060020a0382166000908152600160205260409020600543049081905561053b82610beb565b600080548390811061054957fe5b600091825260209182902001805473ffffffffffffffffffffffffffffffffffffffff191690556002805460001901905560408051600160a060020a0386168152918201849052818101839052517f90e5afdc8fd31453dcf6e37154fa117ddf3b0324c96c65015563df9d5e4b5a759181900360600190a1505050565b60009182526003602052604090912054600160ff9290920360020a900481161490565b33600160a060020a03811660009081526001602052604081206003015460ff161561061357600080fd5b34683635c9adc5dea000001461062857600080fd5b610630610bc8565b610638610c5c565b1561069b5750600254600080546001810182559080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56301805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384161790556106e4565b6106a3610c63565b9050816000828154811015156106b557fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a031602179055505b600280546001908101825560408051608081018252600080825260208083018781523484860190815260608501878152600160a060020a038b168552928790529490922092518355905193820193909355905192810192909255516003909101805460ff1916911515919091179055600a5481106107645760018101600a555b60408051600160a060020a03841681526020810183905281517fa4fe15c53db34d35a5117acc26c27a2653dc68e2dadfc21ed211e38b7864d7a7929181900390910190a15050565b6001602081905260009182526040909120805491810154600282015460039092015490919060ff1684565b600083101580156107e85750606483105b15156107f357600080fd5b60054304821461080257600080fd5b600083815260056020526040902054821161081c57600080fd5b610824610bc8565b604080516060808201835283825233600160a060020a03908116602080850182815260008688018181528b8252600484528882208b8352845288822097518855915160019097018054925173ffffffffffffffffffffffffffffffffffffffff19909316979095169690961774ff000000000000000000000000000000000000000019167401000000000000000000000000000000000000000091151591909102179092558784526005808352858520439190910490556003825284842093909355835185815290810186905280840192909252915185927f2d0a86178d2fd307b47be157a766e6bee19bc26161c32f9781ee0e818636f09c928290030190a2505050565b60056020526000908152604090205481565b60066020526000908152604090205481565b33600160a060020a038116600090815260016020819052604082208082015460039091015490929160ff90911615151461098657600080fd5b600160a060020a03831660009081526001602052604090205415156109aa57600080fd5b600160a060020a038316600090815260016020526040902054613f000160054304116109d557600080fd5b50600160a060020a0382166000818152600160208190526040808320600281018054858355938201859055849055600301805460ff191690555190929183156108fc02918491818181858888f19350505050158015610a38573d6000803e3d6000fd5b5060408051600160a060020a03851681526020810184905281517faee20171b64b7f3360a142659094ce929970d6963dcea8c34a9bf1ece8033680929181900390910190a1505050565b6000805482908110610a9057fe5b600091825260209091200154600160a060020a0316905081565b60008080808080600543049450600b54851115610acb57600a549350610ad1565b60095493505b6040805160001960058802018040808352602083018b90528284018c90529251918290036060019091209094509092508490811515610b0c57fe5b069050600081815481101515610b1e57fe5b600091825260209091200154600160a060020a031698975050505050505050565b60009081526003602052604090205460ff1690565b600460209081526000928352604080842090915290825290208054600190910154600160a060020a0381169074010000000000000000000000000000000000000000900460ff1683565b60025481565b600091825260036020526040909120805460ff9290920360020a9091176001019055565b600b546005430490811015610bdc57610be8565b600a54600955600b8190555b50565b6008546007541415610c3157600780546001810182556000919091527fa66cc928b5edb82af9bd49922954155ab7b0942694bea4ce44661d9a8736c68801819055610c50565b806007600854815481101515610c4357fe5b6000918252602090912001555b50600880546001019055565b6008541590565b60006001600854111515610c7657600080fd5b600880546000190190819055600780549091908110610c9157fe5b90600052602060002001549050905600a165627a7a72305820407c65217daccb6d836624284dcf1ebbb9e3758047571ceba390e670e0f894db0029` // DeploySMC deploys a new Ethereum contract, binding an instance of SMC to it. func DeploySMC(auth *bind.TransactOpts, backend bind.ContractBackend) (common.Address, *types.Transaction, *SMC, error) { @@ -426,15 +426,17 @@ func (_SMC *SMCCallerSession) NotaryPoolLength() (*big.Int, error) { // NotaryRegistry is a free data retrieval call binding the contract method 0x6bdd3271. // -// Solidity: function notaryRegistry( address) constant returns(deregisteredPeriod uint256, poolIndex uint256, deposited bool) +// Solidity: function notaryRegistry( address) constant returns(deregisteredPeriod uint256, poolIndex uint256, balance uint256, deposited bool) func (_SMC *SMCCaller) NotaryRegistry(opts *bind.CallOpts, arg0 common.Address) (struct { DeregisteredPeriod *big.Int PoolIndex *big.Int + Balance *big.Int Deposited bool }, error) { ret := new(struct { DeregisteredPeriod *big.Int PoolIndex *big.Int + Balance *big.Int Deposited bool }) out := ret @@ -444,10 +446,11 @@ func (_SMC *SMCCaller) NotaryRegistry(opts *bind.CallOpts, arg0 common.Address) // NotaryRegistry is a free data retrieval call binding the contract method 0x6bdd3271. // -// Solidity: function notaryRegistry( address) constant returns(deregisteredPeriod uint256, poolIndex uint256, deposited bool) +// Solidity: function notaryRegistry( address) constant returns(deregisteredPeriod uint256, poolIndex uint256, balance uint256, deposited bool) func (_SMC *SMCSession) NotaryRegistry(arg0 common.Address) (struct { DeregisteredPeriod *big.Int PoolIndex *big.Int + Balance *big.Int Deposited bool }, error) { return _SMC.Contract.NotaryRegistry(&_SMC.CallOpts, arg0) @@ -455,10 +458,11 @@ func (_SMC *SMCSession) NotaryRegistry(arg0 common.Address) (struct { // NotaryRegistry is a free data retrieval call binding the contract method 0x6bdd3271. // -// Solidity: function notaryRegistry( address) constant returns(deregisteredPeriod uint256, poolIndex uint256, deposited bool) +// Solidity: function notaryRegistry( address) constant returns(deregisteredPeriod uint256, poolIndex uint256, balance uint256, deposited bool) func (_SMC *SMCCallerSession) NotaryRegistry(arg0 common.Address) (struct { DeregisteredPeriod *big.Int PoolIndex *big.Int + Balance *big.Int Deposited bool }, error) { return _SMC.Contract.NotaryRegistry(&_SMC.CallOpts, arg0) diff --git a/sharding/contracts/sharding_manager.sol b/sharding/contracts/sharding_manager.sol index ba2062e61..52bde118c 100644 --- a/sharding/contracts/sharding_manager.sol +++ b/sharding/contracts/sharding_manager.sol @@ -11,6 +11,7 @@ contract SMC { struct Notary { uint deregisteredPeriod; uint poolIndex; + uint balance; bool deposited; } @@ -110,6 +111,7 @@ contract SMC { notaryRegistry[notaryAddress] = Notary({ deregisteredPeriod: 0, poolIndex: index, + balance: msg.value, deposited: true }); @@ -150,8 +152,9 @@ contract SMC { require(notaryRegistry[notaryAddress].deregisteredPeriod != 0); require((block.number / PERIOD_LENGTH) > (notaryRegistry[notaryAddress].deregisteredPeriod + NOTARY_LOCKUP_LENGTH)); + uint balance = notaryRegistry[notaryAddress].balance; delete notaryRegistry[notaryAddress]; - notaryAddress.transfer(NOTARY_DEPOSIT); + notaryAddress.transfer(balance); emit NotaryReleased(notaryAddress, index); }