Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
307ddff
upgrade sdk to v0.47
LucaPalla95 Dec 17, 2024
76c285e
add icacontroller and reorder app.go steps
niilptr Dec 20, 2024
a17e6d7
refactor new app inputs and update modules
LucaPalla95 Dec 23, 2024
992f013
add icq, use AppKeepers, refactor upgrades structure
niilptr Dec 23, 2024
b2abf76
refactor using AppKeepers and upgrade directories
niilptr Dec 23, 2024
c003b6f
add modules consensus version
LucaPalla95 Dec 24, 2024
c7a8d28
add new grpc services
niilptr Dec 24, 2024
55b8115
add params migration to v05 upgrade handler
niilptr Dec 24, 2024
29758c0
add params upgrades
niilptr Jan 2, 2025
1196e1c
generate proto-go
niilptr Jan 2, 2025
88f0a7f
remove burn module
niilptr Jan 3, 2025
9f6054e
remove dependency from ignite-cli
niilptr Jan 3, 2025
c90e4cf
bump dependencies, update make proto-gen
niilptr Jan 3, 2025
585b752
ugrade sdk to v0.50
LucaPalla95 Jan 8, 2025
06f1892
update dependencies versions, use cosmos logger
LucaPalla95 Jan 9, 2025
dca7cb4
use cosmos-db, remove legeacy proposal handler
LucaPalla95 Jan 9, 2025
b5477a6
fix keepers initialisation, fix app methods
LucaPalla95 Jan 13, 2025
2bec208
update proto
niilptr Jan 9, 2025
4b547b4
update modules to v0.50
niilptr Jan 10, 2025
7983ff5
update root.go and add autocli (wip)
niilptr Jan 10, 2025
8e895dc
use cmtservice, fix bApp.SetParamStore, fix expected keepers
LucaPalla95 Jan 14, 2025
eb1ca00
Update InterfaceRegistry and appCodec (wip)
LucaPalla95 Jan 14, 2025
b822ec4
fix handling of interfaceRegistry and txConfig
niilptr Jan 14, 2025
95f597d
move ValidateBasic in the message server
niilptr Jan 15, 2025
1904f95
go mod tidy
niilptr Jan 15, 2025
0d7c87f
remove the legacy GetSignBytes method since no longer need to impleme…
niilptr Jan 15, 2025
29d06ca
Add preblocker and remove ModuleBaisc global variable (now local)
LucaPalla95 Jan 15, 2025
928e2ae
update modules AppModule wrt sdk v0.50 definitions
niilptr Jan 16, 2025
44cb683
remove GetSigners() from messages since no longer required in sdk v0.50
niilptr Jan 16, 2025
d3b892d
remove unneeded Route() and Type() methods from messages
niilptr Jan 16, 2025
ba66307
add circuit module
niilptr Jan 16, 2025
0dba8f3
Fix root.go
LucaPalla95 Jan 16, 2025
d1a2178
add app_params.go
niilptr Jan 16, 2025
f57eab0
sdk v0.50: fix main
niilptr Jan 16, 2025
2a6a051
sdk v0.50: fix genaccounts
niilptr Jan 16, 2025
3652720
sdk v0.50: remove unneeded NewDefaultGenesisState
niilptr Jan 16, 2025
f3ca063
sdk v0.50: fix MakeEncodingConfig
niilptr Jan 16, 2025
75f0797
sdk v0.50: fix export.go
niilptr Jan 16, 2025
05b32b9
sdk v0.50: fix upgrades dependencies
niilptr Jan 16, 2025
1f1ece5
fix proto-gen, update services types names, update variables names
niilptr Jan 17, 2025
c787f52
make proto-gen
niilptr Jan 17, 2025
8c878cf
upgrade go version, remove not needed replace
niilptr Jan 17, 2025
6c8f944
bump go version
niilptr Jan 20, 2025
420847b
sdk v0.50: fix build
niilptr Jan 20, 2025
7944fec
add build test
niilptr Jan 20, 2025
c68e659
Fix proto
LucaPalla95 Jan 21, 2025
9dbbb66
Fix proto
LucaPalla95 Jan 21, 2025
cb4d55b
fix proto
LucaPalla95 Jan 22, 2025
4fa7c10
fix nft mint
niilptr Jan 22, 2025
eb7e591
fix app adding setupUpgradeStoreLoaders
niilptr Jan 22, 2025
1c04e46
add helpers to test upgrades
niilptr Jan 22, 2025
aaa824a
fix keys readding missing keys
niilptr Jan 23, 2025
d8a145d
fix upgrade test
niilptr Jan 23, 2025
a0dcae3
update dependencies
niilptr Jan 28, 2025
0a98925
use app params and encoding config
niilptr Jan 28, 2025
ad88697
fix keyring not decoding keys by fixing root initialization
niilptr Jan 29, 2025
e21c99f
minor refactor for setting sdk config
niilptr Jan 29, 2025
1abd7af
add cosmos service option to proto msg
niilptr Jan 29, 2025
4d3ba0a
re-add get tx and get query cmds
niilptr Jan 29, 2025
23ad221
setup test for msgs handler
niilptr Jan 29, 2025
826e8ee
fix test suite genesis initialization
niilptr Jan 30, 2025
cc2f2fc
refactor test suite and update the internal modules wiring test
niilptr Jan 30, 2025
55252d6
add setup methods to test suite
niilptr Jan 30, 2025
d66a5f6
Fix failed to load latest version error
LucaPalla95 Jan 31, 2025
675286b
fix test suite initialization
niilptr Jan 31, 2025
80da3e8
Fix missing param during migration
LucaPalla95 Feb 3, 2025
c95eeeb
Review v0.5.0 upgradeHandler
LucaPalla95 Feb 5, 2025
8d5b0d8
review go.mod
LucaPalla95 Feb 5, 2025
e2d1ae4
remove not needed file
niilptr Feb 5, 2025
f5501cc
update dockerfile
niilptr Feb 11, 2025
8ba78dd
fix ibc client creation failure by adding the ibc light-clients module
niilptr Feb 12, 2025
cf4aad1
clean code
niilptr Feb 14, 2025
6c24c23
enable cmtservice.RegisterGRPCGatewayRoutes
niilptr Feb 14, 2025
f675a50
update pfm module version
niilptr Feb 14, 2025
3f23992
unpin buf commits, update proto-builder version, regenerate proto
niilptr Feb 19, 2025
e68ca32
add proto validation at app startup
niilptr Feb 19, 2025
11204d2
add call to register streaming service
niilptr Feb 19, 2025
170ec55
add wasm pinned code initialization
niilptr Feb 19, 2025
220b064
remove not needed file
niilptr Feb 19, 2025
897aa98
update swagger generation
niilptr Feb 19, 2025
05b7b37
use local go modules for swagger generation and link the output to th…
niilptr Feb 20, 2025
4b832fc
delete the old openapi documentation and not needed file
niilptr Feb 20, 2025
ad3d10b
add gov params ExpeditedMinDeposit and MinInitialDepositRatio
niilptr Feb 26, 2025
c482963
add proposals migration in the upgrade handler
niilptr Feb 27, 2025
06abbeb
upgrade wasmd version
niilptr Feb 27, 2025
89a072e
update antehandler
niilptr Feb 28, 2025
333af2a
bump versions
LucaPalla95 Mar 3, 2025
13c0eea
fix proposals migration
niilptr Mar 3, 2025
84ec7b7
icq version bump
LucaPalla95 Mar 3, 2025
b428e60
Merge branch 'luca/bump-version' into kintsugi/cosmos-sdk-upgrade
LucaPalla95 Mar 3, 2025
d1b7202
fix upgrade loggers
niilptr Mar 5, 2025
bdd73e6
update wasm availableCapabilities
niilptr Mar 5, 2025
fa07242
set MinInitialDepositRatio to 0.5
niilptr Mar 12, 2025
fa28352
set ProposalCancelRatio to 0.5 and specify the ProposalCancelDest add…
niilptr Mar 12, 2025
5d294d6
fix upgrade test
niilptr Mar 13, 2025
a095089
rename v05 to v5
niilptr Mar 27, 2025
7336f05
rename v04 to v4
niilptr Mar 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
98 changes: 61 additions & 37 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,37 +1,61 @@
# how to run
# docker build -t firmachain .

# docker run -it -p 26657:26657 -p 26656:26656 -v ~/.firmachain:/root/.firmachain firmachain firmachaind init
# docker run -it -p 26657:26657 -p 26656:26656 -v ~/.firmachain:/root/.firmachain firmachain firmachaind start

# to enter docker
# docker exec -it firmachain bash

# run container as a daemon (td option : -t -> Assign Termail to Container, -d: run on the background)
# > docker run -td -p 26657:26657 -p 26656:26656 -v ~/.firmachain:/root/.firmachain firmachain firmachaind start

# Use multi-stage build
FROM golang:1.16 as builder

RUN apt-get update && apt-get install -y git

# Download from GitHub instead of using COPY
RUN rm firmachain -rf
RUN git clone https://github.com/firmachain/firmachain /firmachain
WORKDIR "/firmachain"

# Always run on latest version
RUN LEDGER_ENABLED=false make

# Create final container
FROM ubuntu:latest

# It is ok to COPY files from a build container (when using multi-stage builds)
COPY --from=builder /go/bin/firmachaind /usr/local/bin/firmachaind

# rest server / grpc / tendermint p2p / tendermint rpc
EXPOSE 1317 9090 26656 26657

# Run firmachind by default
# ex) docker run firmachain
CMD ["/usr/local/bin/firmachaind"]
# syntax=docker/dockerfile:1

