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

Add transaction signer #850

Merged
merged 11 commits into from
Oct 9, 2024
Merged

Add transaction signer #850

merged 11 commits into from
Oct 9, 2024

Conversation

otherview
Copy link
Member

@otherview otherview commented Sep 16, 2024

Description

There seems to be a lot of repetition around the build and the signing of transactions.
Most recognizable by the fact that different tests have built different helpers to make these operations faster.

This PR enhances the tx package to help in this case:

  • Introduces the following methods:

MustSignTx(tx *Transaction, pk *ecdsa.PrivateKey) *Transaction

MustCustomSignTx(sign SignFunction, tx *Transaction, pk *ecdsa.PrivateKey) *Transaction

SignTx(tx *Transaction, pk *ecdsa.PrivateKey) (*Transaction, error)

CustomSignTx(sign SignFunction, tx *Transaction, pk *ecdsa.PrivateKey) (*Transaction, error)

DelegatorSignTx(tx *Transaction, pk *ecdsa.PrivateKey) (*Transaction, error)

CustomDelegatorSignTx(sign SignFunction, tx *Transaction, pk *ecdsa.PrivateKey) (*Transaction, error)

Fixes # (issue)

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • New and existing E2E tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules
  • I have not added any vulnerable dependencies to my code

@otherview otherview requested a review from a team as a code owner September 16, 2024 14:57
@codecov-commenter
Copy link

codecov-commenter commented Sep 16, 2024

Codecov Report

Attention: Patch coverage is 44.82759% with 16 lines in your changes missing coverage. Please review.

Project coverage is 62.63%. Comparing base (48cead2) to head (5c15945).

Files with missing lines Patch % Lines
tx/signer.go 40.74% 13 Missing and 3 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #850      +/-   ##
==========================================
- Coverage   62.65%   62.63%   -0.03%     
==========================================
  Files         208      209       +1     
  Lines       18926    18952      +26     
==========================================
+ Hits        11858    11870      +12     
- Misses       5970     5982      +12     
- Partials     1098     1100       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

packer/packer_test.go Outdated Show resolved Hide resolved
txpool/tx_object_test.go Outdated Show resolved Hide resolved
txpool/tx_object_test.go Outdated Show resolved Hide resolved
tx/builder.go Outdated Show resolved Hide resolved
tx/signer.go Outdated Show resolved Hide resolved
tx/signer.go Outdated Show resolved Hide resolved
darrenvechain
darrenvechain previously approved these changes Sep 26, 2024
tx/signer.go Outdated Show resolved Hide resolved
tx/signer.go Outdated Show resolved Hide resolved
tx/signer.go Outdated Show resolved Hide resolved
tx/signer.go Outdated Show resolved Hide resolved
Co-authored-by: libotony <[email protected]>
@libotony libotony changed the title Enhance Tx Builder Add transaction signer Oct 9, 2024
@otherview otherview merged commit a0e5a44 into master Oct 9, 2024
15 checks passed
@otherview otherview deleted the pedro/enhance_tx_builder branch October 9, 2024 10:10
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.

5 participants