diff options
author | Jeffrey Wilcke <geffobscura@gmail.com> | 2016-06-18 17:17:57 +0800 |
---|---|---|
committer | Péter Szilágyi <peterke@gmail.com> | 2016-06-24 18:18:25 +0800 |
commit | a9c94cbf48fefe39104ee3495df139ff374dd219 (patch) | |
tree | f23b098a99765f7ef83c9448c6dd04ba27051379 /core/vm_env.go | |
parent | d2089e46f875cbfe3ac31ed8b78cb482ba4952f8 (diff) | |
download | go-tangerine-a9c94cbf48fefe39104ee3495df139ff374dd219.tar go-tangerine-a9c94cbf48fefe39104ee3495df139ff374dd219.tar.gz go-tangerine-a9c94cbf48fefe39104ee3495df139ff374dd219.tar.bz2 go-tangerine-a9c94cbf48fefe39104ee3495df139ff374dd219.tar.lz go-tangerine-a9c94cbf48fefe39104ee3495df139ff374dd219.tar.xz go-tangerine-a9c94cbf48fefe39104ee3495df139ff374dd219.tar.zst go-tangerine-a9c94cbf48fefe39104ee3495df139ff374dd219.zip |
[release/1.4.8] 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.
(cherry picked from commit 7a5b571c671e70e0e4807cf971c15e2d1e09d33d)
Diffstat (limited to 'core/vm_env.go')
-rw-r--r-- | core/vm_env.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/core/vm_env.go b/core/vm_env.go index f50140c68..3ef61b8ce 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 } |