From 8c69f23a10f1649fe0d6eb67efc29af0782059a3 Mon Sep 17 00:00:00 2001 From: Dzmitry Hil Date: Mon, 13 May 2024 11:19:46 +0300 Subject: [PATCH 1/4] Update CI cache to ScribeMD/docker-cache. --- .github/workflows/relayer-ci.yml | 5 +- integration-tests/init.go | 1 + integration-tests/xrpl.go | 4 +- integration-tests/xrpl/matching_test.go | 339 ++++++++++++++++++++++++ 4 files changed, 344 insertions(+), 5 deletions(-) create mode 100644 integration-tests/xrpl/matching_test.go diff --git a/.github/workflows/relayer-ci.yml b/.github/workflows/relayer-ci.yml index 609be000..23fc9983 100644 --- a/.github/workflows/relayer-ci.yml +++ b/.github/workflows/relayer-ci.yml @@ -112,11 +112,10 @@ jobs: key: ${{ runner.os }}-wasm-cache-${{ hashFiles('**/Cargo.lock') }} if: ${{ matrix.build-contract }} - name: Set up docker cache - uses: satackey/action-docker-layer-caching@v0.0.11 + uses: ScribeMD/docker-cache@0.5.0 if: ${{ matrix.docker-cache }} - continue-on-error: true with: - key: ${{ runner.os }}-docker-cache-${{ steps.crust-coreum-cache-key.outputs.key }} + key: ${{ runner.os }}-docker-cache-scribemd-${{ steps.crust-coreum-cache-key.outputs.key }} - name: Build contract run: make build-contract working-directory: ./coreumbridge-xrpl diff --git a/integration-tests/init.go b/integration-tests/init.go index 0f9c4f19..5ab75b96 100644 --- a/integration-tests/init.go +++ b/integration-tests/init.go @@ -47,6 +47,7 @@ func init() { flag.Parse() logCfg := logger.DefaultZapLoggerConfig() + logCfg.Level = "error" // set correct skip caller since we don't use the err counter wrapper here logCfg.CallerSkip = 1 log, err := logger.NewZapLogger(logCfg) diff --git a/integration-tests/xrpl.go b/integration-tests/xrpl.go index d15a187b..bbaf3426 100644 --- a/integration-tests/xrpl.go +++ b/integration-tests/xrpl.go @@ -192,9 +192,9 @@ func (c XRPLChain) FundAccount(ctx context.Context, t *testing.T, acc rippledata c.AutoFillTx(ctx, t, &fundXrpTx, fundingAcc) require.NoError(t, c.signer.Sign(&fundXrpTx, faucetKeyringKeyName)) - t.Logf("Funding account, account address: %s, amount: %f", acc, amount) + //t.Logf("Funding account, account address: %s, amount: %f", acc, amount) require.NoError(t, c.RPCClient().SubmitAndAwaitSuccess(ctx, &fundXrpTx)) - t.Logf("The account %s is funded", acc) + //t.Logf("The account %s is funded", acc) } // AutoFillSignAndSubmitTx autofills the transaction and submits it. diff --git a/integration-tests/xrpl/matching_test.go b/integration-tests/xrpl/matching_test.go new file mode 100644 index 00000000..31f2dc51 --- /dev/null +++ b/integration-tests/xrpl/matching_test.go @@ -0,0 +1,339 @@ +//go:build integrationtests +// +build integrationtests + +package xrpl_test + +import ( + "context" + "fmt" + "sort" + "strings" + "testing" + + rippledata "github.com/rubblelabs/ripple/data" + "github.com/samber/lo" + "github.com/stretchr/testify/require" + + integrationtests "github.com/CoreumFoundation/coreumbridge-xrpl/integration-tests" + "github.com/CoreumFoundation/coreumbridge-xrpl/relayer/xrpl" +) + +type Amount struct { + Value string + Currency string +} + +func NewAmount(value, currency string) Amount { + return Amount{ + Value: value, + Currency: currency, + } +} + +type Offer struct { + TakerPays Amount + TakerGets Amount + Account rippledata.Account +} + +func TestExchange(t *testing.T) { + + ctx, chains := integrationtests.NewTestingContext(t) + + acc1 := chains.XRPL.GenAccount(ctx, t, 100) + acc2 := chains.XRPL.GenAccount(ctx, t, 100) + acc3 := chains.XRPL.GenAccount(ctx, t, 100) + + // mapping to print balances with static names + accNames := map[string]rippledata.Account{ + "acc1": acc1, + "acc2": acc2, + "acc3": acc3, + } + + fooCurrency := "FOO" + barCurrency := "BAR" + + tickSize := uint8(3) + + type testCase struct { + name string + offers []Offer + } + tests := []testCase{ + { + name: "maker_receives_more", + offers: []Offer{ + { + TakerPays: NewAmount("3", fooCurrency), + TakerGets: NewAmount("7", barCurrency), // 3/7 ~= 0.4285714285 + Account: acc1, + }, + { + TakerPays: NewAmount("42.86", barCurrency), + TakerGets: NewAmount("100", fooCurrency), // 42.86/100 = 0.4286 + Account: acc2, + }, + // result + // acc1:0.006993006993006BAR, 3FOO + // acc2:97FOO, 6.993006993006994BAR + + // 3 / (7 - 0.006993006993006 ) + // (100 - 97) / 6.993006993006994 + }, + }, + { + name: "maker_receives_more", + offers: []Offer{ + { + TakerPays: NewAmount("0.000000000000003", fooCurrency), + TakerGets: NewAmount("0.000000000000007", barCurrency), // 0.000000000000003/0.000000000000007 ~= 0.4285714285 + Account: acc1, + }, + { + TakerPays: NewAmount("0.000000000040286", barCurrency), + TakerGets: NewAmount("0.000000000100000", fooCurrency), // 0.000000000040286/0.000000000100000 = 0.4286 + Account: acc2, + }, + // result + // acc1:3FOO, 6993006993006e-30BAR, 3e-15FOO + // acc2:97FOO, 99997e-15FOO, 6993006993006994e-30BAR + }, + }, + } + + for _, tt := range tests { + tt := tt + t.Run(tt.name, func(t *testing.T) { + // ------------------------------ EXECUTION ------------------------------ + + issuer := chains.XRPL.GenAccount(ctx, t, 100) + setUpIssuerAccount(ctx, t, chains, issuer, tickSize) + + currencies := make(map[rippledata.Currency]struct{}) + + t.Logf("----------Offers----------") + for _, offer := range tt.offers { + for accName, acc := range accNames { + if offer.Account.String() != acc.String() { + continue + } + t.Logf("Acc:%s, TakerPays:%s%s, TakerGets:%s%s", + accName, + offer.TakerPays.Value, offer.TakerPays.Currency, + offer.TakerGets.Value, offer.TakerGets.Currency, + ) + } + + takerPaysCurrency, err := rippledata.NewCurrency(offer.TakerPays.Currency) + require.NoError(t, err) + currencies[takerPaysCurrency] = struct{}{} + + takerGetsCurrency, err := rippledata.NewCurrency(offer.TakerGets.Currency) + require.NoError(t, err) + currencies[takerGetsCurrency] = struct{}{} + + setMaxTrustSet(ctx, t, chains, issuer, takerPaysCurrency, offer.Account) + setMaxTrustSet(ctx, t, chains, issuer, takerGetsCurrency, offer.Account) + // offer creator pays TakerGets amount + valueToFund, err := rippledata.NewValue(offer.TakerGets.Value, false) + require.NoError(t, err) + amountToFund := rippledata.Amount{ + Value: valueToFund, + Currency: takerGetsCurrency, + Issuer: issuer, + } + fundAccount(ctx, t, chains, offer.Account, amountToFund) + } + + t.Log("----------Balances before offers creation----------") + printBalances(ctx, t, chains, accNames, currencies, issuer) + + offerSequences := make(map[uint32]rippledata.Account, 0) + + for _, offer := range tt.offers { + offerTakerPaysValue, err := rippledata.NewValue(offer.TakerPays.Value, false) + require.NoError(t, err) + offerTakerPaysCurrency, err := rippledata.NewCurrency(offer.TakerPays.Currency) + require.NoError(t, err) + offerTakerPaysAmount := rippledata.Amount{ + Value: offerTakerPaysValue, + Currency: offerTakerPaysCurrency, + Issuer: issuer, + } + + offerTakerGetsValue, err := rippledata.NewValue(offer.TakerGets.Value, false) + require.NoError(t, err) + offerTakerGetsCurrency, err := rippledata.NewCurrency(offer.TakerGets.Currency) + require.NoError(t, err) + offerTakerGetsAmount := rippledata.Amount{ + Value: offerTakerGetsValue, + Currency: offerTakerGetsCurrency, + Issuer: issuer, + } + + offerSeq := createOffer(ctx, t, chains, offer.Account, offerTakerPaysAmount, offerTakerGetsAmount) + if offerSeq != nil { + offerSequences[*offerSeq] = offer.Account + } + } + + //t.Log("----------Balances after offers creation----------") + //printBalances(ctx, t, chains, accNames, currencies, issuer) + + // cancelling all offers + for offerSequence, acc := range offerSequences { + cancelOffer(ctx, t, chains, acc, offerSequence) + } + + t.Log("----------Balances after offers cancelling----------") + printBalances(ctx, t, chains, accNames, currencies, issuer) + }) + } +} + +func printBalances( + ctx context.Context, + t *testing.T, + chains integrationtests.Chains, + accNames map[string]rippledata.Account, + currencies map[rippledata.Currency]struct{}, issuer rippledata.Account) { + + accKeys := lo.Keys(accNames) + sort.Strings(accKeys) + + for _, name := range accKeys { + acc := accNames[name] + + balances := chains.XRPL.GetAccountBalances(ctx, t, acc) + results := make([]string, 0) + for currency := range currencies { + key := fmt.Sprintf("%s/%s", xrpl.ConvertCurrencyToString(currency), issuer.String()) + balance, ok := balances[key] + if !ok || balance.Value.IsZero() { + continue + } + results = append(results, fmt.Sprintf("%s%s", balance.Value.String(), currency)) + } + if len(results) == 0 { + continue + } + t.Logf("%s:%s", name, strings.Join(results, ", ")) + } +} + +func createOffer( + ctx context.Context, + t *testing.T, + chains integrationtests.Chains, + sender rippledata.Account, + takerPays rippledata.Amount, + takerGets rippledata.Amount, +) *uint32 { + offer1CreateTx := rippledata.OfferCreate{ + TakerPays: takerPays, + TakerGets: takerGets, + TxBase: rippledata.TxBase{ + TransactionType: rippledata.OFFER_CREATE, + }, + } + require.NoError(t, chains.XRPL.AutoFillSignAndSubmitTx(ctx, t, &offer1CreateTx, sender)) + + txRes, err := chains.XRPL.RPCClient().Tx(ctx, offer1CreateTx.Hash) + require.NoError(t, err) + + var offer1Seq *uint32 + for _, an := range txRes.MetaData.AffectedNodes { + createdNode := an.CreatedNode + if createdNode == nil { + continue + } + if createdNode.LedgerEntryType != rippledata.OFFER { + continue + } + offer, ok := createdNode.NewFields.(*rippledata.Offer) + if !ok { + panic("failed to cast tp *rippledata.Offer") + } + offer1Seq = offer.Sequence + } + + return offer1Seq +} + +func setUpIssuerAccount( + ctx context.Context, + t *testing.T, + chains integrationtests.Chains, + issuer rippledata.Account, + tickSize uint8, +) { + tx := rippledata.AccountSet{ + SetFlag: lo.ToPtr(uint32(rippledata.TxDefaultRipple)), + TxBase: rippledata.TxBase{ + TransactionType: rippledata.ACCOUNT_SET, + }, + TickSize: lo.ToPtr(uint8(tickSize)), + } + require.NoError(t, chains.XRPL.AutoFillSignAndSubmitTx(ctx, t, &tx, issuer)) +} + +func setMaxTrustSet( + ctx context.Context, + t *testing.T, + chains integrationtests.Chains, + issuer rippledata.Account, + currency rippledata.Currency, + accounts ...rippledata.Account, +) { + currencyTrustSetValue, err := rippledata.NewValue("10e80", false) + require.NoError(t, err) + + for _, acc := range accounts { + tx := rippledata.TrustSet{ + LimitAmount: rippledata.Amount{ + Value: currencyTrustSetValue, + Currency: currency, + Issuer: issuer, + }, + TxBase: rippledata.TxBase{ + TransactionType: rippledata.TRUST_SET, + Flags: lo.ToPtr(rippledata.TxSetNoRipple), + }, + } + require.NoError(t, chains.XRPL.AutoFillSignAndSubmitTx(ctx, t, &tx, acc)) + } +} + +func fundAccount( + ctx context.Context, + t *testing.T, + chains integrationtests.Chains, + recipientAcc rippledata.Account, + amount rippledata.Amount, +) { + tx := rippledata.Payment{ + Destination: recipientAcc, + Amount: amount, + TxBase: rippledata.TxBase{ + TransactionType: rippledata.PAYMENT, + }, + } + require.NoError(t, chains.XRPL.AutoFillSignAndSubmitTx(ctx, t, &tx, amount.Issuer)) +} + +func cancelOffer( + ctx context.Context, + t *testing.T, + chains integrationtests.Chains, + sender rippledata.Account, + offerSeq uint32, +) { + offer1CancelTx := rippledata.OfferCancel{ + TxBase: rippledata.TxBase{ + TransactionType: rippledata.OFFER_CANCEL, + }, + OfferSequence: offerSeq, + } + require.NoError(t, chains.XRPL.AutoFillSignAndSubmitTx(ctx, t, &offer1CancelTx, sender)) +} From b1761ceba78a403cf3defa0e528ae56ada5e0dfd Mon Sep 17 00:00:00 2001 From: Dzmitry Hil Date: Wed, 15 May 2024 08:29:33 +0300 Subject: [PATCH 2/4] Update CI cache to ScribeMD/docker-cache. --- integration-tests/init.go | 1 - integration-tests/xrpl.go | 4 +- integration-tests/xrpl/matching_test.go | 339 ------------------------ 3 files changed, 2 insertions(+), 342 deletions(-) delete mode 100644 integration-tests/xrpl/matching_test.go diff --git a/integration-tests/init.go b/integration-tests/init.go index 5ab75b96..0f9c4f19 100644 --- a/integration-tests/init.go +++ b/integration-tests/init.go @@ -47,7 +47,6 @@ func init() { flag.Parse() logCfg := logger.DefaultZapLoggerConfig() - logCfg.Level = "error" // set correct skip caller since we don't use the err counter wrapper here logCfg.CallerSkip = 1 log, err := logger.NewZapLogger(logCfg) diff --git a/integration-tests/xrpl.go b/integration-tests/xrpl.go index bbaf3426..d15a187b 100644 --- a/integration-tests/xrpl.go +++ b/integration-tests/xrpl.go @@ -192,9 +192,9 @@ func (c XRPLChain) FundAccount(ctx context.Context, t *testing.T, acc rippledata c.AutoFillTx(ctx, t, &fundXrpTx, fundingAcc) require.NoError(t, c.signer.Sign(&fundXrpTx, faucetKeyringKeyName)) - //t.Logf("Funding account, account address: %s, amount: %f", acc, amount) + t.Logf("Funding account, account address: %s, amount: %f", acc, amount) require.NoError(t, c.RPCClient().SubmitAndAwaitSuccess(ctx, &fundXrpTx)) - //t.Logf("The account %s is funded", acc) + t.Logf("The account %s is funded", acc) } // AutoFillSignAndSubmitTx autofills the transaction and submits it. diff --git a/integration-tests/xrpl/matching_test.go b/integration-tests/xrpl/matching_test.go deleted file mode 100644 index 31f2dc51..00000000 --- a/integration-tests/xrpl/matching_test.go +++ /dev/null @@ -1,339 +0,0 @@ -//go:build integrationtests -// +build integrationtests - -package xrpl_test - -import ( - "context" - "fmt" - "sort" - "strings" - "testing" - - rippledata "github.com/rubblelabs/ripple/data" - "github.com/samber/lo" - "github.com/stretchr/testify/require" - - integrationtests "github.com/CoreumFoundation/coreumbridge-xrpl/integration-tests" - "github.com/CoreumFoundation/coreumbridge-xrpl/relayer/xrpl" -) - -type Amount struct { - Value string - Currency string -} - -func NewAmount(value, currency string) Amount { - return Amount{ - Value: value, - Currency: currency, - } -} - -type Offer struct { - TakerPays Amount - TakerGets Amount - Account rippledata.Account -} - -func TestExchange(t *testing.T) { - - ctx, chains := integrationtests.NewTestingContext(t) - - acc1 := chains.XRPL.GenAccount(ctx, t, 100) - acc2 := chains.XRPL.GenAccount(ctx, t, 100) - acc3 := chains.XRPL.GenAccount(ctx, t, 100) - - // mapping to print balances with static names - accNames := map[string]rippledata.Account{ - "acc1": acc1, - "acc2": acc2, - "acc3": acc3, - } - - fooCurrency := "FOO" - barCurrency := "BAR" - - tickSize := uint8(3) - - type testCase struct { - name string - offers []Offer - } - tests := []testCase{ - { - name: "maker_receives_more", - offers: []Offer{ - { - TakerPays: NewAmount("3", fooCurrency), - TakerGets: NewAmount("7", barCurrency), // 3/7 ~= 0.4285714285 - Account: acc1, - }, - { - TakerPays: NewAmount("42.86", barCurrency), - TakerGets: NewAmount("100", fooCurrency), // 42.86/100 = 0.4286 - Account: acc2, - }, - // result - // acc1:0.006993006993006BAR, 3FOO - // acc2:97FOO, 6.993006993006994BAR - - // 3 / (7 - 0.006993006993006 ) - // (100 - 97) / 6.993006993006994 - }, - }, - { - name: "maker_receives_more", - offers: []Offer{ - { - TakerPays: NewAmount("0.000000000000003", fooCurrency), - TakerGets: NewAmount("0.000000000000007", barCurrency), // 0.000000000000003/0.000000000000007 ~= 0.4285714285 - Account: acc1, - }, - { - TakerPays: NewAmount("0.000000000040286", barCurrency), - TakerGets: NewAmount("0.000000000100000", fooCurrency), // 0.000000000040286/0.000000000100000 = 0.4286 - Account: acc2, - }, - // result - // acc1:3FOO, 6993006993006e-30BAR, 3e-15FOO - // acc2:97FOO, 99997e-15FOO, 6993006993006994e-30BAR - }, - }, - } - - for _, tt := range tests { - tt := tt - t.Run(tt.name, func(t *testing.T) { - // ------------------------------ EXECUTION ------------------------------ - - issuer := chains.XRPL.GenAccount(ctx, t, 100) - setUpIssuerAccount(ctx, t, chains, issuer, tickSize) - - currencies := make(map[rippledata.Currency]struct{}) - - t.Logf("----------Offers----------") - for _, offer := range tt.offers { - for accName, acc := range accNames { - if offer.Account.String() != acc.String() { - continue - } - t.Logf("Acc:%s, TakerPays:%s%s, TakerGets:%s%s", - accName, - offer.TakerPays.Value, offer.TakerPays.Currency, - offer.TakerGets.Value, offer.TakerGets.Currency, - ) - } - - takerPaysCurrency, err := rippledata.NewCurrency(offer.TakerPays.Currency) - require.NoError(t, err) - currencies[takerPaysCurrency] = struct{}{} - - takerGetsCurrency, err := rippledata.NewCurrency(offer.TakerGets.Currency) - require.NoError(t, err) - currencies[takerGetsCurrency] = struct{}{} - - setMaxTrustSet(ctx, t, chains, issuer, takerPaysCurrency, offer.Account) - setMaxTrustSet(ctx, t, chains, issuer, takerGetsCurrency, offer.Account) - // offer creator pays TakerGets amount - valueToFund, err := rippledata.NewValue(offer.TakerGets.Value, false) - require.NoError(t, err) - amountToFund := rippledata.Amount{ - Value: valueToFund, - Currency: takerGetsCurrency, - Issuer: issuer, - } - fundAccount(ctx, t, chains, offer.Account, amountToFund) - } - - t.Log("----------Balances before offers creation----------") - printBalances(ctx, t, chains, accNames, currencies, issuer) - - offerSequences := make(map[uint32]rippledata.Account, 0) - - for _, offer := range tt.offers { - offerTakerPaysValue, err := rippledata.NewValue(offer.TakerPays.Value, false) - require.NoError(t, err) - offerTakerPaysCurrency, err := rippledata.NewCurrency(offer.TakerPays.Currency) - require.NoError(t, err) - offerTakerPaysAmount := rippledata.Amount{ - Value: offerTakerPaysValue, - Currency: offerTakerPaysCurrency, - Issuer: issuer, - } - - offerTakerGetsValue, err := rippledata.NewValue(offer.TakerGets.Value, false) - require.NoError(t, err) - offerTakerGetsCurrency, err := rippledata.NewCurrency(offer.TakerGets.Currency) - require.NoError(t, err) - offerTakerGetsAmount := rippledata.Amount{ - Value: offerTakerGetsValue, - Currency: offerTakerGetsCurrency, - Issuer: issuer, - } - - offerSeq := createOffer(ctx, t, chains, offer.Account, offerTakerPaysAmount, offerTakerGetsAmount) - if offerSeq != nil { - offerSequences[*offerSeq] = offer.Account - } - } - - //t.Log("----------Balances after offers creation----------") - //printBalances(ctx, t, chains, accNames, currencies, issuer) - - // cancelling all offers - for offerSequence, acc := range offerSequences { - cancelOffer(ctx, t, chains, acc, offerSequence) - } - - t.Log("----------Balances after offers cancelling----------") - printBalances(ctx, t, chains, accNames, currencies, issuer) - }) - } -} - -func printBalances( - ctx context.Context, - t *testing.T, - chains integrationtests.Chains, - accNames map[string]rippledata.Account, - currencies map[rippledata.Currency]struct{}, issuer rippledata.Account) { - - accKeys := lo.Keys(accNames) - sort.Strings(accKeys) - - for _, name := range accKeys { - acc := accNames[name] - - balances := chains.XRPL.GetAccountBalances(ctx, t, acc) - results := make([]string, 0) - for currency := range currencies { - key := fmt.Sprintf("%s/%s", xrpl.ConvertCurrencyToString(currency), issuer.String()) - balance, ok := balances[key] - if !ok || balance.Value.IsZero() { - continue - } - results = append(results, fmt.Sprintf("%s%s", balance.Value.String(), currency)) - } - if len(results) == 0 { - continue - } - t.Logf("%s:%s", name, strings.Join(results, ", ")) - } -} - -func createOffer( - ctx context.Context, - t *testing.T, - chains integrationtests.Chains, - sender rippledata.Account, - takerPays rippledata.Amount, - takerGets rippledata.Amount, -) *uint32 { - offer1CreateTx := rippledata.OfferCreate{ - TakerPays: takerPays, - TakerGets: takerGets, - TxBase: rippledata.TxBase{ - TransactionType: rippledata.OFFER_CREATE, - }, - } - require.NoError(t, chains.XRPL.AutoFillSignAndSubmitTx(ctx, t, &offer1CreateTx, sender)) - - txRes, err := chains.XRPL.RPCClient().Tx(ctx, offer1CreateTx.Hash) - require.NoError(t, err) - - var offer1Seq *uint32 - for _, an := range txRes.MetaData.AffectedNodes { - createdNode := an.CreatedNode - if createdNode == nil { - continue - } - if createdNode.LedgerEntryType != rippledata.OFFER { - continue - } - offer, ok := createdNode.NewFields.(*rippledata.Offer) - if !ok { - panic("failed to cast tp *rippledata.Offer") - } - offer1Seq = offer.Sequence - } - - return offer1Seq -} - -func setUpIssuerAccount( - ctx context.Context, - t *testing.T, - chains integrationtests.Chains, - issuer rippledata.Account, - tickSize uint8, -) { - tx := rippledata.AccountSet{ - SetFlag: lo.ToPtr(uint32(rippledata.TxDefaultRipple)), - TxBase: rippledata.TxBase{ - TransactionType: rippledata.ACCOUNT_SET, - }, - TickSize: lo.ToPtr(uint8(tickSize)), - } - require.NoError(t, chains.XRPL.AutoFillSignAndSubmitTx(ctx, t, &tx, issuer)) -} - -func setMaxTrustSet( - ctx context.Context, - t *testing.T, - chains integrationtests.Chains, - issuer rippledata.Account, - currency rippledata.Currency, - accounts ...rippledata.Account, -) { - currencyTrustSetValue, err := rippledata.NewValue("10e80", false) - require.NoError(t, err) - - for _, acc := range accounts { - tx := rippledata.TrustSet{ - LimitAmount: rippledata.Amount{ - Value: currencyTrustSetValue, - Currency: currency, - Issuer: issuer, - }, - TxBase: rippledata.TxBase{ - TransactionType: rippledata.TRUST_SET, - Flags: lo.ToPtr(rippledata.TxSetNoRipple), - }, - } - require.NoError(t, chains.XRPL.AutoFillSignAndSubmitTx(ctx, t, &tx, acc)) - } -} - -func fundAccount( - ctx context.Context, - t *testing.T, - chains integrationtests.Chains, - recipientAcc rippledata.Account, - amount rippledata.Amount, -) { - tx := rippledata.Payment{ - Destination: recipientAcc, - Amount: amount, - TxBase: rippledata.TxBase{ - TransactionType: rippledata.PAYMENT, - }, - } - require.NoError(t, chains.XRPL.AutoFillSignAndSubmitTx(ctx, t, &tx, amount.Issuer)) -} - -func cancelOffer( - ctx context.Context, - t *testing.T, - chains integrationtests.Chains, - sender rippledata.Account, - offerSeq uint32, -) { - offer1CancelTx := rippledata.OfferCancel{ - TxBase: rippledata.TxBase{ - TransactionType: rippledata.OFFER_CANCEL, - }, - OfferSequence: offerSeq, - } - require.NoError(t, chains.XRPL.AutoFillSignAndSubmitTx(ctx, t, &offer1CancelTx, sender)) -} From 0da22a254cd9a208f54296e065db41c5bd3f781f Mon Sep 17 00:00:00 2001 From: Dzmitry Hil Date: Wed, 15 May 2024 13:18:02 +0300 Subject: [PATCH 3/4] Update crust version. --- .github/workflows/relayer-ci.yml | 2 +- build/go.mod | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/relayer-ci.yml b/.github/workflows/relayer-ci.yml index d1a84045..cc6615dc 100644 --- a/.github/workflows/relayer-ci.yml +++ b/.github/workflows/relayer-ci.yml @@ -71,7 +71,7 @@ jobs: with: repository: CoreumFoundation/crust path: crust - ref: 9e29fa9e7f52a0e8db70c1a1d43404de432bdac3 + ref: 66e0a14ecac37fe053780b6d814231bd98eb2240 - name: Checkout coreum uses: actions/checkout@v4 with: diff --git a/build/go.mod b/build/go.mod index 3f56f15f..556ccddd 100644 --- a/build/go.mod +++ b/build/go.mod @@ -4,7 +4,7 @@ go 1.21 require ( github.com/CoreumFoundation/coreum-tools v0.4.1-0.20240321120602-0a9c50facc68 - github.com/CoreumFoundation/crust/build v0.0.0-20240430120448-28dd7f5dacb7 + github.com/CoreumFoundation/crust/build v0.0.0-20240510112142-66e0a14ecac3 github.com/pkg/errors v0.9.1 ) From 49de90e2b9c263fb0dcbf33d93147ec11903e4ba Mon Sep 17 00:00:00 2001 From: Dzmitry Hil Date: Wed, 15 May 2024 13:47:38 +0300 Subject: [PATCH 4/4] Update coreum version. --- .github/workflows/relayer-ci.yml | 2 +- build/go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/relayer-ci.yml b/.github/workflows/relayer-ci.yml index cc6615dc..da37cb46 100644 --- a/.github/workflows/relayer-ci.yml +++ b/.github/workflows/relayer-ci.yml @@ -77,7 +77,7 @@ jobs: with: repository: CoreumFoundation/coreum path: coreum - ref: 4695973601fb222a90677c645e975f6a264238b6 + ref: 4e06879add40dc0a64c48a87f4b293c08b88f4d9 - name: Set up build system run: | echo "$(pwd)/coreumbridge-xrpl/bin" >> $GITHUB_PATH diff --git a/build/go.sum b/build/go.sum index 919f0e64..b561b774 100644 --- a/build/go.sum +++ b/build/go.sum @@ -2,8 +2,8 @@ github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8 github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/CoreumFoundation/coreum-tools v0.4.1-0.20240321120602-0a9c50facc68 h1:Tb9avuSQW3smVGrUnDh/Y+ML4eK802UsvJNZHsBgOGg= github.com/CoreumFoundation/coreum-tools v0.4.1-0.20240321120602-0a9c50facc68/go.mod h1:VD93vCHkxYaT/RhOesXTFgd/GQDW54tr0BqGi5JU1c0= -github.com/CoreumFoundation/crust/build v0.0.0-20240430120448-28dd7f5dacb7 h1:9MxrRBEPRuh3fBY0TIXFz4CPbwKEKojRupnxTcWmV60= -github.com/CoreumFoundation/crust/build v0.0.0-20240430120448-28dd7f5dacb7/go.mod h1:2jqmpvPVpODkfLXUWc2Fj9voIMloobAHFcbhNxbwGSc= +github.com/CoreumFoundation/crust/build v0.0.0-20240510112142-66e0a14ecac3 h1:L65Qcae4kbrnHOB94idYs7n5PYdfYDqCt1f8hgcmxGg= +github.com/CoreumFoundation/crust/build v0.0.0-20240510112142-66e0a14ecac3/go.mod h1:2jqmpvPVpODkfLXUWc2Fj9voIMloobAHFcbhNxbwGSc= github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=