aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGustav Simonsson <gustav.simonsson@gmail.com>2015-05-15 22:05:11 +0800
committerGustav Simonsson <gustav.simonsson@gmail.com>2015-05-15 22:05:11 +0800
commitdadf01de60dee3d60b71ba354c40c657cdd4c34d (patch)
tree97a814f72fe396dcf6d8b92c5800257d5553781e /tests
parentc1f0d40e34a80f4453a9a54f90e2d4551c3bdb05 (diff)
downloaddexon-dadf01de60dee3d60b71ba354c40c657cdd4c34d.tar
dexon-dadf01de60dee3d60b71ba354c40c657cdd4c34d.tar.gz
dexon-dadf01de60dee3d60b71ba354c40c657cdd4c34d.tar.bz2
dexon-dadf01de60dee3d60b71ba354c40c657cdd4c34d.tar.lz
dexon-dadf01de60dee3d60b71ba354c40c657cdd4c34d.tar.xz
dexon-dadf01de60dee3d60b71ba354c40c657cdd4c34d.tar.zst
dexon-dadf01de60dee3d60b71ba354c40c657cdd4c34d.zip
unskip StateTests/stTransactionTest and use test tx nonce
Diffstat (limited to 'tests')
-rw-r--r--tests/helper/vm.go10
-rw-r--r--tests/vm/gh_test.go1
2 files changed, 6 insertions, 5 deletions
diff --git a/tests/helper/vm.go b/tests/helper/vm.go
index fb3fb40a5..6a1b9a0f1 100644
--- a/tests/helper/vm.go
+++ b/tests/helper/vm.go
@@ -163,6 +163,7 @@ func RunState(statedb *state.StateDB, env, tx map[string]string) ([]byte, state.
gas = common.Big(tx["gasLimit"])
price = common.Big(tx["gasPrice"])
value = common.Big(tx["value"])
+ nonce = common.Big(tx["nonce"]).Uint64()
caddr = common.HexToAddress(env["currentCoinbase"])
)
@@ -178,7 +179,7 @@ func RunState(statedb *state.StateDB, env, tx map[string]string) ([]byte, state.
coinbase := statedb.GetOrNewStateObject(caddr)
coinbase.SetGasPool(common.Big(env["currentGasLimit"]))
- message := NewMessage(common.BytesToAddress(keyPair.Address()), to, data, value, gas, price)
+ message := NewMessage(common.BytesToAddress(keyPair.Address()), to, data, value, gas, price, nonce)
vmenv := NewEnvFromMap(statedb, env, tx)
vmenv.origin = common.BytesToAddress(keyPair.Address())
ret, _, err := core.ApplyMessage(vmenv, message, coinbase)
@@ -195,10 +196,11 @@ type Message struct {
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) Message {
- return Message{from, to, value, gas, price, data}
+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 }
@@ -207,5 +209,5 @@ 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 0 }
+func (self Message) Nonce() uint64 { return self.nonce }
func (self Message) Data() []byte { return self.data }
diff --git a/tests/vm/gh_test.go b/tests/vm/gh_test.go
index 2545affe5..612537ddf 100644
--- a/tests/vm/gh_test.go
+++ b/tests/vm/gh_test.go
@@ -320,7 +320,6 @@ func TestStateLog(t *testing.T) {
}
func TestStateTransaction(t *testing.T) {
- t.Skip()
const fn = "../files/StateTests/stTransactionTest.json"
RunVmTest(fn, t)
}