Compare commits

..

3 Commits

Author SHA1 Message Date
georgehao
54a418f88a feat: update 2023-11-15 18:13:35 +08:00
georgehao
a5c0dace15 feat: reduce the fetch limit size 2023-11-15 17:53:35 +08:00
Steven
4aa5d5cd37 fix (prover): close file handles used in prover (#1007)
Co-authored-by: HAOYUatHZ <37070449+HAOYUatHZ@users.noreply.github.com>
2023-11-07 16:50:43 +08:00
3 changed files with 8 additions and 1 deletions

View File

@@ -18,7 +18,7 @@ import (
// Todo : read from config
var (
// the number of blocks fetch per round
fetchLimit = uint64(3000)
fetchLimit = uint64(100)
)
// FetchAndSave is a function type that fetches events from blockchain and saves them to database

View File

@@ -236,6 +236,11 @@ func (p *ProverCore) mayDumpProof(id string, proofByt []byte) error {
if err != nil {
return err
}
defer func() {
if err = f.Close(); err != nil {
log.Error("failed to close proof dump file", "id", id, "error", err)
}
}()
log.Info("Saving proof", "task-id", id)
_, err = f.Write(proofByt)
return err

View File

@@ -92,6 +92,7 @@ func TestFFI(t *testing.T) {
func readChunkTrace(filePat string, as *assert.Assertions) []*types.BlockTrace {
f, err := os.Open(filePat)
as.NoError(err)
defer as.NoError(f.Close())
byt, err := io.ReadAll(f)
as.NoError(err)
@@ -104,6 +105,7 @@ func readChunkTrace(filePat string, as *assert.Assertions) []*types.BlockTrace {
func readVk(filePat string, as *assert.Assertions) string {
f, err := os.Open(filePat)
as.NoError(err)
defer as.NoError(f.Close())
byt, err := io.ReadAll(f)
as.NoError(err)