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.

ingest/asset/asset.pb.go renamed to asset/asset.pb.go

Lines changed: 45 additions & 45 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

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

ingest/processors/asset_processor/asset.go renamed to processors/asset/asset.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"fmt"
55
"time"
66

7-
utils "github.com/stellar/go/ingest/processors/processor_utils"
7+
"github.com/stellar/go/processors/utils"
88
"github.com/stellar/go/toid"
99
"github.com/stellar/go/xdr"
1010
)

ingest/processors/asset_processor/asset_test.go renamed to processors/asset/asset_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/stretchr/testify/assert"
99

1010
"github.com/stellar/go/ingest"
11-
utils "github.com/stellar/go/ingest/processors/processor_utils"
11+
"github.com/stellar/go/processors/utils"
1212
"github.com/stellar/go/xdr"
1313
)
1414

ingest/processors/claimable_balance_processor/claimable_balance.go renamed to processors/claimable_balance/claimable_balance.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66

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

ingest/processors/claimable_balance_processor/claimable_balance_test.go renamed to processors/claimable_balance/claimable_balance_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/stretchr/testify/assert"
99

1010
"github.com/stellar/go/ingest"
11-
utils "github.com/stellar/go/ingest/processors/processor_utils"
11+
"github.com/stellar/go/processors/utils"
1212
"github.com/stellar/go/xdr"
1313
)
1414

ingest/processors/config_setting_processor/config_setting.go renamed to processors/config_setting/config_setting.go

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

88
"github.com/stellar/go/ingest"
9-
utils "github.com/stellar/go/ingest/processors/processor_utils"
9+
"github.com/stellar/go/processors/utils"
1010
"github.com/stellar/go/xdr"
1111
)
1212

ingest/processors/contract_processor/contract_code.go renamed to processors/contract/contract_code.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"time"
66

77
"github.com/stellar/go/ingest"
8-
utils "github.com/stellar/go/ingest/processors/processor_utils"
8+
"github.com/stellar/go/processors/utils"
99
"github.com/stellar/go/xdr"
1010
)
1111

ingest/processors/contract_processor/contract_data.go renamed to processors/contract/contract_data.go

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

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/strkey"
1212
"github.com/stellar/go/xdr"
1313
)

ingest/processors/contract_processor/contract_events.go renamed to processors/contract/contract_events.go

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

88
"github.com/stellar/go/ingest"
9-
utils "github.com/stellar/go/ingest/processors/processor_utils"
9+
"github.com/stellar/go/processors/utils"
1010
"github.com/stellar/go/strkey"
1111
"github.com/stellar/go/toid"
1212
"github.com/stellar/go/xdr"

ingest/processors/contract_processor/ttl.go renamed to processors/contract/ttl.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"time"
66

77
"github.com/stellar/go/ingest"
8-
utils "github.com/stellar/go/ingest/processors/processor_utils"
8+
"github.com/stellar/go/processors/utils"
99
"github.com/stellar/go/xdr"
1010
)
1111

ingest/processors/effects_processor/effects.go renamed to processors/effects/effects.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package effect
1+
package effects
22

33
import (
44
"encoding/base64"
@@ -12,9 +12,9 @@ import (
1212
"github.com/guregu/null"
1313
"github.com/stellar/go/amount"
1414
"github.com/stellar/go/ingest"
15-
operations "github.com/stellar/go/ingest/processors/operation_processor"
16-
utils "github.com/stellar/go/ingest/processors/processor_utils"
1715
"github.com/stellar/go/keypair"
16+
operations "github.com/stellar/go/processors/operation"
17+
"github.com/stellar/go/processors/utils"
1818
"github.com/stellar/go/protocols/horizon/base"
1919
"github.com/stellar/go/strkey"
2020
"github.com/stellar/go/support/contractevents"

0 commit comments

Comments
 (0)