-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9ee0d51
commit b8e962d
Showing
80 changed files
with
10,280 additions
and
9,447 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: e2e | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
|
||
env: | ||
LINT_VERSION: v1.52 | ||
GO_VERSION: 1.21.0 | ||
|
||
TAR_PATH: /tmp/poa.tar | ||
IMAGE_NAME: poa | ||
DOCKER_TAG: poa:local | ||
|
||
jobs: | ||
build-docker: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Go ${{ env.GO_VERSION }} | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build and export | ||
uses: docker/build-push-action@v5 | ||
with: | ||
tags: ${{ env.DOCKER_TAG }} | ||
outputs: type=docker,dest=${{ env.TAR_PATH }} | ||
|
||
- name: Upload host artifact | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: ${{ env.IMAGE_NAME }} | ||
path: ${{ env.TAR_PATH }} | ||
|
||
test: | ||
needs: build-docker | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
test: | ||
- "ictest-poa" | ||
fail-fast: false | ||
|
||
steps: | ||
- name: Set up Go ${{ env.GO_VERSION }} | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: ${{ env.GO_VERSION }} | ||
|
||
- name: checkout chain | ||
uses: actions/checkout@v4 | ||
|
||
- name: Download Host Artifact | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: ${{ env.IMAGE_NAME }} | ||
path: /tmp | ||
|
||
- name: Load Docker Image | ||
run: | | ||
docker image load -i ${{ env.TAR_PATH }} | ||
docker image ls -a | ||
- name: Run Test | ||
run: make ${{ matrix.test }} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,6 @@ go.work | |
go.work.sum | ||
|
||
# Depinject debug file | ||
debug_container.dot | ||
debug_container.dot | ||
|
||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# make local-image | ||
# docker run --rm -it poa:local q | ||
|
||
FROM golang:1.21-alpine3.18 as builder | ||
|
||
RUN set -eux; apk add --no-cache git libusb-dev linux-headers gcc musl-dev make go; | ||
|
||
ENV GOPATH="" | ||
|
||
COPY go.mod . | ||
COPY go.sum . | ||
RUN go mod download | ||
|
||
COPY . . | ||
|
||
RUN cd simapp && make build | ||
|
||
FROM alpine:3.18 | ||
|
||
COPY --from=builder /go/simapp/build/* /bin/poad | ||
|
||
ENTRYPOINT ["/bin/poad"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
package poaante | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
"github.com/strangelove-ventures/poa" | ||
|
||
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" | ||
) | ||
|
||
type MsgStakingFilterDecorator struct { | ||
} | ||
|
||
func NewPOAStakingFilterDecorator() MsgStakingFilterDecorator { | ||
return MsgStakingFilterDecorator{} | ||
} | ||
|
||
// AnteHandle performs an AnteHandler check that returns an error if the tx contains a message that is blocked. | ||
func (msfd MsgStakingFilterDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { | ||
currHeight := ctx.BlockHeight() | ||
if currHeight <= 1 { | ||
// allow GenTx to pass | ||
return next(ctx, tx, simulate) | ||
} | ||
|
||
invalid, err := msfd.hasInvalidStakingMsg(tx.GetMsgs()) | ||
if err != nil { | ||
return ctx, err | ||
} | ||
|
||
if invalid { | ||
return ctx, poa.ErrStakingActionNotAllowed | ||
} | ||
|
||
return next(ctx, tx, simulate) | ||
} | ||
|
||
func (msfd MsgStakingFilterDecorator) hasInvalidStakingMsg(msgs []sdk.Msg) (bool, error) { | ||
for _, msg := range msgs { | ||
switch msg.(type) { | ||
case *stakingtypes.MsgBeginRedelegate: | ||
return true, nil | ||
case *stakingtypes.MsgCancelUnbondingDelegation: | ||
return true, nil | ||
case *stakingtypes.MsgCreateValidator: // TODO:? wrap it to our own Message to allow & mint the needed token? | ||
return true, nil | ||
case *stakingtypes.MsgDelegate: | ||
return true, nil | ||
case *stakingtypes.MsgEditValidator: // TODO:? | ||
return true, nil | ||
case *stakingtypes.MsgUndelegate: | ||
return true, nil | ||
case *stakingtypes.MsgUpdateParams: // TODO: ? allow or wrap with isAdmin? | ||
return true, nil | ||
default: | ||
return false, nil | ||
} | ||
} | ||
return false, nil | ||
} |
Oops, something went wrong.