chore(state): Copy Iterator Key() and Value() APIs return values.#3541
chore(state): Copy Iterator Key() and Value() APIs return values.#3541
Iterator Key() and Value() APIs return values.#3541Conversation
|
If/when this is ready for review, please hit the "ready for review" button |
884c0c9 to
e28659f
Compare
Shouldn't we first bump the Go version of cometBFT to 1.22.5, i.e., the same version that the latest cometbft-db uses? |
yes |
…e() returned object". Copying the Iterator.Value() object is unnecessary here. This reverts commit 9df0d8b.
898bb22 to
0bff6b2
Compare
There is now a separate PR bumping cometbft-db version. |
…s. (#3541) Related to cometbft/cometbft-db#168. #### Changes We recently updated cometbft-db `Iterator` type `Key()` and `Value()` APIs to return their values directly instead of a copy. Therefore, this PR ensures that code in cometbft that modifies or stores references to the return value of those APIs creates a copy before continuing. --- #### PR checklist ~- [ ] Tests written/updated~ - [x] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [x] Updated relevant documentation (`docs/` or `spec/`) and code comments - [x] Title follows the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec (cherry picked from commit 3be35f0)
…s. (backport #3541) (#3598) Related to cometbft/cometbft-db#168. #### Changes We recently updated cometbft-db `Iterator` type `Key()` and `Value()` APIs to return their values directly instead of a copy. Therefore, this PR ensures that code in cometbft that modifies or stores references to the return value of those APIs creates a copy before continuing. --- #### PR checklist ~- [ ] Tests written/updated~ - [x] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [x] Updated relevant documentation (`docs/` or `spec/`) and code comments - [x] Title follows the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) spec <hr>This is an automatic backport of pull request #3541 done by [Mergify](https://mergify.com). Co-authored-by: Alessandro Sforzin <alessandro@informal.systems>
Related to cometbft/cometbft-db#168.
Changes
We recently updated cometbft-db
IteratortypeKey()andValue()APIs to return their values directly instead of a copy.Therefore, this PR ensures that code in cometbft that modifies or stores references to the return value of those APIs creates a copy before continuing.
PR checklist
- [ ] Tests written/updated.changelog(we use unclog to manage our changelog)docs/orspec/) and code comments