Skip to content

[DRAFT] WIP Qml Load Snapshot Onboarding #449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

D33r-Gee
Copy link
Contributor

@D33r-Gee D33r-Gee commented May 5, 2025

Based on #424. This is a WIP.

UTXO Snapshot Loading with Onboarding Support

Overview

This PR enables loading a signet UTXO snapshot at height 160,000, during the initial onboarding process.

What This PR Does

  1. Enables snapshot selection during onboarding, with loading when headers are synced

Implementation Details

Core Components Modified

  1. CPP Backend (src/qml/models/nodemodel.cpp)
  • Adds support for storing snapshot file path during onboarding
  • Implements automatic snapshot loading once headers are synced
  1. UI Components (src/qml/components/SnapshotSettings.qml, src/qml/components/ConnectionSettings.qml)
  • File selection dialog with onboarding awareness
  • Snapshot verification status
  • Progress tracking and visualization
  • Updated visibility conditions to enable loading during onboarding

Key Design Decisions

  1. Onboarding Integration
  • Allows users to select snapshot during setup
  • Delayed loading until headers are synced
  • Proper state handling between onboarding and regular modes

Testing Instructions

  1. Build
  2. Launch Bitcoin Core QML GUI
  3. Navigate to Connection Settings
  4. Test with sample snapshot:
magnet:?xt=urn:btih:9da986cb27b3980ea7fd06b21e199b148d486880&dn=utxo-signet-160000.dat
  1. Test onboarding flow:

    • Select a snapshot file during initial setup
    • Verify it loads automatically after headers sync
  2. Verify (see screenshots below):

    • "Snapshot Loaded" confirmation appears
    • Block clock shows ~50% progress
    • For errors, check debug.log for [snapshot] or [loadsnapshot] messages
Ubuntu 22.04 Screenshots

Screenshot 2025-05-05 154558
Screenshot 2025-05-05 154615
Load_UTXO_Snapshots_FileDialog
Screenshot 2025-05-05 154703
Screenshot 2025-05-05 154720
Screenshot 2025-05-05 154738

Expected Behavior

  • File selection dialog works
  • Success/failure state properly displayed
  • Node becomes usable while background validation continues
  • When selected during onboarding, snapshot loads after headers sync

Notes for Reviewers

Snapshot Compatibility

  • Currently only works with signet UTXO snapshot
  • Limited to specific 160,000 height
  • Validates against chain parameters m_assumeutxo_data
    (the changes there can be discarded once synced since m_assumeutxo_data is already hardcoded)

feedback welcome on the approach and implementation details.

@GBKS
Copy link
Contributor

GBKS commented May 9, 2025

I just tested this, screenshots of my journey are below.

assumeutxo-testing

There are various visual tweaks that need to be done to match the design, but those can be done in a follow-up PR. The auto-refresh for when headers are synced is nice. I don't think we covered this state ("headers are syncing") in the design, we should make sure to add it in.

Functionality-wise, the only problem I had was getting a snapshot file that works. The magnet link in the description did not have enough peers, and the one I downloaded here also did not work. Gee then directly sent me the file and that worked.

When using the wrong file, I was expecting a proper error message, but did not get one. The screen just went back to its original state. We should make sure to have good errors here, so people know how to do things correctly. Important requirements that people might frequently stumble over could also be put in the description.

I'll leave it to others to decide whether to merge this in or not, based on more technical evaluations and PR planning.

@D33r-Gee
Copy link
Contributor Author

D33r-Gee commented May 9, 2025

When using the wrong file, I was expecting a proper error message, but did not get one. The screen just went back to its original state. We should make sure to have good errors here, so people know how to do things correctly. Important requirements that people might frequently stumble over could also be put in the description.

Thanks @GBKS for testing and reviewing the design! I have incorporated your feedback in #424 since that one has been undrafted.

Will update this PR with the error handling next.

D33r-Gee added 4 commits May 9, 2025 12:19
- This introduce the UI flow to load a AssumeUTXO snapshot
- It modifies the connection settings
- Adds a SnapshotSettings file, Icon, and modified progress
bar.
- Also it adds error page on snapshotloading failure
- Extend node interface with virtual functions for UTXO snapshot loading
- Add signal mechanism to monitor snapshot loading progress
- Include predefined signet UTXO dataset in chainparams for validation
- Add SnapshotQml class to encapsulate snapshot loading operations
- Integrate QML properties for UTXO snapshot management
- Wire up snapshot loading functionality with node interface
- Update visibility conditions in ConnectionSettings and SnapshotSettings to enable loading during onboarding.
- Introduce new methods in NodeModel for handling snapshot file paths and loading logic based on header sync status.
- Ensure snapshot loading is triggered appropriately when headers are synced and a snapshot file path is set.
- Adds error handling on snapshot failure.
@D33r-Gee D33r-Gee force-pushed the qml-load-snapshot-onboarding branch from 5e0f7b4 to cac8de9 Compare May 9, 2025 19:52
@D33r-Gee
Copy link
Contributor Author

D33r-Gee commented May 9, 2025

with cac8de9 rebased on top of #424 to allow for error handling if an incorrect snapshot gets picked. This works with both the Onboarding and post onboarding use cases.

This is a WIP, feedback welcomed!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants