-
Notifications
You must be signed in to change notification settings - Fork 471
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
txngroup-deltas: Fix pointer bug copying deltas for txngroups #5375
Merged
algorandskiy
merged 8 commits into
algorand:master
from
Eric-Warehime:fix-group-delta-pointer-bug
May 11, 2023
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
f18e8cc
Fix pointer bug copying deltas for txngroups
Eric-Warehime 6b5d8dc
Fix lint
Eric-Warehime 66cbb88
PR comments
Eric-Warehime f2f0e92
Add box_del to txntracer tests
Eric-Warehime b2c731d
Use logic.AssembleString in txntracer test
Eric-Warehime 4e8215a
Add second txn group to txntracer test
Eric-Warehime bdf35d8
Copy contents of Accs
Eric-Warehime 4791b5f
Init maps with proper size
Eric-Warehime File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -600,6 +600,7 @@ type evalTestLedger struct { | |
rewardsPool basics.Address | ||
latestTotals ledgercore.AccountTotals | ||
tracer logic.EvalTracer | ||
boxes map[string][]byte | ||
} | ||
|
||
// newTestLedger creates a in memory Ledger that is as realistic as | ||
|
@@ -611,6 +612,7 @@ func newTestLedger(t testing.TB, balances bookkeeping.GenesisBalances) *evalTest | |
feeSink: balances.FeeSink, | ||
rewardsPool: balances.RewardsPool, | ||
tracer: nil, | ||
boxes: make(map[string][]byte), | ||
} | ||
|
||
protoVersion := protocol.ConsensusFuture | ||
|
@@ -728,7 +730,9 @@ func (ledger *evalTestLedger) LookupAsset(rnd basics.Round, addr basics.Address, | |
} | ||
|
||
func (ledger *evalTestLedger) LookupKv(rnd basics.Round, key string) ([]byte, error) { | ||
panic("unimplemented") | ||
// The test ledger only has one view of the value of a box--no rnd based retrieval is implemented currently | ||
val, _ := ledger.boxes[key] | ||
return val, nil | ||
Comment on lines
+733
to
+735
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the kind of craziness I'm talking about. Shouldn't we use a real ledger, and not constantly make little updates to approximate its behavior here? |
||
} | ||
|
||
// GenesisHash returns the genesis hash for this ledger. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Every test that uses this
evalTestLedger
creeps me out. It is a mock that maybe has the same behaviour as a real ledger, and maybe not. So every time we extend it to try to do more, it feels even more as though every test should be converted to use a real ledger.DoubleLedger
andTestConsensusRange
have some real benefits in terms of accuracy and testing across changes in old versions.I'm not going to hold up this PR, but we have to wean ourselves off this thing.
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.
Yeah I agree the actual implementation of the test ledger is pretty far from the actual ledger. It does seem difficult to mock since the data retrieved in the actual ledger hits the caches (trackers) first and then disk if the cache misses.
I haven't looked into the
DoubleLedger
orTestConsensusRange
, but I will do next time I need to test things requiring the ledger.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.
Using real ledger will make all dependent tests very slow. I guess we need just one unified mock with some default implementation and let embedders to override methods they care about