mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-19 02:12:23 +00:00
move blocknumber to blockhash
This commit is contained in:
parent
5de2a2da3f
commit
a7bd5d29de
2 changed files with 21 additions and 7 deletions
|
|
@ -75,7 +75,10 @@ func GetSignersFromContract(addrBlockSigner common.Address, client bind.Contract
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
opts := new(bind.CallOpts)
|
opts := new(bind.CallOpts)
|
||||||
addrs, err := blockSigner.GetSigners(opts, new(big.Int).SetUint64(blockNumber))
|
// TODO: let move from blockNumber to blockHash
|
||||||
|
// addrs, err := blockSigner.GetSigners(opts, new(big.Int).SetUint64(blockNumber))
|
||||||
|
log.Error("Should replace blockNumber to blockHash", blockNumber)
|
||||||
|
addrs, err := blockSigner.GetSigners(opts, [32]byte{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("Fail get block signers", "error", err)
|
log.Error("Fail get block signers", "error", err)
|
||||||
return nil, err
|
return nil, err
|
||||||
|
|
|
||||||
|
|
@ -9,11 +9,11 @@ import (
|
||||||
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
||||||
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
|
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
|
||||||
"github.com/ethereum/go-ethereum/common"
|
"github.com/ethereum/go-ethereum/common"
|
||||||
// "github.com/ethereum/go-ethereum/contracts"
|
"github.com/ethereum/go-ethereum/contracts"
|
||||||
// "github.com/ethereum/go-ethereum/contracts/validator/contract"
|
"github.com/ethereum/go-ethereum/contracts/validator/contract"
|
||||||
"github.com/ethereum/go-ethereum/core"
|
"github.com/ethereum/go-ethereum/core"
|
||||||
"github.com/ethereum/go-ethereum/crypto"
|
"github.com/ethereum/go-ethereum/crypto"
|
||||||
// "math/rand"
|
"math/rand"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
|
@ -65,7 +65,6 @@ func TestValidator(t *testing.T) {
|
||||||
contractBackend.Commit()
|
contractBackend.Commit()
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
func TestRewardBalance(t *testing.T) {
|
func TestRewardBalance(t *testing.T) {
|
||||||
contractBackend := backends.NewSimulatedBackend(core.GenesisAlloc{
|
contractBackend := backends.NewSimulatedBackend(core.GenesisAlloc{
|
||||||
acc1Addr: {Balance: new(big.Int).SetUint64(10000000)},
|
acc1Addr: {Balance: new(big.Int).SetUint64(10000000)},
|
||||||
|
|
@ -77,7 +76,20 @@ func TestRewardBalance(t *testing.T) {
|
||||||
accounts := []*bind.TransactOpts{acc1Opts, acc2Opts}
|
accounts := []*bind.TransactOpts{acc1Opts, acc2Opts}
|
||||||
transactOpts := bind.NewKeyedTransactor(acc1Key)
|
transactOpts := bind.NewKeyedTransactor(acc1Key)
|
||||||
|
|
||||||
validatorAddr, _, baseValidator, err := contract.DeployTomoValidator(transactOpts, contractBackend, big.NewInt(50000), big.NewInt(99), big.NewInt(100), big.NewInt(100))
|
// validatorAddr, _, baseValidator, err := contract.DeployTomoValidator(transactOpts, contractBackend, big.NewInt(50000), big.NewInt(99), big.NewInt(100), big.NewInt(100))
|
||||||
|
validatorCap := new(big.Int)
|
||||||
|
validatorCap.SetString("50000000000000000000000", 10)
|
||||||
|
validatorAddr, _, baseValidator, err := contract.DeployTomoValidator(
|
||||||
|
transactOpts,
|
||||||
|
contractBackend,
|
||||||
|
[]common.Address{addr},
|
||||||
|
[]*big.Int{validatorCap},
|
||||||
|
addr,
|
||||||
|
big.NewInt(50000),
|
||||||
|
big.NewInt(99),
|
||||||
|
big.NewInt(100),
|
||||||
|
big.NewInt(100),
|
||||||
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("can't deploy root registry: %v", err)
|
t.Fatalf("can't deploy root registry: %v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -146,4 +158,3 @@ func TestRewardBalance(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue