Skip to content
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

5. change(rpc): Implement coinbase conversion to RPC TransactionTemplate type #5554

Merged
merged 11 commits into from
Nov 7, 2022

Conversation

teor2345
Copy link
Collaborator

@teor2345 teor2345 commented Nov 4, 2022

Motivation

We want to calculate miner fees and transaction roots, then generate transaction templates.

This does everything except actually generating a coinbase transaction.

Part of #5453.

Specifications

coinbase_txn, transactions, and some root fields in:
https://zcash.github.io/rpc/getblocktemplate.html

Solution

  • Add conversion from coinbase Transactions into TransactionTemplates
    • Calculate the sigops using zebra-script, because we don't want to call the transaction verifier
  • Add a Network field to the getblocktemplate RPC handler
    • The network and block height are needed to generate the coinbase transaction

Refactors:

  • Split out a select_mempool_transactions() function
  • Cleanup redundant dependencies

Review

Anyone can review this PR.

Reviewer Checklist

  • Will the PR name make sense to users?
    • Does it need extra CHANGELOG info? (new features, breaking changes, large changes)
  • Are the PR labels correct?
  • Does the code do what the ticket and PR says?
  • How do you know it works? Does it have tests?

Follow Up Work

Actually generate the coinbase transaction

@teor2345 teor2345 added C-enhancement Category: This is an improvement P-Medium ⚡ A-rpc Area: Remote Procedure Call interfaces A-script Area: Script handling labels Nov 4, 2022
@teor2345 teor2345 requested a review from a team as a code owner November 4, 2022 04:40
@teor2345 teor2345 self-assigned this Nov 4, 2022
@teor2345 teor2345 requested review from arya2 and removed request for a team November 4, 2022 04:40
@github-actions github-actions bot added the C-feature Category: New features label Nov 4, 2022
@codecov
Copy link

codecov bot commented Nov 4, 2022

Codecov Report

Merging #5554 (9e899d9) into main (75f83fc) will decrease coverage by 0.05%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #5554      +/-   ##
==========================================
- Coverage   78.84%   78.78%   -0.06%     
==========================================
  Files         305      305              
  Lines       38126    38127       +1     
==========================================
- Hits        30061    30039      -22     
- Misses       8065     8088      +23     

Base automatically changed from refactor-tip-height to main November 4, 2022 18:19
Copy link
Contributor

@arya2 arya2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good! There's a small merge conflict with the select_mempool_transactions refactor.

zebra-rpc/src/methods/get_block_template_rpcs.rs Outdated Show resolved Hide resolved
@teor2345
Copy link
Collaborator Author

teor2345 commented Nov 6, 2022

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Nov 6, 2022

update

☑️ Nothing to do

  • #commits-behind>0 [:pushpin: update requirement]
  • -closed [:pushpin: update requirement]

@teor2345
Copy link
Collaborator Author

teor2345 commented Nov 7, 2022

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Nov 7, 2022

update

✅ Branch has been successfully updated

@teor2345
Copy link
Collaborator Author

teor2345 commented Nov 7, 2022

@Mergifyio update

@mergify
Copy link
Contributor

mergify bot commented Nov 7, 2022

update

✅ Branch has been successfully updated

@mergify mergify bot merged commit 516845a into main Nov 7, 2022
@mergify mergify bot deleted the add-coinbase branch November 7, 2022 17:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-rpc Area: Remote Procedure Call interfaces A-script Area: Script handling C-enhancement Category: This is an improvement C-feature Category: New features
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants