From 2f77c6b1db3891f8ef94a4805b42ecda308cea81 Mon Sep 17 00:00:00 2001 From: james Date: Thu, 31 Aug 2023 11:45:33 +0800 Subject: [PATCH] fix evm test --- testutils/evm.go | 14 ++++++++++---- testutils/harness_test.go | 7 ++++--- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/testutils/evm.go b/testutils/evm.go index 039dfce0..a6917d01 100644 --- a/testutils/evm.go +++ b/testutils/evm.go @@ -9,6 +9,10 @@ import ( "crypto/ecdsa" "encoding/hex" "errors" + "log" + "math/big" + "strings" + "github.com/Qitmeer/qng/meerevm/params" "github.com/Qitmeer/qng/testutils/swap/factory" "github.com/Qitmeer/qng/testutils/swap/router" @@ -17,9 +21,6 @@ import ( "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" - "log" - "math/big" - "strings" ) var CHAIN_ID = params.QngPrivnetChainConfig.ChainID @@ -89,7 +90,12 @@ func (w *testWallet) CreateRouter(factory, weth common.Address) (string, error) func (w *testWallet) AuthTrans(privatekeybyte []byte) (*bind.TransactOpts, error) { privateKey := crypto.ToECDSAUnsafe(privatekeybyte) - return bind.NewKeyedTransactorWithChainID(privateKey, CHAIN_ID) + authCaller, err := bind.NewKeyedTransactorWithChainID(privateKey, CHAIN_ID) + if err != nil { + return nil, err + } + authCaller.GasLimit = uint64(GAS_LIMIT) + return authCaller, nil } func (w *testWallet) CreateLegacyTx(fromPkByte []byte, to *common.Address, nonce uint64, gas uint64, val *big.Int, d []byte) (string, error) { diff --git a/testutils/harness_test.go b/testutils/harness_test.go index 215256a0..45771697 100644 --- a/testutils/harness_test.go +++ b/testutils/harness_test.go @@ -5,12 +5,13 @@ package testutils_test import ( - "github.com/Qitmeer/qng/core/types" - "github.com/Qitmeer/qng/params" - . "github.com/Qitmeer/qng/testutils" "sync" "testing" "time" + + "github.com/Qitmeer/qng/core/types" + "github.com/Qitmeer/qng/params" + . "github.com/Qitmeer/qng/testutils" ) func TestHarness(t *testing.T) {