Skip to content

Commit

Permalink
deps: update xdr (9ac02641139e6717924fdad716f6e958d0168491)
Browse files Browse the repository at this point in the history
  • Loading branch information
overcat committed Sep 14, 2023
1 parent 5068c18 commit 0133b45
Show file tree
Hide file tree
Showing 58 changed files with 681 additions and 1,185 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ xdr/Stellar-contract-config-setting.x

XDRGEN_REPO=overcat/xdrgen
XDRGEN_COMMIT=c98916346eeea7e37aaea039de03c1e5ea0a116a
XDRNEXT_COMMIT=e372df9f677961aac04c5a4cc80a3667f310b29f
XDRNEXT_COMMIT=9ac02641139e6717924fdad716f6e958d0168491

UNAME := $(shell uname)
SED := sed
Expand Down Expand Up @@ -87,7 +87,7 @@ xdr/%.x:
.PHONY: xdr

xdr-clean:
rm .xdr/*.x || true
rm xdr/*.x || true
rm stellar_sdk/xdr/*.py || true
.PHONY: xdr-clean

Expand Down
13 changes: 5 additions & 8 deletions stellar_sdk/xdr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,30 +75,25 @@
from .clawback_result_code import ClawbackResultCode
from .config_setting_contract_bandwidth_v0 import ConfigSettingContractBandwidthV0
from .config_setting_contract_compute_v0 import ConfigSettingContractComputeV0
from .config_setting_contract_events_v0 import ConfigSettingContractEventsV0
from .config_setting_contract_execution_lanes_v0 import (
ConfigSettingContractExecutionLanesV0,
)
from .config_setting_contract_historical_data_v0 import (
ConfigSettingContractHistoricalDataV0,
)
from .config_setting_contract_ledger_cost_v0 import ConfigSettingContractLedgerCostV0
from .config_setting_contract_meta_data_v0 import ConfigSettingContractMetaDataV0
from .config_setting_entry import ConfigSettingEntry
from .config_setting_id import ConfigSettingID
from .config_upgrade_set import ConfigUpgradeSet
from .config_upgrade_set_key import ConfigUpgradeSetKey
from .constants import *
from .contract_code_entry import ContractCodeEntry
from .contract_code_entry_body import ContractCodeEntryBody
from .contract_cost_param_entry import ContractCostParamEntry
from .contract_cost_params import ContractCostParams
from .contract_cost_type import ContractCostType
from .contract_data_durability import ContractDataDurability
from .contract_data_entry import ContractDataEntry
from .contract_data_entry_body import ContractDataEntryBody
from .contract_data_entry_data import ContractDataEntryData
from .contract_data_flags import ContractDataFlags
from .contract_entry_body_type import ContractEntryBodyType
from .contract_event import ContractEvent
from .contract_event_body import ContractEventBody
from .contract_event_type import ContractEventType
Expand Down Expand Up @@ -134,6 +129,8 @@
from .envelope_type import EnvelopeType
from .error import Error
from .error_code import ErrorCode
from .eviction_iterator import EvictionIterator
from .expiration_entry import ExpirationEntry
from .extension_point import ExtensionPoint
from .fee_bump_transaction import FeeBumpTransaction
from .fee_bump_transaction_envelope import FeeBumpTransactionEnvelope
Expand Down Expand Up @@ -164,6 +161,7 @@
from .int64 import Int64
from .int128_parts import Int128Parts
from .int256_parts import Int256Parts
from .invoke_contract_args import InvokeContractArgs
from .invoke_host_function_op import InvokeHostFunctionOp
from .invoke_host_function_result import InvokeHostFunctionResult
from .invoke_host_function_result_code import InvokeHostFunctionResultCode
Expand Down Expand Up @@ -199,6 +197,7 @@
from .ledger_key_contract_code import LedgerKeyContractCode
from .ledger_key_contract_data import LedgerKeyContractData
from .ledger_key_data import LedgerKeyData
from .ledger_key_expiration import LedgerKeyExpiration
from .ledger_key_liquidity_pool import LedgerKeyLiquidityPool
from .ledger_key_offer import LedgerKeyOffer
from .ledger_key_trust_line import LedgerKeyTrustLine
Expand Down Expand Up @@ -308,7 +307,6 @@
from .sc_spec_type_map import SCSpecTypeMap
from .sc_spec_type_option import SCSpecTypeOption
from .sc_spec_type_result import SCSpecTypeResult
from .sc_spec_type_set import SCSpecTypeSet
from .sc_spec_type_tuple import SCSpecTypeTuple
from .sc_spec_type_udt import SCSpecTypeUDT
from .sc_spec_type_vec import SCSpecTypeVec
Expand Down Expand Up @@ -360,7 +358,6 @@
from .simple_payment_result import SimplePaymentResult
from .soroban_address_credentials import SorobanAddressCredentials
from .soroban_authorization_entry import SorobanAuthorizationEntry
from .soroban_authorized_contract_function import SorobanAuthorizedContractFunction
from .soroban_authorized_function import SorobanAuthorizedFunction
from .soroban_authorized_function_type import SorobanAuthorizedFunctionType
from .soroban_authorized_invocation import SorobanAuthorizedInvocation
Expand Down
11 changes: 11 additions & 0 deletions stellar_sdk/xdr/bump_footprint_expiration_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ class BumpFootprintExpirationResult:
void;
case BUMP_FOOTPRINT_EXPIRATION_MALFORMED:
case BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED:
case BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE:
void;
};
"""
Expand Down Expand Up @@ -48,6 +49,11 @@ def pack(self, packer: Packer) -> None:
== BumpFootprintExpirationResultCode.BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED
):
return
if (
self.code
== BumpFootprintExpirationResultCode.BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE
):
return

@classmethod
def unpack(cls, unpacker: Unpacker) -> BumpFootprintExpirationResult:
Expand All @@ -64,6 +70,11 @@ def unpack(cls, unpacker: Unpacker) -> BumpFootprintExpirationResult:
== BumpFootprintExpirationResultCode.BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED
):
return cls(code=code)
if (
code
== BumpFootprintExpirationResultCode.BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE
):
return cls(code=code)
return cls(code=code)

def to_xdr_bytes(self) -> bytes:
Expand Down
4 changes: 3 additions & 1 deletion stellar_sdk/xdr/bump_footprint_expiration_result_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ class BumpFootprintExpirationResultCode(IntEnum):
// codes considered as "failure" for the operation
BUMP_FOOTPRINT_EXPIRATION_MALFORMED = -1,
BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED = -2
BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED = -2,
BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE = -3
};
"""

BUMP_FOOTPRINT_EXPIRATION_SUCCESS = 0
BUMP_FOOTPRINT_EXPIRATION_MALFORMED = -1
BUMP_FOOTPRINT_EXPIRATION_RESOURCE_LIMIT_EXCEEDED = -2
BUMP_FOOTPRINT_EXPIRATION_INSUFFICIENT_REFUNDABLE_FEE = -3

def pack(self, packer: Packer) -> None:
packer.pack_int(self.value)
Expand Down
41 changes: 20 additions & 21 deletions stellar_sdk/xdr/config_setting_contract_bandwidth_v0.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,40 @@ class ConfigSettingContractBandwidthV0:
struct ConfigSettingContractBandwidthV0
{
// Maximum size in bytes to propagate per ledger
uint32 ledgerMaxPropagateSizeBytes;
// Maximum sum of all transaction sizes in the ledger in bytes
uint32 ledgerMaxTxsSizeBytes;
// Maximum size in bytes for a transaction
uint32 txMaxSizeBytes;
// Fee for propagating 1KB of data
int64 feePropagateData1KB;
// Fee for 1 KB of transaction size
int64 feeTxSize1KB;
};
"""

def __init__(
self,
ledger_max_propagate_size_bytes: Uint32,
ledger_max_txs_size_bytes: Uint32,
tx_max_size_bytes: Uint32,
fee_propagate_data1_kb: Int64,
fee_tx_size1_kb: Int64,
) -> None:
self.ledger_max_propagate_size_bytes = ledger_max_propagate_size_bytes
self.ledger_max_txs_size_bytes = ledger_max_txs_size_bytes
self.tx_max_size_bytes = tx_max_size_bytes
self.fee_propagate_data1_kb = fee_propagate_data1_kb
self.fee_tx_size1_kb = fee_tx_size1_kb

def pack(self, packer: Packer) -> None:
self.ledger_max_propagate_size_bytes.pack(packer)
self.ledger_max_txs_size_bytes.pack(packer)
self.tx_max_size_bytes.pack(packer)
self.fee_propagate_data1_kb.pack(packer)
self.fee_tx_size1_kb.pack(packer)

@classmethod
def unpack(cls, unpacker: Unpacker) -> ConfigSettingContractBandwidthV0:
ledger_max_propagate_size_bytes = Uint32.unpack(unpacker)
ledger_max_txs_size_bytes = Uint32.unpack(unpacker)
tx_max_size_bytes = Uint32.unpack(unpacker)
fee_propagate_data1_kb = Int64.unpack(unpacker)
fee_tx_size1_kb = Int64.unpack(unpacker)
return cls(
ledger_max_propagate_size_bytes=ledger_max_propagate_size_bytes,
ledger_max_txs_size_bytes=ledger_max_txs_size_bytes,
tx_max_size_bytes=tx_max_size_bytes,
fee_propagate_data1_kb=fee_propagate_data1_kb,
fee_tx_size1_kb=fee_tx_size1_kb,
)

def to_xdr_bytes(self) -> bytes:
Expand All @@ -76,26 +76,25 @@ def from_xdr(cls, xdr: str) -> ConfigSettingContractBandwidthV0:
def __hash__(self):
return hash(
(
self.ledger_max_propagate_size_bytes,
self.ledger_max_txs_size_bytes,
self.tx_max_size_bytes,
self.fee_propagate_data1_kb,
self.fee_tx_size1_kb,
)
)

def __eq__(self, other: object):
if not isinstance(other, self.__class__):
return NotImplemented
return (
self.ledger_max_propagate_size_bytes
== other.ledger_max_propagate_size_bytes
self.ledger_max_txs_size_bytes == other.ledger_max_txs_size_bytes
and self.tx_max_size_bytes == other.tx_max_size_bytes
and self.fee_propagate_data1_kb == other.fee_propagate_data1_kb
and self.fee_tx_size1_kb == other.fee_tx_size1_kb
)

def __str__(self):
out = [
f"ledger_max_propagate_size_bytes={self.ledger_max_propagate_size_bytes}",
f"ledger_max_txs_size_bytes={self.ledger_max_txs_size_bytes}",
f"tx_max_size_bytes={self.tx_max_size_bytes}",
f"fee_propagate_data1_kb={self.fee_propagate_data1_kb}",
f"fee_tx_size1_kb={self.fee_tx_size1_kb}",
]
return f"<ConfigSettingContractBandwidthV0 [{', '.join(out)}]>"
96 changes: 46 additions & 50 deletions stellar_sdk/xdr/config_setting_contract_ledger_cost_v0.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,16 @@ class ConfigSettingContractLedgerCostV0:
int64 feeWriteLedgerEntry; // Fee per ledger entry write
int64 feeRead1KB; // Fee for reading 1KB
int64 feeWrite1KB; // Fee for writing 1KB
// Bucket list fees grow slowly up to that size
int64 bucketListSizeBytes;
// Fee rate in stroops when the bucket list is empty
int64 bucketListFeeRateLow;
// Fee rate in stroops when the bucket list reached bucketListSizeBytes
int64 bucketListFeeRateHigh;
// Rate multiplier for any additional data past the first bucketListSizeBytes
uint32 bucketListGrowthFactor;
// The following parameters determine the write fee per 1KB.
// Write fee grows linearly until bucket list reaches this size
int64 bucketListTargetSizeBytes;
// Fee per 1KB write when the bucket list is empty
int64 writeFee1KBBucketListLow;
// Fee per 1KB write when the bucket list has reached `bucketListTargetSizeBytes`
int64 writeFee1KBBucketListHigh;
// Write fee multiplier for any additional data past the first `bucketListTargetSizeBytes`
uint32 bucketListWriteFeeGrowthFactor;
};
"""

Expand All @@ -66,11 +66,10 @@ def __init__(
fee_read_ledger_entry: Int64,
fee_write_ledger_entry: Int64,
fee_read1_kb: Int64,
fee_write1_kb: Int64,
bucket_list_size_bytes: Int64,
bucket_list_fee_rate_low: Int64,
bucket_list_fee_rate_high: Int64,
bucket_list_growth_factor: Uint32,
bucket_list_target_size_bytes: Int64,
write_fee1_kb_bucket_list_low: Int64,
write_fee1_kb_bucket_list_high: Int64,
bucket_list_write_fee_growth_factor: Uint32,
) -> None:
self.ledger_max_read_ledger_entries = ledger_max_read_ledger_entries
self.ledger_max_read_bytes = ledger_max_read_bytes
Expand All @@ -83,11 +82,10 @@ def __init__(
self.fee_read_ledger_entry = fee_read_ledger_entry
self.fee_write_ledger_entry = fee_write_ledger_entry
self.fee_read1_kb = fee_read1_kb
self.fee_write1_kb = fee_write1_kb
self.bucket_list_size_bytes = bucket_list_size_bytes
self.bucket_list_fee_rate_low = bucket_list_fee_rate_low
self.bucket_list_fee_rate_high = bucket_list_fee_rate_high
self.bucket_list_growth_factor = bucket_list_growth_factor
self.bucket_list_target_size_bytes = bucket_list_target_size_bytes
self.write_fee1_kb_bucket_list_low = write_fee1_kb_bucket_list_low
self.write_fee1_kb_bucket_list_high = write_fee1_kb_bucket_list_high
self.bucket_list_write_fee_growth_factor = bucket_list_write_fee_growth_factor

def pack(self, packer: Packer) -> None:
self.ledger_max_read_ledger_entries.pack(packer)
Expand All @@ -101,11 +99,10 @@ def pack(self, packer: Packer) -> None:
self.fee_read_ledger_entry.pack(packer)
self.fee_write_ledger_entry.pack(packer)
self.fee_read1_kb.pack(packer)
self.fee_write1_kb.pack(packer)
self.bucket_list_size_bytes.pack(packer)
self.bucket_list_fee_rate_low.pack(packer)
self.bucket_list_fee_rate_high.pack(packer)
self.bucket_list_growth_factor.pack(packer)
self.bucket_list_target_size_bytes.pack(packer)
self.write_fee1_kb_bucket_list_low.pack(packer)
self.write_fee1_kb_bucket_list_high.pack(packer)
self.bucket_list_write_fee_growth_factor.pack(packer)

@classmethod
def unpack(cls, unpacker: Unpacker) -> ConfigSettingContractLedgerCostV0:
Expand All @@ -120,11 +117,10 @@ def unpack(cls, unpacker: Unpacker) -> ConfigSettingContractLedgerCostV0:
fee_read_ledger_entry = Int64.unpack(unpacker)
fee_write_ledger_entry = Int64.unpack(unpacker)
fee_read1_kb = Int64.unpack(unpacker)
fee_write1_kb = Int64.unpack(unpacker)
bucket_list_size_bytes = Int64.unpack(unpacker)
bucket_list_fee_rate_low = Int64.unpack(unpacker)
bucket_list_fee_rate_high = Int64.unpack(unpacker)
bucket_list_growth_factor = Uint32.unpack(unpacker)
bucket_list_target_size_bytes = Int64.unpack(unpacker)
write_fee1_kb_bucket_list_low = Int64.unpack(unpacker)
write_fee1_kb_bucket_list_high = Int64.unpack(unpacker)
bucket_list_write_fee_growth_factor = Uint32.unpack(unpacker)
return cls(
ledger_max_read_ledger_entries=ledger_max_read_ledger_entries,
ledger_max_read_bytes=ledger_max_read_bytes,
Expand All @@ -137,11 +133,10 @@ def unpack(cls, unpacker: Unpacker) -> ConfigSettingContractLedgerCostV0:
fee_read_ledger_entry=fee_read_ledger_entry,
fee_write_ledger_entry=fee_write_ledger_entry,
fee_read1_kb=fee_read1_kb,
fee_write1_kb=fee_write1_kb,
bucket_list_size_bytes=bucket_list_size_bytes,
bucket_list_fee_rate_low=bucket_list_fee_rate_low,
bucket_list_fee_rate_high=bucket_list_fee_rate_high,
bucket_list_growth_factor=bucket_list_growth_factor,
bucket_list_target_size_bytes=bucket_list_target_size_bytes,
write_fee1_kb_bucket_list_low=write_fee1_kb_bucket_list_low,
write_fee1_kb_bucket_list_high=write_fee1_kb_bucket_list_high,
bucket_list_write_fee_growth_factor=bucket_list_write_fee_growth_factor,
)

def to_xdr_bytes(self) -> bytes:
Expand Down Expand Up @@ -177,11 +172,10 @@ def __hash__(self):
self.fee_read_ledger_entry,
self.fee_write_ledger_entry,
self.fee_read1_kb,
self.fee_write1_kb,
self.bucket_list_size_bytes,
self.bucket_list_fee_rate_low,
self.bucket_list_fee_rate_high,
self.bucket_list_growth_factor,
self.bucket_list_target_size_bytes,
self.write_fee1_kb_bucket_list_low,
self.write_fee1_kb_bucket_list_high,
self.bucket_list_write_fee_growth_factor,
)
)

Expand All @@ -201,11 +195,14 @@ def __eq__(self, other: object):
and self.fee_read_ledger_entry == other.fee_read_ledger_entry
and self.fee_write_ledger_entry == other.fee_write_ledger_entry
and self.fee_read1_kb == other.fee_read1_kb
and self.fee_write1_kb == other.fee_write1_kb
and self.bucket_list_size_bytes == other.bucket_list_size_bytes
and self.bucket_list_fee_rate_low == other.bucket_list_fee_rate_low
and self.bucket_list_fee_rate_high == other.bucket_list_fee_rate_high
and self.bucket_list_growth_factor == other.bucket_list_growth_factor
and self.bucket_list_target_size_bytes
== other.bucket_list_target_size_bytes
and self.write_fee1_kb_bucket_list_low
== other.write_fee1_kb_bucket_list_low
and self.write_fee1_kb_bucket_list_high
== other.write_fee1_kb_bucket_list_high
and self.bucket_list_write_fee_growth_factor
== other.bucket_list_write_fee_growth_factor
)

def __str__(self):
Expand All @@ -221,10 +218,9 @@ def __str__(self):
f"fee_read_ledger_entry={self.fee_read_ledger_entry}",
f"fee_write_ledger_entry={self.fee_write_ledger_entry}",
f"fee_read1_kb={self.fee_read1_kb}",
f"fee_write1_kb={self.fee_write1_kb}",
f"bucket_list_size_bytes={self.bucket_list_size_bytes}",
f"bucket_list_fee_rate_low={self.bucket_list_fee_rate_low}",
f"bucket_list_fee_rate_high={self.bucket_list_fee_rate_high}",
f"bucket_list_growth_factor={self.bucket_list_growth_factor}",
f"bucket_list_target_size_bytes={self.bucket_list_target_size_bytes}",
f"write_fee1_kb_bucket_list_low={self.write_fee1_kb_bucket_list_low}",
f"write_fee1_kb_bucket_list_high={self.write_fee1_kb_bucket_list_high}",
f"bucket_list_write_fee_growth_factor={self.bucket_list_write_fee_growth_factor}",
]
return f"<ConfigSettingContractLedgerCostV0 [{', '.join(out)}]>"
Loading

0 comments on commit 0133b45

Please sign in to comment.