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

Update Database on project #158

Merged
merged 12 commits into from
May 20, 2022
Merged

Update Database on project #158

merged 12 commits into from
May 20, 2022

Conversation

stdevMac
Copy link
Member

  • Add transaction database (oriented to transactions)
  • Minor changes on names and comments

@stdevMac stdevMac self-assigned this May 18, 2022
@codecov
Copy link

codecov bot commented May 18, 2022

Codecov Report

Merging #158 (9c72866) into main (a9841aa) will not change coverage.
The diff coverage is 100.00%.

@@            Coverage Diff            @@
##              main      #158   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           34        36    +2     
  Lines         3690      3762   +72     
=========================================
+ Hits          3690      3762   +72     
Flag Coverage Δ
unittests 100.00% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
internal/db/abi/abi.go 100.00% <ø> (ø)
internal/db/abi/manager.go 100.00% <ø> (ø)
internal/db/block_specific.go 100.00% <ø> (ø)
internal/db/sorted_list.go 100.00% <ø> (ø)
internal/db/state/code.go 100.00% <ø> (ø)
internal/db/state/storage.go 100.00% <ø> (ø)
internal/db/transaction/manager.go 100.00% <ø> (ø)
internal/db/transaction/transaction.go 100.00% <ø> (ø)
internal/services/transactions.go 100.00% <ø> (ø)
internal/db/db.go 100.00% <100.00%> (ø)
... and 4 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 a9841aa...9c72866. Read the comment docs.

Copy link
Contributor

@tshakalekholoane tshakalekholoane left a comment

Choose a reason for hiding this comment

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

Looks good but just a couple of issues:

  1. The db package is becoming increasingly specialised to Juno's requirements so I think we should have this moved to the internal in the root directory of the repository.
  2. Although not documented, the file name convention is all lowercase or lowercase with underscores. I have a preference for the former as _xxx.go prefixes tend to be used as directives on how the toolchain interacts with these files i.e. _test.go, _linux.go, _arm.go, and so on. (See issue).
  3. It is not clear to me why is the abi, state, and transaction packages coupled with the database. If they are related to how such objects are handled by the database then they should be under an internal directory under db which is also makes point 1. more pertinent. Shouldn't we also apply similar treatment to blocks as well? So instead of blockSpecific we could have block and treat that similarly to state and transaction?
  4. Using separators i.e. 268_435_456 and providing more context on the values that set the geometry might improve readability.
  5. Do we need a separate db_test package?

@tshakalekholoane tshakalekholoane added DB Database Core Features or changes related to core package labels May 19, 2022
@tshakalekholoane tshakalekholoane added this to the Alpha Release milestone May 19, 2022
@adriantpaez
Copy link
Contributor

Looks good but just a couple of issues:

  1. The db package is becoming increasingly specialised to Juno's requirements so I think we should have this moved to the internal in the root directory of the repository.
  2. Although not documented, the file name convention is all lowercase or lowercase with underscores. I have a preference for the former as _xxx.go prefixes tend to be used as directives on how the toolchain interacts with these files i.e. _test.go, _linux.go, _arm.go, and so on. (See issue).
  3. It is not clear to me why is the abi, state, and transaction packages coupled with the database. If they are related to how such objects are handled by the database then they should be under an internal directory under db which is also makes point 1. more pertinent. Shouldn't we also apply similar treatment to blocks as well? So instead of blockSpecific we could have block and treat that similarly to state and transaction?
  4. Using separators i.e. 268_435_456 and providing more context on the values that set the geometry might improve readability.
  5. Do we need a separate db_test package?

About 3. :db package has a simple database implementation without any data type associated, and abi, state and transactions are databases for each of that types

@adriantpaez
Copy link
Contributor

Looks good but just a couple of issues:

  1. The db package is becoming increasingly specialised to Juno's requirements so I think we should have this moved to the internal in the root directory of the repository.
  2. Although not documented, the file name convention is all lowercase or lowercase with underscores. I have a preference for the former as _xxx.go prefixes tend to be used as directives on how the toolchain interacts with these files i.e. _test.go, _linux.go, _arm.go, and so on. (See issue).
  3. It is not clear to me why is the abi, state, and transaction packages coupled with the database. If they are related to how such objects are handled by the database then they should be under an internal directory under db which is also makes point 1. more pertinent. Shouldn't we also apply similar treatment to blocks as well? So instead of blockSpecific we could have block and treat that similarly to state and transaction?
  4. Using separators i.e. 268_435_456 and providing more context on the values that set the geometry might improve readability.
  5. Do we need a separate db_test package?

Abou 3.: blockSpecific is a kind of database used to store values that can change in a block and we need to get the correct value in a specific block too. An example of that is contract storage, because the storage may change in a transaction. Not confuse it with storing the blocks. To store the blocks we use a simple key-value database without any version control.

Copy link
Contributor

@tshakalekholoane tshakalekholoane left a comment

Choose a reason for hiding this comment

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

LGTM.

@adriantpaez adriantpaez merged commit bcaf91f into main May 20, 2022
@adriantpaez adriantpaez deleted the db/update branch May 20, 2022 15:58
IronGauntlets pushed a commit that referenced this pull request Aug 18, 2022
* update database

* Remove comments in db

* Add coverage

* Update coverage

* solve error compiling and more coverage

* Move db from pkg to internal

* Rename files to snake case format

* Remove db_test package

* Fix imports and renames of the databases constructors

Co-authored-by: stdevAdrianPaez <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Core Features or changes related to core package DB Database
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants