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

ledger: move StartEvaluator parameters into a parameters object #3030

Merged

Conversation

tsachiherman
Copy link
Contributor

Summary

move StartEvaluator parameters into an object. Given that most of the time the parameters are using a "default" state, it reduce the number of passed parameters, improving the caller readability.

Test Plan

Unit tests updated.

@tsachiherman tsachiherman changed the title ledger: move StartEvaluator parameters into an object ledger: move StartEvaluator parameters into a parameters object Oct 10, 2021
@codecov-commenter
Copy link

codecov-commenter commented Oct 10, 2021

Codecov Report

Merging #3030 (53eb091) into master (0d5b66e) will increase coverage by 0.02%.
The diff coverage is 85.96%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #3030      +/-   ##
==========================================
+ Coverage   43.65%   43.67%   +0.02%     
==========================================
  Files         391      391              
  Lines       86764    86779      +15     
==========================================
+ Hits        37875    37901      +26     
+ Misses      42861    42854       -7     
+ Partials     6028     6024       -4     
Impacted Files Coverage Δ
ledger/internal/evalindexer.go 0.00% <ø> (-12.50%) ⬇️
ledger/ledgercore/misc.go 0.00% <ø> (ø)
ledger/internal/eval.go 69.94% <80.00%> (+0.13%) ⬆️
ledger/evalindexer.go 51.61% <90.00%> (+10.79%) ⬆️
ledger/ledger.go 64.44% <100.00%> (+1.14%) ⬆️
data/abi/abi_type.go 90.90% <0.00%> (-0.91%) ⬇️
network/wsPeer.go 73.31% <0.00%> (-0.78%) ⬇️
catchup/service.go 69.35% <0.00%> (ø)
data/transactions/verify/txn.go 44.29% <0.00%> (+0.87%) ⬆️
ledger/blockqueue.go 83.90% <0.00%> (+2.87%) ⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0d5b66e...53eb091. Read the comment docs.

brianolson
brianolson previously approved these changes Oct 11, 2021
Copy link
Contributor

@brianolson brianolson left a comment

Choose a reason for hiding this comment

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

I like it. @tolikzinovyev may be interested in the changes to eval-for-indexer

func (x *roundCowBase) initializeAccountsCache(accts map[basics.Address]*basics.AccountData) {
for address, accountData := range accts {
if accountData == nil {
x.accounts[address] = basics.AccountData{}
Copy link
Contributor

Choose a reason for hiding this comment

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

why can we have nil entries on init?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The indexer would preload the touched accounts. If an account doesn't exist, it would place nil instead of an empty AccountData{}.

Copy link
Contributor

Choose a reason for hiding this comment

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

can't we change this code in the indexer preloaded and get rid of initializeAccountsCache func from here?

Copy link
Contributor Author

@tsachiherman tsachiherman Oct 11, 2021

Choose a reason for hiding this comment

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

you mean implementing the caching layer in indexerLedgerConnector instead ?

@tsachiherman tsachiherman merged commit 4c45443 into algorand:master Oct 11, 2021
@tsachiherman tsachiherman deleted the tsachi/ledger_refactoring_cleanup branch October 11, 2021 19:47
@tolikzinovyev
Copy link
Contributor

What is the reason to have an additional caching layer?

@tsachiherman
Copy link
Contributor Author

What is the reason to have an additional caching layer?

We're refactoring the ledger, and the evaluator refactoring is part of that. The extra "layer" of the indexer would hopefully help the encapsulation, as some of the underlying data structures are going to be updated and it would reduce the volatility of the indexer interface.

In terms of performance, I don't believe it would be noticible.

cce pushed a commit to cce/go-algorand that referenced this pull request Oct 28, 2021
…rand#3030)

move StartEvaluator parameters into an object. Given that most of the time the parameters are using a "default" state, it reduce the number of passed parameters, improving the caller readability.

Unit tests updated.
@egieseke egieseke mentioned this pull request Nov 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants