From 82afdf50ea2b35dfc988b5e36e971c0927db4fad Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Fri, 2 Jun 2023 12:39:45 -0400 Subject: [PATCH 1/2] Make `returnValue` optional in meta. This is meaningless for non-Soroban txs. --- Stellar-ledger.x | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Stellar-ledger.x b/Stellar-ledger.x index 7b0e04a..059321d 100644 --- a/Stellar-ledger.x +++ b/Stellar-ledger.x @@ -407,7 +407,7 @@ struct TransactionMetaV3 // applied if any ContractEvent events<>; // custom events populated by the // contracts themselves. - SCVal returnValue; // return value of the invocation. + SCVal* returnValue; // return value of the host fn invocation (if any) // Diagnostics events that are not hashed. // This will contain all contract and diagnostic events. Even ones From e269b7f032d8b2fdd3ad1c7f557c6c1280788a45 Mon Sep 17 00:00:00 2001 From: Dmytro Kozhevin Date: Fri, 2 Jun 2023 21:01:32 -0400 Subject: [PATCH 2/2] Make whole soroban tx meta optional. Also did some small extension point cleanup. --- Stellar-contract-config-setting.x | 5 +++-- Stellar-ledger.x | 24 +++++++++++++++++------- Stellar-transaction.x | 2 +- 3 files changed, 21 insertions(+), 10 deletions(-) diff --git a/Stellar-contract-config-setting.x b/Stellar-contract-config-setting.x index db8a462..9b50678 100644 --- a/Stellar-contract-config-setting.x +++ b/Stellar-contract-config-setting.x @@ -129,10 +129,11 @@ enum ContractCostType { }; struct ContractCostParamEntry { - int64 constTerm; - int64 linearTerm; // use `ext` to add more terms (e.g. higher order polynomials) in the future ExtensionPoint ext; + + int64 constTerm; + int64 linearTerm; }; struct StateExpirationSettings { diff --git a/Stellar-ledger.x b/Stellar-ledger.x index 5471ca7..dd943d0 100644 --- a/Stellar-ledger.x +++ b/Stellar-ledger.x @@ -398,21 +398,31 @@ struct DiagnosticEvent ContractEvent event; }; -struct TransactionMetaV3 +struct SorobanTransactionMeta { - LedgerEntryChanges txChangesBefore; // tx level changes before operations - // are applied if any - OperationMeta operations<>; // meta for each operation - LedgerEntryChanges txChangesAfter; // tx level changes after operations are - // applied if any + ExtensionPoint ext; + ContractEvent events<>; // custom events populated by the // contracts themselves. - SCVal* returnValue; // return value of the host fn invocation (if any) + SCVal returnValue; // return value of the host fn invocation // Diagnostics events that are not hashed. // This will contain all contract and diagnostic events. Even ones // that were emitted in a failed contract call. DiagnosticEvent diagnosticEvents<>; +} + +struct TransactionMetaV3 +{ + ExtensionPoint ext; + + LedgerEntryChanges txChangesBefore; // tx level changes before operations + // are applied if any + OperationMeta operations<>; // meta for each operation + LedgerEntryChanges txChangesAfter; // tx level changes after operations are + // applied if any + SorobanTransactionMeta* sorobanMeta; // Soroban-specific meta (only for + // Soroban transactions). }; // This is in Stellar-ledger.x to due to a circular dependency diff --git a/Stellar-transaction.x b/Stellar-transaction.x index 0a571b5..d084585 100644 --- a/Stellar-transaction.x +++ b/Stellar-transaction.x @@ -789,10 +789,10 @@ struct SorobanResources // The transaction extension for Soroban. struct SorobanTransactionData { + ExtensionPoint ext; SorobanResources resources; // Portion of transaction `fee` allocated to refundable fees. int64 refundableFee; - ExtensionPoint ext; }; // TransactionV0 is a transaction with the AccountID discriminant stripped off,