Skip to content

Commit

Permalink
nmt support
Browse files Browse the repository at this point in the history
  • Loading branch information
bianyuanop committed Feb 19, 2024
1 parent a2b7fdd commit e2f594b
Show file tree
Hide file tree
Showing 15 changed files with 178 additions and 127 deletions.
4 changes: 4 additions & 0 deletions actions/burn_asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,7 @@ func (*BurnAsset) ValidRange(chain.Rules) (int64, int64) {
// Returning -1, -1 means that the action is always valid.
return -1, -1
}

func (*BurnAsset) NMTNamespace() []byte {
return DefaultNMTNamespace
}
2 changes: 2 additions & 0 deletions actions/consts.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,5 @@ const (
MaxMetadataSize = 256
MaxDecimals = 9
)

var DefaultNMTNamespace = make([]byte, 8)
4 changes: 4 additions & 0 deletions actions/create_asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,7 @@ func (*CreateAsset) ValidRange(chain.Rules) (int64, int64) {
// Returning -1, -1 means that the action is always valid.
return -1, -1
}

func (*CreateAsset) NMTNamespace() []byte {
return DefaultNMTNamespace
}
4 changes: 4 additions & 0 deletions actions/export_asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,3 +286,7 @@ func (*ExportAsset) ValidRange(chain.Rules) (int64, int64) {
// Returning -1, -1 means that the action is always valid.
return -1, -1
}

func (*ExportAsset) NMTNamespace() []byte {
return DefaultNMTNamespace
}
4 changes: 4 additions & 0 deletions actions/export_block_msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,7 @@ func (*ExportBlockMsg) ValidRange(chain.Rules) (int64, int64) {
// Returning -1, -1 means that the action is always valid.
return -1, -1
}

func (*ExportBlockMsg) NMTNamespace() []byte {
return DefaultNMTNamespace
}
4 changes: 4 additions & 0 deletions actions/import_asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -294,3 +294,7 @@ func (*ImportAsset) ValidRange(chain.Rules) (int64, int64) {
// Returning -1, -1 means that the action is always valid.
return -1, -1
}

func (*ImportAsset) NMTNamespace() []byte {
return DefaultNMTNamespace
}
4 changes: 4 additions & 0 deletions actions/import_block_msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,3 +118,7 @@ func (*ImportBlockMsg) ValidRange(chain.Rules) (int64, int64) {
// Returning -1, -1 means that the action is always valid.
return -1, -1
}

func (*ImportBlockMsg) NMTNamespace() []byte {
return DefaultNMTNamespace
}
4 changes: 4 additions & 0 deletions actions/mint_asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,7 @@ func (*MintAsset) ValidRange(chain.Rules) (int64, int64) {
// Returning -1, -1 means that the action is always valid.
return -1, -1
}

func (*MintAsset) NMTNamespace() []byte {
return DefaultNMTNamespace
}
4 changes: 4 additions & 0 deletions actions/msg.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,7 @@ func (*SequencerMsg) ValidRange(chain.Rules) (int64, int64) {
// Returning -1, -1 means that the action is always valid.
return -1, -1
}

func (t *SequencerMsg) NMTNamespace() []byte {
return t.ChainId
}
4 changes: 4 additions & 0 deletions actions/transfer.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,7 @@ func (*Transfer) ValidRange(chain.Rules) (int64, int64) {
// Returning -1, -1 means that the action is always valid.
return -1, -1
}

func (*Transfer) NMTNamespace() []byte {
return DefaultNMTNamespace
}
14 changes: 13 additions & 1 deletion cmd/token-cli/cmd/chain.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,20 @@ var chainInfoCmd = &cobra.Command{
var watchChainCmd = &cobra.Command{
Use: "watch",
RunE: func(_ *cobra.Command, args []string) error {
pastBlocks, err := handler.Root().PromptBool("streaming from past blocks?")
if err != nil {
return err
}
var startBlock uint64
if pastBlocks {
startBlock, err = handler.Root().PromptUint64("start block")
if err != nil {
return err
}
}

var cli *trpc.JSONRPCClient
return handler.Root().WatchChain(hideTxs, func(uri string, networkID uint32, chainID ids.ID) (chain.Parser, error) {
return handler.Root().WatchChain(hideTxs, pastBlocks, startBlock, func(uri string, networkID uint32, chainID ids.ID) (chain.Parser, error) {
fmt.Println("Here is network Id: %d", networkID)
fmt.Println("Here is uri: %s", uri)

Expand Down
65 changes: 37 additions & 28 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
module github.com/AnomalyFi/nodekit-seq

go 1.20
go 1.21

toolchain go1.21.6

require (
github.com/AnomalyFi/hypersdk v0.9.2-0.20240113190421-be19653c0162
github.com/AnomalyFi/hypersdk v0.9.3
github.com/ava-labs/avalanche-network-runner v1.7.2
github.com/ava-labs/avalanchego v1.10.10
github.com/ethereum/go-ethereum v1.12.0
Expand All @@ -15,8 +17,8 @@ require (
github.com/tidwall/btree v1.5.0
github.com/wailsapp/wails/v2 v2.5.1
go.uber.org/zap v1.24.0
golang.org/x/exp v0.0.0-20230522175609-2e198f4a06a1
golang.org/x/net v0.10.0
golang.org/x/exp v0.0.0-20240110193028-0dcbfd608b1e
golang.org/x/net v0.17.0
)

require (
Expand All @@ -29,7 +31,8 @@ require (
github.com/bep/debounce v1.2.1 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcd/btcutil v1.1.3 // indirect
github.com/cenkalti/backoff/v4 v4.2.0 // indirect
github.com/celestiaorg/nmt v0.20.0 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/chzyer/readline v1.5.1 // indirect
github.com/cockroachdb/errors v1.9.1 // indirect
Expand All @@ -46,7 +49,7 @@ require (
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect
github.com/getsentry/sentry-go v0.18.0 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
Expand All @@ -57,14 +60,14 @@ require (
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/pprof v0.0.0-20230406165453-00490a63f317 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/google/uuid v1.3.1 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/rpc v1.2.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.15.2 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
github.com/hashicorp/go-bexpr v0.1.10 // indirect
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
Expand Down Expand Up @@ -108,7 +111,7 @@ require (
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/rivo/uniseg v0.4.4 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/rogpeppe/go-internal v1.10.0 // indirect
github.com/rs/cors v1.7.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/samber/lo v1.38.1 // indirect
Expand All @@ -120,7 +123,7 @@ require (
github.com/spf13/pflag v1.0.5 // indirect
github.com/spf13/viper v1.12.0 // indirect
github.com/status-im/keycard-go v0.2.0 // indirect
github.com/stretchr/testify v1.8.3 // indirect
github.com/stretchr/testify v1.8.4 // indirect
github.com/subosito/gotenv v1.3.0 // indirect
github.com/supranational/blst v0.3.11 // indirect
github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect
Expand All @@ -134,32 +137,38 @@ require (
github.com/wailsapp/mimetype v1.4.1 // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
github.com/yusufpapurcu/wmi v1.2.2 // indirect
go.opentelemetry.io/otel v1.11.2 // indirect
go.opentelemetry.io/otel/exporters/otlp/internal/retry v1.11.2 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.11.2 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.11.2 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.11.2 // indirect
go.opentelemetry.io/otel v1.22.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.22.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.22.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp v1.22.0 // indirect
go.opentelemetry.io/otel/exporters/zipkin v1.11.2 // indirect
go.opentelemetry.io/otel/sdk v1.11.2 // indirect
go.opentelemetry.io/otel/trace v1.11.2 // indirect
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
go.opentelemetry.io/otel/metric v1.22.0 // indirect
go.opentelemetry.io/otel/sdk v1.22.0 // indirect
go.opentelemetry.io/otel/trace v1.22.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/mock v0.2.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/sync v0.2.0 // indirect
golang.org/x/sys v0.8.0 // indirect
golang.org/x/term v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/crypto v0.14.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/sync v0.4.0 // indirect
golang.org/x/sys v0.16.0 // indirect
golang.org/x/term v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
gonum.org/v1/gonum v0.11.0 // indirect
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 // indirect
google.golang.org/grpc v1.56.0-dev // indirect
google.golang.org/protobuf v1.30.0 // indirect
google.golang.org/genproto v0.0.0-20231002182017-d307bd883b97 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20231002182017-d307bd883b97 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20231002182017-d307bd883b97 // indirect
google.golang.org/grpc v1.60.1 // indirect
google.golang.org/protobuf v1.32.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)

replace github.com/ava-labs/avalanchego => github.com/AnomalyFi/avalanchego v1.10.10-beta.2

replace github.com/ava-labs/coreth => github.com/AnomalyFi/coreth v0.12.5-rc.6.1
Loading

0 comments on commit e2f594b

Please sign in to comment.