Skip to content

Commit

Permalink
Update supernova to use latest gno version
Browse files Browse the repository at this point in the history
  • Loading branch information
zivkovicmilos committed May 9, 2024
1 parent 9191ab3 commit 3ba6f05
Show file tree
Hide file tree
Showing 24 changed files with 204 additions and 279 deletions.
7 changes: 6 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,5 +106,10 @@ func execMain(cfg *internal.Config) error {
}

// Create and run the pipeline
return internal.NewPipeline(cfg).Execute()
pipeline, err := internal.NewPipeline(cfg)
if err != nil {
return fmt.Errorf("unable to create pipeline, %w", err)
}

return pipeline.Execute()
}
64 changes: 36 additions & 28 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,42 @@ require (
)

require (
github.com/btcsuite/btcd v0.22.0-beta.0.20220111032746-97732e52810c // indirect
github.com/btcsuite/btcd/btcutil v1.1.1 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
github.com/cockroachdb/apd v1.1.0 // indirect
dario.cat/mergo v1.0.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.3 // indirect
github.com/cenkalti/backoff/v4 v4.3.0 // indirect
github.com/cockroachdb/apd/v3 v3.2.1 // indirect
github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.3.0 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect
github.com/rs/cors v1.10.1 // indirect
github.com/rs/xid v1.5.0 // indirect
github.com/zondax/hid v0.9.2 // indirect
github.com/zondax/ledger-go v0.14.3 // indirect
go.opentelemetry.io/otel v1.25.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlpmetric/otlpmetricgrpc v1.25.0 // indirect
go.opentelemetry.io/otel/metric v1.25.0 // indirect
go.opentelemetry.io/otel/sdk v1.25.0 // indirect
go.opentelemetry.io/otel/sdk/metric v1.25.0 // indirect
go.opentelemetry.io/otel/trace v1.25.0 // indirect
go.opentelemetry.io/proto/otlp v1.1.0 // indirect
golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect
google.golang.org/grpc v1.63.0 // indirect
)

require (
github.com/btcsuite/btcd/btcutil v1.1.5 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dgraph-io/badger/v3 v3.2103.4 // indirect
github.com/dgraph-io/ristretto v0.1.1 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/fsnotify/fsnotify v1.5.4 // indirect
github.com/gnolang/cors v1.8.1 // indirect
github.com/gnolang/gno v0.0.0-20230330135006-28c1984fb1cd
github.com/gnolang/gno v0.0.0-20240509142750-711f4d03a167
github.com/gnolang/overflow v0.0.0-20170615021017-4d914c927216 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.3 // indirect
github.com/google/flatbuffers v1.12.1 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
github.com/klauspost/compress v1.12.3 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/gorilla/websocket v1.5.1 // indirect
github.com/lib/pq v1.10.9 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/linxGnu/grocksdb v1.7.15 // indirect
Expand All @@ -42,15 +54,11 @@ require (
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/rivo/uniseg v0.4.7 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/syndtr/goleveldb v1.0.0 // indirect
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c // indirect
go.etcd.io/bbolt v1.3.7 // indirect
go.opencensus.io v0.24.0 // indirect
go.uber.org/multierr v1.10.0 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/net v0.22.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/tools v0.19.0 // indirect
Expand Down
268 changes: 82 additions & 186 deletions go.sum

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions internal/batcher/batcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"fmt"
"math"

"github.com/gnolang/gno/pkgs/amino"
core_types "github.com/gnolang/gno/pkgs/bft/rpc/core/types"
"github.com/gnolang/gno/pkgs/std"
"github.com/gnolang/gno/tm2/pkg/amino"
core_types "github.com/gnolang/gno/tm2/pkg/bft/rpc/core/types"
"github.com/gnolang/gno/tm2/pkg/std"
"github.com/gnolang/supernova/internal/common"
"github.com/schollz/progressbar/v3"
)
Expand Down
4 changes: 2 additions & 2 deletions internal/batcher/batcher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"fmt"
"testing"

core_types "github.com/gnolang/gno/pkgs/bft/rpc/core/types"
"github.com/gnolang/gno/pkgs/std"
core_types "github.com/gnolang/gno/tm2/pkg/bft/rpc/core/types"
"github.com/gnolang/gno/tm2/pkg/std"
"github.com/gnolang/supernova/internal/common"
"github.com/stretchr/testify/assert"
)
Expand Down
30 changes: 18 additions & 12 deletions internal/client/http_client.go
Original file line number Diff line number Diff line change
@@ -1,41 +1,47 @@
package client

import (
"context"
"fmt"

"github.com/gnolang/gno/gnoland"
"github.com/gnolang/gno/pkgs/amino"
"github.com/gnolang/gno/pkgs/bft/rpc/client"
core_types "github.com/gnolang/gno/pkgs/bft/rpc/core/types"
"github.com/gnolang/gno/pkgs/std"
"github.com/gnolang/gno/gno.land/pkg/gnoland"
"github.com/gnolang/gno/tm2/pkg/amino"
"github.com/gnolang/gno/tm2/pkg/bft/rpc/client"
core_types "github.com/gnolang/gno/tm2/pkg/bft/rpc/core/types"
"github.com/gnolang/gno/tm2/pkg/std"
"github.com/gnolang/supernova/internal/common"
)

type Batch struct {
batch *client.BatchHTTP
batch *client.RPCBatch
}

func (b *Batch) AddTxBroadcast(tx []byte) error {
if _, err := b.batch.BroadcastTxSync(tx); err != nil {
if err := b.batch.BroadcastTxSync(tx); err != nil {
return fmt.Errorf("unable to prepare transaction, %w", err)
}

return nil
}

func (b *Batch) Execute() ([]interface{}, error) {
return b.batch.Send()
return b.batch.Send(context.Background())
}

type HTTPClient struct {
conn *client.HTTP
conn *client.RPCClient
}

// NewHTTPClient creates a new instance of the HTTP client
func NewHTTPClient(url string) *HTTPClient {
return &HTTPClient{
conn: client.NewHTTP(url, ""),
func NewHTTPClient(url string) (*HTTPClient, error) {
cli, err := client.NewHTTPClient(url)
if err != nil {
return nil, fmt.Errorf("unable to create http client, %w", err)
}

return &HTTPClient{
conn: cli,
}, nil
}

func (h *HTTPClient) CreateBatch() common.Batch {
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/collector.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"math"
"time"

"github.com/gnolang/gno/pkgs/bft/types"
"github.com/gnolang/gno/tm2/pkg/bft/types"
"github.com/schollz/progressbar/v3"
)

Expand Down
6 changes: 3 additions & 3 deletions internal/collector/collector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"testing"
"time"

core_types "github.com/gnolang/gno/pkgs/bft/rpc/core/types"
"github.com/gnolang/gno/pkgs/bft/types"
"github.com/gnolang/gno/pkgs/crypto/tmhash"
core_types "github.com/gnolang/gno/tm2/pkg/bft/rpc/core/types"
"github.com/gnolang/gno/tm2/pkg/bft/types"
"github.com/gnolang/gno/tm2/pkg/crypto/tmhash"
"github.com/stretchr/testify/assert"
)

Expand Down
2 changes: 1 addition & 1 deletion internal/collector/mock_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package collector

import core_types "github.com/gnolang/gno/pkgs/bft/rpc/core/types"
import core_types "github.com/gnolang/gno/tm2/pkg/bft/rpc/core/types"

type (
getBlockDelegate func(height *int64) (*core_types.ResultBlock, error)
Expand Down
2 changes: 1 addition & 1 deletion internal/collector/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package collector
import (
"time"

core_types "github.com/gnolang/gno/pkgs/bft/rpc/core/types"
core_types "github.com/gnolang/gno/tm2/pkg/bft/rpc/core/types"
)

type Client interface {
Expand Down
2 changes: 1 addition & 1 deletion internal/common/common.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package common

import "github.com/gnolang/gno/pkgs/std"
import "github.com/gnolang/gno/tm2/pkg/std"

const (
Denomination = "ugnot"
Expand Down
2 changes: 1 addition & 1 deletion internal/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"errors"
"regexp"

"github.com/gnolang/gno/pkgs/crypto/bip39"
"github.com/gnolang/gno/tm2/pkg/crypto/bip39"
"github.com/gnolang/supernova/internal/runtime"
)

Expand Down
10 changes: 5 additions & 5 deletions internal/distributor/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ import (
"fmt"
"sort"

"github.com/gnolang/gno/gnoland"
"github.com/gnolang/gno/pkgs/crypto"
"github.com/gnolang/gno/pkgs/crypto/keys"
"github.com/gnolang/gno/pkgs/sdk/bank"
"github.com/gnolang/gno/pkgs/std"
"github.com/gnolang/gno/gno.land/pkg/gnoland"
"github.com/gnolang/gno/tm2/pkg/crypto"
"github.com/gnolang/gno/tm2/pkg/crypto/keys"
"github.com/gnolang/gno/tm2/pkg/sdk/bank"
"github.com/gnolang/gno/tm2/pkg/std"
"github.com/gnolang/supernova/internal/common"
"github.com/schollz/progressbar/v3"
)
Expand Down
10 changes: 5 additions & 5 deletions internal/distributor/distributor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"fmt"
"testing"

"github.com/gnolang/gno/gnoland"
"github.com/gnolang/gno/pkgs/crypto/bip39"
"github.com/gnolang/gno/pkgs/crypto/keys"
"github.com/gnolang/gno/pkgs/sdk/bank"
"github.com/gnolang/gno/pkgs/std"
"github.com/gnolang/gno/gno.land/pkg/gnoland"
"github.com/gnolang/gno/tm2/pkg/crypto/bip39"
"github.com/gnolang/gno/tm2/pkg/crypto/keys"
"github.com/gnolang/gno/tm2/pkg/sdk/bank"
"github.com/gnolang/gno/tm2/pkg/std"
"github.com/gnolang/supernova/internal/common"
"github.com/stretchr/testify/assert"
)
Expand Down
4 changes: 2 additions & 2 deletions internal/distributor/mock_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package distributor

import (
"github.com/gnolang/gno/gnoland"
"github.com/gnolang/gno/pkgs/std"
"github.com/gnolang/gno/gno.land/pkg/gnoland"
"github.com/gnolang/gno/tm2/pkg/std"
)

type (
Expand Down
13 changes: 9 additions & 4 deletions internal/pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/gnolang/gno/pkgs/crypto/keys"
"github.com/gnolang/gno/tm2/pkg/crypto/keys"
"github.com/gnolang/supernova/internal/batcher"
"github.com/gnolang/supernova/internal/client"
"github.com/gnolang/supernova/internal/collector"
Expand Down Expand Up @@ -36,15 +36,20 @@ type Pipeline struct {
}

// NewPipeline creates a new pipeline instance
func NewPipeline(cfg *Config) *Pipeline {
func NewPipeline(cfg *Config) (*Pipeline, error) {
kb := keys.NewInMemory()

cli, err := client.NewHTTPClient(cfg.URL)
if err != nil {
return nil, fmt.Errorf("unable to create HTTP client, %w", err)
}

return &Pipeline{
cfg: cfg,
keybase: kb,
cli: client.NewHTTPClient(cfg.URL),
cli: cli,
signer: signer.NewKeybaseSigner(kb, cfg.ChainID),
}
}, nil
}

// Execute runs the entire pipeline process
Expand Down
8 changes: 4 additions & 4 deletions internal/runtime/common_deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"path/filepath"
"time"

"github.com/gnolang/gno/gnoland"
"github.com/gnolang/gno/pkgs/gnolang"
"github.com/gnolang/gno/pkgs/sdk/vm"
"github.com/gnolang/gno/pkgs/std"
"github.com/gnolang/gno/gno.land/pkg/gnoland"
"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
"github.com/gnolang/gno/gnovm/pkg/gnolang"
"github.com/gnolang/gno/tm2/pkg/std"
)

type commonDeployment struct {
Expand Down
4 changes: 2 additions & 2 deletions internal/runtime/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package runtime
import (
"fmt"

"github.com/gnolang/gno/gnoland"
"github.com/gnolang/gno/pkgs/std"
"github.com/gnolang/gno/gno.land/pkg/gnoland"
"github.com/gnolang/gno/tm2/pkg/std"
"github.com/gnolang/supernova/internal/common"
"github.com/schollz/progressbar/v3"
)
Expand Down
6 changes: 3 additions & 3 deletions internal/runtime/helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ package runtime
import (
"testing"

"github.com/gnolang/gno/gnoland"
"github.com/gnolang/gno/pkgs/sdk/vm"
"github.com/gnolang/gno/pkgs/std"
"github.com/gnolang/gno/gno.land/pkg/gnoland"
"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
"github.com/gnolang/gno/tm2/pkg/std"
"github.com/stretchr/testify/assert"
)

Expand Down
4 changes: 2 additions & 2 deletions internal/runtime/mock_test.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package runtime

import (
"github.com/gnolang/gno/gnoland"
"github.com/gnolang/gno/pkgs/std"
"github.com/gnolang/gno/gno.land/pkg/gnoland"
"github.com/gnolang/gno/tm2/pkg/std"
)

type signTxDelegate func(*std.Tx, *gnoland.GnoAccount, uint64, string) error
Expand Down
8 changes: 4 additions & 4 deletions internal/runtime/realm_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"path/filepath"
"time"

"github.com/gnolang/gno/gnoland"
"github.com/gnolang/gno/pkgs/gnolang"
"github.com/gnolang/gno/pkgs/sdk/vm"
"github.com/gnolang/gno/pkgs/std"
"github.com/gnolang/gno/gno.land/pkg/gnoland"
"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
"github.com/gnolang/gno/gnovm/pkg/gnolang"
"github.com/gnolang/gno/tm2/pkg/std"
"github.com/gnolang/supernova/internal/common"
)

Expand Down
4 changes: 2 additions & 2 deletions internal/runtime/runtime.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package runtime

import (
"github.com/gnolang/gno/gnoland"
"github.com/gnolang/gno/pkgs/std"
"github.com/gnolang/gno/gno.land/pkg/gnoland"
"github.com/gnolang/gno/tm2/pkg/std"
"github.com/gnolang/supernova/internal/common"
)

Expand Down
4 changes: 2 additions & 2 deletions internal/runtime/runtime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"runtime"
"testing"

"github.com/gnolang/gno/pkgs/sdk/vm"
"github.com/gnolang/gno/pkgs/std"
"github.com/gnolang/gno/gno.land/pkg/sdk/vm"
"github.com/gnolang/gno/tm2/pkg/std"
"github.com/stretchr/testify/assert"
)

Expand Down
Loading

0 comments on commit 3ba6f05

Please sign in to comment.