diff --git a/.github/workflows/fuzz.yml b/.github/workflows/fuzz.yml index c3d4d6a3d6..cdf5093286 100644 --- a/.github/workflows/fuzz.yml +++ b/.github/workflows/fuzz.yml @@ -41,4 +41,4 @@ jobs: restore-keys: ${{ runner.os }}-go-mod - name: Fuzz trie - run: go test -run Fuzz_Trie_PutAndGet_Single -fuzz=Fuzz_Trie_PutAndGet_Single -fuzztime=5m github.com/ChainSafe/gossamer/lib/trie + run: go test -run Fuzz_Trie_PutAndGet_Single -fuzz=Fuzz_Trie_PutAndGet_Single -fuzztime=5m github.com/ChainSafe/gossamer/pkg/trie diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index 315acc738d..d2c79f3101 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -82,9 +82,9 @@ jobs: - name: Trie memory test run: | - sed -i 's/const skip = true/const skip = false/g' ./lib/trie/mem_test.go - go test -run ^Test_Trie_MemoryUsage$ ./lib/trie - sed -i 's/const skip = false/const skip = true/g' ./lib/trie/mem_test.go + sed -i 's/const skip = true/const skip = false/g' ./pkg/trie/mem_test.go + go test -run ^Test_Trie_MemoryUsage$ ./pkg/trie + sed -i 's/const skip = false/const skip = true/g' ./pkg/trie/mem_test.go - name: Test - Race run: make test-using-race-detector diff --git a/cmd/gossamer/commands/import_state.go b/cmd/gossamer/commands/import_state.go index 43d24a4588..d262a72488 100644 --- a/cmd/gossamer/commands/import_state.go +++ b/cmd/gossamer/commands/import_state.go @@ -7,8 +7,8 @@ import ( "fmt" "github.com/ChainSafe/gossamer/dot" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/lib/utils" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/spf13/cobra" ) diff --git a/dot/core/helpers_test.go b/dot/core/helpers_test.go index a011937672..3bac5b8272 100644 --- a/dot/core/helpers_test.go +++ b/dot/core/helpers_test.go @@ -20,9 +20,9 @@ import ( "github.com/ChainSafe/gossamer/lib/runtime" rtstorage "github.com/ChainSafe/gossamer/lib/runtime/storage" wazero_runtime "github.com/ChainSafe/gossamer/lib/runtime/wazero" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/lib/utils" "github.com/ChainSafe/gossamer/pkg/scale" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/centrifuge/go-substrate-rpc-client/v4/signature" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" diff --git a/dot/core/service.go b/dot/core/service.go index ca69713075..75e01e7a8c 100644 --- a/dot/core/service.go +++ b/dot/core/service.go @@ -20,7 +20,7 @@ import ( rtstorage "github.com/ChainSafe/gossamer/lib/runtime/storage" wazero_runtime "github.com/ChainSafe/gossamer/lib/runtime/wazero" "github.com/ChainSafe/gossamer/lib/transaction" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" cscale "github.com/centrifuge/go-substrate-rpc-client/v4/scale" ctypes "github.com/centrifuge/go-substrate-rpc-client/v4/types" diff --git a/dot/core/service_integration_test.go b/dot/core/service_integration_test.go index 4cca83e2d9..2078d2713e 100644 --- a/dot/core/service_integration_test.go +++ b/dot/core/service_integration_test.go @@ -24,9 +24,9 @@ import ( rtstorage "github.com/ChainSafe/gossamer/lib/runtime/storage" wazero_runtime "github.com/ChainSafe/gossamer/lib/runtime/wazero" "github.com/ChainSafe/gossamer/lib/transaction" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/lib/utils" "github.com/ChainSafe/gossamer/pkg/scale" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" ) diff --git a/dot/core/service_test.go b/dot/core/service_test.go index c7fc9baa52..52a2df46af 100644 --- a/dot/core/service_test.go +++ b/dot/core/service_test.go @@ -23,8 +23,8 @@ import ( rtstorage "github.com/ChainSafe/gossamer/lib/runtime/storage" wazero_runtime "github.com/ChainSafe/gossamer/lib/runtime/wazero" "github.com/ChainSafe/gossamer/lib/transaction" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/pkg/scale" + "github.com/ChainSafe/gossamer/pkg/trie" cscale "github.com/centrifuge/go-substrate-rpc-client/v4/scale" "github.com/centrifuge/go-substrate-rpc-client/v4/signature" ctypes "github.com/centrifuge/go-substrate-rpc-client/v4/types" diff --git a/dot/digest/helpers_test.go b/dot/digest/helpers_test.go index 8637ccbaf2..05e82cd862 100644 --- a/dot/digest/helpers_test.go +++ b/dot/digest/helpers_test.go @@ -10,8 +10,8 @@ import ( "github.com/ChainSafe/gossamer/lib/common" "github.com/ChainSafe/gossamer/lib/genesis" "github.com/ChainSafe/gossamer/lib/runtime" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/lib/utils" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/require" ) diff --git a/dot/helpers_test.go b/dot/helpers_test.go index 089c9817ba..c3382cf29e 100644 --- a/dot/helpers_test.go +++ b/dot/helpers_test.go @@ -13,8 +13,8 @@ import ( "github.com/ChainSafe/gossamer/lib/common" "github.com/ChainSafe/gossamer/lib/genesis" runtime "github.com/ChainSafe/gossamer/lib/runtime" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/lib/utils" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/require" ) diff --git a/dot/import.go b/dot/import.go index 208d648765..5cdfb8ba04 100644 --- a/dot/import.go +++ b/dot/import.go @@ -13,8 +13,8 @@ import ( "github.com/ChainSafe/gossamer/dot/state" "github.com/ChainSafe/gossamer/dot/types" "github.com/ChainSafe/gossamer/lib/common" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/pkg/scale" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/ChainSafe/gossamer/internal/log" ) diff --git a/dot/import_integration_test.go b/dot/import_integration_test.go index 649775b523..1cd39f7b37 100644 --- a/dot/import_integration_test.go +++ b/dot/import_integration_test.go @@ -13,8 +13,8 @@ import ( "github.com/ChainSafe/gossamer/dot/types" "github.com/ChainSafe/gossamer/internal/log" "github.com/ChainSafe/gossamer/lib/common" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/pkg/scale" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/dot/node_integration_test.go b/dot/node_integration_test.go index ce0a2d999c..73f1339599 100644 --- a/dot/node_integration_test.go +++ b/dot/node_integration_test.go @@ -35,7 +35,7 @@ import ( "github.com/ChainSafe/gossamer/lib/keystore" "github.com/ChainSafe/gossamer/lib/runtime" wazero_runtime "github.com/ChainSafe/gossamer/lib/runtime/wazero" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" gomock "go.uber.org/mock/gomock" diff --git a/dot/rpc/helpers_test.go b/dot/rpc/helpers_test.go index af7835518a..af8d15f5d7 100644 --- a/dot/rpc/helpers_test.go +++ b/dot/rpc/helpers_test.go @@ -10,8 +10,8 @@ import ( "github.com/ChainSafe/gossamer/lib/common" "github.com/ChainSafe/gossamer/lib/genesis" "github.com/ChainSafe/gossamer/lib/runtime" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/lib/utils" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/require" ) diff --git a/dot/rpc/interfaces.go b/dot/rpc/interfaces.go index 0a868a0950..31bf5633c9 100644 --- a/dot/rpc/interfaces.go +++ b/dot/rpc/interfaces.go @@ -15,7 +15,7 @@ import ( "github.com/ChainSafe/gossamer/lib/grandpa" "github.com/ChainSafe/gossamer/lib/runtime" "github.com/ChainSafe/gossamer/lib/transaction" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" ) // StorageAPI is the interface for the storage state diff --git a/dot/rpc/modules/api.go b/dot/rpc/modules/api.go index dc7754a66f..e039df052b 100644 --- a/dot/rpc/modules/api.go +++ b/dot/rpc/modules/api.go @@ -13,7 +13,7 @@ import ( "github.com/ChainSafe/gossamer/lib/grandpa" "github.com/ChainSafe/gossamer/lib/runtime" "github.com/ChainSafe/gossamer/lib/transaction" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" ) // StorageAPI is the interface for the storage state diff --git a/dot/rpc/modules/author_integration_test.go b/dot/rpc/modules/author_integration_test.go index 33bd4e1c42..fbeef37cf9 100644 --- a/dot/rpc/modules/author_integration_test.go +++ b/dot/rpc/modules/author_integration_test.go @@ -31,8 +31,8 @@ import ( "github.com/ChainSafe/gossamer/lib/runtime/storage" wazero_runtime "github.com/ChainSafe/gossamer/lib/runtime/wazero" "github.com/ChainSafe/gossamer/lib/transaction" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/pkg/scale" + "github.com/ChainSafe/gossamer/pkg/trie" cscale "github.com/centrifuge/go-substrate-rpc-client/v4/scale" "github.com/centrifuge/go-substrate-rpc-client/v4/signature" ctypes "github.com/centrifuge/go-substrate-rpc-client/v4/types" diff --git a/dot/rpc/modules/chain_integration_test.go b/dot/rpc/modules/chain_integration_test.go index 9c78f331b9..4405afa0ef 100644 --- a/dot/rpc/modules/chain_integration_test.go +++ b/dot/rpc/modules/chain_integration_test.go @@ -16,8 +16,8 @@ import ( "github.com/ChainSafe/gossamer/lib/common" "github.com/ChainSafe/gossamer/lib/runtime" wazero_runtime "github.com/ChainSafe/gossamer/lib/runtime/wazero" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/pkg/scale" + "github.com/ChainSafe/gossamer/pkg/trie" "go.uber.org/mock/gomock" rtstorage "github.com/ChainSafe/gossamer/lib/runtime/storage" diff --git a/dot/rpc/modules/childstate_integration_test.go b/dot/rpc/modules/childstate_integration_test.go index 74c7ae53e0..7bacf23e96 100644 --- a/dot/rpc/modules/childstate_integration_test.go +++ b/dot/rpc/modules/childstate_integration_test.go @@ -13,7 +13,7 @@ import ( "github.com/ChainSafe/gossamer/dot/types" "github.com/ChainSafe/gossamer/internal/database" "github.com/ChainSafe/gossamer/lib/common" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/require" ) diff --git a/dot/rpc/modules/childstate_test.go b/dot/rpc/modules/childstate_test.go index e56b776b3b..5d82c9b70b 100644 --- a/dot/rpc/modules/childstate_test.go +++ b/dot/rpc/modules/childstate_test.go @@ -11,7 +11,7 @@ import ( apimocks "github.com/ChainSafe/gossamer/dot/rpc/modules/mocks" "github.com/ChainSafe/gossamer/lib/common" rtstorage "github.com/ChainSafe/gossamer/lib/runtime/storage" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "go.uber.org/mock/gomock" "github.com/stretchr/testify/assert" diff --git a/dot/rpc/modules/dev_integration_test.go b/dot/rpc/modules/dev_integration_test.go index 8ea64c66ee..293643a0c7 100644 --- a/dot/rpc/modules/dev_integration_test.go +++ b/dot/rpc/modules/dev_integration_test.go @@ -17,7 +17,7 @@ import ( "github.com/ChainSafe/gossamer/lib/keystore" "github.com/ChainSafe/gossamer/lib/runtime" wazero_runtime "github.com/ChainSafe/gossamer/lib/runtime/wazero" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" ) diff --git a/dot/rpc/modules/helpers_test.go b/dot/rpc/modules/helpers_test.go index bce60ba019..1b4e3e40a8 100644 --- a/dot/rpc/modules/helpers_test.go +++ b/dot/rpc/modules/helpers_test.go @@ -9,8 +9,8 @@ import ( "github.com/ChainSafe/gossamer/lib/common" "github.com/ChainSafe/gossamer/lib/genesis" "github.com/ChainSafe/gossamer/lib/runtime" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/lib/utils" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/require" ) diff --git a/dot/rpc/modules/mocks/mocks.go b/dot/rpc/modules/mocks/mocks.go index b668da62f9..1b9c1629b2 100644 --- a/dot/rpc/modules/mocks/mocks.go +++ b/dot/rpc/modules/mocks/mocks.go @@ -20,7 +20,7 @@ import ( genesis "github.com/ChainSafe/gossamer/lib/genesis" runtime "github.com/ChainSafe/gossamer/lib/runtime" transaction "github.com/ChainSafe/gossamer/lib/transaction" - trie "github.com/ChainSafe/gossamer/lib/trie" + trie "github.com/ChainSafe/gossamer/pkg/trie" gomock "go.uber.org/mock/gomock" ) diff --git a/dot/rpc/modules/mocks_test.go b/dot/rpc/modules/mocks_test.go index 8e0ecb8c31..17c27be12d 100644 --- a/dot/rpc/modules/mocks_test.go +++ b/dot/rpc/modules/mocks_test.go @@ -17,7 +17,7 @@ import ( types "github.com/ChainSafe/gossamer/dot/types" common "github.com/ChainSafe/gossamer/lib/common" runtime "github.com/ChainSafe/gossamer/lib/runtime" - trie "github.com/ChainSafe/gossamer/lib/trie" + trie "github.com/ChainSafe/gossamer/pkg/trie" gomock "go.uber.org/mock/gomock" ) diff --git a/dot/rpc/modules/state.go b/dot/rpc/modules/state.go index 1cae7e3612..7fac92e561 100644 --- a/dot/rpc/modules/state.go +++ b/dot/rpc/modules/state.go @@ -11,8 +11,8 @@ import ( "github.com/ChainSafe/gossamer/lib/common" "github.com/ChainSafe/gossamer/lib/runtime" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/pkg/scale" + "github.com/ChainSafe/gossamer/pkg/trie" ) // StateGetReadProofRequest json fields diff --git a/dot/rpc/modules/state_integration_test.go b/dot/rpc/modules/state_integration_test.go index a37cb667e1..8a600c74b0 100644 --- a/dot/rpc/modules/state_integration_test.go +++ b/dot/rpc/modules/state_integration_test.go @@ -17,7 +17,7 @@ import ( "github.com/ChainSafe/gossamer/dot/rpc/modules/mocks" "github.com/ChainSafe/gossamer/dot/types" "github.com/ChainSafe/gossamer/lib/common" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" diff --git a/dot/rpc/modules/state_test.go b/dot/rpc/modules/state_test.go index 6e40bf99e2..4617560416 100644 --- a/dot/rpc/modules/state_test.go +++ b/dot/rpc/modules/state_test.go @@ -22,7 +22,7 @@ import ( "testing" wazero_runtime "github.com/ChainSafe/gossamer/lib/runtime/wazero" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/ChainSafe/gossamer/dot/rpc/modules/mocks" testdata "github.com/ChainSafe/gossamer/dot/rpc/modules/test_data" diff --git a/dot/rpc/modules/system_integration_test.go b/dot/rpc/modules/system_integration_test.go index 195624be4c..8ad072c74b 100644 --- a/dot/rpc/modules/system_integration_test.go +++ b/dot/rpc/modules/system_integration_test.go @@ -29,8 +29,8 @@ import ( "github.com/ChainSafe/gossamer/lib/runtime" wazero_runtime "github.com/ChainSafe/gossamer/lib/runtime/wazero" "github.com/ChainSafe/gossamer/lib/transaction" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/pkg/scale" + "github.com/ChainSafe/gossamer/pkg/trie" ) var ( diff --git a/dot/state/base_test.go b/dot/state/base_test.go index 637ee44bb9..c08e478f04 100644 --- a/dot/state/base_test.go +++ b/dot/state/base_test.go @@ -8,7 +8,7 @@ import ( "github.com/ChainSafe/gossamer/lib/common" "github.com/ChainSafe/gossamer/lib/genesis" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/require" ) diff --git a/dot/state/block_data_test.go b/dot/state/block_data_test.go index 370282850b..70b40a41f5 100644 --- a/dot/state/block_data_test.go +++ b/dot/state/block_data_test.go @@ -8,7 +8,7 @@ import ( "github.com/ChainSafe/gossamer/dot/types" "github.com/ChainSafe/gossamer/lib/common" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/require" ) diff --git a/dot/state/block_finalisation_test.go b/dot/state/block_finalisation_test.go index 0834529bf0..578ce884da 100644 --- a/dot/state/block_finalisation_test.go +++ b/dot/state/block_finalisation_test.go @@ -8,7 +8,7 @@ import ( "github.com/ChainSafe/gossamer/dot/types" "github.com/ChainSafe/gossamer/lib/common" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/require" ) diff --git a/dot/state/block_race_test.go b/dot/state/block_race_test.go index 716b94ebca..26169d1f4a 100644 --- a/dot/state/block_race_test.go +++ b/dot/state/block_race_test.go @@ -10,7 +10,7 @@ import ( "github.com/ChainSafe/gossamer/dot/types" "github.com/ChainSafe/gossamer/internal/database" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "go.uber.org/mock/gomock" "github.com/stretchr/testify/require" diff --git a/dot/state/block_test.go b/dot/state/block_test.go index 18ef1233f7..321297021b 100644 --- a/dot/state/block_test.go +++ b/dot/state/block_test.go @@ -12,8 +12,8 @@ import ( "github.com/ChainSafe/gossamer/internal/database" "github.com/ChainSafe/gossamer/lib/blocktree" "github.com/ChainSafe/gossamer/lib/common" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/pkg/scale" + "github.com/ChainSafe/gossamer/pkg/trie" "go.uber.org/mock/gomock" "github.com/stretchr/testify/require" diff --git a/dot/state/grandpa_test.go b/dot/state/grandpa_test.go index 6e51cd4cc6..8018308c0b 100644 --- a/dot/state/grandpa_test.go +++ b/dot/state/grandpa_test.go @@ -15,7 +15,7 @@ import ( "github.com/ChainSafe/gossamer/lib/crypto/ed25519" "github.com/ChainSafe/gossamer/lib/crypto/sr25519" "github.com/ChainSafe/gossamer/lib/keystore" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/gtank/merlin" "go.uber.org/mock/gomock" diff --git a/dot/state/helpers_test.go b/dot/state/helpers_test.go index 10029e9f01..283b5f2c0a 100644 --- a/dot/state/helpers_test.go +++ b/dot/state/helpers_test.go @@ -12,8 +12,8 @@ import ( "github.com/ChainSafe/gossamer/lib/common" "github.com/ChainSafe/gossamer/lib/genesis" "github.com/ChainSafe/gossamer/lib/runtime" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/lib/utils" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/require" ) diff --git a/dot/state/initialize.go b/dot/state/initialize.go index 6be468907e..88c26e7744 100644 --- a/dot/state/initialize.go +++ b/dot/state/initialize.go @@ -14,7 +14,7 @@ import ( "github.com/ChainSafe/gossamer/lib/runtime" rtstorage "github.com/ChainSafe/gossamer/lib/runtime/storage" wazero_runtime "github.com/ChainSafe/gossamer/lib/runtime/wazero" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" ) // Initialise initialises the genesis state of the DB using the given storage trie. diff --git a/dot/state/mocks_database_test.go b/dot/state/mocks_database_test.go index cd53b18af9..91978d00fd 100644 --- a/dot/state/mocks_database_test.go +++ b/dot/state/mocks_database_test.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ChainSafe/gossamer/lib/trie/db (interfaces: Database) +// Source: github.com/ChainSafe/gossamer/pkg/trie/db (interfaces: Database) // // Generated by this command: // -// mockgen -destination=mocks_database_test.go -package=state github.com/ChainSafe/gossamer/lib/trie/db Database +// mockgen -destination=mocks_database_test.go -package=state github.com/ChainSafe/gossamer/pkg/trie/db Database // // Package state is a generated GoMock package. diff --git a/dot/state/mocks_generate_test.go b/dot/state/mocks_generate_test.go index 10d9c46059..5d474062b6 100644 --- a/dot/state/mocks_generate_test.go +++ b/dot/state/mocks_generate_test.go @@ -7,4 +7,4 @@ package state //go:generate mockgen -destination=mocks_runtime_test.go -package $GOPACKAGE github.com/ChainSafe/gossamer/lib/runtime Instance //go:generate mockgen -destination=mock_gauge_test.go -package $GOPACKAGE github.com/prometheus/client_golang/prometheus Gauge //go:generate mockgen -destination=mock_counter_test.go -package $GOPACKAGE github.com/prometheus/client_golang/prometheus Counter -//go:generate mockgen -destination=mocks_database_test.go -package=$GOPACKAGE github.com/ChainSafe/gossamer/lib/trie/db Database +//go:generate mockgen -destination=mocks_database_test.go -package=$GOPACKAGE github.com/ChainSafe/gossamer/pkg/trie/db Database diff --git a/dot/state/offline_pruner.go b/dot/state/offline_pruner.go index 0d0e24568b..b39d138def 100644 --- a/dot/state/offline_pruner.go +++ b/dot/state/offline_pruner.go @@ -11,7 +11,7 @@ import ( "github.com/ChainSafe/gossamer/internal/database" "github.com/ChainSafe/gossamer/lib/common" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" ) // OfflinePruner is a tool to prune the stale state with the help of diff --git a/dot/state/service.go b/dot/state/service.go index 7066664ee4..51691e6900 100644 --- a/dot/state/service.go +++ b/dot/state/service.go @@ -13,7 +13,7 @@ import ( "github.com/ChainSafe/gossamer/internal/log" "github.com/ChainSafe/gossamer/internal/metrics" "github.com/ChainSafe/gossamer/lib/blocktree" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" ) var logger = log.NewFromGlobal( diff --git a/dot/state/service_integration_test.go b/dot/state/service_integration_test.go index 3f19e8650a..e29c72ef37 100644 --- a/dot/state/service_integration_test.go +++ b/dot/state/service_integration_test.go @@ -17,7 +17,7 @@ import ( "github.com/ChainSafe/gossamer/internal/log" "github.com/ChainSafe/gossamer/lib/common" runtime "github.com/ChainSafe/gossamer/lib/runtime/storage" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "go.uber.org/mock/gomock" "github.com/stretchr/testify/require" diff --git a/dot/state/storage.go b/dot/state/storage.go index ed8f8377a0..5410294733 100644 --- a/dot/state/storage.go +++ b/dot/state/storage.go @@ -13,8 +13,8 @@ import ( "github.com/ChainSafe/gossamer/internal/database" "github.com/ChainSafe/gossamer/lib/common" rtstorage "github.com/ChainSafe/gossamer/lib/runtime/storage" - "github.com/ChainSafe/gossamer/lib/trie" - "github.com/ChainSafe/gossamer/lib/trie/proof" + "github.com/ChainSafe/gossamer/pkg/trie" + "github.com/ChainSafe/gossamer/pkg/trie/proof" ) // storagePrefix storage key prefix. diff --git a/dot/state/storage_test.go b/dot/state/storage_test.go index 5c66947c07..cad3431dfa 100644 --- a/dot/state/storage_test.go +++ b/dot/state/storage_test.go @@ -10,10 +10,10 @@ import ( "github.com/ChainSafe/gossamer/dot/telemetry" "github.com/ChainSafe/gossamer/dot/types" "github.com/ChainSafe/gossamer/internal/database" - "github.com/ChainSafe/gossamer/internal/trie/node" "github.com/ChainSafe/gossamer/lib/common" runtime "github.com/ChainSafe/gossamer/lib/runtime/storage" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" + "github.com/ChainSafe/gossamer/pkg/trie/node" "go.uber.org/mock/gomock" "github.com/stretchr/testify/require" diff --git a/dot/state/test_helpers.go b/dot/state/test_helpers.go index 6409aeb61a..a9d2c03201 100644 --- a/dot/state/test_helpers.go +++ b/dot/state/test_helpers.go @@ -12,8 +12,8 @@ import ( "github.com/ChainSafe/gossamer/dot/types" "github.com/ChainSafe/gossamer/internal/database" "github.com/ChainSafe/gossamer/lib/common" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/pkg/scale" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/require" ) diff --git a/dot/state/tries.go b/dot/state/tries.go index d7c87bc625..ee0db88740 100644 --- a/dot/state/tries.go +++ b/dot/state/tries.go @@ -7,7 +7,7 @@ import ( "sync" "github.com/ChainSafe/gossamer/lib/common" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus/promauto" ) diff --git a/dot/state/tries_test.go b/dot/state/tries_test.go index cff32bfac1..c434eaec9e 100644 --- a/dot/state/tries_test.go +++ b/dot/state/tries_test.go @@ -6,9 +6,9 @@ package state import ( "testing" - "github.com/ChainSafe/gossamer/internal/trie/node" "github.com/ChainSafe/gossamer/lib/common" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" + "github.com/ChainSafe/gossamer/pkg/trie/node" "github.com/stretchr/testify/assert" "go.uber.org/mock/gomock" ) diff --git a/dot/sync/chain_sync.go b/dot/sync/chain_sync.go index b127f9b1ff..498eeacfba 100644 --- a/dot/sync/chain_sync.go +++ b/dot/sync/chain_sync.go @@ -24,7 +24,7 @@ import ( "github.com/ChainSafe/gossamer/internal/database" "github.com/ChainSafe/gossamer/lib/common" "github.com/ChainSafe/gossamer/lib/common/variadic" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" ) var _ ChainSync = (*chainSync)(nil) diff --git a/dot/sync/chain_sync_test.go b/dot/sync/chain_sync_test.go index d98b335a27..8d20f33419 100644 --- a/dot/sync/chain_sync_test.go +++ b/dot/sync/chain_sync_test.go @@ -17,7 +17,7 @@ import ( "github.com/ChainSafe/gossamer/lib/common" "github.com/ChainSafe/gossamer/lib/common/variadic" "github.com/ChainSafe/gossamer/lib/runtime/storage" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/libp2p/go-libp2p/core/peer" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/dot/sync/message_integration_test.go b/dot/sync/message_integration_test.go index 7b4ff69529..300a1f580f 100644 --- a/dot/sync/message_integration_test.go +++ b/dot/sync/message_integration_test.go @@ -12,7 +12,7 @@ import ( "github.com/ChainSafe/gossamer/dot/state" "github.com/ChainSafe/gossamer/dot/types" "github.com/ChainSafe/gossamer/lib/common/variadic" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/require" ) diff --git a/dot/sync/syncer_integration_test.go b/dot/sync/syncer_integration_test.go index ac4ddf34e4..35dc29eba1 100644 --- a/dot/sync/syncer_integration_test.go +++ b/dot/sync/syncer_integration_test.go @@ -19,8 +19,8 @@ import ( runtime "github.com/ChainSafe/gossamer/lib/runtime" rtstorage "github.com/ChainSafe/gossamer/lib/runtime/storage" wazero_runtime "github.com/ChainSafe/gossamer/lib/runtime/wazero" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/lib/utils" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" diff --git a/dot/utils_integration_test.go b/dot/utils_integration_test.go index 27e0d7c738..b50ddd3b06 100644 --- a/dot/utils_integration_test.go +++ b/dot/utils_integration_test.go @@ -9,7 +9,7 @@ import ( "testing" "github.com/ChainSafe/gossamer/lib/genesis" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/require" ) diff --git a/lib/babe/helpers_test.go b/lib/babe/helpers_test.go index f21eec6984..161110e77e 100644 --- a/lib/babe/helpers_test.go +++ b/lib/babe/helpers_test.go @@ -23,9 +23,9 @@ import ( rtstorage "github.com/ChainSafe/gossamer/lib/runtime/storage" wazero_runtime "github.com/ChainSafe/gossamer/lib/runtime/wazero" "github.com/ChainSafe/gossamer/lib/transaction" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/lib/utils" "github.com/ChainSafe/gossamer/pkg/scale" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" ) diff --git a/lib/grandpa/grandpa_integration_test.go b/lib/grandpa/grandpa_integration_test.go index 1771e585af..01950743d3 100644 --- a/lib/grandpa/grandpa_integration_test.go +++ b/lib/grandpa/grandpa_integration_test.go @@ -16,7 +16,7 @@ import ( "github.com/ChainSafe/gossamer/lib/common" "github.com/ChainSafe/gossamer/lib/crypto/ed25519" "github.com/ChainSafe/gossamer/lib/keystore" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/require" ) diff --git a/lib/grandpa/helpers_integration_test.go b/lib/grandpa/helpers_integration_test.go index 0c80b8dce9..fb5b343825 100644 --- a/lib/grandpa/helpers_integration_test.go +++ b/lib/grandpa/helpers_integration_test.go @@ -20,8 +20,8 @@ import ( runtime "github.com/ChainSafe/gossamer/lib/runtime" "github.com/ChainSafe/gossamer/lib/runtime/storage" wazero_runtime "github.com/ChainSafe/gossamer/lib/runtime/wazero" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/lib/utils" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/libp2p/go-libp2p/core/peer" "github.com/libp2p/go-libp2p/core/protocol" "github.com/stretchr/testify/assert" diff --git a/lib/grandpa/helpers_unit_test.go b/lib/grandpa/helpers_unit_test.go index 1c778e204d..16f480295a 100644 --- a/lib/grandpa/helpers_unit_test.go +++ b/lib/grandpa/helpers_unit_test.go @@ -10,7 +10,7 @@ import ( "github.com/ChainSafe/gossamer/lib/common" "github.com/ChainSafe/gossamer/lib/crypto/ed25519" "github.com/ChainSafe/gossamer/lib/keystore" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/require" ) diff --git a/lib/runtime/genesis.go b/lib/runtime/genesis.go index 5912886bf1..27d93ff754 100644 --- a/lib/runtime/genesis.go +++ b/lib/runtime/genesis.go @@ -8,7 +8,7 @@ import ( "fmt" "github.com/ChainSafe/gossamer/lib/genesis" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" ) var ( diff --git a/lib/runtime/interfaces.go b/lib/runtime/interfaces.go index 2fb1f4799d..0abccf953c 100644 --- a/lib/runtime/interfaces.go +++ b/lib/runtime/interfaces.go @@ -6,7 +6,7 @@ package runtime import ( "github.com/ChainSafe/gossamer/lib/common" "github.com/ChainSafe/gossamer/lib/transaction" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" ) // Storage runtime interface. diff --git a/lib/runtime/storage/trie.go b/lib/runtime/storage/trie.go index 7b76779f5e..dfdc9275a8 100644 --- a/lib/runtime/storage/trie.go +++ b/lib/runtime/storage/trie.go @@ -11,7 +11,7 @@ import ( "sync" "github.com/ChainSafe/gossamer/lib/common" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "golang.org/x/exp/maps" ) diff --git a/lib/runtime/storage/trie_test.go b/lib/runtime/storage/trie_test.go index 01acbf0177..c79def9cce 100644 --- a/lib/runtime/storage/trie_test.go +++ b/lib/runtime/storage/trie_test.go @@ -11,7 +11,7 @@ import ( "testing" "github.com/ChainSafe/gossamer/lib/common" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/require" ) diff --git a/lib/runtime/wazero/imports.go b/lib/runtime/wazero/imports.go index d0bb9c0e55..66999d4464 100644 --- a/lib/runtime/wazero/imports.go +++ b/lib/runtime/wazero/imports.go @@ -21,9 +21,9 @@ import ( "github.com/ChainSafe/gossamer/lib/crypto/sr25519" "github.com/ChainSafe/gossamer/lib/runtime" "github.com/ChainSafe/gossamer/lib/transaction" - "github.com/ChainSafe/gossamer/lib/trie" - "github.com/ChainSafe/gossamer/lib/trie/proof" "github.com/ChainSafe/gossamer/pkg/scale" + "github.com/ChainSafe/gossamer/pkg/trie" + "github.com/ChainSafe/gossamer/pkg/trie/proof" "github.com/tetratelabs/wazero/api" ) diff --git a/lib/runtime/wazero/imports_test.go b/lib/runtime/wazero/imports_test.go index 5ecd82b41d..e7f955d8ab 100644 --- a/lib/runtime/wazero/imports_test.go +++ b/lib/runtime/wazero/imports_test.go @@ -24,9 +24,9 @@ import ( "github.com/ChainSafe/gossamer/lib/keystore" "github.com/ChainSafe/gossamer/lib/runtime" "github.com/ChainSafe/gossamer/lib/runtime/storage" - "github.com/ChainSafe/gossamer/lib/trie" - "github.com/ChainSafe/gossamer/lib/trie/proof" "github.com/ChainSafe/gossamer/pkg/scale" + "github.com/ChainSafe/gossamer/pkg/trie" + "github.com/ChainSafe/gossamer/pkg/trie/proof" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/lib/runtime/wazero/instance.go b/lib/runtime/wazero/instance.go index f5e963c2a2..d87b3d9773 100644 --- a/lib/runtime/wazero/instance.go +++ b/lib/runtime/wazero/instance.go @@ -20,8 +20,8 @@ import ( "github.com/ChainSafe/gossamer/lib/runtime/allocator" "github.com/ChainSafe/gossamer/lib/runtime/offchain" "github.com/ChainSafe/gossamer/lib/transaction" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/pkg/scale" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/klauspost/compress/zstd" "github.com/tetratelabs/wazero" "github.com/tetratelabs/wazero/api" diff --git a/lib/runtime/wazero/instance_test.go b/lib/runtime/wazero/instance_test.go index ddf50db845..822a6d8781 100644 --- a/lib/runtime/wazero/instance_test.go +++ b/lib/runtime/wazero/instance_test.go @@ -21,9 +21,9 @@ import ( "github.com/ChainSafe/gossamer/lib/runtime" "github.com/ChainSafe/gossamer/lib/runtime/storage" "github.com/ChainSafe/gossamer/lib/runtime/wazero/testdata" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/lib/utils" "github.com/ChainSafe/gossamer/pkg/scale" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/centrifuge/go-substrate-rpc-client/v4/signature" "github.com/stretchr/testify/assert" diff --git a/lib/runtime/wazero/test_helpers.go b/lib/runtime/wazero/test_helpers.go index 067bd4173b..06725197b0 100644 --- a/lib/runtime/wazero/test_helpers.go +++ b/lib/runtime/wazero/test_helpers.go @@ -16,7 +16,7 @@ import ( "github.com/ChainSafe/gossamer/lib/runtime" "github.com/ChainSafe/gossamer/lib/runtime/mocks" "github.com/ChainSafe/gossamer/lib/runtime/storage" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" ) diff --git a/lib/trie/child_storage.go b/pkg/trie/child_storage.go similarity index 100% rename from lib/trie/child_storage.go rename to pkg/trie/child_storage.go diff --git a/lib/trie/child_storage_test.go b/pkg/trie/child_storage_test.go similarity index 100% rename from lib/trie/child_storage_test.go rename to pkg/trie/child_storage_test.go diff --git a/internal/trie/codec/nibbles.go b/pkg/trie/codec/nibbles.go similarity index 100% rename from internal/trie/codec/nibbles.go rename to pkg/trie/codec/nibbles.go diff --git a/internal/trie/codec/nibbles_test.go b/pkg/trie/codec/nibbles_test.go similarity index 100% rename from internal/trie/codec/nibbles_test.go rename to pkg/trie/codec/nibbles_test.go diff --git a/lib/trie/database.go b/pkg/trie/database.go similarity index 98% rename from lib/trie/database.go rename to pkg/trie/database.go index 667ccec5df..5a454e4d18 100644 --- a/lib/trie/database.go +++ b/pkg/trie/database.go @@ -8,10 +8,10 @@ import ( "fmt" "github.com/ChainSafe/gossamer/internal/database" - "github.com/ChainSafe/gossamer/internal/trie/codec" - "github.com/ChainSafe/gossamer/internal/trie/node" "github.com/ChainSafe/gossamer/lib/common" - "github.com/ChainSafe/gossamer/lib/trie/db" + "github.com/ChainSafe/gossamer/pkg/trie/codec" + "github.com/ChainSafe/gossamer/pkg/trie/db" + "github.com/ChainSafe/gossamer/pkg/trie/node" ) // NewBatcher creates a new database batch. diff --git a/lib/trie/database_test.go b/pkg/trie/database_test.go similarity index 100% rename from lib/trie/database_test.go rename to pkg/trie/database_test.go diff --git a/lib/trie/db/db.go b/pkg/trie/db/db.go similarity index 100% rename from lib/trie/db/db.go rename to pkg/trie/db/db.go diff --git a/lib/trie/db_getter_mocks_test.go b/pkg/trie/db_getter_mocks_test.go similarity index 92% rename from lib/trie/db_getter_mocks_test.go rename to pkg/trie/db_getter_mocks_test.go index caa0079c0c..1ace0c3dcb 100644 --- a/lib/trie/db_getter_mocks_test.go +++ b/pkg/trie/db_getter_mocks_test.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ChainSafe/gossamer/lib/trie/db (interfaces: DBGetter) +// Source: github.com/ChainSafe/gossamer/pkg/trie/db (interfaces: DBGetter) // // Generated by this command: // -// mockgen -destination=db_getter_mocks_test.go -package=trie github.com/ChainSafe/gossamer/lib/trie/db DBGetter +// mockgen -destination=db_getter_mocks_test.go -package=trie github.com/ChainSafe/gossamer/pkg/trie/db DBGetter // // Package trie is a generated GoMock package. diff --git a/lib/trie/genesis.go b/pkg/trie/genesis.go similarity index 100% rename from lib/trie/genesis.go rename to pkg/trie/genesis.go diff --git a/lib/trie/genesis_test.go b/pkg/trie/genesis_test.go similarity index 96% rename from lib/trie/genesis_test.go rename to pkg/trie/genesis_test.go index 48bff6e56b..b70e320b0d 100644 --- a/lib/trie/genesis_test.go +++ b/pkg/trie/genesis_test.go @@ -7,8 +7,8 @@ import ( "testing" "github.com/ChainSafe/gossamer/dot/types" - "github.com/ChainSafe/gossamer/internal/trie/node" "github.com/ChainSafe/gossamer/lib/common" + "github.com/ChainSafe/gossamer/pkg/trie/node" "github.com/stretchr/testify/assert" ) diff --git a/lib/trie/helpers_test.go b/pkg/trie/helpers_test.go similarity index 96% rename from lib/trie/helpers_test.go rename to pkg/trie/helpers_test.go index cbae542394..1254a15b1b 100644 --- a/lib/trie/helpers_test.go +++ b/pkg/trie/helpers_test.go @@ -8,9 +8,9 @@ import ( "testing" "time" - "github.com/ChainSafe/gossamer/internal/trie/node" - "github.com/ChainSafe/gossamer/internal/trie/tracking" "github.com/ChainSafe/gossamer/lib/common" + "github.com/ChainSafe/gossamer/pkg/trie/node" + "github.com/ChainSafe/gossamer/pkg/trie/tracking" "github.com/stretchr/testify/require" "golang.org/x/exp/maps" ) diff --git a/lib/trie/interfaces.go b/pkg/trie/interfaces.go similarity index 92% rename from lib/trie/interfaces.go rename to pkg/trie/interfaces.go index 452b46dbcc..8da58a28a3 100644 --- a/lib/trie/interfaces.go +++ b/pkg/trie/interfaces.go @@ -4,8 +4,8 @@ package trie import ( - "github.com/ChainSafe/gossamer/internal/trie/tracking" "github.com/ChainSafe/gossamer/lib/common" + "github.com/ChainSafe/gossamer/pkg/trie/tracking" ) // Deltas is the interface for the trie local deltas since diff --git a/lib/trie/layout.go b/pkg/trie/layout.go similarity index 100% rename from lib/trie/layout.go rename to pkg/trie/layout.go diff --git a/lib/trie/layout_test.go b/pkg/trie/layout_test.go similarity index 100% rename from lib/trie/layout_test.go rename to pkg/trie/layout_test.go diff --git a/lib/trie/mem_test.go b/pkg/trie/mem_test.go similarity index 100% rename from lib/trie/mem_test.go rename to pkg/trie/mem_test.go diff --git a/lib/trie/mocks_generate_test.go b/pkg/trie/mocks_generate_test.go similarity index 71% rename from lib/trie/mocks_generate_test.go rename to pkg/trie/mocks_generate_test.go index f101c2239c..8d8db3d14c 100644 --- a/lib/trie/mocks_generate_test.go +++ b/pkg/trie/mocks_generate_test.go @@ -3,4 +3,4 @@ package trie -//go:generate mockgen -destination=db_getter_mocks_test.go -package=$GOPACKAGE github.com/ChainSafe/gossamer/lib/trie/db DBGetter +//go:generate mockgen -destination=db_getter_mocks_test.go -package=$GOPACKAGE github.com/ChainSafe/gossamer/pkg/trie/db DBGetter diff --git a/lib/trie/node.go b/pkg/trie/node.go similarity index 78% rename from lib/trie/node.go rename to pkg/trie/node.go index b16ffabb3e..da351be36a 100644 --- a/lib/trie/node.go +++ b/pkg/trie/node.go @@ -4,7 +4,7 @@ package trie import ( - "github.com/ChainSafe/gossamer/internal/trie/node" + "github.com/ChainSafe/gossamer/pkg/trie/node" ) // Node is a node in the trie and can be a leaf or a branch. diff --git a/internal/trie/node/README.md b/pkg/trie/node/README.md similarity index 100% rename from internal/trie/node/README.md rename to pkg/trie/node/README.md diff --git a/internal/trie/node/branch_encode.go b/pkg/trie/node/branch_encode.go similarity index 95% rename from internal/trie/node/branch_encode.go rename to pkg/trie/node/branch_encode.go index d9b8e7b5a6..1e64c7c35b 100644 --- a/internal/trie/node/branch_encode.go +++ b/pkg/trie/node/branch_encode.go @@ -41,9 +41,9 @@ var parallelEncodingRateLimit = make(chan struct{}, parallelLimit) // encodeChildrenOpportunisticParallel encodes children in parallel eventually. // Leaves are encoded in a blocking way, and branches are encoded in separate -// goroutines IF they are less than the parallelLimit number of goroutines already -// running. This is designed to limit the total number of goroutines in order to -// avoid using too much memory on the stack. +// goroutines IF they are less than the parallelLimit number of goroutines +// already running. This is designed to limit the total number of goroutines in +// order to avoid using too much memory on the stack. func encodeChildrenOpportunisticParallel(children []*Node, maxInlineValue int, buffer io.Writer) (err error) { // Buffered channels since children might be encoded in this // goroutine or another one. diff --git a/internal/trie/node/branch_encode_test.go b/pkg/trie/node/branch_encode_test.go similarity index 100% rename from internal/trie/node/branch_encode_test.go rename to pkg/trie/node/branch_encode_test.go diff --git a/internal/trie/node/buffer.go b/pkg/trie/node/buffer.go similarity index 100% rename from internal/trie/node/buffer.go rename to pkg/trie/node/buffer.go diff --git a/internal/trie/node/buffer_mock_test.go b/pkg/trie/node/buffer_mock_test.go similarity index 96% rename from internal/trie/node/buffer_mock_test.go rename to pkg/trie/node/buffer_mock_test.go index 396f9bd50c..6e6f51b74e 100644 --- a/internal/trie/node/buffer_mock_test.go +++ b/pkg/trie/node/buffer_mock_test.go @@ -1,5 +1,5 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ChainSafe/gossamer/internal/trie/node (interfaces: Buffer) +// Source: github.com/ChainSafe/gossamer/pkg/trie/node (interfaces: Buffer) // // Generated by this command: // diff --git a/internal/trie/node/children.go b/pkg/trie/node/children.go similarity index 100% rename from internal/trie/node/children.go rename to pkg/trie/node/children.go diff --git a/internal/trie/node/children_test.go b/pkg/trie/node/children_test.go similarity index 100% rename from internal/trie/node/children_test.go rename to pkg/trie/node/children_test.go diff --git a/internal/trie/node/copy.go b/pkg/trie/node/copy.go similarity index 100% rename from internal/trie/node/copy.go rename to pkg/trie/node/copy.go diff --git a/internal/trie/node/copy_test.go b/pkg/trie/node/copy_test.go similarity index 100% rename from internal/trie/node/copy_test.go rename to pkg/trie/node/copy_test.go diff --git a/internal/trie/node/decode.go b/pkg/trie/node/decode.go similarity index 100% rename from internal/trie/node/decode.go rename to pkg/trie/node/decode.go diff --git a/internal/trie/node/decode_test.go b/pkg/trie/node/decode_test.go similarity index 100% rename from internal/trie/node/decode_test.go rename to pkg/trie/node/decode_test.go diff --git a/internal/trie/node/dirty.go b/pkg/trie/node/dirty.go similarity index 100% rename from internal/trie/node/dirty.go rename to pkg/trie/node/dirty.go diff --git a/internal/trie/node/dirty_test.go b/pkg/trie/node/dirty_test.go similarity index 100% rename from internal/trie/node/dirty_test.go rename to pkg/trie/node/dirty_test.go diff --git a/internal/trie/node/encode.go b/pkg/trie/node/encode.go similarity index 97% rename from internal/trie/node/encode.go rename to pkg/trie/node/encode.go index 1e5810ea34..e7697344b5 100644 --- a/internal/trie/node/encode.go +++ b/pkg/trie/node/encode.go @@ -6,9 +6,9 @@ package node import ( "fmt" - "github.com/ChainSafe/gossamer/internal/trie/codec" "github.com/ChainSafe/gossamer/lib/common" "github.com/ChainSafe/gossamer/pkg/scale" + "github.com/ChainSafe/gossamer/pkg/trie/codec" ) // Encode encodes the node to the buffer given. diff --git a/internal/trie/node/encode_decode_test.go b/pkg/trie/node/encode_decode_test.go similarity index 100% rename from internal/trie/node/encode_decode_test.go rename to pkg/trie/node/encode_decode_test.go diff --git a/internal/trie/node/encode_test.go b/pkg/trie/node/encode_test.go similarity index 100% rename from internal/trie/node/encode_test.go rename to pkg/trie/node/encode_test.go diff --git a/internal/trie/node/hash.go b/pkg/trie/node/hash.go similarity index 98% rename from internal/trie/node/hash.go rename to pkg/trie/node/hash.go index 1dfbca098d..1fca6bfade 100644 --- a/internal/trie/node/hash.go +++ b/pkg/trie/node/hash.go @@ -9,7 +9,7 @@ import ( "hash" "io" - "github.com/ChainSafe/gossamer/internal/trie/pools" + "github.com/ChainSafe/gossamer/pkg/trie/pools" ) // MerkleValue writes the Merkle value from the encoding of a non-root diff --git a/internal/trie/node/hash_test.go b/pkg/trie/node/hash_test.go similarity index 100% rename from internal/trie/node/hash_test.go rename to pkg/trie/node/hash_test.go diff --git a/internal/trie/node/header.go b/pkg/trie/node/header.go similarity index 100% rename from internal/trie/node/header.go rename to pkg/trie/node/header.go diff --git a/internal/trie/node/header_test.go b/pkg/trie/node/header_test.go similarity index 100% rename from internal/trie/node/header_test.go rename to pkg/trie/node/header_test.go diff --git a/internal/trie/node/helpers_test.go b/pkg/trie/node/helpers_test.go similarity index 100% rename from internal/trie/node/helpers_test.go rename to pkg/trie/node/helpers_test.go diff --git a/internal/trie/node/key.go b/pkg/trie/node/key.go similarity index 93% rename from internal/trie/node/key.go rename to pkg/trie/node/key.go index 343a5d747d..2d8fe5c56c 100644 --- a/internal/trie/node/key.go +++ b/pkg/trie/node/key.go @@ -8,7 +8,7 @@ import ( "fmt" "io" - "github.com/ChainSafe/gossamer/internal/trie/codec" + "github.com/ChainSafe/gossamer/pkg/trie/codec" ) const maxPartialKeyLength = ^uint16(0) diff --git a/internal/trie/node/key_test.go b/pkg/trie/node/key_test.go similarity index 100% rename from internal/trie/node/key_test.go rename to pkg/trie/node/key_test.go diff --git a/internal/trie/node/mocks_generate_test.go b/pkg/trie/node/mocks_generate_test.go similarity index 100% rename from internal/trie/node/mocks_generate_test.go rename to pkg/trie/node/mocks_generate_test.go diff --git a/internal/trie/node/node.go b/pkg/trie/node/node.go similarity index 100% rename from internal/trie/node/node.go rename to pkg/trie/node/node.go diff --git a/internal/trie/node/node_test.go b/pkg/trie/node/node_test.go similarity index 100% rename from internal/trie/node/node_test.go rename to pkg/trie/node/node_test.go diff --git a/internal/trie/node/reader_mock_test.go b/pkg/trie/node/reader_mock_test.go similarity index 100% rename from internal/trie/node/reader_mock_test.go rename to pkg/trie/node/reader_mock_test.go diff --git a/internal/trie/node/subvalue.go b/pkg/trie/node/subvalue.go similarity index 100% rename from internal/trie/node/subvalue.go rename to pkg/trie/node/subvalue.go diff --git a/internal/trie/node/subvalue_test.go b/pkg/trie/node/subvalue_test.go similarity index 100% rename from internal/trie/node/subvalue_test.go rename to pkg/trie/node/subvalue_test.go diff --git a/internal/trie/node/types.go b/pkg/trie/node/types.go similarity index 100% rename from internal/trie/node/types.go rename to pkg/trie/node/types.go diff --git a/internal/trie/node/variants.go b/pkg/trie/node/variants.go similarity index 100% rename from internal/trie/node/variants.go rename to pkg/trie/node/variants.go diff --git a/internal/trie/node/writer_mock_test.go b/pkg/trie/node/writer_mock_test.go similarity index 100% rename from internal/trie/node/writer_mock_test.go rename to pkg/trie/node/writer_mock_test.go diff --git a/internal/trie/pools/pools.go b/pkg/trie/pools/pools.go similarity index 100% rename from internal/trie/pools/pools.go rename to pkg/trie/pools/pools.go diff --git a/lib/trie/print.go b/pkg/trie/print.go similarity index 100% rename from lib/trie/print.go rename to pkg/trie/print.go diff --git a/lib/trie/print_test.go b/pkg/trie/print_test.go similarity index 100% rename from lib/trie/print_test.go rename to pkg/trie/print_test.go diff --git a/lib/trie/proof/database_mocks_test.go b/pkg/trie/proof/database_mocks_test.go similarity index 92% rename from lib/trie/proof/database_mocks_test.go rename to pkg/trie/proof/database_mocks_test.go index ab48cca603..8743c92069 100644 --- a/lib/trie/proof/database_mocks_test.go +++ b/pkg/trie/proof/database_mocks_test.go @@ -1,9 +1,9 @@ // Code generated by MockGen. DO NOT EDIT. -// Source: github.com/ChainSafe/gossamer/lib/trie/db (interfaces: DBGetter) +// Source: github.com/ChainSafe/gossamer/pkg/trie/db (interfaces: DBGetter) // // Generated by this command: // -// mockgen -destination=database_mocks_test.go -package=proof github.com/ChainSafe/gossamer/lib/trie/db DBGetter +// mockgen -destination=database_mocks_test.go -package=proof github.com/ChainSafe/gossamer/pkg/trie/db DBGetter // // Package proof is a generated GoMock package. diff --git a/lib/trie/proof/generate.go b/pkg/trie/proof/generate.go similarity index 95% rename from lib/trie/proof/generate.go rename to pkg/trie/proof/generate.go index 0daca83e52..2c3ed4a981 100644 --- a/lib/trie/proof/generate.go +++ b/pkg/trie/proof/generate.go @@ -8,12 +8,12 @@ import ( "errors" "fmt" - "github.com/ChainSafe/gossamer/internal/trie/codec" - "github.com/ChainSafe/gossamer/internal/trie/node" - "github.com/ChainSafe/gossamer/internal/trie/pools" "github.com/ChainSafe/gossamer/lib/common" - "github.com/ChainSafe/gossamer/lib/trie" - "github.com/ChainSafe/gossamer/lib/trie/db" + "github.com/ChainSafe/gossamer/pkg/trie" + "github.com/ChainSafe/gossamer/pkg/trie/codec" + "github.com/ChainSafe/gossamer/pkg/trie/db" + "github.com/ChainSafe/gossamer/pkg/trie/node" + "github.com/ChainSafe/gossamer/pkg/trie/pools" ) var ( diff --git a/lib/trie/proof/generate_test.go b/pkg/trie/proof/generate_test.go similarity index 99% rename from lib/trie/proof/generate_test.go rename to pkg/trie/proof/generate_test.go index 44e3c118d2..e05a7d2a55 100644 --- a/lib/trie/proof/generate_test.go +++ b/pkg/trie/proof/generate_test.go @@ -7,10 +7,10 @@ import ( "errors" "testing" - "github.com/ChainSafe/gossamer/internal/trie/codec" - "github.com/ChainSafe/gossamer/internal/trie/node" - "github.com/ChainSafe/gossamer/lib/trie" - "github.com/ChainSafe/gossamer/lib/trie/db" + "github.com/ChainSafe/gossamer/pkg/trie" + "github.com/ChainSafe/gossamer/pkg/trie/codec" + "github.com/ChainSafe/gossamer/pkg/trie/db" + "github.com/ChainSafe/gossamer/pkg/trie/node" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" diff --git a/lib/trie/proof/helpers_test.go b/pkg/trie/proof/helpers_test.go similarity index 96% rename from lib/trie/proof/helpers_test.go rename to pkg/trie/proof/helpers_test.go index 58ec6bb417..050c7094aa 100644 --- a/lib/trie/proof/helpers_test.go +++ b/pkg/trie/proof/helpers_test.go @@ -8,10 +8,10 @@ import ( "math/rand" "testing" - "github.com/ChainSafe/gossamer/internal/trie/node" "github.com/ChainSafe/gossamer/lib/common" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/pkg/scale" + "github.com/ChainSafe/gossamer/pkg/trie" + "github.com/ChainSafe/gossamer/pkg/trie/node" "github.com/stretchr/testify/require" ) diff --git a/lib/trie/proof/mocks_generate_test.go b/pkg/trie/proof/mocks_generate_test.go similarity index 71% rename from lib/trie/proof/mocks_generate_test.go rename to pkg/trie/proof/mocks_generate_test.go index adde5e4e89..cf5c92d081 100644 --- a/lib/trie/proof/mocks_generate_test.go +++ b/pkg/trie/proof/mocks_generate_test.go @@ -3,4 +3,4 @@ package proof -//go:generate mockgen -destination=database_mocks_test.go -package=$GOPACKAGE github.com/ChainSafe/gossamer/lib/trie/db DBGetter +//go:generate mockgen -destination=database_mocks_test.go -package=$GOPACKAGE github.com/ChainSafe/gossamer/pkg/trie/db DBGetter diff --git a/lib/trie/proof/proof_test.go b/pkg/trie/proof/proof_test.go similarity index 99% rename from lib/trie/proof/proof_test.go rename to pkg/trie/proof/proof_test.go index a45e4ffde3..e603311eee 100644 --- a/lib/trie/proof/proof_test.go +++ b/pkg/trie/proof/proof_test.go @@ -9,8 +9,8 @@ import ( "testing" "github.com/ChainSafe/gossamer/internal/database" - "github.com/ChainSafe/gossamer/lib/trie" - "github.com/ChainSafe/gossamer/lib/trie/db" + "github.com/ChainSafe/gossamer/pkg/trie" + "github.com/ChainSafe/gossamer/pkg/trie/db" "github.com/stretchr/testify/require" ) diff --git a/lib/trie/proof/verify.go b/pkg/trie/proof/verify.go similarity index 97% rename from lib/trie/proof/verify.go rename to pkg/trie/proof/verify.go index 97e439fdec..f913f731b4 100644 --- a/lib/trie/proof/verify.go +++ b/pkg/trie/proof/verify.go @@ -10,11 +10,11 @@ import ( "strings" "github.com/ChainSafe/gossamer/internal/log" - "github.com/ChainSafe/gossamer/internal/trie/node" - "github.com/ChainSafe/gossamer/internal/trie/pools" "github.com/ChainSafe/gossamer/lib/common" - "github.com/ChainSafe/gossamer/lib/trie" - "github.com/ChainSafe/gossamer/lib/trie/db" + "github.com/ChainSafe/gossamer/pkg/trie" + "github.com/ChainSafe/gossamer/pkg/trie/db" + "github.com/ChainSafe/gossamer/pkg/trie/node" + "github.com/ChainSafe/gossamer/pkg/trie/pools" ) var ( diff --git a/lib/trie/proof/verify_test.go b/pkg/trie/proof/verify_test.go similarity index 99% rename from lib/trie/proof/verify_test.go rename to pkg/trie/proof/verify_test.go index 78e0e5dd50..1b4e70411f 100644 --- a/lib/trie/proof/verify_test.go +++ b/pkg/trie/proof/verify_test.go @@ -6,9 +6,9 @@ package proof import ( "testing" - "github.com/ChainSafe/gossamer/internal/trie/node" - "github.com/ChainSafe/gossamer/lib/trie" - "github.com/ChainSafe/gossamer/lib/trie/db" + "github.com/ChainSafe/gossamer/pkg/trie" + "github.com/ChainSafe/gossamer/pkg/trie/db" + "github.com/ChainSafe/gossamer/pkg/trie/node" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/internal/trie/tracking/deltas.go b/pkg/trie/tracking/deltas.go similarity index 100% rename from internal/trie/tracking/deltas.go rename to pkg/trie/tracking/deltas.go diff --git a/internal/trie/tracking/deltas_test.go b/pkg/trie/tracking/deltas_test.go similarity index 100% rename from internal/trie/tracking/deltas_test.go rename to pkg/trie/tracking/deltas_test.go diff --git a/internal/trie/tracking/helpers_test.go b/pkg/trie/tracking/helpers_test.go similarity index 100% rename from internal/trie/tracking/helpers_test.go rename to pkg/trie/tracking/helpers_test.go diff --git a/internal/trie/tracking/interfaces.go b/pkg/trie/tracking/interfaces.go similarity index 100% rename from internal/trie/tracking/interfaces.go rename to pkg/trie/tracking/interfaces.go diff --git a/lib/trie/trie.go b/pkg/trie/trie.go similarity index 99% rename from lib/trie/trie.go rename to pkg/trie/trie.go index 99152be798..da30b5de26 100644 --- a/lib/trie/trie.go +++ b/pkg/trie/trie.go @@ -8,11 +8,11 @@ import ( "fmt" "reflect" - "github.com/ChainSafe/gossamer/internal/trie/codec" - "github.com/ChainSafe/gossamer/internal/trie/node" - "github.com/ChainSafe/gossamer/internal/trie/tracking" "github.com/ChainSafe/gossamer/lib/common" - "github.com/ChainSafe/gossamer/lib/trie/db" + "github.com/ChainSafe/gossamer/pkg/trie/codec" + "github.com/ChainSafe/gossamer/pkg/trie/db" + "github.com/ChainSafe/gossamer/pkg/trie/node" + "github.com/ChainSafe/gossamer/pkg/trie/tracking" ) // EmptyHash is the empty trie hash. diff --git a/lib/trie/trie_endtoend_test.go b/pkg/trie/trie_endtoend_test.go similarity index 99% rename from lib/trie/trie_endtoend_test.go rename to pkg/trie/trie_endtoend_test.go index 1cccd342be..2c2046fa6c 100644 --- a/lib/trie/trie_endtoend_test.go +++ b/pkg/trie/trie_endtoend_test.go @@ -15,8 +15,8 @@ import ( "github.com/stretchr/testify/require" "github.com/ChainSafe/gossamer/internal/database" - "github.com/ChainSafe/gossamer/internal/trie/codec" "github.com/ChainSafe/gossamer/lib/common" + "github.com/ChainSafe/gossamer/pkg/trie/codec" ) const ( diff --git a/lib/trie/trie_test.go b/pkg/trie/trie_test.go similarity index 99% rename from lib/trie/trie_test.go rename to pkg/trie/trie_test.go index 7c78e3afb2..a4bce36c2f 100644 --- a/lib/trie/trie_test.go +++ b/pkg/trie/trie_test.go @@ -9,10 +9,10 @@ import ( "reflect" "testing" - "github.com/ChainSafe/gossamer/internal/trie/node" - "github.com/ChainSafe/gossamer/internal/trie/tracking" "github.com/ChainSafe/gossamer/lib/common" - "github.com/ChainSafe/gossamer/lib/trie/db" + "github.com/ChainSafe/gossamer/pkg/trie/db" + "github.com/ChainSafe/gossamer/pkg/trie/node" + "github.com/ChainSafe/gossamer/pkg/trie/tracking" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" diff --git a/scripts/trie_state_script.go b/scripts/trie_state_script.go index 0348134c54..3117ce93c3 100644 --- a/scripts/trie_state_script.go +++ b/scripts/trie_state_script.go @@ -12,8 +12,8 @@ import ( "github.com/ChainSafe/gossamer/dot/rpc/modules" "github.com/ChainSafe/gossamer/lib/common" - "github.com/ChainSafe/gossamer/lib/trie" "github.com/ChainSafe/gossamer/pkg/scale" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/ChainSafe/gossamer/tests/utils/rpc" ) diff --git a/scripts/trie_state_script_test.go b/scripts/trie_state_script_test.go index 06bbedf654..11703b7077 100644 --- a/scripts/trie_state_script_test.go +++ b/scripts/trie_state_script_test.go @@ -9,7 +9,7 @@ import ( "github.com/ChainSafe/gossamer/dot/rpc/modules" "github.com/ChainSafe/gossamer/lib/common" - "github.com/ChainSafe/gossamer/lib/trie" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/stretchr/testify/require" ) diff --git a/tests/rpc/rpc_05-state_test.go b/tests/rpc/rpc_05-state_test.go index 9d3573cce8..c37f794077 100644 --- a/tests/rpc/rpc_05-state_test.go +++ b/tests/rpc/rpc_05-state_test.go @@ -12,9 +12,9 @@ import ( "github.com/ChainSafe/gossamer/dot/rpc/modules" "github.com/ChainSafe/gossamer/lib/common" "github.com/ChainSafe/gossamer/lib/runtime" - "github.com/ChainSafe/gossamer/lib/trie" libutils "github.com/ChainSafe/gossamer/lib/utils" "github.com/ChainSafe/gossamer/pkg/scale" + "github.com/ChainSafe/gossamer/pkg/trie" "github.com/ChainSafe/gossamer/tests/utils/config" "github.com/ChainSafe/gossamer/tests/utils/node" "github.com/ChainSafe/gossamer/tests/utils/rpc"