aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-11-27 13:21:54 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:54 +0800
commit39d08a8ae65a37adfb774fdbf6e0f6247e94bda5 (patch)
tree759533eca5a46cc5e03e736f674293ac2302e849
parent0f595a79c871281c6a1bef2c9cafcf2e5e4105b9 (diff)
downloaddexon-39d08a8ae65a37adfb774fdbf6e0f6247e94bda5.tar.gz
dexon-39d08a8ae65a37adfb774fdbf6e0f6247e94bda5.tar.zst
dexon-39d08a8ae65a37adfb774fdbf6e0f6247e94bda5.zip
tests: fix tests
-rw-r--r--.gitmodules2
-rw-r--r--core/evm.go11
-rw-r--r--tests/init_test.go4
3 files changed, 13 insertions, 4 deletions
diff --git a/.gitmodules b/.gitmodules
index 32bdb3b6e..e1f82719d 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
[submodule "tests"]
path = tests/testdata
- url = https://github.com/ethereum/tests
+ url = https://github.com/dexon-foundation/tests
diff --git a/core/evm.go b/core/evm.go
index 80b0eaa7a..04bc173f5 100644
--- a/core/evm.go
+++ b/core/evm.go
@@ -60,7 +60,7 @@ func NewEVMContext(msg Message, header *types.Header, chain ChainContext, author
Transfer: Transfer,
GetHash: GetHashFn(header, chain),
StateAtNumber: StateAtNumberFn(chain),
- GetRoundHeight: chain.GetRoundHeight,
+ GetRoundHeight: GetRoundHeightFn(chain),
Origin: msg.From(),
Coinbase: beneficiary,
BlockNumber: new(big.Int).Set(header.Number),
@@ -81,6 +81,15 @@ func StateAtNumberFn(chain ChainContext) func(n uint64) (*state.StateDB, error)
}
}
+func GetRoundHeightFn(chain ChainContext) func(uint64) (uint64, bool) {
+ if chain != nil {
+ return chain.GetRoundHeight
+ }
+ return func(uint64) (uint64, bool) {
+ return 0, false
+ }
+}
+
// GetHashFn returns a GetHashFunc which retrieves header hashes by number
func GetHashFn(ref *types.Header, chain ChainContext) func(n uint64) common.Hash {
var cache map[uint64]common.Hash
diff --git a/tests/init_test.go b/tests/init_test.go
index 7a0bd4635..048f405d2 100644
--- a/tests/init_test.go
+++ b/tests/init_test.go
@@ -34,8 +34,8 @@ import (
)
var (
- baseDir = filepath.Join(".", "testdata")
- blockTestDir = filepath.Join(baseDir, "BlockchainTests")
+ baseDir = filepath.Join(".", "testdata")
+ // blockTestDir = filepath.Join(baseDir, "BlockchainTests")
stateTestDir = filepath.Join(baseDir, "GeneralStateTests")
transactionTestDir = filepath.Join(baseDir, "TransactionTests")
vmTestDir = filepath.Join(baseDir, "VMTests")