aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm_env.go
diff options
context:
space:
mode:
authorJeffrey Wilcke <geffobscura@gmail.com>2016-06-18 17:17:57 +0800
committerPéter Szilágyi <peterke@gmail.com>2016-06-22 16:38:25 +0800
commit7a5b571c671e70e0e4807cf971c15e2d1e09d33d (patch)
tree4ae6b6e4be80171e26aab26b88124cd87a3c53d4 /core/vm_env.go
parent599e3c7b3f22b157c4f643a48d391cf972384099 (diff)
downloadgo-tangerine-7a5b571c671e70e0e4807cf971c15e2d1e09d33d.tar.gz
go-tangerine-7a5b571c671e70e0e4807cf971c15e2d1e09d33d.tar.zst
go-tangerine-7a5b571c671e70e0e4807cf971c15e2d1e09d33d.zip
test, cmd/evm, core, core/vm: illegal code hash implementation
This implements a generic approach to enabling soft forks by allowing anyone to put in hashes of contracts that should not be interacted from. This will help "The DAO" in their endevour to stop any whithdrawals from any DAO contract by convincing the mining community to accept their code hash.
Diffstat (limited to 'core/vm_env.go')
-rw-r--r--core/vm_env.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/core/vm_env.go b/core/vm_env.go
index 599672382..1c1110280 100644
--- a/core/vm_env.go
+++ b/core/vm_env.go
@@ -25,6 +25,8 @@ import (
"github.com/ethereum/go-ethereum/core/vm"
)
+var IllegalCodeHashes map[common.Hash]struct{}
+
// GetHashFn returns a function for which the VM env can query block hashes through
// up to the limit defined by the Yellow Paper and uses the given block chain
// to query for information.
@@ -47,6 +49,8 @@ type VMEnv struct {
depth int // Current execution depth
msg Message // Message appliod
+ CodeHashes []common.Hash // code hashes collected during execution
+
header *types.Header // Header information
chain *BlockChain // Blockchain handle
logs []vm.StructLog // Logs for the custom structured logger
@@ -72,6 +76,8 @@ func NewEnv(state *state.StateDB, chainConfig *ChainConfig, chain *BlockChain, m
return env
}
+func (self *VMEnv) MarkCodeHash(hash common.Hash) { self.CodeHashes = append(self.CodeHashes, hash) }
+
func (self *VMEnv) RuleSet() vm.RuleSet { return self.chainConfig }
func (self *VMEnv) Vm() vm.Vm { return self.evm }
func (self *VMEnv) Origin() common.Address { f, _ := self.msg.From(); return f }