Skip to content

Commit

Permalink
Make returnValue optional in meta. (#100)
Browse files Browse the repository at this point in the history
* Make `returnValue` optional in meta.

This is meaningless for non-Soroban txs.

* Make whole soroban tx meta optional.

Also did some small extension point cleanup.
  • Loading branch information
dmkozh authored Jun 8, 2023
1 parent 956da0a commit 5b1ab56
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 10 deletions.
5 changes: 3 additions & 2 deletions Stellar-contract-config-setting.x
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
24 changes: 17 additions & 7 deletions Stellar-ledger.x
Original file line number Diff line number Diff line change
Expand Up @@ -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 invocation.
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
Expand Down
2 changes: 1 addition & 1 deletion Stellar-transaction.x
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 5b1ab56

Please sign in to comment.