Skip to content

--db SQLite persistence: slot/blockHeight resets to 0 on restart #635

@zekikucukkose

Description

@zekikucukkose

Summary

When using --db /path/to/file.sqlite, surfpool correctly persists account state across restarts, but does not restore the slot/blockHeight. The chain always restarts from slot ~0 regardless of what was in the database.

Reproduction

  # Run surfpool with a persistent DB
  surfpool start --port 8899 --no-deploy --no-studio --offline \                                                                   
    --db /tmp/test.sqlite                                                                                                          
                                                                                                                                   
  # Let it run until slot > 100 (~40 seconds), then Ctrl+C                                                                         
                                                                                                                                   
  # Confirm the checkpoint WAS written to the DB                                                                                   
  sqlite3 /tmp/test.sqlite \                                                                                                     
    "SELECT * FROM slot_checkpoint"                                                                                                
  # → default | "latest_slot" | 270 | ...   ← row exists                                                                           
                                                                                                                                   
  # Restart with the same DB                                                                                                       
  surfpool start --port 8899 --no-deploy --no-studio --offline \                                                                   
    --db /tmp/test.sqlite                                                                                                          
                                                                                                                                   
  # Check slot                                                                                                                     
  curl -s -X POST -H 'Content-Type: application/json' \                                                                            
    -d '{"jsonrpc":"2.0","id":1,"method":"getSlot"}' \                                                                             
    http://localhost:8899/                                                                                                         
  # → {"result": 12}   ← reset to 0, not restored from 270   

Environment

  • Surfpool 1.1.1 and 1.2.0 (both affected)
  • Docker surfpool/surfpool:1.2.0 (linux/arm64 and linux/amd64) and native macOS arm64 binary

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions