Skip to content

Commit

Permalink
feat: block proposer check and workflow fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
hacheigriega committed Dec 6, 2023
1 parent 0e8b4e9 commit 2d3c5e8
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 4 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ concurrency:
jobs:
build:
runs-on: ubuntu-latest
env:
GOPRIVATE: github.com/fabianMendez/privatemodule
GH_ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }}
strategy:
matrix:
arch: [amd64, arm64]
Expand Down Expand Up @@ -46,6 +49,7 @@ jobs:
env:
GOOS: ${{ matrix.targetos }}
GOARCH: ${{ matrix.arch }}
- run: git config --global url.https://[email protected]/.insteadOf https://github.com/
- name: Compile
if: steps.cache-binaries.outputs.cache-hit != 'true' && env.GIT_DIFF
run: |
Expand All @@ -54,6 +58,9 @@ jobs:
tests:
runs-on: ubuntu-latest
env:
GOPRIVATE: github.com/fabianMendez/privatemodule
GH_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
Expand All @@ -62,6 +69,7 @@ jobs:
check-latest: true
cache: true
cache-dependency-path: go.sum
- run: git config --global url.https://[email protected]/.insteadOf https://github.com/
- uses: technote-space/[email protected]
id: git_diff
with:
Expand All @@ -84,12 +92,16 @@ jobs:

test-e2e:
runs-on: ubuntu-latest
env:
GOPRIVATE: github.com/fabianMendez/privatemodule
GH_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
timeout-minutes: 10
steps:
- uses: actions/setup-go@v4
with:
go-version: "1.21"
- uses: actions/checkout@v4
- run: git config --global url.https://[email protected]/.insteadOf https://github.com/
- uses: technote-space/[email protected]
with:
PATTERNS: |
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,9 @@ cover-html: test-unit-cover
@go tool cover -html=$(TEST_COVERAGE_PROFILE)

docker-build-e2e:
@docker build -t sedaprotocol/seda-chaind-e2e -f dockerfiles/Dockerfile.e2e .
@docker build \
-t sedaprotocol/seda-chaind-e2e \
-f dockerfiles/Dockerfile.e2e .

.PHONY: cover-html run-tests $(TEST_TARGETS) test test-race docker-build-e2e

Expand Down
14 changes: 12 additions & 2 deletions dockerfiles/Dockerfile.e2e
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,19 @@ ARG GIT_COMMIT
RUN apk add --no-cache \
ca-certificates \
build-base \
linux-headers
linux-headers \
git

# # Download go dependencies
COPY .netrc /root/
# CMD echo $GITHUB_TOKEN

# ENV GOPRIVATE=github.com/sedaprotocol/*
# ENV GIT_TERMINAL_PROMPT=0

# RUN git config --global url."https://${GITHUB_TOKEN}@github.com/".insteadOf "https://github.com/"


# Download go dependencies
WORKDIR /seda-chain
COPY go.mod go.sum ./
RUN --mount=type=cache,target=/root/.cache/go-build \
Expand Down
6 changes: 5 additions & 1 deletion x/randomness/keeper/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,13 @@ func ProcessProposalHandler(
return &abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_REJECT}, err
}

if msg.Proposer != string(sdk.AccAddress(req.ProposerAddress).String()) {
return &abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_REJECT},
fmt.Errorf("the NewSeed transaction must be from the block proposer")
}

// TO-DO run DefaultProposalHandler.ProcessProposalHandler first?
// TO-DO Validate()?
// TO-DO Ensure that msg was signed by block proposer?

// get block proposer's validator public key
validator, err := stakingKeeper.GetValidatorByConsAddr(ctx, sdk.ConsAddress(req.ProposerAddress))
Expand Down

0 comments on commit 2d3c5e8

Please sign in to comment.