Skip to content

Commit

Permalink
Zkevm allow jumpdest in push n (#1011)
Browse files Browse the repository at this point in the history
* fix jumpn

* hack

* add docs

---------

Co-authored-by: Igor Mandrigin <[email protected]>
  • Loading branch information
hexoscott and mandrigin authored Aug 23, 2024
1 parent 569ec3b commit bd75618
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
8 changes: 8 additions & 0 deletions core/vm/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ func getData(data []byte, start uint64, size uint64) []byte {
// getDataBig returns a slice from the data based on the start and size and pads
// up to size with zero's. This function is overflow safe.
func getDataBig(data []byte, start *uint256.Int, size uint64) []byte {
/*
* zkEVM hack: we need to limit the size of the memory to 1GB
* for witness generation purpose we execute opcodes even if they are out of gas.
* that could lead to a huge memory allocation (in the reported case 400GB)
*/
if size >= 1*1024*1024*1024 {
size = 1 * 1024 * 1024 * 1024
}
start64, overflow := start.Uint64WithOverflow()
if overflow {
start64 = ^uint64(0)
Expand Down
5 changes: 4 additions & 1 deletion core/vm/contract.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ func (c *Contract) validJumpdest(dest *uint256.Int) (bool, bool) {
if c.skipAnalysis {
return true, false
}
return c.isCode(udest), true
/*
* zkEVM doesn't do dynamic jumpdest analysis. So PUSHN is not considered.
*/
return true, false
}

func isCodeFromAnalysis(analysis []uint64, udest uint64) bool {
Expand Down

0 comments on commit bd75618

Please sign in to comment.