aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/state_test_util.go3
-rw-r--r--tests/transaction_test_util.go13
-rw-r--r--tests/util.go23
-rw-r--r--tests/vm_test_util.go7
4 files changed, 12 insertions, 34 deletions
diff --git a/tests/state_test_util.go b/tests/state_test_util.go
index c8899392a..c08398321 100644
--- a/tests/state_test_util.go
+++ b/tests/state_test_util.go
@@ -29,6 +29,7 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/state"
+ "github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/vm"
"github.com/ethereum/go-ethereum/crypto"
"github.com/ethereum/go-ethereum/ethdb"
@@ -225,7 +226,7 @@ func RunState(chainConfig *params.ChainConfig, statedb *state.StateDB, env, tx m
key, _ := hex.DecodeString(tx["secretKey"])
addr := crypto.PubkeyToAddress(crypto.ToECDSA(key).PublicKey)
- message := NewMessage(addr, to, data, value, gas, price, nonce)
+ message := types.NewMessage(addr, to, nonce, value, gas, price, data)
vmenv := NewEnvFromMap(chainConfig, statedb, env, tx)
vmenv.origin = addr
diff --git a/tests/transaction_test_util.go b/tests/transaction_test_util.go
index be3514737..184bdee2a 100644
--- a/tests/transaction_test_util.go
+++ b/tests/transaction_test_util.go
@@ -159,16 +159,11 @@ func verifyTxFields(txTest TransactionTest, decodedTx *types.Transaction) (err e
}
}()
- var (
- decodedSender common.Address
- )
+ var decodedSender common.Address
chainConfig := &params.ChainConfig{HomesteadBlock: params.MainNetHomesteadBlock}
- if chainConfig.IsHomestead(common.String2Big(txTest.Blocknumber)) {
- decodedSender, err = decodedTx.From()
- } else {
- decodedSender, err = decodedTx.FromFrontier()
- }
+ signer := types.MakeSigner(chainConfig, common.String2Big(txTest.Blocknumber))
+ decodedSender, err = types.Sender(signer, decodedTx)
if err != nil {
return err
}
@@ -198,7 +193,7 @@ func verifyTxFields(txTest TransactionTest, decodedTx *types.Transaction) (err e
return fmt.Errorf("Nonce mismatch: %v %v", expectedNonce, decodedTx.Nonce())
}
- v, r, s := decodedTx.SignatureValues()
+ v, r, s := types.SignatureValues(signer, decodedTx)
expectedR := mustConvertBigInt(txTest.Transaction.R, 16)
if r.Cmp(expectedR) != 0 {
return fmt.Errorf("R mismatch: %v %v", expectedR, r)
diff --git a/tests/util.go b/tests/util.go
index 5296bb54b..53955a47f 100644
--- a/tests/util.go
+++ b/tests/util.go
@@ -282,26 +282,3 @@ func (self *Env) Create(caller vm.ContractRef, data []byte, gas, price, value *b
return core.Create(self, caller, data, gas, price, value)
}
}
-
-type Message struct {
- from common.Address
- to *common.Address
- value, gas, price *big.Int
- data []byte
- nonce uint64
-}
-
-func NewMessage(from common.Address, to *common.Address, data []byte, value, gas, price *big.Int, nonce uint64) Message {
- return Message{from, to, value, gas, price, data, nonce}
-}
-
-func (self Message) Hash() []byte { return nil }
-func (self Message) From() (common.Address, error) { return self.from, nil }
-func (self Message) FromFrontier() (common.Address, error) { return self.from, nil }
-func (self Message) To() *common.Address { return self.to }
-func (self Message) GasPrice() *big.Int { return self.price }
-func (self Message) Gas() *big.Int { return self.gas }
-func (self Message) Value() *big.Int { return self.value }
-func (self Message) Nonce() uint64 { return self.nonce }
-func (self Message) CheckNonce() bool { return true }
-func (self Message) Data() []byte { return self.data }
diff --git a/tests/vm_test_util.go b/tests/vm_test_util.go
index f00af87b9..50660134b 100644
--- a/tests/vm_test_util.go
+++ b/tests/vm_test_util.go
@@ -225,7 +225,12 @@ func RunVm(state *state.StateDB, env, exec map[string]string) ([]byte, vm.Logs,
caller := state.GetOrNewStateObject(from)
- vmenv := NewEnvFromMap(&params.ChainConfig{params.MainNetHomesteadBlock, params.MainNetDAOForkBlock, true, nil, common.Hash{}, nil}, state, env, exec)
+ chainConfig := &params.ChainConfig{
+ HomesteadBlock: params.MainNetHomesteadBlock,
+ DAOForkBlock: params.MainNetDAOForkBlock,
+ DAOForkSupport: true,
+ }
+ vmenv := NewEnvFromMap(chainConfig, state, env, exec)
vmenv.vmTest = true
vmenv.skipTransfer = true
vmenv.initial = true