-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add v2.1 upgrade handler (#121) * feat: add upgrade handler * chore: fix bech32 error * chore: fix typo * feat: add ante handler to block account * chore: fix vesting unlock time * Update app/upgrades/v1/upgrade.go Co-authored-by: Anil K <[email protected]> * Update app/upgrades/v1/upgrade.go Co-authored-by: Anil K <[email protected]> * chore: add depgaurd config * chore: update linter * chore: try fixing linter --------- Co-authored-by: Anil K <[email protected]> * CV FIX: wasm snapshot (#124) * Add Wasm to Snapshot * Update app/app.go --------- Co-authored-by: Anil K <[email protected]> * fix keyring deprecated issue for mac (#123) Co-authored-by: Anil K <[email protected]> * chore: update docker to support wasmvm (#120) Co-authored-by: Anil K <[email protected]> * feat: add upgrade handler `v2.2.0` (#128) * chore: add upgrade handler `v2.2.0` * fix claim records * update time * fix panic * changes * add claim records from snapshots * suggestions * review changes * review changes * Update app/upgrades/v2.2.0/upgrade.go * fix amount sim bug * add logs * log * log * Fix airdrop amounts * fix build * fix * review changes * Update x/claim/keeper/claim.go * test calc * small fix * another handle * handle more coin errors * revert * add snapshot1 data directly * update data * sub original claim allocation * review changes * Update app/upgrades/v2.2.0/upgrade.go * update go.mod --------- Co-authored-by: Anil K <[email protected]> Co-authored-by: Anil K <[email protected]> * Update .github/workflows/lint.yml --------- Co-authored-by: MD Aleem <[email protected]> Co-authored-by: Chill Validation <[email protected]> Co-authored-by: Bala Murali Krishna Komatireddy <[email protected]> Co-authored-by: Jay Namsayin <[email protected]> Co-authored-by: atheeshp <[email protected]> Co-authored-by: Anil K <[email protected]>
- Loading branch information
1 parent
1cdb42d
commit d3e462a
Showing
12 changed files
with
6,027 additions
and
69 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 |
---|---|---|
@@ -1,27 +1,25 @@ | ||
name: Lint | ||
# Lint runs golangci-lint over the entire passage3d repository | ||
# This workflow is run on every pull request and push to master | ||
# The `golangci` will pass without running if no *.{go, mod, sum} files have been changed. | ||
on: | ||
pull_request: | ||
push: | ||
tags: | ||
- v* | ||
branches: | ||
- master | ||
- main | ||
pull_request: | ||
permissions: | ||
contents: read | ||
# Optional: allow read access to pull request. Use with `only-new-issues` option. | ||
# pull-requests: read | ||
jobs: | ||
golangci: | ||
name: golangci-lint | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: technote-space/[email protected] | ||
- uses: actions/setup-go@v3 | ||
with: | ||
PATTERNS: | | ||
**/**.go | ||
go.mod | ||
go.sum | ||
go-version: 1.20 | ||
- uses: actions/checkout@v3 | ||
- name: golangci-lint | ||
uses: golangci/golangci-lint-action@v2 | ||
uses: golangci/golangci-lint-action@v3 | ||
with: | ||
version: latest | ||
skip-go-installation: true | ||
if: env.GIT_DIFF | ||
version: 1.49.0 |
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 |
---|---|---|
@@ -1,42 +1,25 @@ | ||
# Simple usage with a mounted data directory: | ||
# > docker build -t simapp . | ||
# | ||
# Server: | ||
# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.simapp:/root/.simapp simapp simd init test-chain | ||
# TODO: need to set validator in genesis so start runs | ||
# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.simapp:/root/.simapp simapp simd start | ||
# | ||
# Client: (Note the simapp binary always looks at ~/.simapp we can bind to different local storage) | ||
# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.simappcli:/root/.simapp simapp simd keys add foo | ||
# > docker run -it -p 26657:26657 -p 26656:26656 -v ~/.simappcli:/root/.simapp simapp simd keys list | ||
# TODO: demo connecting rest-server (or is this in server now?) | ||
FROM golang:alpine AS build-env | ||
|
||
# Install minimum necessary dependencies, | ||
ENV PACKAGES curl make git libc-dev bash gcc linux-headers eudev-dev python3 | ||
RUN apk add --no-cache $PACKAGES | ||
|
||
# Set working directory for the build | ||
WORKDIR /go/src/github.com/cosmos/cosmos-sdk | ||
|
||
# Add source files | ||
FROM golang:1.20.5-alpine AS build-env | ||
|
||
# Set up dependencies | ||
ENV PACKAGES bash curl make git libc-dev gcc linux-headers eudev-dev python3 | ||
|
||
# ADD . /code | ||
WORKDIR /code | ||
|
||
COPY . . | ||
|
||
# install simapp, remove packages | ||
RUN make build-linux | ||
ADD https://github.com/CosmWasm/wasmvm/releases/download/v1.2.1/libwasmvm_muslc.x86_64.a /lib/libwasmvm_muslc.a | ||
|
||
RUN apk add --no-cache $PACKAGES && \ | ||
BUILD_TAGS=muslc LINK_STATICALLY=true make install && \ | ||
rm -rf /var/cache/apk/* | ||
|
||
# Final image | ||
FROM alpine:edge | ||
|
||
# Install ca-certificates | ||
RUN apk add --update ca-certificates | ||
WORKDIR /root | ||
|
||
# Copy over binaries from the build-env | ||
COPY --from=build-env /go/src/github.com/cosmos/cosmos-sdk/build/simd /usr/bin/simd | ||
WORKDIR /code | ||
|
||
EXPOSE 26656 26657 1317 9090 | ||
COPY --from=build-env /go/bin/passage /usr/local/bin/passage | ||
|
||
# Run simd by default, omit entrypoint to ease using container with simcli | ||
CMD ["simd"] | ||
CMD ["passage"] |
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,60 @@ | ||
package ante | ||
|
||
import ( | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" | ||
authztypes "github.com/cosmos/cosmos-sdk/x/authz" | ||
distributiontypes "github.com/cosmos/cosmos-sdk/x/distribution/types" | ||
) | ||
|
||
const blockedMultisigAddr = "pasg105488mw9t3qtp62jhllde28v40xqxpjksjqmvx" | ||
|
||
// BlockAccountDecorator restricts the community pool multisig account's transactions, except for the community fund. | ||
// Call next AnteHandler if the message is allowed | ||
type BlockAccountDecorator struct{} | ||
|
||
func NewBlockAccountDecorator() BlockAccountDecorator { | ||
return BlockAccountDecorator{} | ||
} | ||
|
||
func (bad BlockAccountDecorator) AnteHandle(ctx sdk.Context, tx sdk.Tx, simulate bool, next sdk.AnteHandler) (newCtx sdk.Context, err error) { | ||
if simulate { | ||
return next(ctx, tx, simulate) | ||
} | ||
|
||
msgs := tx.GetMsgs() | ||
// handle msg based on type | ||
if err := handleMessages(msgs); err != nil { | ||
return ctx, err | ||
} | ||
|
||
return next(ctx, tx, simulate) | ||
} | ||
|
||
// handleMessages check and handle each msg with rules | ||
func handleMessages(msgs []sdk.Msg) error { | ||
for _, msg := range msgs { | ||
|
||
if msgExec, ok := msg.(*authztypes.MsgExec); ok { | ||
msgs, err := msgExec.GetMessages() | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if err := handleMessages(msgs); err != nil { | ||
return err | ||
} | ||
} else if _, ok := msg.(*distributiontypes.MsgFundCommunityPool); ok { | ||
return nil | ||
} | ||
|
||
signers := msg.GetSigners() | ||
for _, signer := range signers { | ||
if signer.String() == blockedMultisigAddr { | ||
return sdkerrors.ErrUnauthorized.Wrapf("%s is not allowed to perform this transaction", blockedMultisigAddr) | ||
} | ||
} | ||
} | ||
|
||
return nil | ||
} |
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,26 @@ | ||
package upgrades | ||
|
||
import ( | ||
store "github.com/cosmos/cosmos-sdk/store/types" | ||
"github.com/cosmos/cosmos-sdk/types/module" | ||
auth "github.com/cosmos/cosmos-sdk/x/auth/keeper" | ||
bank "github.com/cosmos/cosmos-sdk/x/bank/keeper" | ||
distribution "github.com/cosmos/cosmos-sdk/x/distribution/keeper" | ||
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" | ||
claim "github.com/envadiv/Passage3D/x/claim/keeper" | ||
) | ||
|
||
// Upgrade defines a struct containing necessary fields that a SoftwareUpgradeProposal | ||
// must have written, in order for the state migration to go smoothly. | ||
// An upgrade must implement this struct, and then set it in the app.go. | ||
// The app.go will then define the handler. | ||
type Upgrade struct { | ||
// Upgrade version name, for the upgrade handler, e.g. `v1` | ||
UpgradeName string | ||
|
||
// CreateUpgradeHandler defines the function that creates an upgrade handler | ||
CreateUpgradeHandler func(*module.Manager, module.Configurator, distribution.Keeper, bank.Keeper, auth.AccountKeeper, claim.Keeper) upgradetypes.UpgradeHandler | ||
|
||
// Store upgrades, should be used for any new modules introduced, new modules deleted, or store names renamed. | ||
StoreUpgrades store.StoreUpgrades | ||
} |
Oops, something went wrong.