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:
@ -86,3 +86,22 @@ func (st *Stack) Print() {
|
||||
}
|
||||
fmt.Println("#############")
|
||||
}
|
||||
|
||||
// ReturnStack is an object for basic return stack operations.
|
||||
type ReturnStack struct {
|
||||
data []uint64
|
||||
}
|
||||
|
||||
func newReturnStack() *ReturnStack {
|
||||
return &ReturnStack{data: make([]uint64, 0, 1024)}
|
||||
}
|
||||
|
||||
func (st *ReturnStack) push(d uint64) {
|
||||
st.data = append(st.data, d)
|
||||
}
|
||||
|
||||
func (st *ReturnStack) pop() (ret uint64) {
|
||||
ret = st.data[len(st.data)-1]
|
||||
st.data = st.data[:len(st.data)-1]
|
||||
return
|
||||
}
|
||||
|
Reference in New Issue
Block a user