Skip to content

Commit

Permalink
Merge pull request #1224 from iotaledger/develop
Browse files Browse the repository at this point in the history
Merge v0.5.7 into master
  • Loading branch information
capossele authored Apr 23, 2021
2 parents 08e9924 + cdf2d0e commit 400e1bf
Show file tree
Hide file tree
Showing 176 changed files with 9,576 additions and 2,365 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/reviewdog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@ jobs:
with:
go-version: "^1.16.2"

- uses: actions/setup-go@v2
with:
go-version: "^1.16.2"

- name: Run golangci-lint # reviewdog v1.19.0, golangci-lint v1.38.0
uses: reviewdog/action-golangci-lint@93be4324306dcbba508544d891a7b0576bb28ddd
- name: Run golangci-lint
uses: reviewdog/action-golangci-lint@c9fac889cce0d374dc2700eb2bd28987d443fdf9
with:
github_token: ${{ secrets.github_token }}
golangci_lint_flags: "--timeout=10m"
Expand Down
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
# v0.5.7 - 2021-04-23
* Add approval weight manager (soft launch)
* Add epochs
* Add debug APIs for epochs
* Update local dashboard to show finalization based on approval weight
* Improve FPC
* Improve markers manager
* Improve integration tests
* Improve payload unmarshaling
* Remove unless-stopped option from Docker default config
* Increase CfgGossipAgeThreshold parameter
* Fix several bugs on hive.go
* Fix mana event storage pruning
* Fix mana leaderboard and explorer live feed scroll view
* Update snapshot with initial mana state
* Update to latest hive.go
* **Breaking**: bumps network and database versions

# v0.5.6 - 2021-04-03
* Fix childBranchType
* Fix FPC empty round increase
Expand Down
6 changes: 3 additions & 3 deletions client/autopeering.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"net/http"

webapi_autopeering "github.com/iotaledger/goshimmer/plugins/webapi/autopeering"
"github.com/iotaledger/goshimmer/plugins/webapi/jsonmodels"
)

