From a919e96885939e7b6b8fbb93758a028dee4c4c51 Mon Sep 17 00:00:00 2001 From: hunterpack Date: Mon, 6 Apr 2026 14:34:23 -0500 Subject: [PATCH 1/3] initial p26 updates --- internal/transform/config_setting.go | 110 ++++++++++ internal/transform/config_setting_test.go | 251 ++++++++++++++++------ internal/transform/parquet_converter.go | 13 ++ internal/transform/schema.go | 13 ++ internal/transform/schema_parquet.go | 13 ++ 5 files changed, 336 insertions(+), 64 deletions(-) diff --git a/internal/transform/config_setting.go b/internal/transform/config_setting.go index 1c01571a..ccc4e493 100644 --- a/internal/transform/config_setting.go +++ b/internal/transform/config_setting.go @@ -1,6 +1,9 @@ package transform import ( + "encoding/base64" + "encoding/hex" + "encoding/json" "fmt" "strconv" @@ -106,6 +109,34 @@ func TransformConfigSetting(ledgerChange ingest.Change, header xdr.LedgerHeaderH liveSorobanStateSizeWindow = append(liveSorobanStateSizeWindow, uint64(sizeWindow)) } + // P23: ContractParallelCompute (ID=14) + contractParallelCompute, _ := configSetting.GetContractParallelCompute() + ledgerMaxDependentTxClusters := contractParallelCompute.LedgerMaxDependentTxClusters + + // P23: ContractLedgerCostExt (ID=15) - TxMaxFootprintEntries + txMaxFootprintEntries := contractLedgerCostV0.TxMaxFootprintEntries + + // P23: ContractScpTiming (ID=16) + contractScpTiming, _ := configSetting.GetContractScpTiming() + ledgerTargetCloseTimeMilliseconds := contractScpTiming.LedgerTargetCloseTimeMilliseconds + nominationTimeoutInitialMilliseconds := contractScpTiming.NominationTimeoutInitialMilliseconds + nominationTimeoutIncrementMilliseconds := contractScpTiming.NominationTimeoutIncrementMilliseconds + ballotTimeoutInitialMilliseconds := contractScpTiming.BallotTimeoutInitialMilliseconds + ballotTimeoutIncrementMilliseconds := contractScpTiming.BallotTimeoutIncrementMilliseconds + + // P26 CAP-77: Frozen ledger keys (IDs 17-20) + frozenLedgerKeys, _ := configSetting.GetFrozenLedgerKeys() + frozenLedgerKeysJSON := serializeEncodedLedgerKeys(frozenLedgerKeys.Keys) + + frozenLedgerKeysDelta, _ := configSetting.GetFrozenLedgerKeysDelta() + frozenLedgerKeysDeltaJSON := serializeFrozenKeysDelta(frozenLedgerKeysDelta) + + freezeBypassTxs, _ := configSetting.GetFreezeBypassTxs() + freezeBypassTxsJSON := serializeHashes(freezeBypassTxs.TxHashes) + + freezeBypassTxsDelta, _ := configSetting.GetFreezeBypassTxsDelta() + freezeBypassTxsDeltaJSON := serializeFreezeBypassTxsDelta(freezeBypassTxsDelta) + closedAt, err := utils.TimePointToUTCTimeStamp(header.Header.ScpValue.CloseTime) if err != nil { return ConfigSettingOutput{}, err @@ -170,6 +201,19 @@ func TransformConfigSetting(ledgerChange ingest.Change, header xdr.LedgerHeaderH LedgerMaxTxCount: uint32(ledgerMaxTxCount), BucketListSizeWindow: bucketListSizeWindow, LiveSorobanStateSizeWindow: liveSorobanStateSizeWindow, + // P23 config settings + LedgerMaxDependentTxClusters: uint32(ledgerMaxDependentTxClusters), + TxMaxFootprintEntries: uint32(txMaxFootprintEntries), + LedgerTargetCloseTimeMilliseconds: uint32(ledgerTargetCloseTimeMilliseconds), + NominationTimeoutInitialMilliseconds: uint32(nominationTimeoutInitialMilliseconds), + NominationTimeoutIncrementMilliseconds: uint32(nominationTimeoutIncrementMilliseconds), + BallotTimeoutInitialMilliseconds: uint32(ballotTimeoutInitialMilliseconds), + BallotTimeoutIncrementMilliseconds: uint32(ballotTimeoutIncrementMilliseconds), + // P26 CAP-77 frozen ledger keys + FrozenLedgerKeys: frozenLedgerKeysJSON, + FrozenLedgerKeysDelta: frozenLedgerKeysDeltaJSON, + FreezeBypassTxs: freezeBypassTxsJSON, + FreezeBypassTxsDelta: freezeBypassTxsDeltaJSON, LastModifiedLedger: uint32(ledgerEntry.LastModifiedLedgerSeq), LedgerEntryChange: uint32(changeType), Deleted: outputDeleted, @@ -191,3 +235,69 @@ func serializeParams(costParams xdr.ContractCostParams) []map[string]string { return params } + +// serializeEncodedLedgerKeys converts a slice of EncodedLedgerKey (opaque bytes) to a JSON array of base64 strings. +func serializeEncodedLedgerKeys(keys []xdr.EncodedLedgerKey) string { + if len(keys) == 0 { + return "" + } + encoded := make([]string, 0, len(keys)) + for _, key := range keys { + encoded = append(encoded, base64.StdEncoding.EncodeToString(key)) + } + result, _ := json.Marshal(encoded) + return string(result) +} + +// serializeFrozenKeysDelta converts a FrozenLedgerKeysDelta to a JSON object with keysToFreeze and keysToUnfreeze arrays. +func serializeFrozenKeysDelta(delta xdr.FrozenLedgerKeysDelta) string { + if len(delta.KeysToFreeze) == 0 && len(delta.KeysToUnfreeze) == 0 { + return "" + } + freeze := make([]string, 0, len(delta.KeysToFreeze)) + for _, key := range delta.KeysToFreeze { + freeze = append(freeze, base64.StdEncoding.EncodeToString(key)) + } + unfreeze := make([]string, 0, len(delta.KeysToUnfreeze)) + for _, key := range delta.KeysToUnfreeze { + unfreeze = append(unfreeze, base64.StdEncoding.EncodeToString(key)) + } + result, _ := json.Marshal(map[string][]string{ + "keys_to_freeze": freeze, + "keys_to_unfreeze": unfreeze, + }) + return string(result) +} + +// serializeHashes converts a slice of Hash ([32]byte) to a JSON array of hex strings. +func serializeHashes(hashes []xdr.Hash) string { + if len(hashes) == 0 { + return "" + } + encoded := make([]string, 0, len(hashes)) + for _, h := range hashes { + encoded = append(encoded, hex.EncodeToString(h[:])) + } + result, _ := json.Marshal(encoded) + return string(result) +} + +// serializeFreezeBypassTxsDelta converts a FreezeBypassTxsDelta to a JSON object with addTxs and removeTxs arrays. +func serializeFreezeBypassTxsDelta(delta xdr.FreezeBypassTxsDelta) string { + if len(delta.AddTxs) == 0 && len(delta.RemoveTxs) == 0 { + return "" + } + addTxs := make([]string, 0, len(delta.AddTxs)) + for _, h := range delta.AddTxs { + addTxs = append(addTxs, hex.EncodeToString(h[:])) + } + removeTxs := make([]string, 0, len(delta.RemoveTxs)) + for _, h := range delta.RemoveTxs { + removeTxs = append(removeTxs, hex.EncodeToString(h[:])) + } + result, _ := json.Marshal(map[string][]string{ + "add_txs": addTxs, + "remove_txs": removeTxs, + }) + return string(result) +} diff --git a/internal/transform/config_setting_test.go b/internal/transform/config_setting_test.go index 4bcb4816..b3767910 100644 --- a/internal/transform/config_setting_test.go +++ b/internal/transform/config_setting_test.go @@ -73,6 +73,56 @@ func makeConfigSettingTestInput() []ingest.Change { }, } + // P23: ContractParallelCompute (ID=14) + parallelCompute := xdr.ConfigSettingContractParallelComputeV0{ + LedgerMaxDependentTxClusters: 5, + } + parallelComputeEntry := xdr.LedgerEntry{ + LastModifiedLedgerSeq: 24229504, + Data: xdr.LedgerEntryData{ + Type: xdr.LedgerEntryTypeConfigSetting, + ConfigSetting: &xdr.ConfigSettingEntry{ + ConfigSettingId: xdr.ConfigSettingIdConfigSettingContractParallelCompute, + ContractParallelCompute: ¶llelCompute, + }, + }, + } + + // P23: ContractLedgerCostExt (ID=15) + ledgerCostExt := xdr.ConfigSettingContractLedgerCostExtV0{ + TxMaxFootprintEntries: 100, + FeeWrite1Kb: 2000, + } + ledgerCostExtEntry := xdr.LedgerEntry{ + LastModifiedLedgerSeq: 24229505, + Data: xdr.LedgerEntryData{ + Type: xdr.LedgerEntryTypeConfigSetting, + ConfigSetting: &xdr.ConfigSettingEntry{ + ConfigSettingId: xdr.ConfigSettingIdConfigSettingContractLedgerCostExt, + ContractLedgerCostExt: &ledgerCostExt, + }, + }, + } + + // P23: ContractScpTiming (ID=16) + scpTiming := xdr.ConfigSettingScpTiming{ + LedgerTargetCloseTimeMilliseconds: 5000, + NominationTimeoutInitialMilliseconds: 1000, + NominationTimeoutIncrementMilliseconds: 500, + BallotTimeoutInitialMilliseconds: 1000, + BallotTimeoutIncrementMilliseconds: 1000, + } + scpTimingEntry := xdr.LedgerEntry{ + LastModifiedLedgerSeq: 24229506, + Data: xdr.LedgerEntryData{ + Type: xdr.LedgerEntryTypeConfigSetting, + ConfigSetting: &xdr.ConfigSettingEntry{ + ConfigSettingId: xdr.ConfigSettingIdConfigSettingContractScpTiming, + ContractScpTiming: &scpTiming, + }, + }, + } + return []ingest.Change{ { ChangeType: xdr.LedgerEntryChangeTypeLedgerEntryUpdated, @@ -80,6 +130,24 @@ func makeConfigSettingTestInput() []ingest.Change { Pre: &xdr.LedgerEntry{}, Post: &contractDataLedgerEntry, }, + { + ChangeType: xdr.LedgerEntryChangeTypeLedgerEntryCreated, + Type: xdr.LedgerEntryTypeConfigSetting, + Pre: nil, + Post: ¶llelComputeEntry, + }, + { + ChangeType: xdr.LedgerEntryChangeTypeLedgerEntryCreated, + Type: xdr.LedgerEntryTypeConfigSetting, + Pre: nil, + Post: &ledgerCostExtEntry, + }, + { + ChangeType: xdr.LedgerEntryChangeTypeLedgerEntryCreated, + Type: xdr.LedgerEntryTypeConfigSetting, + Pre: nil, + Post: &scpTimingEntry, + }, } } @@ -87,70 +155,125 @@ func makeConfigSettingTestOutput() []ConfigSettingOutput { contractMapType := make([]map[string]string, 0) bucket := make([]uint64, 0) + // Base output with all zero values (for ContractMaxSizeBytes test) + baseOutput := ConfigSettingOutput{ + ConfigSettingId: 0, + ContractMaxSizeBytes: 0, + LedgerMaxInstructions: 0, + TxMaxInstructions: 0, + FeeRatePerInstructionsIncrement: 0, + TxMemoryLimit: 0, + LedgerMaxReadLedgerEntries: 0, + LedgerMaxDiskReadEntries: 0, + LedgerMaxReadBytes: 0, + LedgerMaxDiskReadBytes: 0, + LedgerMaxWriteLedgerEntries: 0, + LedgerMaxWriteBytes: 0, + TxMaxReadLedgerEntries: 0, + TxMaxDiskReadEntries: 0, + TxMaxReadBytes: 0, + TxMaxDiskReadBytes: 0, + TxMaxWriteLedgerEntries: 0, + TxMaxWriteBytes: 0, + FeeReadLedgerEntry: 0, + FeeDiskReadLedgerEntry: 0, + FeeWriteLedgerEntry: 0, + FeeRead1Kb: 0, + FeeWrite1Kb: 0, + FeeDiskRead1Kb: 0, + BucketListTargetSizeBytes: 0, + SorobanStateTargetSizeBytes: 0, + WriteFee1KbBucketListLow: 0, + RentFee1KBSorobanStateSizeLow: 0, + WriteFee1KbBucketListHigh: 0, + RentFee1KBSorobanStateSizeHigh: 0, + BucketListWriteFeeGrowthFactor: 0, + SorobanStateRentFeeGrowthFactor: 0, + FeeHistorical1Kb: 0, + TxMaxContractEventsSizeBytes: 0, + FeeContractEvents1Kb: 0, + LedgerMaxTxsSizeBytes: 0, + TxMaxSizeBytes: 0, + FeeTxSize1Kb: 0, + ContractCostParamsCpuInsns: contractMapType, + ContractCostParamsMemBytes: contractMapType, + ContractDataKeySizeBytes: 0, + ContractDataEntrySizeBytes: 0, + MaxEntryTtl: 0, + MinTemporaryTtl: 0, + MinPersistentTtl: 0, + AutoBumpLedgers: 0, + PersistentRentRateDenominator: 0, + TempRentRateDenominator: 0, + MaxEntriesToArchive: 0, + BucketListSizeWindowSampleSize: 0, + LiveSorobanStateSizeWindowSampleSize: 0, + LiveSorobanStateSizeWindowSamplePeriod: 0, + EvictionScanSize: 0, + StartingEvictionScanLevel: 0, + LedgerMaxTxCount: 0, + BucketListSizeWindow: bucket, + LiveSorobanStateSizeWindow: bucket, + LedgerMaxDependentTxClusters: 0, + TxMaxFootprintEntries: 0, + LedgerTargetCloseTimeMilliseconds: 0, + NominationTimeoutInitialMilliseconds: 0, + NominationTimeoutIncrementMilliseconds: 0, + BallotTimeoutInitialMilliseconds: 0, + BallotTimeoutIncrementMilliseconds: 0, + FrozenLedgerKeys: "", + FrozenLedgerKeysDelta: "", + FreezeBypassTxs: "", + FreezeBypassTxsDelta: "", + LastModifiedLedger: 24229503, + LedgerEntryChange: 1, + Deleted: false, + LedgerSequence: 10, + ClosedAt: time.Date(1970, time.January, 1, 0, 16, 40, 0, time.UTC), + } + + // P23: ContractParallelCompute output + parallelComputeOutput := baseOutput + parallelComputeOutput.ConfigSettingId = 14 + parallelComputeOutput.LedgerMaxDependentTxClusters = 5 + parallelComputeOutput.LastModifiedLedger = 24229504 + parallelComputeOutput.LedgerEntryChange = 0 + parallelComputeOutput.ContractCostParamsCpuInsns = contractMapType + parallelComputeOutput.ContractCostParamsMemBytes = contractMapType + parallelComputeOutput.BucketListSizeWindow = bucket + parallelComputeOutput.LiveSorobanStateSizeWindow = bucket + + // P23: ContractLedgerCostExt output + ledgerCostExtOutput := baseOutput + ledgerCostExtOutput.ConfigSettingId = 15 + ledgerCostExtOutput.TxMaxFootprintEntries = 100 + ledgerCostExtOutput.FeeWrite1Kb = 2000 + ledgerCostExtOutput.LastModifiedLedger = 24229505 + ledgerCostExtOutput.LedgerEntryChange = 0 + ledgerCostExtOutput.ContractCostParamsCpuInsns = contractMapType + ledgerCostExtOutput.ContractCostParamsMemBytes = contractMapType + ledgerCostExtOutput.BucketListSizeWindow = bucket + ledgerCostExtOutput.LiveSorobanStateSizeWindow = bucket + + // P23: ContractScpTiming output + scpTimingOutput := baseOutput + scpTimingOutput.ConfigSettingId = 16 + scpTimingOutput.LedgerTargetCloseTimeMilliseconds = 5000 + scpTimingOutput.NominationTimeoutInitialMilliseconds = 1000 + scpTimingOutput.NominationTimeoutIncrementMilliseconds = 500 + scpTimingOutput.BallotTimeoutInitialMilliseconds = 1000 + scpTimingOutput.BallotTimeoutIncrementMilliseconds = 1000 + scpTimingOutput.LastModifiedLedger = 24229506 + scpTimingOutput.LedgerEntryChange = 0 + scpTimingOutput.ContractCostParamsCpuInsns = contractMapType + scpTimingOutput.ContractCostParamsMemBytes = contractMapType + scpTimingOutput.BucketListSizeWindow = bucket + scpTimingOutput.LiveSorobanStateSizeWindow = bucket + return []ConfigSettingOutput{ - { - ConfigSettingId: 0, - ContractMaxSizeBytes: 0, - LedgerMaxInstructions: 0, - TxMaxInstructions: 0, - FeeRatePerInstructionsIncrement: 0, - TxMemoryLimit: 0, - LedgerMaxReadLedgerEntries: 0, - LedgerMaxDiskReadEntries: 0, - LedgerMaxReadBytes: 0, - LedgerMaxDiskReadBytes: 0, - LedgerMaxWriteLedgerEntries: 0, - LedgerMaxWriteBytes: 0, - TxMaxReadLedgerEntries: 0, - TxMaxDiskReadEntries: 0, - TxMaxReadBytes: 0, - TxMaxDiskReadBytes: 0, - TxMaxWriteLedgerEntries: 0, - TxMaxWriteBytes: 0, - FeeReadLedgerEntry: 0, - FeeDiskReadLedgerEntry: 0, - FeeWriteLedgerEntry: 0, - FeeRead1Kb: 0, - FeeWrite1Kb: 0, - FeeDiskRead1Kb: 0, - BucketListTargetSizeBytes: 0, - SorobanStateTargetSizeBytes: 0, - WriteFee1KbBucketListLow: 0, - RentFee1KBSorobanStateSizeLow: 0, - WriteFee1KbBucketListHigh: 0, - RentFee1KBSorobanStateSizeHigh: 0, - BucketListWriteFeeGrowthFactor: 0, - SorobanStateRentFeeGrowthFactor: 0, - FeeHistorical1Kb: 0, - TxMaxContractEventsSizeBytes: 0, - FeeContractEvents1Kb: 0, - LedgerMaxTxsSizeBytes: 0, - TxMaxSizeBytes: 0, - FeeTxSize1Kb: 0, - ContractCostParamsCpuInsns: contractMapType, - ContractCostParamsMemBytes: contractMapType, - ContractDataKeySizeBytes: 0, - ContractDataEntrySizeBytes: 0, - MaxEntryTtl: 0, - MinTemporaryTtl: 0, - MinPersistentTtl: 0, - AutoBumpLedgers: 0, - PersistentRentRateDenominator: 0, - TempRentRateDenominator: 0, - MaxEntriesToArchive: 0, - BucketListSizeWindowSampleSize: 0, - LiveSorobanStateSizeWindowSampleSize: 0, - LiveSorobanStateSizeWindowSamplePeriod: 0, - EvictionScanSize: 0, - StartingEvictionScanLevel: 0, - LedgerMaxTxCount: 0, - BucketListSizeWindow: bucket, - LiveSorobanStateSizeWindow: bucket, - LastModifiedLedger: 24229503, - LedgerEntryChange: 1, - Deleted: false, - LedgerSequence: 10, - ClosedAt: time.Date(1970, time.January, 1, 0, 16, 40, 0, time.UTC), - }, + baseOutput, + parallelComputeOutput, + ledgerCostExtOutput, + scpTimingOutput, } } diff --git a/internal/transform/parquet_converter.go b/internal/transform/parquet_converter.go index 1b863aa4..ac88ef17 100644 --- a/internal/transform/parquet_converter.go +++ b/internal/transform/parquet_converter.go @@ -402,6 +402,19 @@ func (cso ConfigSettingOutput) ToParquet() interface{} { LedgerMaxTxCount: int64(cso.LedgerMaxTxCount), BucketListSizeWindow: BucketListSizeWindowInt, LiveSorobanStateSizeWindow: BucketListSizeWindowInt, + // P23 config settings + LedgerMaxDependentTxClusters: int64(cso.LedgerMaxDependentTxClusters), + TxMaxFootprintEntries: int64(cso.TxMaxFootprintEntries), + LedgerTargetCloseTimeMilliseconds: int64(cso.LedgerTargetCloseTimeMilliseconds), + NominationTimeoutInitialMilliseconds: int64(cso.NominationTimeoutInitialMilliseconds), + NominationTimeoutIncrementMilliseconds: int64(cso.NominationTimeoutIncrementMilliseconds), + BallotTimeoutInitialMilliseconds: int64(cso.BallotTimeoutInitialMilliseconds), + BallotTimeoutIncrementMilliseconds: int64(cso.BallotTimeoutIncrementMilliseconds), + // P26 CAP-77 frozen ledger keys + FrozenLedgerKeys: cso.FrozenLedgerKeys, + FrozenLedgerKeysDelta: cso.FrozenLedgerKeysDelta, + FreezeBypassTxs: cso.FreezeBypassTxs, + FreezeBypassTxsDelta: cso.FreezeBypassTxsDelta, LastModifiedLedger: int64(cso.LastModifiedLedger), LedgerEntryChange: int64(cso.LedgerEntryChange), Deleted: cso.Deleted, diff --git a/internal/transform/schema.go b/internal/transform/schema.go index 8b76b861..b58739a3 100644 --- a/internal/transform/schema.go +++ b/internal/transform/schema.go @@ -619,6 +619,19 @@ type ConfigSettingOutput struct { LedgerMaxTxCount uint32 `json:"ledger_max_tx_count"` BucketListSizeWindow []uint64 `json:"bucket_list_size_window"` LiveSorobanStateSizeWindow []uint64 `json:"live_soroban_state_size_window"` + // P23 config settings + LedgerMaxDependentTxClusters uint32 `json:"ledger_max_dependent_tx_clusters"` + TxMaxFootprintEntries uint32 `json:"tx_max_footprint_entries"` + LedgerTargetCloseTimeMilliseconds uint32 `json:"ledger_target_close_time_milliseconds"` + NominationTimeoutInitialMilliseconds uint32 `json:"nomination_timeout_initial_milliseconds"` + NominationTimeoutIncrementMilliseconds uint32 `json:"nomination_timeout_increment_milliseconds"` + BallotTimeoutInitialMilliseconds uint32 `json:"ballot_timeout_initial_milliseconds"` + BallotTimeoutIncrementMilliseconds uint32 `json:"ballot_timeout_increment_milliseconds"` + // P26 CAP-77 frozen ledger keys + FrozenLedgerKeys string `json:"frozen_ledger_keys"` + FrozenLedgerKeysDelta string `json:"frozen_ledger_keys_delta"` + FreezeBypassTxs string `json:"freeze_bypass_txs"` + FreezeBypassTxsDelta string `json:"freeze_bypass_txs_delta"` LastModifiedLedger uint32 `json:"last_modified_ledger"` LedgerEntryChange uint32 `json:"ledger_entry_change"` Deleted bool `json:"deleted"` diff --git a/internal/transform/schema_parquet.go b/internal/transform/schema_parquet.go index 829ab047..26fa0ebe 100644 --- a/internal/transform/schema_parquet.go +++ b/internal/transform/schema_parquet.go @@ -361,6 +361,19 @@ type ConfigSettingOutputParquet struct { LedgerMaxTxCount int64 `parquet:"name=ledger_max_tx_count, type=INT64, convertedtype=UINT_64"` BucketListSizeWindow []int64 `parquet:"name=bucket_list_size_window, type=INT64, repetitiontype=REPEATED"` LiveSorobanStateSizeWindow []int64 `parquet:"name=live_soroban_state_size_window, type=INT64, repetitiontype=REPEATED"` + // P23 config settings + LedgerMaxDependentTxClusters int64 `parquet:"name=ledger_max_dependent_tx_clusters, type=INT64, convertedtype=UINT_64"` + TxMaxFootprintEntries int64 `parquet:"name=tx_max_footprint_entries, type=INT64, convertedtype=UINT_64"` + LedgerTargetCloseTimeMilliseconds int64 `parquet:"name=ledger_target_close_time_milliseconds, type=INT64, convertedtype=UINT_64"` + NominationTimeoutInitialMilliseconds int64 `parquet:"name=nomination_timeout_initial_milliseconds, type=INT64, convertedtype=UINT_64"` + NominationTimeoutIncrementMilliseconds int64 `parquet:"name=nomination_timeout_increment_milliseconds, type=INT64, convertedtype=UINT_64"` + BallotTimeoutInitialMilliseconds int64 `parquet:"name=ballot_timeout_initial_milliseconds, type=INT64, convertedtype=UINT_64"` + BallotTimeoutIncrementMilliseconds int64 `parquet:"name=ballot_timeout_increment_milliseconds, type=INT64, convertedtype=UINT_64"` + // P26 CAP-77 frozen ledger keys + FrozenLedgerKeys string `parquet:"name=frozen_ledger_keys, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"` + FrozenLedgerKeysDelta string `parquet:"name=frozen_ledger_keys_delta, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"` + FreezeBypassTxs string `parquet:"name=freeze_bypass_txs, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"` + FreezeBypassTxsDelta string `parquet:"name=freeze_bypass_txs_delta, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"` LastModifiedLedger int64 `parquet:"name=last_modified_ledger, type=INT64, convertedtype=UINT_64"` LedgerEntryChange int64 `parquet:"name=ledger_entry_change, type=INT64, convertedtype=UINT_64"` Deleted bool `parquet:"name=deleted, type=BOOLEAN"` From 8d05423c98fdf73342c686c6717e816bc8a2a0b5 Mon Sep 17 00:00:00 2001 From: hunterpack Date: Mon, 6 Apr 2026 14:58:26 -0500 Subject: [PATCH 2/3] update sdk version --- go.mod | 4 ++-- go.sum | 8 ++++---- internal/transform/config_setting_test.go | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/go.mod b/go.mod index 8bb69c12..2af1018e 100644 --- a/go.mod +++ b/go.mod @@ -13,7 +13,7 @@ require ( github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.17.0 - github.com/stellar/go-stellar-sdk v0.0.0-20251211085638-ba09a6a91775 + github.com/stellar/go-stellar-sdk v0.0.0-20260325174035-031e5bfdc4bd github.com/stellar/go-stellar-xdr-json v0.0.0-20250826185517-ee4033414d38 github.com/stretchr/testify v1.10.0 github.com/xitongsys/parquet-go v1.6.2 @@ -91,7 +91,7 @@ require ( github.com/sourcegraph/conc v0.3.0 // indirect github.com/spf13/afero v1.10.0 // indirect github.com/spf13/cast v1.5.1 // indirect - github.com/stellar/go-xdr v0.0.0-20231122183749-b53fb00bcac2 // indirect + github.com/stellar/go-xdr v0.0.0-20260312225820-cc2b0611aabf // indirect github.com/stretchr/objx v0.5.2 // indirect github.com/subosito/gotenv v1.6.0 // indirect go.opencensus.io v0.24.0 // indirect diff --git a/go.sum b/go.sum index 4df33d6e..eb8d2baa 100644 --- a/go.sum +++ b/go.sum @@ -673,12 +673,12 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.17.0 h1:I5txKw7MJasPL/BrfkbA0Jyo/oELqVmux4pR/UxOMfI= github.com/spf13/viper v1.17.0/go.mod h1:BmMMMLQXSbcHK6KAOiFLz0l5JHrU89OdIRHvsk0+yVI= -github.com/stellar/go-stellar-sdk v0.0.0-20251211085638-ba09a6a91775 h1:BxsjQ1g8oduCyVJLV2K8GrdVHPrOdzgBVw9FDm3/zV8= -github.com/stellar/go-stellar-sdk v0.0.0-20251211085638-ba09a6a91775/go.mod h1:4osSHRDfb/D7zE2iNjmPdg2Gmbx0M/JLhTM4YcwPW5s= +github.com/stellar/go-stellar-sdk v0.0.0-20260325174035-031e5bfdc4bd h1:WerRnoHDI7w0rAAmJhvKSTG7vy3bnXLH4DZ5gZA54n4= +github.com/stellar/go-stellar-sdk v0.0.0-20260325174035-031e5bfdc4bd/go.mod h1:tLKAQPxa2I5UvGMabBbUXcY3fmgYnfDudrMeK7CDX4w= github.com/stellar/go-stellar-xdr-json v0.0.0-20250826185517-ee4033414d38 h1:MpBttv9FXBK9N/rNwjVGIEc4NegoYT9eEQiwtkIHw2E= github.com/stellar/go-stellar-xdr-json v0.0.0-20250826185517-ee4033414d38/go.mod h1:UEZ6EvdC3Cou6N46OJ5SXvbWTlod8gOUI/CvhY1JVaM= -github.com/stellar/go-xdr v0.0.0-20231122183749-b53fb00bcac2 h1:OzCVd0SV5qE3ZcDeSFCmOWLZfEWZ3Oe8KtmSOYKEVWE= -github.com/stellar/go-xdr v0.0.0-20231122183749-b53fb00bcac2/go.mod h1:yoxyU/M8nl9LKeWIoBrbDPQ7Cy+4jxRcWcOayZ4BMps= +github.com/stellar/go-xdr v0.0.0-20260312225820-cc2b0611aabf h1:GY1RVbX3Hg7poPXEf6yojjP0hyypvgUgZmCqQU9D0xg= +github.com/stellar/go-xdr v0.0.0-20260312225820-cc2b0611aabf/go.mod h1:If+U9Z1W5xU97VrOgJandQT+2dN7/iOpkCrxBJEyF80= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE= diff --git a/internal/transform/config_setting_test.go b/internal/transform/config_setting_test.go index b3767910..431b756c 100644 --- a/internal/transform/config_setting_test.go +++ b/internal/transform/config_setting_test.go @@ -82,7 +82,7 @@ func makeConfigSettingTestInput() []ingest.Change { Data: xdr.LedgerEntryData{ Type: xdr.LedgerEntryTypeConfigSetting, ConfigSetting: &xdr.ConfigSettingEntry{ - ConfigSettingId: xdr.ConfigSettingIdConfigSettingContractParallelCompute, + ConfigSettingId: xdr.ConfigSettingIdConfigSettingContractParallelComputeV0, ContractParallelCompute: ¶llelCompute, }, }, @@ -98,7 +98,7 @@ func makeConfigSettingTestInput() []ingest.Change { Data: xdr.LedgerEntryData{ Type: xdr.LedgerEntryTypeConfigSetting, ConfigSetting: &xdr.ConfigSettingEntry{ - ConfigSettingId: xdr.ConfigSettingIdConfigSettingContractLedgerCostExt, + ConfigSettingId: xdr.ConfigSettingIdConfigSettingContractLedgerCostExtV0, ContractLedgerCostExt: &ledgerCostExt, }, }, @@ -117,7 +117,7 @@ func makeConfigSettingTestInput() []ingest.Change { Data: xdr.LedgerEntryData{ Type: xdr.LedgerEntryTypeConfigSetting, ConfigSetting: &xdr.ConfigSettingEntry{ - ConfigSettingId: xdr.ConfigSettingIdConfigSettingContractScpTiming, + ConfigSettingId: xdr.ConfigSettingIdConfigSettingScpTiming, ContractScpTiming: &scpTiming, }, }, From 52f3584fcf39a358834315393ae1cd1ae4c62cf2 Mon Sep 17 00:00:00 2001 From: hunterpack Date: Thu, 9 Apr 2026 16:16:48 -0500 Subject: [PATCH 3/3] updates based on pr comments --- internal/transform/config_setting.go | 111 +++++++------------ internal/transform/config_setting_test.go | 129 +++++++++++++++++++++- internal/transform/parquet_converter.go | 10 +- internal/transform/schema.go | 10 +- internal/transform/schema_parquet.go | 6 +- 5 files changed, 183 insertions(+), 83 deletions(-) diff --git a/internal/transform/config_setting.go b/internal/transform/config_setting.go index ccc4e493..ddeeb281 100644 --- a/internal/transform/config_setting.go +++ b/internal/transform/config_setting.go @@ -1,9 +1,6 @@ package transform import ( - "encoding/base64" - "encoding/hex" - "encoding/json" "fmt" "strconv" @@ -126,16 +123,27 @@ func TransformConfigSetting(ledgerChange ingest.Change, header xdr.LedgerHeaderH // P26 CAP-77: Frozen ledger keys (IDs 17-20) frozenLedgerKeys, _ := configSetting.GetFrozenLedgerKeys() - frozenLedgerKeysJSON := serializeEncodedLedgerKeys(frozenLedgerKeys.Keys) + frozenLedgerKeysBase64, err := marshalEncodedLedgerKeys(frozenLedgerKeys.Keys) + if err != nil { + return ConfigSettingOutput{}, err + } frozenLedgerKeysDelta, _ := configSetting.GetFrozenLedgerKeysDelta() - frozenLedgerKeysDeltaJSON := serializeFrozenKeysDelta(frozenLedgerKeysDelta) + frozenLedgerKeysToFreeze, err := marshalEncodedLedgerKeys(frozenLedgerKeysDelta.KeysToFreeze) + if err != nil { + return ConfigSettingOutput{}, err + } + frozenLedgerKeysToUnfreeze, err := marshalEncodedLedgerKeys(frozenLedgerKeysDelta.KeysToUnfreeze) + if err != nil { + return ConfigSettingOutput{}, err + } freezeBypassTxs, _ := configSetting.GetFreezeBypassTxs() - freezeBypassTxsJSON := serializeHashes(freezeBypassTxs.TxHashes) + freezeBypassTxHashes := hashesToHexStrings(freezeBypassTxs.TxHashes) freezeBypassTxsDelta, _ := configSetting.GetFreezeBypassTxsDelta() - freezeBypassTxsDeltaJSON := serializeFreezeBypassTxsDelta(freezeBypassTxsDelta) + freezeBypassTxsToAdd := hashesToHexStrings(freezeBypassTxsDelta.AddTxs) + freezeBypassTxsToRemove := hashesToHexStrings(freezeBypassTxsDelta.RemoveTxs) closedAt, err := utils.TimePointToUTCTimeStamp(header.Header.ScpValue.CloseTime) if err != nil { @@ -210,10 +218,12 @@ func TransformConfigSetting(ledgerChange ingest.Change, header xdr.LedgerHeaderH BallotTimeoutInitialMilliseconds: uint32(ballotTimeoutInitialMilliseconds), BallotTimeoutIncrementMilliseconds: uint32(ballotTimeoutIncrementMilliseconds), // P26 CAP-77 frozen ledger keys - FrozenLedgerKeys: frozenLedgerKeysJSON, - FrozenLedgerKeysDelta: frozenLedgerKeysDeltaJSON, - FreezeBypassTxs: freezeBypassTxsJSON, - FreezeBypassTxsDelta: freezeBypassTxsDeltaJSON, + FrozenLedgerKeys: frozenLedgerKeysBase64, + FrozenLedgerKeysToFreeze: frozenLedgerKeysToFreeze, + FrozenLedgerKeysToUnfreeze: frozenLedgerKeysToUnfreeze, + FreezeBypassTxs: freezeBypassTxHashes, + FreezeBypassTxsToAdd: freezeBypassTxsToAdd, + FreezeBypassTxsToRemove: freezeBypassTxsToRemove, LastModifiedLedger: uint32(ledgerEntry.LastModifiedLedgerSeq), LedgerEntryChange: uint32(changeType), Deleted: outputDeleted, @@ -236,68 +246,31 @@ func serializeParams(costParams xdr.ContractCostParams) []map[string]string { return params } -// serializeEncodedLedgerKeys converts a slice of EncodedLedgerKey (opaque bytes) to a JSON array of base64 strings. -func serializeEncodedLedgerKeys(keys []xdr.EncodedLedgerKey) string { - if len(keys) == 0 { - return "" - } - encoded := make([]string, 0, len(keys)) +// marshalEncodedLedgerKeys converts a slice of EncodedLedgerKey (XDR-encoded opaque bytes) +// to a slice of base64 strings using xdr.MarshalBase64, matching the format used +// by transformLedgerKeys in ledger.go. +func marshalEncodedLedgerKeys(keys []xdr.EncodedLedgerKey) ([]string, error) { + result := make([]string, 0, len(keys)) for _, key := range keys { - encoded = append(encoded, base64.StdEncoding.EncodeToString(key)) + var ledgerKey xdr.LedgerKey + if err := xdr.SafeUnmarshal(key, &ledgerKey); err != nil { + return nil, fmt.Errorf("could not unmarshal encoded ledger key: %v", err) + } + b64, err := xdr.MarshalBase64(ledgerKey) + if err != nil { + return nil, fmt.Errorf("could not marshal ledger key to base64: %v", err) + } + result = append(result, b64) } - result, _ := json.Marshal(encoded) - return string(result) + return result, nil } -// serializeFrozenKeysDelta converts a FrozenLedgerKeysDelta to a JSON object with keysToFreeze and keysToUnfreeze arrays. -func serializeFrozenKeysDelta(delta xdr.FrozenLedgerKeysDelta) string { - if len(delta.KeysToFreeze) == 0 && len(delta.KeysToUnfreeze) == 0 { - return "" - } - freeze := make([]string, 0, len(delta.KeysToFreeze)) - for _, key := range delta.KeysToFreeze { - freeze = append(freeze, base64.StdEncoding.EncodeToString(key)) - } - unfreeze := make([]string, 0, len(delta.KeysToUnfreeze)) - for _, key := range delta.KeysToUnfreeze { - unfreeze = append(unfreeze, base64.StdEncoding.EncodeToString(key)) - } - result, _ := json.Marshal(map[string][]string{ - "keys_to_freeze": freeze, - "keys_to_unfreeze": unfreeze, - }) - return string(result) -} - -// serializeHashes converts a slice of Hash ([32]byte) to a JSON array of hex strings. -func serializeHashes(hashes []xdr.Hash) string { - if len(hashes) == 0 { - return "" - } - encoded := make([]string, 0, len(hashes)) +// hashesToHexStrings converts a slice of xdr.Hash to a slice of hex-encoded strings, +// matching the format used by utils.HashToHexString for transaction hashes. +func hashesToHexStrings(hashes []xdr.Hash) []string { + result := make([]string, 0, len(hashes)) for _, h := range hashes { - encoded = append(encoded, hex.EncodeToString(h[:])) - } - result, _ := json.Marshal(encoded) - return string(result) -} - -// serializeFreezeBypassTxsDelta converts a FreezeBypassTxsDelta to a JSON object with addTxs and removeTxs arrays. -func serializeFreezeBypassTxsDelta(delta xdr.FreezeBypassTxsDelta) string { - if len(delta.AddTxs) == 0 && len(delta.RemoveTxs) == 0 { - return "" - } - addTxs := make([]string, 0, len(delta.AddTxs)) - for _, h := range delta.AddTxs { - addTxs = append(addTxs, hex.EncodeToString(h[:])) - } - removeTxs := make([]string, 0, len(delta.RemoveTxs)) - for _, h := range delta.RemoveTxs { - removeTxs = append(removeTxs, hex.EncodeToString(h[:])) + result = append(result, utils.HashToHexString(h)) } - result, _ := json.Marshal(map[string][]string{ - "add_txs": addTxs, - "remove_txs": removeTxs, - }) - return string(result) + return result } diff --git a/internal/transform/config_setting_test.go b/internal/transform/config_setting_test.go index 431b756c..dbaa4465 100644 --- a/internal/transform/config_setting_test.go +++ b/internal/transform/config_setting_test.go @@ -123,6 +123,57 @@ func makeConfigSettingTestInput() []ingest.Change { }, } + // P26 CAP-77: FrozenLedgerKeys (ID=17) + // Create valid XDR-encoded LedgerKey bytes for testing + testLedgerKey1 := xdr.LedgerKey{ + Type: xdr.LedgerEntryTypeAccount, + Account: &xdr.LedgerKeyAccount{ + AccountId: xdr.MustAddress("GAAZI4TCR3TY5OJHCTJC2A4QSY6CJWJH5IAJTGKIN2ER7LBNVKOCCWN7"), + }, + } + testLedgerKey2 := xdr.LedgerKey{ + Type: xdr.LedgerEntryTypeAccount, + Account: &xdr.LedgerKeyAccount{ + AccountId: xdr.MustAddress("GCO2IP3MJNUOKS4PUDI4C7LGGMQDJGXG3COYX3WSB4HHNAHKYV5YL3VC"), + }, + } + encodedKey1, _ := testLedgerKey1.MarshalBinary() + encodedKey2, _ := testLedgerKey2.MarshalBinary() + frozenKeys := xdr.FrozenLedgerKeys{ + Keys: []xdr.EncodedLedgerKey{ + xdr.EncodedLedgerKey(encodedKey1), + xdr.EncodedLedgerKey(encodedKey2), + }, + } + frozenKeysEntry := xdr.LedgerEntry{ + LastModifiedLedgerSeq: 24229507, + Data: xdr.LedgerEntryData{ + Type: xdr.LedgerEntryTypeConfigSetting, + ConfigSetting: &xdr.ConfigSettingEntry{ + ConfigSettingId: xdr.ConfigSettingIdConfigSettingFrozenLedgerKeys, + FrozenLedgerKeys: &frozenKeys, + }, + }, + } + + // P26 CAP-77: FreezeBypassTxs (ID=19) + var txHash1, txHash2 xdr.Hash + copy(txHash1[:], []byte("aaaabbbbccccddddeeeeffffgggghhhh")) + copy(txHash2[:], []byte("11112222333344445555666677778888")) + bypassTxs := xdr.FreezeBypassTxs{ + TxHashes: []xdr.Hash{txHash1, txHash2}, + } + bypassTxsEntry := xdr.LedgerEntry{ + LastModifiedLedgerSeq: 24229508, + Data: xdr.LedgerEntryData{ + Type: xdr.LedgerEntryTypeConfigSetting, + ConfigSetting: &xdr.ConfigSettingEntry{ + ConfigSettingId: xdr.ConfigSettingIdConfigSettingFreezeBypassTxs, + FreezeBypassTxs: &bypassTxs, + }, + }, + } + return []ingest.Change{ { ChangeType: xdr.LedgerEntryChangeTypeLedgerEntryUpdated, @@ -148,12 +199,25 @@ func makeConfigSettingTestInput() []ingest.Change { Pre: nil, Post: &scpTimingEntry, }, + { + ChangeType: xdr.LedgerEntryChangeTypeLedgerEntryCreated, + Type: xdr.LedgerEntryTypeConfigSetting, + Pre: nil, + Post: &frozenKeysEntry, + }, + { + ChangeType: xdr.LedgerEntryChangeTypeLedgerEntryCreated, + Type: xdr.LedgerEntryTypeConfigSetting, + Pre: nil, + Post: &bypassTxsEntry, + }, } } func makeConfigSettingTestOutput() []ConfigSettingOutput { contractMapType := make([]map[string]string, 0) bucket := make([]uint64, 0) + emptyStrSlice := make([]string, 0) // Base output with all zero values (for ContractMaxSizeBytes test) baseOutput := ConfigSettingOutput{ @@ -221,10 +285,12 @@ func makeConfigSettingTestOutput() []ConfigSettingOutput { NominationTimeoutIncrementMilliseconds: 0, BallotTimeoutInitialMilliseconds: 0, BallotTimeoutIncrementMilliseconds: 0, - FrozenLedgerKeys: "", - FrozenLedgerKeysDelta: "", - FreezeBypassTxs: "", - FreezeBypassTxsDelta: "", + FrozenLedgerKeys: emptyStrSlice, + FrozenLedgerKeysToFreeze: emptyStrSlice, + FrozenLedgerKeysToUnfreeze: emptyStrSlice, + FreezeBypassTxs: emptyStrSlice, + FreezeBypassTxsToAdd: emptyStrSlice, + FreezeBypassTxsToRemove: emptyStrSlice, LastModifiedLedger: 24229503, LedgerEntryChange: 1, Deleted: false, @@ -242,6 +308,12 @@ func makeConfigSettingTestOutput() []ConfigSettingOutput { parallelComputeOutput.ContractCostParamsMemBytes = contractMapType parallelComputeOutput.BucketListSizeWindow = bucket parallelComputeOutput.LiveSorobanStateSizeWindow = bucket + parallelComputeOutput.FrozenLedgerKeys = emptyStrSlice + parallelComputeOutput.FrozenLedgerKeysToFreeze = emptyStrSlice + parallelComputeOutput.FrozenLedgerKeysToUnfreeze = emptyStrSlice + parallelComputeOutput.FreezeBypassTxs = emptyStrSlice + parallelComputeOutput.FreezeBypassTxsToAdd = emptyStrSlice + parallelComputeOutput.FreezeBypassTxsToRemove = emptyStrSlice // P23: ContractLedgerCostExt output ledgerCostExtOutput := baseOutput @@ -254,6 +326,12 @@ func makeConfigSettingTestOutput() []ConfigSettingOutput { ledgerCostExtOutput.ContractCostParamsMemBytes = contractMapType ledgerCostExtOutput.BucketListSizeWindow = bucket ledgerCostExtOutput.LiveSorobanStateSizeWindow = bucket + ledgerCostExtOutput.FrozenLedgerKeys = emptyStrSlice + ledgerCostExtOutput.FrozenLedgerKeysToFreeze = emptyStrSlice + ledgerCostExtOutput.FrozenLedgerKeysToUnfreeze = emptyStrSlice + ledgerCostExtOutput.FreezeBypassTxs = emptyStrSlice + ledgerCostExtOutput.FreezeBypassTxsToAdd = emptyStrSlice + ledgerCostExtOutput.FreezeBypassTxsToRemove = emptyStrSlice // P23: ContractScpTiming output scpTimingOutput := baseOutput @@ -269,11 +347,54 @@ func makeConfigSettingTestOutput() []ConfigSettingOutput { scpTimingOutput.ContractCostParamsMemBytes = contractMapType scpTimingOutput.BucketListSizeWindow = bucket scpTimingOutput.LiveSorobanStateSizeWindow = bucket + scpTimingOutput.FrozenLedgerKeys = emptyStrSlice + scpTimingOutput.FrozenLedgerKeysToFreeze = emptyStrSlice + scpTimingOutput.FrozenLedgerKeysToUnfreeze = emptyStrSlice + scpTimingOutput.FreezeBypassTxs = emptyStrSlice + scpTimingOutput.FreezeBypassTxsToAdd = emptyStrSlice + scpTimingOutput.FreezeBypassTxsToRemove = emptyStrSlice + + // P26 CAP-77: FrozenLedgerKeys output (ID=17) + frozenKeysOutput := baseOutput + frozenKeysOutput.ConfigSettingId = 17 + frozenKeysOutput.LastModifiedLedger = 24229507 + frozenKeysOutput.LedgerEntryChange = 0 + frozenKeysOutput.ContractCostParamsCpuInsns = contractMapType + frozenKeysOutput.ContractCostParamsMemBytes = contractMapType + frozenKeysOutput.BucketListSizeWindow = bucket + frozenKeysOutput.LiveSorobanStateSizeWindow = bucket + frozenKeysOutput.FrozenLedgerKeys = []string{"AAAAAAAAAAABlHJijueOuScU0i0DkJY8JNkn6gCZmUhuiR+sLaqcIQ==", "AAAAAAAAAACdpD9sS2jlS4+g0cF9ZjMgNJrm2J2L7tIPDnaA6sV7hQ=="} + frozenKeysOutput.FrozenLedgerKeysToFreeze = emptyStrSlice + frozenKeysOutput.FrozenLedgerKeysToUnfreeze = emptyStrSlice + frozenKeysOutput.FreezeBypassTxs = emptyStrSlice + frozenKeysOutput.FreezeBypassTxsToAdd = emptyStrSlice + frozenKeysOutput.FreezeBypassTxsToRemove = emptyStrSlice + + // P26 CAP-77: FreezeBypassTxs output (ID=19) + bypassTxsOutput := baseOutput + bypassTxsOutput.ConfigSettingId = 19 + bypassTxsOutput.LastModifiedLedger = 24229508 + bypassTxsOutput.LedgerEntryChange = 0 + bypassTxsOutput.ContractCostParamsCpuInsns = contractMapType + bypassTxsOutput.ContractCostParamsMemBytes = contractMapType + bypassTxsOutput.BucketListSizeWindow = bucket + bypassTxsOutput.LiveSorobanStateSizeWindow = bucket + bypassTxsOutput.FrozenLedgerKeys = emptyStrSlice + bypassTxsOutput.FrozenLedgerKeysToFreeze = emptyStrSlice + bypassTxsOutput.FrozenLedgerKeysToUnfreeze = emptyStrSlice + bypassTxsOutput.FreezeBypassTxs = []string{ + "6161616162626262636363636464646465656565666666666767676768686868", + "3131313132323232333333333434343435353535363636363737373738383838", + } + bypassTxsOutput.FreezeBypassTxsToAdd = emptyStrSlice + bypassTxsOutput.FreezeBypassTxsToRemove = emptyStrSlice return []ConfigSettingOutput{ baseOutput, parallelComputeOutput, ledgerCostExtOutput, scpTimingOutput, + frozenKeysOutput, + bypassTxsOutput, } } diff --git a/internal/transform/parquet_converter.go b/internal/transform/parquet_converter.go index ac88ef17..8156830a 100644 --- a/internal/transform/parquet_converter.go +++ b/internal/transform/parquet_converter.go @@ -411,10 +411,12 @@ func (cso ConfigSettingOutput) ToParquet() interface{} { BallotTimeoutInitialMilliseconds: int64(cso.BallotTimeoutInitialMilliseconds), BallotTimeoutIncrementMilliseconds: int64(cso.BallotTimeoutIncrementMilliseconds), // P26 CAP-77 frozen ledger keys - FrozenLedgerKeys: cso.FrozenLedgerKeys, - FrozenLedgerKeysDelta: cso.FrozenLedgerKeysDelta, - FreezeBypassTxs: cso.FreezeBypassTxs, - FreezeBypassTxsDelta: cso.FreezeBypassTxsDelta, + FrozenLedgerKeys: toJSONString(cso.FrozenLedgerKeys), + FrozenLedgerKeysToFreeze: toJSONString(cso.FrozenLedgerKeysToFreeze), + FrozenLedgerKeysToUnfreeze: toJSONString(cso.FrozenLedgerKeysToUnfreeze), + FreezeBypassTxs: toJSONString(cso.FreezeBypassTxs), + FreezeBypassTxsToAdd: toJSONString(cso.FreezeBypassTxsToAdd), + FreezeBypassTxsToRemove: toJSONString(cso.FreezeBypassTxsToRemove), LastModifiedLedger: int64(cso.LastModifiedLedger), LedgerEntryChange: int64(cso.LedgerEntryChange), Deleted: cso.Deleted, diff --git a/internal/transform/schema.go b/internal/transform/schema.go index b58739a3..18c6177b 100644 --- a/internal/transform/schema.go +++ b/internal/transform/schema.go @@ -628,10 +628,12 @@ type ConfigSettingOutput struct { BallotTimeoutInitialMilliseconds uint32 `json:"ballot_timeout_initial_milliseconds"` BallotTimeoutIncrementMilliseconds uint32 `json:"ballot_timeout_increment_milliseconds"` // P26 CAP-77 frozen ledger keys - FrozenLedgerKeys string `json:"frozen_ledger_keys"` - FrozenLedgerKeysDelta string `json:"frozen_ledger_keys_delta"` - FreezeBypassTxs string `json:"freeze_bypass_txs"` - FreezeBypassTxsDelta string `json:"freeze_bypass_txs_delta"` + FrozenLedgerKeys []string `json:"frozen_ledger_keys"` + FrozenLedgerKeysToFreeze []string `json:"frozen_ledger_keys_to_freeze"` + FrozenLedgerKeysToUnfreeze []string `json:"frozen_ledger_keys_to_unfreeze"` + FreezeBypassTxs []string `json:"freeze_bypass_txs"` + FreezeBypassTxsToAdd []string `json:"freeze_bypass_txs_to_add"` + FreezeBypassTxsToRemove []string `json:"freeze_bypass_txs_to_remove"` LastModifiedLedger uint32 `json:"last_modified_ledger"` LedgerEntryChange uint32 `json:"ledger_entry_change"` Deleted bool `json:"deleted"` diff --git a/internal/transform/schema_parquet.go b/internal/transform/schema_parquet.go index 26fa0ebe..e57500ff 100644 --- a/internal/transform/schema_parquet.go +++ b/internal/transform/schema_parquet.go @@ -371,9 +371,11 @@ type ConfigSettingOutputParquet struct { BallotTimeoutIncrementMilliseconds int64 `parquet:"name=ballot_timeout_increment_milliseconds, type=INT64, convertedtype=UINT_64"` // P26 CAP-77 frozen ledger keys FrozenLedgerKeys string `parquet:"name=frozen_ledger_keys, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"` - FrozenLedgerKeysDelta string `parquet:"name=frozen_ledger_keys_delta, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"` + FrozenLedgerKeysToFreeze string `parquet:"name=frozen_ledger_keys_to_freeze, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"` + FrozenLedgerKeysToUnfreeze string `parquet:"name=frozen_ledger_keys_to_unfreeze, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"` FreezeBypassTxs string `parquet:"name=freeze_bypass_txs, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"` - FreezeBypassTxsDelta string `parquet:"name=freeze_bypass_txs_delta, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"` + FreezeBypassTxsToAdd string `parquet:"name=freeze_bypass_txs_to_add, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"` + FreezeBypassTxsToRemove string `parquet:"name=freeze_bypass_txs_to_remove, type=BYTE_ARRAY, convertedtype=UTF8, encoding=PLAIN_DICTIONARY"` LastModifiedLedger int64 `parquet:"name=last_modified_ledger, type=INT64, convertedtype=UINT_64"` LedgerEntryChange int64 `parquet:"name=ledger_entry_change, type=INT64, convertedtype=UINT_64"` Deleted bool `parquet:"name=deleted, type=BOOLEAN"`