aboutsummaryrefslogtreecommitdiffstats
path: root/core/evm.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@dexon.org>2018-11-05 13:49:08 +0800
committerWei-Ning Huang <w@dexon.org>2019-03-12 12:19:09 +0800
commit1a75ec877713fb50021410a5d0474563299b16a0 (patch)
tree9d6fc5e152769faad486a0b5f4f894c68165ee1e /core/evm.go
parentfd48d4b21645ee8fd8cfafe63f7bd2630bb77611 (diff)
downloaddexon-1a75ec877713fb50021410a5d0474563299b16a0.tar.gz
dexon-1a75ec877713fb50021410a5d0474563299b16a0.tar.zst
dexon-1a75ec877713fb50021410a5d0474563299b16a0.zip
core: validate roundHeight mapping in governance contract
Diffstat (limited to 'core/evm.go')
-rw-r--r--core/evm.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/core/evm.go b/core/evm.go
index 1fb47199b..d9ba7921c 100644
--- a/core/evm.go
+++ b/core/evm.go
@@ -18,6 +18,7 @@ package core
import (
"math/big"
+ "sync"
"github.com/dexon-foundation/dexon/common"
"github.com/dexon-foundation/dexon/consensus"
@@ -33,6 +34,9 @@ type ChainContext interface {
// GetHeader returns the hash corresponding to their hash.
GetHeader(common.Hash, uint64) *types.Header
+
+ // GetRoundHeightMap returns the mapping between round and height.
+ GetRoundHeightMap() sync.Map
}
// NewEVMContext creates a new context for use in the EVM.
@@ -54,6 +58,7 @@ func NewEVMContext(msg Message, header *types.Header, chain ChainContext, author
Time: new(big.Int).Set(header.Time),
Randomness: header.Randomness,
Difficulty: new(big.Int).Set(header.Difficulty),
+ RoundHeight: chain.GetRoundHeightMap(),
GasLimit: header.GasLimit,
GasPrice: new(big.Int).Set(msg.GasPrice()),
}