Skip to content
This repository has been archived by the owner on Oct 24, 2024. It is now read-only.

Extend TLD Expiration Message #104

Merged
merged 26 commits into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
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
55 changes: 55 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Lint

on:
pull_request:
branches:
- "**"
workflow_dispatch:

permissions:
contents: read
# Optional: allow read access to pull request. Use with `only-new-issues` option.
# pull-requests: read

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.21'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Require: The version of golangci-lint to use.
# When `install-mode` is `binary` (default) the value can be v1.2 or v1.2.3 or `latest` to use the latest version.
# When `install-mode` is `goinstall` the value can be v1.2.3, `latest`, or the hash of a commit.
version: v1.55

# Optional: working directory, useful for monorepos
# working-directory: somedir

# Optional: golangci-lint command line arguments.
#
# Note: By default, the `.golangci.yml` file should be at the root of the repository.
# The location of the configuration file can be changed by using `--config=`
# args: --timeout=30m --config=/my/path/.golangci.yml --issues-exit-code=0

# Optional: show only new issues if it's a pull request. The default value is `false`.
# only-new-issues: true

# Optional: if set to true, then all caching functionality will be completely disabled,
# takes precedence over all other caching options.
# skip-cache: true

# Optional: if set to true, then the action won't cache or restore ~/go/pkg.
# skip-pkg-cache: true

# Optional: if set to true, then the action won't cache or restore ~/.cache/go-build.
# skip-build-cache: true

# Optional: The mode to install golangci-lint. It can be 'binary' or 'goinstall'.
# install-mode: "goinstall"
34 changes: 34 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
run:
tests: true
# timeout for analysis, e.g. 30s, 5m, default is 1m
timeout: 5m

linters:
disable-all: true
enable:
- errcheck
- misspell
- gosimple
- govet
- gci

linters-settings:
gci:
# Section configuration to compare against.
# Section names are case-insensitive and may contain parameters in ().
# The default order of sections is `standard > default > custom > blank > dot`,
# If `custom-order` is `true`, it follows the order of `sections` option.
# Default: ["standard", "default"]
sections:
- standard # Standard section: captures all standard packages.
- default # Default section: contains all imports that could not be matched to another section type.
- prefix(github.com/mycel-domain/mycel) # Custom section: groups all imports with the specified Prefix.
- blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled.
- dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled.
# Skip generated files.
# Default: true
skip-generated: false
# Enable custom order of sections.
# If `true`, make the section order the same as the order of `sections`.
# Default: false
custom-order: true
41 changes: 33 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,7 @@ CONTAINER_NAME := mycel_i
DOCKERFILE := ./dockerfile-build
DOCKER_RUN_CMD := docker run --rm -it -v $(shell pwd):/mycel -w /mycel -p 1317:1317 -p 3000:3000 -p 4500:4500 -p 5000:5000 -p 26657:26657 --name mycel $(CONTAINER_NAME)

test-all-module:
go test ./x/.../
test-all-keepers:
go test ./x/.../keeper
test-all-types:
go test ./x/.../types
test-module-%:
go test ./x/$*/.../
## Build
docker-build:
docker build -t $(CONTAINER_NAME) -f $(DOCKERFILE) .
docker-run:
Expand All @@ -18,3 +11,35 @@ serve:
$(DOCKER_RUN_CMD) ignite chain serve -r
build:
$(DOCKER_RUN_CMD) ignite chain build

## Test
test-all-module:
go test ./x/.../
test-all-keepers:
go test ./x/.../keeper
test-all-types:
go test ./x/.../types
test-module-%:
go test ./x/$*/.../


## Lint
golangci_lint_cmd=golangci-lint
golangci_version=v1.55.2

lint:
@echo "--> Running linter"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
@$(golangci_lint_cmd) run --timeout=10m

lint-fix:
@echo "--> Running linter"
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
@$(golangci_lint_cmd) run --fix --out-format=tab --issues-exit-code=0

