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

services/horizon: Update TestProtocol14StateVerifier to test LiquidityPoolEntry #3867

Merged
merged 3 commits into from
Aug 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ import (

"github.com/stellar/go/keypair"
"github.com/stellar/go/services/horizon/internal/db2/history"
"github.com/stellar/go/services/horizon/internal/ingest"
"github.com/stellar/go/services/horizon/internal/test/integration"
"github.com/stellar/go/txnbuild"
"github.com/stretchr/testify/assert"
)

func TestProtocol14StateVerifier(t *testing.T) {
itest := integration.NewTest(t, protocol15Config)
func TestStateVerifier(t *testing.T) {
itest := integration.NewTest(t, integration.Config{
ProtocolVersion: ingest.MaxSupportedProtocolVersion,
})

sponsored := keypair.MustRandom()
sponsoredSource := &txnbuild.SimpleAccount{
Expand Down Expand Up @@ -45,6 +48,19 @@ func TestProtocol14StateVerifier(t *testing.T) {
Line: txnbuild.CreditAsset{"ABCD", master.Address()}.MustToChangeTrustAsset(),
Limit: txnbuild.MaxTrustlineLimit,
},
&txnbuild.ChangeTrust{
Line: txnbuild.LiquidityPoolShareChangeTrustAsset{
LiquidityPoolParameters: txnbuild.LiquidityPoolParameters{
AssetA: txnbuild.NativeAsset{},
AssetB: txnbuild.CreditAsset{
Code: "ABCD",
Issuer: master.Address(),
},
Fee: 30,
},
},
Limit: txnbuild.MaxTrustlineLimit,
},
&txnbuild.ManageSellOffer{
SourceAccount: sponsoredSource.AccountID,
Selling: txnbuild.NativeAsset{},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import (

"github.com/stellar/go/services/horizon/internal/db2"
"github.com/stellar/go/services/horizon/internal/db2/history"
"github.com/stellar/go/services/horizon/internal/ingest"
"github.com/stellar/go/services/horizon/internal/test/integration"
strtime "github.com/stellar/go/support/time"
"github.com/stellar/go/xdr"
"github.com/stretchr/testify/assert"
)

func TestTradeAggregations(t *testing.T) {
itest := integration.NewTest(t, protocol15Config)
itest := integration.NewTest(t, integration.Config{ProtocolVersion: ingest.MaxSupportedProtocolVersion})
ctx := context.Background()
historyQ := itest.Horizon().HistoryQ()

Expand Down
3 changes: 2 additions & 1 deletion services/horizon/internal/integration/txsub_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,15 @@ import (
"sync"
"testing"

"github.com/stellar/go/services/horizon/internal/ingest"
"github.com/stellar/go/services/horizon/internal/test/integration"
"github.com/stellar/go/txnbuild"
"github.com/stretchr/testify/assert"
)

func TestTxsub(t *testing.T) {
tt := assert.New(t)
itest := integration.NewTest(t, integration.Config{ProtocolVersion: 17})
itest := integration.NewTest(t, integration.Config{ProtocolVersion: ingest.MaxSupportedProtocolVersion})
master := itest.Master()

// Sanity check: create 20 accounts and submit 2 txs from each of them as
Expand Down
4 changes: 2 additions & 2 deletions services/horizon/internal/test/integration/integration.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ var (

type Config struct {
PostgresURL string
ProtocolVersion int32
ProtocolVersion uint32
SkipContainerCreation bool
CoreDockerImage string

Expand Down Expand Up @@ -421,7 +421,7 @@ func (i *Test) WaitForHorizon() {
continue
}

if root.CurrentProtocolVersion == i.config.ProtocolVersion {
if uint32(root.CurrentProtocolVersion) == i.config.ProtocolVersion {
i.t.Logf("Horizon protocol version matches... %v", root)
return
}
Expand Down
6 changes: 6 additions & 0 deletions xdr/ledger_key.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,12 @@ func (key LedgerKey) MarshalBinaryCompress() ([]byte, error) {
return nil, err
}
m = append(m, cBalance...)
case LedgerEntryTypeLiquidityPool:
cBalance, err := key.LiquidityPool.LiquidityPoolId.MarshalBinary()
if err != nil {
return nil, err
}
m = append(m, cBalance...)
default:
panic("Unknown type")
}
Expand Down