Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
trinhdn2 committed Jun 20, 2023
1 parent 5cae6e4 commit 120c02f
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 10 deletions.
6 changes: 2 additions & 4 deletions core/types/transaction.go
Expand Up @@ -26,11 +26,9 @@ import (
"sync/atomic"
"time"

"github.com/tomochain/tomochain/crypto"

"github.com/tomochain/tomochain/common/math"

"github.com/tomochain/tomochain/common"
"github.com/tomochain/tomochain/common/math"
"github.com/tomochain/tomochain/crypto"
"github.com/tomochain/tomochain/rlp"
)

Expand Down
7 changes: 4 additions & 3 deletions eth/tracers/tracers_test.go
Expand Up @@ -20,17 +20,18 @@ import (
"crypto/ecdsa"
"crypto/rand"
"encoding/json"
"github.com/tomochain/tomochain/core/rawdb"
"io/ioutil"
"math/big"
"path/filepath"
"reflect"
"strings"
"testing"

"github.com/tomochain/tomochain/common"
"github.com/tomochain/tomochain/common/hexutil"
"github.com/tomochain/tomochain/common/math"
"github.com/tomochain/tomochain/core"
"github.com/tomochain/tomochain/core/rawdb"
"github.com/tomochain/tomochain/core/types"
"github.com/tomochain/tomochain/core/vm"
"github.com/tomochain/tomochain/crypto"
Expand Down Expand Up @@ -178,7 +179,7 @@ func TestPrestateTracerCreate2(t *testing.T) {
}
evm := vm.NewEVM(context, statedb, nil, params.MainnetChainConfig, vm.Config{Debug: true, Tracer: tracer})

msg, err := tx.AsMessage(signer, nil, nil)
msg, err := core.TransactionToMessage(signer, nil, nil)
if err != nil {
t.Fatalf("failed to prepare transaction for tracing: %v", err)
}
Expand Down Expand Up @@ -253,7 +254,7 @@ func TestCallTracer(t *testing.T) {
}
evm := vm.NewEVM(context, statedb, nil, test.Genesis.Config, vm.Config{Debug: true, Tracer: tracer})

msg, err := tx.AsMessage(signer, nil, common.Big0)
msg, err := core.TransactionToMessage(signer, nil, common.Big0)
if err != nil {
t.Fatalf("failed to prepare transaction for tracing: %v", err)
}
Expand Down
16 changes: 14 additions & 2 deletions les/odr_test.go
Expand Up @@ -19,14 +19,14 @@ package les
import (
"bytes"
"context"
"github.com/tomochain/tomochain/core/rawdb"
"math/big"
"testing"
"time"

"github.com/tomochain/tomochain/common"
"github.com/tomochain/tomochain/common/math"
"github.com/tomochain/tomochain/core"
"github.com/tomochain/tomochain/core/rawdb"
"github.com/tomochain/tomochain/core/state"
"github.com/tomochain/tomochain/core/types"
"github.com/tomochain/tomochain/core/vm"
Expand Down Expand Up @@ -110,7 +110,7 @@ func odrAccounts(ctx context.Context, db ethdb.Database, config *params.ChainCon
//func TestOdrContractCallLes2(t *testing.T) { testOdr(t, 2, 2, odrContractCall) }

type callmsg struct {
types.Message
core.Message
}

func (callmsg) CheckNonce() bool { return false }
Expand All @@ -133,6 +133,18 @@ func odrContractCall(ctx context.Context, db ethdb.Database, config *params.Chai
if value, ok := feeCapacity[testContractAddr]; ok {
balanceTokenFee = value
}
//msg := &Message{
// To: call.To,
// From: call.From,
// Value: call.Value,
// GasLimit: call.Gas,
// GasPrice: call.GasPrice,
// GasFeeCap: call.GasFeeCap,
// GasTipCap: call.GasTipCap,
// Data: call.Data,
// AccessList: call.AccessList,
// SkipAccountChecks: false,
//}
msg := callmsg{types.NewMessage(from.Address(), &testContractAddr, 0, new(big.Int), 100000, new(big.Int), data, false, balanceTokenFee)}

context := core.NewEVMContext(msg, header, bc, nil)
Expand Down
2 changes: 1 addition & 1 deletion light/odr_test.go
Expand Up @@ -148,7 +148,7 @@ func odrAccounts(ctx context.Context, db ethdb.Database, bc *core.BlockChain, lc
func TestOdrContractCallLes1(t *testing.T) { testChainOdr(t, 1, odrContractCall) }

type callmsg struct {
types.Message
core.Message
}

func (callmsg) CheckNonce() bool { return false }
Expand Down

0 comments on commit 120c02f

Please sign in to comment.