mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-19 21:31:37 +00:00
backends: increase gaslimit in order to allow tests of large contracts (#17358)
This commit is contained in:
parent
165510daef
commit
eb90b2899f
4 changed files with 10 additions and 8 deletions
|
|
@ -141,10 +141,11 @@ func NewXDCSimulatedBackend(alloc core.GenesisAlloc, gasLimit uint64, chainConfi
|
|||
|
||||
// NewSimulatedBackend creates a new binding backend using a simulated blockchain
|
||||
// for testing purposes.
|
||||
//
|
||||
// A simulated backend always uses chainID 1337.
|
||||
func NewSimulatedBackend(alloc core.GenesisAlloc) *SimulatedBackend {
|
||||
func NewSimulatedBackend(alloc core.GenesisAlloc, gasLimit uint64) *SimulatedBackend {
|
||||
database := rawdb.NewMemoryDatabase()
|
||||
genesis := core.Genesis{Config: params.AllEthashProtocolChanges, Alloc: alloc, GasLimit: 42000000}
|
||||
genesis := core.Genesis{Config: params.AllEthashProtocolChanges, GasLimit: gasLimit, Alloc: alloc}
|
||||
genesis.MustCommit(database)
|
||||
blockchain, _ := core.NewBlockChain(database, nil, genesis.Config, ethash.NewFaker(), vm.Config{})
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ func TestRandomize(t *testing.T) {
|
|||
|
||||
func TestSendTxRandomizeSecretAndOpening(t *testing.T) {
|
||||
genesis := core.GenesisAlloc{acc1Addr: {Balance: big.NewInt(1000000000000)}}
|
||||
backend := backends.NewSimulatedBackend(genesis)
|
||||
backend := backends.NewSimulatedBackend(genesis, 42000000)
|
||||
backend.Commit()
|
||||
signer := types.HomesteadSigner{}
|
||||
ctx := context.Background()
|
||||
|
|
|
|||
|
|
@ -2,15 +2,16 @@ package tests
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"math/big"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/XinFinOrg/XDPoSChain/accounts/abi/bind"
|
||||
"github.com/XinFinOrg/XDPoSChain/accounts/abi/bind/backends"
|
||||
"github.com/XinFinOrg/XDPoSChain/common"
|
||||
"github.com/XinFinOrg/XDPoSChain/core"
|
||||
"github.com/XinFinOrg/XDPoSChain/crypto"
|
||||
"github.com/XinFinOrg/XDPoSChain/log"
|
||||
"math/big"
|
||||
"os"
|
||||
"testing"
|
||||
)
|
||||
|
||||
var (
|
||||
|
|
@ -27,7 +28,7 @@ func TestPriceFeed(t *testing.T) {
|
|||
// init genesis
|
||||
contractBackend := backends.NewSimulatedBackend(core.GenesisAlloc{
|
||||
mainAddr: {Balance: big.NewInt(0).Mul(big.NewInt(10000000000000), big.NewInt(10000000000000))},
|
||||
})
|
||||
}, 42000000)
|
||||
transactOpts := bind.NewKeyedTransactor(mainKey)
|
||||
// deploy payer swap SMC
|
||||
addr, contract, err := DeployMyInherited(transactOpts, contractBackend)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ func TestFeeTxWithTRC21Token(t *testing.T) {
|
|||
// init genesis
|
||||
contractBackend := backends.NewSimulatedBackend(core.GenesisAlloc{
|
||||
mainAddr: {Balance: big.NewInt(0).Mul(big.NewInt(10000000000000), big.NewInt(10000000000000))},
|
||||
})
|
||||
}, 42000000)
|
||||
transactOpts := bind.NewKeyedTransactor(mainKey)
|
||||
// deploy payer swap SMC
|
||||
trc21IssuerAddr, trc21Issuer, err := DeployTRC21Issuer(transactOpts, contractBackend, minApply)
|
||||
|
|
|
|||
Loading…
Reference in a new issue