diff --git a/scripts/soroban-settings/SorobanSettingsUpgrade.py b/scripts/soroban-settings/SorobanSettingsUpgrade.py deleted file mode 100644 index 1d5f3c8445..0000000000 --- a/scripts/soroban-settings/SorobanSettingsUpgrade.py +++ /dev/null @@ -1,340 +0,0 @@ -from stellar_sdk.xdr import * -from stellar_sdk import Network, Keypair, TransactionBuilder, StrKey, utils, scval -from stellar_sdk.exceptions import PrepareTransactionException -from stellar_sdk.soroban_server import SorobanServer -from stellar_sdk.soroban_rpc import GetTransactionStatus -from stellar_sdk.xdr import TransactionMeta, LedgerEntryType, LedgerKey, ConfigSettingContractComputeV0, ConfigUpgradeSet, ConfigSettingContractLedgerCostV0, ConfigSettingContractHistoricalDataV0, ConfigSettingContractEventsV0, ConfigSettingContractBandwidthV0, ConfigUpgradeSetKey, ConfigSettingEntry, StateArchivalSettings, ConfigSettingContractExecutionLanesV0, Uint32, Uint64, Int64, Hash, LedgerKeyConfigSetting, ConfigSettingID -import stellar_sdk -from enum import IntEnum -import urllib.parse -import argparse -import time -import sys - -secret = "SAAPYAPTTRZMCUZFPG3G66V4ZMHTK4TWA6NS7U4F7Z3IMUD52EK4DDEV" -# public -> GDAT5HWTGIU4TSSZ4752OUC4SABDLTLZFRPZUJ3D6LKBNEPA7V2CIG54 - -# For standalone -# Fund standalone with friendbot - http://localhost:8000/friendbot?addr=GDAT5HWTGIU4TSSZ4752OUC4SABDLTLZFRPZUJ3D6LKBNEPA7V2CIG54 -# rpc_server_url = "http://127.0.0.1:8000/soroban/rpc" -# network_passphrase = Network.STANDALONE_NETWORK_PASSPHRASE - -# For futurenet -# Fund futurenet with friendbot - https://friendbot-futurenet.stellar.org/?addr=GDAT5HWTGIU4TSSZ4752OUC4SABDLTLZFRPZUJ3D6LKBNEPA7V2CIG54 -rpc_server_url = "https://rpc-futurenet.stellar.org:443/" -network_passphrase = Network.FUTURENET_NETWORK_PASSPHRASE - -contract_file_path = "write_upgrade_bytes/target/wasm32-unknown-unknown/release/soroban_write_upgrade_bytes_contract.wasm" - -kp = Keypair.from_secret(secret) -soroban_server = SorobanServer(rpc_server_url) - -# hardcode the upgrade you want to do here. -def get_upgrade_set(): - - execution_lane_tx_count_per_ledger = 30 - max_data_entry_size = 64 * 1024 - max_txn_per_ledger = 1 - max_read_bytes_per_tx = 130 * 1024 - max_write_bytes_per_tx = 65 * 1024 - max_instructions_per_tx = 100_000_000 - max_read_entries_tx = 30 - max_write_entries_per_tx = 20 - max_size_bytes_per_tx = 70 * 1024 # tx envelope - - max_contract_size = Uint32(max_data_entry_size) - - contract_size_upgrade_entry = ConfigSettingEntry( - ConfigSettingID.CONFIG_SETTING_CONTRACT_MAX_SIZE_BYTES, - contract_max_size_bytes = max_contract_size) - - compute_settings = ConfigSettingContractComputeV0(ledger_max_instructions=Int64(max_txn_per_ledger * max_instructions_per_tx), - tx_max_instructions=Int64(max_instructions_per_tx), - fee_rate_per_instructions_increment=Int64(100), - tx_memory_limit=Uint32(40 * 1024 * 1024)) # 40 mb - - compute_upgrade_entry = ConfigSettingEntry( - ConfigSettingID.CONFIG_SETTING_CONTRACT_COMPUTE_V0, - contract_compute = compute_settings) - - contract_ledger_cost_settings = ConfigSettingContractLedgerCostV0(ledger_max_read_ledger_entries=Uint32(max_txn_per_ledger * max_read_entries_tx), - ledger_max_read_bytes=Uint32(max_txn_per_ledger * max_read_bytes_per_tx), # 130 kb - ledger_max_write_ledger_entries=Uint32(max_txn_per_ledger * max_write_entries_per_tx), - ledger_max_write_bytes=Uint32(max_txn_per_ledger * max_write_bytes_per_tx), # 65 kb - tx_max_read_ledger_entries=Uint32(max_read_entries_tx), - tx_max_read_bytes=Uint32(max_read_bytes_per_tx), # 130 kb - tx_max_write_ledger_entries=Uint32(max_write_entries_per_tx), - tx_max_write_bytes=Uint32(max_write_bytes_per_tx), # 65 kb - fee_read_ledger_entry=Int64(1000), - fee_write_ledger_entry=Int64(3000), - fee_read1_kb=Int64(1000), - bucket_list_target_size_bytes=Int64(2 * 1024 * 1024 * 1024), # 2 GB - write_fee1_kb_bucket_list_low=Int64(1000), - write_fee1_kb_bucket_list_high=Int64(4_000_000), # 0.4 XLM = 0.4 * 10 ^ stroops - bucket_list_write_fee_growth_factor=Uint32(1000)) - - contract_ledger_cost_entry = ConfigSettingEntry( - ConfigSettingID.CONFIG_SETTING_CONTRACT_LEDGER_COST_V0, - contract_ledger_cost = contract_ledger_cost_settings) - - contract_historical_data_settings = ConfigSettingContractHistoricalDataV0(fee_historical1_kb=Int64(5000)) - - contract_historical_data_entry = ConfigSettingEntry( - ConfigSettingID.CONFIG_SETTING_CONTRACT_HISTORICAL_DATA_V0, - contract_historical_data = contract_historical_data_settings) - - contract_events_settings = ConfigSettingContractEventsV0(tx_max_contract_events_size_bytes=Uint32(2 * 1024), # 2 kb - fee_contract_events1_kb=Int64(300)) - - contract_events_entry = ConfigSettingEntry( - ConfigSettingID.CONFIG_SETTING_CONTRACT_EVENTS_V0, - contract_events = contract_events_settings) - - contract_bandwidth_settings = ConfigSettingContractBandwidthV0(ledger_max_txs_size_bytes=Uint32(max_size_bytes_per_tx), # 100 kb - tx_max_size_bytes=Uint32(max_size_bytes_per_tx), # 70 kb - fee_tx_size1_kb=Int64(500)) - - contract_bandwidth_entry = ConfigSettingEntry( - ConfigSettingID.CONFIG_SETTING_CONTRACT_BANDWIDTH_V0, - contract_bandwidth = contract_bandwidth_settings) - - contract_data_entry_size = Uint32(max_data_entry_size) - - contract_data_entry_entry = ConfigSettingEntry( - ConfigSettingID.CONFIG_SETTING_CONTRACT_DATA_ENTRY_SIZE_BYTES, - contract_data_entry_size_bytes = contract_data_entry_size) - - ledgers_per_day = 12 * 60 * 24 - state_arch_settings = StateArchivalSettings(max_entry_ttl=Uint32(ledgers_per_day * 31 ), # 31 days, 12 ledger close per minute - min_temp_entry_ttl=Uint32(16), - min_persistent_entry_ttl=Uint32(ledgers_per_day * 7), # 7 days - persistent_rent_rate_denominator=Int64(ledgers_per_day * 31), - temp_rent_rate_denominator=Int64(ledgers_per_day * 31 * 10), - max_entries_to_archive=Uint32(100), - bucket_list_size_window_sample_size=Uint32(30), #InitialSorobanNetworkConfig - eviction_scan_size=Uint64(100_000), #InitialSorobanNetworkConfig - starting_eviction_scan_level=Uint32(1)) - - state_arch_upgrade_entry = ConfigSettingEntry( - ConfigSettingID.CONFIG_SETTING_STATE_ARCHIVAL, - state_archival_settings = state_arch_settings) - - execution_lanes_setting = ConfigSettingContractExecutionLanesV0(ledger_max_tx_count=Uint32(execution_lane_tx_count_per_ledger)) - - execution_lanes_entry = ConfigSettingEntry( - ConfigSettingID.CONFIG_SETTING_CONTRACT_EXECUTION_LANES, - contract_execution_lanes = execution_lanes_setting) - - return ConfigUpgradeSet([contract_size_upgrade_entry, compute_upgrade_entry, contract_ledger_cost_entry, contract_historical_data_entry, contract_events_entry, contract_bandwidth_entry, contract_data_entry_entry, state_arch_upgrade_entry, execution_lanes_entry]) -############# - -# TODO: Update tx submissions to go directly to tx endpoint instead of rpc -# Upload and create contract - - -def deploy_contract(): - print("uploading contract...") - source = soroban_server.load_account(kp.public_key) - tx = ( - TransactionBuilder(source, network_passphrase) - .set_timeout(300) - .append_upload_contract_wasm_op( - contract=contract_file_path, # the path to the contract, or binary data - ) - .build() - ) - - try: - tx = soroban_server.prepare_transaction(tx) - except PrepareTransactionException as e: - print(f"Got exception: {e.simulate_transaction_response}") - raise e - - tx.sign(kp) - send_transaction_data = soroban_server.send_transaction(tx) - print(f"sent transaction: {send_transaction_data}") - - while True: - print("waiting for transaction to be confirmed...") - get_transaction_data = soroban_server.get_transaction( - send_transaction_data.hash) - if get_transaction_data.status != GetTransactionStatus.NOT_FOUND: - break - time.sleep(3) - - print(f"transaction: {get_transaction_data}\n\n") - - wasm_id = None - - assert get_transaction_data.status == GetTransactionStatus.SUCCESS - assert get_transaction_data.result_meta_xdr is not None - transaction_meta = TransactionMeta.from_xdr( - get_transaction_data.result_meta_xdr - ) - wasm_id = transaction_meta.v3.soroban_meta.return_value.bytes.sc_bytes.hex() # type: ignore - print(f"wasm id: {wasm_id}") - - assert wasm_id, "wasm id should not be empty" - - print("creating contract...") - - source = soroban_server.load_account( - kp.public_key - ) # refresh source account, because the current SDK will increment the sequence number by one after building a transaction - - tx = ( - TransactionBuilder(source, network_passphrase) - .set_timeout(300) - .append_create_contract_op( - wasm_id=wasm_id, - address=kp.public_key, - ) - .build() - ) - - try: - tx = soroban_server.prepare_transaction(tx) - except PrepareTransactionException as e: - print(f"Got exception: {e.simulate_transaction_response}") - raise e - - tx.sign(kp) - - send_transaction_data = soroban_server.send_transaction(tx) - print(f"sent transaction: {send_transaction_data}") - - while True: - print("waiting for transaction to be confirmed...") - get_transaction_data = soroban_server.get_transaction( - send_transaction_data.hash) - if get_transaction_data.status != GetTransactionStatus.NOT_FOUND: - break - time.sleep(3) - - print(f"transaction: {get_transaction_data}\n\n") - - assert get_transaction_data.status == GetTransactionStatus.SUCCESS - assert get_transaction_data.result_meta_xdr is not None - transaction_meta = TransactionMeta.from_xdr( - get_transaction_data.result_meta_xdr - ) - return transaction_meta.v3.soroban_meta.return_value.address.contract_id.hash # type: ignore - - -def upload_upgrade_bytes(contract_id, upgrade): - source = soroban_server.load_account(kp.public_key) - - tx = ( - TransactionBuilder(source, network_passphrase, base_fee=100) - .add_time_bounds(0, 0) - .append_invoke_contract_function_op( - contract_id=contract_id, - function_name="write", - parameters=[scval.to_bytes(upgrade.to_xdr_bytes())], - ) - .build() - ) - - try: - tx = soroban_server.prepare_transaction(tx) - except PrepareTransactionException as e: - print(f"Got exception: {e.simulate_transaction_response}") - raise e - - tx.sign(kp) - send_transaction_data = soroban_server.send_transaction(tx) - print(f"sent transaction: {send_transaction_data}") - - while True: - print("waiting for transaction to be confirmed...") - get_transaction_data = soroban_server.get_transaction( - send_transaction_data.hash) - if get_transaction_data.status != GetTransactionStatus.NOT_FOUND: - break - time.sleep(3) - - print(f"transaction: {get_transaction_data}\n\n") - - assert get_transaction_data.status == GetTransactionStatus.SUCCESS - - -def get_upgrade_key(contract_id, upgrade_hash): - key = ConfigUpgradeSetKey(contract_id=Hash( - contract_id), content_hash=Hash(upgrade_hash)) - return key - - -""" -The setup_upgrade mode will setup the ContractData required for the -upgrade, and then print out the url encoded xdr to submit to core -using the upgrades endpoint (upgrades?mode=set&configupgradesetkey=********). - -Note that the upgrade is specified in code at the moment (upgrade = get_upgrade_set()) -""" - - -def setup_upgrade(args): - # Get upgrade xdr - upgrade = get_upgrade_set() - upgrade_hash = utils.sha256(upgrade.to_xdr_bytes()) - - # Deploy contract - contract_id_hash = deploy_contract() - # print(f"contract id xdr: {Hash(contract_id_hash).to_xdr()}") - print(f"contract id hex: {Hash(contract_id_hash).to_xdr_bytes().hex()}") - - contract_id_str = StrKey.encode_contract(contract_id_hash) - print(f"contract id: {contract_id_str}") - - # Invoke contract - upload_upgrade_bytes(contract_id_str, upgrade) - - # Get upgrade - upgrade_key = get_upgrade_key(contract_id_hash, upgrade_hash).to_xdr() - url_encoded_key = urllib.parse.quote(upgrade_key) - print(f"url encoded upgrade: {url_encoded_key}") - - -def get_settings(args): - config_setting = LedgerKeyConfigSetting( - config_setting_id=ConfigSettingID(int(args.configSettingID))) - ledger_key = LedgerKey( - LedgerEntryType.CONFIG_SETTING, - config_setting = config_setting) - - resp = soroban_server.get_ledger_entries([ledger_key]) - if resp.entries is None: - raise RequestException( - 404, - f"Ledger entry not found, maybe you need to activate", - ) - assert len(resp.entries) == 1 - data = LedgerEntryData.from_xdr(resp.entries[0].xdr) - assert data.config_setting is not None - print(data) - - -def main(): - argument_parser = argparse.ArgumentParser() - subparsers = argument_parser.add_subparsers(required=True) - - parser_setup_upgrade = subparsers.add_parser( - "setupUpgrade", - help="Get upgrade for hardcoded settings") - parser_setup_upgrade.set_defaults(func=setup_upgrade) - - parser_get_settings = subparsers.add_parser( - "getSettings", - help="Get settings") - parser_get_settings.add_argument("-id", - "--configSettingID", - required=True, - help="The integer ConfigSettingID value being queried") - parser_get_settings.set_defaults(func=get_settings) - - args = argument_parser.parse_args() - args.func(args) - - -if __name__ == "__main__": - main() diff --git a/scripts/soroban-settings/write_upgrade_bytes/Cargo.lock b/scripts/soroban-settings/write_upgrade_bytes/Cargo.lock deleted file mode 100644 index f6f40d671d..0000000000 --- a/scripts/soroban-settings/write_upgrade_bytes/Cargo.lock +++ /dev/null @@ -1,1486 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "addr2line" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a76fd60b23679b7d19bd066031410fb7e458ccc5e958eb5c325888ce4baedc97" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "arbitrary" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d098ff73c1ca148721f37baad5ea6a465a13f9573aba8641fbbbae8164a54e" -dependencies = [ - "derive_arbitrary", -] - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "backtrace" -version = "0.3.67" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "233d376d6d185f2a3093e58f283f60f880315b6c60075b01f36b3b85154564ca" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base16ct" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" - -[[package]] -name = "base32" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23ce669cd6c8588f79e15cf450314f9638f967fc5770ff1c7c1deb0925ea7cfa" - -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" - -[[package]] -name = "base64ct" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" - -[[package]] -name = "block-buffer" -version = "0.10.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" -dependencies = [ - "generic-array", -] - -[[package]] -name = "bumpalo" -version = "3.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b1ce199063694f33ffb7dd4e0ee620741495c32833cde5aa08f02a0bf96f0c8" - -[[package]] -name = "bytes-lit" -version = "0.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0adabf37211a5276e46335feabcbb1530c95eb3fdf85f324c7db942770aa025d" -dependencies = [ - "num-bigint", - "proc-macro2", - "quote", - "syn 2.0.15", -] - -[[package]] -name = "cc" -version = "1.0.79" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f" - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "chrono" -version = "0.4.24" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" -dependencies = [ - "iana-time-zone", - "num-integer", - "num-traits", - "serde", - "winapi", -] - -[[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - -[[package]] -name = "const-oid" -version = "0.9.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" - -[[package]] -name = "core-foundation-sys" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" - -[[package]] -name = "cpufeatures" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e4c1eaa2012c47becbbad2ab175484c2a84d1185b566fb2cc5b8707343dfe58" -dependencies = [ - "libc", -] - -[[package]] -name = "crate-git-revision" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c521bf1f43d31ed2f73441775ed31935d77901cb3451e44b38a1c1612fcbaf98" -dependencies = [ - "serde", - "serde_derive", - "serde_json", -] - -[[package]] -name = "crypto-bigint" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" -dependencies = [ - "generic-array", - "rand_core", - "subtle", - "zeroize", -] - -[[package]] -name = "crypto-common" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" -dependencies = [ - "generic-array", - "typenum", -] - -[[package]] -name = "ctor" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1586fa608b1dab41f667475b4a41faec5ba680aee428bfa5de4ea520fdc6e901" -dependencies = [ - "quote", - "syn 2.0.15", -] - -[[package]] -name = "curve25519-dalek" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622178105f911d937a42cdb140730ba4a3ed2becd8ae6ce39c7d28b5d75d4588" -dependencies = [ - "cfg-if", - "cpufeatures", - "curve25519-dalek-derive", - "digest", - "fiat-crypto", - "platforms", - "rustc_version", - "subtle", - "zeroize", -] - -[[package]] -name = "curve25519-dalek-derive" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83fdaf97f4804dcebfa5862639bc9ce4121e82140bec2a987ac5140294865b5b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.15", -] - -[[package]] -name = "cxx" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f61f1b6389c3fe1c316bf8a4dccc90a38208354b330925bce1f74a6c4756eb93" -dependencies = [ - "cc", - "cxxbridge-flags", - "cxxbridge-macro", - "link-cplusplus", -] - -[[package]] -name = "cxx-build" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12cee708e8962df2aeb38f594aae5d827c022b6460ac71a7a3e2c3c2aae5a07b" -dependencies = [ - "cc", - "codespan-reporting", - "once_cell", - "proc-macro2", - "quote", - "scratch", - "syn 2.0.15", -] - -[[package]] -name = "cxxbridge-flags" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7944172ae7e4068c533afbb984114a56c46e9ccddda550499caa222902c7f7bb" - -[[package]] -name = "cxxbridge-macro" -version = "1.0.94" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2345488264226bf682893e25de0769f3360aac9957980ec49361b083ddaa5bc5" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.15", -] - -[[package]] -name = "darling" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0558d22a7b463ed0241e993f76f09f30b126687447751a8638587b864e4b3944" -dependencies = [ - "darling_core", - "darling_macro", -] - -[[package]] -name = "darling_core" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab8bfa2e259f8ee1ce5e97824a3c55ec4404a0d772ca7fa96bf19f0752a046eb" -dependencies = [ - "fnv", - "ident_case", - "proc-macro2", - "quote", - "strsim", - "syn 2.0.15", -] - -[[package]] -name = "darling_macro" -version = "0.20.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29a358ff9f12ec09c3e61fef9b5a9902623a695a46a917b07f269bff1445611a" -dependencies = [ - "darling_core", - "quote", - "syn 2.0.15", -] - -[[package]] -name = "der" -version = "0.7.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56acb310e15652100da43d130af8d97b509e95af61aab1c5a7939ef24337ee17" -dependencies = [ - "const-oid", - "zeroize", -] - -[[package]] -name = "derive_arbitrary" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cdeb9ec472d588e539a818b2dee436825730da08ad0017c4b1a17676bdc8b7" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "digest" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" -dependencies = [ - "block-buffer", - "const-oid", - "crypto-common", - "subtle", -] - -[[package]] -name = "downcast-rs" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" - -[[package]] -name = "ecdsa" -version = "0.16.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" -dependencies = [ - "der", - "digest", - "elliptic-curve", - "rfc6979", - "signature", - "spki", -] - -[[package]] -name = "ed25519" -version = "2.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60f6d271ca33075c88028be6f04d502853d63a5ece419d269c15315d4fc1cf1d" -dependencies = [ - "pkcs8", - "signature", -] - -[[package]] -name = "ed25519-dalek" -version = "2.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7277392b266383ef8396db7fdeb1e77b6c52fed775f5df15bb24f35b72156980" -dependencies = [ - "curve25519-dalek", - "ed25519", - "rand_core", - "serde", - "sha2", - "zeroize", -] - -[[package]] -name = "either" -version = "1.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7fcaabb2fef8c910e7f4c7ce9f67a1283a1715879a7c230ca9d6d1ae31f16d91" - -[[package]] -name = "elliptic-curve" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" -dependencies = [ - "base16ct", - "crypto-bigint", - "digest", - "ff", - "generic-array", - "group", - "pkcs8", - "rand_core", - "sec1", - "subtle", - "zeroize", -] - -[[package]] -name = "ethnum" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0198b9d0078e0f30dedc7acbb21c974e838fc8fae3ee170128658a98cb2c1c04" - -[[package]] -name = "ff" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" -dependencies = [ - "rand_core", - "subtle", -] - -[[package]] -name = "fiat-crypto" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0870c84016d4b481be5c9f323c24f65e31e901ae618f0e80f4308fb00de1d2d" - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "generic-array" -version = "0.14.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" -dependencies = [ - "typenum", - "version_check", - "zeroize", -] - -[[package]] -name = "getrandom" -version = "0.2.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi", - "wasm-bindgen", -] - -[[package]] -name = "gimli" -version = "0.27.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0a93d233ebf96623465aad4046a8d3aa4da22d4f4beba5388838c8a434bbb4" - -[[package]] -name = "group" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" -dependencies = [ - "ff", - "rand_core", - "subtle", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hex" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" -dependencies = [ - "serde", -] - -[[package]] -name = "hmac" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" -dependencies = [ - "digest", -] - -[[package]] -name = "iana-time-zone" -version = "0.1.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0722cd7114b7de04316e7ea5456a0bbb20e4adb46fd27a3697adb812cff0f37c" -dependencies = [ - "android_system_properties", - "core-foundation-sys", - "iana-time-zone-haiku", - "js-sys", - "wasm-bindgen", - "windows", -] - -[[package]] -name = "iana-time-zone-haiku" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" -dependencies = [ - "cxx", - "cxx-build", -] - -[[package]] -name = "ident_case" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown", - "serde", -] - -[[package]] -name = "indexmap-nostd" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e04e2fd2b8188ea827b32ef11de88377086d690286ab35747ef7f9bf3ccb590" - -[[package]] -name = "itertools" -version = "0.10.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" -dependencies = [ - "either", -] - -[[package]] -name = "itoa" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" - -[[package]] -name = "js-sys" -version = "0.3.61" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "k256" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cadb76004ed8e97623117f3df85b17aaa6626ab0b0831e6573f104df16cd1bcc" -dependencies = [ - "cfg-if", - "ecdsa", - "elliptic-curve", - "once_cell", - "sha2", - "signature", -] - -[[package]] -name = "keccak" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" -dependencies = [ - "cpufeatures", -] - -[[package]] -name = "libc" -version = "0.2.147" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" - -[[package]] -name = "libm" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" - -[[package]] -name = "link-cplusplus" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ecd207c9c713c34f95a097a5b029ac2ce6010530c7b49d7fea24d977dede04f5" -dependencies = [ - "cc", -] - -[[package]] -name = "log" -version = "0.4.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "memchr" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dffe52ecf27772e601905b7522cb4ef790d2cc203488bbd0e2fe85fcb74566d" - -[[package]] -name = "miniz_oxide" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b275950c28b37e794e8c55d88aeb5e139d0ce23fdbbeda68f8d7174abdf9e8fa" -dependencies = [ - "adler", -] - -[[package]] -name = "num-bigint" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93ab6289c7b344a8a9f60f88d80aa20032336fe78da341afc91c8a2341fc75f" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-derive" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e6a0fd4f737c707bd9086cc16c925f294943eb62eb71499e9fd4cf71f8b9f4e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.15", -] - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd" -dependencies = [ - "autocfg", -] - -[[package]] -name = "object" -version = "0.30.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea86265d3d3dcb6a27fc51bd29a4bf387fae9d2986b823079d4986af253eb439" -dependencies = [ - "memchr", -] - -[[package]] -name = "once_cell" -version = "1.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" - -[[package]] -name = "paste" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f746c4065a8fa3fe23974dd82f15431cc8d40779821001404d10d2e79ca7d79" - -[[package]] -name = "pkcs8" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" -dependencies = [ - "der", - "spki", -] - -[[package]] -name = "platforms" -version = "3.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4503fa043bf02cee09a9582e9554b4c6403b2ef55e4612e96561d294419429f8" - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "prettyplease" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ceca8aaf45b5c46ec7ed39fff75f57290368c1846d33d24a122ca81416ab058" -dependencies = [ - "proc-macro2", - "syn 2.0.15", -] - -[[package]] -name = "proc-macro2" -version = "1.0.56" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "quote" -version = "1.0.26" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "rfc6979" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" -dependencies = [ - "hmac", - "subtle", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - -[[package]] -name = "rustc_version" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366" -dependencies = [ - "semver", -] - -[[package]] -name = "ryu" -version = "1.0.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f91339c0467de62360649f8d3e185ca8de4224ff281f66000de5eb2a77a79041" - -[[package]] -name = "scratch" -version = "1.0.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1792db035ce95be60c3f8853017b3999209281c24e2ba5bc8e59bf97a0c590c1" - -[[package]] -name = "sec1" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0aec48e813d6b90b15f0b8948af3c63483992dee44c03e9930b3eebdabe046e" -dependencies = [ - "base16ct", - "der", - "generic-array", - "pkcs8", - "subtle", - "zeroize", -] - -[[package]] -name = "semver" -version = "1.0.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bebd363326d05ec3e2f532ab7660680f3b02130d780c299bca73469d521bc0ed" - -[[package]] -name = "serde" -version = "1.0.160" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.160" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.15", -] - -[[package]] -name = "serde_json" -version = "1.0.96" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "serde_with" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f02d8aa6e3c385bf084924f660ce2a3a6bd333ba55b35e8590b321f35d88513" -dependencies = [ - "base64 0.21.0", - "chrono", - "hex", - "indexmap", - "serde", - "serde_json", - "serde_with_macros", - "time", -] - -[[package]] -name = "serde_with_macros" -version = "3.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edc7d5d3932fb12ce722ee5e64dd38c504efba37567f0c402f6ca728c3b8b070" -dependencies = [ - "darling", - "proc-macro2", - "quote", - "syn 2.0.15", -] - -[[package]] -name = "sha2" -version = "0.10.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" -dependencies = [ - "cfg-if", - "cpufeatures", - "digest", -] - -[[package]] -name = "sha3" -version = "0.10.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" -dependencies = [ - "digest", - "keccak", -] - -[[package]] -name = "signature" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" -dependencies = [ - "digest", - "rand_core", -] - -[[package]] -name = "smallvec" -version = "1.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a507befe795404456341dfab10cef66ead4c041f62b8b11bbb92bffe5d0953e0" - -[[package]] -name = "soroban-env-common" -version = "20.0.0-rc1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b65261df4aec251bf503bdb9d08a11a0109ad010d22fb6068c5767bd612a76cc" -dependencies = [ - "arbitrary", - "crate-git-revision", - "ethnum", - "num-derive", - "num-traits", - "serde", - "soroban-env-macros", - "soroban-wasmi", - "static_assertions", - "stellar-xdr", -] - -[[package]] -name = "soroban-env-guest" -version = "20.0.0-rc1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5353b943c5ce51df6ba333a734867b301d3b1628dc1aa7d00bd59658059c8193" -dependencies = [ - "soroban-env-common", - "static_assertions", -] - -[[package]] -name = "soroban-env-host" -version = "20.0.0-rc1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b79d564bb297c48be6250334cb33025abe66b90f981de87543b8abd796b3b52" -dependencies = [ - "backtrace", - "ed25519-dalek", - "getrandom", - "k256", - "num-derive", - "num-integer", - "num-traits", - "rand", - "rand_chacha", - "sha2", - "sha3", - "soroban-env-common", - "soroban-native-sdk-macros", - "soroban-wasmi", - "static_assertions", - "stellar-strkey", -] - -[[package]] -name = "soroban-env-macros" -version = "20.0.0-rc1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d827dbe18b79ade40d0d7cfca4a117b59ae1e0feb8dbd4a97f5fca479b04043d" -dependencies = [ - "itertools", - "proc-macro2", - "quote", - "serde", - "serde_json", - "stellar-xdr", - "syn 2.0.15", -] - -[[package]] -name = "soroban-ledger-snapshot" -version = "20.0.0-rc1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15b6817c444562363c619afa0519a8d15157bd8be3a2bf02bf7239245ed263a0" -dependencies = [ - "serde", - "serde_json", - "soroban-env-common", - "soroban-env-host", - "thiserror", -] - -[[package]] -name = "soroban-native-sdk-macros" -version = "20.0.0-rc1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de68658cc0351f3dce994b409af3708fea744d31bbfbfa7335f7481b1be847a2" -dependencies = [ - "itertools", - "proc-macro2", - "quote", - "syn 2.0.15", -] - -[[package]] -name = "soroban-sdk" -version = "20.0.0-rc1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1afc6bb5ed7a89a41fd6e38e30c61c736f905312c8721fbb708bf19ce96d85cb" -dependencies = [ - "arbitrary", - "bytes-lit", - "ctor", - "ed25519-dalek", - "rand", - "soroban-env-guest", - "soroban-env-host", - "soroban-ledger-snapshot", - "soroban-sdk-macros", - "stellar-strkey", -] - -[[package]] -name = "soroban-sdk-macros" -version = "20.0.0-rc1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc90811bcfe1c0fb24fbb1ab8fdd05c98d677ec124b3ce8ef2c0219cb9b47753" -dependencies = [ - "crate-git-revision", - "darling", - "itertools", - "proc-macro2", - "quote", - "rustc_version", - "sha2", - "soroban-env-common", - "soroban-spec", - "soroban-spec-rust", - "stellar-xdr", - "syn 2.0.15", -] - -[[package]] -name = "soroban-spec" -version = "20.0.0-rc1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94e6202dfc8dfd3abcda4f2946d11806a573671d5948c6b2adc5fa8128feeca6" -dependencies = [ - "base64 0.13.1", - "stellar-xdr", - "thiserror", - "wasmparser", -] - -[[package]] -name = "soroban-spec-rust" -version = "20.0.0-rc1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f21ab4a805e72ba39b58a441466c4a8882b6d635a654fdbcbbae092465854d5" -dependencies = [ - "prettyplease", - "proc-macro2", - "quote", - "sha2", - "soroban-spec", - "stellar-xdr", - "syn 2.0.15", - "thiserror", -] - -[[package]] -name = "soroban-wasmi" -version = "0.31.0-soroban1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b6e3e79c1f227ec98ea1e8fbf43d0267b9ca748616c9c8c0162fa2a8ca4d5d2" -dependencies = [ - "smallvec", - "spin", - "wasmi_arena", - "wasmi_core", - "wasmparser-nostd", -] - -[[package]] -name = "soroban-write-upgrade-bytes-contract" -version = "0.0.0" -dependencies = [ - "soroban-sdk", -] - -[[package]] -name = "spin" -version = "0.9.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" - -[[package]] -name = "spki" -version = "0.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" -dependencies = [ - "base64ct", - "der", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "stellar-strkey" -version = "0.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c0689070126ca7f2effc2c5726584446db52190f0cef043c02eb4040a711c11" -dependencies = [ - "base32", - "thiserror", -] - -[[package]] -name = "stellar-xdr" -version = "20.0.0-rc1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e09a3734914a7427dbcd4f06b6dcd2b1cf38e934202f6abe4d73658f718b6113" -dependencies = [ - "arbitrary", - "base64 0.13.1", - "crate-git-revision", - "hex", - "serde", - "serde_with", -] - -[[package]] -name = "strsim" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" - -[[package]] -name = "subtle" -version = "2.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "termcolor" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thiserror" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "978c9a314bd8dc99be594bc3c175faaa9794be04a5a5e153caba6915336cebac" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.15", -] - -[[package]] -name = "time" -version = "0.3.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd0cbfecb4d19b5ea75bb31ad904eb5b9fa13f21079c3b92017ebdf4999a5890" -dependencies = [ - "itoa", - "serde", - "time-core", - "time-macros", -] - -[[package]] -name = "time-core" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" - -[[package]] -name = "time-macros" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd80a657e71da814b8e5d60d3374fc6d35045062245d80224748ae522dd76f36" -dependencies = [ - "time-core", -] - -[[package]] -name = "typenum" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" - -[[package]] -name = "unicode-ident" -version = "1.0.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" - -[[package]] -name = "unicode-width" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 1.0.109", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.84" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" - -[[package]] -name = "wasmi_arena" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "401c1f35e413fac1846d4843745589d9ec678977ab35a384db8ae7830525d468" - -[[package]] -name = "wasmi_core" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf1a7db34bff95b85c261002720c00c3a6168256dcb93041d3fa2054d19856a" -dependencies = [ - "downcast-rs", - "libm", - "num-traits", - "paste", -] - -[[package]] -name = "wasmparser" -version = "0.88.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb8cf7dd82407fe68161bedcd57fde15596f32ebf6e9b3bdbf3ae1da20e38e5e" -dependencies = [ - "indexmap", -] - -[[package]] -name = "wasmparser-nostd" -version = "0.100.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9157cab83003221bfd385833ab587a039f5d6fa7304854042ba358a3b09e0724" -dependencies = [ - "indexmap-nostd", -] - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70ec6ce85bb158151cae5e5c87f95a8e97d2c0c4b001223f33a334e3ce5de178" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-targets", -] - -[[package]] -name = "windows-targets" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" -dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" - -[[package]] -name = "zeroize" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0956f1ba7c7909bfb66c2e9e4124ab6f6482560f6628b5aaeba39207c9aad9" diff --git a/scripts/soroban-settings/write_upgrade_bytes/Cargo.toml b/scripts/soroban-settings/write_upgrade_bytes/Cargo.toml deleted file mode 100644 index 97c6854818..0000000000 --- a/scripts/soroban-settings/write_upgrade_bytes/Cargo.toml +++ /dev/null @@ -1,33 +0,0 @@ -[workspace] - -[package] -name = "soroban-write-upgrade-bytes-contract" -version = "0.0.0" -authors = ["Stellar Development Foundation "] -license = "Apache-2.0" -edition = "2021" -publish = false - -[lib] -crate-type = ["cdylib"] -doctest = false - -[dependencies] -soroban-sdk = { version = "20.0.0-rc1" } - -[dev_dependencies] -soroban-sdk = { version = "20.0.0-rc1", features = ["testutils"] } - -[profile.release] -opt-level = "z" -overflow-checks = true -debug = 0 -strip = "symbols" -debug-assertions = false -panic = "abort" -codegen-units = 1 -lto = true - -[profile.release-with-logs] -inherits = "release" -debug-assertions = true diff --git a/scripts/soroban-settings/write_upgrade_bytes/Makefile b/scripts/soroban-settings/write_upgrade_bytes/Makefile deleted file mode 100644 index 71ad4a6c04..0000000000 --- a/scripts/soroban-settings/write_upgrade_bytes/Makefile +++ /dev/null @@ -1,16 +0,0 @@ -default: build - -all: test - -test: build - cargo test - -build: - soroban contract build - @ls -l target/wasm32-unknown-unknown/release/*.wasm - -fmt: - cargo fmt --all - -clean: - cargo clean diff --git a/scripts/soroban-settings/write_upgrade_bytes/src/lib.rs b/scripts/soroban-settings/write_upgrade_bytes/src/lib.rs deleted file mode 100644 index ced0b29ce1..0000000000 --- a/scripts/soroban-settings/write_upgrade_bytes/src/lib.rs +++ /dev/null @@ -1,23 +0,0 @@ -#![no_std] -use soroban_sdk::{contract, contractimpl, Env, Bytes, BytesN}; - -pub(crate) const EXTEND_AMOUNT: u32 = 518400; // 30 days -pub(crate) const EXTEND_THRESHOLD: u32 = EXTEND_AMOUNT; - -#[contract] -pub struct WriteBytesContract; - -#[contractimpl] -impl WriteBytesContract { - pub fn write(env: Env, xdr_bytes: Bytes) -> BytesN<32> { - let hash = env.crypto().sha256(&xdr_bytes); - env.storage().temporary().set(&hash, &xdr_bytes); - env.storage().temporary().extend(&hash, EXTEND_THRESHOLD, EXTEND_AMOUNT); - - env.storage().instance().extend(EXTEND_THRESHOLD, EXTEND_AMOUNT); - - hash - } -} - -mod test; diff --git a/scripts/soroban-settings/write_upgrade_bytes/src/test.rs b/scripts/soroban-settings/write_upgrade_bytes/src/test.rs deleted file mode 100644 index 1ed2a6796c..0000000000 --- a/scripts/soroban-settings/write_upgrade_bytes/src/test.rs +++ /dev/null @@ -1,6 +0,0 @@ -#![cfg(test)] - -use super::*; -use soroban_sdk::Env; - - //TODO: Add tests \ No newline at end of file diff --git a/soroban-settings/README.md b/soroban-settings/README.md new file mode 100644 index 0000000000..b07c79abfe --- /dev/null +++ b/soroban-settings/README.md @@ -0,0 +1,2 @@ +## Description +This folder contains JSON files that can be encoded into `ConfigUpgradeSet` XDR using the `stellar-xdr` cli. The encoded xdr can be used along with the `get-settings-upgrade-txs` stellar-core command line tool to craft the transactions required to propose a settings upgrade. \ No newline at end of file diff --git a/soroban-settings/phase1.json b/soroban-settings/phase1.json new file mode 100644 index 0000000000..7c26a601f5 --- /dev/null +++ b/soroban-settings/phase1.json @@ -0,0 +1,314 @@ +{ + "updated_entry": [ + { + "contract_max_size_bytes": 65536 + }, + { + "contract_compute_v0": { + "ledger_max_instructions": 100000000, + "tx_max_instructions": 100000000, + "fee_rate_per_instructions_increment": 100, + "tx_memory_limit": 41943040 + } + }, + { + "contract_ledger_cost_v0": { + "ledger_max_read_ledger_entries": 40, + "ledger_max_read_bytes": 133120, + "ledger_max_write_ledger_entries": 20, + "ledger_max_write_bytes": 66560, + "tx_max_read_ledger_entries": 40, + "tx_max_read_bytes": 133120, + "tx_max_write_ledger_entries": 20, + "tx_max_write_bytes": 66560, + "fee_read_ledger_entry": 1000, + "fee_write_ledger_entry": 3000, + "fee_read1_kb": 1000, + "bucket_list_target_size_bytes": 14495514624, + "write_fee1_kb_bucket_list_low": 1000, + "write_fee1_kb_bucket_list_high": 4000000, + "bucket_list_write_fee_growth_factor": 1000 + } + }, + { + "contract_historical_data_v0": { + "fee_historical1_kb": 5000 + } + }, + { + "contract_events_v0": { + "tx_max_contract_events_size_bytes": 8198, + "fee_contract_events1_kb": 300 + } + }, + { + "contract_bandwidth_v0": { + "ledger_max_txs_size_bytes": 71680, + "tx_max_size_bytes": 71680, + "fee_tx_size1_kb": 500 + } + }, + { + "contract_cost_params_cpu_instructions": [ + { + "ext": "v0", + "const_term": 4, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 434, + "linear_term": 16 + }, + { + "ext": "v0", + "const_term": 42, + "linear_term": 16 + }, + { + "ext": "v0", + "const_term": 44, + "linear_term": 16 + }, + { + "ext": "v0", + "const_term": 295, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 60, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 221, + "linear_term": 26 + }, + { + "ext": "v0", + "const_term": 331, + "linear_term": 4369 + }, + { + "ext": "v0", + "const_term": 3636, + "linear_term": 7013 + }, + { + "ext": "v0", + "const_term": 40256, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 377551, + "linear_term": 4059 + }, + { + "ext": "v0", + "const_term": 417482, + "linear_term": 45712 + }, + { + "ext": "v0", + "const_term": 417482, + "linear_term": 45712 + }, + { + "ext": "v0", + "const_term": 1945, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 6481, + "linear_term": 5943 + }, + { + "ext": "v0", + "const_term": 711, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 2314804, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 4176, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 4716, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 4680, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 4256, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 884, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 1059, + "linear_term": 502 + } + ] + }, + { + "contract_cost_params_memory_bytes": [ + { + "ext": "v0", + "const_term": 0, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 16, + "linear_term": 128 + }, + { + "ext": "v0", + "const_term": 0, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 0, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 0, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 0, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 242, + "linear_term": 384 + }, + { + "ext": "v0", + "const_term": 0, + "linear_term": 384 + }, + { + "ext": "v0", + "const_term": 0, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 0, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 0, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 132773, + "linear_term": 4903 + }, + { + "ext": "v0", + "const_term": 132773, + "linear_term": 4903 + }, + { + "ext": "v0", + "const_term": 14, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 0, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 0, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 181, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 99, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 99, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 99, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 99, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 99, + "linear_term": 0 + }, + { + "ext": "v0", + "const_term": 0, + "linear_term": 0 + } + ] + }, + { + "contract_data_key_size_bytes": 300 + }, + { + "contract_data_entry_size_bytes": 65536 + }, + { + "state_archival": { + "max_entry_ttl": 3110400, + "min_temporary_ttl": 16, + "min_persistent_ttl": 120960, + "persistent_rent_rate_denominator": 535680, + "temp_rent_rate_denominator": 5356800, + "max_entries_to_archive": 100, + "bucket_list_size_window_sample_size": 30, + "eviction_scan_size": 100000, + "starting_eviction_scan_level": 1 + } + }, + { + "contract_execution_lanes": { + "ledger_max_tx_count": 100 + } + } + ] +} \ No newline at end of file diff --git a/src/transactions/test/InvokeHostFunctionTests.cpp b/src/transactions/test/InvokeHostFunctionTests.cpp index df91437be5..ca1b91dfe7 100644 --- a/src/transactions/test/InvokeHostFunctionTests.cpp +++ b/src/transactions/test/InvokeHostFunctionTests.cpp @@ -2511,6 +2511,7 @@ TEST_CASE("settings upgrade command line utils", "[tx][soroban][upgrades]") auto const& contractSourceRefLedgerKey = std::get<1>(createRes); auto const& contractID = std::get<2>(createRes); + xdr::xvector initialEntries; xdr::xvector updatedEntries; for (uint32_t i = 0; i < static_cast(CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW); ++i) @@ -2518,13 +2519,223 @@ TEST_CASE("settings upgrade command line utils", "[tx][soroban][upgrades]") LedgerTxn ltx(app->getLedgerTxnRoot()); auto entry = ltx.load(configSettingKey(static_cast(i))); + + // Store the initial entries before we modify the cost types below + initialEntries.emplace_back(entry.current().data.configSetting()); + + // We're writing the latest cpu and mem settings below to makes sure + // they don't brick the settings upgrade process. We would ideally pull + // this from phase1.json, but core doesn't know how to parse JSON XDR. + auto const& vals = xdr::xdr_traits::enum_values(); if (entry.current().data.configSetting().configSettingID() == - CONFIG_SETTING_CONTRACT_LEDGER_COST_V0) + CONFIG_SETTING_CONTRACT_COST_PARAMS_CPU_INSTRUCTIONS) { - entry.current() - .data.configSetting() - .contractLedgerCost() - .feeRead1KB = 1234; + auto& params = entry.current() + .data.configSetting() + .contractCostParamsCpuInsns(); + for (auto val : vals) + { + switch (val) + { + case WasmInsnExec: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 4, 0}; + break; + case MemAlloc: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 434, 16}; + break; + case MemCpy: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 42, 16}; + break; + case MemCmp: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 44, 16}; + break; + case DispatchHostFunction: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 295, 0}; + break; + case VisitObject: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 60, 0}; + break; + case ValSer: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 221, 26}; + break; + case ValDeser: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 331, 4369}; + break; + case ComputeSha256Hash: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 3636, 7013}; + break; + case ComputeEd25519PubKey: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 40256, 0}; + break; + case VerifyEd25519Sig: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 377551, 4059}; + break; + case VmInstantiation: + params[val] = ContractCostParamEntry{ExtensionPoint{0}, + 417482, 45712}; + break; + case VmCachedInstantiation: + params[val] = ContractCostParamEntry{ExtensionPoint{0}, + 417482, 45712}; + break; + case InvokeVmFunction: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 1945, 0}; + break; + case ComputeKeccak256Hash: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 6481, 5943}; + break; + case ComputeEcdsaSecp256k1Sig: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 711, 0}; + break; + case RecoverEcdsaSecp256k1Key: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 2314804, 0}; + break; + case Int256AddSub: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 4176, 0}; + break; + case Int256Mul: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 4716, 0}; + break; + case Int256Div: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 4680, 0}; + break; + case Int256Pow: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 4256, 0}; + break; + case Int256Shift: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 884, 0}; + break; + case ChaCha20DrawBytes: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 1059, 502}; + break; + } + } + } + if (entry.current().data.configSetting().configSettingID() == + CONFIG_SETTING_CONTRACT_COST_PARAMS_MEMORY_BYTES) + { + auto& params = entry.current() + .data.configSetting() + .contractCostParamsMemBytes(); + for (auto val : vals) + { + switch (val) + { + case WasmInsnExec: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 0, 0}; + break; + case MemAlloc: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 16, 128}; + break; + case MemCpy: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 0, 0}; + break; + case MemCmp: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 0, 0}; + break; + case DispatchHostFunction: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 0, 0}; + break; + case VisitObject: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 0, 0}; + break; + case ValSer: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 242, 384}; + break; + case ValDeser: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 0, 384}; + break; + case ComputeSha256Hash: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 0, 0}; + break; + case ComputeEd25519PubKey: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 0, 0}; + break; + case VerifyEd25519Sig: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 0, 0}; + break; + case VmInstantiation: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 132773, 4903}; + break; + case VmCachedInstantiation: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 132773, 4903}; + break; + case InvokeVmFunction: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 14, 0}; + break; + case ComputeKeccak256Hash: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 0, 0}; + break; + case ComputeEcdsaSecp256k1Sig: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 0, 0}; + break; + case RecoverEcdsaSecp256k1Key: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 181, 0}; + break; + case Int256AddSub: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 99, 0}; + break; + case Int256Mul: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 99, 0}; + break; + case Int256Div: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 99, 0}; + break; + case Int256Pow: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 99, 0}; + break; + case Int256Shift: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 99, 0}; + break; + case ChaCha20DrawBytes: + params[val] = + ContractCostParamEntry{ExtensionPoint{0}, 0, 0}; + break; + } + } } updatedEntries.emplace_back(entry.current().data.configSetting()); } @@ -2564,22 +2775,72 @@ TEST_CASE("settings upgrade command line utils", "[tx][soroban][upgrades]") commandHandler.upgrades(command, ret); REQUIRE(ret == ""); - auto checkCost = [&](int64 feeRead) { - auto costKey = configSettingKey( - ConfigSettingID::CONFIG_SETTING_CONTRACT_LEDGER_COST_V0); - LedgerTxn ltx(app->getLedgerTxnRoot()); - auto costEntry = ltx.load(costKey); - REQUIRE(costEntry.current() - .data.configSetting() - .contractLedgerCost() - .feeRead1KB == feeRead); + auto checkSettings = [&](xdr::xvector const& entries) { + for (uint32_t i = 0; + i < static_cast(CONFIG_SETTING_BUCKETLIST_SIZE_WINDOW); + ++i) + { + LedgerTxn ltx(app->getLedgerTxnRoot()); + auto entry = + ltx.load(configSettingKey(static_cast(i))); + + REQUIRE(entry.current().data.configSetting() == entries.at(i)); + } }; SECTION("success") { - // trigger upgrade + { + // trigger upgrade + auto ledgerUpgrade = LedgerUpgrade{LEDGER_UPGRADE_CONFIG}; + ledgerUpgrade.newConfig() = upgradeSetKey; + + auto const& lcl = lm.getLastClosedLedgerHeader(); + auto txSet = TxSetXDRFrame::makeEmpty(lcl); + auto lastCloseTime = lcl.header.scpValue.closeTime; + + app->getHerder().externalizeValue( + txSet, lcl.header.ledgerSeq + 1, lastCloseTime, + {LedgerTestUtils::toUpgradeType(ledgerUpgrade)}); + + checkSettings(updatedEntries); + } + + // now revert to make sure the new settings didn't lock us in. + ConfigUpgradeSet upgradeSet2; + upgradeSet2.updatedEntry = initialEntries; + + auto invokeRes2 = + getInvokeTx(a1.getPublicKey(), contractCodeLedgerKey, + contractSourceRefLedgerKey, contractID, upgradeSet2, + a1.getLastSequenceNumber() + 4); + + auto const& upgradeSetKey2 = invokeRes2.second; + + invokeRes2.first.v1().signatures.emplace_back(SignatureUtils::sign( + a1.getSecretKey(), + sha256(xdr::xdr_to_opaque(app->getNetworkID(), ENVELOPE_TYPE_TX, + invokeRes2.first.v1().tx)))); + + auto const& txRevertSettings = + TransactionFrameBase::makeTransactionFromWire(app->getNetworkID(), + invokeRes2.first); + LedgerTxn ltx(app->getLedgerTxnRoot()); + TransactionMetaFrame txm(ltx.loadHeader().current().ledgerVersion); + REQUIRE(txRevertSettings->checkValid(*app, ltx, 0, 0, 0)); + REQUIRE(txRevertSettings->apply(*app, ltx, txm)); + ltx.commit(); + + std::string command2 = "mode=set&configupgradesetkey="; + command2 += decoder::encode_b64(xdr::xdr_to_opaque(upgradeSetKey2)); + command2 += "&upgradetime=2000-07-21T22:04:00Z"; + + std::string ret; + commandHandler.upgrades(command2, ret); + REQUIRE(ret == ""); + auto ledgerUpgrade = LedgerUpgrade{LEDGER_UPGRADE_CONFIG}; - ledgerUpgrade.newConfig() = upgradeSetKey; + ledgerUpgrade.newConfig() = upgradeSetKey2; auto const& lcl = lm.getLastClosedLedgerHeader(); auto txSet = TxSetXDRFrame::makeEmpty(lcl); @@ -2589,7 +2850,7 @@ TEST_CASE("settings upgrade command line utils", "[tx][soroban][upgrades]") txSet, lcl.header.ledgerSeq + 1, lastCloseTime, {LedgerTestUtils::toUpgradeType(ledgerUpgrade)}); - checkCost(1234); + checkSettings(initialEntries); } auto const& lcl = lm.getLastClosedLedgerHeader(); @@ -2622,7 +2883,7 @@ TEST_CASE("settings upgrade command line utils", "[tx][soroban][upgrades]") {LedgerTestUtils::toUpgradeType(ledgerUpgrade)}); // No upgrade due to expired entry - checkCost(1000); + checkSettings(initialEntries); } auto updateBytes = [&](SCVal const& bytes) { @@ -2645,7 +2906,7 @@ TEST_CASE("settings upgrade command line utils", "[tx][soroban][upgrades]") {LedgerTestUtils::toUpgradeType(ledgerUpgrade)}); // No upgrade due to tampered entry - checkCost(1000); + checkSettings(initialEntries); }; SECTION("Invalid XDR")