Extracting AvmContractDetails into separate class#1112
Merged
AlexandraRoatis merged 21 commits intomasterfrom Feb 12, 2020
Merged
Extracting AvmContractDetails into separate class#1112AlexandraRoatis merged 21 commits intomasterfrom
AlexandraRoatis merged 21 commits intomasterfrom
Conversation
f929a37 to
904adbb
Compare
Reading contract details from disk involves: 1. splitting the RLP encoding into meaningful components, and 2. interpreting the components according to the vm type. To make the code more understanable and increase its maintainability the first part of the decoding is done using the new RLPContractDetails class.
The previous commit started the separation of the decoding process into (a) reading the data from disk and (b) interpreting the data. It also introduced part (a) as the process of creating the RLPContractDetails object. This commit completes the separation by doing part (b). As a result only the interpretation of data remains inside the decode method of AionContractDetailsImpl. The unit tests for RLPContractDetails cover incorrect encoding size, testEncodingIncorrectSize was no longer useful.
The VM type is required to interpret the contract details correctly. It is now provided directly to the decode method instead of being specified externally and requested via documentation.
DetailsDataStore has access to the physical databases where contract data is stored. Since connecting the contract details object to the data source must go though the DetailsDataStore it is best to perform this operation when the instance is created. Additionaly, this refactoring minimizes direct access to the databases used by all contracts and reduces the mutability of the contract details object.
904adbb to
0cd6014
Compare
Any use of this internal variable is misleading and can cause serious errors. The current concatenated storage hash must be computed and is retrieved by calls to the getStorageHash method.
The new AvmContractDetails is identical to AionContractDetailsImpl, other than the class name. This choice was made to allow easily tracking the evolution of the class towards supporting only AVM contracts. Similarly, AionContractDetailsImpl will evolve to support only the FVM. The DetailsDataStore is responsible for instantiating the correct version based on the given VM type. To avoid incorrect cross-class casting, it does not create a ContractDetails instance when the VM type does not correspond to a supported VM.
848f0ad to
3509a79
Compare
The class supports only AVM making the vmType setting redundant.
0b4360b to
4362759
Compare
ff48d48 to
ebaae0a
Compare
The storage transition from in-line the details database to the external storage database existed as a way to accomodate small FVM contracts that could function mainly in the limited trie size that allows the in-line storage. The AVM uses its object graph for tracking internal variables, while the external storage is specifically meant for large collections of data. Transitioning in this case is typically imminent and not worth the additional cost demonstrated by the benchmark test.
ebaae0a to
fc110ea
Compare
fc110ea to
65a3cf9
Compare
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.