From 128a277b025431654b8d73f63a7a570b33d080fa Mon Sep 17 00:00:00 2001 From: harry <53987565+h5law@users.noreply.github.com> Date: Mon, 24 Jul 2023 11:24:18 +0100 Subject: [PATCH 1/2] [Docs] Update development docs to warn to not use the changelog hook (#923) Co-authored-by: Daniel Olshansky --- docs/development/README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/development/README.md b/docs/development/README.md index 351ec2da8..3f62d8a6b 100644 --- a/docs/development/README.md +++ b/docs/development/README.md @@ -86,9 +86,7 @@ Optionally activate changelog pre-commit hook cp .githooks/pre-commit .git/hooks/pre-commit chmod +x .git/hooks/pre-commit ``` - -_Please note that the Github workflow will still prevent this from merging -unless the CHANGELOG is updated._ +_**NOTE**: The pre-commit changelog verification has been disabled during the developement of V1 as of 2023-05-16 to unblock development velocity; see more details [here](https://github.com/pokt-network/pocket/assets/1892194/394fdb09-e388-44aa-820d-e9d5a23578cf). This check is no longer done in the CI and is not recommended for local development either currently._ ### Pocket Network CLI From 98bac7cb0a61010d2f41939c5b5af5d847d9620d Mon Sep 17 00:00:00 2001 From: harry <53987565+h5law@users.noreply.github.com> Date: Mon, 24 Jul 2023 22:47:00 +0100 Subject: [PATCH 2/2] [IBC] chore: Rename FlushAllEntries => FlushCachesToStore (#934) --- ibc/ibc_handle_event_test.go | 2 +- ibc/module.go | 2 +- ibc/store/bulk_store_cache.go | 6 +++--- ibc/store/provable_store.go | 4 ++-- ibc/store/provable_store_test.go | 12 ++++++------ internal/testutil/ibc/mock.go | 2 +- shared/modules/ibc_store_module.go | 4 ++-- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/ibc/ibc_handle_event_test.go b/ibc/ibc_handle_event_test.go index 9d6ed3ebe..422f450f6 100644 --- a/ibc/ibc_handle_event_test.go +++ b/ibc/ibc_handle_event_test.go @@ -81,7 +81,7 @@ func TestHandleEvent_FlushCaches(t *testing.T) { require.NoError(t, cache.Stop()) // flush the cache - err = ibcHost.GetBus().GetBulkStoreCacher().FlushAllEntries() + err = ibcHost.GetBus().GetBulkStoreCacher().FlushCachesToStore() require.NoError(t, err) cache, err = kvstore.NewKVStore(tmpDir) diff --git a/ibc/module.go b/ibc/module.go index 24736e9d4..aae9b4581 100644 --- a/ibc/module.go +++ b/ibc/module.go @@ -95,7 +95,7 @@ func (m *ibcModule) HandleEvent(event *anypb.Any) error { } // Flush all caches to disk for last height bsc := m.GetBus().GetBulkStoreCacher() - if err := bsc.FlushAllEntries(); err != nil { + if err := bsc.FlushCachesToStore(); err != nil { return err } // Prune old cache entries diff --git a/ibc/store/bulk_store_cache.go b/ibc/store/bulk_store_cache.go index 953e9ca3b..0e71de3cf 100644 --- a/ibc/store/bulk_store_cache.go +++ b/ibc/store/bulk_store_cache.go @@ -124,8 +124,8 @@ func (s *bulkStoreCache) GetAllStores() map[string]modules.ProvableStore { return s.ls.stores } -// FlushAllEntries caches all the entries for all stores in the bulkStoreCache -func (s *bulkStoreCache) FlushAllEntries() error { +// FlushdCachesToStore caches all the entries for all stores in the bulkStoreCache +func (s *bulkStoreCache) FlushCachesToStore() error { s.ls.m.Lock() defer s.ls.m.Unlock() s.logger.Info().Msg("🚽 Flushing All Cache Entries to Disk 🚽") @@ -134,7 +134,7 @@ func (s *bulkStoreCache) FlushAllEntries() error { return err } for _, store := range s.ls.stores { - if err := store.FlushEntries(disk); err != nil { + if err := store.FlushCache(disk); err != nil { s.logger.Error().Err(err).Str("store", string(store.GetCommitmentPrefix())).Msg("🚨 Error Flushing Cache 🚨") return err } diff --git a/ibc/store/provable_store.go b/ibc/store/provable_store.go index c3ff8a171..df4612725 100644 --- a/ibc/store/provable_store.go +++ b/ibc/store/provable_store.go @@ -166,8 +166,8 @@ func (p *provableStore) Root() ics23.CommitmentRoot { return root } -// FlushEntries writes all local changes to disk and clears the in-memory cache -func (p *provableStore) FlushEntries(store kvstore.KVStore) error { +// FlushCache writes all local changes to disk and clears the in-memory cache +func (p *provableStore) FlushCache(store kvstore.KVStore) error { p.m.Lock() defer p.m.Unlock() for _, entry := range p.cache { diff --git a/ibc/store/provable_store_test.go b/ibc/store/provable_store_test.go index 10fdaf3c0..174d62827 100644 --- a/ibc/store/provable_store_test.go +++ b/ibc/store/provable_store_test.go @@ -148,7 +148,7 @@ func TestProvableStore_GetAndProve(t *testing.T) { } } -func TestProvableStore_FlushEntries(t *testing.T) { +func TestProvableStore_FlushCache(t *testing.T) { provableStore := newTestProvableStore(t) kvs := []struct { key []byte @@ -177,7 +177,7 @@ func TestProvableStore_FlushEntries(t *testing.T) { } } cache := kvstore.NewMemKVStore() - require.NoError(t, provableStore.FlushEntries(cache)) + require.NoError(t, provableStore.FlushCache(cache)) keys, values, err := cache.GetAll([]byte{}, false) require.NoError(t, err) require.Len(t, keys, 3) @@ -221,7 +221,7 @@ func TestProvableStore_PruneCache(t *testing.T) { } } cache := kvstore.NewMemKVStore() - require.NoError(t, provableStore.FlushEntries(cache)) + require.NoError(t, provableStore.FlushCache(cache)) keys, _, err := cache.GetAll([]byte{}, false) require.NoError(t, err) require.Len(t, keys, 3) // 3 entries in cache should be flushed to disk @@ -264,12 +264,12 @@ func TestProvableStore_RestoreCache(t *testing.T) { } cache := kvstore.NewMemKVStore() - require.NoError(t, provableStore.FlushEntries(cache)) + require.NoError(t, provableStore.FlushCache(cache)) keys, values, err := cache.GetAll([]byte{}, false) require.NoError(t, err) require.Len(t, keys, 3) require.NoError(t, cache.ClearAll()) - require.NoError(t, provableStore.FlushEntries(cache)) + require.NoError(t, provableStore.FlushCache(cache)) newKeys, _, err := cache.GetAll([]byte{}, false) require.NoError(t, err) require.Len(t, newKeys, 0) @@ -284,7 +284,7 @@ func TestProvableStore_RestoreCache(t *testing.T) { newKeys, _, err = cache.GetAll([]byte{}, false) require.NoError(t, err) require.Len(t, newKeys, 0) - require.NoError(t, provableStore.FlushEntries(cache)) + require.NoError(t, provableStore.FlushCache(cache)) newKeys, newValues, err := cache.GetAll([]byte{}, false) require.NoError(t, err) require.Len(t, newKeys, 3) diff --git a/internal/testutil/ibc/mock.go b/internal/testutil/ibc/mock.go index d1bc22728..03ab3faa3 100644 --- a/internal/testutil/ibc/mock.go +++ b/internal/testutil/ibc/mock.go @@ -74,7 +74,7 @@ func baseBulkStoreCacherMock(t gocuke.TestingT, bus modules.Bus) *mockModules.Mo storeMock.EXPECT().AddStore(gomock.Any()).Return(nil).AnyTimes() storeMock.EXPECT().GetStore(gomock.Any()).Return(provableStoreMock, nil).AnyTimes() storeMock.EXPECT().RemoveStore(gomock.Any()).Return(nil).AnyTimes() - storeMock.EXPECT().FlushAllEntries().Return(nil).AnyTimes() + storeMock.EXPECT().FlushCachesToStore().Return(nil).AnyTimes() storeMock.EXPECT().PruneCaches(gomock.Any()).Return(nil).AnyTimes() storeMock.EXPECT().RestoreCaches(gomock.Any()).Return(nil).AnyTimes() diff --git a/shared/modules/ibc_store_module.go b/shared/modules/ibc_store_module.go index 2a308a66b..fc0196804 100644 --- a/shared/modules/ibc_store_module.go +++ b/shared/modules/ibc_store_module.go @@ -25,7 +25,7 @@ type BulkStoreCacher interface { GetStore(name string) (ProvableStore, error) RemoveStore(name string) error GetAllStores() map[string]ProvableStore - FlushAllEntries() error + FlushCachesToStore() error PruneCaches(height uint64) error RestoreCaches(height uint64) error } @@ -44,7 +44,7 @@ type ProvableStore interface { Delete(key []byte) error GetCommitmentPrefix() coreTypes.CommitmentPrefix Root() ics23.CommitmentRoot - FlushEntries(kvstore.KVStore) error + FlushCache(kvstore.KVStore) error PruneCache(store kvstore.KVStore, height uint64) error RestoreCache(store kvstore.KVStore, height uint64) error }