Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

derive TransactionCost::{PartialEq, Eq} #31626

Merged
merged 2 commits into from
May 15, 2023

Conversation

apfitzge
Copy link
Contributor

Problem

Writing tests for these is pretty inconvenient w/o equal comparison.
Was in the process of adding some more tests to QosService after #31542 when I encountered this

Summary of Changes

derive PartialEq and Eq

Fixes #

@apfitzge apfitzge requested a review from tao-stones May 13, 2023 00:44
@codecov
Copy link

codecov bot commented May 13, 2023

Codecov Report

Merging #31626 (8fdb16e) into master (91194cd) will decrease coverage by 0.1%.
The diff coverage is 0.0%.

@@            Coverage Diff            @@
##           master   #31626     +/-   ##
=========================================
- Coverage    81.3%    81.2%   -0.1%     
=========================================
  Files         733      733             
  Lines      206666   206679     +13     
=========================================
- Hits       168038   168030      -8     
- Misses      38628    38649     +21     

Copy link
Contributor

@tao-stones tao-stones left a comment

Choose a reason for hiding this comment

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

not sure if the default impl compares writable_accounts correctly - only the content of vec matters, not the order.

@apfitzge
Copy link
Contributor Author

not sure if the default impl compares writable_accounts correctly - only the content of vec matters, not the order.

🤔 yeah, I guess that is true. For my test cases I was always getting the costs from the same transactions so order was equivalent.

I think it should only be used in tests, so I'm happy to write a custom one that checks contents instead of directly Vecs.

@tao-stones
Copy link
Contributor

not sure if the default impl compares writable_accounts correctly - only the content of vec matters, not the order.

🤔 yeah, I guess that is true. For my test cases I was always getting the costs from the same transactions so order was equivalent.

I think it should only be used in tests, so I'm happy to write a custom one that checks contents instead of directly Vecs.

Yeah, i think it's ok to use default impl for test. I guess don't really need "deep" compare in regular code?

Copy link
Contributor

@tao-stones tao-stones left a comment

Choose a reason for hiding this comment

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

lgtm

@apfitzge apfitzge merged commit e5effa3 into solana-labs:master May 15, 2023
@apfitzge apfitzge deleted the transaction_cost_equality branch May 15, 2023 19:27
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants