Skip to content

Commit

Permalink
Bump core version (#1076)
Browse files Browse the repository at this point in the history
  • Loading branch information
2opremio authored Nov 14, 2023
1 parent 5398c06 commit 733ce06
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 28 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/soroban-rpc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion cmd/soroban-rpc/internal/test/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion cmd/soroban-rpc/internal/test/simulate_transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ func TestSimulateTransactionSucceeds(t *testing.T) {
},
},
Instructions: 6062311,
ReadBytes: 48,
ReadBytes: 0,
WriteBytes: 7048,
},
ResourceFee: 130498,
Expand Down
16 changes: 15 additions & 1 deletion cmd/soroban-rpc/internal/test/transaction_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
25 changes: 4 additions & 21 deletions cmd/soroban-rpc/lib/preflight/src/fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -131,10 +131,7 @@ fn calculate_host_function_soroban_resources(
) -> Result<SorobanResources> {
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()
Expand Down Expand Up @@ -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],
Expand Down Expand Up @@ -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,
Expand All @@ -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(
Expand Down Expand Up @@ -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,
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down

0 comments on commit 733ce06

Please sign in to comment.