const (
Expand All @@ -13,8 +13,8 @@ const (

// GetNeighbors gets the chosen/accepted neighbors.
// If knownPeers is set, also all known peers to the node are returned additionally.
func (api *GoShimmerAPI) GetNeighbors(knownPeers bool) (*webapi_autopeering.Response, error) {
res := &webapi_autopeering.Response{}
func (api *GoShimmerAPI) GetNeighbors(knownPeers bool) (*jsonmodels.GetNeighborsResponse, error) {
res := &jsonmodels.GetNeighborsResponse{}
if err := api.do(http.MethodGet, func() string {
if !knownPeers {
return routeGetNeighbors
Expand Down
6 changes: 3 additions & 3 deletions client/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package client
import (
"net/http"

webapi_data "github.com/iotaledger/goshimmer/plugins/webapi/data"
"github.com/iotaledger/goshimmer/plugins/webapi/jsonmodels"
)

const (
Expand All @@ -12,9 +12,9 @@ const (

// Data sends the given data (payload) by creating a message in the backend.
func (api *GoShimmerAPI) Data(data []byte) (string, error) {
res := &webapi_data.Response{}
res := &jsonmodels.DataResponse{}
if err := api.do(http.MethodPost, routeData,
&webapi_data.Request{Data: data}, res); err != nil {
&jsonmodels.DataRequest{Data: data}, res); err != nil {
return "", err
}

Expand Down
14 changes: 7 additions & 7 deletions client/drng.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package client
import (
"net/http"

webapi_drng "github.com/iotaledger/goshimmer/plugins/webapi/drng"
"github.com/iotaledger/goshimmer/plugins/webapi/jsonmodels"
)

const (
Expand All @@ -14,18 +14,18 @@ const (

// BroadcastCollectiveBeacon sends the given collective beacon (payload) by creating a message in the backend.
func (api *GoShimmerAPI) BroadcastCollectiveBeacon(payload []byte) (string, error) {
res := &webapi_drng.CollectiveBeaconResponse{}
res := &jsonmodels.CollectiveBeaconResponse{}
if err := api.do(http.MethodPost, routeCollectiveBeacon,
&webapi_drng.CollectiveBeaconRequest{Payload: payload}, res); err != nil {
&jsonmodels.CollectiveBeaconRequest{Payload: payload}, res); err != nil {
return "", err
}

return res.ID, nil
}

// GetRandomness gets the current randomness.
func (api *GoShimmerAPI) GetRandomness() (*webapi_drng.RandomnessResponse, error) {
res := &webapi_drng.RandomnessResponse{}
func (api *GoShimmerAPI) GetRandomness() (*jsonmodels.RandomnessResponse, error) {
res := &jsonmodels.RandomnessResponse{}
if err := api.do(http.MethodGet, func() string {
return routeRandomness
}(), nil, res); err != nil {
Expand All @@ -35,8 +35,8 @@ func (api *GoShimmerAPI) GetRandomness() (*webapi_drng.RandomnessResponse, error
}

// GetCommittee gets the current committee.
func (api *GoShimmerAPI) GetCommittee() (*webapi_drng.CommitteeResponse, error) {
res := &webapi_drng.CommitteeResponse{}
func (api *GoShimmerAPI) GetCommittee() (*jsonmodels.CommitteeResponse, error) {
res := &jsonmodels.CommitteeResponse{}
if err := api.do(http.MethodGet, func() string {
return routeCommittee
}(), nil, res); err != nil {
Expand Down
8 changes: 4 additions & 4 deletions client/faucet.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,18 @@ package client
import (
"net/http"

webapi_faucet "github.com/iotaledger/goshimmer/plugins/webapi/faucet"
"github.com/iotaledger/goshimmer/plugins/webapi/jsonmodels"
)

const (
routeFaucet = "faucet"
)

// SendFaucetRequest requests funds from faucet nodes by sending a faucet request payload message.
func (api *GoShimmerAPI) SendFaucetRequest(base58EncodedAddr string) (*webapi_faucet.Response, error) {
res := &webapi_faucet.Response{}
func (api *GoShimmerAPI) SendFaucetRequest(base58EncodedAddr string) (*jsonmodels.FaucetResponse, error) {
res := &jsonmodels.FaucetResponse{}
if err := api.do(http.MethodPost, routeFaucet,
&webapi_faucet.Request{Address: base58EncodedAddr}, res); err != nil {
&jsonmodels.FaucetRequest{Address: base58EncodedAddr}, res); err != nil {
return nil, err
}

Expand Down
6 changes: 3 additions & 3 deletions client/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,16 @@ package client
import (
"net/http"

webapi_info "github.com/iotaledger/goshimmer/plugins/webapi/info"
"github.com/iotaledger/goshimmer/plugins/webapi/jsonmodels"
)

const (
routeInfo = "info"
)

// Info gets the info of the node.
func (api *GoShimmerAPI) Info() (*webapi_info.Response, error) {
res := &webapi_info.Response{}
func (api *GoShimmerAPI) Info() (*jsonmodels.InfoResponse, error) {
res := &jsonmodels.InfoResponse{}
if err := api.do(http.MethodGet, routeInfo, nil, res); err != nil {
return nil, err
}
Expand Down
68 changes: 34 additions & 34 deletions client/mana.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"net/http"

webapi_mana "github.com/iotaledger/goshimmer/plugins/webapi/mana"
"github.com/iotaledger/goshimmer/plugins/webapi/jsonmodels"
)

const (
Expand All @@ -21,35 +21,35 @@ const (
)

// GetOwnMana returns the access and consensus mana of the node this api client is communicating with.
func (api *GoShimmerAPI) GetOwnMana() (*webapi_mana.GetManaResponse, error) {
res := &webapi_mana.GetManaResponse{}
func (api *GoShimmerAPI) GetOwnMana() (*jsonmodels.GetManaResponse, error) {
res := &jsonmodels.GetManaResponse{}
if err := api.do(http.MethodGet, routeGetMana,
&webapi_mana.GetManaRequest{NodeID: ""}, res); err != nil {
&jsonmodels.GetManaRequest{NodeID: ""}, res); err != nil {
return nil, err
}
return res, nil
}

// GetManaFullNodeID returns the access and consensus mana of the node specified in the argument.
// Note, that for the node to understand which nodeID we are referring to, short node ID is not sufficient.
func (api *GoShimmerAPI) GetManaFullNodeID(fullNodeID string) (*webapi_mana.GetManaResponse, error) {
res := &webapi_mana.GetManaResponse{}
func (api *GoShimmerAPI) GetManaFullNodeID(fullNodeID string) (*jsonmodels.GetManaResponse, error) {
res := &jsonmodels.GetManaResponse{}
if err := api.do(http.MethodGet, routeGetMana,
&webapi_mana.GetManaRequest{NodeID: fullNodeID}, res); err != nil {
&jsonmodels.GetManaRequest{NodeID: fullNodeID}, res); err != nil {
return nil, err
}
return res, nil
}

// GetMana returns the access and consensus mana a node has based on its shortNodeID.
func (api *GoShimmerAPI) GetMana(shortNodeID string) (*webapi_mana.GetManaResponse, error) {
func (api *GoShimmerAPI) GetMana(shortNodeID string) (*jsonmodels.GetManaResponse, error) {
// ask the node about the full mana map and filter out based on shortID
allManaRes := &webapi_mana.GetAllManaResponse{}
allManaRes := &jsonmodels.GetAllManaResponse{}
if err := api.do(http.MethodGet, routeGetAllMana,
nil, allManaRes); err != nil {
return nil, err
}
res := &webapi_mana.GetManaResponse{ShortNodeID: shortNodeID}
res := &jsonmodels.GetManaResponse{ShortNodeID: shortNodeID}
// look for node's mana values in the map
for _, nodeStr := range allManaRes.Access {
if nodeStr.ShortNodeID == shortNodeID {
Expand All @@ -67,8 +67,8 @@ func (api *GoShimmerAPI) GetMana(shortNodeID string) (*webapi_mana.GetManaRespon
}

// GetAllMana returns the mana perception of the node in the network.
func (api *GoShimmerAPI) GetAllMana() (*webapi_mana.GetAllManaResponse, error) {
res := &webapi_mana.GetAllManaResponse{}
func (api *GoShimmerAPI) GetAllMana() (*jsonmodels.GetAllManaResponse, error) {
res := &jsonmodels.GetAllManaResponse{}
if err := api.do(http.MethodGet, routeGetAllMana,
nil, res); err != nil {
return nil, err
Expand All @@ -77,18 +77,18 @@ func (api *GoShimmerAPI) GetAllMana() (*webapi_mana.GetAllManaResponse, error) {
}

// GetManaPercentile returns the mana percentile for access and consensus mana of a node.
func (api *GoShimmerAPI) GetManaPercentile(fullNodeID string) (*webapi_mana.GetPercentileResponse, error) {
res := &webapi_mana.GetPercentileResponse{}
func (api *GoShimmerAPI) GetManaPercentile(fullNodeID string) (*jsonmodels.GetPercentileResponse, error) {
res := &jsonmodels.GetPercentileResponse{}
if err := api.do(http.MethodGet, routeGetManaPercentile,
&webapi_mana.GetPercentileRequest{NodeID: fullNodeID}, res); err != nil {
&jsonmodels.GetPercentileRequest{NodeID: fullNodeID}, res); err != nil {
return nil, err
}
return res, nil
}

// GetOnlineAccessMana returns the sorted list of online access mana of nodes.
func (api *GoShimmerAPI) GetOnlineAccessMana() (*webapi_mana.GetOnlineResponse, error) {
res := &webapi_mana.GetOnlineResponse{}
func (api *GoShimmerAPI) GetOnlineAccessMana() (*jsonmodels.GetOnlineResponse, error) {
res := &jsonmodels.GetOnlineResponse{}
if err := api.do(http.MethodGet, routeGetOnlineAccessMana,
nil, res); err != nil {
return nil, err
Expand All @@ -97,8 +97,8 @@ func (api *GoShimmerAPI) GetOnlineAccessMana() (*webapi_mana.GetOnlineResponse,
}

// GetOnlineConsensusMana returns the sorted list of online consensus mana of nodes.
func (api *GoShimmerAPI) GetOnlineConsensusMana() (*webapi_mana.GetOnlineResponse, error) {
res := &webapi_mana.GetOnlineResponse{}
func (api *GoShimmerAPI) GetOnlineConsensusMana() (*jsonmodels.GetOnlineResponse, error) {
res := &jsonmodels.GetOnlineResponse{}
if err := api.do(http.MethodGet, routeGetOnlineConsensusMana,
nil, res); err != nil {
return nil, err
Expand All @@ -107,8 +107,8 @@ func (api *GoShimmerAPI) GetOnlineConsensusMana() (*webapi_mana.GetOnlineRespons
}

// GetNHighestAccessMana returns the N highest access mana holders in the network, sorted in descending order.
func (api *GoShimmerAPI) GetNHighestAccessMana(n int) (*webapi_mana.GetNHighestResponse, error) {
res := &webapi_mana.GetNHighestResponse{}
func (api *GoShimmerAPI) GetNHighestAccessMana(n int) (*jsonmodels.GetNHighestResponse, error) {
res := &jsonmodels.GetNHighestResponse{}
if err := api.do(http.MethodGet, func() string {
return fmt.Sprintf("%s?number=%d", routeGetNHighestAccessMana, n)
}(), nil, res); err != nil {
Expand All @@ -118,8 +118,8 @@ func (api *GoShimmerAPI) GetNHighestAccessMana(n int) (*webapi_mana.GetNHighestR
}

// GetNHighestConsensusMana returns the N highest consensus mana holders in the network, sorted in descending order.
func (api *GoShimmerAPI) GetNHighestConsensusMana(n int) (*webapi_mana.GetNHighestResponse, error) {
res := &webapi_mana.GetNHighestResponse{}
func (api *GoShimmerAPI) GetNHighestConsensusMana(n int) (*jsonmodels.GetNHighestResponse, error) {
res := &jsonmodels.GetNHighestResponse{}
if err := api.do(http.MethodGet, func() string {
return fmt.Sprintf("%s?number=%d", routeGetNHighestConsensusMana, n)
}(), nil, res); err != nil {
Expand All @@ -129,39 +129,39 @@ func (api *GoShimmerAPI) GetNHighestConsensusMana(n int) (*webapi_mana.GetNHighe
}

// GetPending returns the mana (bm2) that will be pledged by spending the output specified.
func (api *GoShimmerAPI) GetPending(outputID string) (*webapi_mana.PendingResponse, error) {
res := &webapi_mana.PendingResponse{}
func (api *GoShimmerAPI) GetPending(outputID string) (*jsonmodels.PendingResponse, error) {
res := &jsonmodels.PendingResponse{}
if err := api.do(http.MethodGet, routePending,
&webapi_mana.PendingRequest{OutputID: outputID}, res); err != nil {
&jsonmodels.PendingRequest{OutputID: outputID}, res); err != nil {
return nil, err
}
return res, nil
}

// GetPastConsensusManaVector returns the consensus base mana vector of a time in the past.
func (api *GoShimmerAPI) GetPastConsensusManaVector(t int64) (*webapi_mana.PastConsensusManaVectorResponse, error) {
res := &webapi_mana.PastConsensusManaVectorResponse{}
func (api *GoShimmerAPI) GetPastConsensusManaVector(t int64) (*jsonmodels.PastConsensusManaVectorResponse, error) {
res := &jsonmodels.PastConsensusManaVectorResponse{}
if err := api.do(http.MethodGet, routePastConsensusVector,
&webapi_mana.PastConsensusManaVectorRequest{Timestamp: t}, res); err != nil {
&jsonmodels.PastConsensusManaVectorRequest{Timestamp: t}, res); err != nil {
return nil, err
}
return res, nil
}

// GetPastConsensusVectorMetadata returns the consensus base mana vector metadata of a time in the past.
func (api *GoShimmerAPI) GetPastConsensusVectorMetadata() (*webapi_mana.PastConsensusVectorMetadataResponse, error) {
res := &webapi_mana.PastConsensusVectorMetadataResponse{}
func (api *GoShimmerAPI) GetPastConsensusVectorMetadata() (*jsonmodels.PastConsensusVectorMetadataResponse, error) {
res := &jsonmodels.PastConsensusVectorMetadataResponse{}
if err := api.do(http.MethodGet, routePastConsensusVector, nil, res); err != nil {
return nil, err
}
return res, nil
}

// GetConsensusEventLogs returns the consensus event logs or the nodeIDs specified.
func (api *GoShimmerAPI) GetConsensusEventLogs(nodeIDs []string) (*webapi_mana.GetEventLogsResponse, error) {
res := &webapi_mana.GetEventLogsResponse{}
func (api *GoShimmerAPI) GetConsensusEventLogs(nodeIDs []string) (*jsonmodels.GetEventLogsResponse, error) {
res := &jsonmodels.GetEventLogsResponse{}
if err := api.do(http.MethodGet, routePastConsensusEventLogs,
&webapi_mana.GetEventLogsRequest{NodeIDs: nodeIDs}, res); err != nil {
&jsonmodels.GetEventLogsRequest{NodeIDs: nodeIDs}, res); err != nil {
return nil, err
}
return res, nil
Expand Down
6 changes: 3 additions & 3 deletions client/spammer.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import (
"fmt"
"net/http"

webapi_spammer "github.com/iotaledger/goshimmer/plugins/spammer"
"github.com/iotaledger/goshimmer/plugins/webapi/jsonmodels"
)

const (
routeSpammer = "spammer"
)

// ToggleSpammer toggles the node internal spammer.
func (api *GoShimmerAPI) ToggleSpammer(enable bool, mpm int) (*webapi_spammer.Response, error) {
res := &webapi_spammer.Response{}
func (api *GoShimmerAPI) ToggleSpammer(enable bool, mpm int) (*jsonmodels.SpammerResponse, error) {
res := &jsonmodels.SpammerResponse{}
if err := api.do(http.MethodGet, func() string {
if enable {
return fmt.Sprintf("%s?cmd=start&mpm=%d", routeSpammer, mpm)
Expand Down
Loading

0 comments on commit 400e1bf

Please sign in to comment.