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

Algod : merge unlimited assets to master #3652

Merged
merged 186 commits into from
Mar 2, 2022
Merged

Conversation

tsachiherman
Copy link
Contributor

@tsachiherman tsachiherman commented Feb 17, 2022

Summary

This PR adds support of for unlimited assets.

Done:

Test Plan

Extend, update and add new unit tests.

cce and others added 30 commits October 26, 2021 22:38
…ration (#3195)

* Initial support for ExtendApplicationStorage

* minor bugfix.

* better documentation

* update testing protocol.

* fix consensus protocol json

* rename ExtendApplicationStorage -> EnableExplicitAccountResourceTracking

* rename EnableExplicitAccountResourceTracking->EnableAccountDataResourceSeparation
## Summary

This PR adds the migration to the new schema designed at https://docs.google.com/document/d/1E9sQvWfu9uOYvai4VjWIyUDY9Mo8bhnBX92qXh1y54o/edit#, 
by adding a new database upgrade. 
The encoded AccountData is being re-encoded into the new schema, and the old data is dropped.

It also include the long-waiting PR : #1974

The migration implemented in this PR is currently hard-gated. We should remove that gating only once the rest of the logic would be capable of working with the new schema.

## Test Plan

Unit tests updated/added.
split Balances Get/Put interface methods into separate methods for creatables
…nlineAccountBalance (#3241)

## Summary

extract the logic of NormalizedOnlineBalance into NormalizedOnlineAccountBalance.
The change is quite benign, but would allow future PRs to complete the calculation of the normalized balance without having an AccountData object.

## Test Plan

Use existing unit tests.
## Summary

Part 2 of `apply.balances` and `cow` changes. This PR introduces partial deltas (`NewAccountDelta`) and some glue to make it work with existing old schema. Most of this glue code must be removed when a new schema is enabled.

## Test Plan

- [x] Existing tests
- [x] Add `Total*` fields validation test
## Summary

MergeInMatchingAccounts requires addresses per resource but storing addresses there makes the code much slower.
Lets see if MergeInMatchingAccounts can be eliminated altogether on the schema switch.

## Test Plan

Added new test for triggering missed base account data in StateDelta for some application resources modification.
## Summary

This is follow up PR for #3292 

## Test Plan

This is mostly existing tests modification
cce and others added 5 commits February 24, 2022 16:41
… feature/unlimited-assets-api-split-accountresource
…3666)

## Summary

This PR replaces the existing account preloading during validating with a more transaction-type oriented prefetcher.
The prefetcher examine the transaction type, and preload all the required resources ( account data, assets and applications ).

## Test Plan

Unit test added.

## Benchmarks

The following (existing) benchmarks were executed, and no performance difference was noted : 
* BenchmarkBlockEvaluatorDiskFullAppOptIns
* BenchmarkBlockEvaluatorDiskAppOptIns
* BenchmarkBlockEvaluatorDiskNoCrypto
* BenchmarkBlockEvaluatorDiskCrypto
* BenchmarkBlockEvaluatorRAMNoCrypto
* BenchmarkBlockEvaluatorRAMCrypto

The benchmark `BenchmarkBlockEvaluatorDiskAppCalls`, which was designed for applications, shown a notable improvements, dropping the transaction processing time from 42902ns to 33465ns.
…accountresource

REST API: split msgpack API type AccountResourceModel into two
@@ -1600,10 +1784,6 @@
"type": "integer",
"x-go-name": "AssetID"
},
"creator": {
"description": "Address that created this asset. This is the address where the parameters for this asset can be found, and also the address where unwanted asset units can be sent in the worst case.",
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this impact sdk backwards compatibility? Please comment.

Copy link
Contributor

Choose a reason for hiding this comment

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

As is, yes it will. I'd like to suggest we manually retain this field in the SDK models so they don't have an explicitly breaking change. The field can just be empty if algod doesn't return it.

Copy link
Contributor

Choose a reason for hiding this comment

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

IMO it would be preferable to introduce a breaking change than provide an empty value. That way you would find out that you need to pull the creator from /v2/assets/{asset-id} instead. However I don't have a lot of experience with how we deprecate functionality in the SDKs or warn users of issues like this, whether a compiler error or compiler warning is more typical.

Copy link
Contributor

Choose a reason for hiding this comment

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


// IsEmpty return true if any of the fields other then the UpdateRound are non-zero.
func (ba *baseAccountData) IsEmpty() bool {
return ba.Status == 0 &&
Copy link
Contributor

@id-ms id-ms Feb 28, 2022

Choose a reason for hiding this comment

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

I understand that because of the round fields, we can't return *ba == baseAccountData{} do you think it is worth having an inner type for it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's a bit of an overkill to have an embedded datatype if you're going to use it in exactly one location.
There is a unit test that verify that nothing is being missed here : TestBaseAccountDataIsEmpty.

Copy link
Contributor

@id-ms id-ms Feb 28, 2022

Choose a reason for hiding this comment

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

it could also be used for the set and the get.
but as long as we don't "miss" zeroing or setting fields. it is good

cce and others added 3 commits March 1, 2022 11:03
## Summary

AccountApplicationInformation was calling `ledger.LookupResource` with `basics.AssetCreatable` instead of `basics.AppCreatable`, resulting in a consistent failure.

## Test Plan

Unit test will follow on a subsequent PR.
@tsachiherman tsachiherman merged commit e1ae888 into master Mar 2, 2022
tsachiherman pushed a commit that referenced this pull request Mar 4, 2022
…3708)

## Summary

This replaces the various Ledger interfaces' `LookupResource` method with two more specific `LookupApplication` and `LookupAsset` methods. Following up on code review feedback from #3652.

## Test Plan

Existing tests should pass, including the ones that implement their own mock ledger.
@egieseke egieseke mentioned this pull request Mar 6, 2022
@tsachiherman tsachiherman deleted the feature/unlimited-assets branch March 16, 2022 16:58
@cce cce restored the feature/unlimited-assets branch September 7, 2022 20:42
@cce cce deleted the feature/unlimited-assets branch September 7, 2022 20:42
@cce cce restored the feature/unlimited-assets branch September 7, 2022 20:42
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.

10 participants