mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-04 00:44:27 +00:00
sharding/proposer: beginning addHeader test
Former-commit-id: 02b04a635b1f54c6a6bf76bcfea779a83f0439e7 [formerly 0741baedf7ca864162bf61796242c78adba4cc60] Former-commit-id: 68fe8324ba9bd1f03355632262be1d1e47162505
This commit is contained in:
parent
df211116c0
commit
57f5595eb5
@ -1 +1,41 @@
|
||||
package proposer
|
||||
|
||||
import (
|
||||
"github.com/ethereum/go-ethereum/accounts/abi/bind"
|
||||
"github.com/ethereum/go-ethereum/accounts/abi/bind/backends"
|
||||
"github.com/ethereum/go-ethereum/core"
|
||||
"github.com/ethereum/go-ethereum/crypto"
|
||||
"github.com/ethereum/go-ethereum/sharding/contracts"
|
||||
"math/big"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var (
|
||||
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
||||
addr = crypto.PubkeyToAddress(key.PublicKey)
|
||||
accountBalance = big.NewInt(1001000000000000000000)
|
||||
)
|
||||
|
||||
type mockClient struct {
|
||||
smc *contracts.SMC
|
||||
t *testing.T
|
||||
}
|
||||
|
||||
func (m *mockClient) SMCCaller() *contracts.SMCCaller {
|
||||
return &m.smc.SMCCaller
|
||||
}
|
||||
|
||||
func (m *mockClient) SMCTransactor() *contracts.SMCTransactor {
|
||||
return &m.smc.SMCTransactor
|
||||
}
|
||||
|
||||
func transactOpts() *bind.TransactOpts {
|
||||
return bind.NewKeyedTransactor(key)
|
||||
}
|
||||
|
||||
func setup() (*backends.SimulatedBackend, *contracts.SMC) {
|
||||
backend := backends.NewSimulatedBackend(core.GenesisAlloc{addr: {Balance: accountBalance}})
|
||||
_, _, smc, _ := contracts.DeploySMC(transactOpts(), backend)
|
||||
backend.Commit()
|
||||
return backend, smc
|
||||
}
|
Loading…
Reference in New Issue
Block a user