cosmos-sdk/testutil
Facundo Medica 6a03586074
fix: remove previous header in Prepare/Process Proposal + provide chain id in baseapp + fix context for verifying txs (#15303)
## Description

### Issue
Some values (like chain ID) were being leaked from the previous block/initialization into PrepareProposal and ProcessProposal, these values are only available if:
1. The node has never been stopped since the genesis block (as these values are set on `InitChain`)
2. The node has already commited a block (as the previous header was being used for the new state of prepare and process proposal).

So if a node is restarted, during the first prepare and process proposal these values won't be populated, and that will cause issues if they are being used.

### Solution

Remove any previous header information from a previous block in the prepare and process proposal contexts, making things consistent at every height.

- Added ChainID to baseapp
- Use an empty header in Commit() with only the chain id set
- Fix context for prepare and process proposal

Closes: #15269



---

### 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...

- [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/main/docs/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/main/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [ ] reviewed "Files changed" and left comments if necessary
- [ ] confirmed all CI checks have passed

### 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.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed 
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
2023-03-13 17:15:39 +00:00
..
cli refactor: rename to CometBFT (#14914) 2023-02-06 18:11:14 +00:00
cmdtest test: add cmdtest package (#15251) 2023-03-06 19:40:24 +00:00
configurator refactor: remove capability module (#15344) 2023-03-10 12:59:10 +00:00
mock feat!: use cosmossdk.io/log logger (#15011) 2023-02-27 21:36:22 +00:00
network fix: remove previous header in Prepare/Process Proposal + provide chain id in baseapp + fix context for verifying txs (#15303) 2023-03-13 17:15:39 +00:00
sims feat: add extend cb to avoid unmarshal appState twice for sim test (#15305) 2023-03-08 23:51:26 +00:00
testdata chore: make proto-gen due to dep update (#15268) 2023-03-06 10:54:50 +01:00
account.go refactor(crisis): CLI tests using Tendermint mock (#12874) 2022-08-10 13:54:31 +00:00
assert_helpers.go fix: correct path required proto testdata (#14991) 2023-02-11 16:59:16 +00:00
context.go chore: rename log pkg and add zerolog (#14955) 2023-02-08 11:32:22 +00:00
ioutil_test.go ci: improve error checking (errcheck linter) (#11195) 2022-04-13 06:46:51 +00:00
ioutil.go refactor!: abstractions for snapshot and pruning; snapshot intervals eventually pruned; unit tests (#11496) 2022-04-21 15:30:36 -04:00
key_test.go refactor(testutil): remove dependency on simapp (#12624) 2022-07-20 07:34:58 +00:00
key.go chore: move server.GenerateCoinKey and server.GenerateSaveCoinKey to … (#10957) 2022-01-18 15:24:16 +00:00
list.go refactor: remove weird casting for staking.Keeper in slashing and distribution (#12973) 2022-08-20 21:11:44 +00:00
rest.go refactor!: extract simulation helpers out of simapp (#13402) 2022-09-27 21:19:44 +02:00