-
Notifications
You must be signed in to change notification settings - Fork 36
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
create and load tank snapshots #555
create and load tank snapshots #555
Conversation
@@ -135,3 +135,6 @@ baseConfig: | | |||
config: "" | |||
|
|||
connect: [] | |||
blocksDownload: | |||
enabled: false | |||
url: "https://storage.googleapis.com/warnet-signet-chains/0014d33b6e11ca95c4edccd8e986434358d79e919730/premined-signet.tar.gz" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this kind of hard-code is ok in a test but i dont think it belongs in a default
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, added "do not merge" to the title of the PR and added this as a todo in the description, will try to fix tomorrow.
6d33d3c
to
0fb66d1
Compare
if key is set, download and untar a blocks directory into the bitcoin datadir. its up to the user to make sure they are choosing an appropriate snapshot, e.g., if the snapshot was created from a signet chain then it can only be loaded into a signet node with the correct signet challenge. we can expand on this in the future to better export all of the relevant config details in the snapshot, but for now this just adds the ability to load files into pods before the pod starts.
tars a datadir based on a passed in filter (if no filter, zip everything) and copies the zip to the users host.
0fb66d1
to
cc1b6dc
Compare
This is very cool and I'm sure will be extremely useful! I've had an initial run through and it has worked as described in the description. I also think the init container architecture sounds good, so concept ack on that. Few initial thoughts before I dive into code review:
|
agree. there is an |
Or create snapshot directory should one not exist? |
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ConflictsNo conflicts as of last run. |
Code looks ok to me, fancy adding a little doc and we can get this merged? |
could do, but generally not a fan of creating dirs randomly on the users system, outside of a scoped warnet project directory. I think for now I'll leave it to "output dir is required" and then as we fine tune this whole project structure / snapshot management we can improve on it.
will do! |
allow a user to snapshot a single tank (with a filter) or snapshot all tanks with a filter. this creates a zip that can then be loaded via the initContainer in the first commit
228bec2
to
366465c
Compare
@m3dwards added a doc, and also took your suggestion of defaulting to |
LGTM. Like the doc! |
thx! working on a test locally but its a bit tricky given interactions with local fs etc, should have it finished tomorrow and will open a PR |
This has broken apidocs https://github.com/bitcoin-dev-project/warnet/actions/runs/10816493180/job/30007779318 |
@willcl-ark fixed #585 |
Given a url, download the blocks and start a node with this chain. This works by creating a temporary initContainer which downloads the file and untars it into the .bitcoin data dir. Once complete, the initContainer cleans itself up and the pod starts as normal.
Other nodes get this chain by doing IBD, or each node can be specified to start with its own snapshot. This could be useful for things like simulating a hard fork, chain split, etc.
For testing
I mined a signet chain to 200 blocks and created a snapshot using
warnet snapshot miner -f "chainstate,blocks,wallets"
. The network along with the snapshot is saved as a warnet project here: https://github.com/josibake/warnet-projects/tree/main/premined-signetTo test:
git clone [email protected]:josibake/warnet-projects.git && cd warnet-projects/premined-signet
uv venv && source .venv/bin/activate.fish && uv pip install -e ../../warnet
warnet deploy networks/cve_images_on_signet/
warnet bitcoin rpc miner loadwallet mining_wallet
warnet bitcoin rpc miner -getinfo
You should see something like the following:
.. which means your miner started with a premined chain and 5000 available coins in the wallet!
Bonus
warnet run scenarios/signet_miner.py --tank=0 generate --min-nbits --address=tb1qnsv03jqd7tkn2crd7jqv5wxwf2mmxl2l23w7rs --ongoing
warnet down && warnet deploy networks/cve_images_on_signet/
and verify you are back at your starting point of a 200 block chainTODO: