Skip to content

Commit 3014c68

Browse files
authored
Merge branch 'master' into master
2 parents 04081f6 + 516fa2d commit 3014c68

33 files changed

+3769
-480
lines changed

.github/workflows/galexie-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
# this is the multi-arch index sha, get it by 'docker buildx imagetools inspect stellar/quickstart:testing'
1717
GALEXIE_INTEGRATION_TESTS_QUICKSTART_IMAGE: docker.io/stellar/quickstart:testing@sha256:5333ec87069efd7bb61f6654a801dc093bf0aad91f43a5ba84806d3efe4a6322
1818
GALEXIE_INTEGRATION_TESTS_QUICKSTART_IMAGE_PULL: "false"
19-
STELLAR_CORE_VERSION: 22.1.0-2194.0241e79f7.focal
19+
STELLAR_CORE_VERSION: 22.2.0-2361.e6c1f3bfc.focal
2020
steps:
2121
- name: Set VERSION
2222
run: |

.github/workflows/galexie.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
name: Test
1111
runs-on: ubuntu-22.04
1212
env:
13-
CAPTIVE_CORE_DEBIAN_PKG_VERSION: 22.1.0-2194.0241e79f7.focal
13+
CAPTIVE_CORE_DEBIAN_PKG_VERSION: 22.2.0-2361.e6c1f3bfc.focal
1414
GALEXIE_INTEGRATION_TESTS_ENABLED: "true"
1515
GALEXIE_INTEGRATION_TESTS_CAPTIVE_CORE_BIN: /usr/bin/stellar-core
1616
# this pins to a version of quickstart:testing that has the same version as GALEXIE_INTEGRATION_TESTS_CAPTIVE_CORE_BIN

.github/workflows/horizon.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ jobs:
3333
HORIZON_INTEGRATION_TESTS_ENABLED: true
3434
HORIZON_INTEGRATION_TESTS_CORE_MAX_SUPPORTED_PROTOCOL: ${{ matrix.protocol-version }}
3535
HORIZON_INTEGRATION_TESTS_CAPTIVE_CORE_USE_DB: true
36-
PROTOCOL_22_CORE_DEBIAN_PKG_VERSION: 22.1.0-2194.0241e79f7.focal
37-
PROTOCOL_22_CORE_DOCKER_IMG: stellar/stellar-core:22.1.0-2194.0241e79f7.focal
36+
PROTOCOL_22_CORE_DEBIAN_PKG_VERSION: 22.2.0-2361.e6c1f3bfc.focal
37+
PROTOCOL_22_CORE_DOCKER_IMG: stellar/stellar-core:22.2.0-2361.e6c1f3bfc.focal
3838
PROTOCOL_22_STELLAR_RPC_DOCKER_IMG: stellar/stellar-rpc:22.1.2
3939
PGHOST: localhost
4040
PGPORT: 5432
@@ -124,7 +124,7 @@ jobs:
124124
runs-on: ubuntu-22.04
125125
env:
126126
GO_VERSION: 1.23.4
127-
STELLAR_CORE_VERSION: 22.1.0-2194.0241e79f7.focal
127+
STELLAR_CORE_VERSION: 22.2.0-2361.e6c1f3bfc.focal
128128
CAPTIVE_CORE_STORAGE_PATH: /tmp
129129
steps:
130130
- uses: actions/checkout@v3

amount/main.go

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,15 @@ func ParseInt64(v string) (int64, error) {
8282
return i, nil
8383
}
8484

