-
Notifications
You must be signed in to change notification settings - Fork 519
Txn: Refactor some stateless checks on transactions #6287
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
Conversation
Some cleanups I ran into while doing tx.Access. Wanted to make this PR first because that PR risks being big anyway. transaction.WellFormed() was huge. Move each transaction's implementation into the file that defined the transaction type's field. transaction.Alive() is better thought of as a method on block. It's the block that decides if the transaction is Alive. By moving it there, we remove an interface that was only introduced to fix the circular dependency caused by putting in the "wrong" place.
9b3c0bf to
ab82579
Compare
Also fix up MatchAddress stuff
ab82579 to
5dedcf9
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6287 +/- ##
==========================================
+ Coverage 51.70% 51.72% +0.02%
==========================================
Files 647 649 +2
Lines 86874 86849 -25
==========================================
+ Hits 44917 44922 +5
+ Misses 39100 39058 -42
- Partials 2857 2869 +12 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
algorandskiy
left a comment
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.
In general looks good, not sure about getting rid First/Last getters
Simplifying before tx.Access work
9dfef81 to
7aa72cb
Compare
Summary
Some cleanups I ran into while doing tx.Access. Wanted to make this PR first because that PR risks being big anyway.
transaction.WellFormed() was huge. Move each transaction's implementation into the file that defined the transaction type's field.
transaction.Alive() is better thought of as a method on block. It's the block that decides if the transaction is Alive. By moving it there, we remove an interface that was only introduced to fix the circular dependency caused by putting in the "wrong" place.
transaction.MatchAddress is rewritten to avoid accumulating a slice of addresses just to call slice.Contains on it.
AddressTxnsis nowTxnsFromsince its callers (stateproof REST endpoints) really only wanted to inspect the Sender anyway. They wanted the transactions sent by a particular address, not any transaction related to that address.We should consider making MatchAddress work properly for additional types like acfg and freeze, but it's only used to decide what transactions to return from
pendingwhen an address filter is given.Made some changes to how we turn evaldeltas into consumable json. The pending endpoint and the dry-run code were both doing, in slightly different ways. I'll need to modify it for tx.Access, so I wanted to clean it up now.
Test Plan
No meaningful tests should have been removed, only moved, hopefully to more meaningful places. The biggest motion was creating
/transaction/<txType>_test.goin cases where it didn't exist, to hold the associated WellFormedness checks.(By accident of history, payment_test was doing some general transaction tests, because that was basically the only transaction at one time.)