Skip to content

Commit 17fd7aa

Browse files
Merge pull request #5706 from stellar/karthik/2023-0-21/merge-master-into-p23
Merge `master` into `protocol-23` feature branch
2 parents 43708bf + d0335c8 commit 17fd7aa

File tree

97 files changed

+520
-362
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

97 files changed

+520
-362
lines changed

.github/workflows/horizon.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ jobs:
123123
runs-on: ubuntu-22.04
124124
env:
125125
GO_VERSION: 1.23.4
126-
STELLAR_CORE_VERSION: 22.1.1-2291.a50f3f919.jammy~do~not~use~in~prd
126+
STELLAR_CORE_VERSION: 23.0.0.1-2488.23.0.0rc.1.472e3e69d.jammy
127127
CAPTIVE_CORE_STORAGE_PATH: /tmp
128128
steps:
129129
- uses: actions/checkout@v3
File renamed without changes.
Lines changed: 45 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

ingest/ledger_transaction.go

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -270,13 +270,7 @@ func (t *LedgerTransaction) FeeCharged() (int64, bool) {
270270
_, ok = t.GetSorobanData()
271271
if ok {
272272
if uint32(t.Ledger.LedgerHeaderHistoryEntry().Header.LedgerVersion) < 21 && t.Envelope.Type == xdr.EnvelopeTypeEnvelopeTypeTxFeeBump {
273-
var resourceFeeRefund int64
274-
275-
resourceFeeRefund, ok = t.SorobanResourceFeeRefund()
276-
if !ok {
277-
return 0, false
278-
}
279-
273+
resourceFeeRefund := t.SorobanResourceFeeRefund()
280274
return int64(t.Result.Result.FeeCharged) - resourceFeeRefund, true
281275
}
282276
}
@@ -395,6 +389,11 @@ func (t *LedgerTransaction) GetSorobanData() (xdr.SorobanTransactionData, bool)
395389
}
396390
}
397391

392+
func (t *LedgerTransaction) IsSorobanTx() bool {
393+
_, res := t.GetSorobanData()
394+
return res
395+
}
396+
398397
func (t *LedgerTransaction) SorobanResourceFee() (int64, bool) {
399398
sorobanData, ok := t.GetSorobanData()
400399
if !ok {
@@ -547,21 +546,23 @@ func getAccountBalanceFromLedgerEntryChanges(changes xdr.LedgerEntryChanges, sou
547546
return accountBalanceStart, accountBalanceEnd
548547
}
549548

550-
func (t *LedgerTransaction) SorobanResourceFeeRefund() (int64, bool) {
551-
meta, ok := t.UnsafeMeta.GetV3()
552-
if !ok {
553-
return 0, false
549+
func (t *LedgerTransaction) OriginalFeeCharged() int64 {
550+
startingBal, endingBal := getAccountBalanceFromLedgerEntryChanges(t.FeeChanges, t.FeeAccount().ToAccountId().Address())
551+
if endingBal > startingBal {
552+
panic("Invalid Fee")
554553
}
554+
return startingBal - endingBal
555+
}
555556

556-
feeAccountAddress, ok := t.FeeAccountAddress()
557-
if !ok {
558-
return 0, false
557+
func (t *LedgerTransaction) SorobanResourceFeeRefund() int64 {
558+
if !t.IsSorobanTx() {
559+
return 0
559560
}
560-
561-
accountBalanceStart, accountBalanceEnd := getAccountBalanceFromLedgerEntryChanges(meta.TxChangesAfter, feeAccountAddress)
562-
563-
return accountBalanceEnd - accountBalanceStart, true
564-
561+
startingBal, endingBal := getAccountBalanceFromLedgerEntryChanges(t.UnsafeMeta.MustV3().TxChangesAfter, t.FeeAccount().ToAccountId().Address())
562+
if startingBal > endingBal {
563+
panic("Invalid Soroban Resource Refund")
564+
}
565+
return endingBal - startingBal
565566
}
566567

567568
func (t *LedgerTransaction) SorobanTotalNonRefundableResourceFeeCharged() (int64, bool) {

ingest/ledger_transaction_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -897,8 +897,7 @@ func TestTransactionHelperFunctions(t *testing.T) {
897897
assert.Equal(t, int64(-1234), inclusionFee)
898898

899899
var sorobanResourceFeeRefund int64
900-
sorobanResourceFeeRefund, ok = transaction.SorobanResourceFeeRefund()
901-
assert.Equal(t, true, ok)
900+
sorobanResourceFeeRefund = transaction.SorobanResourceFeeRefund()
902901
assert.Equal(t, int64(0), sorobanResourceFeeRefund)
903902

904903
var sorobanTotalNonRefundableResourceFeeCharged int64

ingest/tutorial/ttp-example/extract_ledger_ttp_events.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import (
55
"io"
66
"os"
77

8-
"github.com/stellar/go/ingest/processors/token_transfer"
98
"github.com/stellar/go/network"
9+
"github.com/stellar/go/processors/token_transfer"
1010
"github.com/stellar/go/support/log"
1111
"github.com/stellar/go/xdr"
1212
"google.golang.org/protobuf/encoding/protojson"

ingest/processors/account_processor/account.go renamed to processors/account/account.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"github.com/guregu/null"
88
"github.com/guregu/null/zero"
99
"github.com/stellar/go/ingest"
10-
utils "github.com/stellar/go/ingest/processors/processor_utils"
10+
"github.com/stellar/go/processors/utils"
1111
"github.com/stellar/go/xdr"
1212
)
1313

ingest/processors/account_processor/account_signer.go renamed to processors/account/account_signer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77

88
"github.com/guregu/null"
99
"github.com/stellar/go/ingest"
10-
utils "github.com/stellar/go/ingest/processors/processor_utils"
10+
"github.com/stellar/go/processors/utils"
1111
"github.com/stellar/go/xdr"
1212
)
1313

File renamed without changes.

0 commit comments

Comments
 (0)