core/vm: EIP-2315, JUMPSUB for the EVM (#20619)
* core/vm: implement EIP 2315, subroutines for the EVM * core/vm: eip 2315 - lintfix + check jump dest validity + check ret stack size constraints logger: markdown-friendly traces, validate jumpdest, more testcase, correct opcodes * core/vm: update subroutines acc to eip: disallow walk-into * core/vm/eips: gas cost changes for subroutines * core/vm: update opcodes for EIP-2315 * core/vm: define RETURNSUB as a 'jumping' operation + review concerns Co-authored-by: Martin Holst Swende <martin@swende.se>
This commit is contained in:
@ -23,6 +23,7 @@ func (s StructLog) MarshalJSON() ([]byte, error) {
|
||||
Memory hexutil.Bytes `json:"memory"`
|
||||
MemorySize int `json:"memSize"`
|
||||
Stack []*math.HexOrDecimal256 `json:"stack"`
|
||||
ReturnStack []math.HexOrDecimal64 `json:"returnStack"`
|
||||
Storage map[common.Hash]common.Hash `json:"-"`
|
||||
Depth int `json:"depth"`
|
||||
RefundCounter uint64 `json:"refund"`
|
||||
@ -43,6 +44,12 @@ func (s StructLog) MarshalJSON() ([]byte, error) {
|
||||
enc.Stack[k] = (*math.HexOrDecimal256)(v)
|
||||
}
|
||||
}
|
||||
if s.ReturnStack != nil {
|
||||
enc.ReturnStack = make([]math.HexOrDecimal64, len(s.ReturnStack))
|
||||
for k, v := range s.ReturnStack {
|
||||
enc.ReturnStack[k] = math.HexOrDecimal64(v)
|
||||
}
|
||||
}
|
||||
enc.Storage = s.Storage
|
||||
enc.Depth = s.Depth
|
||||
enc.RefundCounter = s.RefundCounter
|
||||
@ -62,6 +69,7 @@ func (s *StructLog) UnmarshalJSON(input []byte) error {
|
||||
Memory *hexutil.Bytes `json:"memory"`
|
||||
MemorySize *int `json:"memSize"`
|
||||
Stack []*math.HexOrDecimal256 `json:"stack"`
|
||||
ReturnStack []math.HexOrDecimal64 `json:"returnStack"`
|
||||
Storage map[common.Hash]common.Hash `json:"-"`
|
||||
Depth *int `json:"depth"`
|
||||
RefundCounter *uint64 `json:"refund"`
|
||||
@ -95,6 +103,12 @@ func (s *StructLog) UnmarshalJSON(input []byte) error {
|
||||
s.Stack[k] = (*big.Int)(v)
|
||||
}
|
||||
}
|
||||
if dec.ReturnStack != nil {
|
||||
s.ReturnStack = make([]uint64, len(dec.ReturnStack))
|
||||
for k, v := range dec.ReturnStack {
|
||||
s.ReturnStack[k] = uint64(v)
|
||||
}
|
||||
}
|
||||
if dec.Storage != nil {
|
||||
s.Storage = dec.Storage
|
||||
}
|
||||
|
Reference in New Issue
Block a user