Skip to content
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

Upgrade / v1.7.6 #445

Merged
merged 23 commits into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c293d88
Merge pull request #410 from sge-network/release/v1.7.x
scorpioborn Jun 20, 2024
7349c6f
Merge pull request #421 from sge-network/release/v1.7.x
scorpioborn Jul 25, 2024
6930279
Merge pull request #431 from sge-network/release/v1.7.x
scorpioborn Aug 6, 2024
5fae06a
Merge pull request #432 from sge-network/release/v1.7.x
scorpioborn Aug 8, 2024
86d6d49
refactor: disable all modules deprecated txs
scorpioborn Nov 4, 2024
4dae5b0
lint: remove unnecessary else
scorpioborn Nov 4, 2024
b735428
feat: upgrade golang to 1.23
scorpioborn Nov 4, 2024
56b559d
lint: golangci go version
scorpioborn Nov 4, 2024
163e2d2
lint: golangci upgrade
scorpioborn Nov 4, 2024
66e0ee1
lint: golangci new version fixes
scorpioborn Nov 4, 2024
9afb14d
feat: upgrde cosmos-sdk fork and wasmd
scorpioborn Nov 4, 2024
8c32d3f
Merge pull request #441 from scorpioborn/refactor/disable-txs
scorpioborn Nov 4, 2024
f66d4d1
fix: deduct tx fees
scorpioborn Nov 4, 2024
4ddf6c9
fix: add wasmconfig check
scorpioborn Nov 5, 2024
b1ced16
Merge pull request #442 from scorpioborn/fix/tx-fee-deduct
scorpioborn Nov 5, 2024
793e50c
fix: proto dockerfile and makefile v1.23
scorpioborn Nov 6, 2024
1db0d48
Merge pull request #443 from scorpioborn/fix/proto-dockerfile-version
scorpioborn Nov 21, 2024
a5bba54
refactor: upgrade alpine version of docker builder
scorpioborn Nov 25, 2024
14c8a48
Merge pull request #444 from sge-network/refactor/upgrade-builder-doc…
scorpioborn Nov 25, 2024
b22bd76
refactor: disable endblockers of v1 modules
scorpioborn Jan 31, 2025
fbda7e0
feat: upgrade handler with module accounts funds transfer
scorpioborn Feb 3, 2025
b8b6f4f
lint: unused ctx
scorpioborn Feb 3, 2025
db334b1
lint: worlflow upgrade for upload-artifact
scorpioborn Feb 3, 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
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ on:
schedule:
- cron: '26 6 * * 2'
env:
GO_VERSION: 1.22
GO_VERSION: 1.23

jobs:
analyze:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- master

env:
GO_VERSION: '1.22'
GO_VERSION: '1.23'

jobs:
golangci:
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.22
go-version: 1.23
- name: Display go version
run: go version
- name: install tparse
Expand All @@ -42,7 +42,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.22
go-version: 1.23
- uses: technote-space/get-diff-action@v4
id: git_diff
with:
Expand Down Expand Up @@ -71,7 +71,7 @@ jobs:
GOWRK=off go build cmd/sged/main.go
- name: Upload sged artifact
if: env.GIT_DIFF
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: sged-${{ matrix.targetos }}-${{ matrix.arch }}
path: cmd/sged/sged
Expand All @@ -81,7 +81,7 @@ jobs:
steps:
- uses: actions/setup-go@v5
with:
go-version: 1.22
go-version: 1.23
- uses: actions/checkout@v4
- name: Create a file with all the pkgs
run: go list ./... | grep -E -v 'tests/e2e' > pkgs.txt
Expand Down Expand Up @@ -116,7 +116,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.22
go-version: 1.23
- uses: technote-space/get-diff-action@v4
with:
PATTERNS: |
Expand Down Expand Up @@ -194,7 +194,7 @@ jobs:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: 1.22
go-version: 1.23
- uses: technote-space/get-diff-action@v4
with:
PATTERNS: |
Expand Down
14 changes: 11 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ run:
timeout: 15m
sort-results: true
allow-parallel-runners: true
exclude-dir: testutil/testdata_pulsar
concurrency: 4

