Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exp: Add the Zenith (Light Horizon) prototype #4352

Merged
merged 146 commits into from
Jan 9, 2024
Merged
Show file tree
Hide file tree
Changes from 58 commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
c2f03ff
exp/lighthorizon: Init
bartekn Feb 4, 2022
41f13ef
More op adapters
bartekn Feb 5, 2022
39dafba
refactoring, more ops
bartekn Feb 7, 2022
79d1cbb
More ops
bartekn Feb 7, 2022
9984e2b
Use operations.TypeNames
bartekn Feb 7, 2022
5cbe604
Merge branch 'master' into lighthorizon
bartekn Feb 7, 2022
11ad8de
all ops
bartekn Feb 8, 2022
542e5c3
Merge branch 'lighthorizon' of github.com:bartekn/go into lighthorizon
bartekn Feb 8, 2022
7d34235
rename files
bartekn Feb 8, 2022
b5bf85f
Imitate horizon responses
bartekn Feb 8, 2022
8eaed23
fixes
bartekn Feb 8, 2022
e12667f
indexer
bartekn Feb 18, 2022
d3a4bf3
s3 upload
bartekn Feb 21, 2022
b728976
Upload/download to save memory
bartekn Feb 21, 2022
570f9bc
Use a rwmutex for thread safety on indexes
Feb 22, 2022
f7bebe3
Extract s3 operations to S3IndexStore
Feb 22, 2022
f8b5108
Implement NextActive, and use index to skip checkpoints
Feb 22, 2022
3127509
Fix deadlock and constant-ize constant
Feb 22, 2022
b34326d
Add remaining countdown to indexer
Feb 23, 2022
27f71d1
use sync/errgroup for simpler error handling
Feb 23, 2022
2078ca2
Clear indexes in Flush to save memory
Feb 23, 2022
ead329d
Add FileIndexStore
Feb 23, 2022
0d30385
fixup! use sync/errgroup for simpler error handling
Feb 23, 2022
719297a
FileIndexStore add top-level dirs to organize slightly
Feb 23, 2022
8735d72
Add some root dirs to the file index store
Feb 23, 2022
8cc1cad
fixup! Add some root dirs to the file index store
Feb 23, 2022
0e5f896
Try gzipping local index files
Feb 24, 2022
246293e
gzipped index file per account for s3 as well
Mar 1, 2022
ee487b0
First pass at adding an s3 cache for checkpoints
Mar 1, 2022
d29da53
Add warning that there's no cache expiry
Mar 1, 2022
f2c68a5
Ignore malformed indexes so that we can rebuild them
Mar 1, 2022
f34cd1e
Fix bug in gzip writer
Mar 1, 2022
0eb4003
prefix s3 paths with 3-char
Mar 1, 2022
197914f
add an lru cache for s3 fs caching
Mar 2, 2022
ec37f06
Merge method
Mar 8, 2022
84dd02b
Batch index generation
Mar 8, 2022
94dd4a5
First pass at a lighthorizon dockerfile
Mar 9, 2022
565620e
Add blank prefix so lighthorizon and single build
Mar 9, 2022
bb60607
Add accounts file
Mar 9, 2022
d684687
Merge branch 'lighthorizon' of github.com:bartekn/go into lighthorizon
Mar 9, 2022
3e2a8f5
Adding a trie index for transactions
Mar 10, 2022
fc48df0
lighthorizon /transactions?id=<txhash>
Mar 10, 2022
e3acbad
Change TrieIndex to a radix tree. Saves ~20% size on-disk
Mar 11, 2022
b68b19f
Reduce and bugfixes
bartekn Mar 13, 2022
4587f7c
Merge branch 'lighthorizon' of github.com:bartekn/go into lighthorizon
bartekn Mar 13, 2022
fe907fd
Add a one-byte bitmask header for trie index nodes (saves a few bytes…
Mar 14, 2022
13312e8
Add subpath to tx indexes to keep index folders clean
Mar 14, 2022
3c3518a
Add transaction index building to batch/map
Mar 14, 2022
d6852a8
Add TrieIndex.Merge method
Mar 14, 2022
4379223
add -modules flag to single so you can limit which indexes get built
Mar 14, 2022
c4d5379
Add txn-by-hash merging into batch reduce
Mar 15, 2022
3358d4b
Add ledgerexporter service which stores txmeta in GCS
tamirms Feb 2, 2022
d182a32
Add historyarchive.ArchiveGCSBackend
Apr 18, 2022
41e44a0
Add historyarchive.ArchiveBackend.Close()
Apr 18, 2022
f37348f
ledgerexporter service supports multiple write targets
Apr 18, 2022
ac10f81
lighthorizon reading from ledgerexporter txmeta archive
Apr 25, 2022
38652e2
lighthorizon serving ops from txmeta
Apr 25, 2022
ebf37a7
index/cmd/single read from txmeta files
Apr 26, 2022
48e51e9
exp/lighthorizon: Add initial support for XDR serialization (#4369)
Shaptic May 5, 2022
e3397e5
exp/lighthorizon: Improve trie tests to avoid raw comparisons/outputs…
Shaptic May 12, 2022
ac4417a
exp/lighthorizon: Add XDR marshalling for the `TrieNode` structure. (…
Shaptic May 12, 2022
4eeba9d
lighthorizon: Sync with upstream master branch (#4404)
Shaptic May 24, 2022
64b0b67
Explain map and reduce commands
bartekn May 26, 2022
056eb0c
exp/lighthorizon: Refactor single-process index builder. (#4410)
Shaptic May 31, 2022
f6f9055
exp/services/ledgerexporter: Extend tool to support lower ledger boun…
Shaptic May 31, 2022
7015de6
exp/lighthorizon: Refactor and repair the reduce job (#4424)
Shaptic Jun 6, 2022
3aa5029
exp/lighthorizon: Unify map-reduce and single-process index builders …
Shaptic Jun 6, 2022
6b47337
exp/lighthorizon: Thread-safe support for reading account list via Fi…
Shaptic Jun 9, 2022
33cbd42
exp/lighthorizon: Restructure index package into sensible sub-package…
Shaptic Jun 10, 2022
e03abae
exp/lighthorizon: Merge on-disk index with in-memory one on load. (#4…
Shaptic Jun 21, 2022
e0e8bf1
exp/lighthorizon: Allow indexer to continually update as new txmeta a…
Shaptic Jun 23, 2022
00ae4ed
exp/lighthorizon: enforce the limit from request on the response size…
sreuland Jun 30, 2022
b3a5466
Dockerize ledgerexport to run in AWS Batch
2opremio Jun 30, 2022
740bc0b
exp/lighthorizon: Add test for batch index building map job (#4440)
Shaptic Jun 30, 2022
eeea565
Refactor bound preparation and add --continue flag
2opremio Jul 1, 2022
811c551
Address review feedback and rework env variable names
2opremio Jul 1, 2022
9aff46a
Run gofmt -w (I don't know why those files were changed)
2opremio Jul 1, 2022
9212a03
Add proper logging to indicate what range is being exported
2opremio Jul 1, 2022
61fe924
Add clarification about end ledger
2opremio Jul 1, 2022
969f21b
Fix boolean argument passing
2opremio Jul 3, 2022
b0095ec
Merge remote-tracking branch 'origin/lighthorizon' into dockerize-led…
2opremio Jul 4, 2022
168ba93
Address review feedback
2opremio Jul 6, 2022
b877e6d
Address feedback
2opremio Jul 7, 2022
58fe6c2
Use sqlite for captive core
2opremio Jul 7, 2022
17e0db9
Merge pull request #4443 from 2opremio/dockerize-ledgerexporter
2opremio Jul 11, 2022
2f0fa9c
exp/lighthorizon: Add basic scaffolding for metrics. (#4456)
Shaptic Jul 11, 2022
17f5d36
lighthorizon: Prepend version to ledger files (#4450)
2opremio Jul 13, 2022
6e864fc
exp/lighthorizon/index: More testing for batch indexing and off-by-on…
Shaptic Jul 14, 2022
291e99e
Minor ledgerexporter infrastructure improvements (#4461)
2opremio Jul 19, 2022
66228cb
Forgot to add login step to ledgerexporter workflow
2opremio Jul 19, 2022
033de79
exp/lighthorizon: Set a default number of workers. (#4465)
Shaptic Jul 20, 2022
8c9eec3
exp/lighthorizon: Fix the single-process index builder data race. (#4…
Shaptic Jul 21, 2022
bceaf07
/exp/lighthorizon: new endpoints for tx and ops paged listing by acco…
sreuland Jul 22, 2022
9b93a36
exp/lighthorizon: Add an on-disk cache for frequently accessed ledger…
Shaptic Jul 26, 2022
90f32cc
exp/lighthorizon/index: Drop building indices for successful transact…
Shaptic Jul 27, 2022
738befe
Add metrics middleware to collect request duration metrics (#4486)
tamirms Jul 28, 2022
6a9373e
exp/lighthorizon: Isolate cursor advancement code to its own interfac…
Shaptic Jul 28, 2022
3808eaf
exp/lighthorizon/index: Parse network passphrase from the env. (#4491)
Shaptic Jul 29, 2022
1ac18f3
Refactor access to meta archive (#4488)
bartekn Aug 1, 2022
a12b11f
exp/lighthorizon: Add response age prometheus metrics (#4492)
tamirms Aug 2, 2022
a047725
exp/lighthorizon/index: Allow accounts to be indexed by ledger. (#4495)
Shaptic Aug 2, 2022
2e50ba8
services/horizon/docker/ledgerexporter: deploy ledgerexporter image a…
sreuland Aug 3, 2022
7d26a32
Make indexing s3 bucket configurable (#4507)
2opremio Aug 4, 2022
67b94b5
exp/lighthorizon: Add duration metrics for on-the-fly ingestion eleme…
Shaptic Aug 5, 2022
1c2072b
exp/lighthorizon: Add JSON content type to responses. (#4509)
Shaptic Aug 5, 2022
c18e31f
exp/lighthorizon: *Correctly* set `Content-Type`, plus JSONify errors…
Shaptic Aug 5, 2022
4a82936
exp/lighthorizon/services: Move service-specific stuff to its own fil…
Shaptic Aug 8, 2022
828fc46
exp/lighthorizon, xdr: Rename `CheckpointIndex` to better reflect its…
Shaptic Aug 8, 2022
aeb23a3
exp/lighthorizon: Add a suite of tools to manage the on-disk ledger c…
Shaptic Aug 10, 2022
22b0e46
Merge branch 'master' into lighthorizon
Shaptic Aug 10, 2022
a47f74c
Run 'go mod tidy' after merge
Shaptic Aug 10, 2022
34c98a3
exp/lighthorizon: add horizon web docker/k8s deployment (#4519)
sreuland Aug 10, 2022
d98b01b
Merge branch 'lighthorizon' into lighthorizon_mergeUpstream
sreuland Aug 10, 2022
b395544
It seems like the merge caused some deleted files to stay in:
Shaptic Aug 10, 2022
817e19f
Merge branch 'master' into lighthorizon_mergeUpstream
Shaptic Aug 10, 2022
b8c287d
One more that didn't get removed :thinking:
Shaptic Aug 10, 2022
ca471e9
all: Merge 'master' into lighthorizon branch. (#4529)
Shaptic Aug 10, 2022
9f9216c
Merge branch 'master' into lighthorizon_mergeUpstreamAgain
Shaptic Aug 11, 2022
5ffdd3b
all: Merge `master` into the 'lighthorizon' branch again. (#4536)
Shaptic Aug 11, 2022
c3ec897
all: Incorporate generics into Light Horizon code. (#4537)
Shaptic Aug 12, 2022
7a30aef
bump go version to 18 on lighthorizon docker images, they need it now…
sreuland Aug 15, 2022
adadbcc
exp/lighthorizon/actions: use standard Problem model on API error res…
sreuland Aug 17, 2022
4838973
exp/lighthorizon/build/index-batch: carry over map/reduce updates to …
sreuland Aug 17, 2022
01b3b4a
exp/lighthorizon: Properly transform transactions into JSON. (#4531)
Shaptic Aug 19, 2022
f8fcb05
exp/lighthorizon: Add a set of tools to aide in index inspection. (#4…
Shaptic Aug 30, 2022
a8f9750
exp/lighthorizon/cmd: index batch fix s3 sub paths in reduce (#4552)
sreuland Aug 31, 2022
56a0321
exp/lighthorzon: Add a generic, thread-safe `SafeSet`. (#4572)
Shaptic Sep 2, 2022
3c53909
support/storage: Make the on-disk cache thread-safe. (#4575)
Shaptic Sep 7, 2022
7a5cc31
exp/lighthorizon: Incorporate tool subcommands into the webserver. (#…
Shaptic Sep 12, 2022
c9c58d2
exp/lighthorizon/index/cmd: Fix index single watch, slow down the ret…
sreuland Sep 13, 2022
f6dad54
exp/lighthorizon: Refactor archive interface and support parallel led…
Shaptic Sep 15, 2022
02dab00
exp/lighthorizon: Minor error-handling and deployment improvements. (…
Shaptic Sep 20, 2022
a088915
exp/lighthorizon/index: Add ability to disable bits in index. (#4601)
Shaptic Sep 27, 2022
dc430d4
exp/lighthorizon: Add parameters to preload ledger cache. (#4615)
Shaptic Oct 11, 2022
d3cf7fd
Rename file to fix typo
Shaptic May 19, 2023
922c969
Merge branch 'master' into lighthorizon
Shaptic Jan 5, 2024
10054c5
Re-run gofmt after generating
Shaptic Jan 5, 2024
1ce75a7
Update generated XDR file
Shaptic Jan 5, 2024
3bfd4b3
Fix things after the merge
Shaptic Jan 5, 2024
5691d2f
Remove unused creation method
Shaptic Jan 5, 2024
4724299
Fixup bad merge in the captive core config
Shaptic Jan 5, 2024
29cea5f
Upgrade gRPC to conform to later Go versions
Shaptic Jan 5, 2024
52cc470
Attempting to get Go version nonsense resolved
Shaptic Jan 5, 2024
6567031
Only do exporter jobs and fixup Dockerfile versions
Shaptic Jan 6, 2024
3e36559
Merge branch 'master' into lighthorizon
Shaptic Jan 9, 2024
7f9e886
Update Dockerfile to Ubuntu 22.04 Jammy
Shaptic Jan 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions exp/lighthorizon/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
FROM golang:1.17 AS builder
Shaptic marked this conversation as resolved.
Show resolved Hide resolved

WORKDIR /go/src/github.com/stellar/go
COPY go.mod go.sum ./
RUN go mod download
COPY . ./
# RUN go install github.com/stellar/go/exp/lighthorizon
# RUN go install github.com/stellar/go/exp/lighthorizon/index/cmd/batch/map
RUN go install github.com/stellar/go/exp/lighthorizon/index/cmd/batch/reduce
# RUN go install github.com/stellar/go/exp/lighthorizon/index/cmd/single
Shaptic marked this conversation as resolved.
Show resolved Hide resolved

FROM ubuntu:20.04

ENV DEBIAN_FRONTEND=noninteractive
# ca-certificates are required to make tls connections
RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates curl wget gnupg apt-utils
RUN apt-get clean

# COPY --from=builder /go/bin/lighthorizon ./
# COPY --from=builder /go/bin/map ./
COPY --from=builder /go/bin/reduce ./
# COPY --from=builder /go/bin/single ./

ENTRYPOINT ["./reduce"]

127 changes: 127 additions & 0 deletions exp/lighthorizon/actions/operation.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
package actions

import (
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"
"strconv"

"github.com/stellar/go/exp/lighthorizon/adapters"
"github.com/stellar/go/exp/lighthorizon/archive"
"github.com/stellar/go/exp/lighthorizon/index"
"github.com/stellar/go/protocols/horizon/operations"
"github.com/stellar/go/support/render/hal"
"github.com/stellar/go/toid"
)

func Operations(archiveWrapper archive.Wrapper, indexStore index.Store) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
// For _links rendering, imitate horizon.stellar.org links for horizon-cmp
r.URL.Scheme = "http"
r.URL.Host = "localhost:8080"

if r.Method != "GET" {
return
Shaptic marked this conversation as resolved.
Show resolved Hide resolved
}

query, err := url.ParseQuery(r.URL.RawQuery)
if err != nil {
fmt.Fprintf(w, "Error: %v", err)
return
}

var cursor int64
if query.Get("cursor") == "" {
cursor = toid.New(1, 1, 1).ToInt64()
} else {
cursor, err = strconv.ParseInt(query.Get("cursor"), 10, 64)
if err != nil {
fmt.Fprintf(w, "Error: %v", err)
return
}
}

var limit int64
if query.Get("limit") == "" {
limit = 10
} else {
limit, err = strconv.ParseInt(query.Get("limit"), 10, 64)
if err != nil {
fmt.Fprintf(w, "Error: %v", err)
return
}
}

if limit == 0 || limit > 200 {
limit = 10
}

page := hal.Page{
Cursor: query.Get("cursor"),
Order: "asc",
Limit: uint64(limit),
}
page.Init()
page.FullURL = r.URL

// For now, use a query param for now to avoid dragging in chi-router. Not
Shaptic marked this conversation as resolved.
Show resolved Hide resolved
// really the point of the experiment yet.
account := query.Get("account")
if account != "" {
// Skip the cursor ahead to the next active checkpoint for this account
checkpoint, err := indexStore.NextActive(account, "all_all", uint32(toid.Parse(cursor).LedgerSequence/64))
if err == io.EOF {
// never active. No results.
page.PopulateLinks()

encoder := json.NewEncoder(w)
encoder.SetIndent("", " ")
err = encoder.Encode(page)
if err != nil {
fmt.Fprintf(w, "Error: %v", err)
return
}
return
Shaptic marked this conversation as resolved.
Show resolved Hide resolved
} else if err != nil {
fmt.Fprintf(w, "Error: %v", err)
return
}
ledger := int32(checkpoint * 64)
if ledger < 0 {
// Check we don't overflow going from uint32 -> int32
fmt.Fprintf(w, "Error: Ledger overflow")
return
}
cursor = toid.New(ledger, 1, 1).ToInt64()
}

ops, err := archiveWrapper.GetOperations(cursor, limit)
if err != nil {
fmt.Fprintf(w, "Error: %v", err)
return
}

for _, op := range ops {
var response operations.Operation
response, err = adapters.PopulateOperation(r, &op)
if err != nil {
fmt.Fprintf(w, "Error: %v", err)
return
}

page.Add(response)
}

page.PopulateLinks()

encoder := json.NewEncoder(w)
encoder.SetIndent("", " ")
err = encoder.Encode(page)
if err != nil {
fmt.Fprintf(w, "Error: %v", err)
return
}
}
}
110 changes: 110 additions & 0 deletions exp/lighthorizon/actions/transaction.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
package actions

import (
"encoding/hex"
"encoding/json"
"fmt"
"io"
"net/http"
"net/url"

"github.com/stellar/go/exp/lighthorizon/adapters"
"github.com/stellar/go/exp/lighthorizon/archive"
"github.com/stellar/go/exp/lighthorizon/index"
hProtocol "github.com/stellar/go/protocols/horizon"
"github.com/stellar/go/support/render/hal"
)

func Transactions(archiveWrapper archive.Wrapper, indexStore index.Store) func(http.ResponseWriter, *http.Request) {
return func(w http.ResponseWriter, r *http.Request) {
// For _links rendering, imitate horizon.stellar.org links for horizon-cmp
r.URL.Scheme = "http"
r.URL.Host = "localhost:8080"

if r.Method != "GET" {
return
}

query, err := url.ParseQuery(r.URL.RawQuery)
if err != nil {
fmt.Fprintf(w, "Error: %v", err)
return
}

page := hal.Page{}
page.Init()
page.FullURL = r.URL

// For now, use a query param for now to avoid dragging in chi-router. Not
Shaptic marked this conversation as resolved.
Show resolved Hide resolved
// really the point of the experiment yet.
id := query.Get("id")
var cursor int64
if id != "" {
b, err := hex.DecodeString(id)
if err != nil {
fmt.Fprintf(w, "Error: %v", err)
return
}
if len(b) != 32 {
Shaptic marked this conversation as resolved.
Show resolved Hide resolved
fmt.Fprintf(w, "Error: invalid hash")
return
}
var hash [32]byte
copy(hash[:], b)
// Skip the cursor ahead to the next active checkpoint for this account
txnToid, err := indexStore.TransactionTOID(hash)
if err == io.EOF {
// never active. No results.
page.PopulateLinks()

encoder := json.NewEncoder(w)
encoder.SetIndent("", " ")
err = encoder.Encode(page)
if err != nil {
fmt.Fprintf(w, "Error: %v", err)
return
}
return
Shaptic marked this conversation as resolved.
Show resolved Hide resolved
} else if err != nil {
fmt.Fprintf(w, "Error: %v", err)
return
}
cursor = txnToid
}

txns, err := archiveWrapper.GetTransactions(cursor, 1)
if err != nil {
fmt.Fprintf(w, "Error: %v", err)
return
}

for _, txn := range txns {
hash, err := txn.TransactionHash()
if err != nil {
fmt.Fprintf(w, "Error: %v", err)
return
}
if id != "" && hash != id {
continue
}
var response hProtocol.Transaction
response, err = adapters.PopulateTransaction(r, &txn)
if err != nil {
fmt.Fprintf(w, "Error: %v", err)
return
}

page.Add(response)
}

page.PopulateLinks()

encoder := json.NewEncoder(w)
encoder.SetIndent("", " ")
err = encoder.Encode(page)
if err != nil {
fmt.Fprintf(w, "Error: %v", err)
return
}
}
}
21 changes: 21 additions & 0 deletions exp/lighthorizon/adapters/account_merge.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package adapters

import (
"github.com/stellar/go/exp/lighthorizon/common"
"github.com/stellar/go/protocols/horizon/operations"
)

func populateAccountMergeOperation(op *common.Operation, baseOp operations.Base) (operations.AccountMerge, error) {
destination := op.Get().Body.MustDestination()

return operations.AccountMerge{
Base: baseOp,
Account: op.SourceAccount().Address(),
Into: destination.Address(),
// TODO:
AccountMuxed: "",
AccountMuxedID: 0,
IntoMuxed: "",
IntoMuxedID: 0,
}, nil
}
43 changes: 43 additions & 0 deletions exp/lighthorizon/adapters/allow_trust.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package adapters

import (
"github.com/stellar/go/exp/lighthorizon/common"
"github.com/stellar/go/protocols/horizon/base"
"github.com/stellar/go/protocols/horizon/operations"
"github.com/stellar/go/support/errors"
"github.com/stellar/go/xdr"
)

func populateAllowTrustOperation(op *common.Operation, baseOp operations.Base) (operations.AllowTrust, error) {
allowTrust := op.Get().Body.MustAllowTrustOp()

var (
assetType string
code string
issuer string
)

err := allowTrust.Asset.ToAsset(op.SourceAccount()).Extract(&assetType, &code, &issuer)
if err != nil {
return operations.AllowTrust{}, errors.Wrap(err, "xdr.Asset.Extract error")
}

flags := xdr.TrustLineFlags(allowTrust.Authorize)

return operations.AllowTrust{
Base: baseOp,
Asset: base.Asset{
Type: assetType,
Code: code,
Issuer: issuer,
},

Trustee: op.SourceAccount().Address(),
Trustor: allowTrust.Trustor.Address(),
Authorize: flags.IsAuthorized(),
AuthorizeToMaintainLiabilities: flags.IsAuthorizedToMaintainLiabilitiesFlag(),
// TODO:
TrusteeMuxed: "",
TrusteeMuxedID: 0,
Shaptic marked this conversation as resolved.
Show resolved Hide resolved
}, nil
}
15 changes: 15 additions & 0 deletions exp/lighthorizon/adapters/begin_sponsoring_future_reserves.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package adapters

import (
"github.com/stellar/go/exp/lighthorizon/common"
"github.com/stellar/go/protocols/horizon/operations"
)

func populateBeginSponsoringFutureReservesOperation(op *common.Operation, baseOp operations.Base) (operations.BeginSponsoringFutureReserves, error) {
beginSponsoringFutureReserves := op.Get().Body.MustBeginSponsoringFutureReservesOp()

return operations.BeginSponsoringFutureReserves{
Base: baseOp,
SponsoredID: beginSponsoringFutureReserves.SponsoredId.Address(),
}, nil
}
17 changes: 17 additions & 0 deletions exp/lighthorizon/adapters/bump_sequence.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package adapters

import (
"strconv"

"github.com/stellar/go/exp/lighthorizon/common"
"github.com/stellar/go/protocols/horizon/operations"
)

func populateBumpSequenceOperation(op *common.Operation, baseOp operations.Base) (operations.BumpSequence, error) {
bumpSequence := op.Get().Body.MustBumpSequenceOp()

return operations.BumpSequence{
Base: baseOp,
BumpTo: strconv.FormatInt(int64(bumpSequence.BumpTo), 10),
}, nil
}
Loading