aboutsummaryrefslogtreecommitdiffstats
path: root/core/vm/opcodes.go
diff options
context:
space:
mode:
authorWei-Ning Huang <w@cobinhood.com>2018-10-18 13:12:16 +0800
committerWei-Ning Huang <w@dexon.org>2019-04-09 21:32:50 +0800
commit6137f79f726e8ec6a282ee0ca4ed45c05020ed4c (patch)
tree9a9e5c3cc01e0a7c1898799562e13fabeaf608d5 /core/vm/opcodes.go
parent1fa4415d48e4ed7ee0f75ed21e62847ea68d3a0f (diff)
downloadgo-tangerine-6137f79f726e8ec6a282ee0ca4ed45c05020ed4c.tar
go-tangerine-6137f79f726e8ec6a282ee0ca4ed45c05020ed4c.tar.gz
go-tangerine-6137f79f726e8ec6a282ee0ca4ed45c05020ed4c.tar.bz2
go-tangerine-6137f79f726e8ec6a282ee0ca4ed45c05020ed4c.tar.lz
go-tangerine-6137f79f726e8ec6a282ee0ca4ed45c05020ed4c.tar.xz
go-tangerine-6137f79f726e8ec6a282ee0ca4ed45c05020ed4c.tar.zst
go-tangerine-6137f79f726e8ec6a282ee0ca4ed45c05020ed4c.zip
core: vm: implement RAND opcode support
DEXON has a built-in on chain random oracle that allow one to retrieve a random variable. Add a new opcode `RAND` to load the random variable onto the stack.
Diffstat (limited to 'core/vm/opcodes.go')
-rw-r--r--core/vm/opcodes.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/core/vm/opcodes.go b/core/vm/opcodes.go
index 4349ffd29..8762d4b43 100644
--- a/core/vm/opcodes.go
+++ b/core/vm/opcodes.go
@@ -71,6 +71,7 @@ const (
SAR
SHA3 = 0x20
+ RAND = 0x2f
)
// 0x30 range - closure state.
@@ -251,6 +252,7 @@ var opCodeToString = map[OpCode]string{
// 0x20 range - crypto.
SHA3: "SHA3",
+ RAND: "RAND",
// 0x30 range - closure state.
ADDRESS: "ADDRESS",
@@ -420,6 +422,7 @@ var stringToOp = map[string]OpCode{
"ADDMOD": ADDMOD,
"MULMOD": MULMOD,
"SHA3": SHA3,
+ "RAND": RAND,
"ADDRESS": ADDRESS,
"BALANCE": BALANCE,
"ORIGIN": ORIGIN,