ARG GO_VERSION="1.23"
ARG RUNNER_IMAGE="alpine:3.20"

# Use a minimal base image (Alpine Linux)
FROM golang:${GO_VERSION}-alpine3.20 AS go-builder

WORKDIR /app

RUN apk add --no-cache ca-certificates build-base git linux-headers binutils-gold

# Download dependencies and CosmWasm libwasmvm if found.
ADD go.mod go.sum ./
RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
go mod download

# Cosmwasm - Download correct libwasmvm version
RUN ARCH=$(uname -m) && WASMVM_VERSION=$(go list -m github.com/CosmWasm/wasmvm/v2 | sed 's/.* //') && \
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/libwasmvm_muslc.$ARCH.a \
-O /lib/libwasmvm_muslc.$ARCH.a && \
# verify checksum
wget https://github.com/CosmWasm/wasmvm/releases/download/$WASMVM_VERSION/checksums.txt -O /tmp/checksums.txt && \
sha256sum /lib/libwasmvm_muslc.$ARCH.a | grep $(cat /tmp/checksums.txt | grep libwasmvm_muslc.$ARCH | cut -d ' ' -f 1)


# Copy the repository
COPY . ./

ARG GIT_VERSION
ARG GIT_COMMIT
ARG GIT_BRANCH

RUN git checkout ${GIT_BRANCH}

RUN --mount=type=cache,target=/root/.cache/go-build \
--mount=type=cache,target=/root/go/pkg/mod \
GOWORK=off go build \
-mod=readonly \
-tags "netgo,ledger,muslc" \
-ldflags \
"-X github.com/cosmos/cosmos-sdk/version.Name="firmachain" \
-X github.com/cosmos/cosmos-sdk/version.AppName="firmachaind" \
-X github.com/cosmos/cosmos-sdk/version.Version=${GIT_VERSION}@${GIT_BRANCH} \
-X github.com/cosmos/cosmos-sdk/version.Commit=${GIT_COMMIT} \
-w -s -linkmode=external -extldflags '-Wl,-z,muldefs -static'" \
-trimpath \
-o ./bin/firmachaind \
./cmd/firmachaind

# --------------------------------------------------------
FROM ${RUNNER_IMAGE}

COPY --from=go-builder /app/bin/firmachaind /usr/bin/firmachaind

# rest server, tendermint p2p, tendermint rpc
EXPOSE 1317 26656 26657

ENV PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH"
CMD ["/usr/bin/firmachaind", "version"]
9 changes: 0 additions & 9 deletions Dockerfile.proto-gen

This file was deleted.

54 changes: 31 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
PACKAGES=$(shell go list ./... | grep -v '/simulation')
VERSION := $(shell echo $(shell git describe --tags --always) | sed 's/^v//')
COMMIT := $(shell git log -1 --format='%H')
BRANCH := $(shell git branch --show-current)

include Makefile.ledger

Expand All @@ -21,11 +22,20 @@ else
BUILD_FLAGS := -ldflags '$(ldflags)' $(build_tags)
endif

DOCKER := $(shell which docker)

all: install

install: go.sum
go install -mod=readonly $(BUILD_FLAGS) ./cmd/firmachaind

docker-img-from-current-branch:
docker build \
--build-arg GIT_VERSION=$(VERSION) \
--build-arg GIT_COMMIT=$(COMMIT) \
--build-arg GIT_BRANCH=$(BRANCH) \
-t firmachain .

go.sum: go.mod
@echo "--> Ensure dependencies have not been modified"
GO111MODULE=on go mod verify
Expand All @@ -38,26 +48,24 @@ test:
###############################################################################

