Skip to content

Commit

Permalink
Merge pull request #513 from frankcrypto2023/fixtest
Browse files Browse the repository at this point in the history
fix evm test
  • Loading branch information
dindinw authored Aug 31, 2023
2 parents fbff948 + 2f77c6b commit 672e1dc
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
14 changes: 10 additions & 4 deletions testutils/evm.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
7 changes: 4 additions & 3 deletions testutils/harness_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 672e1dc

Please sign in to comment.