@kalepail pointed out that the Env::from_snapshot_file is misleading it looks like it takes a snapshot file from the CLI, but the CLI actually outputs ledger snapshots that need to be given to Env::from_ledger_snapshot_file.
Env::from_snapshot_file is for test snapshots that contain not only the ledger but an entire snapshot of the test environment.
Env::from_ledger_snapshot_file is for ledger snapshots that can come from a test environment or from a deployed network like pubnet or testnet.
It's unfortunate that we have two competing concepts that are easily confusable.
It might be difficult to rename these functions now, but we can at least provide a meaningful error pointing a developer towards the fix they need. We can detect if the file is a ledger only and tell the develoepr to use Env::from_ledger_snapshot_file.
@kalepail pointed out that the Env::from_snapshot_file is misleading it looks like it takes a snapshot file from the CLI, but the CLI actually outputs ledger snapshots that need to be given to Env::from_ledger_snapshot_file.
Env::from_snapshot_file
is for test snapshots that contain not only the ledger but an entire snapshot of the test environment.Env::from_ledger_snapshot_file
is for ledger snapshots that can come from a test environment or from a deployed network like pubnet or testnet.It's unfortunate that we have two competing concepts that are easily confusable.
It might be difficult to rename these functions now, but we can at least provide a meaningful error pointing a developer towards the fix they need. We can detect if the file is a ledger only and tell the develoepr to use
Env::from_ledger_snapshot_file
.Discussion: