aboutsummaryrefslogtreecommitdiffstats
path: root/ethchain/stack.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-03-21 21:47:55 +0800
committerobscuren <geffobscura@gmail.com>2014-03-21 21:47:55 +0800
commit2ea4c632d1673b762c1af11582364d9faa08c413 (patch)
treec9e87a5d79eb1bbeaee691a056a2e6974b6ba3f5 /ethchain/stack.go
parentfa1db8d2dcbc12fd9b343e6572c541d92fe7cb55 (diff)
downloadgo-tangerine-2ea4c632d1673b762c1af11582364d9faa08c413.tar
go-tangerine-2ea4c632d1673b762c1af11582364d9faa08c413.tar.gz
go-tangerine-2ea4c632d1673b762c1af11582364d9faa08c413.tar.bz2
go-tangerine-2ea4c632d1673b762c1af11582364d9faa08c413.tar.lz
go-tangerine-2ea4c632d1673b762c1af11582364d9faa08c413.tar.xz
go-tangerine-2ea4c632d1673b762c1af11582364d9faa08c413.tar.zst
go-tangerine-2ea4c632d1673b762c1af11582364d9faa08c413.zip
Closure return, arguments fixed. Added proper tests
Diffstat (limited to 'ethchain/stack.go')
-rw-r--r--ethchain/stack.go52
1 files changed, 26 insertions, 26 deletions
diff --git a/ethchain/stack.go b/ethchain/stack.go
index c75d02dda..b64b759fd 100644
--- a/ethchain/stack.go
+++ b/ethchain/stack.go
@@ -36,24 +36,22 @@ const (
oSHA3 = 0x20
// 0x30 range - closure state
- oADDRESS = 0x30
- oBALANCE = 0x31
- oORIGIN = 0x32
- oCALLER = 0x33
- oCALLVALUE = 0x34
- oCALLDATA = 0x35
- oCALLDATASIZE = 0x36
- oRETURNDATASIZE = 0x37
- oTXGASPRICE = 0x38
+ oADDRESS = 0x30
+ oBALANCE = 0x31
+ oORIGIN = 0x32
+ oCALLER = 0x33
+ oCALLVALUE = 0x34
+ oCALLDATA = 0x35
+ oCALLDATASIZE = 0x36
+ oGASPRICE = 0x37
// 0x40 range - block operations
oPREVHASH = 0x40
- oPREVNONCE = 0x41
- oCOINBASE = 0x42
- oTIMESTAMP = 0x43
- oNUMBER = 0x44
- oDIFFICULTY = 0x45
- oGASLIMIT = 0x46
+ oCOINBASE = 0x41
+ oTIMESTAMP = 0x42
+ oNUMBER = 0x43
+ oDIFFICULTY = 0x44
+ oGASLIMIT = 0x45
// 0x50 range - 'storage' and execution
oPUSH = 0x50
@@ -108,19 +106,17 @@ var opCodeToString = map[OpCode]string{
oSHA3: "SHA3",
// 0x30 range - closure state
- oADDRESS: "ADDRESS",
- oBALANCE: "BALANCE",
- oORIGIN: "ORIGIN",
- oCALLER: "CALLER",
- oCALLVALUE: "CALLVALUE",
- oCALLDATA: "CALLDATA",
- oCALLDATASIZE: "CALLDATASIZE",
- oRETURNDATASIZE: "RETURNDATASIZE",
- oTXGASPRICE: "TXGASPRICE",
+ oADDRESS: "ADDRESS",
+ oBALANCE: "BALANCE",
+ oORIGIN: "ORIGIN",
+ oCALLER: "CALLER",
+ oCALLVALUE: "CALLVALUE",
+ oCALLDATA: "CALLDATA",
+ oCALLDATASIZE: "CALLDATASIZE",
+ oGASPRICE: "TXGASPRICE",
// 0x40 range - block operations
oPREVHASH: "PREVHASH",
- oPREVNONCE: "PREVNONCE",
oCOINBASE: "COINBASE",
oTIMESTAMP: "TIMESTAMP",
oNUMBER: "NUMBER",
@@ -244,7 +240,11 @@ func (m *Memory) Get(offset, size int64) []byte {
func (m *Memory) Print() {
fmt.Println("### MEM ###")
if len(m.store) > 0 {
- fmt.Println(m.store)
+ addr := 0
+ for i := 0; i+32 < len(m.store); i += 32 {
+ fmt.Printf("%03d %v\n", addr, m.store[i:i+32])
+ addr++
+ }
} else {
fmt.Println("-- empty --")
}