Skip to content

Commit

Permalink
XDR for upgradeable config entries (#75)
Browse files Browse the repository at this point in the history
* Generalize configuration-related XDR.

The changes here are summarized in proposed updated to CAP-47 (stellar/stellar-protocol#1291).

- Use unique keys to identify settings
- Only distribute a hash for config upgrades in `StellarValue`
- Add SCP messages for exchanging config upgrade sets

* Remove unused ConfigSetting

---------

Co-authored-by: Dmytro Kozhevin <dmytro@stellar.org>
  • Loading branch information
sisuresh and dmkozh authored Mar 30, 2023
1 parent 7356dc2 commit eab1622
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 27 deletions.
26 changes: 4 additions & 22 deletions Stellar-ledger-entries.x
Original file line number Diff line number Diff line change
Expand Up @@ -505,33 +505,15 @@ struct ContractCodeEntry {
opaque code<SCVAL_LIMIT>;
};

enum ConfigSettingType
{
CONFIG_SETTING_TYPE_UINT32 = 0
};

union ConfigSetting switch (ConfigSettingType type)
{
case CONFIG_SETTING_TYPE_UINT32:
uint32 uint32Val;
};

enum ConfigSettingID
{
CONFIG_SETTING_CONTRACT_MAX_SIZE = 0
CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES = 0
};

struct ConfigSettingEntry
union ConfigSettingEntry switch (ConfigSettingID configSettingID)
{
union switch (int v)
{
case 0:
void;
}
ext;

ConfigSettingID configSettingID;
ConfigSetting setting;
case CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES:
uint32 contractMaxSizeBytes;
};

struct LedgerEntryExtensionV1
Expand Down
15 changes: 10 additions & 5 deletions Stellar-ledger.x
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,11 @@ enum LedgerUpgradeType
LEDGER_UPGRADE_CONFIG = 6
};

struct ConfigUpgradeSetKey {
Hash contractID;
Hash contentHash;
};

union LedgerUpgrade switch (LedgerUpgradeType type)
{
case LEDGER_UPGRADE_VERSION:
Expand All @@ -143,11 +148,11 @@ case LEDGER_UPGRADE_BASE_RESERVE:
case LEDGER_UPGRADE_FLAGS:
uint32 newFlags; // update flags
case LEDGER_UPGRADE_CONFIG:
struct
{
ConfigSettingID id; // id to update
ConfigSetting setting; // new value
} configSetting;
ConfigUpgradeSetKey newConfig;
};

struct ConfigUpgradeSet {
ConfigSettingEntry updatedEntry<>;
};

/* Entries used to define the bucket list */
Expand Down

0 comments on commit eab1622

Please sign in to comment.