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 Copy() to transaction.Transaction and payload.P2PNotaryRequest #3407

Merged
merged 5 commits into from
May 1, 2024

Conversation

AliceInHunterland
Copy link
Contributor

Close #3288

pkg/core/transaction/transaction.go Outdated Show resolved Hide resolved
pkg/core/transaction/witness.go Outdated Show resolved Hide resolved
pkg/core/transaction/witness.go Outdated Show resolved Hide resolved
pkg/core/transaction/transaction_test.go Show resolved Hide resolved
pkg/core/transaction/transaction_test.go Show resolved Hide resolved
pkg/network/payload/notary_request.go Outdated Show resolved Hide resolved
Copy link

codecov bot commented Apr 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 86.19%. Comparing base (198af7f) to head (8da7c0a).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3407      +/-   ##
==========================================
+ Coverage   86.13%   86.19%   +0.06%     
==========================================
  Files         331      331              
  Lines       38114    38210      +96     
==========================================
+ Hits        32828    32937     +109     
+ Misses       3773     3754      -19     
- Partials     1513     1519       +6     

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

pkg/core/transaction/transaction.go Outdated Show resolved Hide resolved
pkg/network/payload/notary_request.go Outdated Show resolved Hide resolved
pkg/network/payload/notary_request.go Outdated Show resolved Hide resolved
pkg/core/transaction/witness.go Outdated Show resolved Hide resolved
pkg/services/notary/notary.go Show resolved Hide resolved
pkg/services/notary/notary.go Show resolved Hide resolved
pkg/core/transaction/transaction.go Outdated Show resolved Hide resolved
pkg/core/transaction/transaction.go Outdated Show resolved Hide resolved
pkg/core/transaction/transaction_test.go Show resolved Hide resolved
pkg/core/transaction/witness.go Outdated Show resolved Hide resolved
pkg/network/payload/notary_request_test.go Outdated Show resolved Hide resolved
pkg/network/payload/notary_request_test.go Outdated Show resolved Hide resolved
pkg/services/notary/notary.go Show resolved Hide resolved
@AliceInHunterland
Copy link
Contributor Author

@AnnaShaleva Let's decide if the current copy implementation is okay before writing tests for all new copy() methods?

pkg/core/transaction/attribute.go Show resolved Hide resolved
pkg/core/transaction/attribute.go Outdated Show resolved Hide resolved
pkg/core/transaction/signer.go Outdated Show resolved Hide resolved
pkg/core/transaction/signer.go Outdated Show resolved Hide resolved
pkg/core/transaction/witness_condition.go Outdated Show resolved Hide resolved
pkg/core/transaction/witness_condition.go Show resolved Hide resolved
pkg/crypto/keys/publickey.go Outdated Show resolved Hide resolved
@AliceInHunterland AliceInHunterland force-pushed the copy-transaction branch 3 times, most recently from 5098928 to 84b50f4 Compare April 22, 2024 08:51
pkg/core/transaction/attribute.go Outdated Show resolved Hide resolved
pkg/core/transaction/attribute.go Outdated Show resolved Hide resolved
pkg/core/transaction/attribute.go Outdated Show resolved Hide resolved
pkg/core/transaction/attribute_test.go Outdated Show resolved Hide resolved
pkg/core/transaction/conflicts.go Outdated Show resolved Hide resolved
pkg/core/transaction/attribute_test.go Outdated Show resolved Hide resolved
pkg/core/transaction/attribute_test.go Outdated Show resolved Hide resolved
pkg/crypto/keys/publickey.go Show resolved Hide resolved
pkg/core/transaction/attribute_test.go Show resolved Hide resolved
pkg/core/transaction/signer.go Show resolved Hide resolved
@AliceInHunterland AliceInHunterland force-pushed the copy-transaction branch 3 times, most recently from 1c84171 to 13ab7de Compare April 23, 2024 15:36
pkg/core/transaction/attribute.go Show resolved Hide resolved
pkg/core/transaction/attribute.go Show resolved Hide resolved
pkg/core/transaction/attribute.go Show resolved Hide resolved
pkg/core/transaction/witness.go Show resolved Hide resolved
pkg/core/transaction/witness_condition.go Outdated Show resolved Hide resolved
pkg/core/transaction/witness_condition.go Outdated Show resolved Hide resolved
pkg/core/transaction/witness_condition_test.go Outdated Show resolved Hide resolved
pkg/core/transaction/witness_rule.go Outdated Show resolved Hide resolved
pkg/crypto/keys/publickey_test.go Show resolved Hide resolved
Copy link
Member

@AnnaShaleva AnnaShaleva left a comment

Choose a reason for hiding this comment

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

Style comments, the logic LGTM.

pkg/core/transaction/witness_test.go Outdated Show resolved Hide resolved
pkg/core/transaction/witness_test.go Outdated Show resolved Hide resolved
pkg/core/transaction/witness_test.go Outdated Show resolved Hide resolved
pkg/core/transaction/witness_condition.go Outdated Show resolved Hide resolved
pkg/core/transaction/witness_condition.go Outdated Show resolved Hide resolved
pkg/core/transaction/signer.go Outdated Show resolved Hide resolved
pkg/core/transaction/attribute.go Outdated Show resolved Hide resolved
pkg/services/notary/notary.go Show resolved Hide resolved
pkg/core/transaction/transaction.go Outdated Show resolved Hide resolved
pkg/crypto/keys/publickey.go Show resolved Hide resolved
Copy link
Member

@AnnaShaleva AnnaShaleva left a comment

Choose a reason for hiding this comment

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

Nice!

@AnnaShaleva
Copy link
Member

@roman-khimov, ready for review.

pkg/core/transaction/signer.go Outdated Show resolved Hide resolved
pkg/core/transaction/signer.go Outdated Show resolved Hide resolved
InvocationScript: make([]byte, MaxInvocationScript),
VerificationScript: make([]byte, MaxVerificationScript),
InvocationScript: []byte{1, 2, 2},
VerificationScript: []byte{3, 2, 2},
Copy link
Member

Choose a reason for hiding this comment

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

Why?

Since the AllowedGroups []*keys.PublicKey slice is used in the
initialization, the test should use the same structures.

Signed-off-by: Ekaterina Pavlova <[email protected]>
Add a method that makes a deep copy of all fields and resets size/hash
caches.

Close #3288

Signed-off-by: Ekaterina Pavlova <[email protected]>
@AnnaShaleva
Copy link
Member

Do you really need this change? It can break some initializations in existing code.

That was my concern as far, but I've checked the existing code and it seems that this type change doesn't break anything. Anyway, the current version looks better.

@AnnaShaleva AnnaShaleva merged commit b54fcbc into master May 1, 2024
21 checks passed
@AnnaShaleva AnnaShaleva deleted the copy-transaction branch May 1, 2024 07:46
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.

Add Copy() to transaction.Transaction and payload.P2PNotaryRequest
3 participants