-
Notifications
You must be signed in to change notification settings - Fork 146
chore(trie): Add support for trie V1 #3433
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
Merged
Merged
Changes from all commits
Commits
Show all changes
164 commits
Select commit
Hold shift + click to select a range
76767e9
feat(trie): Add v2 runtime functions
dimartiro 155cc4b
Merge branch 'development' into diego/trieV1/runtime-functions
dimartiro f4ad738
chore(trie): version trie functions
dimartiro b0a36cc
Update tests
dimartiro 3293693
Fix lint errors
dimartiro 634f315
Fix deepsource checks
dimartiro 1015ece
Revisit TODOs
dimartiro 9d828c7
Add more tests
dimartiro b09f7a5
Fix linter
dimartiro 8c8ed40
Merge remote-tracking branch 'origin/development' into diego/trieV1/v…
dimartiro 5d25644
Fix linter
dimartiro a625bc4
Get hashed values
dimartiro 40fccff
Check memory db put value error
dimartiro 59107ce
Add memory db lock
dimartiro ce73de2
Fix linter
dimartiro e0dd691
Deepsource
dimartiro 7e16064
Add default version
dimartiro 61f0d8d
Fix doc
dimartiro 7974017
Add test to cover case for #2329
dimartiro 494a85b
Fix linter
dimartiro 2703b93
chore(trie): version trie functions
dimartiro 00d4231
Update tests
dimartiro 447ccf5
Fix lint errors
dimartiro 752ce6d
Fix deepsource checks
dimartiro 0514501
Revisit TODOs
dimartiro a0b8dc1
Add more tests
dimartiro db45755
Fix linter
dimartiro 5719b28
fix(dot/sync): rework on bootstrap/tip sync (#3227)
EclesioMeloJunior ae86ad0
chore(deps): bump github.com/multiformats/go-multiaddr from 0.10.1 to…
dependabot[bot] 7046c94
chore(deps): bump github.com/go-playground/validator/v10 from 10.14.1…
dependabot[bot] 9dc3af5
chore(deps): bump github.com/ethereum/go-ethereum from 1.12.0 to 1.12…
dependabot[bot] 970e6aa
chore(deepsource): address Deepsource suggestions (#3436)
EclesioMeloJunior 2ebf184
Fix linter
dimartiro 1761922
Get hashed values
dimartiro 7b4b6d1
Check memory db put value error
dimartiro 5ec4460
Add memory db lock
dimartiro 8d70d77
Fix linter
dimartiro 461596e
Deepsource
dimartiro c9b42e9
Add default version
dimartiro 503fc27
Fix doc
dimartiro 3f6cdcc
Add test to cover case for #2329
dimartiro 0c5f542
Fix linter
dimartiro 3e3878a
Use state version param in runtime functions
dimartiro 45394d7
Merge branch 'diego/trieV1/versioning' into diego/trieV1/runtime-func…
dimartiro 4f8d81c
PR comments
dimartiro 1b5c0d3
Merge branch 'development' of https://github.com/ChainSafe/gossamer i…
dimartiro 2da48d7
Fix merge
dimartiro c0bda83
Merge branch 'diego/trieV1/versioning' into diego/trieV1/runtime-func…
dimartiro 264ca68
Merge branch 'development' of https://github.com/ChainSafe/gossamer i…
dimartiro 7e1e42f
Fix merge
dimartiro 644dc20
Version child tries functions
dimartiro 99626a3
Improve version test cover
dimartiro 376a97e
Remove unused function
dimartiro 130e9bb
Refactor tests
dimartiro 15770b4
Add child storage tests
dimartiro f00678c
Add more tests to increase coverage
dimartiro 8834add
Fix linters
dimartiro 265c747
Merge branch 'diego/trieV1/versioning' into diego/trieV1/runtime-func…
dimartiro d4e2ac6
PR comments
dimartiro 024965a
Increase coverage in child storage tests
dimartiro 4f87801
Remove unused functions
dimartiro bc167e2
Merge branch 'diego/trieV1/versioning' of https://github.com/ChainSaf…
dimartiro 84541d8
Removes todos and skip validations for unused params
dimartiro 884a2ae
Merge branch 'development' of https://github.com/ChainSafe/gossamer i…
dimartiro b765f73
Merge branch 'diego/trieV1/versioning' into diego/trieV1/runtime-func…
dimartiro 793d80c
Add new runtime functions tests
dimartiro 4139160
Improve largest lines to not ignore linter
dimartiro d02b3d3
Merge branch 'development' of https://github.com/ChainSafe/gossamer i…
dimartiro 19ffee8
Merge branch 'development' of https://github.com/ChainSafe/gossamer i…
dimartiro cfcb324
Fix trie snapshot creation copying internal db
dimartiro 3da0d32
Fix DBGetter mock
dimartiro 919468c
Remove comments
dimartiro b94c622
Fix get version in runtime functions
dimartiro c088287
Merge branch 'diego/trieV1/versioning' of https://github.com/ChainSaf…
dimartiro 55c51b2
Merge branch 'development' of https://github.com/ChainSafe/gossamer i…
dimartiro 19fd637
Merge branch 'development' of https://github.com/ChainSafe/gossamer i…
dimartiro 48ccf91
Fix merge
dimartiro f695530
Improve version parsing and simplify checks
dimartiro 31413a4
lint
dimartiro fd95c86
Merge branch 'diego/trieV1/versioning' into diego/trieV1/runtime-func…
dimartiro 215d4b3
PR comments
dimartiro a5a10c4
Add comment
dimartiro bb1a1c4
Fixes
dimartiro 0043e31
Rollback runtime constants changes
dimartiro 28ee3c9
Remove unused version parse switch case
dimartiro a8f1d23
Change panic to test fail
dimartiro da95dd7
Merge branch 'development' of https://github.com/ChainSafe/gossamer i…
dimartiro 39c3923
Use sharing db in trie
dimartiro c481b6a
Fix mocks
dimartiro 8ac581c
Remove old in memory db implementation and replace it to pebble
dimartiro 50f52de
Fix lint
dimartiro 191ff3e
Fix fuzz test
dimartiro 22b4216
Remove value nodes from db when hashed node is deleted
dimartiro ab2ee18
Merge branch 'diego/trieV1/versioning' of https://github.com/ChainSaf…
dimartiro 8d7c6b6
Add comments
dimartiro 233c2f2
Merge branch 'diego/trieV1/versioning' of https://github.com/ChainSaf…
dimartiro f32c939
Return empty array instead 0
dimartiro 8e076bb
Fix return zero value
dimartiro c187943
Revert using pebble as in memory db for tries
dimartiro ce04c1f
Merge branch 'diego/trieV1/versioning' of https://github.com/ChainSaf…
dimartiro 97ce272
Add more test cases
dimartiro 16ea637
Merge branch 'diego/trieV1/runtime-functions' of https://github.com/C…
dimartiro 26f3eb5
Fix documentations
dimartiro bf28117
Merge branch 'development' of https://github.com/ChainSafe/gossamer i…
dimartiro dfefbbf
Fix ClearChildStorage with versioning
dimartiro 5f2ad5d
Merge branch 'development' of https://github.com/ChainSafe/gossamer i…
dimartiro 1dbf91b
Fix tests
dimartiro 436100c
Add todo reminder
dimartiro c2bdf2f
Fix merge trie nodes preserve isHashed property
dimartiro 242bba6
Merge branch 'development' of https://github.com/ChainSafe/gossamer i…
dimartiro 18c6a22
Merge branch 'development' of https://github.com/ChainSafe/gossamer i…
dimartiro 6e1e612
Simplify runtime functions reusing v2 in v1
dimartiro 1096a93
Reuse new root from entries function in ext_ordered_root
dimartiro 4d6434a
Add tests for new root function
dimartiro d8df35e
Fix lint lll
dimartiro 8c92fbb
Improve trie versions functions
dimartiro 02928a0
Merge branch 'development' of https://github.com/ChainSafe/gossamer i…
dimartiro 784f96e
Fix test
dimartiro f5a67b9
Merge branch 'development' of https://github.com/ChainSafe/gossamer i…
dimartiro a276576
PR comments
dimartiro 0915077
Merge branch 'development' of https://github.com/ChainSafe/gossamer i…
dimartiro 8cf3b4a
PR review comments
dimartiro a9a25e9
Add godoc for exported method and consts
dimartiro 487e1ea
Do not store hashed values
dimartiro f0478c2
Remove DB
dimartiro b04de53
Use trie version to calculate hash only
dimartiro a16d3de
Fix import state command
dimartiro eda5f6c
Use default state version in helpers test
dimartiro 3ec5be3
Merge branch 'development' of https://github.com/ChainSafe/gossamer i…
dimartiro a3db05c
Use default state version in helpers test
dimartiro 50f9616
Revert import integration tests change
dimartiro ffa7157
Lint
dimartiro 9ba1bee
Merge branch 'development' of https://github.com/ChainSafe/gossamer i…
dimartiro c72deb8
Change default version to 0
dimartiro 93c29f7
Fix Test_newTrieFromPairs
dimartiro 9f66a11
Add one more test case
dimartiro a47970a
Fix version test
dimartiro 2970674
Fix deepsource checks
dimartiro 34f4e6b
Fix deepsource checks
dimartiro 39bcb46
Replace max int to constant
dimartiro 0e4ab54
Use default state version in e2e tests
dimartiro 8a7cc08
Change constant
dimartiro 8c49535
Simplify database interface
dimartiro bd21886
Removes harcoded state trie version
dimartiro 5946baf
Merge branch 'development' of https://github.com/ChainSafe/gossamer i…
dimartiro bc85310
Get state trie version from runtime
dimartiro 1d1bd25
Move comment
dimartiro 2648240
Add import state version
dimartiro 2de3013
Change error message
dimartiro 4181e0b
Merge branch 'development' into diego/trieV1/versioning
dimartiro 6fa58b7
Merge branch 'development' into diego/trieV1/versioning
dimartiro 337ab9c
Merge branch 'development' into diego/trieV1/versioning
dimartiro c56bd71
Removes Database interface
dimartiro 2ff1a4e
Make GetCurrentStateTrieVersion private
dimartiro 38b4b37
Rename trie version to layout
dimartiro 14ad372
use NoMaxInlineValueSize
dimartiro 2185edb
Fix mocks
dimartiro f4661c9
Fix tests using new runtime version parameter
dimartiro 2cfbdca
Fix Test_ext_default_child_storage_root_version_2
dimartiro 8f56a8d
Use right test runtime URL
dimartiro 5b08816
Merge branch 'development' of https://github.com/ChainSafe/gossamer i…
dimartiro a747c37
Add missing err check
dimartiro 8dcca66
Fix commands checks and doc
dimartiro 2ce26f7
Merge branch 'development' into diego/trieV1/versioning
dimartiro 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 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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| // Copyright 2023 ChainSafe Systems (ON) | ||
| // SPDX-License-Identifier: LGPL-3.0-only | ||
|
|
||
| package commands | ||
|
|
||
| import ( | ||
| "testing" | ||
|
|
||
| "github.com/stretchr/testify/assert" | ||
| "github.com/stretchr/testify/require" | ||
| ) | ||
|
|
||
| func TestImportStateMissingStateFile(t *testing.T) { | ||
| rootCmd, err := NewRootCommand() | ||
| require.NoError(t, err) | ||
| rootCmd.AddCommand(ImportStateCmd) | ||
|
|
||
| rootCmd.SetArgs([]string{ImportStateCmd.Name()}) | ||
| err = rootCmd.Execute() | ||
| assert.ErrorContains(t, err, "state-file must be specified") | ||
| } | ||
|
|
||
| func TestImportStateInvalidFirstSlot(t *testing.T) { | ||
| rootCmd, err := NewRootCommand() | ||
| require.NoError(t, err) | ||
| rootCmd.AddCommand(ImportStateCmd) | ||
|
|
||
| rootCmd.SetArgs([]string{ImportStateCmd.Name(), "--first-slot", "wrong"}) | ||
| err = rootCmd.Execute() | ||
| assert.ErrorContains(t, err, "invalid argument \"wrong\"") | ||
| } | ||
|
|
||
| func TestImportStateEmptyHeaderFile(t *testing.T) { | ||
| rootCmd, err := NewRootCommand() | ||
| require.NoError(t, err) | ||
| rootCmd.AddCommand(ImportStateCmd) | ||
|
|
||
| rootCmd.SetArgs([]string{ImportStateCmd.Name(), | ||
| "--state-file", "test", | ||
| "--header-file", "", | ||
| }) | ||
| err = rootCmd.Execute() | ||
| assert.ErrorContains(t, err, "header-file must be specified") | ||
| } | ||
|
|
||
| func TestImportStateErrorImportingState(t *testing.T) { | ||
| rootCmd, err := NewRootCommand() | ||
| require.NoError(t, err) | ||
| rootCmd.AddCommand(ImportStateCmd) | ||
|
|
||
| rootCmd.SetArgs([]string{ImportStateCmd.Name(), | ||
| "--state-file", "test", | ||
| "--header-file", "test", | ||
| }) | ||
| err = rootCmd.Execute() | ||
| assert.ErrorContains(t, err, "no such file or directory") | ||
| } | ||
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
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
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
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
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
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
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
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.