MCPcopy Create free account
hub / github.com/PolyhedraZK/ExpanderCompilerCollection / DetectFieldIdFromFile

Function DetectFieldIdFromFile

ecgo/layered/serialize.go:170–188  ·  view source on GitHub ↗
(fn string)

Source from the content-addressed store, hash-verified

168}
169
170func DetectFieldIdFromFile(fn string) uint64 {
171 // Read the first 4 bytes of the file
172 file, err := os.Open(fn)
173 if err != nil {
174 panic(err)
175 }
176 defer file.Close()
177 buf := make([]byte, 40)
178 n, err := file.Read(buf)
179 if err != nil || n != 40 {
180 panic(err)
181 }
182 in := utils.NewInputBuf(buf)
183 if in.ReadUint64() != MAGIC {
184 panic("invalid file header")
185 }
186 f := in.ReadBigInt(32)
187 return field.GetFieldId(field.GetFieldFromOrder(f))
188}

Callers 2

ProveFileFunction · 0.92
VerifyFileFunction · 0.92

Calls 5

ReadUint64Method · 0.95
ReadBigIntMethod · 0.95
NewInputBufFunction · 0.92
GetFieldIdFunction · 0.92
GetFieldFromOrderFunction · 0.92

Tested by

no test coverage detected