mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-01 15:57:39 +00:00
sharding: fixed return bool for functions in sol
Former-commit-id: 33624e189e073aa862f2e33f8fd5ebea919d6368 [formerly c7c40d11c99abd923eeee641866e73ea26d7ca13] Former-commit-id: 7d307bc09f0f46d31be20560879954eb8b2a9215
This commit is contained in:
parent
150f0ae58d
commit
84389b219b
@ -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\":\"\",\"type\":\"bytes32\"}],\"name\":\"collationTrees\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"deregisterNotary\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"name\":\"periodHead\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"registerNotary\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"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\":\"releaseNotary\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"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\":false,\"inputs\":[{\"name\":\"_shardId\",\"type\":\"uint256\"},{\"name\":\"period\",\"type\":\"uint256\"},{\"name\":\"chunkRoot\",\"type\":\"bytes32\"},{\"name\":\"proposerAddress\",\"type\":\"address\"}],\"name\":\"addHeader\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"shardId\",\"type\":\"uint256\"},{\"name\":\"parentHash\",\"type\":\"bytes32\"},{\"name\":\"chunkRoot\",\"type\":\"bytes32\"},{\"name\":\"period\",\"type\":\"uint256\"},{\"name\":\"proposerAddress\",\"type\":\"address\"}],\"name\":\"computeHeaderHash\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"int256\"},{\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"collationHeaders\",\"outputs\":[{\"name\":\"shardId\",\"type\":\"uint256\"},{\"name\":\"chunkRoot\",\"type\":\"bytes32\"},{\"name\":\"period\",\"type\":\"uint256\"},{\"name\":\"proposerAddress\",\"type\":\"address\"}],\"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\":\"int128\"},{\"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\"}]"
|
||||
const SMCABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"uint256\"},{\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"collationTrees\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"deregisterNotary\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"name\":\"periodHead\",\"outputs\":[{\"name\":\"\",\"type\":\"int256\"}],\"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\":\"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\":false,\"inputs\":[{\"name\":\"_shardId\",\"type\":\"uint256\"},{\"name\":\"period\",\"type\":\"uint256\"},{\"name\":\"chunkRoot\",\"type\":\"bytes32\"},{\"name\":\"proposerAddress\",\"type\":\"address\"}],\"name\":\"addHeader\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"shardId\",\"type\":\"uint256\"},{\"name\":\"parentHash\",\"type\":\"bytes32\"},{\"name\":\"chunkRoot\",\"type\":\"bytes32\"},{\"name\":\"period\",\"type\":\"uint256\"},{\"name\":\"proposerAddress\",\"type\":\"address\"}],\"name\":\"computeHeaderHash\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes32\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"\",\"type\":\"int256\"},{\"name\":\"\",\"type\":\"bytes32\"}],\"name\":\"collationHeaders\",\"outputs\":[{\"name\":\"shardId\",\"type\":\"uint256\"},{\"name\":\"chunkRoot\",\"type\":\"bytes32\"},{\"name\":\"period\",\"type\":\"uint256\"},{\"name\":\"proposerAddress\",\"type\":\"address\"}],\"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\":\"int128\"},{\"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\"}]"
|
||||
|
||||
// SMCBin is the compiled bytecode used for deploying new contracts.
|
||||
const SMCBin = `0x608060405234801561001057600080fd5b50610928806100206000396000f3006080604052600436106100b95763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166303dde97781146100be57806358377bd1146100eb578063584475db1461011457806368e9513e1461012c5780636bdd3271146101345780639910851d14610175578063a81f45101461018a578063b09f427e146101be578063b8bc055f146101d9578063b9505ea414610203578063b9d8ef9614610230578063f6f67d361461027a575b600080fd5b3480156100ca57600080fd5b506100d960043560243561028f565b60408051918252519081900360200190f35b3480156100f757600080fd5b506101006102ac565b604080519115158252519081900360200190f35b34801561012057600080fd5b506100d96004356103df565b6101006103f1565b34801561014057600080fd5b50610155600160a060020a03600435166105af565b604080519384526020840192909252151582820152519081900360600190f35b34801561018157600080fd5b506101006105d2565b34801561019657600080fd5b506101a2600435610705565b60408051600160a060020a039092168252519081900360200190f35b3480156101ca57600080fd5b506101a260043560243561072d565b3480156101e557600080fd5b50610100600435602435604435600160a060020a03606435166107c2565b34801561020f57600080fd5b506100d9600435602435604435606435600160a060020a03608435166107cc565b34801561023c57600080fd5b5061024b6004356024356107d7565b60408051948552602085019390935283830191909152600160a060020a03166060830152519081900360800190f35b34801561028657600080fd5b506100d9610811565b600260209081526000928352604080842090915290825290205481565b33600160a060020a0381166000908152600160208190526040822090810154600290910154919291839060ff1615156102e457600080fd5b82600160a060020a03166000838154811015156102fd57fe5b600091825260209091200154600160a060020a03161461031c57600080fd5b610324610817565b5050600160a060020a0382166000908152600160205260409020600543049081905561034f82610846565b600080548390811061035d57fe5b600091825260209182902001805473ffffffffffffffffffffffffffffffffffffffff191690556005805460001901905560408051600160a060020a0386168152918201849052818101839052517f90e5afdc8fd31453dcf6e37154fa117ddf3b0324c96c65015563df9d5e4b5a759181900360600190a16001935050505090565b600b6020526000908152604090205481565b33600160a060020a038116600090815260016020526040812060020154909190829060ff161561042057600080fd5b34683635c9adc5dea000001461043557600080fd5b61043d610817565b506104466108b7565b156104a95750600554600080546001810182559080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56301805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384161790556104f2565b6104b16108be565b9050816000828154811015156104c357fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a031602179055505b6005805460019081019091556040805160608101825260008082526020808301868152838501868152600160a060020a0389168452918690529390912091518255915192810192909255516002909101805460ff1916911515919091179055600954811061056257600181016009555b60408051600160a060020a03841681526020810183905281517fa4fe15c53db34d35a5117acc26c27a2653dc68e2dadfc21ed211e38b7864d7a7929181900390910190a160019250505090565b600160208190526000918252604090912080549181015460029091015460ff1683565b33600160a060020a0381166000908152600160208190526040822080820154600290910154929392909160ff90911615151461060d57600080fd5b600160a060020a038216600090815260016020526040902054151561063157600080fd5b600160a060020a038216600090815260016020526040902054613f0001600543041161065c57600080fd5b600160a060020a03821660008181526001602081905260408083208381559182018390556002909101805460ff1916905551683635c9adc5dea000009082818181858883f193505050501580156106b7573d6000803e3d6000fd5b5060408051600160a060020a03841681526020810183905281517faee20171b64b7f3360a142659094ce929970d6963dcea8c34a9bf1ece8033680929181900390910190a160019250505090565b600080548290811061071357fe5b600091825260209091200154600160a060020a0316905081565b60008080808080600543049450600a5485111561074e576009549350610754565b60085493505b6040805160001960058802018040808352602083018b90528284018c9052925191829003606001909120909450909250849081151561078f57fe5b0690506000818154811015156107a157fe5b600091825260209091200154600160a060020a031698975050505050505050565b6000949350505050565b600095945050505050565b60036020818152600093845260408085209091529183529120805460018201546002830154929093015490929190600160a060020a031684565b60055481565b600a5460009060054304908110156108325760009150610842565b600954600855600a819055600191505b5090565b600754600654141561088c57600680546001810182556000919091527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f018190556108ab565b80600660075481548110151561089e57fe5b6000918252602090912001555b50600780546001019055565b6007541590565b600060016007541115156108d157600080fd5b6007805460001901908190556006805490919081106108ec57fe5b90600052602060002001549050905600a165627a7a72305820d453a229f7690048c16d8e76567fa0295b766cfeb78ef0750763de17190630300029`
|
||||
const SMCBin = `0x608060405234801561001057600080fd5b506108ec806100206000396000f3006080604052600436106100b95763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166303dde97781146100be57806358377bd1146100eb578063584475db1461010257806368e9513e1461011a5780636bdd3271146101225780639910851d14610163578063a81f451014610178578063b09f427e146101ac578063b8bc055f146101c7578063b9505ea4146101f1578063b9d8ef961461021e578063f6f67d3614610268575b600080fd5b3480156100ca57600080fd5b506100d960043560243561027d565b60408051918252519081900360200190f35b3480156100f757600080fd5b5061010061029a565b005b34801561010e57600080fd5b506100d96004356103c5565b6101006103d7565b34801561012e57600080fd5b50610143600160a060020a036004351661058a565b604080519384526020840192909252151582820152519081900360600190f35b34801561016f57600080fd5b506101006105ad565b34801561018457600080fd5b506101906004356106d9565b60408051600160a060020a039092168252519081900360200190f35b3480156101b857600080fd5b50610190600435602435610701565b3480156101d357600080fd5b50610100600435602435604435600160a060020a0360643516610796565b3480156101fd57600080fd5b506100d9600435602435604435606435600160a060020a036084351661079c565b34801561022a57600080fd5b506102396004356024356107a7565b60408051948552602085019390935283830191909152600160a060020a03166060830152519081900360800190f35b34801561027457600080fd5b506100d96107e1565b600260209081526000928352604080842090915290825290205481565b33600160a060020a038116600090815260016020819052604082209081015460029091015490919060ff1615156102d057600080fd5b82600160a060020a03166000838154811015156102e957fe5b600091825260209091200154600160a060020a03161461030857600080fd5b6103106107e7565b50600160a060020a0382166000908152600160205260409020600543049081905561033a8261080a565b600080548390811061034857fe5b600091825260209182902001805473ffffffffffffffffffffffffffffffffffffffff191690556005805460001901905560408051600160a060020a0386168152918201849052818101839052517f90e5afdc8fd31453dcf6e37154fa117ddf3b0324c96c65015563df9d5e4b5a759181900360600190a1505050565b600b6020526000908152604090205481565b33600160a060020a03811660009081526001602052604081206002015460ff161561040157600080fd5b34683635c9adc5dea000001461041657600080fd5b61041e6107e7565b61042661087b565b156104895750600554600080546001810182559080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56301805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384161790556104d2565b610491610882565b9050816000828154811015156104a357fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a031602179055505b6005805460019081019091556040805160608101825260008082526020808301868152838501868152600160a060020a0389168452918690529390912091518255915192810192909255516002909101805460ff1916911515919091179055600954811061054257600181016009555b60408051600160a060020a03841681526020810183905281517fa4fe15c53db34d35a5117acc26c27a2653dc68e2dadfc21ed211e38b7864d7a7929181900390910190a15050565b600160208190526000918252604090912080549181015460029091015460ff1683565b33600160a060020a038116600090815260016020819052604090912080820154600290910154909160ff9091161515146105e657600080fd5b600160a060020a038216600090815260016020526040902054151561060a57600080fd5b600160a060020a038216600090815260016020526040902054613f0001600543041161063557600080fd5b600160a060020a03821660008181526001602081905260408083208381559182018390556002909101805460ff1916905551683635c9adc5dea000009082818181858883f19350505050158015610690573d6000803e3d6000fd5b5060408051600160a060020a03841681526020810183905281517faee20171b64b7f3360a142659094ce929970d6963dcea8c34a9bf1ece8033680929181900390910190a15050565b60008054829081106106e757fe5b600091825260209091200154600160a060020a0316905081565b60008080808080600543049450600a54851115610722576009549350610728565b60085493505b6040805160001960058802018040808352602083018b90528284018c9052925191829003606001909120909450909250849081151561076357fe5b06905060008181548110151561077557fe5b600091825260209091200154600160a060020a031698975050505050505050565b50505050565b600095945050505050565b60036020818152600093845260408085209091529183529120805460018201546002830154929093015490929190600160a060020a031684565b60055481565b600a5460054304908110156107fb57610807565b600954600855600a8190555b50565b600754600654141561085057600680546001810182556000919091527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f0181905561086f565b80600660075481548110151561086257fe5b6000918252602090912001555b50600780546001019055565b6007541590565b6000600160075411151561089557600080fd5b6007805460001901908190556006805490919081106108b057fe5b90600052602060002001549050905600a165627a7a723058206a18c219259d03462104b10265828f09d0a7edbae0d8cc91dad68df76b9ad2820029`
|
||||
|
||||
// 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) {
|
||||
@ -392,21 +392,21 @@ func (_SMC *SMCCallerSession) PeriodHead(arg0 *big.Int) (*big.Int, error) {
|
||||
|
||||
// AddHeader is a paid mutator transaction binding the contract method 0xb8bc055f.
|
||||
//
|
||||
// Solidity: function addHeader(_shardId uint256, period uint256, chunkRoot bytes32, proposerAddress address) returns(bool)
|
||||
// Solidity: function addHeader(_shardId uint256, period uint256, chunkRoot bytes32, proposerAddress address) returns()
|
||||
func (_SMC *SMCTransactor) AddHeader(opts *bind.TransactOpts, _shardId *big.Int, period *big.Int, chunkRoot [32]byte, proposerAddress common.Address) (*types.Transaction, error) {
|
||||
return _SMC.contract.Transact(opts, "addHeader", _shardId, period, chunkRoot, proposerAddress)
|
||||
}
|
||||
|
||||
// AddHeader is a paid mutator transaction binding the contract method 0xb8bc055f.
|
||||
//
|
||||
// Solidity: function addHeader(_shardId uint256, period uint256, chunkRoot bytes32, proposerAddress address) returns(bool)
|
||||
// Solidity: function addHeader(_shardId uint256, period uint256, chunkRoot bytes32, proposerAddress address) returns()
|
||||
func (_SMC *SMCSession) AddHeader(_shardId *big.Int, period *big.Int, chunkRoot [32]byte, proposerAddress common.Address) (*types.Transaction, error) {
|
||||
return _SMC.Contract.AddHeader(&_SMC.TransactOpts, _shardId, period, chunkRoot, proposerAddress)
|
||||
}
|
||||
|
||||
// AddHeader is a paid mutator transaction binding the contract method 0xb8bc055f.
|
||||
//
|
||||
// Solidity: function addHeader(_shardId uint256, period uint256, chunkRoot bytes32, proposerAddress address) returns(bool)
|
||||
// Solidity: function addHeader(_shardId uint256, period uint256, chunkRoot bytes32, proposerAddress address) returns()
|
||||
func (_SMC *SMCTransactorSession) AddHeader(_shardId *big.Int, period *big.Int, chunkRoot [32]byte, proposerAddress common.Address) (*types.Transaction, error) {
|
||||
return _SMC.Contract.AddHeader(&_SMC.TransactOpts, _shardId, period, chunkRoot, proposerAddress)
|
||||
}
|
||||
@ -434,63 +434,63 @@ func (_SMC *SMCTransactorSession) ComputeHeaderHash(shardId *big.Int, parentHash
|
||||
|
||||
// DeregisterNotary is a paid mutator transaction binding the contract method 0x58377bd1.
|
||||
//
|
||||
// Solidity: function deregisterNotary() returns(bool)
|
||||
// Solidity: function deregisterNotary() returns()
|
||||
func (_SMC *SMCTransactor) DeregisterNotary(opts *bind.TransactOpts) (*types.Transaction, error) {
|
||||
return _SMC.contract.Transact(opts, "deregisterNotary")
|
||||
}
|
||||
|
||||
// DeregisterNotary is a paid mutator transaction binding the contract method 0x58377bd1.
|
||||
//
|
||||
// Solidity: function deregisterNotary() returns(bool)
|
||||
// Solidity: function deregisterNotary() returns()
|
||||
func (_SMC *SMCSession) DeregisterNotary() (*types.Transaction, error) {
|
||||
return _SMC.Contract.DeregisterNotary(&_SMC.TransactOpts)
|
||||
}
|
||||
|
||||
// DeregisterNotary is a paid mutator transaction binding the contract method 0x58377bd1.
|
||||
//
|
||||
// Solidity: function deregisterNotary() returns(bool)
|
||||
// Solidity: function deregisterNotary() returns()
|
||||
func (_SMC *SMCTransactorSession) DeregisterNotary() (*types.Transaction, error) {
|
||||
return _SMC.Contract.DeregisterNotary(&_SMC.TransactOpts)
|
||||
}
|
||||
|
||||
// RegisterNotary is a paid mutator transaction binding the contract method 0x68e9513e.
|
||||
//
|
||||
// Solidity: function registerNotary() returns(bool)
|
||||
// Solidity: function registerNotary() returns()
|
||||
func (_SMC *SMCTransactor) RegisterNotary(opts *bind.TransactOpts) (*types.Transaction, error) {
|
||||
return _SMC.contract.Transact(opts, "registerNotary")
|
||||
}
|
||||
|
||||
// RegisterNotary is a paid mutator transaction binding the contract method 0x68e9513e.
|
||||
//
|
||||
// Solidity: function registerNotary() returns(bool)
|
||||
// Solidity: function registerNotary() returns()
|
||||
func (_SMC *SMCSession) RegisterNotary() (*types.Transaction, error) {
|
||||
return _SMC.Contract.RegisterNotary(&_SMC.TransactOpts)
|
||||
}
|
||||
|
||||
// RegisterNotary is a paid mutator transaction binding the contract method 0x68e9513e.
|
||||
//
|
||||
// Solidity: function registerNotary() returns(bool)
|
||||
// Solidity: function registerNotary() returns()
|
||||
func (_SMC *SMCTransactorSession) RegisterNotary() (*types.Transaction, error) {
|
||||
return _SMC.Contract.RegisterNotary(&_SMC.TransactOpts)
|
||||
}
|
||||
|
||||
// ReleaseNotary is a paid mutator transaction binding the contract method 0x9910851d.
|
||||
//
|
||||
// Solidity: function releaseNotary() returns(bool)
|
||||
// Solidity: function releaseNotary() returns()
|
||||
func (_SMC *SMCTransactor) ReleaseNotary(opts *bind.TransactOpts) (*types.Transaction, error) {
|
||||
return _SMC.contract.Transact(opts, "releaseNotary")
|
||||
}
|
||||
|
||||
// ReleaseNotary is a paid mutator transaction binding the contract method 0x9910851d.
|
||||
//
|
||||
// Solidity: function releaseNotary() returns(bool)
|
||||
// Solidity: function releaseNotary() returns()
|
||||
func (_SMC *SMCSession) ReleaseNotary() (*types.Transaction, error) {
|
||||
return _SMC.Contract.ReleaseNotary(&_SMC.TransactOpts)
|
||||
}
|
||||
|
||||
// ReleaseNotary is a paid mutator transaction binding the contract method 0x9910851d.
|
||||
//
|
||||
// Solidity: function releaseNotary() returns(bool)
|
||||
// Solidity: function releaseNotary() returns()
|
||||
func (_SMC *SMCTransactorSession) ReleaseNotary() (*types.Transaction, error) {
|
||||
return _SMC.Contract.ReleaseNotary(&_SMC.TransactOpts)
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ contract SMC {
|
||||
|
||||
/// Registers notary to notatery registry, locks in the notary deposit,
|
||||
/// and returns true on success
|
||||
function registerNotary() public payable returns(bool) {
|
||||
function registerNotary() public payable {
|
||||
address notaryAddress = msg.sender;
|
||||
require(!notaryRegistry[notaryAddress].deposited);
|
||||
require(msg.value == NOTARY_DEPOSIT);
|
||||
@ -125,13 +125,12 @@ contract SMC {
|
||||
}
|
||||
|
||||
emit NotaryRegistered(notaryAddress, index);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Deregisters notary from notatery registry, lock up period countdowns down,
|
||||
/// notary may call releaseNotary after lock up period finishses to withdraw deposit,
|
||||
/// and returns true on success
|
||||
function deregisterNotary() public returns(bool) {
|
||||
function deregisterNotary() public {
|
||||
address notaryAddress = msg.sender;
|
||||
uint index = notaryRegistry[notaryAddress].poolIndex;
|
||||
require(notaryRegistry[notaryAddress].deposited);
|
||||
@ -147,12 +146,11 @@ contract SMC {
|
||||
delete notaryPool[index];
|
||||
--notaryPoolLength;
|
||||
emit NotaryDeregistered(notaryAddress, index, deregisteredPeriod);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Removes an entry from notary registry, returns deposit back to the notary,
|
||||
/// and returns true on success.
|
||||
function releaseNotary() public returns(bool) {
|
||||
function releaseNotary() public {
|
||||
address notaryAddress = msg.sender;
|
||||
uint index = notaryRegistry[notaryAddress].poolIndex;
|
||||
require(notaryRegistry[notaryAddress].deposited == true);
|
||||
@ -162,7 +160,6 @@ contract SMC {
|
||||
delete notaryRegistry[notaryAddress];
|
||||
notaryAddress.transfer(NOTARY_DEPOSIT);
|
||||
emit NotaryReleased(notaryAddress, index);
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Calcuates the hash of the header from the input parameters
|
||||
@ -184,7 +181,7 @@ contract SMC {
|
||||
uint period,
|
||||
bytes32 chunkRoot,
|
||||
address proposerAddress
|
||||
) public returns(bool) {
|
||||
) public {
|
||||
/*
|
||||
TODO: Anyone can call this at any time. The first header
|
||||
to get included for a given shard in a given period gets in,
|
||||
@ -194,14 +191,13 @@ contract SMC {
|
||||
|
||||
/// To keep track of notary size in between periods, we call updateNotarySampleSize
|
||||
/// before notary registration/deregistration so correct size can be applied next period
|
||||
function updateNotarySampleSize() internal returns(bool) {
|
||||
function updateNotarySampleSize() internal {
|
||||
uint currentPeriod = block.number / PERIOD_LENGTH;
|
||||
if (currentPeriod < sampleSizeLastUpdatedPeriod) {
|
||||
return false;
|
||||
return;
|
||||
}
|
||||
currentPeriodNotarySampleSize = nextPeriodNotarySampleSize;
|
||||
sampleSizeLastUpdatedPeriod = currentPeriod;
|
||||
return true;
|
||||
}
|
||||
|
||||
/// Check if the empty slots stack is empty
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"context"
|
||||
|
||||
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
||||
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
|
||||
"github.com/ethereum/go-ethereum/common"
|
||||
@ -72,7 +73,7 @@ func TestNotaryRegister(t *testing.T) {
|
||||
backend := backends.NewSimulatedBackend(genesis)
|
||||
_, _, smc, _ := deploySMCContract(backend, notaryPoolPrivKeys[0])
|
||||
|
||||
// Test notary 0 has not registered
|
||||
// Notary 0 has not registered
|
||||
notary, err := smc.NotaryRegistry(&bind.CallOpts{}, notaryPoolAddr[0])
|
||||
if err != nil {
|
||||
t.Fatalf("Can't get notary registry info: %v", err)
|
||||
|
Loading…
Reference in New Issue
Block a user