mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-01 15:57:39 +00:00
sharding: fixed lint
Former-commit-id: cecf8e888992de3583c222e98f1e3e4c26c48924 [formerly 67381715d66b4a512d9e884a257ab0609fd81d33] Former-commit-id: 66fa59bb52e8343843f10247d668e2b3fe8c892f
This commit is contained in:
parent
0b7df21505
commit
4e45d1882c
@ -19,7 +19,7 @@ import (
|
||||
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\"}]"
|
||||
|
||||
// SMCBin is the compiled bytecode used for deploying new contracts.
|
||||
const SMCBin = `0x608060405234801561001057600080fd5b50610921806100206000396000f3006080604052600436106100b95763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166303dde97781146100be57806358377bd1146100eb578063584475db1461011457806368e9513e1461012c5780636bdd3271146101345780639910851d14610175578063a81f45101461018a578063b09f427e146101be578063b8bc055f146101d9578063b9505ea414610203578063b9d8ef9614610230578063f6f67d361461027a575b600080fd5b3480156100ca57600080fd5b506100d960043560243561028f565b60408051918252519081900360200190f35b3480156100f757600080fd5b506101006102ac565b604080519115158252519081900360200190f35b34801561012057600080fd5b506100d96004356103df565b6101006103f1565b34801561014057600080fd5b50610155600160a060020a03600435166105af565b604080519384526020840192909252151582820152519081900360600190f35b34801561018157600080fd5b506101006105d2565b34801561019657600080fd5b506101a2600435610705565b60408051600160a060020a039092168252519081900360200190f35b3480156101ca57600080fd5b506101a260043560243561072d565b3480156101e557600080fd5b50610100600435602435604435600160a060020a03606435166107bb565b34801561020f57600080fd5b506100d9600435602435604435606435600160a060020a03608435166107c5565b34801561023c57600080fd5b5061024b6004356024356107d0565b60408051948552602085019390935283830191909152600160a060020a03166060830152519081900360800190f35b34801561028657600080fd5b506100d961080a565b600260209081526000928352604080842090915290825290205481565b33600160a060020a0381166000908152600160208190526040822090810154600290910154919291839060ff1615156102e457600080fd5b82600160a060020a03166000838154811015156102fd57fe5b600091825260209091200154600160a060020a03161461031c57600080fd5b610324610810565b5050600160a060020a0382166000908152600160205260409020600543049081905561034f8261083f565b600080548390811061035d57fe5b600091825260209182902001805473ffffffffffffffffffffffffffffffffffffffff191690556005805460001901905560408051600160a060020a0386168152918201849052818101839052517f90e5afdc8fd31453dcf6e37154fa117ddf3b0324c96c65015563df9d5e4b5a759181900360600190a16001935050505090565b600b6020526000908152604090205481565b33600160a060020a038116600090815260016020526040812060020154909190829060ff161561042057600080fd5b34683635c9adc5dea000001461043557600080fd5b61043d610810565b506104466108b0565b156104a95750600554600080546001810182559080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56301805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384161790556104f2565b6104b16108b7565b9050816000828154811015156104c357fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a031602179055505b6005805460019081019091556040805160608101825260008082526020808301868152838501868152600160a060020a0389168452918690529390912091518255915192810192909255516002909101805460ff1916911515919091179055600954811061056257600181016009555b60408051600160a060020a03841681526020810183905281517fa4fe15c53db34d35a5117acc26c27a2653dc68e2dadfc21ed211e38b7864d7a7929181900390910190a160019250505090565b600160208190526000918252604090912080549181015460029091015460ff1683565b33600160a060020a0381166000908152600160208190526040822080820154600290910154929392909160ff90911615151461060d57600080fd5b600160a060020a038216600090815260016020526040902054151561063157600080fd5b600160a060020a038216600090815260016020526040902054613f0001600543041161065c57600080fd5b600160a060020a03821660008181526001602081905260408083208381559182018390556002909101805460ff1916905551683635c9adc5dea000009082818181858883f193505050501580156106b7573d6000803e3d6000fd5b5060408051600160a060020a03841681526020810183905281517faee20171b64b7f3360a142659094ce929970d6963dcea8c34a9bf1ece8033680929181900390910190a160019250505090565b600080548290811061071357fe5b600091825260209091200154600160a060020a0316905081565b600080808080600543049350600a5484111561074d576009549250610753565b60085492505b60408051600019600587020180408252602082018990528183018a90529151908190036060019020909250839081151561078957fe5b06905060008181548110151561079b57fe5b600091825260209091200154600160a060020a0316979650505050505050565b6000949350505050565b600095945050505050565b60036020818152600093845260408085209091529183529120805460018201546002830154929093015490929190600160a060020a031684565b60055481565b600a54600090600543049081101561082b576000915061083b565b600954600855600a819055600191505b5090565b600754600654141561088557600680546001810182556000919091527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f018190556108a4565b80600660075481548110151561089757fe5b6000918252602090912001555b50600780546001019055565b6007541590565b600060016007541115156108ca57600080fd5b6007805460001901908190556006805490919081106108e557fe5b90600052602060002001549050905600a165627a7a72305820f09036677376fe46add7ec634264b1b42a1568f2d25123be3958f3625d5500da0029`
|
||||
const SMCBin = `0x608060405234801561001057600080fd5b50610928806100206000396000f3006080604052600436106100b95763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166303dde97781146100be57806358377bd1146100eb578063584475db1461011457806368e9513e1461012c5780636bdd3271146101345780639910851d14610175578063a81f45101461018a578063b09f427e146101be578063b8bc055f146101d9578063b9505ea414610203578063b9d8ef9614610230578063f6f67d361461027a575b600080fd5b3480156100ca57600080fd5b506100d960043560243561028f565b60408051918252519081900360200190f35b3480156100f757600080fd5b506101006102ac565b604080519115158252519081900360200190f35b34801561012057600080fd5b506100d96004356103df565b6101006103f1565b34801561014057600080fd5b50610155600160a060020a03600435166105af565b604080519384526020840192909252151582820152519081900360600190f35b34801561018157600080fd5b506101006105d2565b34801561019657600080fd5b506101a2600435610705565b60408051600160a060020a039092168252519081900360200190f35b3480156101ca57600080fd5b506101a260043560243561072d565b3480156101e557600080fd5b50610100600435602435604435600160a060020a03606435166107c2565b34801561020f57600080fd5b506100d9600435602435604435606435600160a060020a03608435166107cc565b34801561023c57600080fd5b5061024b6004356024356107d7565b60408051948552602085019390935283830191909152600160a060020a03166060830152519081900360800190f35b34801561028657600080fd5b506100d9610811565b600260209081526000928352604080842090915290825290205481565b33600160a060020a0381166000908152600160208190526040822090810154600290910154919291839060ff1615156102e457600080fd5b82600160a060020a03166000838154811015156102fd57fe5b600091825260209091200154600160a060020a03161461031c57600080fd5b610324610817565b5050600160a060020a0382166000908152600160205260409020600543049081905561034f82610846565b600080548390811061035d57fe5b600091825260209182902001805473ffffffffffffffffffffffffffffffffffffffff191690556005805460001901905560408051600160a060020a0386168152918201849052818101839052517f90e5afdc8fd31453dcf6e37154fa117ddf3b0324c96c65015563df9d5e4b5a759181900360600190a16001935050505090565b600b6020526000908152604090205481565b33600160a060020a038116600090815260016020526040812060020154909190829060ff161561042057600080fd5b34683635c9adc5dea000001461043557600080fd5b61043d610817565b506104466108b7565b156104a95750600554600080546001810182559080527f290decd9548b62a8d60345a988386fc84ba6bc95484008f6362f93160ef3e56301805473ffffffffffffffffffffffffffffffffffffffff1916600160a060020a0384161790556104f2565b6104b16108be565b9050816000828154811015156104c357fe5b9060005260206000200160006101000a815481600160a060020a030219169083600160a060020a031602179055505b6005805460019081019091556040805160608101825260008082526020808301868152838501868152600160a060020a0389168452918690529390912091518255915192810192909255516002909101805460ff1916911515919091179055600954811061056257600181016009555b60408051600160a060020a03841681526020810183905281517fa4fe15c53db34d35a5117acc26c27a2653dc68e2dadfc21ed211e38b7864d7a7929181900390910190a160019250505090565b600160208190526000918252604090912080549181015460029091015460ff1683565b33600160a060020a0381166000908152600160208190526040822080820154600290910154929392909160ff90911615151461060d57600080fd5b600160a060020a038216600090815260016020526040902054151561063157600080fd5b600160a060020a038216600090815260016020526040902054613f0001600543041161065c57600080fd5b600160a060020a03821660008181526001602081905260408083208381559182018390556002909101805460ff1916905551683635c9adc5dea000009082818181858883f193505050501580156106b7573d6000803e3d6000fd5b5060408051600160a060020a03841681526020810183905281517faee20171b64b7f3360a142659094ce929970d6963dcea8c34a9bf1ece8033680929181900390910190a160019250505090565b600080548290811061071357fe5b600091825260209091200154600160a060020a0316905081565b60008080808080600543049450600a5485111561074e576009549350610754565b60085493505b6040805160001960058802018040808352602083018b90528284018c9052925191829003606001909120909450909250849081151561078f57fe5b0690506000818154811015156107a157fe5b600091825260209091200154600160a060020a031698975050505050505050565b6000949350505050565b600095945050505050565b60036020818152600093845260408085209091529183529120805460018201546002830154929093015490929190600160a060020a031684565b60055481565b600a5460009060054304908110156108325760009150610842565b600954600855600a819055600191505b5090565b600754600654141561088c57600680546001810182556000919091527ff652222313e28459528d920b65115c16c04f3efc82aaedc97be59f3f377c0d3f018190556108ab565b80600660075481548110151561089e57fe5b6000918252602090912001555b50600780546001019055565b6007541590565b600060016007541115156108d157600080fd5b6007805460001901908190556006805490919081106108ec57fe5b90600052602060002001549050905600a165627a7a72305820d453a229f7690048c16d8e76567fa0295b766cfeb78ef0750763de17190630300029`
|
||||
|
||||
// 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) {
|
||||
|
@ -77,7 +77,7 @@ func TestNotaryRegister(t *testing.T) {
|
||||
t.Fatalf("Can't get notary registry info: %v", err)
|
||||
}
|
||||
|
||||
if notary.Deposited != false {
|
||||
if notary.Deposited {
|
||||
t.Fatalf("Notary has not registered. Got deposited flag: %v", notary.Deposited)
|
||||
}
|
||||
|
||||
@ -89,7 +89,7 @@ func TestNotaryRegister(t *testing.T) {
|
||||
|
||||
notary, err = smc.NotaryRegistry(&bind.CallOpts{}, notaryPoolAddr[0])
|
||||
|
||||
if notary.Deposited != true &&
|
||||
if !notary.Deposited &&
|
||||
notary.PoolIndex.Cmp(big.NewInt(0)) != 0 &&
|
||||
notary.DeregisteredPeriod.Cmp(big.NewInt(0)) != 0 {
|
||||
t.Fatalf("Incorrect notary registry. Want - deposited:true, index:0, period:0"+
|
||||
@ -109,7 +109,7 @@ func TestNotaryRegister(t *testing.T) {
|
||||
|
||||
notary, err = smc.NotaryRegistry(&bind.CallOpts{}, notaryPoolAddr[1])
|
||||
|
||||
if notary.Deposited != true &&
|
||||
if !notary.Deposited &&
|
||||
notary.PoolIndex.Cmp(big.NewInt(1)) != 0 &&
|
||||
notary.DeregisteredPeriod.Cmp(big.NewInt(0)) != 0 {
|
||||
t.Fatalf("Incorrect notary registry. Want - deposited:true, index:1, period:0"+
|
||||
@ -118,7 +118,7 @@ func TestNotaryRegister(t *testing.T) {
|
||||
|
||||
notary, err = smc.NotaryRegistry(&bind.CallOpts{}, notaryPoolAddr[2])
|
||||
|
||||
if notary.Deposited != true &&
|
||||
if !notary.Deposited &&
|
||||
notary.PoolIndex.Cmp(big.NewInt(2)) != 0 &&
|
||||
notary.DeregisteredPeriod.Cmp(big.NewInt(0)) != 0 {
|
||||
t.Fatalf("Incorrect notary registry. Want - deposited:true, index:2, period:0"+
|
||||
@ -148,7 +148,7 @@ func TestNotaryRegisterInsufficientEther(t *testing.T) {
|
||||
notary, _ := smc.NotaryRegistry(&bind.CallOpts{}, addr)
|
||||
numNotaries, _ := smc.NotaryPoolLength(&bind.CallOpts{})
|
||||
|
||||
if notary.Deposited != false {
|
||||
if notary.Deposited {
|
||||
t.Fatalf("Notary deposited with insufficient fund")
|
||||
}
|
||||
|
||||
@ -171,7 +171,7 @@ func TestNotaryDoubleRegisters(t *testing.T) {
|
||||
notary, _ := smc.NotaryRegistry(&bind.CallOpts{}, addr)
|
||||
numNotaries, _ := smc.NotaryPoolLength(&bind.CallOpts{})
|
||||
|
||||
if notary.Deposited != true {
|
||||
if !notary.Deposited {
|
||||
t.Fatalf("Notary has not registered. Got deposited flag: %v", notary.Deposited)
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ func TestNotaryDeregister(t *testing.T) {
|
||||
notary, _ := smc.NotaryRegistry(&bind.CallOpts{}, addr)
|
||||
numNotaries, _ := smc.NotaryPoolLength(&bind.CallOpts{})
|
||||
|
||||
if notary.Deposited != true {
|
||||
if !notary.Deposited {
|
||||
t.Fatalf("Notary has not registered. Got deposited flag: %v", notary.Deposited)
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@ func TestNotaryDeregisterThenRegister(t *testing.T) {
|
||||
notary, _ := smc.NotaryRegistry(&bind.CallOpts{}, addr)
|
||||
numNotaries, _ := smc.NotaryPoolLength(&bind.CallOpts{})
|
||||
|
||||
if notary.Deposited != true {
|
||||
if !notary.Deposited {
|
||||
t.Fatalf("Notary has not registered. Got deposited flag: %v", notary.Deposited)
|
||||
}
|
||||
|
||||
@ -300,7 +300,7 @@ func TestNotaryRelease(t *testing.T) {
|
||||
notary, _ := smc.NotaryRegistry(&bind.CallOpts{}, addr)
|
||||
numNotaries, _ := smc.NotaryPoolLength(&bind.CallOpts{})
|
||||
|
||||
if notary.Deposited != true {
|
||||
if !notary.Deposited {
|
||||
t.Fatalf("Notary has not registered. Got deposited flag: %v", notary.Deposited)
|
||||
}
|
||||
|
||||
@ -343,7 +343,7 @@ func TestNotaryRelease(t *testing.T) {
|
||||
t.Fatalf("Can't get notary registry info: %v", err)
|
||||
}
|
||||
|
||||
if notary.Deposited != false {
|
||||
if notary.Deposited {
|
||||
t.Fatalf("Notary deposit flag should be false after released")
|
||||
}
|
||||
|
||||
@ -368,7 +368,7 @@ func TestNotaryInstantRelease(t *testing.T) {
|
||||
notary, _ := smc.NotaryRegistry(&bind.CallOpts{}, addr)
|
||||
numNotaries, _ := smc.NotaryPoolLength(&bind.CallOpts{})
|
||||
|
||||
if notary.Deposited != true {
|
||||
if !notary.Deposited {
|
||||
t.Fatalf("Notary has not registered. Got deposited flag: %v", notary.Deposited)
|
||||
}
|
||||
|
||||
@ -403,7 +403,7 @@ func TestNotaryInstantRelease(t *testing.T) {
|
||||
t.Fatalf("Can't get notary registry info: %v", err)
|
||||
}
|
||||
|
||||
if notary.Deposited != true {
|
||||
if !notary.Deposited {
|
||||
t.Fatalf("Notary deposit flag should be true before released")
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user