format:
@go install mvdan.cc/gofumpt@latest
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@$(golangci_version)
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -path "./tests/mocks/*" -not -name "*.pb.go" -not -name "*.pb.gw.go" -not -name "*.pulsar.go" -not -path "./crypto/keys/secp256k1/*" | xargs gofumpt -w -l
$(golangci_lint_cmd) run --fix
.PHONY: format
11 changes: 4 additions & 7 deletions app/ante.go
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
package app

import (
ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
"github.com/cosmos/ibc-go/v7/modules/core/keeper"

errorsmod "cosmossdk.io/errors"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/x/auth/ante"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types"
ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante"
"github.com/cosmos/ibc-go/v7/modules/core/keeper"
)

// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
Expand Down
27 changes: 11 additions & 16 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ import (

autocliv1 "cosmossdk.io/api/cosmos/autocli/v1"
reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1"
// CosmWasm
"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/libs/log"
Expand Down Expand Up @@ -111,31 +115,22 @@ import (
ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint"
"github.com/spf13/cast"

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

// Registry
registrymodule "github.com/mycel-domain/mycel/x/registry"
registrymodulekeeper "github.com/mycel-domain/mycel/x/registry/keeper"
registrymoduletypes "github.com/mycel-domain/mycel/x/registry/types"

appparams "github.com/mycel-domain/mycel/app/params"
"github.com/mycel-domain/mycel/docs"
// Epochs
epochsmodule "github.com/mycel-domain/mycel/x/epochs"
epochsmodulekeeper "github.com/mycel-domain/mycel/x/epochs/keeper"
epochsmoduletypes "github.com/mycel-domain/mycel/x/epochs/types"

furnacemodule "github.com/mycel-domain/mycel/x/furnace"
furnacemodulekeeper "github.com/mycel-domain/mycel/x/furnace/keeper"
furnacemoduletypes "github.com/mycel-domain/mycel/x/furnace/types"
// Registry
registrymodule "github.com/mycel-domain/mycel/x/registry"
registrymodulekeeper "github.com/mycel-domain/mycel/x/registry/keeper"
registrymoduletypes "github.com/mycel-domain/mycel/x/registry/types"
resolvermodule "github.com/mycel-domain/mycel/x/resolver"
resolvermodulekeeper "github.com/mycel-domain/mycel/x/resolver/keeper"
resolvermoduletypes "github.com/mycel-domain/mycel/x/resolver/types"
// this line is used by starport scaffolding # stargate/app/moduleImport

appparams "github.com/mycel-domain/mycel/app/params"
"github.com/mycel-domain/mycel/docs"
)

const (
Expand Down Expand Up @@ -327,7 +322,7 @@ type App struct {
RegistryKeeper registrymodulekeeper.Keeper
EpochsKeeper epochsmodulekeeper.Keeper
ResolverKeeper resolvermodulekeeper.Keeper
FurnaceKeeper furnacemodulekeeper.Keeper
FurnaceKeeper furnacemodulekeeper.Keeper
// this line is used by starport scaffolding # stargate/app/keeperDeclaration

// mm is the module manager
Expand Down
2 changes: 1 addition & 1 deletion app/params/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const (

Bech32PrefixAccAddr = "mycel"

OneYearInDays = 365
OneYearInDays = 365
)

var (
Expand Down
10 changes: 4 additions & 6 deletions app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@ import (
"encoding/json"
"testing"

"cosmossdk.io/math"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
dbm "github.com/cometbft/cometbft-db"
abci "github.com/cometbft/cometbft/abci/types"
"github.com/cometbft/cometbft/libs/log"
tmproto "github.com/cometbft/cometbft/proto/tendermint/types"
tmtypes "github.com/cometbft/cometbft/types"
"github.com/stretchr/testify/require"

"cosmossdk.io/math"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
"github.com/cosmos/cosmos-sdk/server"
Expand All @@ -25,6 +22,7 @@ import (
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
minttypes "github.com/cosmos/cosmos-sdk/x/mint/types"
"github.com/stretchr/testify/require"
)

// SetupOptions defines arguments that are passed into `Simapp` constructor.
Expand Down
7 changes: 7 additions & 0 deletions buf.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
version: v1
breaking:
use:
- FILE
lint:
use:
- DEFAULT
21 changes: 11 additions & 10 deletions cmd/myceld/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,18 @@ package cmd
import (
"errors"
"io"
"log"
"os"
"path/filepath"
"strings"

// CosmWasm
wasmcli "github.com/CosmWasm/wasmd/x/wasm/client/cli"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
dbm "github.com/cometbft/cometbft-db"
tmcfg "github.com/cometbft/cometbft/config"
tmcli "github.com/cometbft/cometbft/libs/cli"
"github.com/cometbft/cometbft/libs/log"
tmlog "github.com/cometbft/cometbft/libs/log"
tmtypes "github.com/cometbft/cometbft/types"
"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
Expand Down Expand Up @@ -38,12 +42,6 @@ import (
"github.com/spf13/cobra"
"github.com/spf13/pflag"

// this line is used by starport scaffolding # root/moduleImport

// CosmWasm
wasmcli "github.com/CosmWasm/wasmd/x/wasm/client/cli"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"

"github.com/mycel-domain/mycel/app"
appparams "github.com/mycel-domain/mycel/app/params"
"github.com/mycel-domain/mycel/cmd/myceld/dns"
Expand Down Expand Up @@ -224,7 +222,10 @@ func overwriteFlagDefaults(c *cobra.Command, defaults map[string]string) {
set := func(s *pflag.FlagSet, key, val string) {
if f := s.Lookup(key); f != nil {
f.DefValue = val
f.Value.Set(val)
err := f.Value.Set(val)
if err != nil {
log.Printf("%v", err)
}
}
}
for key, val := range defaults {
Expand All @@ -242,7 +243,7 @@ type appCreator struct {

// newApp creates a new Cosmos SDK app
func (a appCreator) newApp(
logger log.Logger,
logger tmlog.Logger,
db dbm.DB,
traceStore io.Writer,
appOpts servertypes.AppOptions,
Expand Down Expand Up @@ -324,7 +325,7 @@ func (a appCreator) newApp(

// appExport creates a new simapp (optionally at a given height)
func (a appCreator) appExport(
logger log.Logger,
logger tmlog.Logger,
db dbm.DB,
traceStore io.Writer,
height int64,
Expand Down
9 changes: 6 additions & 3 deletions cmd/myceld/dns/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ import (
"strings"

"github.com/miekg/dns"
resolver "github.com/mycel-domain/mycel/x/resolver/types"
"github.com/spf13/cobra"
"google.golang.org/grpc"

"github.com/spf13/cobra"
resolver "github.com/mycel-domain/mycel/x/resolver/types"
)

type grpcService struct {
Expand Down Expand Up @@ -193,7 +193,10 @@ func (s *grpcService) HandleDNSRequest(w dns.ResponseWriter, r *dns.Msg) {
msg.SetRcode(r, dns.RcodeNameError)
}

w.WriteMsg(&msg)
err := w.WriteMsg(&msg)
if err != nil {
log.Printf("Failed to write message: %v", err)
}
}

func RunDnsServer(nodeAddress string, listenPort int) error {
Expand Down
5 changes: 4 additions & 1 deletion docs/docs.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@ func handler(title string) http.HandlerFunc {
t, _ := httptemplate.ParseFS(template, indexFile)

return func(w http.ResponseWriter, req *http.Request) {
t.Execute(w, struct {
err := t.Execute(w, struct {
Title string
URL string
}{
title,
apiFile,
})
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}
}
Loading
Loading