Skip to content

Commit

Permalink
Merge pull request #1077 from maticnetwork/v1.0.2-candidate
Browse files Browse the repository at this point in the history
V1.0.2 release candidate
  • Loading branch information
marcello33 authored Oct 5, 2023
2 parents fe19017 + 934347c commit e3af686
Show file tree
Hide file tree
Showing 12 changed files with 1,099 additions and 128 deletions.
52 changes: 46 additions & 6 deletions checkpoint/client/rest/query_milestone.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
jsoniter "github.com/json-iterator/go"

"github.com/maticnetwork/heimdall/checkpoint/types"
"github.com/maticnetwork/heimdall/helper"
hmRest "github.com/maticnetwork/heimdall/types/rest"
)

Expand All @@ -29,8 +30,16 @@ func milestoneLatestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
return
}

// fetch checkpoint
// Fetch latest milestone
result, height, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryLatestMilestone), nil)

// Return status code 503 (Service Unavailable) if HF hasn't been activated
if height < helper.GetAalborgHardForkHeight() {
hmRest.WriteErrorResponse(w, http.StatusServiceUnavailable, "Aalborg hardfork not activated yet")

return
}

if err != nil {
hmRest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())

Expand All @@ -43,11 +52,11 @@ func milestoneLatestHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
}
}

// swagger:route GET /checkpoints/count checkpoint checkpointCount
// It returns the checkpoint counts
// swagger:route GET /milestone/count milestone milestoneCount
// It returns the milestone count
// responses:
//
// 200: checkpointCountResponse
// 200: milestoneCountResponse
func milestoneCountHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
return func(w http.ResponseWriter, r *http.Request) {
cliCtx, ok := rest.ParseQueryHeightOrReturnBadRequest(w, cliCtx, r)
Expand All @@ -56,6 +65,14 @@ func milestoneCountHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
}

countBytes, height, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryCount), nil)

// Return status code 503 (Service Unavailable) if HF hasn't been activated
if height < helper.GetAalborgHardForkHeight() {
hmRest.WriteErrorResponse(w, http.StatusServiceUnavailable, "Aalborg hardfork not activated yet")

return
}

if err != nil {
hmRest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
return
Expand Down Expand Up @@ -106,8 +123,16 @@ func milestoneByNumberHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
return
}

// query checkpoint
// query milestone
res, height, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryMilestoneByNumber), queryParams)

// Return status code 503 (Service Unavailable) if HF hasn't been activated
if height < helper.GetAalborgHardForkHeight() {
hmRest.WriteErrorResponse(w, http.StatusServiceUnavailable, "Aalborg hardfork not activated yet")

return
}

if err != nil {
hmRest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
return
Expand All @@ -126,8 +151,15 @@ func latestNoAckMilestoneHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
return
}

// fetch checkpoint
result, height, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryLatestNoAckMilestone), nil)

// Return status code 503 (Service Unavailable) if HF hasn't been activated
if height < helper.GetAalborgHardForkHeight() {
hmRest.WriteErrorResponse(w, http.StatusServiceUnavailable, "Aalborg hardfork not activated yet")

return
}

