Skip to content

Commit

Permalink
chore: cleanup repo (#13)
Browse files Browse the repository at this point in the history
* local-ic cleanup

* add POA test

* cleanup misc go and proto

* cleanup

* undo accidental params change (!=0)

* remove handled todos

* lint

* proto-gen latest

* release docker image on tag
  • Loading branch information
Reecepbcups authored Feb 29, 2024
1 parent 0ebdae9 commit b782409
Show file tree
Hide file tree
Showing 42 changed files with 219 additions and 361 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build appd
name: Build Manifest

on:
pull_request:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ jobs:
# names of `make` commands to run tests
test:
- "ictest-ibc"
- "ictest-poa"
- "ictest-tokenfactory"
- "ictest-manifest"
fail-fast: false
Expand Down
69 changes: 69 additions & 0 deletions .github/workflows/release-docker-image.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
# This workflow pushes new docker images on every new tag.
#
# On every new `vX.Y.Z` tag the following images are pushed:
#
# liftedinit/manifest-ledger:vX.Y.Z # is pushed
# liftedinit/manifest-ledger:X.Y.Z # is pushed
# liftedinit/manifest-ledger:X.Y # is updated to X.Y.Z
# liftedinit/manifest-ledger:X # is updated to X.Y.Z
# liftedinit/manifest-ledger:latest # is updated to X.Y.Z
#
# All the images above have support for linux/amd64 and linux/arm64.
#
# Due to QEMU virtualization used to build multi-platform docker images
# this workflow might take a while to complete.

name: Push Docker Images

on:
release:
types: [published, created, edited]
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+' # ignore rc

jobs:
chain-images:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Parse tag
id: tag
run: |
VERSION=$(echo ${{ github.ref_name }} | sed "s/v//")
MAJOR_VERSION=$(echo $VERSION | cut -d '.' -f 1)
MINOR_VERSION=$(echo $VERSION | cut -d '.' -f 2)
PATCH_VERSION=$(echo $VERSION | cut -d '.' -f 3)
echo "VERSION=$VERSION" >> $GITHUB_ENV
echo "MAJOR_VERSION=$MAJOR_VERSION" >> $GITHUB_ENV
echo "MINOR_VERSION=$MINOR_VERSION" >> $GITHUB_ENV
echo "PATCH_VERSION=$PATCH_VERSION" >> $GITHUB_ENV
- name: Build and push
id: build_push_image
uses: docker/build-push-action@v5
with:
file: Dockerfile
context: .
push: true
platforms: linux/amd64,linux/arm64
tags: |
ghcr.io/liftedinit/manifest-ledger:${{ env.MAJOR_VERSION }}
ghcr.io/liftedinit/manifest-ledger:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}
ghcr.io/liftedinit/manifest-ledger:${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }}
ghcr.io/liftedinit/manifest-ledger:v${{ env.MAJOR_VERSION }}.${{ env.MINOR_VERSION }}.${{ env.PATCH_VERSION }}
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,4 @@ jobs:
check-latest: true

- name: unit tests
run: |
make test
run: make test
4 changes: 3 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ linters-settings:
- prefix(github.com/cosmos)
- prefix(cosmossdk.io)
- prefix(github.com/cosmos/cosmos-sdk)
- prefix(github.com/CosmosContracts/juno)
- prefix(github.com/strangelove-ventures/poa)
- prefix(github.com/reecepbcups/tokenfactory)
- prefix(github.com/liftedinit/manifest-ledger)
gosec:
excludes:
- G404
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ ictest-tokenfactory:
ictest-manifest:
cd interchaintest && go test -race -v -run TestManifestModule . -count=1

ictest-poa:
cd interchaintest && go test -race -v -run TestPOA . -count=1


.PHONY: ictest-ibc ictest-tokenfactory

