From 20ee0a3525ac4fe3d6820286773f409f65877bd5 Mon Sep 17 00:00:00 2001 From: yihuang Date: Mon, 25 Mar 2024 11:45:24 +0800 Subject: [PATCH] Problem: dependencies in store is not consistent (#235) * Revert "build(deps): Bump github.com/cosmos/iavl from 1.0.1 to 1.1.1 in store (#19770)" This reverts commit ff30f6e0a4463f6de19678581e8d1114646cb1c7. * Problem: store package has dependency issues Solution: - revert the iavl bump, v1.0.2 is the version referenced by outer packages --- go.mod | 1 + go.sum | 2 -- simapp/go.mod | 1 + simapp/go.sum | 2 -- store/CHANGELOG.md | 4 ---- store/cache/cache_test.go | 11 +++++------ store/go.mod | 16 ++++++++-------- store/go.sum | 36 ++++++++++++++++++------------------ store/iavl/store.go | 3 +-- store/iavl/store_test.go | 21 ++++++++++----------- store/iavl/tree.go | 5 +++-- store/iavl/tree_test.go | 3 +-- store/prefix/store_test.go | 3 +-- store/wrapper/wrapper.go | 34 ---------------------------------- 14 files changed, 49 insertions(+), 93 deletions(-) delete mode 100644 store/wrapper/wrapper.go diff --git a/go.mod b/go.mod index 22ae5fe8ebed..cf4eb93e189a 100644 --- a/go.mod +++ b/go.mod @@ -169,6 +169,7 @@ require ( // Below are the long-lived replace of the Cosmos SDK replace ( + cosmossdk.io/store => ./store // use cosmos fork of keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // dgrijalva/jwt-go is deprecated and doesn't receive security updates. diff --git a/go.sum b/go.sum index a7a2741a8ed3..2dcc7475ba29 100644 --- a/go.sum +++ b/go.sum @@ -14,8 +14,6 @@ cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= -cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= cosmossdk.io/x/tx v0.13.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= diff --git a/simapp/go.mod b/simapp/go.mod index c8dd9837ccc4..19c716a5db9c 100644 --- a/simapp/go.mod +++ b/simapp/go.mod @@ -207,6 +207,7 @@ require ( // Below are the long-lived replace of the SimApp replace ( + cosmossdk.io/store => ../store // use cosmos fork of keyring github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 // Simapp always use the latest version of the cosmos-sdk diff --git a/simapp/go.sum b/simapp/go.sum index c2b293c55ffc..304effe160a3 100644 --- a/simapp/go.sum +++ b/simapp/go.sum @@ -200,8 +200,6 @@ cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= -cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= cosmossdk.io/tools/confix v0.1.1 h1:aexyRv9+y15veH3Qw16lxQwo+ki7r2I+g0yNTEFEQM8= cosmossdk.io/tools/confix v0.1.1/go.mod h1:nQVvP1tHsGXS83PonPVWJtSbddIqyjEw99L4M3rPJyQ= cosmossdk.io/x/circuit v0.1.0 h1:IAej8aRYeuOMritczqTlljbUVHq1E85CpBqaCTwYgXs= diff --git a/store/CHANGELOG.md b/store/CHANGELOG.md index 95a55120ae45..b56a47dd9af1 100644 --- a/store/CHANGELOG.md +++ b/store/CHANGELOG.md @@ -31,10 +31,6 @@ Ref: https://keepachangelog.com/en/1.0.0/ ## v1.1.0 (March 20, 2024) -### Improvements - -* [#19770](https://github.com/cosmos/cosmos-sdk/pull/19770) Upgrade IAVL to IAVL v1.1.1. - ## v1.0.2 (January 10, 2024) ### Bug Fixes diff --git a/store/cache/cache_test.go b/store/cache/cache_test.go index efbf22c8e18e..0340f7ecbd8d 100644 --- a/store/cache/cache_test.go +++ b/store/cache/cache_test.go @@ -13,11 +13,10 @@ import ( "cosmossdk.io/store/cachekv" iavlstore "cosmossdk.io/store/iavl" "cosmossdk.io/store/types" - "cosmossdk.io/store/wrapper" ) func TestGetOrSetStoreCache(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() mngr := cache.NewCommitKVStoreCacheManager(cache.DefaultCommitKVStoreCacheSize) sKey := types.NewKVStoreKey("test") @@ -30,7 +29,7 @@ func TestGetOrSetStoreCache(t *testing.T) { } func TestUnwrap(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() mngr := cache.NewCommitKVStoreCacheManager(cache.DefaultCommitKVStoreCacheSize) sKey := types.NewKVStoreKey("test") @@ -43,7 +42,7 @@ func TestUnwrap(t *testing.T) { } func TestStoreCache(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() mngr := cache.NewCommitKVStoreCacheManager(cache.DefaultCommitKVStoreCacheSize) sKey := types.NewKVStoreKey("test") @@ -69,7 +68,7 @@ func TestStoreCache(t *testing.T) { } func TestReset(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() mngr := cache.NewCommitKVStoreCacheManager(cache.DefaultCommitKVStoreCacheSize) sKey := types.NewKVStoreKey("test") @@ -89,7 +88,7 @@ func TestReset(t *testing.T) { } func TestCacheWrap(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() mngr := cache.NewCommitKVStoreCacheManager(cache.DefaultCommitKVStoreCacheSize) sKey := types.NewKVStoreKey("test") diff --git a/store/go.mod b/store/go.mod index f587701c2fdf..c9950b02ce56 100644 --- a/store/go.mod +++ b/store/go.mod @@ -9,7 +9,7 @@ require ( github.com/cometbft/cometbft v0.38.6 github.com/cosmos/cosmos-db v1.0.2 github.com/cosmos/gogoproto v1.4.11 - github.com/cosmos/iavl v1.1.1 + github.com/cosmos/iavl v1.0.1 github.com/cosmos/ics23/go v0.10.0 github.com/golang/mock v1.6.0 github.com/golang/protobuf v1.5.4 // indirect @@ -20,7 +20,7 @@ require ( github.com/spf13/cast v1.6.0 // indirect github.com/stretchr/testify v1.8.4 github.com/tidwall/btree v1.7.0 - golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f + golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 google.golang.org/grpc v1.60.0 google.golang.org/protobuf v1.33.0 gotest.tools/v3 v3.5.1 @@ -61,17 +61,17 @@ require ( github.com/petermattis/goid v0.0.0-20221215004737-a150e88a970d // indirect github.com/pkg/errors v0.9.1 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.19.0 // indirect + github.com/prometheus/client_golang v1.18.0 // indirect github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.50.0 // indirect - github.com/prometheus/procfs v0.13.0 // indirect + github.com/prometheus/common v0.47.0 // indirect + github.com/prometheus/procfs v0.12.0 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rs/zerolog v1.32.0 // indirect github.com/sasha-s/go-deadlock v0.3.1 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect - golang.org/x/crypto v0.21.0 // indirect - golang.org/x/net v0.22.0 // indirect - golang.org/x/sys v0.18.0 // indirect + golang.org/x/crypto v0.19.0 // indirect + golang.org/x/net v0.20.0 // indirect + golang.org/x/sys v0.17.0 // indirect golang.org/x/text v0.14.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20231120223509-83a465c0220f // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/store/go.sum b/store/go.sum index a2692063e174..5b83ff072607 100644 --- a/store/go.sum +++ b/store/go.sum @@ -50,8 +50,8 @@ github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAK github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g= github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y= -github.com/cosmos/iavl v1.1.1 h1:64nTi8s3gEoGqhA8TyAWFWfz7/pg0anKzHNSc1ETc7Q= -github.com/cosmos/iavl v1.1.1/go.mod h1:jLeUvm6bGT1YutCaL2fIar/8vGUE8cPZvh/gXEWDaDM= +github.com/cosmos/iavl v1.0.1 h1:D+mYbcRO2wptYzOM1Hxl9cpmmHU1ZEt9T2Wv5nZTeUw= +github.com/cosmos/iavl v1.0.1/go.mod h1:8xIUkgVvwvVrBu81scdPty+/Dx9GqwHnAvXz4cwF7RY= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= @@ -211,8 +211,8 @@ github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= -github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU= -github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k= +github.com/prometheus/client_golang v1.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= +github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= @@ -220,13 +220,13 @@ github.com/prometheus/client_model v0.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZ github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= -github.com/prometheus/common v0.50.0 h1:YSZE6aa9+luNa2da6/Tik0q0A5AbR+U003TItK57CPQ= -github.com/prometheus/common v0.50.0/go.mod h1:wHFBCEVWVmHMUpg7pYcOm2QUR/ocQdYSJVQJKnHc3xQ= +github.com/prometheus/common v0.47.0 h1:p5Cz0FNHo7SnWOmWmoRozVcjEp0bIVU8cV7OShpjL1k= +github.com/prometheus/common v0.47.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= -github.com/prometheus/procfs v0.13.0 h1:GqzLlQyfsPbaEHaQkO7tbDlriv/4o5Hudv6OXHGKX7o= -github.com/prometheus/procfs v0.13.0/go.mod h1:cd4PFCR54QLnGKPaKGA6l+cfuNXtht43ZKY6tow0Y1g= +github.com/prometheus/procfs v0.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= +github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= @@ -260,10 +260,10 @@ golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnf golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= -golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= -golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f h1:3CW0unweImhOzd5FmYuRsD4Y4oQFKZIjAnKbjV4WIrw= -golang.org/x/exp v0.0.0-20240314144324-c7f7c6466f7f/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= +golang.org/x/crypto v0.19.0 h1:ENy+Az/9Y1vSrlrvBSyna3PITt4tiZLf7sgCjZBX7Wo= +golang.org/x/crypto v0.19.0/go.mod h1:Iy9bg/ha4yyC70EfRS8jz+B6ybOBKMaSxLj6P6oBDfU= +golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ= +golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= @@ -279,8 +279,8 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= -golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo= +golang.org/x/net v0.20.0/go.mod h1:z8BVo6PvndSri0LbOE3hAn0apkU+1YvI6E70E9jsnvY= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -288,8 +288,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.5.0 h1:60k92dhOjHxJkrqnwsfl8KuaHbn/5dl0lUPUklKo3qE= +golang.org/x/sync v0.5.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -320,8 +320,8 @@ golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.17.0 h1:25cE3gD+tdBA7lp7QfhuV+rJiE9YXTcS3VG1SqssI/Y= +golang.org/x/sys v0.17.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/store/iavl/store.go b/store/iavl/store.go index e73dcd6c1fdd..c52feb89544d 100644 --- a/store/iavl/store.go +++ b/store/iavl/store.go @@ -16,7 +16,6 @@ import ( "cosmossdk.io/store/metrics" pruningtypes "cosmossdk.io/store/pruning/types" "cosmossdk.io/store/types" - "cosmossdk.io/store/wrapper" ) const ( @@ -50,7 +49,7 @@ func LoadStore(db dbm.DB, logger log.Logger, key types.StoreKey, id types.Commit // provided DB. An error is returned if the version fails to load, or if called with a positive // version on an empty tree. func LoadStoreWithInitialVersion(db dbm.DB, logger log.Logger, key types.StoreKey, id types.CommitID, initialVersion uint64, cacheSize int, disableFastNode bool, metrics metrics.StoreMetrics) (types.CommitKVStore, error) { - tree := iavl.NewMutableTree(wrapper.NewDBWrapper(db), cacheSize, disableFastNode, logger, iavl.InitialVersionOption(initialVersion)) + tree := iavl.NewMutableTree(db, cacheSize, disableFastNode, logger, iavl.InitialVersionOption(initialVersion)) isUpgradeable, err := tree.IsUpgradeable() if err != nil { diff --git a/store/iavl/store_test.go b/store/iavl/store_test.go index 46d9fa62371c..d9a47b21fb7b 100644 --- a/store/iavl/store_test.go +++ b/store/iavl/store_test.go @@ -17,7 +17,6 @@ import ( "cosmossdk.io/store/internal/kv" "cosmossdk.io/store/metrics" "cosmossdk.io/store/types" - "cosmossdk.io/store/wrapper" ) var ( @@ -38,7 +37,7 @@ func randBytes(numBytes int) []byte { // make a tree with data from above and save it func newAlohaTree(t *testing.T, db dbm.DB) (*iavl.MutableTree, types.CommitID) { t.Helper() - tree := iavl.NewMutableTree(wrapper.NewDBWrapper(db), cacheSize, false, log.NewNopLogger()) + tree := iavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger()) for k, v := range treeData { _, err := tree.Set([]byte(k), []byte(v)) @@ -286,7 +285,7 @@ func TestIAVLIterator(t *testing.T) { } func TestIAVLReverseIterator(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() tree := iavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger()) @@ -320,7 +319,7 @@ func TestIAVLReverseIterator(t *testing.T) { } func TestIAVLPrefixIterator(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() tree := iavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger()) iavlStore := UnsafeNewStore(tree) @@ -383,7 +382,7 @@ func TestIAVLPrefixIterator(t *testing.T) { } func TestIAVLReversePrefixIterator(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() tree := iavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger()) iavlStore := UnsafeNewStore(tree) @@ -450,7 +449,7 @@ func nextVersion(iavl *Store) { } func TestIAVLNoPrune(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() tree := iavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger()) iavlStore := UnsafeNewStore(tree) @@ -468,7 +467,7 @@ func TestIAVLNoPrune(t *testing.T) { } func TestIAVLStoreQuery(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() tree := iavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger()) iavlStore := UnsafeNewStore(tree) @@ -580,7 +579,7 @@ func TestIAVLStoreQuery(t *testing.T) { func BenchmarkIAVLIteratorNext(b *testing.B) { b.ReportAllocs() - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() treeSize := 1000 tree := iavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger()) @@ -616,7 +615,7 @@ func TestSetInitialVersion(t *testing.T) { { "works with a mutable tree", func(db *dbm.MemDB) *Store { - tree := iavl.NewMutableTree(wrapper.NewDBWrapper(db), cacheSize, false, log.NewNopLogger()) + tree := iavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger()) store := UnsafeNewStore(tree) return store @@ -625,7 +624,7 @@ func TestSetInitialVersion(t *testing.T) { { "throws error on immutable tree", func(db *dbm.MemDB) *Store { - tree := iavl.NewMutableTree(wrapper.NewDBWrapper(db), cacheSize, false, log.NewNopLogger()) + tree := iavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger()) store := UnsafeNewStore(tree) _, version, err := store.tree.SaveVersion() require.NoError(t, err) @@ -670,7 +669,7 @@ func TestChangeSets(t *testing.T) { treeSize := 1000 treeVersion := int64(10) targetVersion := int64(6) - tree := iavl.NewMutableTree(wrapper.NewDBWrapper(db), cacheSize, false, log.NewNopLogger(), iavl.FlushThresholdOption(math.MaxInt)) + tree := iavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger(), iavl.FlushThresholdOption(math.MaxInt)) for j := int64(0); j < treeVersion; j++ { keys := [][]byte{} diff --git a/store/iavl/tree.go b/store/iavl/tree.go index 889fc1d5a07f..a44559784a86 100644 --- a/store/iavl/tree.go +++ b/store/iavl/tree.go @@ -4,7 +4,8 @@ import ( "fmt" "github.com/cosmos/iavl" - idb "github.com/cosmos/iavl/db" + + "cosmossdk.io/store/types" ) var ( @@ -31,7 +32,7 @@ type ( GetVersioned(key []byte, version int64) ([]byte, error) GetImmutable(version int64) (*iavl.ImmutableTree, error) SetInitialVersion(version uint64) - Iterator(start, end []byte, ascending bool) (idb.Iterator, error) + Iterator(start, end []byte, ascending bool) (types.Iterator, error) AvailableVersions() []int LoadVersionForOverwriting(targetVersion int64) error TraverseStateChanges(startVersion, endVersion int64, fn func(version int64, changeSet *iavl.ChangeSet) error) error diff --git a/store/iavl/tree_test.go b/store/iavl/tree_test.go index 243355e42e08..63a12a2e5d28 100644 --- a/store/iavl/tree_test.go +++ b/store/iavl/tree_test.go @@ -8,12 +8,11 @@ import ( "github.com/stretchr/testify/require" "cosmossdk.io/log" - "cosmossdk.io/store/wrapper" ) func TestImmutableTreePanics(t *testing.T) { t.Parallel() - immTree := iavl.NewImmutableTree(wrapper.NewDBWrapper(dbm.NewMemDB()), 100, false, log.NewNopLogger()) + immTree := iavl.NewImmutableTree(dbm.NewMemDB(), 100, false, log.NewNopLogger()) it := &immutableTree{immTree} require.Panics(t, func() { _, err := it.Set([]byte{}, []byte{}) diff --git a/store/prefix/store_test.go b/store/prefix/store_test.go index 818733033e09..af2605818c52 100644 --- a/store/prefix/store_test.go +++ b/store/prefix/store_test.go @@ -14,7 +14,6 @@ import ( "cosmossdk.io/store/gaskv" "cosmossdk.io/store/iavl" "cosmossdk.io/store/types" - "cosmossdk.io/store/wrapper" ) // copied from iavl/store_test.go @@ -91,7 +90,7 @@ func testPrefixStore(t *testing.T, baseStore types.KVStore, prefix []byte) { } func TestIAVLStorePrefix(t *testing.T) { - db := wrapper.NewDBWrapper(dbm.NewMemDB()) + db := dbm.NewMemDB() tree := tiavl.NewMutableTree(db, cacheSize, false, log.NewNopLogger()) iavlStore := iavl.UnsafeNewStore(tree) diff --git a/store/wrapper/wrapper.go b/store/wrapper/wrapper.go deleted file mode 100644 index 5ccb4aef4698..000000000000 --- a/store/wrapper/wrapper.go +++ /dev/null @@ -1,34 +0,0 @@ -package wrapper - -import ( - dbm "github.com/cosmos/cosmos-db" - idb "github.com/cosmos/iavl/db" -) - -var _ idb.DB = &DBWrapper{} - -// DBwrapper is a simple wrapper of dbm.DB that implements the iavl.DB interface. -type DBWrapper struct { - dbm.DB -} - -// NewDBWrapper creates a new DBWrapper instance. -func NewDBWrapper(db dbm.DB) *DBWrapper { - return &DBWrapper{db} -} - -func (dbw *DBWrapper) NewBatch() idb.Batch { - return dbw.DB.NewBatch() -} - -func (dbw *DBWrapper) NewBatchWithSize(size int) idb.Batch { - return dbw.DB.NewBatchWithSize(size) -} - -func (dbw *DBWrapper) Iterator(start, end []byte) (idb.Iterator, error) { - return dbw.DB.Iterator(start, end) -} - -func (dbw *DBWrapper) ReverseIterator(start, end []byte) (idb.Iterator, error) { - return dbw.DB.ReverseIterator(start, end) -}