Conversation
|
So now we store ABCI results in two places: blockstore and tx_indexer (given user has enabled it). Did not this seem wasteful to you guys? |
|
Yup. But it is quite small (just the code (int32) and data (usually nil)) are stored here. If this does bother you still, please change where it saves the data. Hash is calculated in state, that stays, but the save could change to use tx_indexer and the rpc also, and then we save a little space. |
|
@ethanfrey am curious, what's the purpose of putting "Results" in the header? |
The point is to enable cheap queries for all the results in a block.
It's so light clients can verify Merkle proofs of the results of a transaction. |
| // getBlock(h-1).Txs[5] | ||
| // | ||
| // ```shell | ||
| // curl 'localhost:46657/block_results?height=10' |
There was a problem hiding this comment.
re ^^: so here we're fetching results for height=9, right?
There was a problem hiding this comment.
changed this. now you get what you asked for
144d2b9 to
d0c0f4d
Compare
types/block.go
Outdated
| ValidatorsHash data.Bytes `json:"validators_hash"` // validators for the current block | ||
| ConsensusHash data.Bytes `json:"consensus_hash"` // consensus params for current block | ||
| AppHash data.Bytes `json:"app_hash"` // state after txs from the previous block | ||
| ResultsHash data.Bytes `json:"results_hash"` // root hash of all results from the txs from the previous block |
There was a problem hiding this comment.
Shouldn't we call it LastResultsHash ?
I see that none of the other "responses from the previous block" have Last in them, but the tx results seem different, since they really do apply to the previous block, whereas ValidatorsHash/ConsensusHash are a "change to be applied for the next block"
rpc/core/blocks.go
Outdated
| // | ||
| // Results are for the tx of the last block with the same index. | ||
| // Thus response.results[5] is the results of executing | ||
| // getBlock(h-1).Txs[5] |
There was a problem hiding this comment.
Doesn't seem right. This should have the same semantics as /commit. So block_results?height=h should return the results from executing the block at height h
state/state.go
Outdated
|
|
||
| // Store LastABCIResults along with hash | ||
| LastResults types.ABCIResults // TODO: remove?? | ||
| LastResultHash []byte // this is the one for the next block to propose |
There was a problem hiding this comment.
I think we only need the one LastResultHash like we only have the one AppHash
Codecov Report
@@ Coverage Diff @@
## develop #999 +/- ##
==========================================
Coverage ? 60.12%
==========================================
Files ? 110
Lines ? 10273
Branches ? 0
==========================================
Hits ? 6177
Misses ? 3535
Partials ? 561 |
State maintains LastResultsHash Verify that we can produce unique hashes for each result, and provide valid proofs from the root hash.
Add some tests. Behaves like saving validator set, except it always saves at each height instead of a reference to last changed.
Expose it in rpc client Move ABCIResults into tendermint/types from tendermint/state
d0c0f4d to
bfcb40b
Compare
|
@melekes want to take another look at this when you get a chance? Will merge in the meantime |
|
LGTM |
) * Add `CMT_HOME` (or remove it?) (tendermint#983) Closes tendermint#982 Added `CMT_HOME` everywhere `CMTHOME` is used. ### Notes to reviewers This could be fixed the opposite way, by removing the only reference to `CMT_HOME` in the code, and also the reference in `UPGRADING.md` (two lines of code). However, the reference in `UPGRADING.md`, which is part of our documentation, is already present in `v0.34.x` (not in `v0.37.x` though!). That's why this PR introduces `CMT_HOME` to work in equal conditions as `CMTHOME`. If reviewers lean toward removing `CMT_HOME` from the doc in `v0.34.x` (and unreleased `v0.38.x` and `main`), I can do it easily. --- #### PR checklist - [x] Tests written/updated - [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments (cherry picked from commit b7be568) # Conflicts: # UPGRADING.md # cmd/cometbft/commands/root_test.go * Revert "Add `CMT_HOME` (or remove it?) (tendermint#983)" * Add `CMT_HOME` (or remove it?) (tendermint#983) Closes tendermint#982 Added `CMT_HOME` everywhere `CMTHOME` is used. This could be fixed the opposite way, by removing the only reference to `CMT_HOME` in the code, and also the reference in `UPGRADING.md` (two lines of code). However, the reference in `UPGRADING.md`, which is part of our documentation, is already present in `v0.34.x` (not in `v0.37.x` though!). That's why this PR introduces `CMT_HOME` to work in equal conditions as `CMTHOME`. If reviewers lean toward removing `CMT_HOME` from the doc in `v0.34.x` (and unreleased `v0.38.x` and `main`), I can do it easily. --- - [x] Tests written/updated - [ ] Changelog entry added in `.changelog` (we use [unclog](https://github.com/informalsystems/unclog) to manage our changelog) - [ ] Updated relevant documentation (`docs/` or `spec/`) and code comments --------- Co-authored-by: Sergio Mena <sergio@informal.systems>
Address issue #952
This is now maintained in state and save to the db.
TODO:
LastResultsHash data.Bytesto the header{code, data}of the results from the previous block.BlockStorefor storing all the results for a given block.