Skip to content

Commit

Permalink
Merge branch 'rc/v1.7.next1' into fix_invalid_address_errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sstanculeanu authored Aug 20, 2024
2 parents e52d7d1 + b06b627 commit 05fcff7
Show file tree
Hide file tree
Showing 40 changed files with 783 additions and 983 deletions.
45 changes: 29 additions & 16 deletions .github/workflows/deploy-docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ name: Build Docker image & push
on:
release:
types: [published]
pull_request:

jobs:
build-docker-image:
Expand All @@ -17,19 +18,31 @@ jobs:

steps:
- name: Check out code into the Go module directory
uses: actions/checkout@v3

- name: Get the version
id: get_version
run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/}

- name: Build image
run: |
TAG_VERSION=${{ steps.get_version.outputs.VERSION }}
cd ${GITHUB_WORKSPACE} && docker build -t "${REGISTRY_HOSTNAME}/${IMAGE_NODE}:${TAG_VERSION}" -f ./docker/Dockerfile .
- name: Push image
run: |
docker login --username ${{ secrets.DOCKERHUB_USERNAME }} --password ${{ secrets.DOCKERHUB_TOKEN }}
TAG_VERSION=${{ steps.get_version.outputs.VERSION }}
docker push "${REGISTRY_HOSTNAME}/${IMAGE_NODE}:${TAG_VERSION}"
docker logout
uses: actions/checkout@v4

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5
with:
images: ${{ env.REGISTRY_HOSTNAME }}/${{ env.IMAGE_NODE }}

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Log into Docker Hub
if: github.event_name != 'pull_request'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Build and push image to Docker Hub
id: push
uses: docker/build-push-action@v5
with:
context: .
file: ./docker/Dockerfile
platforms: linux/amd64,linux/arm64
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@

.idea/
vendor/
cmd/proxy/proxy
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ For more details, go [here](https://docs.multiversx.com/sdk-and-tools/proxy/).
- `/v1.0/address/:address/shard` (GET) --> returns the shard of an :address based on current proxy's configuration.
- `/v1.0/address/:address/keys ` (GET) --> returns the key-value pairs of an :address.
- `/v1.0/address/:address/storage/:key` (GET) --> returns the value for a given key for an account.
- `/v1.0/address/:address/transactions` (GET) --> returns the transactions stored in indexer for a given :address.
- `/v1.0/address/:address/esdt` (GET) --> returns the account's ESDT tokens list for the given :address.
- `/v1.0/address/:address/esdt/:tokenIdentifier` (GET) --> returns the token data for a given :address and ESDT token, such as balance and properties.
- `/v1.0/address/:address/esdts-with-role/:role` (GET) --> returns the token identifiers for a given :address and the provided role.
Expand Down Expand Up @@ -83,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
3 changes: 3 additions & 0 deletions api/errors/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,9 @@ var ErrInvalidReceiverAddress = errors.New("invalid receiver address")
// ErrTransactionNotFound signals that a transaction was not found
var ErrTransactionNotFound = errors.New("transaction not found")

// ErrSCRsNoFound signals that smart contract results were not found
var ErrSCRsNoFound = errors.New("smart contract results not found")

// ErrTransactionsNotFoundInPool signals that no transaction was not found in pool
var ErrTransactionsNotFoundInPool = errors.New("transactions not found in pool")

Expand Down
22 changes: 0 additions & 22 deletions api/groups/baseAccountsGroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ func NewAccountsGroup(facadeHandler data.FacadeHandler) (*accountsGroup, error)
{Path: "/:address/nonce", Handler: ag.getNonce, Method: http.MethodGet},
{Path: "/:address/shard", Handler: ag.getShard, Method: http.MethodGet},
{Path: "/:address/code-hash", Handler: ag.getCodeHash, Method: http.MethodGet},
{Path: "/:address/transactions", Handler: ag.getTransactions, Method: http.MethodGet},
{Path: "/:address/keys", Handler: ag.getKeyValuePairs, Method: http.MethodGet},
{Path: "/:address/key/:key", Handler: ag.getValueForKey, Method: http.MethodGet},
{Path: "/:address/esdt", Handler: ag.getESDTTokens, Method: http.MethodGet},
Expand Down Expand Up @@ -71,16 +70,6 @@ func (group *accountsGroup) respondWithAccount(c *gin.Context, transform func(*d
shared.RespondWith(c, http.StatusOK, response, "", data.ReturnCodeSuccess)
}

func (group *accountsGroup) getTransactionsFromFacade(c *gin.Context) ([]data.DatabaseTransaction, int, error) {
addr := c.Param("address")
transactions, err := group.facade.GetTransactions(addr)
if err != nil {
return nil, http.StatusInternalServerError, err
}

return transactions, http.StatusOK, nil
}

// getAccount returns an accountResponse containing information
// about the account correlated with provided address
func (group *accountsGroup) getAccount(c *gin.Context) {
Expand Down Expand Up @@ -157,17 +146,6 @@ func (group *accountsGroup) getAccounts(c *gin.Context) {
shared.RespondWith(c, http.StatusOK, response, "", data.ReturnCodeSuccess)
}

// getTransactions returns the transactions for the address parameter
func (group *accountsGroup) getTransactions(c *gin.Context) {
transactions, status, err := group.getTransactionsFromFacade(c)
if err != nil {
shared.RespondWith(c, status, nil, err.Error(), data.ReturnCodeInternalError)
return
}

shared.RespondWith(c, http.StatusOK, gin.H{"transactions": transactions}, "", data.ReturnCodeSuccess)
}

// getKeyValuePairs returns the key-value pairs for the address parameter
func (group *accountsGroup) getKeyValuePairs(c *gin.Context) {
addr := c.Param("address")
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
6 changes: 0 additions & 6 deletions api/groups/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
type AccountsFacadeHandler interface {
GetAccount(address string, options common.AccountQueryOptions) (*data.AccountModel, error)
GetCodeHash(address string, options common.AccountQueryOptions) (*data.GenericAPIResponse, error)
GetTransactions(address string) ([]data.DatabaseTransaction, error)
GetShardIDForAddress(address string) (uint32, error)
GetValueForKey(address string, key string, options common.AccountQueryOptions) (string, error)
GetAllESDTTokens(address string, options common.AccountQueryOptions) (*data.GenericAPIResponse, error)
Expand Down Expand Up @@ -50,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
Loading

0 comments on commit 05fcff7

Please sign in to comment.