diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index bd4149d2..06fe32f6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -2,21 +2,20 @@ name: build on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] jobs: - build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.22" + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "1.23" - - name: Build - run: go build -v ./... + - name: Build + run: go build -v ./... diff --git a/.github/workflows/golangci.yml b/.github/workflows/golangci.yml index 5458ed18..0d823490 100644 --- a/.github/workflows/golangci.yml +++ b/.github/workflows/golangci.yml @@ -18,7 +18,7 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: "1.22" + go-version: "1.23" - uses: actions/checkout@v4 - name: golangci-lint uses: golangci/golangci-lint-action@v6 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 221dff1e..55574fae 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -2,21 +2,29 @@ name: test on: push: - branches: [ "main" ] + branches: ["main"] pull_request: - branches: [ "main" ] + branches: ["main"] jobs: - run-tests: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: "1.23" + + - name: Test + run: go test -v ./... + + - name: Test Simulation Deterministic + run: make test-sim-deterministic - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: "1.22" + - name: Test Simulation Import/Export + run: make test-sim-import-export - - name: Test - run: go test -v ./... + - name: Test Simulation Multi Seed Short + run: make test-sim-multi-seed-short diff --git a/Makefile b/Makefile index c09867d2..800d551c 100644 --- a/Makefile +++ b/Makefile @@ -163,17 +163,12 @@ test-wasm: ############################################################################### integration-test-all: init-test-framework \ - test-alliance \ init-test-framework: clean-testing-data install @echo "Initializing both blockchains..." ./scripts/tests/init-test-framework.sh ./scripts/tests/relayer/interchain-acc-config/rly-init.sh -test-alliance: - @echo "Testing alliance..." - ./scripts/tests/alliance/delegate.sh - clean-testing-data: @echo "Killing eved and removing previous data" -@pkill $(BINARY) 2>/dev/null diff --git a/app/app.go b/app/app.go index 7f554799..d451c618 100644 --- a/app/app.go +++ b/app/app.go @@ -58,11 +58,6 @@ import ( feemarketpost "github.com/skip-mev/feemarket/x/feemarket/post" feemarkettypes "github.com/skip-mev/feemarket/x/feemarket/types" "github.com/spf13/cast" - bank "github.com/terra-money/alliance/custom/bank" - bankkeeper "github.com/terra-money/alliance/custom/bank/keeper" - alliancemodule "github.com/terra-money/alliance/x/alliance" - alliancemodulekeeper "github.com/terra-money/alliance/x/alliance/keeper" - alliancemoduletypes "github.com/terra-money/alliance/x/alliance/types" autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" @@ -122,6 +117,8 @@ import ( "github.com/cosmos/cosmos-sdk/x/authz" authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" + "github.com/cosmos/cosmos-sdk/x/bank" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/cosmos/cosmos-sdk/x/consensus" consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" @@ -207,16 +204,14 @@ var maccPerms = map[string][]string{ govtypes.ModuleName: {authtypes.Burner}, nft.ModuleName: nil, // non sdk modules - ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - ibcfeetypes.ModuleName: nil, - icatypes.ModuleName: nil, - wasmtypes.ModuleName: {authtypes.Burner}, - tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - alliancemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - alliancemoduletypes.RewardsPoolName: nil, - feeabstypes.ModuleName: nil, - feemarkettypes.ModuleName: {authtypes.Burner}, - feemarkettypes.FeeCollectorName: {authtypes.Burner}, + ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + ibcfeetypes.ModuleName: nil, + icatypes.ModuleName: nil, + wasmtypes.ModuleName: {authtypes.Burner}, + tokenfactorytypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + feeabstypes.ModuleName: nil, + feemarkettypes.ModuleName: {authtypes.Burner}, + feemarkettypes.FeeCollectorName: {authtypes.Burner}, } var ( @@ -266,7 +261,6 @@ type EveApp struct { TransferKeeper ibctransferkeeper.Keeper Wasm08Keeper wasm08keeper.Keeper WasmKeeper wasmkeeper.Keeper - AllianceKeeper alliancemodulekeeper.Keeper IBCHooksKeeper ibchookskeeper.Keeper @@ -343,7 +337,6 @@ func NewEveApp( wasm08types.StoreKey, wasmtypes.StoreKey, icahosttypes.StoreKey, icacontrollertypes.StoreKey, tokenfactorytypes.StoreKey, ibchookstypes.StoreKey, - alliancemoduletypes.StoreKey, feeabstypes.StoreKey, feemarkettypes.StoreKey, ) @@ -427,17 +420,6 @@ func NewEveApp( authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), ) - app.AllianceKeeper = alliancemodulekeeper.NewKeeper( - appCodec, - runtime.NewKVStoreService(keys[alliancemoduletypes.StoreKey]), - app.AccountKeeper, - app.BankKeeper, - &app.StakingKeeper, - app.DistrKeeper, - authtypes.FeeCollectorName, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - app.BankKeeper.RegisterKeepers(app.AllianceKeeper, app.StakingKeeper) app.MintKeeper = mintkeeper.NewKeeper( appCodec, @@ -483,7 +465,7 @@ func NewEveApp( // register the staking hooks // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks app.StakingKeeper.SetHooks( - stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks(), app.AllianceKeeper.StakingHooks()), + stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks()), ) app.CircuitKeeper = circuitkeeper.NewKeeper( @@ -578,7 +560,7 @@ func NewEveApp( // See: https://docs.cosmos.network/main/modules/gov#proposal-messages govRouter := govv1beta1.NewRouter() govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)).AddRoute(alliancemoduletypes.RouterKey, alliancemodule.NewAllianceProposalHandler(app.AllianceKeeper)). + AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). AddRoute(feeabstypes.RouterKey, feeabsmodule.NewHostZoneProposal(app.FeeabsKeeper)) govConfig := govtypes.DefaultConfig() @@ -663,7 +645,7 @@ func NewEveApp( app.GetSubspace(feeabstypes.ModuleName), &app.StakingKeeper, app.AccountKeeper, - app.BankKeeper.BaseKeeper, + app.BankKeeper, app.TransferKeeper, app.IBCKeeper.ChannelKeeper, app.IBCKeeper.PortKeeper, @@ -815,7 +797,6 @@ func NewEveApp( ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper), ibctm.NewAppModule(), ibchooks.NewAppModule(app.AccountKeeper), - alliancemodule.NewAppModule(appCodec, app.AllianceKeeper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry, app.GetSubspace(alliancemoduletypes.ModuleName)), // sdk crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), // always be last to make sure that it checks for all invariants and not only part of them, @@ -840,7 +821,6 @@ func NewEveApp( feeabsmodule.UpdateSetHostZoneClientProposalHandler, }, ), - alliancemoduletypes.ModuleName: alliancemodule.AppModuleBasic{}, // wasm08types.ModuleName: wasm08.AppModuleBasic{}, // wasmtypes.ModuleName: wasm.AppModuleBasic{}, }) @@ -877,7 +857,6 @@ func NewEveApp( wasm08types.ModuleName, wasmtypes.ModuleName, tokenfactorytypes.ModuleName, - alliancemoduletypes.ModuleName, feeabstypes.ModuleName, ) @@ -899,7 +878,6 @@ func NewEveApp( wasm08types.ModuleName, wasmtypes.ModuleName, tokenfactorytypes.ModuleName, - alliancemoduletypes.ModuleName, feeabstypes.ModuleName, ) @@ -944,7 +922,6 @@ func NewEveApp( wasmtypes.ModuleName, tokenfactorytypes.ModuleName, - alliancemoduletypes.ModuleName, feemarkettypes.ModuleName, feeabstypes.ModuleName, @@ -1327,7 +1304,6 @@ func BlockedAddresses() map[string]bool { // allow the following addresses to receive funds delete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) - delete(modAccAddrs, authtypes.NewModuleAddress(alliancemoduletypes.ModuleName).String()) delete(modAccAddrs, authtypes.NewModuleAddress(feeabstypes.ModuleName).String()) return modAccAddrs @@ -1355,7 +1331,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable()) paramsKeeper.Subspace(tokenfactorytypes.ModuleName).WithKeyTable(tokenfactorytypes.ParamKeyTable()) paramsKeeper.Subspace(wasmtypes.ModuleName) - paramsKeeper.Subspace(alliancemoduletypes.ModuleName) paramsKeeper.Subspace(feeabstypes.ModuleName) paramsKeeper.Subspace(feemarkettypes.ModuleName) diff --git a/coderabbit.yaml b/coderabbit.yaml new file mode 100644 index 00000000..482e40a5 --- /dev/null +++ b/coderabbit.yaml @@ -0,0 +1,15 @@ +# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json +language: "en-US" +early_access: true +reviews: + profile: "assertive" + request_changes_workflow: false + high_level_summary: true + poem: true + review_status: true + collapse_walkthrough: false + auto_review: + enabled: true + drafts: true +chat: + auto_reply: true diff --git a/go.mod b/go.mod index 5df38fd7..9bb61eed 100644 --- a/go.mod +++ b/go.mod @@ -36,7 +36,7 @@ require ( cosmossdk.io/core v0.11.1 cosmossdk.io/errors v1.0.1 cosmossdk.io/log v1.4.1 - cosmossdk.io/math v1.3.0 + cosmossdk.io/math v1.4.0 cosmossdk.io/store v1.1.1 cosmossdk.io/tools/confix v0.1.2 cosmossdk.io/x/circuit v0.1.1 @@ -53,7 +53,6 @@ require ( github.com/cosmos/ibc-go/v9 v9.0.1 github.com/osmosis-labs/tokenfactory v0.0.0-20240310155926-981fbeb0fe42 github.com/skip-mev/feemarket v1.1.1 - github.com/terra-money/alliance v0.4.3 go.uber.org/mock v0.5.0 ) diff --git a/go.sum b/go.sum index ea6b9ade..69fc33a3 100644 --- a/go.sum +++ b/go.sum @@ -620,8 +620,8 @@ cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= -cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= -cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= +cosmossdk.io/math v1.4.0 h1:XbgExXFnXmF/CccPPEto40gOO7FpWu9yWNAZPN3nkNQ= +cosmossdk.io/math v1.4.0/go.mod h1:O5PkD4apz2jZs4zqFdTr16e1dcaQCc5z6lkEnrrppuk= cosmossdk.io/store v1.1.1 h1:NA3PioJtWDVU7cHHeyvdva5J/ggyLDkyH0hGHl2804Y= cosmossdk.io/store v1.1.1/go.mod h1:8DwVTz83/2PSI366FERGbWSH7hL6sB7HbYp8bqksNwM= cosmossdk.io/tools/confix v0.1.2 h1:2hoM1oFCNisd0ltSAAZw2i4ponARPmlhuNu3yy0VwI4= @@ -1358,8 +1358,6 @@ github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70 github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/terra-money/alliance v0.4.3 h1:vlTsGkXOO78T8SJHjSQshbiTw7WSdieybWMOYsWyTmY= -github.com/terra-money/alliance v0.4.3/go.mod h1:ljXUIs49+2gHHbNljOoLrIaYV+1QHthS3vdtA7hODe0= github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= diff --git a/scripts/tests/alliance/delegate.sh b/scripts/tests/alliance/delegate.sh deleted file mode 100755 index a59f88bb..00000000 --- a/scripts/tests/alliance/delegate.sh +++ /dev/null @@ -1,109 +0,0 @@ -#!/bin/bash - -echo "" -echo "#################################################" -echo "# Alliance: bridge funds and create an alliance #" -echo "#################################################" -echo "" - -BINARY=eved -CHAIN_DIR=$(pwd)/data - -AMOUNT_TO_DELEGATE=10000000000 -UWHALE_DENOM=uwhale -VAL_WALLET_1=$($BINARY keys show val1 -a --keyring-backend test --home $CHAIN_DIR/test-1) -VAL_WALLET_2=$($BINARY keys show val2 -a --keyring-backend test --home $CHAIN_DIR/test-2) - -echo "Sending tokens from validator wallet on test-1 to validator wallet on test-2" -IBC_TRANSFER=$($BINARY tx ibc-transfer transfer transfer channel-0 $VAL_WALLET_2 $AMOUNT_TO_DELEGATE$UWHALE_DENOM --chain-id test-1 --from $VAL_WALLET_1 --home $CHAIN_DIR/test-1 --fees 60000$UWHALE_DENOM --node tcp://localhost:16657 --keyring-backend test -y -o json | jq -r '.raw_log' ) - -if [[ "$IBC_TRANSFER" == "failed to execute message"* ]]; then - echo "Error: IBC transfer failed, with error: $IBC_TRANSFER" - exit 1 -fi - -ACCOUNT_BALANCE="" -IBC_DENOM="" -while [ "$ACCOUNT_BALANCE" == "" ]; do - IBC_DENOM=$($BINARY q bank balances $VAL_WALLET_2 --chain-id test-2 --node tcp://localhost:26657 -o json | jq -r '.balances[0].denom') - IBC_QUERY=$($BINARY q bank balances $VAL_WALLET_2 --chain-id test-2 --node tcp://localhost:26657 -o json) - - echo $IBC_QUERY - if [ "$IBC_DENOM" != "$UWHALE_DENOM" ]; then - ACCOUNT_BALANCE=$($BINARY q bank balances $VAL_WALLET_2 --chain-id test-2 --node tcp://localhost:26657 -o json | jq -r '.balances[0].amount') - fi - sleep 2 -done - -GOV_ADDRESS=$($BINARY query auth module-account gov --output json | jq .account.base_account.address -r) -echo '{ - "messages": [ - { - "@type": "/alliance.alliance.MsgCreateAlliance", - "authority" : "'"$GOV_ADDRESS"'", - "denom": "'"$IBC_DENOM"'", - "reward_weight": "0.3", - "take_rate": "0.01", - "reward_change_rate": "0.01", - "reward_change_interval": "10s", - "reward_weight_range": { - "min":"0.0001", - "max":"0.3" - } - } - ], - "metadata": "", - "deposit": "25000000000'$UWHALE_DENOM'", - "title": "Create an Alliance!", - "summary": "Source Code Version https://github.com/terra-money/core" -}' > $CHAIN_DIR/create-alliance.json - - -echo "Creating an alliance with the denom $IBC_DENOM" - -PROPOSAL_HEIGHT=$($BINARY tx gov submit-proposal $CHAIN_DIR/create-alliance.json --from=$VAL_WALLET_2 --home $CHAIN_DIR/test-2 --node tcp://localhost:26657 -o json --keyring-backend test --fees 600000$UWHALE_DENOM --gas 500000 -y -o json | jq -r '.height') -sleep 3 - - -PROPOSAL_ID=$($BINARY query gov proposals --home $CHAIN_DIR/test-2 --count-total --node tcp://localhost:26657 -o json --output json --chain-id=test-2 | jq .proposals[-1].id -r) - - -VOTE_RES=$($BINARY tx gov vote $PROPOSAL_ID yes --from=$VAL_WALLET_2 --home $CHAIN_DIR/test-2 --keyring-backend=test --fees 60000$UWHALE_DENOM --chain-id=test-2 --node tcp://localhost:26657 -o json -y) -echo "Vote res: $VOTE_RES" - -ALLIANCE="null" -while [ "$ALLIANCE" == "null" ]; do - echo "Waiting for alliance with denom $IBC_DENOM to be created" - ALLIANCE=$($BINARY q alliance alliances --chain-id test-2 --node tcp://localhost:26657 -o json | jq -r '.alliances[0]') - ALLIANCE_QUERY=$($BINARY q alliance alliances --chain-id test-2 --node tcp://localhost:26657 -o json) - echo $ALLIANCE_QUERY - - sleep 2 -done - -echo "Delegating $AMOUNT_TO_DELEGATE to the alliance $IBC_DENOM" -VAL_ADDR=$($BINARY query staking validators --output json | jq .validators[0].operator_address --raw-output) -DELEGATE_RES=$($BINARY tx alliance delegate $VAL_ADDR $AMOUNT_TO_DELEGATE$IBC_DENOM --from=node0 --from=$VAL_WALLET_2 --home $CHAIN_DIR/test-2 --keyring-backend=test --fees 600000$UWHALE_DENOM --gas 500000 --chain-id=test-2 -o json -y) -sleep 3 -DELEGATIONS=$($BINARY query alliance delegation $VAL_WALLET_2 $VAL_ADDR $IBC_DENOM --chain-id test-2 --node tcp://localhost:26657 -o json | jq -r '.delegation.balance.amount') -if [[ "$DELEGATIONS" == "0" ]]; then - echo "Error: Alliance delegations expected to be greater than 0" - exit 1 -fi - -echo "Query bank balance after alliance creation" -TOTAL_SUPPLY_BEFORE_ALLIANCE=$($BINARY query bank total --denom $UWHALE_DENOM --height $PROPOSAL_HEIGHT -o json | jq -r '.amount') -TOTAL_SUPPLY_AFTER_ALLIANCE=$($BINARY query bank total --denom $UWHALE_DENOM -o json | jq -r '.amount') -TOTAL_SUPPLY_INCREMENT=$(($TOTAL_SUPPLY_BEFORE_ALLIANCE - $TOTAL_SUPPLY_AFTER_ALLIANCE)) - - -if [ "$TOTAL_SUPPLY_INCREMENT" -gt 100000 ] && [ "$TOTAL_SUPPLY_INCREMENT" -lt 1000000 ]; then - echo "Error: Something went wrong, total supply of $UWHALE_DENOM has increased out of range 100_000 between 1_000_000. current value $TOTAL_SUPPLY_INCREMENT" - exit 1 -fi - -echo "" -echo "#########################################################" -echo "# Success: Alliance bridge funds and create an alliance #" -echo "#########################################################" -echo ""