Skip to content

Commit

Permalink
Merge branch 'main' into trung/airdrop
Browse files Browse the repository at this point in the history
  • Loading branch information
faddat authored Dec 4, 2024
2 parents 9968d3a + c693e7f commit 6f3d3df
Show file tree
Hide file tree
Showing 15 changed files with 264 additions and 395 deletions.
19 changes: 9 additions & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 ./...
2 changes: 1 addition & 1 deletion .github/workflows/golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
28 changes: 18 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ run:
linters:
disable-all: true
enable:
- copyloopvar
- errcheck
- dogsled
- exportloopref
- goconst
- gocritic
- gci
Expand Down
5 changes: 0 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions app/ante/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ type HandlerOptions struct {
FeeAbskeeper feeabskeeper.Keeper
FeeMarketKeeper feemarketante.FeeMarketKeeper
AccountKeeper feemarketante.AccountKeeper
BankKeeper feemarketante.BankKeeper
}

// NewAnteHandler constructor
Expand Down Expand Up @@ -63,6 +64,9 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
circuitante.NewCircuitBreakerDecorator(options.CircuitKeeper),
ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker),
feemarketante.NewFeeMarketCheckDecorator( // fee market check replaces fee deduct decorator
options.AccountKeeper,
options.BankKeeper,
options.FeegrantKeeper,
options.FeeMarketKeeper,
ante.NewDeductFeeDecorator(
options.AccountKeeper,
Expand Down
19 changes: 17 additions & 2 deletions app/ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,14 @@ import (
"github.com/osmosis-labs/fee-abstraction/v8/x/feeabs/types"
feemarketante "github.com/skip-mev/feemarket/x/feemarket/ante"
feemarkettypes "github.com/skip-mev/feemarket/x/feemarket/types"
"github.com/stretchr/testify/mock"
"github.com/stretchr/testify/require"
"go.uber.org/mock/gomock"

"cosmossdk.io/errors"
math "cosmossdk.io/math"

"github.com/cosmos/cosmos-sdk/testutil/testdata"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
)
Expand Down Expand Up @@ -45,7 +47,10 @@ func TestMempoolDecorator(t *testing.T) {
{
"valid native fee, should pass",
validFee,
func(suite *AnteTestSuite) {},
func(suite *AnteTestSuite) {
suite.bankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, mock.Anything,
feemarkettypes.FeeCollectorName, mock.Anything).Return(nil).Once()
},
nil,
},
{
Expand All @@ -56,6 +61,8 @@ func TestMempoolDecorator(t *testing.T) {
require.NoError(t, err)
suite.feeabsKeeper.SetTwapRate(suite.ctx, "ibcfee", math.LegacyNewDec(1))
suite.stakingKeeper.EXPECT().BondDenom(gomock.Any()).Return("ueve", nil).AnyTimes()
suite.bankKeeper.On("SendCoinsFromAccountToModule", mock.Anything, mock.Anything,
feemarkettypes.FeeCollectorName, mock.Anything).Return(nil).Once()
},
nil,
},
Expand Down Expand Up @@ -93,11 +100,19 @@ func TestMempoolDecorator(t *testing.T) {
tc.malleate(suite)
suite.txBuilder.SetGasLimit(gasLimit)
suite.txBuilder.SetFeeAmount(tc.feeAmount)
accs := suite.CreateTestAccounts(1)
require.NoError(t, suite.txBuilder.SetMsgs([]sdk.Msg{testdata.NewTestMsg(accs[0].acc.GetAddress())}...))

suite.ctx = suite.ctx.WithMinGasPrices(minGasPrice)

// Construct tx and run through mempool decorator
tx := suite.txBuilder.GetTx()
feemarketDecorator := feemarketante.NewFeeMarketCheckDecorator(suite.feemarketKeeper, nil)
feemarketDecorator := feemarketante.NewFeeMarketCheckDecorator(
suite.accountKeeper,
suite.bankKeeper,
suite.feeGrantKeeper,
suite.feemarketKeeper,
nil)
antehandler := sdk.ChainAnteDecorators(feemarketDecorator)

// Run the ante handler
Expand Down
8 changes: 5 additions & 3 deletions app/ante/suite.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import (
feeabstestutil "github.com/osmosis-labs/fee-abstraction/v8/x/feeabs/testutil"
feeabstypes "github.com/osmosis-labs/fee-abstraction/v8/x/feeabs/types"
feemarketante "github.com/skip-mev/feemarket/x/feemarket/ante"
feemarketmocks "github.com/skip-mev/feemarket/x/feemarket/ante/mocks"
feemarketkeeper "github.com/skip-mev/feemarket/x/feemarket/keeper"
feemarkettypes "github.com/skip-mev/feemarket/x/feemarket/types"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -45,7 +46,7 @@ type AnteTestSuite struct {
clientCtx client.Context
txBuilder client.TxBuilder
accountKeeper authkeeper.AccountKeeper
bankKeeper *feeabstestutil.MockBankKeeper
bankKeeper *feemarketmocks.BankKeeper
feeGrantKeeper *feeabstestutil.MockFeegrantKeeper
stakingKeeper *feeabstestutil.MockStakingKeeper
feeabsKeeper feeabskeeper.Keeper
Expand All @@ -65,7 +66,7 @@ func SetupTestSuite(t *testing.T, isCheckTx bool) *AnteTestSuite {
govAuthority := authtypes.NewModuleAddress("gov").String()

// Setup mock keepers
suite.bankKeeper = feeabstestutil.NewMockBankKeeper(ctrl)
suite.bankKeeper = feemarketmocks.NewBankKeeper(t)
suite.stakingKeeper = feeabstestutil.NewMockStakingKeeper(ctrl)
suite.feeGrantKeeper = feeabstestutil.NewMockFeegrantKeeper(ctrl)
suite.channelKeeper = feeabstestutil.NewMockChannelKeeper(ctrl)
Expand Down Expand Up @@ -99,7 +100,8 @@ func SetupTestSuite(t *testing.T, isCheckTx bool) *AnteTestSuite {
suite.encCfg.Amino.RegisterConcrete(&testdata.TestMsg{}, "testdata.TestMsg", nil)
testdata.RegisterInterfaces(suite.encCfg.InterfaceRegistry)
suite.accountKeeper = authkeeper.NewAccountKeeper(
suite.encCfg.Codec, runtime.NewKVStoreService(key), authtypes.ProtoBaseAccount, maccPerms, authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), sdk.Bech32MainPrefix, govAuthority,
suite.encCfg.Codec, runtime.NewKVStoreService(authKey), authtypes.ProtoBaseAccount, maccPerms,
authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), sdk.Bech32MainPrefix, govAuthority,
)
suite.accountKeeper.SetModuleAccount(suite.ctx, authtypes.NewEmptyModuleAccount(feeabstypes.ModuleName))
// Setup feeabs keeper
Expand Down
Loading

0 comments on commit 6f3d3df

Please sign in to comment.