# Variables for the image and version
protoVer=v0.7
protoImageName=tendermintdev/sdk-proto-gen-go-1.21-image
GOLANG_VERSION=1.21.0
containerProtoGen=firmachain-proto-gen-$(protoVer)-go-${GOLANG_VERSION}

# Target to build the image if it doesn't exist
build-proto-image:
@if [ -z "$$(docker images -q $(protoImageName))" ]; then \
echo "Building Docker image with Go $(GOLANG_VERSION)..."; \
docker build -t $(protoImageName) -f Dockerfile.proto-gen .; \
else \
echo "Image $(protoImageName) already exists."; \
fi

# Generate Protobuf files using the image
proto-gen: build-proto-image
@echo "Generating Protobuf files..."
@if docker ps -a --format '{{.Names}}' | grep -Eq "^${containerProtoGen}$$"; then \
docker start -a $(containerProtoGen); \
else \
docker run --name $(containerProtoGen) -v $(CURDIR):/firmachain --workdir /firmachain $(protoImageName) \
sh ./scripts/protocgen.sh; \
fi
protoVer=0.15.3
protoImageName=ghcr.io/cosmos/proto-builder:$(protoVer)
protoImage=$(DOCKER) run --rm -v $(CURDIR):/workspace --workdir /workspace $(protoImageName)

proto-gen:
@echo "Generating Protobuf files"
@$(protoImage) sh ./scripts/protocgen.sh

###############################################################################
### Docs ###
###############################################################################

SWAGGER_DIR=./swagger-proto

swagger:
@echo "Downloading go modules..."
@go mod tidy
@echo
@echo "Generating Swagger..."
@echo
@./scripts/generate-swagger.sh
76 changes: 76 additions & 0 deletions app/ante.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package app

import (
"errors"

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

corestoretypes "cosmossdk.io/core/store"
circuitante "cosmossdk.io/x/circuit/ante"
circuitkeeper "cosmossdk.io/x/circuit/keeper"

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

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types"
)

// FirmachainHandlerOptions extends the SDK's AnteHandler options.
type FirmachainHandlerOptions struct {
sdkante.HandlerOptions

IBCKeeper *ibckeeper.Keeper
CircuitKeeper *circuitkeeper.Keeper

WasmKeeper *wasmkeeper.Keeper
WasmNodeConfig *wasmTypes.NodeConfig

TXCounterStoreService corestoretypes.KVStoreService
}

// NewAnteHandler constructor
func NewAnteHandler(options FirmachainHandlerOptions) (sdk.AnteHandler, error) {
if options.AccountKeeper == nil {
return nil, errors.New("account keeper is required for ante builder")
}
if options.BankKeeper == nil {
return nil, errors.New("bank keeper is required for ante builder")
}
if options.SignModeHandler == nil {
return nil, errors.New("sign mode handler is required for ante builder")
}
if options.WasmNodeConfig == nil {
return nil, errors.New("wasm config is required for ante builder")
}
if options.TXCounterStoreService == nil {
return nil, errors.New("wasm store service is required for ante builder")
}
if options.CircuitKeeper == nil {
return nil, errors.New("circuit keeper is required for ante builder")
}

anteDecorators := []sdk.AnteDecorator{
sdkante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
wasmkeeper.NewLimitSimulationGasDecorator(options.WasmNodeConfig.SimulationGasLimit), // after setup context to enforce limits early
wasmkeeper.NewCountTXDecorator(options.TXCounterStoreService),
wasmkeeper.NewGasRegisterDecorator(options.WasmKeeper.GetGasRegister()),
wasmkeeper.NewTxContractsDecorator(),
circuitante.NewCircuitBreakerDecorator(options.CircuitKeeper),
sdkante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker),
sdkante.NewValidateBasicDecorator(),
sdkante.NewTxTimeoutHeightDecorator(),
sdkante.NewValidateMemoDecorator(options.AccountKeeper),
sdkante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
sdkante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),
sdkante.NewSetPubKeyDecorator(options.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators
sdkante.NewValidateSigCountDecorator(options.AccountKeeper),
sdkante.NewSigGasConsumeDecorator(options.AccountKeeper, options.SigGasConsumer),
sdkante.NewSigVerificationDecorator(options.AccountKeeper, options.SignModeHandler),
sdkante.NewIncrementSequenceDecorator(options.AccountKeeper),
ibcante.NewRedundantRelayDecorator(options.IBCKeeper),
}

return sdk.ChainAnteDecorators(anteDecorators...), nil
}
Loading