85+
// MustParseInt64Raw simply converts an string into a 64-bit signed integer
86+
func MustParseInt64Raw(v string) int64 {
87+
i, err := strconv.ParseInt(v, 10, 64)
88+
if err != nil {
89+
panic(err)
90+
}
91+
return i
92+
}
93+
8594
// IntStringToAmount converts string integer value and converts it to stellar
8695
// "amount". In other words, it divides the given string integer value by 10^7
8796
// and returns the string representation of that number.
@@ -139,3 +148,17 @@ func StringFromInt64(v int64) string {
139148
r.Quo(r, bigOne)
140149
return r.FloatString(7)
141150
}
151+
152+
// No conversion. Simply convert int64 to string. Useful to have this in one place, should the underlying implementation change
153+
func String64Raw(v xdr.Int64) string {
154+
return strconv.FormatInt(int64(v), 10)
155+
}
156+
157+
func String128Raw(v xdr.Int128Parts) string {
158+
// the upper half of the i128 always indicates its sign regardless of its
159+
// value, just like a native signed type
160+
val := big.NewInt(int64(v.Hi))
161+
val.Lsh(val, 64).Add(val, new(big.Int).SetUint64(uint64(v.Lo)))
162+
163+
return val.String()
164+
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ require (
135135
github.com/gavv/monotime v0.0.0-20161010190848-47d58efa6955 // indirect
136136
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
137137
github.com/golang/protobuf v1.5.4 // indirect
138-
github.com/google/go-cmp v0.6.0 // indirect
138+
github.com/google/go-cmp v0.7.0
139139
github.com/google/go-querystring v0.0.0-20160401233042-9235644dd9e5 // indirect
140140
github.com/googleapis/gax-go/v2 v2.12.4 // indirect
141141
github.com/hashicorp/golang-lru v1.0.2

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -237,8 +237,8 @@ github.com/google/go-cmp v0.5.2/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/
237237
github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
238238
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
239239
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
240-
github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI=
241-
github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY=
240+
github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8=
241+
github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU=
242242
github.com/google/go-querystring v0.0.0-20160401233042-9235644dd9e5 h1:oERTZ1buOUYlpmKaqlO5fYmz8cZ1rYu5DieJzF4ZVmU=
243243
github.com/google/go-querystring v0.0.0-20160401233042-9235644dd9e5/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck=
244244
github.com/google/gopacket v1.1.20-0.20210429153827-3eaba0894325/go.mod h1:riddUzxTSBpJXk3qBHtYr4qOhFhT6k/1c0E3qkQjQpA=

ingest/address/address.pb.go

Lines changed: 0 additions & 206 deletions
This file was deleted.

ingest/asset/asset.go

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,63 @@
11
package asset
22

3+
import (
4+
"github.com/stellar/go/xdr"
5+
"strings"
6+
)
7+
38
// NewNativeAsset creates an Asset representing the native token (XLM).
49
func NewNativeAsset() *Asset {
510
return &Asset{AssetType: &Asset_Native{Native: true}}
611
}
712

8-
// NewIssuedAsset creates an Asset with an asset code and issuer.
9-
func NewIssuedAsset(assetCode, issuer string) *Asset {
13+
func NewProtoAsset(asset xdr.Asset) *Asset {
14+
if asset.IsNative() {
15+
return NewNativeAsset()
16+
}
1017
return &Asset{
1118
AssetType: &Asset_IssuedAsset{
1219
IssuedAsset: &IssuedAsset{
13-
AssetCode: assetCode,
14-
Issuer: issuer,
20+
// Need to trim the extra null characters from showing in the code when saving to assetCode
21+
AssetCode: strings.TrimRight(asset.GetCode(), "\x00"),
22+
Issuer: asset.GetIssuer(),
1523
},
1624
},
1725
}
1826
}
27+
28+
func (a *Asset) ToXdrAsset() xdr.Asset {
29+
if a == nil {
30+
panic("nil asset")
31+
}
32+
switch a := a.AssetType.(type) {
33+
case *Asset_Native:
34+
return xdr.MustNewNativeAsset()
35+
case *Asset_IssuedAsset:
36+
return xdr.MustNewCreditAsset(a.IssuedAsset.AssetCode, a.IssuedAsset.Issuer)
37+
}
38+
panic("unknown asset type")
39+
}
40+
41+
func (a *Asset) Equals(other *Asset) bool {
42+
// If both assets are the same type (native or issued asset)
43+
if a.AssetType == nil || other.AssetType == nil {
44+
return false
45+
}
46+
47+
switch a := a.AssetType.(type) {
48+
case *Asset_Native:
49+
if b, ok := other.AssetType.(*Asset_Native); ok {
50+
// Both assets are native; compare the native boolean value.
51+
// Ideally i could simply be returning true here, but it is more idiomatic to check for the flag equality
52+
return a.Native == b.Native
53+
}
54+
case *Asset_IssuedAsset:
55+
if b, ok := other.AssetType.(*Asset_IssuedAsset); ok {
56+
// Both assets are issued assets; compare their asset_code and issuer
57+
return a.IssuedAsset.AssetCode == b.IssuedAsset.AssetCode &&
58+
a.IssuedAsset.Issuer == b.IssuedAsset.Issuer
59+
}
60+
}
61+
62+
return false
63+
}

0 commit comments

Comments
 (0)