Expand Down
9 changes: 5 additions & 4 deletions api/manifest/v1/tx.pulsar.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions api/manifest/v1/tx_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package app
import (
"errors"

poaante "github.com/strangelove-ventures/poa/ante"

ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante"
"github.com/cosmos/ibc-go/v8/modules/core/keeper"

Expand All @@ -14,6 +12,8 @@ import (

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/auth/ante"

poaante "github.com/strangelove-ventures/poa/ante"
)

// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
Expand Down
21 changes: 12 additions & 9 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,7 @@ import (
"path/filepath"
"sort"

manifest "github.com/liftedinit/manifest-ledger/x/manifest"
manifestkeeper "github.com/liftedinit/manifest-ledger/x/manifest/keeper"
manifesttypes "github.com/liftedinit/manifest-ledger/x/manifest/types"
"github.com/reecepbcups/tokenfactory/x/tokenfactory"
tokenfactorykeeper "github.com/reecepbcups/tokenfactory/x/tokenfactory/keeper"
tokenfactorytypes "github.com/reecepbcups/tokenfactory/x/tokenfactory/types"
"github.com/spf13/cast"
"github.com/strangelove-ventures/poa"
poakeeper "github.com/strangelove-ventures/poa/keeper"
poamodule "github.com/strangelove-ventures/poa/module"

abci "github.com/cometbft/cometbft/abci/types"

Expand Down Expand Up @@ -137,6 +128,18 @@ import (
"github.com/cosmos/cosmos-sdk/x/staking"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

"github.com/strangelove-ventures/poa"
poakeeper "github.com/strangelove-ventures/poa/keeper"
poamodule "github.com/strangelove-ventures/poa/module"

"github.com/reecepbcups/tokenfactory/x/tokenfactory"
tokenfactorykeeper "github.com/reecepbcups/tokenfactory/x/tokenfactory/keeper"
tokenfactorytypes "github.com/reecepbcups/tokenfactory/x/tokenfactory/types"

manifest "github.com/liftedinit/manifest-ledger/x/manifest"
manifestkeeper "github.com/liftedinit/manifest-ledger/x/manifest/keeper"
manifesttypes "github.com/liftedinit/manifest-ledger/x/manifest/types"
)

func GetPoAAdmin() string {
Expand Down
18 changes: 0 additions & 18 deletions app/apptesting/events.go

This file was deleted.

20 changes: 18 additions & 2 deletions app/apptesting/test_suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"fmt"
"time"

"github.com/liftedinit/manifest-ledger/app"
appparams "github.com/liftedinit/manifest-ledger/app/params"
"github.com/stretchr/testify/suite"

"github.com/cometbft/cometbft/crypto/ed25519"
Expand All @@ -32,6 +30,9 @@ import (
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
stakinghelper "github.com/cosmos/cosmos-sdk/x/staking/testutil"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

"github.com/liftedinit/manifest-ledger/app"
appparams "github.com/liftedinit/manifest-ledger/app/params"
)

type KeeperTestHelper struct {
Expand Down Expand Up @@ -251,6 +252,21 @@ func (s *KeeperTestHelper) ConfirmUpgradeSucceeded(upgradeName string, upgradeHe
})
}

// AssertEventEmitted asserts that ctx's event manager has emitted the given number of events
// of the given type.
func (s *KeeperTestHelper) AssertEventEmitted(ctx sdk.Context, eventTypeExpected string, numEventsExpected int) {
allEvents := ctx.EventManager().Events()

// filter out other events
actualEvents := make([]sdk.Event, 0)
for _, event := range allEvents {
if event.Type == eventTypeExpected {
actualEvents = append(actualEvents, event)
}
}
s.Equal(numEventsExpected, len(actualEvents))
}

// CreateRandomAccounts is a function return a list of randomly generated AccAddresses
func CreateRandomAccounts(numAccts int) []sdk.AccAddress {
testAddrs := make([]sdk.AccAddress, numAccts)
Expand Down
4 changes: 2 additions & 2 deletions app/encoding.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ package app
import (
"testing"

"github.com/liftedinit/manifest-ledger/app/params"

dbm "github.com/cosmos/cosmos-db"

"cosmossdk.io/log"

simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"

"github.com/liftedinit/manifest-ledger/app/params"
)

// MakeEncodingConfig creates a new EncodingConfig with all modules registered. For testing only
Expand Down
11 changes: 6 additions & 5 deletions app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import (
"testing"
"time"

apphelpers "github.com/liftedinit/manifest-ledger/app/helpers"
appparams "github.com/liftedinit/manifest-ledger/app/params"
"github.com/liftedinit/manifest-ledger/x/manifest/types"
"github.com/strangelove-ventures/poa"
"github.com/stretchr/testify/require"

abci "github.com/cometbft/cometbft/abci/types"
Expand Down Expand Up @@ -49,6 +45,12 @@ import (
govv1types "github.com/cosmos/cosmos-sdk/x/gov/types/v1"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

"github.com/strangelove-ventures/poa"

apphelpers "github.com/liftedinit/manifest-ledger/app/helpers"
appparams "github.com/liftedinit/manifest-ledger/app/params"
"github.com/liftedinit/manifest-ledger/x/manifest/types"
)

// SimAppChainID hardcoded chainID for simulation
Expand Down Expand Up @@ -195,7 +197,6 @@ func setup(t *testing.T, withGenesis bool) (*ManifestApp, GenesisState) {
})

// Set Default Params
// TODO: can maybe change to set these on start if no params are found.
// Ref: wasmd https://github.com/CosmWasm/wasmd/blob/main/app/app.go#L927-L946
app.MintKeeper.Minter.Set(ctx, minttypes.DefaultInitialMinter())
app.MintKeeper.Params.Set(ctx, minttypes.DefaultParams())
Expand Down
4 changes: 2 additions & 2 deletions app/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package app
import (
"fmt"

upgradetypes "cosmossdk.io/x/upgrade/types"

"github.com/liftedinit/manifest-ledger/app/upgrades"
"github.com/liftedinit/manifest-ledger/app/upgrades/noop"

upgradetypes "cosmossdk.io/x/upgrade/types"
)

// Upgrades list of chain upgrades
Expand Down
4 changes: 2 additions & 2 deletions app/upgrades/noop/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package noop
import (
"context"

"github.com/liftedinit/manifest-ledger/app/upgrades"

storetypes "cosmossdk.io/store/types"
upgradetypes "cosmossdk.io/x/upgrade/types"

"github.com/cosmos/cosmos-sdk/types/module"

"github.com/liftedinit/manifest-ledger/app/upgrades"
)

// NewUpgrade constructor
Expand Down
31 changes: 25 additions & 6 deletions chains/chain.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,35 @@
]
},
{
"key": "app_state.mint.minter.inflation",
"value": "0.000000000000000000"
"key": "app_state.tokenfactory.params.denom_creation_fee",
"value": []
},
{
"key": "app_state.mint.params.inflation_rate_change",
"value": "0.000000000000000000"
"key": "app_state.tokenfactory.params.denom_creation_gas_consume",
"value": 500
},
{
"key": "app_state.mint.params.inflation_min",
"value": "0.000000000000000000"
"key": "app_state.mint.params.blocks_per_year",
"value": "6311520"
},
{
"key": "app_state.manifest.params.inflation.mint_denom",
"value": "umfx"
},
{
"key": "app_state.manifest.params.inflation.yearly_amount",
"value": "500000000000"
},
{
"key": "app_state.manifest.params.inflation.automatic_enabled",
"value": true
},
{
"key": "app_state.manifest.params.stake_holders",
"value": [
{"address":"manifest1hj5fveer5cjtn4wd6wstzugjfdxzl0xp8ws9ct","percentage":80000000},
{"address":"manifest1efd63aw40lxf3n4mhf7dzhjkr453axurm6rp3z","percentage":20000000}
]
}
],
"accounts": [
Expand Down
Loading

0 comments on commit b782409

Please sign in to comment.