diff --git a/.github/workflows/soroban-rpc.yml b/.github/workflows/soroban-rpc.yml index 8ec1b35c5..bbd1c647c 100644 --- a/.github/workflows/soroban-rpc.yml +++ b/.github/workflows/soroban-rpc.yml @@ -112,7 +112,7 @@ jobs: env: SOROBAN_RPC_INTEGRATION_TESTS_ENABLED: true SOROBAN_RPC_INTEGRATION_TESTS_CAPTIVE_CORE_BIN: /usr/bin/stellar-core - PROTOCOL_20_CORE_DEBIAN_PKG_VERSION: 19.14.1-1547.f2d06fbce.focal + PROTOCOL_20_CORE_DEBIAN_PKG_VERSION: 19.14.1-1553.f4c4e2fca.focal steps: - uses: actions/checkout@v3 with: diff --git a/cmd/soroban-rpc/internal/test/docker-compose.yml b/cmd/soroban-rpc/internal/test/docker-compose.yml index 3e8af4bfe..39e3f7ed6 100644 --- a/cmd/soroban-rpc/internal/test/docker-compose.yml +++ b/cmd/soroban-rpc/internal/test/docker-compose.yml @@ -15,7 +15,7 @@ services: # Note: Please keep the image pinned to an immutable tag matching the Captive Core version. # This avoids implicit updates which break compatibility between # the Core container and captive core. - image: ${CORE_IMAGE:-stellar/stellar-core:19.14.1-1547.f2d06fbce.focal} + image: ${CORE_IMAGE:-stellar/stellar-core:19.14.1-1553.f4c4e2fca.focal} depends_on: - core-postgres restart: on-failure diff --git a/cmd/soroban-rpc/internal/test/simulate_transaction_test.go b/cmd/soroban-rpc/internal/test/simulate_transaction_test.go index 04ac395ea..b47c609f0 100644 --- a/cmd/soroban-rpc/internal/test/simulate_transaction_test.go +++ b/cmd/soroban-rpc/internal/test/simulate_transaction_test.go @@ -233,7 +233,7 @@ func TestSimulateTransactionSucceeds(t *testing.T) { }, }, Instructions: 6062311, - ReadBytes: 48, + ReadBytes: 0, WriteBytes: 7048, }, ResourceFee: 130498, diff --git a/cmd/soroban-rpc/internal/test/transaction_test.go b/cmd/soroban-rpc/internal/test/transaction_test.go index ff8473420..e370d7d19 100644 --- a/cmd/soroban-rpc/internal/test/transaction_test.go +++ b/cmd/soroban-rpc/internal/test/transaction_test.go @@ -259,7 +259,21 @@ func sendSuccessfulTransaction(t *testing.T, client *jrpc2.Client, kp *keypair.F var txMeta xdr.TransactionMeta err = xdr.SafeUnmarshalBase64(response.ResultMetaXdr, &txMeta) assert.NoError(t, err) - fmt.Printf("meta: %#v\n", txMeta) + if txMeta.V == 3 && txMeta.V3.SorobanMeta != nil { + if len(txMeta.V3.SorobanMeta.Events) > 0 { + fmt.Println("Contract events:") + for i, e := range txMeta.V3.SorobanMeta.Events { + fmt.Printf(" %d: %s\n", i, e) + } + } + + if len(txMeta.V3.SorobanMeta.DiagnosticEvents) > 0 { + fmt.Println("Diagnostic events:") + for i, d := range txMeta.V3.SorobanMeta.DiagnosticEvents { + fmt.Printf(" %d: %s\n", i, d) + } + } + } } require.NotNil(t, response.ResultXdr) diff --git a/cmd/soroban-rpc/lib/preflight/src/fees.rs b/cmd/soroban-rpc/lib/preflight/src/fees.rs index 20e002b3d..e32ab3e9b 100644 --- a/cmd/soroban-rpc/lib/preflight/src/fees.rs +++ b/cmd/soroban-rpc/lib/preflight/src/fees.rs @@ -7,7 +7,7 @@ use soroban_env_host::e2e_invoke::{ use soroban_env_host::fees::{ compute_rent_fee, compute_transaction_resource_fee, compute_write_fee_per_1kb, FeeConfiguration, LedgerEntryRentChange, RentFeeConfiguration, TransactionResources, - WriteFeeConfiguration, TTL_ENTRY_SIZE, + WriteFeeConfiguration, }; use soroban_env_host::storage::{AccessType, Footprint, Storage}; use soroban_env_host::xdr; @@ -131,10 +131,7 @@ fn calculate_host_function_soroban_resources( ) -> Result { let ledger_footprint = storage_footprint_to_ledger_footprint(footprint) .context("cannot convert storage footprint to ledger footprint")?; - let read_bytes: u32 = ledger_changes - .iter() - .map(|c| c.old_entry_size_bytes + c.ttl_change.as_ref().map_or(0, |_| TTL_ENTRY_SIZE)) - .sum(); + let read_bytes: u32 = ledger_changes.iter().map(|c| c.old_entry_size_bytes).sum(); let write_bytes: u32 = ledger_changes .iter() @@ -224,17 +221,6 @@ fn get_fee_configurations( Ok((fee_configuration, rent_fee_configuration)) } -// Calculate the implicit TTLEntry bytes that will be read for TTLLedgerEntries -fn calculate_ttl_entry_bytes(ledger_entries: &[LedgerKey]) -> u32 { - ledger_entries - .iter() - .map(|lk| match lk { - LedgerKey::ContractData(_) | LedgerKey::ContractCode(_) => TTL_ENTRY_SIZE, - _ => 0, - }) - .sum() -} - #[allow(clippy::cast_possible_truncation)] fn calculate_unmodified_ledger_entry_bytes( ledger_entries: &[LedgerKey], @@ -322,8 +308,6 @@ pub(crate) fn compute_extend_footprint_ttl_transaction_data_and_min_fee( ) .context("cannot compute extend rent changes")?; - let ttl_bytes: u32 = calculate_ttl_entry_bytes(footprint.read_only.as_vec()); - let unmodified_entry_bytes = calculate_unmodified_ledger_entry_bytes( footprint.read_only.as_slice(), ledger_storage, @@ -334,7 +318,7 @@ pub(crate) fn compute_extend_footprint_ttl_transaction_data_and_min_fee( let soroban_resources = SorobanResources { footprint, instructions: 0, - read_bytes: unmodified_entry_bytes + ttl_bytes, + read_bytes: unmodified_entry_bytes, write_bytes: 0, }; let transaction_size_bytes = estimate_max_transaction_size_for_operation( @@ -420,7 +404,6 @@ pub(crate) fn compute_restore_footprint_transaction_data_and_min_fee( ) .context("cannot compute restore rent changes")?; - let ttl_bytes: u32 = calculate_ttl_entry_bytes(footprint.read_write.as_vec()); let write_bytes = calculate_unmodified_ledger_entry_bytes( footprint.read_write.as_vec(), ledger_storage, @@ -430,7 +413,7 @@ pub(crate) fn compute_restore_footprint_transaction_data_and_min_fee( let soroban_resources = SorobanResources { footprint, instructions: 0, - read_bytes: write_bytes + ttl_bytes, + read_bytes: write_bytes, write_bytes, }; let transaction_size_bytes = estimate_max_transaction_size_for_operation( diff --git a/go.mod b/go.mod index fd4fca5f1..f929c0e33 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.7.0 github.com/spf13/pflag v1.0.5 - github.com/stellar/go v0.0.0-20231016174715-c7d3a47ee7a2 + github.com/stellar/go v0.0.0-20231114175958-eb2984b58392 github.com/stretchr/testify v1.8.4 golang.org/x/mod v0.13.0 gotest.tools/v3 v3.5.0 diff --git a/go.sum b/go.sum index f0d20235f..7ab9b159e 100644 --- a/go.sum +++ b/go.sum @@ -333,8 +333,8 @@ 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 v0.0.0-20231016174715-c7d3a47ee7a2 h1:IOOHd1yrwmK0wiAuNDmoHUPTucO0oGkkKa3CE1pgn2E= -github.com/stellar/go v0.0.0-20231016174715-c7d3a47ee7a2/go.mod h1:g78pyZyDFnKMJUaBIXxH7xyQ7PdDrvrJTFCxdGMMb3c= +github.com/stellar/go v0.0.0-20231114175958-eb2984b58392 h1:sYxHgLDT3z6cJrWuf0O9Fbs/E2UNGh3PPoOlM8DJ2vk= +github.com/stellar/go v0.0.0-20231114175958-eb2984b58392/go.mod h1:g78pyZyDFnKMJUaBIXxH7xyQ7PdDrvrJTFCxdGMMb3c= github.com/stellar/go-xdr v0.0.0-20230919160922-6c7b68458206 h1:UFuvvpbWL8+jqO1QmKYWSVhiMp4MRiIFd8/zQlUINH0= github.com/stellar/go-xdr v0.0.0-20230919160922-6c7b68458206/go.mod h1:yoxyU/M8nl9LKeWIoBrbDPQ7Cy+4jxRcWcOayZ4BMps= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=