-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: setup simapp for testing #6
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
name: E2E Test | ||
|
||
on: | ||
pull_request | ||
|
||
jobs: | ||
build_image: | ||
name: Building Heighliner | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Build Docker image | ||
uses: strangelove-ventures/[email protected] | ||
with: | ||
registry: "" # empty registry, image only shared for e2e testing | ||
tag: local # emulate local environment for consistency in interchaintest cases | ||
tar-export-path: autocctp_simapp.tar # export a tarball that can be uploaded as an artifact for the e2e jobs | ||
platform: linux/amd64 # test runner architecture only | ||
git-ref: ${{ github.head_ref }} # source code ref | ||
|
||
# Heighliner chains.yaml config | ||
chain: autocctp-simd | ||
dockerfile: cosmos | ||
build-target: make build | ||
build-dir: simapp | ||
binaries: | | ||
- simapp/build/simd | ||
|
||
- name: Upload tarball | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: autocctp_simapp.tar | ||
path: autocctp_simapp.tar | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.idea | ||
coverage.out | ||
/simapp/build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
build: | ||
@echo "🤖 Building simd..." | ||
@cd simapp && make build 1> /dev/null | ||
@echo "✅ Completed build!" |
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Large diffs are not rendered by default.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
BRANCH := $(shell git rev-parse --abbrev-ref HEAD) | ||
COMMIT := $(shell git log -1 --format='%H') | ||
|
||
ifeq (,$(VERSION)) | ||
VERSION := $(shell git describe --exact-match 2>/dev/null) | ||
ifeq (,$(VERSION)) | ||
ifeq ($(shell git status --porcelain),) | ||
VERSION := $(BRANCH) | ||
else | ||
VERSION := $(BRANCH)-dirty | ||
endif | ||
endif | ||
endif | ||
|
||
ldflags := $(LDFLAGS) | ||
ldflags += -X github.com/cosmos/cosmos-sdk/version.Name=simapp \ | ||
-X github.com/cosmos/cosmos-sdk/version.AppName=simd \ | ||
-X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \ | ||
-X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) | ||
ldflags := $(strip $(ldflags)) | ||
|
||
BUILD_FLAGS := -ldflags '$(ldflags)' | ||
|
||
build: | ||
@go build -mod=readonly $(BUILD_FLAGS) -o $(PWD)/build/ ./... | ||
|
||
.PHONY: build |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package app | ||
|
||
import ( | ||
errorsmod "cosmossdk.io/errors" | ||
"github.com/circlefin/noble-fiattokenfactory/x/fiattokenfactory" | ||
ftfkeeper "github.com/circlefin/noble-fiattokenfactory/x/fiattokenfactory/keeper" | ||
"github.com/cosmos/cosmos-sdk/codec" | ||
sdk "github.com/cosmos/cosmos-sdk/types" | ||
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" | ||
"github.com/cosmos/cosmos-sdk/x/auth/ante" | ||
ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante" | ||
ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" | ||
) | ||
|
||
// HandlerOptions extends the options required by the default Cosmos SDK | ||
// AnteHandler for our custom ante decorators. | ||
type HandlerOptions struct { | ||
ante.HandlerOptions | ||
cdc codec.Codec | ||
FTFKeeper *ftfkeeper.Keeper | ||
IBCKeeper *ibckeeper.Keeper | ||
Comment on lines
+19
to
+21
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Add validation for The Add a validation check for + if options.cdc == nil {
+ return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "codec is required for ante builder")
+ } Place this validation after the existing checks for other required fields.
|
||
} | ||
|
||
// NewAnteHandler extends the default Cosmos SDK AnteHandler with custom ante decorators. | ||
func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { | ||
if options.AccountKeeper == nil { | ||
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "account keeper is required for ante builder") | ||
} | ||
|
||
if options.BankKeeper == nil { | ||
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "bank keeper is required for ante builder") | ||
} | ||
|
||
if options.FTFKeeper == nil { | ||
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "fiattokenfactory keeper is required for ante builder") | ||
} | ||
|
||
if options.IBCKeeper == nil { | ||
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "ibc keeper is required for ante builder") | ||
} | ||
|
||
if options.SignModeHandler == nil { | ||
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder") | ||
} | ||
|
||
anteDecorators := []sdk.AnteDecorator{ | ||
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first | ||
ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker), | ||
ante.NewValidateBasicDecorator(), | ||
ante.NewTxTimeoutHeightDecorator(), | ||
ante.NewValidateMemoDecorator(options.AccountKeeper), | ||
|
||
fiattokenfactory.NewIsPausedDecorator(options.cdc, options.FTFKeeper), | ||
fiattokenfactory.NewIsBlacklistedDecorator(options.FTFKeeper), | ||
|
||
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper), | ||
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker), | ||
ante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators | ||
ante.NewValidateSigCountDecorator(options.AccountKeeper), | ||
ante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer), | ||
ante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler), | ||
ante.NewIncrementSequenceDecorator(options.AccountKeeper), | ||
|
||
ibcante.NewRedundantRelayDecorator(options.IBCKeeper), | ||
} | ||
|
||
return sdk.ChainAnteDecorators(anteDecorators...), nil | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
Consider preserving build output and adding error handling.
Redirecting stdout to
/dev/null
might hide important build information or errors. Consider the following improvements:make build
fails.Here's a suggested improvement:
This change will display the build output and stop the process if
make build
fails, providing better visibility and error handling.📝 Committable suggestion