Skip to content

Commit

Permalink
Remove ContractDataType from ScVal and rename (#118)
Browse files Browse the repository at this point in the history
  • Loading branch information
graydon authored Jun 22, 2023
1 parent 4a25a3e commit 7998421
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
14 changes: 2 additions & 12 deletions Stellar-contract.x
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,12 @@ enum SCValType
// The following are the internal SCVal variants that are not
// exposed to the contracts.
SCV_CONTRACT_INSTANCE = 19,
SCV_STORAGE_TYPE = 20,

// SCV_LEDGER_KEY_CONTRACT_INSTANCE and SCV_LEDGER_KEY_NONCE are unique
// symbolic SCVals used as the key for ledger entries for a contract's
// instance and an address' nonce, respectively.
SCV_LEDGER_KEY_CONTRACT_INSTANCE = 21,
SCV_LEDGER_KEY_NONCE = 22
SCV_LEDGER_KEY_CONTRACT_INSTANCE = 20,
SCV_LEDGER_KEY_NONCE = 21
};

enum SCErrorType
Expand Down Expand Up @@ -169,12 +168,6 @@ case SC_ADDRESS_TYPE_CONTRACT:
Hash contractId;
};

// Here due to circular dependency
enum ContractDataType {
TEMPORARY = 0,
PERSISTENT = 1
};

%struct SCVal;
%struct SCMapEntry;

Expand Down Expand Up @@ -254,9 +247,6 @@ case SCV_LEDGER_KEY_CONTRACT_INSTANCE:
case SCV_LEDGER_KEY_NONCE:
SCNonceKey nonce_key;

case SCV_STORAGE_TYPE:
ContractDataType storageType;

case SCV_CONTRACT_INSTANCE:
SCContractInstance instance;
};
Expand Down
19 changes: 12 additions & 7 deletions Stellar-ledger-entries.x
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ struct LiquidityPoolEntry
body;
};

enum ContractLedgerEntryType {
enum ContractEntryBodyType {
DATA_ENTRY = 0,
EXPIRATION_EXTENSION = 1
};
Expand All @@ -506,12 +506,17 @@ enum ContractDataFlags {
NO_AUTOBUMP = 0x1
};

enum ContractDataDurability {
TEMPORARY = 0,
PERSISTENT = 1
};

struct ContractDataEntry {
SCAddress contract;
SCVal key;
ContractDataType type;
ContractDataDurability durability;

union switch (ContractLedgerEntryType leType)
union switch (ContractEntryBodyType bodyType)
{
case DATA_ENTRY:
struct
Expand All @@ -530,7 +535,7 @@ struct ContractCodeEntry {
ExtensionPoint ext;

Hash hash;
union switch (ContractLedgerEntryType leType)
union switch (ContractEntryBodyType bodyType)
{
case DATA_ENTRY:
opaque code<>;
Expand Down Expand Up @@ -637,14 +642,14 @@ case CONTRACT_DATA:
{
SCAddress contract;
SCVal key;
ContractDataType type;
ContractLedgerEntryType leType;
ContractDataDurability durability;
ContractEntryBodyType bodyType;
} contractData;
case CONTRACT_CODE:
struct
{
Hash hash;
ContractLedgerEntryType leType;
ContractEntryBodyType bodyType;
} contractCode;
case CONFIG_SETTING:
struct
Expand Down

0 comments on commit 7998421

Please sign in to comment.