if err != nil {
hmRest.WriteErrorResponse(w, http.StatusInternalServerError, err.Error())
return
Expand Down Expand Up @@ -176,6 +208,14 @@ func noAckMilestoneByIDHandlerFn(cliCtx context.CLIContext) http.HandlerFunc {
}

result, height, err := cliCtx.QueryWithData(fmt.Sprintf("custom/%s/%s", types.QuerierRoute, types.QueryNoAckMilestoneByID), queryID)

// Return status code 503 (Service Unavailable) if HF hasn't been activated
if height < helper.GetAalborgHardForkHeight() {
hmRest.WriteErrorResponse(w, http.StatusServiceUnavailable, "Aalborg hardfork not activated yet")

return
}

if err != nil {
hmRest.WriteErrorResponse(w, http.StatusBadRequest, err.Error())
return
Expand Down
106 changes: 58 additions & 48 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module github.com/maticnetwork/heimdall

go 1.20
go 1.21

require (
github.com/RichardKnop/machinery v1.7.4
github.com/cbergoon/merkletree v0.2.0
github.com/cosmos/cosmos-sdk v0.46.2
github.com/cosmos/cosmos-sdk v0.47.3
github.com/ethereum/go-ethereum v1.10.26
github.com/go-kit/kit v0.10.0
github.com/go-kit/log v0.2.1
github.com/gogo/protobuf v1.3.2
github.com/golang/mock v1.6.0
github.com/google/uuid v1.3.0
Expand All @@ -21,73 +21,82 @@ require (
github.com/rakyll/statik v0.1.7
github.com/spf13/cobra v1.5.0
github.com/spf13/viper v1.13.0
github.com/streadway/amqp v0.0.0-20200108173154-1c71cc93ed71
github.com/stretchr/testify v1.8.1
github.com/streadway/amqp v1.0.0
github.com/stretchr/testify v1.8.4
github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7
github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15
github.com/tendermint/go-amino v0.15.0
github.com/tendermint/tendermint v0.32.10
github.com/tendermint/tm-db v0.2.0
golang.org/x/sync v0.1.0
google.golang.org/grpc v1.53.0
google.golang.org/protobuf v1.28.1
github.com/tendermint/go-amino v0.16.0
github.com/tendermint/tendermint v0.34.21
github.com/tendermint/tm-db v0.6.7
golang.org/x/sync v0.3.0
google.golang.org/grpc v1.58.2
google.golang.org/protobuf v1.31.0
)

require (
cloud.google.com/go/compute v1.15.1 // indirect
cloud.google.com/go/compute v1.21.0 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
cloud.google.com/go/iam v0.8.0 // indirect
cloud.google.com/go/iam v1.1.1 // indirect
github.com/BurntSushi/toml v1.2.0 // indirect
github.com/JekaMas/workerpool v1.1.8 // indirect
github.com/btcsuite/btcd v0.22.3 // indirect
github.com/cenkalti/backoff/v4 v4.1.1 // indirect
github.com/cenkalti/backoff/v4 v4.2.1 // indirect
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
github.com/etcd-io/bbolt v1.3.3 // indirect
github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c // indirect
github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 // indirect
github.com/gammazero/deque v0.2.1 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/go-kit/kit v0.12.0 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/google/s2a-go v0.1.4 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.3 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c // indirect
github.com/pelletier/go-toml/v2 v2.0.5 // indirect
github.com/stumble/gorocksdb v0.0.3 // indirect
github.com/subosito/gotenv v1.4.1 // indirect
github.com/xdg-go/pbkdf2 v1.0.0 // indirect
github.com/xdg-go/scram v1.0.2 // indirect
github.com/xdg-go/stringprep v1.0.2 // indirect
github.com/youmark/pkcs8 v0.0.0-20181117223130-1be2e3e5546d // indirect
go.opentelemetry.io/proto/otlp v0.10.0 // indirect
github.com/zondax/ledger-go v0.14.1 // indirect
go.opentelemetry.io/otel/metric v1.19.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230711160842-782d3b101e98 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230711160842-782d3b101e98 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)

require (
cloud.google.com/go v0.107.0 // indirect
cloud.google.com/go/pubsub v1.27.1 // indirect
cloud.google.com/go v0.110.4 // indirect
cloud.google.com/go/pubsub v1.32.0 // indirect
github.com/RichardKnop/logging v0.0.0-20190827224416-1a693bdd4fae // indirect
github.com/RichardKnop/redsync v1.2.0 // indirect
github.com/StackExchange/wmi v0.0.0-20210224194228-fe8f1750fd46 // indirect
github.com/aws/aws-sdk-go v1.34.28 // indirect
github.com/aws/aws-sdk-go v1.40.45 // indirect
github.com/bartekn/go-bip39 v0.0.0-20171116152956-a05967ea095d // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/bgentry/speakeasy v0.1.0 // indirect
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b // indirect
github.com/btcsuite/btcd/btcec/v2 v2.2.0 // indirect
github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect
github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/cosmos/go-bip39 v0.0.0-20180618194314-52158e4697b8 // indirect
github.com/cosmos/ledger-cosmos-go v0.10.3 // indirect
github.com/cosmos/ledger-go v0.9.2 // indirect
github.com/cosmos/go-bip39 v1.0.0 // indirect
github.com/cosmos/ledger-cosmos-go v0.13.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1 // indirect
github.com/etcd-io/bbolt v1.3.3 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/go-logfmt/logfmt v0.5.1 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-redis/redis v6.15.7+incompatible // indirect
github.com/go-stack/stack v1.8.1 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect
github.com/gomodule/redigo v2.0.0+incompatible // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
github.com/googleapis/gax-go/v2 v2.11.0 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
Expand All @@ -97,7 +106,7 @@ require (
github.com/klauspost/compress v1.15.15 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/magiconair/properties v1.8.6 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
Expand All @@ -107,45 +116,46 @@ require (
github.com/pelletier/go-toml v1.9.5 // indirect
github.com/peterh/liner v1.2.0 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/client_model v0.4.0 // indirect
github.com/prometheus/common v0.39.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect
github.com/rs/cors v1.7.0 // indirect
github.com/rs/cors v1.8.2 // indirect
github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect
github.com/spf13/afero v1.8.2 // indirect
github.com/spf13/afero v1.9.2 // indirect
github.com/spf13/cast v1.5.0 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/spf13/pflag v1.0.5 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/stumble/gorocksdb v0.0.3 // indirect
github.com/tendermint/btcd v0.1.1 // indirect
github.com/tendermint/iavl v0.12.4 // indirect
github.com/tklauser/go-sysconf v0.3.10 // indirect
github.com/tklauser/numcpus v0.4.0 // indirect
github.com/zondax/hid v0.9.0 // indirect
github.com/zondax/hid v0.9.1 // indirect
go.mongodb.org/mongo-driver v1.3.0 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/otel v1.2.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.2.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.2.0
go.opentelemetry.io/otel/sdk v1.2.0
go.opentelemetry.io/otel/trace v1.2.0
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/net v0.8.0 // indirect
golang.org/x/oauth2 v0.4.0 // indirect
golang.org/x/sys v0.6.0 // indirect
golang.org/x/text v0.8.0 // indirect
google.golang.org/api v0.103.0 // indirect
go.opentelemetry.io/otel v1.19.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.19.0
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0
go.opentelemetry.io/otel/sdk v1.19.0
go.opentelemetry.io/otel/trace v1.19.0
golang.org/x/crypto v0.11.0 // indirect
golang.org/x/net v0.12.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/text v0.11.0 // indirect
google.golang.org/api v0.126.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
google.golang.org/genproto v0.0.0-20230711160842-782d3b101e98 // indirect
gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect
gopkg.in/yaml.v3 v3.0.1
)

replace github.com/tendermint/tendermint => github.com/maticnetwork/tendermint v0.26.0-dev0.0.20230831062110-a7e9709ba003
replace github.com/tendermint/tendermint => github.com/maticnetwork/tendermint v0.26.0-dev0.0.20231005133805-2bb6a831bb2e

replace github.com/tendermint/tm-db => github.com/tendermint/tm-db v0.2.0

replace github.com/cosmos/cosmos-sdk => github.com/maticnetwork/cosmos-sdk v0.37.5-0.20230724090011-a85aaf468bfd
replace github.com/cosmos/cosmos-sdk => github.com/maticnetwork/cosmos-sdk v0.37.5-0.20231005133937-b1eb1f90feb7

replace github.com/ethereum/go-ethereum => github.com/maticnetwork/bor v1.0.4

Expand Down
Loading

0 comments on commit e3af686

Please sign in to comment.