Skip to content

Commit

Permalink
fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
yihuang committed Apr 4, 2024
1 parent 2fb1bdc commit 2850251
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 16 deletions.
25 changes: 20 additions & 5 deletions app/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ func DefaultTxExecutor(_ context.Context,
}

func STMTxExecutor(stores []storetypes.StoreKey, workers int) baseapp.TxExecutor {
index := make(map[storetypes.StoreKey]int, len(stores))
for i, k := range stores {
index[k] = i
}
return func(
ctx context.Context,
blockSize int,
Expand All @@ -40,7 +44,7 @@ func STMTxExecutor(stores []storetypes.StoreKey, workers int) baseapp.TxExecutor
if err := block_stm.ExecuteBlock(
ctx,
blockSize,
stores,
index,
stmMultiStoreWrapper{ms},
workers,
func(txn block_stm.TxnIndex, ms block_stm.MultiStore) {
Expand Down Expand Up @@ -71,21 +75,24 @@ func newMultiStoreWrapper(ms block_stm.MultiStore, stores []storetypes.StoreKey)
return msWrapper{ms, stores, keysByName}

Check warning on line 75 in app/executor.go

View check run for this annotation

Codecov / codecov/patch

app/executor.go#L70-L75

Added lines #L70 - L75 were not covered by tests
}

func (ms msWrapper) getCacheWrapper(key storetypes.StoreKey) storetypes.CacheWrapper {
return ms.GetStore(key)

Check warning on line 79 in app/executor.go

View check run for this annotation

Codecov / codecov/patch

app/executor.go#L78-L79

Added lines #L78 - L79 were not covered by tests
}

func (ms msWrapper) GetStore(key storetypes.StoreKey) storetypes.Store {
return storetypes.Store(ms.GetKVStore(key))
return ms.GetStore(key)

Check failure on line 83 in app/executor.go

View workflow job for this annotation

GitHub Actions / Run golangci-lint

SA5007: infinite recursive call (staticcheck)

Check warning on line 83 in app/executor.go

View check run for this annotation

Codecov / codecov/patch

app/executor.go#L82-L83

Added lines #L82 - L83 were not covered by tests
}

func (ms msWrapper) GetKVStore(key storetypes.StoreKey) storetypes.KVStore {
return ms.MultiStore.GetKVStore(key)

Check warning on line 87 in app/executor.go

View check run for this annotation

Codecov / codecov/patch

app/executor.go#L86-L87

Added lines #L86 - L87 were not covered by tests
}

func (ms msWrapper) GetObjKVStore(key storetypes.StoreKey) storetypes.ObjKVStore {
// TODO
return nil
return ms.MultiStore.GetObjKVStore(key)

Check warning on line 91 in app/executor.go

View check run for this annotation

Codecov / codecov/patch

app/executor.go#L90-L91

Added lines #L90 - L91 were not covered by tests
}

func (ms msWrapper) CacheMultiStore() storetypes.CacheMultiStore {
return cachemulti.NewFromKVStore(ms.GetKVStore, ms.keysByName, nil, nil, true)
return cachemulti.NewFromParent(ms.getCacheWrapper, nil, nil)

Check warning on line 95 in app/executor.go

View check run for this annotation

Codecov / codecov/patch

app/executor.go#L94-L95

Added lines #L94 - L95 were not covered by tests
}

func (ms msWrapper) CacheMultiStoreWithVersion(_ int64) (storetypes.CacheMultiStore, error) {
Expand Down Expand Up @@ -133,6 +140,14 @@ type stmMultiStoreWrapper struct {

var _ block_stm.MultiStore = stmMultiStoreWrapper{}

func (ms stmMultiStoreWrapper) GetStore(key storetypes.StoreKey) storetypes.Store {
return ms.inner.GetStore(key)

Check warning on line 144 in app/executor.go

View check run for this annotation

Codecov / codecov/patch

app/executor.go#L143-L144

Added lines #L143 - L144 were not covered by tests
}

func (ms stmMultiStoreWrapper) GetKVStore(key storetypes.StoreKey) storetypes.KVStore {
return ms.inner.GetKVStore(key)

Check warning on line 148 in app/executor.go

View check run for this annotation

Codecov / codecov/patch

app/executor.go#L147-L148

Added lines #L147 - L148 were not covered by tests
}

func (ms stmMultiStoreWrapper) GetObjKVStore(key storetypes.StoreKey) storetypes.ObjKVStore {
return ms.inner.GetObjKVStore(key)

Check warning on line 152 in app/executor.go

View check run for this annotation

Codecov / codecov/patch

app/executor.go#L151-L152

Added lines #L151 - L152 were not covered by tests
}
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ require (
github.com/tidwall/gjson v1.14.4
github.com/tidwall/sjson v1.2.5
github.com/tyler-smith/go-bip39 v1.1.0
github.com/yihuang/go-block-stm v0.0.0-20240321085908-ff6b9b121972
github.com/yihuang/go-block-stm v0.0.0-20240404183025-a4e4c8046423
golang.org/x/net v0.21.0
golang.org/x/sync v0.6.0
golang.org/x/text v0.14.0
Expand Down Expand Up @@ -243,7 +243,7 @@ require (

replace (
// release/v0.50.x
cosmossdk.io/store => github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20240403085742-29d3142f7596
cosmossdk.io/store => github.com/yihuang/cosmos-sdk/store v0.0.0-20240404193924-d4f38fd057d6
// use cosmos keyring
github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0
github.com/cockroachdb/pebble => github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -415,8 +415,6 @@ github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7Do
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240403085742-29d3142f7596 h1:0GboNOKFdX+T9VmuMa/qW+s/XCjwgcqjomQ9Si6bm28=
github.com/crypto-org-chain/cosmos-sdk v0.46.0-beta2.0.20240403085742-29d3142f7596/go.mod h1:nRk8EA8/fEG4zSme2i/Rq5z3k7TrlsHkOYhrY79hhD8=
github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20240403085742-29d3142f7596 h1:NUjIepL9YhwwhpyefOiJIU2lm5dI+qhsJ9sPyTrMFCY=
github.com/crypto-org-chain/cosmos-sdk/store v0.0.0-20240403085742-29d3142f7596/go.mod h1:lfuLI1f4o+0SGtlHQS4x5qsjRcZZfYqG8bp3k8hM0M8=
github.com/crypto-org-chain/go-ethereum v1.10.20-0.20231207063621-43cf32d91c3e h1:vnyepPQ/m25+19xcTuBUdRxmltZ/EjVWNqEjhg7Ummk=
github.com/crypto-org-chain/go-ethereum v1.10.20-0.20231207063621-43cf32d91c3e/go.mod h1:+a8pUj1tOyJ2RinsNQD4326YS+leSoKGiG/uVVb0x6Y=
github.com/danieljoos/wincred v1.2.0 h1:ozqKHaLK0W/ii4KVbbvluM91W2H3Sh0BncbUNPS7jLE=
Expand Down Expand Up @@ -1129,8 +1127,10 @@ github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 h1:bAn7/zixMGCfxrRT
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673/go.mod h1:N3UwUGtsrSj3ccvlPHLoLsHnpR27oXr4ZE984MbSER8=
github.com/yihuang/btree v0.0.0-20240215071918-6726a9b22e40 h1:FPcNbZSQgK2d/Oj5tD4TwJM8ealdG4DLYvETLV9D5EE=
github.com/yihuang/btree v0.0.0-20240215071918-6726a9b22e40/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY=
github.com/yihuang/go-block-stm v0.0.0-20240321085908-ff6b9b121972 h1:JWX+37iE+HxaKCbDacDpoM9mFReuadR2RGOB98hbt/A=
github.com/yihuang/go-block-stm v0.0.0-20240321085908-ff6b9b121972/go.mod h1:wfjRXpaJlOhZ0awasgWFmvC/MdPmoZzWhVw5f0n121g=
github.com/yihuang/cosmos-sdk/store v0.0.0-20240404193924-d4f38fd057d6 h1:7z30s8j7xhOoGs6Y3Zlt751JkwzTYGES21efEU8Jh9c=
github.com/yihuang/cosmos-sdk/store v0.0.0-20240404193924-d4f38fd057d6/go.mod h1:lfuLI1f4o+0SGtlHQS4x5qsjRcZZfYqG8bp3k8hM0M8=
github.com/yihuang/go-block-stm v0.0.0-20240404183025-a4e4c8046423 h1:3fiPoGYWkXgUa22WHCKbrjWgX1/kixGFqVPx0dmYsW4=
github.com/yihuang/go-block-stm v0.0.0-20240404183025-a4e4c8046423/go.mod h1:U56qBapBYN86mr25QoPfL3pJyF/9a+AzL5TMlo7agWs=
github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
Expand Down
10 changes: 5 additions & 5 deletions gomod2nix.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ schema = 3
version = "v1.3.0"
hash = "sha256-EEFK43Cr0g0ndhQhkIKher0FqV3mvkmE9z0sP7uVSHg="
[mod."cosmossdk.io/store"]
version = "v0.0.0-20240403085742-29d3142f7596"
hash = "sha256-wV4pdty1onr51ZtRWS1MSR4sH3rptsLL+Zc3dPuvlIA="
replaced = "github.com/crypto-org-chain/cosmos-sdk/store"
version = "v0.0.0-20240404193924-d4f38fd057d6"
hash = "sha256-UF7viH+TYLp4eqXub4DHzQn43G34RwRAgcG7Xepsugg="
replaced = "github.com/yihuang/cosmos-sdk/store"
[mod."cosmossdk.io/tools/confix"]
version = "v0.1.1"
hash = "sha256-/Et2FFhb4XfakbLFvGQK3QxN5Y7alzO+DGfi2/EWbxo="
Expand Down Expand Up @@ -594,8 +594,8 @@ schema = 3
version = "v0.5.11"
hash = "sha256-SUyrjc2wyN3cTGKe5JdBEXjtZC1rJySRxJHVUZ59row="
[mod."github.com/yihuang/go-block-stm"]
version = "v0.0.0-20240321085908-ff6b9b121972"
hash = "sha256-Yz7Nd56KBNTFotOtSMdtnwAra5TaK6MxA7cRjPXoot0="
version = "v0.0.0-20240404183025-a4e4c8046423"
hash = "sha256-WrtgRKXasiWUh+fSX2FHcYMDpjoArKwGxLoMJ35GOEU="
[mod."github.com/zondax/hid"]
version = "v0.9.2"
hash = "sha256-9h1gEJ/loyaJvu9AsmslztiA8U9ixDTC6TBw9lCU2BE="
Expand Down

0 comments on commit 2850251

Please sign in to comment.