aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/instructions.go
diff options
context:
space:
mode:
authorNick Johnson <arachnid@notdot.net>2017-01-17 19:19:50 +0800
committerFelix Lange <fjl@users.noreply.github.com>2017-01-17 19:19:50 +0800
commit17d92233d9e64b642fed9a992556f7ff7d6fda18 (patch)
treee655a85d9d31c3377aef21b441c8b2c44df0aeff /core/vm/instructions.go
parent26d385c18b5eb003d9a69ff618c78acbe594db44 (diff)
downloadgo-tangerine-17d92233d9e64b642fed9a992556f7ff7d6fda18.tar.gz
go-tangerine-17d92233d9e64b642fed9a992556f7ff7d6fda18.tar.zst
go-tangerine-17d92233d9e64b642fed9a992556f7ff7d6fda18.zip
cmd/geth, core: add support for recording SHA3 preimages (#3543)
Diffstat (limited to 'core/vm/instructions.go')
-rw-r--r--core/vm/instructions.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/core/vm/instructions.go b/core/vm/instructions.go
index 5bfa73a30..3b1b06cca 100644
--- a/core/vm/instructions.go
+++ b/core/vm/instructions.go
@@ -247,7 +247,12 @@ func opMulmod(pc *uint64, env *EVM, contract *Contract, memory *Memory, stack *S
func opSha3(pc *uint64, env *EVM, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
offset, size := stack.pop(), stack.pop()
- hash := crypto.Keccak256(memory.Get(offset.Int64(), size.Int64()))
+ data := memory.Get(offset.Int64(), size.Int64())
+ hash := crypto.Keccak256(data)
+
+ if env.vmConfig.EnablePreimageRecording {
+ env.StateDB.AddPreimage(common.BytesToHash(hash), data)
+ }
stack.push(common.BytesToBig(hash))
return nil, nil