-
Notifications
You must be signed in to change notification settings - Fork 4k
draft: block stm backports test #24488
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
generic interface generic btree generic cachekv generic transient store support ObjStore changelog Update CHANGELOG.md Signed-off-by: yihuang <[email protected]> object store key Apply review suggestions fix merge conflict fix snapshot revert dependers prefix store support object store (cosmos#236) Problem: snapshot for object store is not skipped (cosmos#585) resolve
fix and add test
* Problem: MultiStore interface is bloated Solution: - Split out specialied methods from it, keeping the MultiStore generic * Update store/CHANGELOG.md Signed-off-by: yihuang <[email protected]> --------- Signed-off-by: yihuang <[email protected]>
* Problem: nested cache store not efficient Solution: - introduce copy-on-write btree based cache store temp * changelog * rename * Update store/cachekv/store.go Signed-off-by: yihuang <[email protected]> --------- Signed-off-by: yihuang <[email protected]>
Solution: - init cachestore on cachestore lazily. - cleanup some unused stuff. Update store/CHANGELOG.md Signed-off-by: yihuang <[email protected]>
add basic support in sdk: - add a TxExecutor baseapp option - add TxIndex/TxCount/MsgIndex in context Update CHANGELOG.md Signed-off-by: yihuang <[email protected]> fix misspell fix lint run gci fix lint gci seems not compatible with gofumpt
…s#237) * Problem: no efficient way to collect fee Solution: - support an idea of virtual account in bank module, where the incoming coins are accumulated in a per-tx object store first, then accumulate and credit to the real account at end blocker. it's nesserary to support parallel tx execution, where we try not to access shared states. more efficient sum support SendCoinsFromModuleToAccountVirtual fix test fix test * fix lint * fix test * fix test * fix test * fix test * fix test * fix mock keeper * try fix lint * try fix lint * reuse code * try fix linter * Update x/bank/keeper/send.go Signed-off-by: yihuang <[email protected]> * algin panic call * fix error handling * try fix lint * nolintlint generate falst postiive --------- Signed-off-by: yihuang <[email protected]>
* Support RunAtomic API * add unit test
fix and add test
Solution: - fix and add test to support the usage pattern in ethermint add Discard method to CacheWrap better testing
* feat: save some memory allocations on un-used cache store * Update CHANGELOG.md Signed-off-by: yihuang <[email protected]> * Update store/internal/btree/btree.go Signed-off-by: yihuang <[email protected]> --------- Signed-off-by: yihuang <[email protected]>
Solution: - fix the way context is updated
Solution: - add checks
…osmos#258) Solution: - add API NewFromParent to cache multistore. Update store/CHANGELOG.md Signed-off-by: yihuang <[email protected]> fix test fix lint
* mutex don't cover GetSigners don't clone header in context * Update CHANGELOG.md Signed-off-by: yihuang <[email protected]> * update comment --------- Signed-off-by: yihuang <[email protected]>
…osmos#507) * Problem: mempool don't respect gas wanted returned by ante handler Solution: - support custom gas wanted in mempool * Update CHANGELOG.md Signed-off-by: yihuang <[email protected]> * cleanup * cleanup * fix priorityIndex * fix process proposal * fix lint * fix lint --------- Signed-off-by: yihuang <[email protected]>
* Problem: redundant mutex for InsertWithGasWanted cfg of PriorityNonceMempool remains unchanged once assigned, so no lock is required * make mocks * cleanup * keep order of check MaxTx
… of same tx (cosmos#565) * Problem: signature verification result not cache between incarnations of same tx Closes: cosmos#564 Solution: - introduce incarnation cache that's shared between incarnations of the same tx * Update CHANGELOG.md Signed-off-by: yihuang <[email protected]> * Update types/context.go Signed-off-by: yihuang <[email protected]> * Update types/context.go Signed-off-by: yihuang <[email protected]> * fix nil convert --------- Signed-off-by: yihuang <[email protected]> Problem: gas consumed differs after enabled cache (cosmos#570) * Problem: gas consumed differs after enabled cache * fix test * Revert "Problem: gas consumed differs after enabled cache" This reverts commit f33944e. * Revert "Problem: signature verification result not cache between incarnations of same tx (cosmos#565)" This reverts commit 5a1594f. * keep interface
* Problem: tx executor can't do dependency analysis Solution: - change the api to allow static analysis on tx body * fix * changelog * cleanup * Update CHANGELOG.md Signed-off-by: yihuang <[email protected]> --------- Signed-off-by: yihuang <[email protected]>
Ironbird - launch a networkTo use Ironbird, you can use the following commands:
|
txGasLimit = gasTx.GetGas() | ||
} | ||
|
||
stop := h.txSelector.SelectTxForProposal(ctx, uint64(req.MaxTxBytes), maxBlockGas, tx, txBz, txGasLimit) |
Check failure
Code scanning / gosec
integer overflow conversion uint64 -> uint32 Error
} else { | ||
stop := h.txSelector.SelectTxForProposal(ctx, uint64(req.MaxTxBytes), maxBlockGas, memTx, txBz) | ||
stop := h.txSelector.SelectTxForProposal(ctx, uint64(req.MaxTxBytes), maxBlockGas, memTx.Tx, txBz, memTx.GasWanted) |
Check failure
Code scanning / gosec
integer overflow conversion uint64 -> uint32 Error
gs.gasMeter.ConsumeGas(gs.gasConfig.ReadCostFlat, types.GasReadCostFlatDesc) | ||
value = gs.parent.Get(key) | ||
|
||
// TODO overflow-safe math? | ||
gs.gasMeter.ConsumeGas(gs.gasConfig.ReadCostPerByte*types.Gas(len(key)), types.GasReadPerByteDesc) | ||
gs.gasMeter.ConsumeGas(gs.gasConfig.ReadCostPerByte*types.Gas(len(value)), types.GasReadPerByteDesc) | ||
gs.gasMeter.ConsumeGas(gs.gasConfig.ReadCostPerByte*types.Gas(gs.valueLen(value)), types.GasReadPerByteDesc) |
Check failure
Code scanning / gosec
integer overflow conversion uint64 -> uint32 Error
gs.gasMeter.ConsumeGas(gs.gasConfig.WriteCostFlat, types.GasWriteCostFlatDesc) | ||
// TODO overflow-safe math? | ||
gs.gasMeter.ConsumeGas(gs.gasConfig.WriteCostPerByte*types.Gas(len(key)), types.GasWritePerByteDesc) | ||
gs.gasMeter.ConsumeGas(gs.gasConfig.WriteCostPerByte*types.Gas(len(value)), types.GasWritePerByteDesc) | ||
gs.gasMeter.ConsumeGas(gs.gasConfig.WriteCostPerByte*types.Gas(gs.valueLen(value)), types.GasWritePerByteDesc) |
Check failure
Code scanning / gosec
integer overflow conversion uint64 -> uint32 Error
if gi.Valid() { | ||
key := gi.Key() | ||
value := gi.Value() | ||
|
||
gi.gasMeter.ConsumeGas(gi.gasConfig.ReadCostPerByte*types.Gas(len(key)), types.GasValuePerByteDesc) | ||
gi.gasMeter.ConsumeGas(gi.gasConfig.ReadCostPerByte*types.Gas(len(value)), types.GasValuePerByteDesc) | ||
gi.gasMeter.ConsumeGas(gi.gasConfig.ReadCostPerByte*types.Gas(gi.valueLen(value)), types.GasValuePerByteDesc) |
Check failure
Code scanning / gosec
integer overflow conversion uint64 -> uint32 Error
|
||
key := make([]byte, len(addr)+8) | ||
copy(key, addr) | ||
binary.BigEndian.PutUint64(key[len(addr):], uint64(sdkCtx.TxIndex())) |
Check failure
Code scanning / gosec
integer overflow conversion uint64 -> uint32 Error
|
||
key := make([]byte, len(addr)+8) | ||
copy(key, addr) | ||
binary.BigEndian.PutUint64(key[len(addr):], uint64(sdkCtx.TxIndex())) |
Check failure
Code scanning / gosec
integer overflow conversion uint64 -> uint32 Error
for _, store := range cms.stores { | ||
store.Discard() | ||
} |
Check warning
Code scanning / CodeQL
Iteration over map Warning
store = cms.initStore(key, cms.parentStore(key)) | ||
} | ||
if key == nil || store == nil { | ||
panic(fmt.Sprintf("kv store with key %v has not been registered in stores", key)) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
func (cms Store) GetObjKVStore(key types.StoreKey) types.ObjKVStore { | ||
store, ok := cms.getCacheWrapper(key).(types.ObjKVStore) | ||
if !ok { | ||
panic(fmt.Sprintf("store with key %v is not ObjKVStore", key)) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
for k, v := range cms.stores { | ||
stores[k] = v.(types.BranchStore).Clone().(types.CacheWrap) | ||
} |
Check warning
Code scanning / CodeQL
Iteration over map Warning
for k, v := range cms.stores { | ||
if _, ok := other.stores[k]; !ok { | ||
// clear the cache store if it's not in the other | ||
v.Discard() | ||
} | ||
} |
Check warning
Code scanning / CodeQL
Iteration over map Warning
panic(fmt.Sprintf("store with key %v is not ObjKVStore", key)) | ||
} | ||
|
||
return store |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
// AssertValidValueGeneric checks if the value is valid(value is not nil and within length limit) | ||
func AssertValidValueGeneric[V any](value V, isZero func(V) bool, valueLen func(V) int) { | ||
if isZero(value) { | ||
panic("value is nil") |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
panic("value is nil") | ||
} | ||
AssertValidValueLength(valueLen(value)) | ||
} |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
for key := range okeys { | ||
cms.MountStoreWithDB(okeys[key], storetypes.StoreTypeObject, nil) | ||
} |
Check warning
Code scanning / CodeQL
Iteration over map Warning test
@@ -303,3 +306,7 @@ | |||
|
|||
return nil | |||
} | |||
|
|||
func (am AppModule) EndBlock(ctx context.Context) error { | |||
return am.keeper.CreditVirtualAccounts(ctx) |
Check warning
Code scanning / CodeQL
Panic in BeginBock or EndBlock consensus methods Warning
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
path flow from Begin/EndBlock to a panic call
Description
This PR includes block store feature #24159, block stm features and cachekv improvement backports, and used for test under crypto-org-chain/ethermint#564
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
in the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
Please see Pull Request Reviewer section in the contributing guide for more information on how to review a pull request.
I have...