-
Notifications
You must be signed in to change notification settings - Fork 3
feat: cookbook v1 #9
feat: cookbook v1 #9
Conversation
.github/workflows/gh-pages.yml
Outdated
- name: Deploy | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./cookbook/book |
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.
@tcharding this is totally wrong, I am adding as a placeholder now.
I'll update once I finish to add the content.
Feel free to comment, edit, contribute...
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.
I'm very far from a GitHub actions expert, please take my lack of comments on the actions stuff as "I don't know enough to comment right now but I don't see anything too crazy"
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.
I will update this soon with the correct code and any questions or if you feel something is odd let me know...
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.
@tcharding the CI action for gh-pages deployment is ready to review. Should work now.
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.
Double-checked once again and made slight tweaks. This should work now.
Ready for review, right? Perhaps squash it all down into a single commit, its going to be a punish to rebase otherwise. Since its the first major work on the cookbook its fine to be one enormous commit (at least I'm fine to review it as such). I got super excited when I ran (FTR I'm going to review it now as is still.) |
+1 to squashing into one commit -- though if you wanna be really nice, you could maybe split it into sections and make each one its own commit, or something. |
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.
Man this is so thorough! I did not review the taproot example, many of the comments on the segwit one will apply I'm guessing. I'll give you time to use/ignore my suggestions then review the taproot one.
Top work bro!
.github/workflows/gh-pages.yml
Outdated
- name: Deploy | ||
uses: peaceiris/actions-gh-pages@v3 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
publish_dir: ./cookbook/book |
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.
I'm very far from a GitHub actions expert, please take my lack of comments on the actions stuff as "I don't know enough to comment right now but I don't see anything too crazy"
I thought you guys did "squash merge" here. But I can squash it sure. We don't squash merge. We try to follow:
EDIT (tcharding): Ouch, I managed to edit your post yesterday instead of replying, sorry about that. FTR the answer here is written by me (tcharding). Sorry @realeinherjar, was not on purpose. |
This PR is already bucket loads of work, speaking for myself I'd prefer you use your effort for real fixes to the cookbook rather than worrying about rebasing. This is example/docs code, its not as critical that we catch mistakes (which is a large part of what spitting it up helps achieve). |
We have "do not automatically run CI for first time contributors" configured, if you want to use CI runs during dev of this you could throw up a trivial PR doing something else and we can merge it for you. |
I see, I will fix something easy and then tag you as a reviewer. |
I've added the segwit suggestions to the taproot one as well, since there was a lot of overlap. |
Great, will review - likely won't get to it today but I'll get to it. Thanks man. |
…s should be enclose in ` cb0cfe4 fix(README): markdown URLs should be enclose in ` (Einherjar) Pull request description: Just a quick fix so I can run CI in #9. #9 (comment) Cc @tcharding ACKs for top commit: tcharding: ACK cb0cfe4 Tree-SHA512: 9ea55c3dc24d69b71e00a588968563a19ff767a2c0c8ae5917361675f887c9668b7575f7baa3221687c1211ac004d4b8be9b36dfe8cd839341fedcd7250bd552
A quick rebase and force push and CI should run for you :) |
@tcharding note that the new GitHub CI for GH Pages replaces the bash script you've made (I'm deleting it). Additionally, I think you've done everything necessary to host a GH Page in a custom domain. Could you check them to see if we need to do anything else. |
Updated the examples from rust-bitcoin/rust-bitcoin#2095. |
I'm not getting what you are trying to achieve with the blockers? Are you thinking this won't merge until after the next release? |
I can revert back.
Since, this linked to the new But we can merge with the current |
oh sorry mate if I caused confusion. I meant to just link you to code that worked to show what was needed :) To clarify so we are both on the same page, I think the cookbook should depend on the latest released version and we should use the soon-to-merge code in |
Ok, gotcha. |
The serialization is correct in 0.30 its just that the API is easy to mis-use. As an example the code FTR one of the |
I knew this cookbook was a good idea and would shake things out. |
Just noticed that there is a commit with a mention in the git brief message - (Is this some sort of auto-generated patch by github?) Just to clarify, how we tend to do things is:
I hope my previous reviews did not lead you to the current git logs, I am trying to get better at reviewing :) |
Totally agree with this.
I did it. But I've rebase everything to 2 commits :) @tcharding this should be ready to review and merge now. |
In this repo I'd like to maintain the same merge policy as in the rest of
For (3) we want the format of the git message to be "describe why the change is needed" then "describe what the change is" (if trivial the git brief message can act as the "what"). So, can you please update the commit logs of the 2 patches? (And please don't use mentions (@superstar) in the git logs because doing so causes GitHub to spam the user with notifications. |
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.
Only reviewed segwit example. I think most comments are nit and can be addressed later if needed, but the script_code one should be addressed.
This is the `cargo` commands that you need to run this example: | ||
|
||
```bash | ||
cargo add bitcoin --features "std, rand-std" |
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.
@tcharding, I think this is bug in rust-bitcoin. I would expect rand-std
to include std
.
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.
cookbook/src/tx_segwit-v0.md
Outdated
.push(&pk.serialize()); | ||
|
||
// Print the transaction ready to broadcast | ||
let tx = sighash_cache.into_transaction(); |
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.
While sighash_cache::witness_mut
this is a fine way to do sighash operations, I feel that it really non-intuitive. It is primarily to avoid allocations when iterating through tx inputs while creating witnesses.
I feel the below is better for a tutorial/cookbook.
// Update the witness wpkh stack: signature + public key.
let pk = sk.public_key(&secp);
let mut witness = &mut tx.input[0].witness;
witness.push_bitcoin_signature(
&sig.serialize_der(),
EcdsaSighashType::All
);
witness.push(&pk.serialize());
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.
I've updated how we are mutating the witness in both segwit and taproot with your suggestion.
Can you check it now please?
@sanket1729 thanks for the review and suggestions. Here are the permalinks for easy visualization Segwit: www.rust-bitcoin.org/cookbook/src/tx_segwit-v0.md Lines 208 to 229 in f15e680
Taproot www.rust-bitcoin.org/cookbook/src/tx_taproot.md Lines 212 to 241 in f15e680
|
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.
ACK 2993048
I've acked but can you re-write the commit logs before this is considered for merge please. Also I'm not totally confident in my ability to review the github actions stuff, especially the deployment, but if it works its way better than the script I had hacked up. We will find out soon enough when we merge, YOLO! |
FTR I served the cookbook locally and it looks awesome! |
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.
ACK 2993048. Just reviewed the examples for correctness and verified that I can serve the files locally.
I am not too familiar with github actions stuff going on here, but this is good to go from my side.
Cookbook on how to sign segwit and taproot transactions Additionally: - Convert `build.sh` to a GitHub Action - Automated CI in GitHub Actions that test all the code in the cookbook - Automated scheduled CI in GitHub Actions that check all markdown files for broken links - Dependabot to update (weekly) - GitHub Actions - Test dependencies - `justfile` to easy run the build and test with `just`
Thanks for the reviews and for dedicating time to help in the making of this content. I am 99% certain on the GitHub Pages deployment. @tcharding I've squashed all to a single commit and changed the commit message. |
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.
ACK cee4953
Looks good, lets go! |
I checked the diff since you reviewed @sanket1729 and its only changes to the github actions etc., no code changes to the examlpes. I'll let this sit over the weekend then merge it unless anyone wants more time to look. |
utACK cee4953. Go ahead |
Doesn't look like this has been deployed. I cleared my cache and checked the site. Did not investigate further (its the weekend here). |
Ok I was asleep. Looks like some Hugo error. I will debug it and submit a fix in the next hours. |
Fix in #14 @tcharding |
No sweat, thanks for the fix. Was cool to wake up and have this fixed already. |
@tcharding the website builds ok now. The instructions are here: https://docs.github.com/en/pages/getting-started-with-github-pages/configuring-a-publishing-source-for-your-github-pages-site#publishing-from-a-branch Finally, since it is a custom domain you might need to do some tweaks explained here: https://docs.github.com/en/pages/configuring-a-custom-domain-for-your-github-pages-site/about-custom-domains-and-github-pages EDIT: If you are struggling with this, let me know. We can jump in a quick call and I can guide you through if necessary... |
Oh, this is my fault for not remembering how I set this up. How I had the build script and the repos set up doesn't work with the actions stuff we just merged. I had it so that this repo was just the source code and the actual site, once built, was pushed to https://github.com/rust-bitcoin/rust-bitcoin.github.io/tree/master. That repo has the custom domain etc. configured already. The reasoning behind this split was so that the source code was not entangled with the hosting service (currently github pages) so that if we wanted to move to a different host it was trivial to do. Other maintainers, if I remember correctly, didn't really see the need for this so I guess we could just delete the other repo and configure github pages from this repo. I'm fasting at the moment and in general I really hate doing any sort of web development, but I'll come back to this once I'me eating again. |
As always if you need an extra pair of hands let me know... |
build.sh
to a GitHub Actions and closes Generated HTML does not include the logo #6..github/workflows/test.yml
rust-bitcoin
docs):.github/workflows/check-links.yml
.github/dependabot.yml
:rust-bitcoin
new versions dependabot will open a PR here to updatejustfile
to easy run the build and test withjust
This is how you receive data over P2Pmoved to feat: Cookbook on how you receive data over P2P rust-bitcoin.github.io#9.This is how you parse blocks and transactionsmoved to feat: Cookbook on how you parse blocks and transactions rust-bitcoin.github.io#8.Details
I want this cookbook to be tested automatically on CI, so the code will always run.
The only solution that worked for me was this workaround that is used in The Rust Rand Book.