mirror of
https://gitlab.com/pulsechaincom/prysm-pulse.git
synced 2025-01-06 01:32:18 +00:00
66da19c50e
Former-commit-id: 0065f7844e971e5104894a1ea36e9955fd7f0faa [formerly 762b0597b7fdb88a7579d31c26efe9d7d6fd77a2] Former-commit-id: 89877b41108d3379e444cc3a4da20522b6db7f0d
34 lines
952 B
Go
34 lines
952 B
Go
package contracts
|
|
|
|
import (
|
|
"math/big"
|
|
"testing"
|
|
|
|
"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"
|
|
)
|
|
|
|
var (
|
|
key, _ = crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291")
|
|
addr = crypto.PubkeyToAddress(key.PublicKey)
|
|
)
|
|
|
|
func TestContractCreation(t *testing.T) {
|
|
contractBackend := backends.NewSimulatedBackend(core.GenesisAlloc{addr: {Balance: big.NewInt(1000000000)}})
|
|
transactOpts := bind.NewKeyedTransactor(key)
|
|
callOpts := bind.CallOpts{}
|
|
|
|
_, _, vmc, err := DeployVMC(transactOpts, contractBackend)
|
|
contractBackend.Commit()
|
|
if err != nil {
|
|
t.Fatalf("can't deploy VMC: %v", err)
|
|
}
|
|
|
|
gasLimit, err := vmc.GetCollationGasLimit(&callOpts)
|
|
if gasLimit.Cmp(new(big.Int).SetInt64(10000000)) != 0 {
|
|
t.Fatalf("collation gas limit should be 10000000 gas")
|
|
}
|
|
}
|