Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- ci_step: "integration tests"
command: make integration-tests

runs-on: self-hosted
runs-on: ubuntu-24.04
steps:
- name: Go version used to build builder
run: go version
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:

jobs:
release:
runs-on: self-hosted
runs-on: ubuntu-24.04
steps:
- name: Checkout faucet
uses: actions/checkout@v4
Expand Down
4 changes: 2 additions & 2 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/pkg/errors"

"github.com/CoreumFoundation/coreum/v4/pkg/client"
"github.com/CoreumFoundation/coreum/v4/pkg/config"
"github.com/CoreumFoundation/coreum/v5/pkg/client"
"github.com/CoreumFoundation/coreum/v5/pkg/config"
)

// App implements core functionality.
Expand Down
2 changes: 1 addition & 1 deletion app/monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

"github.com/CoreumFoundation/coreum-tools/pkg/logger"
"github.com/CoreumFoundation/coreum-tools/pkg/parallel"
"github.com/CoreumFoundation/coreum/v4/pkg/client"
"github.com/CoreumFoundation/coreum/v5/pkg/client"
faucethttp "github.com/CoreumFoundation/faucet/pkg/http"
)

Expand Down
1 change: 0 additions & 1 deletion app/parse_addr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func TestParseAddress(t *testing.T) {
}