linters:
Expand All @@ -16,7 +15,7 @@ linters:
- durationcheck
- errcheck
- errname
- exportloopref
- copyloopvar
- forcetypeassert
- goconst
- gofmt
Expand Down Expand Up @@ -48,7 +47,16 @@ linters:
- revive

issues:
exclude-rules: []
exclude-rules:
- path: (.+)_test.go
linters:
- gosec
- path: suite.go
linters:
- gosec
- path: testutil
linters:
- gosec
max-issues-per-linter: 10000
max-same-issues: 10000

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# syntax=docker/dockerfile:1

ARG GO_VERSION="1.22"
ARG GO_VERSION="1.23"
ARG RUNNER_IMAGE="gcr.io/distroless/static-debian11"
ARG BUILD_TAGS="netgo,ledger,muslc"

# --------------------------------------------------------
# Builder
# --------------------------------------------------------

FROM golang:${GO_VERSION}-alpine3.18 as builder
FROM golang:${GO_VERSION}-alpine3.20 as builder

ARG GIT_VERSION
ARG GIT_COMMIT
Expand Down
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ endif
###############################################################################

check_version:
ifneq ($(GO_MINOR_VERSION),22)
@echo "ERROR: Go version 1.22 is required for this version of SGE."
ifeq ($(shell expr $(GO_MINOR_VERSION) \< 23), 1)
@echo "ERROR: Go version 1.23+ is required for this version of SGE."
exit 1
endif

Expand All @@ -142,7 +142,7 @@ build-reproducible-amd64: go.sum
--build-arg GO_VERSION=$(GO_VERSION) \
--build-arg GIT_VERSION=$(VERSION) \
--build-arg GIT_COMMIT=$(COMMIT) \
--build-arg RUNNER_IMAGE=alpine:3.18 \
--build-arg RUNNER_IMAGE=alpine:3.20 \
--platform linux/amd64 \
-t sge:local-amd64 \
--load \
Expand All @@ -160,7 +160,7 @@ build-reproducible-arm64: go.sum
--build-arg GO_VERSION=$(GO_VERSION) \
--build-arg GIT_VERSION=$(VERSION) \
--build-arg GIT_COMMIT=$(COMMIT) \
--build-arg RUNNER_IMAGE=alpine:3.18 \
--build-arg RUNNER_IMAGE=alpine:3.20 \
--platform linux/arm64 \
-t sge:local-arm64 \
--load \
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ At launch, the SGE Network will be optimized to deploy an inaugural application:

## Installation Steps
>
>Prerequisite: go1.22+ required. [ref](https://golang.org/doc/install)
>Prerequisite: go1.23+ required. [ref](https://golang.org/doc/install)

Sge could be installed by two ways - downloading binary from releases page or build from source.

Expand Down
9 changes: 8 additions & 1 deletion app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ type HandlerOptions struct {
IBCKeeper *ibckeeper.Keeper
BankKeeper bankkeeper.Keeper
TxCounterStoreKey storetypes.StoreKey
WasmConfig wasmtypes.WasmConfig
WasmConfig *wasmtypes.WasmConfig
WasmKeeper *wasmkeeper.Keeper
Cdc codec.BinaryCodec

StakingKeeper stakingkeeper.Keeper
Expand All @@ -50,6 +51,10 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "sign mode handler is required for ante builder")
}

if options.WasmConfig == nil {
return nil, errorsmod.Wrap(sdkerrors.ErrLogic, "wasm config is required for ante builder")
}

sigGasConsumer := options.SigGasConsumer
if sigGasConsumer == nil {
sigGasConsumer = ante.DefaultSigVerificationGasConsumer
Expand All @@ -60,11 +65,13 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) {
ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first
wasmkeeper.NewLimitSimulationGasDecorator(options.WasmConfig.SimulationGasLimit),
wasmkeeper.NewCountTXDecorator(options.TxCounterStoreKey),
wasmkeeper.NewGasRegisterDecorator(options.WasmKeeper.GetGasRegister()),
ante.NewExtensionOptionsDecorator(options.ExtensionOptionChecker),
ante.NewValidateBasicDecorator(),
ante.NewTxTimeoutHeightDecorator(),
ante.NewValidateMemoDecorator(options.AccountKeeper),
ante.NewConsumeGasForTxSizeDecorator(options.AccountKeeper),
ante.NewDeductFeeDecorator(options.AccountKeeper, options.BankKeeper, options.FeegrantKeeper, options.TxFeeChecker),

// SetPubKeyDecorator must be called before all signature verification decorators
ante.NewSetPubKeyDecorator(options.AccountKeeper),
Expand Down
3 changes: 2 additions & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ func NewSgeApp(
IBCKeeper: app.AppKeepers.IBCKeeper,
BankKeeper: app.AppKeepers.BankKeeper,
TxCounterStoreKey: app.AppKeepers.GetKey(wasmtypes.StoreKey),
WasmConfig: wasmConfig,
WasmConfig: &wasmConfig,
WasmKeeper: &app.WasmKeeper,
Cdc: appCodec,

StakingKeeper: *app.AppKeepers.StakingKeeper,
Expand Down
2 changes: 1 addition & 1 deletion app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,7 @@ func NewAppKeeper(
ContractDebugMode: false,
}

wasmCapabilities := "iterator,staking,stargate"
wasmCapabilities := "iterator,staking,stargate,cosmwasm_1_1"

appKeepers.WasmKeeper = wasmkeeper.NewKeeper(
appCodec,
Expand Down
12 changes: 10 additions & 2 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ var mAccPerms = map[string][]string{
icatypes.ModuleName: nil,

// cosmwasm
wasmtypes.ModuleName: {},
wasmtypes.ModuleName: {authtypes.Burner},

// sge
betmoduletypes.BetFeeCollectorFunder{}.GetModuleAcc(): nil,
Expand Down Expand Up @@ -199,7 +199,15 @@ func appModules(
app.BankKeeper,
app.interfaceRegistry,
),
wasm.NewAppModule(appCodec, &app.AppKeepers.WasmKeeper, app.AppKeepers.StakingKeeper, app.AppKeepers.AccountKeeper, app.AppKeepers.BankKeeper, app.MsgServiceRouter(), app.GetSubspace(wasmtypes.ModuleName)),
wasm.NewAppModule(
appCodec,
&app.AppKeepers.WasmKeeper,
app.AppKeepers.StakingKeeper,
app.AppKeepers.AccountKeeper,
app.AppKeepers.BankKeeper,
app.MsgServiceRouter(),
app.GetSubspace(wasmtypes.ModuleName),
),
app.IBCModule,
params.NewAppModule(app.ParamsKeeper),
app.TransferModule,
Expand Down
4 changes: 2 additions & 2 deletions app/upgrades/v10/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"github.com/sge-network/sge/app/upgrades"
)

// UpgradeName defines the on-chain upgrade name for the v1.7.4 upgrade.
const UpgradeName = "v1.7.4"
// UpgradeName defines the on-chain upgrade name for the v1.7.6 upgrade.
const UpgradeName = "v1.7.6"

var Upgrade = upgrades.Upgrade{
UpgradeName: UpgradeName,
Expand Down
68 changes: 66 additions & 2 deletions app/upgrades/v10/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,19 +1,83 @@
package v10

import (
"strings"

sdkmath "cosmossdk.io/math"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

"github.com/sge-network/sge/app/keepers"
"github.com/sge-network/sge/app/params"
housetypes "github.com/sge-network/sge/x/house/types"
orderbooktypes "github.com/sge-network/sge/x/orderbook/types"
rewardtypes "github.com/sge-network/sge/x/reward/types"
)

func CreateUpgradeHandler(
mm *module.Manager,
configurator module.Configurator,
_ *keepers.AppKeepers,
k *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
var recAddress sdk.AccAddress
switch strings.ToLower(ctx.ChainID()) {
case "sgenet-1":
recAddress = sdk.MustAccAddressFromBech32("sge10gtzxh97gvgt6s58w5gagsacrwddhmgzn5ksk6")
case "sge-network-4":
recAddress = sdk.MustAccAddressFromBech32("sge19dkag3dkzcmjzhctz8ysfws443yq0nyyu0r8c0")
case "stage-sgenetwork":
recAddress = sdk.MustAccAddressFromBech32("sge1wkzh54s97m4cr70wfq9j7e4u42mkt2a7hak84c")
default:
return mm.RunMigrations(ctx, configurator, fromVM)
}

orderBookBalance := k.BankKeeper.GetBalance(
ctx,
k.AccountKeeper.GetModuleAddress(orderbooktypes.OrderBookLiquidityFunder{}.GetModuleAcc()),
params.DefaultBondDenom,
)
if orderBookBalance.Amount.GT(sdkmath.ZeroInt()) {
if err := k.BankKeeper.SendCoinsFromModuleToAccount(
ctx,
orderbooktypes.OrderBookLiquidityFunder{}.GetModuleAcc(),
recAddress, sdk.NewCoins(orderBookBalance),
); err != nil {
return nil, err
}
}

houseFeeBalance := k.BankKeeper.GetBalance(
ctx,
k.AccountKeeper.GetModuleAddress(housetypes.HouseFeeCollectorFunder{}.GetModuleAcc()),
params.DefaultBondDenom,
)
if houseFeeBalance.Amount.GT(sdkmath.ZeroInt()) {
if err := k.BankKeeper.SendCoinsFromModuleToAccount(
ctx,
housetypes.HouseFeeCollectorFunder{}.GetModuleAcc(),
recAddress, sdk.NewCoins(houseFeeBalance),
); err != nil {
return nil, err
}
}

rewardPoolBalance := k.BankKeeper.GetBalance(
ctx,
k.AccountKeeper.GetModuleAddress(rewardtypes.RewardPoolFunder{}.GetModuleAcc()),
params.DefaultBondDenom,
)
if rewardPoolBalance.Amount.GT(sdkmath.ZeroInt()) {
if err := k.BankKeeper.SendCoinsFromModuleToAccount(
ctx,
rewardtypes.RewardPoolFunder{}.GetModuleAcc(),
recAddress, sdk.NewCoins(rewardPoolBalance),
); err != nil {
return nil, err
}
}

return mm.RunMigrations(ctx, configurator, fromVM)
}
}
4 changes: 1 addition & 3 deletions app/upgrades/v9/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,10 @@ func CreateUpgradeHandler(
configurator module.Configurator,
k *keepers.AppKeepers,
) upgradetypes.UpgradeHandler {
return func(ctx sdk.Context, plan upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
return func(ctx sdk.Context, _ upgradetypes.Plan, fromVM module.VersionMap) (module.VersionMap, error) {
// https://github.com/cosmos/cosmos-sdk/pull/12363/files
// Set param key table for params module migration
for _, subspace := range k.ParamsKeeper.GetSubspaces() {
subspace := subspace

var keyTable paramstypes.KeyTable
switch subspace.Name() {
case authtypes.ModuleName:
Expand Down
1 change: 0 additions & 1 deletion cmd/sged/cmd/genaccounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@ func TestSampleCMD(t *testing.T) {
args: []string{},
},
} {
tc := tc
t.Run(tc.desc, func(t *testing.T) {
var args []string

Expand Down
Loading
Loading