Skip to content

Commit

Permalink
Merge pull request #457 from multiversx/MX-15699-remove-from-proxy-th…
Browse files Browse the repository at this point in the history
…e-endpoint-block-atlas-shard-nonce

Remove code that serves endpoint /block-atlas/{shard}/{nonce}
  • Loading branch information
danielailie committed Aug 8, 2024
2 parents ceb38a0 + 980d416 commit 0e75611
Show file tree
Hide file tree
Showing 29 changed files with 61 additions and 774 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,6 @@ Please note that `altered-accounts` endpoints will only work if the backing obse

- `/v1.0/blocks/by-round/:round` (GET) --> returns all blocks by round

### block-atlas

- `/v1.0/block-atlas/:shard/:nonce` (GET) --> returns a block by nonce, as required by Block Atlas


### hyperblock

- `/v1.0/hyperblock/by-nonce/:nonce` (GET) --> returns a hyperblock by nonce, with transactions included
Expand Down
6 changes: 0 additions & 6 deletions api/apiHandler.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ func initBaseGroupsWithFacade(facade data.FacadeHandler) (map[string]data.GroupH
return nil, err
}

blockAtlasGroup, err := groups.NewBlockAtlasGroup(facade)
if err != nil {
return nil, err
}

hyperBlocksGroup, err := groups.NewHyperBlockGroup(facade)
if err != nil {
return nil, err
Expand Down Expand Up @@ -110,7 +105,6 @@ func initBaseGroupsWithFacade(facade data.FacadeHandler) (map[string]data.GroupH
"/block": blockGroup,
"/blocks": blocksGroup,
"/internal": internalGroup,
"/block-atlas": blockAtlasGroup,
"/hyperblock": hyperBlocksGroup,
"/network": networkGroup,
"/node": nodeGroup,
Expand Down
58 changes: 0 additions & 58 deletions api/groups/baseBlockAtlasGroup.go

This file was deleted.

132 changes: 0 additions & 132 deletions api/groups/baseBlockAtlasGroup_test.go

This file was deleted.

4 changes: 2 additions & 2 deletions api/groups/baseBlockGroup_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func TestGetBlockByNonce_ReturnsSuccessfully(t *testing.T) {
resp := httptest.NewRecorder()
ws.ServeHTTP(resp, req)

apiResp := blockResponse{}
apiResp := data.BlockApiResponse{}
loadResponse(resp.Body, &apiResp)

assert.Equal(t, http.StatusOK, resp.Code)
Expand Down Expand Up @@ -258,7 +258,7 @@ func TestGetBlockByHash_ReturnsSuccessfully(t *testing.T) {
resp := httptest.NewRecorder()
ws.ServeHTTP(resp, req)

apiResp := blockResponse{}
apiResp := data.BlockApiResponse{}
loadResponse(resp.Body, &apiResp)

assert.Equal(t, http.StatusOK, resp.Code)
Expand Down
5 changes: 0 additions & 5 deletions api/groups/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,6 @@ type InternalFacadeHandler interface {
GetInternalStartOfEpochValidatorsInfo(epoch uint32) (*data.ValidatorsInfoApiResponse, error)
}

// BlockAtlasFacadeHandler interface defines methods that can be used from facade context variable
type BlockAtlasFacadeHandler interface {
GetAtlasBlockByShardIDAndNonce(shardID uint32, nonce uint64) (data.AtlasBlock, error)
}

// HyperBlockFacadeHandler defines the actions needed for fetching the hyperblocks from the nodes
type HyperBlockFacadeHandler interface {
GetHyperBlockByNonce(nonce uint64, options common.HyperblockQueryOptions) (*data.HyperblockApiResponse, error)
Expand Down
6 changes: 0 additions & 6 deletions api/mock/facadeStub.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ type FacadeStub struct {
GetDirectStakedInfoCalled func() (*data.GenericAPIResponse, error)
GetDelegatedInfoCalled func() (*data.GenericAPIResponse, error)
GetRatingsConfigCalled func() (*data.GenericAPIResponse, error)
GetBlockByShardIDAndNonceHandler func(shardID uint32, nonce uint64) (data.AtlasBlock, error)
GetTransactionByHashAndSenderAddressHandler func(txHash string, sndAddr string, withResults bool) (*transaction.ApiTransactionResult, int, error)
GetBlockByHashCalled func(shardID uint32, hash string, options common.BlockQueryOptions) (*data.BlockApiResponse, error)
GetBlockByNonceCalled func(shardID uint32, nonce uint64, options common.BlockQueryOptions) (*data.BlockApiResponse, error)
Expand Down Expand Up @@ -443,11 +442,6 @@ func (f *FacadeStub) GetHeartbeatData() (*data.HeartbeatResponse, error) {
return f.GetHeartbeatDataHandler()
}

// GetAtlasBlockByShardIDAndNonce -
func (f *FacadeStub) GetAtlasBlockByShardIDAndNonce(shardID uint32, nonce uint64) (data.AtlasBlock, error) {
return f.GetBlockByShardIDAndNonceHandler(shardID, nonce)
}

// GetBlockByHash -
func (f *FacadeStub) GetBlockByHash(shardID uint32, hash string, options common.BlockQueryOptions) (*data.BlockApiResponse, error) {
return f.GetBlockByHashCalled(shardID, hash, options)
Expand Down
5 changes: 0 additions & 5 deletions cmd/proxy/config/apiConfig/v1_0.toml
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,6 @@ Routes = [
{ Name = "/by-round/:round", Secured = false, Open = true, RateLimit = 0 },
]

[APIPackages.block-atlas]
Routes = [
{ Name = "/:shard/:nonce", Secured = false, Open = true, RateLimit = 0 }
]

[APIPackages.proof]
Routes = [
{ Name = "/root-hash/:roothash/address/:address", Secured = false, Open = false, RateLimit = 0 },
Expand Down
5 changes: 0 additions & 5 deletions cmd/proxy/config/apiConfig/v_next.toml
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,6 @@ Routes = [
{ Name = "/by-round/:round", Secured = false, Open = true, RateLimit = 0 },
]

[APIPackages.block-atlas]
Routes = [
{ Name = "/:shard/:nonce", Secured = false, Open = true, RateLimit = 0 }
]

[APIPackages.proof]
Routes = [
{ Name = "/root-hash/:roothash/address/:address", Secured = false, Open = false, RateLimit = 0 },
Expand Down
4 changes: 0 additions & 4 deletions cmd/proxy/config/external.toml

This file was deleted.

82 changes: 1 addition & 81 deletions cmd/proxy/config/swagger/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -574,86 +574,6 @@
}
}
},
"/block-atlas/{shard}/{nonce}": {
"get": {
"tags": [
"block-atlas"
],
"summary": "get a block from a specified shard and at a specified nonce",
"parameters": [
{
"name": "shard",
"in": "path",
"description": "the shard ID to look after",
"required": true,
"schema": {
"type": "integer"
}
},
{
"name": "nonce",
"in": "path",
"description": "the nonce to look after",
"required": true,
"schema": {
"type": "integer"
}
}
],
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GenericResponse"
}
}
}
}
}
}
},
"/block-atlas/{shard}/by-hash/{hash}": {
"get": {
"tags": [
"block"
],
"summary": "get a block from a specified shard and with a specified hash",
"parameters": [
{
"name": "shard",
"in": "path",
"description": "the shard ID to look after",
"required": true,
"schema": {
"type": "integer"
}
},
{
"name": "hash",
"in": "path",
"description": "the hash to look after",
"required": true,
"schema": {
"type": "string"
}
}
],
"responses": {
"200": {
"description": "successful operation",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/GenericResponse"
}
}
}
}
}
}
},
"/blocks/by-round/{round}": {
"get": {
"tags": [
Expand Down Expand Up @@ -3239,4 +3159,4 @@
}
}
}
}
}
Loading

0 comments on commit 0e75611

Please sign in to comment.