for _, tc := range testCases {
tc := tc
t.Run(tc.name, func(t *testing.T) {
requireT := require.New(t)
prefix, addr, err := parseAddress(tc.address)
Expand Down
6 changes: 6 additions & 0 deletions build/cmd/builder/main.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
package main

import (
coreumTools "github.com/CoreumFoundation/coreum/build/tools"
"github.com/CoreumFoundation/crust/build"
"github.com/CoreumFoundation/crust/build/tools"
selfBuild "github.com/CoreumFoundation/faucet/build"
)

func init() {
tools.AddTools(coreumTools.Tools...)
}

func main() {
build.Main(selfBuild.Commands)
}
4 changes: 3 additions & 1 deletion build/cmd/znet/main.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package main

import "github.com/CoreumFoundation/crust/pkg/znet"
import (
"github.com/CoreumFoundation/crust/znet/pkg/znet"
)

func main() {
znet.Main()
Expand Down
6 changes: 3 additions & 3 deletions build/faucet/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@ import (
"github.com/CoreumFoundation/crust/build/golang"
"github.com/CoreumFoundation/crust/build/tools"
"github.com/CoreumFoundation/crust/build/types"
"github.com/CoreumFoundation/crust/infra"
"github.com/CoreumFoundation/crust/infra/apps"
"github.com/CoreumFoundation/crust/pkg/znet"
"github.com/CoreumFoundation/crust/znet/infra"
"github.com/CoreumFoundation/crust/znet/infra/apps"
"github.com/CoreumFoundation/crust/znet/pkg/znet"
)

const (
Expand Down
308 changes: 159 additions & 149 deletions build/go.mod

Large diffs are not rendered by default.

1,499 changes: 415 additions & 1,084 deletions build/go.sum

Large diffs are not rendered by default.

12 changes: 7 additions & 5 deletions client/coreum/batch_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"sync"
"testing"

sdkmath "cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/assert"
Expand Down Expand Up @@ -46,9 +47,9 @@ func TestBatchSend(t *testing.T) {
ctx := logger.WithLogger(context.Background(), zaptest.NewLogger(t))
ctx, cancel := context.WithCancel(ctx)
t.Cleanup(cancel)
amount := sdk.NewCoin("test-denom", sdk.NewInt(13))
amount := sdk.NewCoin("test-denom", sdkmath.NewInt(13))
fundingAddresses := []sdk.AccAddress{}
for i := 0; i < 2; i++ {
for range 2 {
address, err := sdk.AccAddressFromHexUnsafe(secp256k1.GenPrivKey().PubKey().Address().String())
fundingAddresses = append(fundingAddresses, address)
requireT.NoError(err)
Expand All @@ -67,11 +68,12 @@ func TestBatchSend(t *testing.T) {
wg := sync.WaitGroup{}
requestCount := 100
wg.Add(requestCount)
for i := 0; i < requestCount; i++ {
for range requestCount {
go func() {
txHash, err := batcher.SendToken(ctx, nil, amount)
requireT.NoError(err)
assertT.Greater(len(txHash), 1) //nolint:testifylint // it suggests to use `NotEmpty` which is a nonsense here
if assert.NoError(t, err) {
assertT.Greater(len(txHash), 1)
}
wg.Done()
}()
}
Expand Down
1 change: 0 additions & 1 deletion client/coreum/batcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,6 @@ func (b *Batcher) Run(ctx context.Context) error {
spawn("processBatches", parallel.Fail, func(ctx context.Context) error {
_ = parallel.Run(ctx, func(ctx context.Context, spawn parallel.SpawnFn) error {
for _, fundingAddress := range b.fundingAddresses {
fundingAddress := fundingAddress
spawn(fundingAddress.String(), parallel.Continue, func(ctx context.Context) error {
b.processBatches(ctx, fundingAddress)
return nil
Expand Down
4 changes: 2 additions & 2 deletions client/coreum/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
"go.uber.org/zap"

"github.com/CoreumFoundation/coreum/v4/pkg/client"
"github.com/CoreumFoundation/coreum/v4/pkg/config"
"github.com/CoreumFoundation/coreum/v5/pkg/client"
"github.com/CoreumFoundation/coreum/v5/pkg/config"
"github.com/CoreumFoundation/faucet/pkg/logger"
)

Expand Down
34 changes: 26 additions & 8 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ import (
"strings"
"time"

sdkmath "cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/tx/signing"
"github.com/cosmos/cosmos-sdk/x/auth"
"github.com/pkg/errors"
"github.com/spf13/pflag"
"go.uber.org/zap"
Expand All @@ -23,10 +26,10 @@ import (
"google.golang.org/grpc/credentials/insecure"

"github.com/CoreumFoundation/coreum-tools/pkg/parallel"
"github.com/CoreumFoundation/coreum/v4/pkg/client"
coreumconfig "github.com/CoreumFoundation/coreum/v4/pkg/config"
"github.com/CoreumFoundation/coreum/v4/pkg/config/constant"
coreumkeyring "github.com/CoreumFoundation/coreum/v4/pkg/keyring"
"github.com/CoreumFoundation/coreum/v5/pkg/client"
coreumconfig "github.com/CoreumFoundation/coreum/v5/pkg/config"
"github.com/CoreumFoundation/coreum/v5/pkg/config/constant"
coreumkeyring "github.com/CoreumFoundation/coreum/v5/pkg/keyring"
"github.com/CoreumFoundation/faucet/app"
"github.com/CoreumFoundation/faucet/client/coreum"
"github.com/CoreumFoundation/faucet/http"
Expand Down Expand Up @@ -73,15 +76,15 @@ func main() {

network.SetSDKConfig()

clientCtx := client.NewContext(client.DefaultContextConfig(), config.NewModuleManager()).
clientCtx := client.NewContext(client.DefaultContextConfig(), auth.AppModuleBasic{}).
WithChainID(string(network.ChainID())).
WithBroadcastMode(flags.BroadcastSync).
WithAwaitTx(true)

clientCtx = addClient(cfg, log, clientCtx)

transferAmount := sdk.Coin{
Amount: sdk.NewInt(cfg.transferAmount),
Amount: sdkmath.NewInt(cfg.transferAmount),
Denom: network.Denom(),
}

Expand Down Expand Up @@ -147,9 +150,20 @@ func addClient(cfg cfg, log *zap.Logger, clientCtx client.Context) client.Contex
)
}

encodingConfig := coreumconfig.NewEncodingConfig(auth.AppModuleBasic{})

pc, ok := encodingConfig.Codec.(codec.GRPCCodecProvider)
if !ok {
panic("failed to cast codec to codec.GRPCCodecProvider")
}

// tls grpc
if nodeURL.Scheme == "https" {
grpcClient, err := grpc.Dial(nodeURL.Host, grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})))
grpcClient, err := grpc.NewClient(
nodeURL.Host,
grpc.WithDefaultCallOptions(grpc.ForceCodec(pc.GRPCCodec())),
grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})),
)
if err != nil {
panic(err)
}
Expand All @@ -163,7 +177,11 @@ func addClient(cfg cfg, log *zap.Logger, clientCtx client.Context) client.Contex
if host == "" {
host = cfg.node
}
grpcClient, err := grpc.Dial(host, grpc.WithTransportCredentials(insecure.NewCredentials()))
grpcClient, err := grpc.NewClient(
host,
grpc.WithDefaultCallOptions(grpc.ForceCodec(pc.GRPCCodec())),
grpc.WithTransportCredentials(insecure.NewCredentials()),
)
if err != nil {
log.Fatal(
"Unable to create cosmos grpc client",
Expand Down
Loading