@@ -3,7 +3,6 @@ package codetrie
33import (
44 "encoding/binary"
55 "errors"
6- "fmt"
76 "math"
87
98 sszlib "github.com/ferranbt/fastssz"
@@ -33,17 +32,13 @@ type CodeTrie interface {
3332 GetTree () (* sszlib.Node , error )
3433}
3534
36- const (
37- FIOUnset = 0xff
38- )
39-
4035type Chunk struct {
4136 fio uint8 // firstInstructionOffset
4237 code []byte
4338}
4439
4540func NewChunk () * Chunk {
46- return & Chunk {fio : FIOUnset , code : nil }
41+ return & Chunk {fio : 0 , code : nil }
4742}
4843
4944func (c * Chunk ) Serialize () []byte {
@@ -208,21 +203,11 @@ func Chunkify(code []byte, chunkSize uint) []*Chunk {
208203 if i == numChunks - 1 {
209204 endIdx = uint (len (code ))
210205 }
211- chunks [i ] = & Chunk {fio : FIOUnset , code : code [startIdx :endIdx ]}
206+ chunks [i ] = & Chunk {fio : 0 , code : code [startIdx :endIdx ]}
212207 }
213208
214209 setFIO (chunks )
215210
216- // Sanity check that all chunks were processed
217- for i , _ := range chunks {
218- if i == len (chunks )- 1 {
219- break
220- }
221- if chunks [i ].fio == FIOUnset {
222- panic (fmt .Sprintf ("Chunk %d has unprocessed FIO" , i ))
223- }
224- }
225-
226211 return chunks
227212}
228213
@@ -238,11 +223,6 @@ func setFIO(chunks []*Chunk) {
238223 break
239224 }
240225
241- // This chunk was already processed (it is a data chunk continuation)
242- if chunks [i ].fio != FIOUnset {
243- continue
244- }
245-
246226 for j , op := range chunk .code {
247227 opcode := OpCode (op )
248228 // Push is the only opcode with immediate
0 commit comments