Skip to content

Commit

Permalink
Merge branch 'master' into protocol-14-meets-master
Browse files Browse the repository at this point in the history
  • Loading branch information
2opremio committed Sep 29, 2020
2 parents 0569304 + ffa7e76 commit 601ba00
Show file tree
Hide file tree
Showing 22 changed files with 130 additions and 81 deletions.
95 changes: 77 additions & 18 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,62 @@ version: 2.1
#----------------------------------------------------------------------------#

commands:
checkout:
steps:
- run:
name: checkout
command: |
# Copy of the upstream checkout command with the following modifications:
# 1. CIRCLE_REPOSITORY_URL is updated to use https rather than ssh
# 2. Removed ssh specific sections
# Use https rather than ssh to clone public projects
CIRCLE_REPOSITORY_URL=${CIRCLE_REPOSITORY_URL/://}
CIRCLE_REPOSITORY_URL=${CIRCLE_REPOSITORY_URL/git@/https://}
echo "Repository URL: ${CIRCLE_REPOSITORY_URL}"
# Workaround old docker images with incorrect $HOME
# check https://github.com/docker/docker/issues/2968 for details
if [ "${HOME}" = "/" ]
then
export HOME=$(getent passwd $(id -un) | cut -d: -f6)
fi
# Ensure ~ is expanded otherwise bash treats is as string literal
eval CIRCLE_WORKING_DIRECTORY=${CIRCLE_WORKING_DIRECTORY}
if [ -e ${CIRCLE_WORKING_DIRECTORY}/.git ]
then
cd ${CIRCLE_WORKING_DIRECTORY}
git remote set-url origin "$CIRCLE_REPOSITORY_URL" || true
else
mkdir -p ${CIRCLE_WORKING_DIRECTORY}
cd ${CIRCLE_WORKING_DIRECTORY}
git clone "$CIRCLE_REPOSITORY_URL" .
fi
if [ -n "$CIRCLE_TAG" ]
then
git fetch --force origin "refs/tags/${CIRCLE_TAG}"
else
# By default "git fetch" only fetches refs/<branchname>
# Below ensures we also fetch PR refs
git config --add remote.origin.fetch "+refs/pull/*/head:refs/remotes/origin/pull/*"
git fetch --force --quiet origin
fi
if [ -n "$CIRCLE_TAG" ]
then
git reset --hard "$CIRCLE_SHA1"
git checkout -q "$CIRCLE_TAG"
elif [ -n "$CIRCLE_BRANCH" ]
then
git reset --hard "$CIRCLE_SHA1"
git checkout -q -B "$CIRCLE_BRANCH"
fi
git reset --hard "$CIRCLE_SHA1"
# gofmt performs checks on the entire codebase to ensure everything is formated
# with the gofmt tool.
gofmt:
Expand Down Expand Up @@ -161,11 +217,11 @@ commands:
#-----------------------------------------------------------------------------#

jobs:
# check_code_1_14 performs code checks using Go 1.14.
check_code_1_14:
# check_code_1_15 performs code checks using Go 1.15.
check_code_1_15:
working_directory: /go/src/github.com/stellar/go
docker:
- image: circleci/golang:1.14-stretch
- image: circleci/golang:1.15
steps:
- install_go_deps
- check_go_deps
Expand All @@ -175,11 +231,11 @@ jobs:
- staticcheck
- build_packages

# test_code_1_13 performs all package tests using Go 1.13.
test_code_1_13:
# test_code_1_14 performs all package tests using Go 1.14.
test_code_1_14:
working_directory: /go/src/github.com/stellar/go
docker:
- image: circleci/golang:1.13-stretch
- image: circleci/golang:1.14-stretch
environment:
GO111MODULE: "on"
PGHOST: localhost
Expand All @@ -195,11 +251,11 @@ jobs:
- install_go_deps
- test_packages

# test_code_1_13_postgres10 performs all package tests using Go 1.13 and Postgres 10.
test_code_1_13_postgres10:
# test_code_1_14_postgres10 performs all package tests using Go 1.14 and Postgres 10.
test_code_1_14_postgres10:
working_directory: /go/src/github.com/stellar/go
docker:
- image: circleci/golang:1.13-stretch
- image: circleci/golang:1.14-stretch
environment:
GO111MODULE: "on"
PGHOST: localhost
Expand All @@ -216,11 +272,11 @@ jobs:
- install_go_deps
- test_packages

# test_code_1_14 performs all package tests using Go 1.14.
test_code_1_14:
# test_code_1_15 performs all package tests using Go 1.15.
test_code_1_15:
working_directory: /go/src/github.com/stellar/go
docker:
- image: circleci/golang:1.14-stretch
- image: circleci/golang:1.15
environment:
GO111MODULE: "on"
PGHOST: localhost
Expand All @@ -236,11 +292,11 @@ jobs:
- install_go_deps
- test_packages

# test_code_1_14 performs all package tests using Go 1.14 and Postgres 10.
test_code_1_14_postgres10:
# test_code_1_15 performs all package tests using Go 1.15 and Postgres 10.
test_code_1_15_postgres10:
working_directory: /go/src/github.com/stellar/go
docker:
- image: circleci/golang:1.14-stretch
- image: circleci/golang:1.15
environment:
GO111MODULE: "on"
PGHOST: localhost
Expand All @@ -265,6 +321,9 @@ jobs:
publish_artifacts:
working_directory: /go/src/github.com/stellar/go
docker:
# Artifacts are built on Go 1.14 because a Go 1.15 Docker image for
# Debian Stretch is currently not available. See
# https://github.com/docker-library/golang/issues/344.
- image: circleci/golang:1.14-stretch
steps:
- check_deprecations
Expand Down Expand Up @@ -359,11 +418,11 @@ workflows:

check_code_and_test:
jobs:
- check_code_1_14
- test_code_1_13
- test_code_1_13_postgres10
- check_code_1_15
- test_code_1_14
- test_code_1_14_postgres10
- test_code_1_15
- test_code_1_15_postgres10
- test_horizon_integration
- publish_state_diff_docker_image:
filters:
Expand Down
2 changes: 1 addition & 1 deletion DEVELOPING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ If you're making changes to Horizon, look for documentation in its [docs](servic
## Requirements
To checkout, build, and run most tests these tools are required:
- Git
- [Go 1.13 or Go 1.14](https://golang.org/dl)
- [Go 1.14 or Go 1.15](https://golang.org/dl)

To run some tests these tools are also required:
- PostgreSQL 9.6+ server running locally, or set [environment variables](https://www.postgresql.org/docs/9.6/libpq-envars.html) (e.g. `PGHOST`, etc) for alternative host.
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This repo contains various tools and services that you can use and deploy, as we

## Dependencies

This repository is officially supported on the last two releases of Go, which is currently Go 1.13 and Go 1.14.
This repository is officially supported on the last two releases of Go, which is currently Go 1.14 and Go 1.15.

It depends on a [number of external dependencies](./go.mod), and uses Go [Modules](https://github.com/golang/go/wiki/Modules) to manage them. Running any `go` command will automatically download dependencies required for that operation.

Expand Down
1 change: 1 addition & 0 deletions clients/horizonclient/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ file. This project adheres to [Semantic Versioning](http://semver.org/).
* Remove JSON variant of `GET /metrics`, both in the server and client code. It's using Prometheus format by default now.
* Add `NextAccountsPage`.
* Fix `Fund` function that consistently errored.
* Dropped support for Go 1.13.

## [v3.0.0](https://github.com/stellar/go/releases/tag/horizonclient-v3.0.0) - 2020-04-28

Expand Down
2 changes: 1 addition & 1 deletion clients/horizonclient/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ This library is aimed at developers building Go applications that interact with
* The [txnbuild API reference](https://godoc.org/github.com/stellar/go/txnbuild).

### Prerequisites
* Go 1.13 or greater
* Go 1.14 or greater
* [Modules](https://github.com/golang/go/wiki/Modules) to manage dependencies

### Installing
Expand Down
2 changes: 1 addition & 1 deletion clients/horizonclient/internal.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ func decodeResponse(resp *http.Response, object interface{}, hc *Client) (err er

err = decoder.Decode(&object)
if err != nil {
return
return errors.Wrap(err, "error decoding response")
}
return
}
Expand Down
2 changes: 1 addition & 1 deletion exp/services/market-tracker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ To use this project, you will have to define the following in a `.env`:

## Running the project

This project was built using Go 1.13 and [Go Modules](https://blog.golang.org/using-go-modules)
This project was built using Go 1.14 and [Go Modules](https://blog.golang.org/using-go-modules)

1. From the monorepo root, navigate to the project: `cd exp/services/market-tracker`
2. Create a `config.json` file with the asset pairs to monitor and the refresh interval. A sample file is checked in at `config_sample.json`
Expand Down
1 change: 0 additions & 1 deletion exp/services/recoverysigner/internal/serve/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,6 @@ func getHandlerDeps(opts Options) (handlerDeps, error) {
return handlerDeps{}, errors.Wrap(err, "error parsing database url")
}
db.SetMaxOpenConns(opts.DatabaseMaxOpenConns)
db.SetMaxIdleConns(opts.DatabaseMaxOpenConns)

err = db.Ping()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion protocols/horizon/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ type TradeAggregation struct {

// PagingToken implementation for hal.Pageable. Not actually used
func (res TradeAggregation) PagingToken() string {
return string(res.Timestamp)
return strconv.FormatInt(res.Timestamp, 10)
}

// Transaction represents a single, successful transaction
Expand Down
5 changes: 5 additions & 0 deletions protocols/horizon/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,8 @@ func TestTransactionUnmarshalJSON(t *testing.T) {
assert.Equal(t, int64(2500000000), parsedFeesAsInts.MaxFee)
assert.Equal(t, int64(3000000000), parsedFeesAsInts.FeeCharged)
}

func TestTradeAggregation_PagingToken(t *testing.T) {
ta := TradeAggregation{Timestamp: 64}
assert.Equal(t, "64", ta.PagingToken())
}
1 change: 1 addition & 0 deletions services/federation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ bumps. A breaking change will get clearly notified in this log.
## Unreleased

* Dropped support for Go 1.12.
* Dropped support for Go 1.13.
* Log User-Agent header in request logs.

## [v0.3.0] - 2019-11-20
Expand Down
4 changes: 4 additions & 0 deletions services/horizon/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
All notable changes to this project will be documented in this
file. This project adheres to [Semantic Versioning](http://semver.org/).x

## Unreleased

* Dropped support for Go 1.13.

## v1.9.0-rc

This is an experimental Horizon release which adds support for the upcoming Protocol 14 upgrade.
Expand Down
2 changes: 1 addition & 1 deletion services/horizon/docker/verify-range/dependencies
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,4 @@ sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'postgres';"

git clone https://github.com/stellar/go.git stellar-go
cd stellar-go
/usr/local/go/bin/go build -v ./services/horizon
/usr/local/go/bin/go build -v ./services/horizon
2 changes: 1 addition & 1 deletion services/horizon/internal/docs/admin.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ To test the installation, simply run `horizon --help` from a terminal. If the h
Should you decide not to use one of our prebuilt releases, you may instead build Horizon from source. To do so, you need to install some developer tools:

- A unix-like operating system with the common core commands (cp, tar, mkdir, bash, etc.)
- A compatible distribution of Go (Go 1.13 or later)
- A compatible distribution of Go (Go 1.14 or later)
- [git](https://git-scm.com/)
- [mercurial](https://www.mercurial-scm.org/)

Expand Down
2 changes: 1 addition & 1 deletion services/horizon/internal/docs/developing.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ If you are just starting with Horizon and want to try it out, consider the [Quic
Building Horizon requires the following developer tools:

- A [Unix-like](https://en.wikipedia.org/wiki/Unix-like) operating system with the common core commands (cp, tar, mkdir, bash, etc.)
- Golang 1.13 or later
- Golang 1.14 or later
- [git](https://git-scm.com/) (to check out Horizon's source code)
- [mercurial](https://www.mercurial-scm.org/) (needed for `go-dep`)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
"encoding/json"
"testing"

"github.com/stretchr/testify/assert"

"github.com/stellar/go/exp/ingest/io"
"github.com/stellar/go/services/horizon/internal/db2/history"
"github.com/stellar/go/support/errors"
Expand Down Expand Up @@ -145,38 +143,3 @@ func (s *OperationsProcessorTestSuiteLedger) TestExecFails() {
s.Assert().Error(err)
s.Assert().EqualError(err, "transient error")
}

func TestTransactionOperationWrapper_Details(t *testing.T) {
unmuxed := xdr.MustAddress("GA5WBPYA5Y4WAEHXWR2UKO2UO4BUGHUQ74EUPKON2QHV4WRHOIRNKKH2")
muxed := xdr.MuxedAccount{
Type: xdr.CryptoKeyTypeKeyTypeMuxedEd25519,
Med25519: &xdr.MuxedAccountMed25519{
Id: 0xdeadbeefdeadbeef,
Ed25519: *unmuxed.Ed25519,
},
}
tx := createTransaction(true, 1)
tx.Index = 1
tx.Envelope.Operations()[0].Body = xdr.OperationBody{
Type: xdr.OperationTypePayment,
PaymentOp: &xdr.PaymentOp{
Destination: muxed,
Asset: xdr.Asset{Type: xdr.AssetTypeAssetTypeNative},
Amount: 100,
},
}
wrapper := transactionOperationWrapper{
index: 1,
transaction: tx,
operation: tx.Envelope.Operations()[0],
ledgerSequence: uint32(56),
}
details, err := wrapper.Details()
assert.NoError(t, err)
assert.Equal(t, details, map[string]interface{}{
"amount": "0.0000100",
"asset_type": "native",
"from": "GAUJETIZVEP2NRYLUESJ3LS66NVCEGMON4UDCBCSBEVPIID773P2W6AY",
"to": "GA5WBPYA5Y4WAEHXWR2UKO2UO4BUGHUQ74EUPKON2QHV4WRHOIRNKKH2",
})
}
1 change: 1 addition & 0 deletions services/keystore/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Unreleased

- Dropped support for Go 1.12.
* Dropped support for Go 1.13.

## [v1.2.0] - 2019-11-20

Expand Down
1 change: 1 addition & 0 deletions services/ticker/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Unreleased

* Dropped support for Go 1.12.
* Dropped support for Go 1.13.


## [v1.2.0] - 2019-11-20
Expand Down
Loading

0 comments on commit 601ba00

Please sign in to comment.