From 3d0ea297f4307cff5c8b7b2002caa387af52e744 Mon Sep 17 00:00:00 2001 From: Rootul Patel Date: Wed, 17 Aug 2022 07:01:19 -0600 Subject: [PATCH 1/2] log proposerAddress for rejected blocks (#611) --- app/process_proposal.go | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/app/process_proposal.go b/app/process_proposal.go index 7de8142e85..549776eaf5 100644 --- a/app/process_proposal.go +++ b/app/process_proposal.go @@ -54,6 +54,8 @@ func (app *App) ProcessProposal(req abci.RequestProcessProposal) abci.ResponsePr rejectedPropBlockLog, "reason", "varying number of messages and payForData txs in the same block", + "proposerAddress", + req.Header.ProposerAddress, ) return abci.ResponseProcessProposal{ Result: abci.ResponseProcessProposal_REJECT, @@ -70,6 +72,8 @@ func (app *App) ProcessProposal(req abci.RequestProcessProposal) abci.ResponsePr "found a message that uses an invalid namespace id", "error", err.Error(), + "proposerAddress", + req.Header.ProposerAddress, ) return abci.ResponseProcessProposal{ Result: abci.ResponseProcessProposal_REJECT, @@ -84,6 +88,8 @@ func (app *App) ProcessProposal(req abci.RequestProcessProposal) abci.ResponsePr "failure to create commitment for included message", "error", err.Error(), + "proposerAddress", + req.Header.ProposerAddress, ) return abci.ResponseProcessProposal{ Result: abci.ResponseProcessProposal_REJECT, @@ -92,7 +98,7 @@ func (app *App) ProcessProposal(req abci.RequestProcessProposal) abci.ResponsePr // TODO: refactor to actually check for subtree roots instead of simply inclusion see issues #382 and #383 if _, has := commitments[string(commit)]; !has { - app.Logger().Info(rejectedPropBlockLog, "reason", "missing MsgPayForData for included message") + app.Logger().Error(rejectedPropBlockLog, "reason", "missing MsgPayForData for included message", "proposerAddress", req.Header.ProposerAddress) return abci.ResponseProcessProposal{ Result: abci.ResponseProcessProposal_REJECT, } @@ -101,7 +107,7 @@ func (app *App) ProcessProposal(req abci.RequestProcessProposal) abci.ResponsePr data, err := coretypes.DataFromProto(req.BlockData) if err != nil { - app.Logger().Error(rejectedPropBlockLog, "reason", "failure to unmarshal block data:", "error", err) + app.Logger().Error(rejectedPropBlockLog, "reason", "failure to unmarshal block data:", "error", err, "proposerAddress", req.Header.ProposerAddress) return abci.ResponseProcessProposal{ Result: abci.ResponseProcessProposal_REJECT, } @@ -116,7 +122,7 @@ func (app *App) ProcessProposal(req abci.RequestProcessProposal) abci.ResponsePr shares, _, err := data.ComputeShares(req.BlockData.OriginalSquareSize) if err != nil { - app.Logger().Error(rejectedPropBlockLog, "reason", "failure to compute shares from block data:", "error", err) + app.Logger().Error(rejectedPropBlockLog, "reason", "failure to compute shares from block data:", "error", err, "proposerAddress", req.Header.ProposerAddress) return abci.ResponseProcessProposal{ Result: abci.ResponseProcessProposal_REJECT, } @@ -130,6 +136,8 @@ func (app *App) ProcessProposal(req abci.RequestProcessProposal) abci.ResponsePr "failure to erasure the data square", "error", err, + "proposerAddress", + req.Header.ProposerAddress, ) return abci.ResponseProcessProposal{ Result: abci.ResponseProcessProposal_REJECT, @@ -143,6 +151,8 @@ func (app *App) ProcessProposal(req abci.RequestProcessProposal) abci.ResponsePr rejectedPropBlockLog, "reason", "proposed data root differs from calculated data root", + "proposerAddress", + req.Header.ProposerAddress, ) return abci.ResponseProcessProposal{ Result: abci.ResponseProcessProposal_REJECT, From a5877a4f2ac21085e50832098b45323a2a3915af Mon Sep 17 00:00:00 2001 From: Rootul Patel Date: Wed, 17 Aug 2022 11:14:32 -0600 Subject: [PATCH 2/2] chore: move scripts from contrib to scripts/ (#625) --- .gitignore | 1 + Makefile | 2 +- {contrib => docker}/Dockerfile.test | 4 ++-- {contrib => scripts}/localnet-blocks-test.sh | 0 {contrib => scripts}/single-node.sh | 0 {contrib => scripts}/test_cover.sh | 0 6 files changed, 4 insertions(+), 3 deletions(-) rename {contrib => docker}/Dockerfile.test (95%) rename {contrib => scripts}/localnet-blocks-test.sh (100%) rename {contrib => scripts}/single-node.sh (100%) rename {contrib => scripts}/test_cover.sh (100%) diff --git a/.gitignore b/.gitignore index d1de802be9..f8070ec071 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ build coverage.txt tools-stamp .vscode +profile.out diff --git a/Makefile b/Makefile index 2e49d85823..05e0ead5f2 100644 --- a/Makefile +++ b/Makefile @@ -83,5 +83,5 @@ benchmark: @go test -mod=readonly -bench=. ./... test-cover: - @export VERSION=$(VERSION); bash -x contrib/test_cover.sh + @export VERSION=$(VERSION); bash -x scripts/test_cover.sh .PHONY: test-cover diff --git a/contrib/Dockerfile.test b/docker/Dockerfile.test similarity index 95% rename from contrib/Dockerfile.test rename to docker/Dockerfile.test index 3f37746eac..a285da2469 100644 --- a/contrib/Dockerfile.test +++ b/docker/Dockerfile.test @@ -15,7 +15,7 @@ COPY . . # Install minimum necessary dependencies, build Cosmos SDK, remove packages RUN apk add --no-cache $PACKAGES && \ - make install + make install # Final image FROM alpine:edge @@ -27,7 +27,7 @@ WORKDIR /root # Copy over binaries from the build-env COPY --from=build-env /go/bin/celestia-appd /usr/bin/celestia-appd -COPY ./contrib/single-node.sh . +COPY ./scripts/single-node.sh . EXPOSE 26657 diff --git a/contrib/localnet-blocks-test.sh b/scripts/localnet-blocks-test.sh similarity index 100% rename from contrib/localnet-blocks-test.sh rename to scripts/localnet-blocks-test.sh diff --git a/contrib/single-node.sh b/scripts/single-node.sh similarity index 100% rename from contrib/single-node.sh rename to scripts/single-node.sh diff --git a/contrib/test_cover.sh b/scripts/test_cover.sh similarity index 100% rename from contrib/test_cover.sh rename to scripts/test_cover.sh