go-algorand icon indicating copy to clipboard operation
go-algorand copied to clipboard

ledger: rename "internal" package to "eval"

Open cce opened this issue 2 years ago • 4 comments

Summary

This will let third-party programs like indexer directly call StartEvaluator and EvaluatorOptions rather than have to place code in go-algorand to call by proxy, and should make it possible to remove evalindexer.go, as well as the indexerLedgerForEval and indexerLedgerConnector implementations (some of it will move to indexer).

Test Plan

Existing tests should pass — just a quick package rename.

cce avatar Jul 18 '22 19:07 cce

I think I like this, I never understood the reasoning behind the internal package. But I want to think a bit about eval. We have two major things that we use eval for - the evaluation of txns and the evaluation of avm programs. And then we also have an apply package. Can anyone succinctly describe what this newly named package does? Should it just go back into ledger? Is it about storage and lookup? (to my mind, that would make it part of ledger) or is it about applying rules of processing (to my mind that's eval but it's also apply).

I don't care if the meaning is perfect now, I like the simplicity of a simple package rename PR (or re-absorption into ledger). Just trying to get the best possible name.

Perhaps this is the cow package?

jannotti avatar Jul 18 '22 19:07 jannotti

Hrmm ... well, eval contains the BlockEvaluator, which uses layered storage "cow" types to model the environment used to evaluate each transaction, handling reads and recording writes made by each one. The apply package contains the implementation of all transaction logic, operating inside these layered environments, which it accesses using an implementation of the apply.Balances interface implemented by eval's "cow" storage. WDYT

cce avatar Jul 18 '22 20:07 cce

Codecov Report

Merging #4272 (b529186) into master (2a933eb) will increase coverage by 0.00%. The diff coverage is 50.00%.

@@           Coverage Diff           @@
##           master    #4272   +/-   ##
=======================================
  Coverage   55.24%   55.25%           
=======================================
  Files         395      395           
  Lines       50219    50219           
=======================================
+ Hits        27744    27749    +5     
  Misses      20093    20093           
+ Partials     2382     2377    -5     
Impacted Files Coverage Δ
ledger/eval/appcow.go 76.14% <ø> (ø)
ledger/eval/applications.go 62.50% <ø> (ø)
ledger/eval/assetcow.go 100.00% <ø> (ø)
ledger/eval/compactcert.go 77.77% <ø> (ø)
ledger/eval/cow.go 76.63% <ø> (ø)
ledger/eval/cow_creatables.go 52.17% <ø> (ø)
ledger/eval/eval.go 67.90% <ø> (ø)
ledger/eval/evalindexer.go 0.00% <ø> (ø)
ledger/eval/prefetcher/error.go 33.33% <ø> (ø)
ledger/eval/prefetcher/prefetcher.go 68.18% <ø> (ø)
... and 13 more

Help us with your feedback. Take ten seconds to tell us how you rate us.

codecov[bot] avatar Jul 19 '22 00:07 codecov[bot]

I don't feel strongly. Getting it out of internal seems like a big enough win to not keep myself up about the name.

jannotti avatar Jul 21 '22 17:07 jannotti

@winder please confirm that the Indexer does not need to import and call any go-algorand package.

algorandskiy avatar Nov 01 '22 20:11 algorandskiy

@algorandskiy this is less important for Indexer today as it was in July. I think there are still good reasons to open it up. Tools like algojig might want to call these functions.

winder avatar Nov 01 '22 20:11 winder

Thanks Will. Then maybe interested parties could refresh it.

algorandskiy avatar Nov 01 '22 20:11 algorandskiy

Closing in favor of #4777

cce avatar Nov 09 '22 19:11 cce