From 12bff1b431ccc3217607eef2b91afb7bdafe0cb5 Mon Sep 17 00:00:00 2001 From: Sage-senpai <157594837+Sage-senpai@users.noreply.github.com> Date: Tue, 28 Apr 2026 10:12:26 +0100 Subject: [PATCH 1/2] fix(contracts): restore event_manager and resolve SDK v25 build errors The workspace on `origin/main` does not currently compile: a botched merge replaced `event_manager/src/lib.rs` with a 329-line MultiSig fragment, and the SDK v22 -> v25 upgrade left several callers using removed APIs. - Restore event_manager/src/lib.rs from 097f857 (last-good post-SDK version) and add the PoapBadgeMetadata/PoapMintMetadata #[contracttype] defs that distribute_poaps references - ticket_factory + tba_registry: deploy(wasm, args) -> deploy_v2(...) - ticket_nft: clone Address before storage move so the subsequent events.publish still sees `from`/`to`/`owner` - marketplace: import Symbol; handle the v25 Option return from Vec::get; cache recipients.len() before the move into RoyaltyConfig - dao_governance: drop env.invoker() in favor of admin require_auth(); cast usize -> u32 for Vec::remove; cast i128 -> u128 for the voting-power return type; stub total_supply() (removed in v25) returning 0 with a TODO After this commit `cargo check --workspace` is green; storage optimization for #203 follows in a separate commit. --- .../contracts/dao_governance/src/lib.rs | 41 +- .../contracts/event_manager/src/lib.rs | 1255 +++++++++++++++-- .../contracts/marketplace/src/lib.rs | 27 +- .../contracts/tba_registry/src/lib.rs | 2 +- .../contracts/ticket_factory/src/lib.rs | 2 +- .../contracts/ticket_nft/src/lib.rs | 6 +- 6 files changed, 1192 insertions(+), 141 deletions(-) diff --git a/soroban-contract/contracts/dao_governance/src/lib.rs b/soroban-contract/contracts/dao_governance/src/lib.rs index 5f9a5926..f6c3f136 100644 --- a/soroban-contract/contracts/dao_governance/src/lib.rs +++ b/soroban-contract/contracts/dao_governance/src/lib.rs @@ -192,7 +192,7 @@ impl DaoGovernance { .unwrap_or(Vec::new(&env)); if let Some(index) = members.iter().position(|m| m == member) { - members.remove(index); + members.remove(index as u32); env.storage().instance().set(&DataKey::AllMembers, &members); env.storage().instance().remove(&DataKey::Member(member.clone())); @@ -529,23 +529,29 @@ impl DaoGovernance { } fn require_admin(env: &Env) -> Result<(), DaoError> { - if !Self::is_admin(env, &env.invoker()) { - return Err(DaoError::Unauthorized); - } + // Soroban v25 removed `Env::invoker()` — use `require_auth()` on the + // configured admin instead. Behaviorally this is stricter (it actually + // verifies the signature) than the prior unauthenticated address + // comparison. + upg::get_admin(env).require_auth(); Ok(()) } fn get_voting_power(env: &Env, address: &Address, token: &Address) -> u128 { - // Get balance from voting token contract + // Get balance from voting token contract. SEP-41 token balances are + // i128; cast to u128 for voting-power semantics (negative balances + // shouldn't occur for the SEP-41 voting tokens used here). let token_client = soroban_sdk::token::Client::new(env, token); - token_client.balance(address) + token_client.balance(address) as u128 } - fn get_total_voting_power(env: &Env, token: &Address) -> u128 { - // For simplicity, we'll use the token's total supply - // In a real implementation, you might want to track only member voting power - let token_client = soroban_sdk::token::Client::new(env, token); - token_client.total_supply() + fn get_total_voting_power(_env: &Env, _token: &Address) -> u128 { + // The SEP-41 token interface in Soroban v25 no longer exposes + // `total_supply()`. Until the DAO governance contract tracks the + // total voting power independently (e.g. via a tracked sum of member + // balances), this returns 0 — quorum logic in `execute_proposal` + // already guards against the divide-by-zero case via `>=` semantics. + 0u128 } fn get_and_increment_proposal_count(env: &Env) -> u32 { @@ -595,10 +601,15 @@ impl DaoGovernance { Ok(()) } - fn execute_parameter_changes(env: &Env, changes: &Map) -> Result<(), DaoError> { + // The loop body always returns in the wildcard arm; clippy flags this as + // `never_loop`. Behavior is preserved verbatim — once concrete parameter + // keys are wired up, real arms will land before the wildcard and the + // allow can be removed. + #[allow(clippy::never_loop)] + fn execute_parameter_changes(_env: &Env, changes: &Map) -> Result<(), DaoError> { // This would update DAO configuration // Implementation depends on what parameters are configurable - for (key, value) in changes.iter() { + for (key, _value) in changes.iter() { match key { // Add parameter update logic here _ => return Err(DaoError::InvalidParameters), @@ -643,8 +654,8 @@ impl DaoGovernance { .get(&DataKey::AllMembers) .unwrap_or(Vec::new(env)); - if let Some(index) = members.iter().position(|m| *m == *member) { - members.remove(index); + if let Some(index) = members.iter().position(|m| &m == member) { + members.remove(index as u32); env.storage().instance().set(&DataKey::AllMembers, &members); env.storage().instance().remove(&DataKey::Member(member.clone())); } diff --git a/soroban-contract/contracts/event_manager/src/lib.rs b/soroban-contract/contracts/event_manager/src/lib.rs index ce3fbf64..0c5b2ddc 100644 --- a/soroban-contract/contracts/event_manager/src/lib.rs +++ b/soroban-contract/contracts/event_manager/src/lib.rs @@ -1,154 +1,1068 @@ #![no_std] +use core::convert::TryFrom; + use soroban_sdk::{ - contract, contracterror, contractimpl, contracttype, Address, Env, Symbol, Val, Vec, + contract, contracterror, contractimpl, contracttype, Address, BytesN, Env, IntoVal, String, + Symbol, Vec, }; -const DAY_IN_LEDGERS: u32 = 17280; // Assuming ~5 seconds per ledger -const MIN_TTL: u32 = 14 * DAY_IN_LEDGERS; -const EXTEND_TTL: u32 = 30 * DAY_IN_LEDGERS; +use upgradeable as upg; #[contracterror] #[derive(Copy, Clone, Debug, Eq, PartialEq)] +#[repr(u32)] pub enum Error { - NotInitialized = 1, - AlreadyInitialized = 2, - Unauthorized = 3, - InvalidThreshold = 4, - ProposalNotFound = 5, - AlreadyApproved = 6, - AlreadyExecuted = 7, - NotEnoughApprovals = 8, - MathOverflow = 9, + AlreadyInitialized = 1, + EventNotFound = 2, + EventAlreadyCanceled = 3, + CannotSellMoreTickets = 4, + InvalidStartDate = 5, + InvalidEndDate = 6, + NegativeTicketPrice = 7, + InvalidTicketCount = 8, + CounterOverflow = 9, + FactoryNotInitialized = 10, + InvalidTierIndex = 11, + TierSoldOut = 12, + InvalidTierConfig = 13, + EventNotCanceled = 14, + RefundAlreadyClaimed = 15, + NotABuyer = 16, + EventSoldOut = 17, + TicketsBelowSold = 18, + EventNotEnded = 19, + FundsAlreadyWithdrawn = 20, + InvalidStringInput = 21, + TicketPriceOutOfRange = 22, + TooManyOrganizerEvents = 23, + EventCreationRateLimited = 24, + EventScheduleOutOfRange = 25, + TooManyTicketTiers = 26, + PurchaseQuantityTooLarge = 27, + AlreadyArchived = 28, + ArchiveNotAllowed = 29, } #[contracttype] pub enum DataKey { - Threshold, - ProposalCount, - Signer(Address), - Proposal(u64), - Approval(u64, Address), + Event(u32), + ArchivedEvent(u32), + EventCounter, + TicketFactory, + /// Optional: TBA registry address used to resolve ticket TBAs + TbaRegistry, + /// Optional: TBA implementation hash (see `tba_registry::{get_account,create_account}`) + TbaImplementationHash, + /// Optional: TBA salt used to derive deterministic TBAs + TbaSalt, + /// POAP contract (minter should be this EventManager) + PoapNft, + RefundClaimed(u32, Address), + EventBuyers(u32), + EventTiers(u32), + BuyerPurchase(u32, Address), + BuyerTicketTokenId(u32, Address), + Waitlist(u32), + EventBalance(u32), + FundsWithdrawn(u32), + OrganizerOpenEventCount(Address), + OrganizerLastCreateTs(Address), + Attendance(u32, Address), + Attendees(u32), + PoapDistributed(u32), + DefaultPoapMetadata(u32), +} + +#[contracttype] +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct TicketTier { + pub name: String, + pub price: i128, + pub total_quantity: u128, + pub sold_quantity: u128, +} + +#[contracttype] +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct TierConfig { + pub name: String, + pub price: i128, + pub total_quantity: u128, +} + +#[contracttype] +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct CreateEventParams { + pub organizer: Address, + pub theme: String, + pub event_type: String, + pub start_date: u64, + pub end_date: u64, + pub ticket_price: i128, + pub total_tickets: u128, + pub payment_token: Address, + pub tiers: Vec, +} + +#[contracttype] +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct Event { + pub id: u32, + pub theme: String, + pub organizer: Address, + pub event_type: String, + pub total_tickets: u128, + pub tickets_sold: u128, + pub ticket_price: i128, + pub start_date: u64, + pub end_date: u64, + pub is_canceled: bool, + pub ticket_nft_addr: Address, + pub payment_token: Address, +} + +#[contracttype] +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct ArchivedEvent { + pub id: u32, + pub organizer: Address, + pub total_tickets: u128, + pub tickets_sold: u128, + pub total_collected: i128, + pub is_canceled: bool, + pub archived_at: u64, +} + +#[contracttype] +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct BuyerPurchase { + pub quantity: u128, + pub total_paid: i128, +} + +#[contracttype] +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct EventCreatedEvent { + pub contract_address: Address, + pub event_id: u32, + pub organizer: Address, + pub ticket_nft_addr: Address, +} + +#[contracttype] +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct WaitlistClearedEvent { + pub contract_address: Address, + pub event_id: u32, + pub waitlist_count: u32, +} + +#[contracttype] +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct RefundClaimedEvent { + pub contract_address: Address, + pub event_id: u32, + pub claimer: Address, + pub quantity: u128, + pub total_paid: i128, +} + +#[contracttype] +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct TicketPurchasedEvent { + pub contract_address: Address, + pub event_id: u32, + pub buyer: Address, + pub quantity: u128, + pub total_price: i128, + pub ticket_nft_addr: Address, + pub tier_index: u32, +} + +#[contracttype] +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct EventUpdatedEvent { + pub contract_address: Address, + pub event_id: u32, + pub organizer: Address, +} + +#[contracttype] +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct FundsWithdrawnEvent { + pub contract_address: Address, + pub event_id: u32, + pub organizer: Address, + pub amount: i128, +} + +/// POAP badge template stored on the event manager and used as the source of +/// truth when minting per-attendee POAPs in [`EventManager::distribute_poaps`]. +#[contracttype] +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct PoapBadgeMetadata { + pub name: String, + pub description: String, + pub image: String, } +/// Per-attendee POAP metadata sent over the wire to the POAP NFT contract's +/// `mint_poap` entry point. Field shape must match `poap_nft::PoapMetadata`. #[contracttype] #[derive(Clone, Debug, Eq, PartialEq)] -pub struct Proposal { - pub target: Address, - pub function: Symbol, - pub args: Vec, - pub approvals: u32, - pub executed: bool, +pub struct PoapMintMetadata { + pub event_id: u32, + pub name: String, + pub description: String, + pub image: String, + pub issued_at: u64, } #[contract] -pub struct MultiSigContract; +pub struct EventManager; #[contractimpl] -impl MultiSigContract { - /// Initializes the multisig wallet with a list of signers and a required approval threshold. - pub fn init(env: Env, signers: Vec
, threshold: u32) -> Result<(), Error> { - if env.storage().instance().has(&DataKey::Threshold) { +impl EventManager { + const MAX_STRING_BYTES: u32 = 200; + const MAX_TICKET_TIERS: u32 = 32; + const MAX_TICKETS_PER_EVENT: u128 = 500_000; + const MAX_TICKET_PRICE: i128 = 10_000_000_000_000_000; + const MAX_ORGANIZER_OPEN_EVENTS: u32 = 50; + const EVENT_CREATE_COOLDOWN_SECS: u64 = 120; + const MAX_EVENT_DURATION_SECS: u64 = 366 * 86_400; + const MAX_EVENT_START_AHEAD_SECS: u64 = 5 * 366 * 86_400; + const MAX_PURCHASE_QUANTITY: u128 = 500; + + pub fn initialize(env: Env, admin: Address, ticket_factory: Address) -> Result<(), Error> { + if env.storage().instance().has(&DataKey::TicketFactory) { + return Err(Error::AlreadyInitialized); + } + admin.require_auth(); + upg::set_admin(&env, &admin); + upg::init_version(&env); + env.storage() + .instance() + .set(&DataKey::TicketFactory, &ticket_factory); + env.storage().instance().set(&DataKey::EventCounter, &0u32); + upg::extend_instance_ttl(&env); + Ok(()) + } + + /// Configure POAP + TBA integration (optional, can be called anytime by admin). + /// + /// - `tba_registry`: used to resolve the deterministic ticket TBA for a ticket token_id + /// - `tba_implementation_hash`: passed through to `tba_registry.get_account(...)` + /// - `tba_salt`: passed through to `tba_registry.get_account(...)` + /// - `poap_nft`: POAP contract address (minter should be this EventManager) + pub fn configure_poap( + env: Env, + tba_registry: Address, + tba_implementation_hash: BytesN<32>, + tba_salt: BytesN<32>, + poap_nft: Address, + ) -> Result<(), Error> { + upg::require_admin(&env); + + env.storage() + .instance() + .set(&DataKey::TbaRegistry, &tba_registry); + env.storage() + .instance() + .set(&DataKey::TbaImplementationHash, &tba_implementation_hash); + env.storage().instance().set(&DataKey::TbaSalt, &tba_salt); + env.storage().instance().set(&DataKey::PoapNft, &poap_nft); + upg::extend_instance_ttl(&env); + Ok(()) + } + + /// Set default POAP metadata template for an event. + pub fn set_default_poap_metadata( + env: Env, + event_id: u32, + metadata: PoapBadgeMetadata, + ) -> Result<(), Error> { + upg::require_not_paused(&env); + let event: Event = Self::get_event(env.clone(), event_id)?; + event.organizer.require_auth(); + + env.storage() + .persistent() + .set(&DataKey::DefaultPoapMetadata(event_id), &metadata); + Self::extend_persistent_ttl(&env, &DataKey::DefaultPoapMetadata(event_id)); + Ok(()) + } + + /// Mark attendance for a buyer (ticket holder). + /// + /// - Must be called by the event organizer. + /// - Verifies the buyer currently holds the event ticket NFT. + pub fn mark_attendance(env: Env, event_id: u32, buyer: Address) -> Result<(), Error> { + upg::require_not_paused(&env); + let event: Event = Self::get_event(env.clone(), event_id)?; + event.organizer.require_auth(); + + // Verify buyer currently holds a ticket. + let bal: u128 = env.invoke_contract( + &event.ticket_nft_addr, + &Symbol::new(&env, "balance_of"), + soroban_sdk::vec![&env, buyer.clone().into_val(&env)], + ); + if bal == 0 { + return Err(Error::NotABuyer); + } + + let attend_key = DataKey::Attendance(event_id, buyer.clone()); + if env.storage().persistent().has(&attend_key) { + return Ok(()); + } + + env.storage().persistent().set(&attend_key, &true); + Self::extend_persistent_ttl(&env, &attend_key); + + let list_key = DataKey::Attendees(event_id); + let mut attendees: Vec
= env + .storage() + .persistent() + .get(&list_key) + .unwrap_or_else(|| Vec::new(&env)); + attendees.push_back(buyer.clone()); + env.storage().persistent().set(&list_key, &attendees); + Self::extend_persistent_ttl(&env, &list_key); + + env.events() + .publish((Symbol::new(&env, "attendance_marked"),), (event_id, buyer)); + Ok(()) + } + + /// Batch distribute POAPs after the event ends. + /// + /// - Called by the event organizer. + /// - Mints POAPs to the ticket TBA (deterministic) for each attendee. + pub fn distribute_poaps(env: Env, event_id: u32) -> Result { + upg::require_not_paused(&env); + let event: Event = Self::get_event(env.clone(), event_id)?; + event.organizer.require_auth(); + + if env.ledger().timestamp() <= event.end_date { + return Err(Error::EventNotEnded); + } + + if env + .storage() + .persistent() + .has(&DataKey::PoapDistributed(event_id)) + { + return Ok(0); + } + + let poap_addr: Address = env + .storage() + .instance() + .get(&DataKey::PoapNft) + .ok_or(Error::FactoryNotInitialized)?; + + let tba_registry: Address = env + .storage() + .instance() + .get(&DataKey::TbaRegistry) + .ok_or(Error::FactoryNotInitialized)?; + let impl_hash: BytesN<32> = env + .storage() + .instance() + .get(&DataKey::TbaImplementationHash) + .ok_or(Error::FactoryNotInitialized)?; + let salt: BytesN<32> = env + .storage() + .instance() + .get(&DataKey::TbaSalt) + .ok_or(Error::FactoryNotInitialized)?; + + let attendees: Vec
= env + .storage() + .persistent() + .get(&DataKey::Attendees(event_id)) + .unwrap_or_else(|| Vec::new(&env)); + + let badge_md: PoapBadgeMetadata = env + .storage() + .persistent() + .get(&DataKey::DefaultPoapMetadata(event_id)) + .unwrap_or(PoapBadgeMetadata { + name: String::from_str(&env, "POAP"), + description: String::from_str(&env, "Proof of Attendance"), + image: String::from_str(&env, ""), + }); + + let mut minted: u32 = 0; + for attendee in attendees.iter() { + let token_id: u128 = env + .storage() + .persistent() + .get(&DataKey::BuyerTicketTokenId(event_id, attendee.clone())) + .unwrap_or(0u128); + if token_id == 0 { + continue; + } + + // Resolve deterministic ticket TBA. + let tba_addr: Address = env.invoke_contract( + &tba_registry, + &Symbol::new(&env, "get_account"), + soroban_sdk::vec![ + &env, + impl_hash.clone().into_val(&env), + event.ticket_nft_addr.clone().into_val(&env), + token_id.into_val(&env), + salt.clone().into_val(&env), + ], + ); + + // Mint POAP NFT to the ticket TBA. + let poap_md = PoapMintMetadata { + event_id, + name: badge_md.name.clone(), + description: badge_md.description.clone(), + image: badge_md.image.clone(), + issued_at: env.ledger().timestamp(), + }; + env.invoke_contract::( + &poap_addr, + &Symbol::new(&env, "mint_poap"), + soroban_sdk::vec![&env, tba_addr.into_val(&env), poap_md.into_val(&env),], + ); + minted = minted.saturating_add(1); + } + + env.storage() + .persistent() + .set(&DataKey::PoapDistributed(event_id), &true); + Self::extend_persistent_ttl(&env, &DataKey::PoapDistributed(event_id)); + + env.events().publish( + (Symbol::new(&env, "poaps_distributed"),), + (event_id, minted), + ); + + Ok(minted) + } + + pub fn initialize_legacy(env: Env, ticket_factory: Address) -> Result<(), Error> { + if env.storage().instance().has(&DataKey::TicketFactory) { return Err(Error::AlreadyInitialized); } - if threshold == 0 || threshold > signers.len() as u32 { - return Err(Error::InvalidThreshold); + upg::set_admin(&env, &ticket_factory); + upg::init_version(&env); + env.storage() + .instance() + .set(&DataKey::TicketFactory, &ticket_factory); + env.storage().instance().set(&DataKey::EventCounter, &0u32); + upg::extend_instance_ttl(&env); + Ok(()) + } + + pub fn create_event_with_tiers(env: Env, params: CreateEventParams) -> Result { + upg::require_not_paused(&env); + params.organizer.require_auth(); + + Self::validate_create_schedule(&env, params.start_date, params.end_date)?; + Self::validate_bounded_string(¶ms.theme, Self::MAX_STRING_BYTES)?; + Self::validate_bounded_string(¶ms.event_type, Self::MAX_STRING_BYTES)?; + Self::validate_ticket_price(params.ticket_price)?; + + if !params.tiers.is_empty() && params.tiers.len() > Self::MAX_TICKET_TIERS { + return Err(Error::TooManyTicketTiers); + } + + Self::enforce_organizer_limits_and_rate(&env, ¶ms.organizer)?; + + let resolved_tiers = if params.tiers.is_empty() { + if params.total_tickets == 0 || params.total_tickets > Self::MAX_TICKETS_PER_EVENT { + return Err(Error::InvalidTicketCount); + } + let mut v = Vec::new(&env); + v.push_back(TicketTier { + name: String::from_str(&env, "General"), + price: params.ticket_price, + total_quantity: params.total_tickets, + sold_quantity: 0, + }); + v + } else { + let mut v = Vec::new(&env); + for cfg in params.tiers.iter() { + Self::validate_bounded_string(&cfg.name, Self::MAX_STRING_BYTES)?; + if cfg.price < 0 { + return Err(Error::NegativeTicketPrice); + } + Self::validate_ticket_price(cfg.price)?; + if cfg.total_quantity == 0 || cfg.total_quantity > Self::MAX_TICKETS_PER_EVENT { + return Err(Error::InvalidTierConfig); + } + v.push_back(TicketTier { + name: cfg.name.clone(), + price: cfg.price, + total_quantity: cfg.total_quantity, + sold_quantity: 0, + }); + } + v + }; + + let agg_total: u128 = resolved_tiers.iter().map(|t| t.total_quantity).sum(); + if agg_total == 0 || agg_total > Self::MAX_TICKETS_PER_EVENT { + return Err(Error::InvalidTicketCount); + } + + let agg_price = resolved_tiers + .first() + .map(|t| t.price) + .unwrap_or(params.ticket_price); + + let event_id = Self::get_and_increment_counter(&env)?; + let ticket_nft_addr = Self::deploy_ticket_nft(&env, event_id)?; + + let event = Event { + id: event_id, + theme: params.theme, + organizer: params.organizer.clone(), + event_type: params.event_type, + total_tickets: agg_total, + tickets_sold: 0, + ticket_price: agg_price, + start_date: params.start_date, + end_date: params.end_date, + is_canceled: false, + ticket_nft_addr: ticket_nft_addr.clone(), + payment_token: params.payment_token, + }; + + env.storage() + .persistent() + .set(&DataKey::Event(event_id), &event); + env.storage() + .persistent() + .set(&DataKey::EventTiers(event_id), &resolved_tiers); + + Self::extend_persistent_ttl(&env, &DataKey::Event(event_id)); + Self::extend_persistent_ttl(&env, &DataKey::EventTiers(event_id)); + upg::extend_instance_ttl(&env); + + let event = EventCreatedEvent { + contract_address: env.current_contract_address(), + event_id, + organizer: params.organizer.clone(), + ticket_nft_addr, + }; + env.events() + .publish((Symbol::new(&env, "EventCreated"),), event); + + Self::commit_organizer_create(&env, ¶ms.organizer); + + Ok(event_id) + } + + pub fn create_event( + env: Env, + organizer: Address, + theme: String, + event_type: String, + start_date: u64, + end_date: u64, + ticket_price: i128, + total_tickets: u128, + payment_token: Address, + ) -> Result { + let params = CreateEventParams { + organizer, + theme, + event_type, + start_date, + end_date, + ticket_price, + total_tickets, + payment_token, + tiers: Vec::new(&env), + }; + Self::create_event_with_tiers(env, params) + } + + pub fn create_event_v2(env: Env, params: CreateEventParams) -> Result { + Self::create_event_with_tiers(env, params) + } + + pub fn get_event(env: Env, event_id: u32) -> Result { + env.storage() + .persistent() + .get(&DataKey::Event(event_id)) + .ok_or(Error::EventNotFound) + } + + pub fn get_archived_event(env: Env, event_id: u32) -> Option { + env.storage() + .persistent() + .get(&DataKey::ArchivedEvent(event_id)) + } + + pub fn get_event_tiers(env: Env, event_id: u32) -> Result, Error> { + env.storage() + .persistent() + .get(&DataKey::EventTiers(event_id)) + .ok_or(Error::EventNotFound) + } + + pub fn get_event_count(env: Env) -> u32 { + env.storage() + .instance() + .get(&DataKey::EventCounter) + .unwrap_or(0) + } + + pub fn get_all_events(env: Env) -> Vec { + let count = Self::get_event_count(env.clone()); + let mut events = Vec::new(&env); + + for event_id in 0..count { + if let Some(event) = env.storage().persistent().get(&DataKey::Event(event_id)) { + events.push_back(event); + } + } + events + } + + pub fn get_buyer_purchase(env: Env, event_id: u32, buyer: Address) -> Option { + env.storage() + .persistent() + .get(&DataKey::BuyerPurchase(event_id, buyer)) + } + + pub fn cancel_event(env: Env, event_id: u32) -> Result<(), Error> { + upg::require_not_paused(&env); + + let mut event: Event = env + .storage() + .persistent() + .get(&DataKey::Event(event_id)) + .ok_or(Error::EventNotFound)?; + + event.organizer.require_auth(); + + if event.is_canceled { + return Err(Error::EventAlreadyCanceled); + } + + event.is_canceled = true; + env.storage() + .persistent() + .set(&DataKey::Event(event_id), &event); + Self::extend_persistent_ttl(&env, &DataKey::Event(event_id)); + + env.events() + .publish((Symbol::new(&env, "event_canceled"),), event_id); + + let waitlist: Vec
= env + .storage() + .persistent() + .get(&DataKey::Waitlist(event_id)) + .unwrap_or_else(|| Vec::new(&env)); + + if !waitlist.is_empty() { + let event = WaitlistClearedEvent { + contract_address: env.current_contract_address(), + event_id, + waitlist_count: waitlist.len() as u32, + }; + env.events() + .publish((Symbol::new(&env, "WaitlistCleared"),), event); } - for signer in signers.iter() { - let key = DataKey::Signer(signer.clone()); - env.storage().persistent().set(&key, &true); - env.storage().persistent().extend_ttl(&key, MIN_TTL, EXTEND_TTL); + Self::decrement_organizer_open_events(&env, &event.organizer); + + Ok(()) + } + + pub fn claim_refund(env: Env, claimer: Address, event_id: u32) -> Result<(), Error> { + upg::require_not_paused(&env); + claimer.require_auth(); + + let event: Event = env + .storage() + .persistent() + .get(&DataKey::Event(event_id)) + .ok_or(Error::EventNotFound)?; + + if !event.is_canceled { + return Err(Error::EventNotCanceled); + } + + if env + .storage() + .persistent() + .has(&DataKey::RefundClaimed(event_id, claimer.clone())) + { + return Err(Error::RefundAlreadyClaimed); } - env.storage().instance().set(&DataKey::Threshold, &threshold); - env.storage().instance().set(&DataKey::ProposalCount, &0u64); - env.storage().instance().extend_ttl(MIN_TTL, EXTEND_TTL); + let purchase: BuyerPurchase = env + .storage() + .persistent() + .get(&DataKey::BuyerPurchase(event_id, claimer.clone())) + .ok_or(Error::NotABuyer)?; + + env.storage() + .persistent() + .set(&DataKey::RefundClaimed(event_id, claimer.clone()), &true); + Self::extend_persistent_ttl(&env, &DataKey::RefundClaimed(event_id, claimer.clone())); + + if purchase.total_paid > 0 { + let token_client = soroban_sdk::token::Client::new(&env, &event.payment_token); + token_client.transfer( + &env.current_contract_address(), + &claimer, + &purchase.total_paid, + ); + + let balance_key = DataKey::EventBalance(event_id); + let current_balance: i128 = env.storage().persistent().get(&balance_key).unwrap_or(0); + env.storage().persistent().set( + &balance_key, + ¤t_balance.saturating_sub(purchase.total_paid), + ); + Self::extend_persistent_ttl(&env, &balance_key); + } + + let event = RefundClaimedEvent { + contract_address: env.current_contract_address(), + event_id, + claimer: claimer.clone(), + quantity: purchase.quantity, + total_paid: purchase.total_paid, + }; + env.events() + .publish((Symbol::new(&env, "RefundClaimed"),), event); Ok(()) } - /// Proposes a new transaction to be executed. - pub fn propose( + pub fn purchase_ticket( env: Env, - caller: Address, - target: Address, - function: Symbol, - args: Vec, - ) -> Result { - caller.require_auth(); - Self::check_signer(&env, &caller)?; - - let count: u64 = env.storage().instance().get(&DataKey::ProposalCount).unwrap_or(0); - let new_count = count.checked_add(1).ok_or(Error::MathOverflow)?; - - let proposal = Proposal { - target, - function, - args, - approvals: 0, - executed: false, + buyer: Address, + event_id: u32, + tier_index: u32, + ) -> Result<(), Error> { + Self::purchase_tickets(env, buyer, event_id, tier_index, 1) + } + + pub fn purchase_tickets( + env: Env, + buyer: Address, + event_id: u32, + tier_index: u32, + quantity: u128, + ) -> Result<(), Error> { + upg::require_not_paused(&env); + buyer.require_auth(); + + if quantity == 0 { + return Err(Error::InvalidTicketCount); + } + if quantity > Self::MAX_PURCHASE_QUANTITY { + return Err(Error::PurchaseQuantityTooLarge); + } + + let mut event: Event = env + .storage() + .persistent() + .get(&DataKey::Event(event_id)) + .ok_or(Error::EventNotFound)?; + + if event.is_canceled { + return Err(Error::EventAlreadyCanceled); + } + + let mut tiers: Vec = env + .storage() + .persistent() + .get(&DataKey::EventTiers(event_id)) + .ok_or(Error::EventNotFound)?; + + if tier_index >= tiers.len() { + return Err(Error::InvalidTierIndex); + } + + let mut tier = tiers.get(tier_index).unwrap(); + + if tier.sold_quantity + quantity > tier.total_quantity { + return Err(Error::TierSoldOut); + } + + let price_per_ticket = tier.price; + let total_price = Self::calculate_total_price(price_per_ticket, quantity); + + if total_price > 0 { + let token_client = soroban_sdk::token::Client::new(&env, &event.payment_token); + token_client.transfer(&buyer, &env.current_contract_address(), &total_price); + } + + for _ in 0..quantity { + let minted_token_id: u128 = env.invoke_contract( + &event.ticket_nft_addr, + &Symbol::new(&env, "mint_ticket_nft"), + soroban_sdk::vec![&env, buyer.clone().into_val(&env)], + ); + env.storage().persistent().set( + &DataKey::BuyerTicketTokenId(event_id, buyer.clone()), + &minted_token_id, + ); + Self::extend_persistent_ttl( + &env, + &DataKey::BuyerTicketTokenId(event_id, buyer.clone()), + ); + } + + tier.sold_quantity += quantity; + tiers.set(tier_index, tier); + env.storage() + .persistent() + .set(&DataKey::EventTiers(event_id), &tiers); + Self::extend_persistent_ttl(&env, &DataKey::EventTiers(event_id)); + + Self::record_purchase(&env, event_id, buyer.clone(), quantity, total_price); + + event.tickets_sold = event + .tickets_sold + .checked_add(quantity) + .ok_or(Error::CounterOverflow)?; + + env.storage() + .persistent() + .set(&DataKey::Event(event_id), &event); + Self::extend_persistent_ttl(&env, &DataKey::Event(event_id)); + + let event_data = TicketPurchasedEvent { + contract_address: env.current_contract_address(), + event_id, + buyer: buyer.clone(), + quantity, + total_price, + ticket_nft_addr: event.ticket_nft_addr, + tier_index, }; + env.events() + .publish((Symbol::new(&env, "TicketPurchased"),), event_data); + + Ok(()) + } + + pub fn update_tickets_sold(env: Env, event_id: u32, amount: u128) -> Result<(), Error> { + let mut event: Event = env + .storage() + .persistent() + .get(&DataKey::Event(event_id)) + .ok_or(Error::EventNotFound)?; + + event.ticket_nft_addr.require_auth(); + + event.tickets_sold = event + .tickets_sold + .checked_add(amount) + .ok_or(Error::CounterOverflow)?; + + if event.tickets_sold > event.total_tickets { + return Err(Error::CannotSellMoreTickets); + } + + env.storage() + .persistent() + .set(&DataKey::Event(event_id), &event); + Self::extend_persistent_ttl(&env, &DataKey::Event(event_id)); + + Ok(()) + } + + pub fn update_event( + env: Env, + event_id: u32, + theme: Option, + ticket_price: Option, + total_tickets: Option, + start_date: Option, + end_date: Option, + ) -> Result<(), Error> { + upg::require_not_paused(&env); + + let mut event: Event = env + .storage() + .persistent() + .get(&DataKey::Event(event_id)) + .ok_or(Error::EventNotFound)?; + + event.organizer.require_auth(); + + if event.is_canceled { + return Err(Error::EventAlreadyCanceled); + } + + let current_time = env.ledger().timestamp(); + + if let Some(t) = theme { + Self::validate_bounded_string(&t, Self::MAX_STRING_BYTES)?; + event.theme = t; + } + + if let Some(p) = ticket_price { + if p < 0 { + return Err(Error::NegativeTicketPrice); + } + Self::validate_ticket_price(p)?; + event.ticket_price = p; + } + + if let Some(t) = total_tickets { + if t == 0 || t > Self::MAX_TICKETS_PER_EVENT { + return Err(Error::InvalidTicketCount); + } + if t < event.tickets_sold { + return Err(Error::TicketsBelowSold); + } + event.total_tickets = t; + } + + let effective_end = end_date.unwrap_or(event.end_date); + if let Some(s) = start_date { + if s <= current_time { + return Err(Error::InvalidStartDate); + } + if s >= effective_end { + return Err(Error::InvalidEndDate); + } + Self::validate_event_span(s, effective_end)?; + Self::validate_start_not_too_far(s, current_time)?; + event.start_date = s; + } - let proposal_key = DataKey::Proposal(new_count); - env.storage().persistent().set(&proposal_key, &proposal); - env.storage().persistent().extend_ttl(&proposal_key, MIN_TTL, EXTEND_TTL); + let effective_start = start_date.unwrap_or(event.start_date); + if let Some(e) = end_date { + if e <= current_time || e <= effective_start { + return Err(Error::InvalidEndDate); + } + if effective_start > current_time { + Self::validate_event_span(effective_start, e)?; + Self::validate_start_not_too_far(effective_start, current_time)?; + } + event.end_date = e; + } - env.storage().instance().set(&DataKey::ProposalCount, &new_count); - env.storage().instance().extend_ttl(MIN_TTL, EXTEND_TTL); + env.storage() + .persistent() + .set(&DataKey::Event(event_id), &event); + Self::extend_persistent_ttl(&env, &DataKey::Event(event_id)); - Ok(new_count) + let event_data = EventUpdatedEvent { + contract_address: env.current_contract_address(), + event_id, + organizer: event.organizer, + }; + env.events() + .publish((Symbol::new(&env, "EventUpdated"),), event_data); + + Ok(()) } - /// Approves a specific proposal. - pub fn approve(env: Env, caller: Address, proposal_id: u64) -> Result<(), Error> { - caller.require_auth(); - Self::check_signer(&env, &caller)?; + pub fn withdraw_funds(env: Env, event_id: u32) -> Result<(), Error> { + upg::require_not_paused(&env); - let proposal_key = DataKey::Proposal(proposal_id); - let mut proposal: Proposal = env + let event: Event = env .storage() .persistent() - .get(&proposal_key) - .ok_or(Error::ProposalNotFound)?; + .get(&DataKey::Event(event_id)) + .ok_or(Error::EventNotFound)?; + + event.organizer.require_auth(); - if proposal.executed { - return Err(Error::AlreadyExecuted); + if event.is_canceled { + return Err(Error::EventAlreadyCanceled); } - let approval_key = DataKey::Approval(proposal_id, caller.clone()); - if env.storage().persistent().has(&approval_key) { - return Err(Error::AlreadyApproved); + if env.ledger().timestamp() <= event.end_date { + return Err(Error::EventNotEnded); } - env.storage().persistent().set(&approval_key, &true); - env.storage().persistent().extend_ttl(&approval_key, MIN_TTL, EXTEND_TTL); + if env + .storage() + .persistent() + .has(&DataKey::FundsWithdrawn(event_id)) + { + return Err(Error::FundsAlreadyWithdrawn); + } - proposal.approvals = proposal.approvals.checked_add(1).ok_or(Error::MathOverflow)?; - - env.storage().persistent().set(&proposal_key, &proposal); - env.storage().persistent().extend_ttl(&proposal_key, MIN_TTL, EXTEND_TTL); + env.storage() + .persistent() + .set(&DataKey::FundsWithdrawn(event_id), &true); + Self::extend_persistent_ttl(&env, &DataKey::FundsWithdrawn(event_id)); + + let balance_key = DataKey::EventBalance(event_id); + let balance: i128 = env.storage().persistent().get(&balance_key).unwrap_or(0); + + if balance > 0 { + let token_client = soroban_sdk::token::Client::new(&env, &event.payment_token); + token_client.transfer(&env.current_contract_address(), &event.organizer, &balance); + env.storage().persistent().set(&balance_key, &0i128); + Self::extend_persistent_ttl(&env, &balance_key); + } + + let event_data = FundsWithdrawnEvent { + contract_address: env.current_contract_address(), + event_id, + organizer: event.organizer.clone(), + amount: balance, + }; + env.events() + .publish((Symbol::new(&env, "FundsWithdrawn"),), event_data); + + Self::decrement_organizer_open_events(&env, &event.organizer); + Self::try_promote_from_waitlist(&env, event_id); Ok(()) } - /// Executes a proposal if the threshold is met. - pub fn execute(env: Env, caller: Address, proposal_id: u64) -> Result { - caller.require_auth(); - Self::check_signer(&env, &caller)?; + pub fn archive_event(env: Env, event_id: u32) -> Result { + upg::require_not_paused(&env); + + if env + .storage() + .persistent() + .has(&DataKey::ArchivedEvent(event_id)) + { + return Err(Error::AlreadyArchived); + } - let proposal_key = DataKey::Proposal(proposal_id); - let mut proposal: Proposal = env + let event: Event = env .storage() .persistent() - .get(&proposal_key) - .ok_or(Error::ProposalNotFound)?; + .get(&DataKey::Event(event_id)) + .ok_or(Error::EventNotFound)?; + + event.organizer.require_auth(); + + if event.is_canceled { + return Err(Error::ArchiveNotAllowed); + } + + let now = env.ledger().timestamp(); + if now <= event.end_date { + return Err(Error::ArchiveNotAllowed); + } - if proposal.executed { - return Err(Error::AlreadyExecuted); + if !env + .storage() + .persistent() + .has(&DataKey::FundsWithdrawn(event_id)) + { + return Err(Error::ArchiveNotAllowed); } - let threshold: u32 = env + let total_collected: i128 = env .storage() .persistent() .get(&DataKey::EventBalance(event_id)) @@ -299,32 +1213,149 @@ impl MultiSigContract { } fn commit_organizer_create(env: &Env, organizer: &Address) { - let ts_key = DataKey::EventCounter; // Dummy key for timestamp if not defined + let count_key = DataKey::OrganizerOpenEventCount(organizer.clone()); + let current: u32 = env.storage().persistent().get(&count_key).unwrap_or(0); + env.storage() + .persistent() + .set(&count_key, ¤t.saturating_add(1)); + Self::extend_persistent_ttl(env, &count_key); + + let ts_key = DataKey::OrganizerLastCreateTs(organizer.clone()); + env.storage() + .persistent() + .set(&ts_key, &env.ledger().timestamp()); + Self::extend_persistent_ttl(env, &ts_key); + } + + fn decrement_organizer_open_events(env: &Env, organizer: &Address) { + let count_key = DataKey::OrganizerOpenEventCount(organizer.clone()); + let current: u32 = env.storage().persistent().get(&count_key).unwrap_or(0); env.storage() + .persistent() + .set(&count_key, ¤t.saturating_sub(1)); + Self::extend_persistent_ttl(env, &count_key); + } + + fn try_promote_from_waitlist(env: &Env, event_id: u32) { + let key = DataKey::Waitlist(event_id); + if let Some(waitlist) = env.storage().persistent().get::<_, Vec
>(&key) { + if !waitlist.is_empty() { + env.events().publish( + (Symbol::new(env, "waitlist_promotion_skipped"),), + (event_id, waitlist.len()), + ); + Self::extend_persistent_ttl(env, &key); + } + } + } + + fn get_and_increment_counter(env: &Env) -> Result { + let current: u32 = env + .storage() + .instance() + .get(&DataKey::EventCounter) + .unwrap_or(0); + let next = current.checked_add(1).ok_or(Error::CounterOverflow)?; + env.storage().instance().set(&DataKey::EventCounter, &next); + upg::extend_instance_ttl(env); + Ok(current) + } + + fn deploy_ticket_nft(env: &Env, event_id: u32) -> Result { + let factory_addr: Address = env + .storage() .instance() - .get(&DataKey::Threshold) - .ok_or(Error::NotInitialized)?; + .get(&DataKey::TicketFactory) + .ok_or(Error::FactoryNotInitialized)?; + + let mut salt_bytes = [0u8; 32]; + let id_bytes = event_id.to_be_bytes(); + salt_bytes[..4].copy_from_slice(&id_bytes); + let salt = BytesN::from_array(env, &salt_bytes); + + let nft_addr: Address = env.invoke_contract( + &factory_addr, + &Symbol::new(env, "deploy_ticket"), + soroban_sdk::vec![env, env.current_contract_address().to_val(), salt.to_val(),], + ); + + Ok(nft_addr) + } - if proposal.approvals < threshold { - return Err(Error::NotEnoughApprovals); + fn record_purchase(env: &Env, event_id: u32, buyer: Address, quantity: u128, total_paid: i128) { + let key = DataKey::BuyerPurchase(event_id, buyer.clone()); + let existing = env.storage().persistent().get::<_, BuyerPurchase>(&key); + + if let Some(mut purchase) = existing { + purchase.quantity = purchase + .quantity + .checked_add(quantity) + .unwrap_or_else(|| panic!("Purchase quantity overflow")); + purchase.total_paid = purchase + .total_paid + .checked_add(total_paid) + .unwrap_or_else(|| panic!("Purchase total overflow")); + env.storage().persistent().set(&key, &purchase); + } else { + let purchase = BuyerPurchase { + quantity, + total_paid, + }; + env.storage().persistent().set(&key, &purchase); + + let buyers_key = DataKey::EventBuyers(event_id); + let mut buyers: Vec
= env + .storage() + .persistent() + .get(&buyers_key) + .unwrap_or_else(|| Vec::new(env)); + buyers.push_back(buyer); + env.storage().persistent().set(&buyers_key, &buyers); + Self::extend_persistent_ttl(env, &buyers_key); } - // Mark executed prior to cross-contract call to prevent reentrancy risks - proposal.executed = true; - env.storage().persistent().set(&proposal_key, &proposal); - env.storage().persistent().extend_ttl(&proposal_key, MIN_TTL, EXTEND_TTL); + if total_paid > 0 { + let balance_key = DataKey::EventBalance(event_id); + let current: i128 = env.storage().persistent().get(&balance_key).unwrap_or(0); + env.storage() + .persistent() + .set(&balance_key, ¤t.saturating_add(total_paid)); + Self::extend_persistent_ttl(env, &balance_key); + } - // Dispatch execution to the target contract - let result = env.invoke_contract::(&proposal.target, &proposal.function, proposal.args); - Ok(result) + Self::extend_persistent_ttl(env, &key); } - // Internal utility to verify the caller is a registered signer - fn check_signer(env: &Env, caller: &Address) -> Result<(), Error> { - let key = DataKey::Signer(caller.clone()); - if !env.storage().persistent().has(&key) { - return Err(Error::Unauthorized); + fn calculate_total_price(ticket_price: i128, quantity: u128) -> i128 { + if ticket_price <= 0 { + return 0; } - Ok(()) + let quantity_i128 = + i128::try_from(quantity).unwrap_or_else(|_| panic!("Quantity exceeds pricing range")); + let subtotal = ticket_price + .checked_mul(quantity_i128) + .unwrap_or_else(|| panic!("Price overflow")); + + let discount_bps = if quantity >= 10 { + 1_000i128 + } else if quantity >= 5 { + 500i128 + } else { + 0i128 + }; + + subtotal + .checked_mul(10_000i128 - discount_bps) + .and_then(|value| value.checked_div(10_000)) + .unwrap_or_else(|| panic!("Discount calculation overflow")) + } + + fn extend_persistent_ttl(env: &Env, key: &DataKey) { + upg::extend_persistent_ttl(env, key); } -} \ No newline at end of file +} + +#[cfg(test)] +mod fuzz; +#[cfg(test)] +mod test; diff --git a/soroban-contract/contracts/marketplace/src/lib.rs b/soroban-contract/contracts/marketplace/src/lib.rs index 394931cf..60f1a8fa 100644 --- a/soroban-contract/contracts/marketplace/src/lib.rs +++ b/soroban-contract/contracts/marketplace/src/lib.rs @@ -1,7 +1,7 @@ #![no_std] use soroban_sdk::{ - contract, contracterror, contractimpl, contracttype, token, Address, BytesN, Env, Vec, + contract, contracterror, contractimpl, contracttype, token, Address, BytesN, Env, Symbol, Vec, }; use upgradeable as upg; @@ -253,7 +253,8 @@ impl MarketplaceContract { let token_client = token::Client::new(&env, &payment_token); // Check if royalty config exists and is active - let royalty_config = env.storage().persistent().get(&DataKey::RoyaltyConfig); + let royalty_config: Option = + env.storage().persistent().get(&DataKey::RoyaltyConfig); let seller_receives = if let Some(ref config) = royalty_config { if config.active { // Calculate and distribute royalties @@ -523,6 +524,7 @@ impl MarketplaceContract { return Err(MarketplaceError::InvalidRoyaltyPercentage); } + let recipients_len = recipients.len(); let config = RoyaltyConfig { recipients, total_percentage, @@ -536,7 +538,7 @@ impl MarketplaceContract { env.events().publish( ("royalty_config_initialized",), - (total_percentage, recipients.len()), + (total_percentage, recipients_len), ); Ok(()) @@ -581,6 +583,7 @@ impl MarketplaceContract { return Err(MarketplaceError::InvalidRoyaltyPercentage); } + let recipients_len = recipients.len(); let config = RoyaltyConfig { recipients, total_percentage, @@ -594,7 +597,7 @@ impl MarketplaceContract { env.events().publish( ("royalty_config_updated",), - (total_percentage, recipients.len()), + (total_percentage, recipients_len), ); Ok(()) @@ -631,9 +634,12 @@ impl MarketplaceContract { } // Update the recipient at the specified index - let mut recipient = config.recipients.get(index); + let mut recipient = config + .recipients + .get(index) + .ok_or(MarketplaceError::RoyaltyConfigNotFound)?; recipient.recipient = new_recipient.clone(); - config.recipients.set(index, &recipient); + config.recipients.set(index, recipient); env.storage() .persistent() @@ -679,7 +685,11 @@ impl MarketplaceContract { } // Calculate total without the old percentage at index - let old_percentage = config.recipients.get(index).percentage; + let mut recipient = config + .recipients + .get(index) + .ok_or(MarketplaceError::RoyaltyConfigNotFound)?; + let old_percentage = recipient.percentage; let mut new_total = config .total_percentage .checked_sub(old_percentage) @@ -695,9 +705,8 @@ impl MarketplaceContract { } // Update the percentage at the specified index - let mut recipient = config.recipients.get(index); recipient.percentage = new_percentage; - config.recipients.set(index, &recipient); + config.recipients.set(index, recipient); config.total_percentage = new_total; env.storage() diff --git a/soroban-contract/contracts/tba_registry/src/lib.rs b/soroban-contract/contracts/tba_registry/src/lib.rs index 709f5630..2698f3eb 100644 --- a/soroban-contract/contracts/tba_registry/src/lib.rs +++ b/soroban-contract/contracts/tba_registry/src/lib.rs @@ -159,7 +159,7 @@ impl TbaRegistry { let deployed_address = env .deployer() .with_current_contract(composite_salt) - .deploy(wasm_hash, constructor_args); + .deploy_v2(wasm_hash, constructor_args); // Initialize the deployed TBA account with NFT details let init_args = soroban_sdk::vec![ diff --git a/soroban-contract/contracts/ticket_factory/src/lib.rs b/soroban-contract/contracts/ticket_factory/src/lib.rs index 9a18c6bf..88a3b120 100644 --- a/soroban-contract/contracts/ticket_factory/src/lib.rs +++ b/soroban-contract/contracts/ticket_factory/src/lib.rs @@ -110,7 +110,7 @@ impl TicketFactory { let deployed_address = env .deployer() .with_address(env.current_contract_address(), salt) - .deploy(wasm_hash, constructor_args); + .deploy_v2(wasm_hash, constructor_args); // Increment ticket count and store the mapping let ticket_id: u32 = env diff --git a/soroban-contract/contracts/ticket_nft/src/lib.rs b/soroban-contract/contracts/ticket_nft/src/lib.rs index db4ed898..12a77cf8 100644 --- a/soroban-contract/contracts/ticket_nft/src/lib.rs +++ b/soroban-contract/contracts/ticket_nft/src/lib.rs @@ -334,8 +334,8 @@ impl TicketNft { .set(&DataKey::Balance(to.clone()), &1u128); Self::extend_persistent_ttl(&env, &DataKey::Owner(token_id)); - Self::extend_persistent_ttl(&env, &DataKey::Balance(from)); - Self::extend_persistent_ttl(&env, &DataKey::Balance(to)); + Self::extend_persistent_ttl(&env, &DataKey::Balance(from.clone())); + Self::extend_persistent_ttl(&env, &DataKey::Balance(to.clone())); env.events().publish( (Symbol::new(&env, "ticket_transferred"),), @@ -359,7 +359,7 @@ impl TicketNft { env.storage() .persistent() .set(&DataKey::Balance(owner.clone()), &0u128); - Self::extend_persistent_ttl(&env, &DataKey::Balance(owner)); + Self::extend_persistent_ttl(&env, &DataKey::Balance(owner.clone())); env.events().publish( (Symbol::new(&env, "ticket_burned"),), From 4c5ae5f669e47ff646bfff745344de913c6ba9ae Mon Sep 17 00:00:00 2001 From: Sage-senpai <157594837+Sage-senpai@users.noreply.github.com> Date: Tue, 28 Apr 2026 12:21:26 +0100 Subject: [PATCH 2/2] feat(contracts): implement secure contract upgradeability pattern Adds a robust upgrade mechanism to all CrowdPass Soroban contracts, enabling future improvements and bug fixes without changing contract addresses. - Add upgrade() function gated behind admin require_auth() - Implement migrate() hook for state schema transformations - Store contract version in instance storage for upgrade tracking - Add version() view function for on-chain version querying - Include upgrade event emission for transparency and auditability - Comprehensive tests covering upgrade flow and unauthorized access Closes #205 --- .../contracts/dao_governance/src/lib.rs | 51 +++ .../contracts/event_manager/src/lib.rs | 21 + .../contracts/marketplace/src/lib.rs | 21 + .../contracts/poap_nft/src/lib.rs | 21 + .../contracts/tba_account/src/lib.rs | 21 + .../contracts/tba_registry/src/lib.rs | 21 + .../contracts/ticket_factory/src/lib.rs | 21 + .../contracts/ticket_nft/src/lib.rs | 21 + .../contracts/upgradeable/src/lib.rs | 112 +++++ .../upgradeable_reference/src/lib.rs | 41 ++ .../upgradeable_reference/src/test.rs | 134 ++++++ .../test/cancel_then_commit_fails.1.json | 331 ++++++-------- .../test/commit_before_delay_fails.1.json | 318 ++++++-------- .../test/commit_without_schedule_fails.1.json | 233 +++++----- .../test/increment_blocked_when_paused.1.json | 304 ++++++------- .../test/increment_works_when_unpaused.1.json | 329 ++++++-------- .../test/initial_state_is_correct.1.json | 233 +++++----- ...st_migrate_authorized_bumps_version.1.json | 188 ++++++++ ..._migrate_rejects_no_op_or_downgrade.1.json | 148 +++++++ ...st_migrate_rejects_strict_downgrade.1.json | 218 ++++++++++ .../test_state_preserved_after_upgrade.1.json | 337 +++++++++++++++ .../test/test_upgrade_authorized.1.json | 219 ++++++++++ .../test/test_upgrade_unauthorized.1.json | 179 ++++++++ .../test/test_version_increments.1.json | 259 +++++++++++ .../test/transfer_admin_updates_owner.1.json | 282 +++++------- .../test/unpause_restores_increment.1.json | 402 +++++++---------- ...version_unchanged_by_admin_transfer.1.json | 282 +++++------- soroban-contract/contracts/vesting/src/lib.rs | 21 + .../test_cliff_blocks_early_release.1.json | 347 +++++++++++++++ .../test/test_full_vest_after_duration.1.json | 358 ++++++++++++++++ .../test/test_linear_release_midway.1.json | 357 ++++++++++++++++ .../test/test_revoke_splits_correctly.1.json | 403 ++++++++++++++++++ 32 files changed, 4611 insertions(+), 1622 deletions(-) create mode 100644 soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_migrate_authorized_bumps_version.1.json create mode 100644 soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_migrate_rejects_no_op_or_downgrade.1.json create mode 100644 soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_migrate_rejects_strict_downgrade.1.json create mode 100644 soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_state_preserved_after_upgrade.1.json create mode 100644 soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_upgrade_authorized.1.json create mode 100644 soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_upgrade_unauthorized.1.json create mode 100644 soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_version_increments.1.json create mode 100644 soroban-contract/contracts/vesting/test_snapshots/test/test_cliff_blocks_early_release.1.json create mode 100644 soroban-contract/contracts/vesting/test_snapshots/test/test_full_vest_after_duration.1.json create mode 100644 soroban-contract/contracts/vesting/test_snapshots/test/test_linear_release_midway.1.json create mode 100644 soroban-contract/contracts/vesting/test_snapshots/test/test_revoke_splits_correctly.1.json diff --git a/soroban-contract/contracts/dao_governance/src/lib.rs b/soroban-contract/contracts/dao_governance/src/lib.rs index f6c3f136..40641c5d 100644 --- a/soroban-contract/contracts/dao_governance/src/lib.rs +++ b/soroban-contract/contracts/dao_governance/src/lib.rs @@ -511,6 +511,57 @@ impl DaoGovernance { Self::get_config(&env) } + // ── Upgrade / admin surface ────────────────────────────────────────────── + + pub fn schedule_upgrade(env: Env, new_wasm_hash: BytesN<32>) { + upg::schedule_upgrade(&env, new_wasm_hash); + } + + pub fn cancel_upgrade(env: Env) { + upg::cancel_upgrade(&env); + } + + pub fn commit_upgrade(env: Env) { + upg::commit_upgrade(&env); + } + + /// Immediate (fast-path) upgrade. Admin-only, no timelock — see + /// `upgradeable::upgrade` for the full security note. Reserve for + /// emergencies; prefer `schedule_upgrade` + `commit_upgrade` for + /// routine upgrades. + pub fn upgrade(env: Env, new_wasm_hash: BytesN<32>) { + upg::upgrade(&env, new_wasm_hash); + } + + /// Apply post-upgrade state-shape migrations and bump the version to + /// `target_version`. Admin-only; rejects downgrades. + pub fn migrate(env: Env, target_version: u32) { + upg::require_admin(&env); + upg::require_version_increase(&env, target_version); + + match target_version { + _ => {} + } + + upg::migration_completed(&env, target_version); + } + + pub fn pause(env: Env) { + upg::pause(&env); + } + + pub fn unpause(env: Env) { + upg::unpause(&env); + } + + pub fn transfer_admin(env: Env, new_admin: Address) { + upg::transfer_admin(&env, new_admin); + } + + pub fn version(env: Env) -> u32 { + upg::get_version(&env) + } + // ── Internal Helper Functions ──────────────────────────────────────────── fn get_config(env: &Env) -> DaoConfig { diff --git a/soroban-contract/contracts/event_manager/src/lib.rs b/soroban-contract/contracts/event_manager/src/lib.rs index 0c5b2ddc..84fa02c9 100644 --- a/soroban-contract/contracts/event_manager/src/lib.rs +++ b/soroban-contract/contracts/event_manager/src/lib.rs @@ -1133,6 +1133,27 @@ impl EventManager { upg::commit_upgrade(&env); } + /// Immediate (fast-path) upgrade. Admin-only, no timelock — see + /// `upgradeable::upgrade` for the full security note. Reserve for + /// emergencies; prefer `schedule_upgrade` + `commit_upgrade` for + /// routine upgrades. + pub fn upgrade(env: Env, new_wasm_hash: BytesN<32>) { + upg::upgrade(&env, new_wasm_hash); + } + + /// Apply post-upgrade state-shape migrations and bump the version to + /// `target_version`. Admin-only; rejects downgrades. + pub fn migrate(env: Env, target_version: u32) { + upg::require_admin(&env); + upg::require_version_increase(&env, target_version); + + match target_version { + _ => {} + } + + upg::migration_completed(&env, target_version); + } + pub fn pause(env: Env) { upg::pause(&env); } diff --git a/soroban-contract/contracts/marketplace/src/lib.rs b/soroban-contract/contracts/marketplace/src/lib.rs index 60f1a8fa..860619c1 100644 --- a/soroban-contract/contracts/marketplace/src/lib.rs +++ b/soroban-contract/contracts/marketplace/src/lib.rs @@ -775,6 +775,27 @@ impl MarketplaceContract { upg::commit_upgrade(&env); } + /// Immediate (fast-path) upgrade. Admin-only, no timelock — see + /// `upgradeable::upgrade` for the full security note. Reserve for + /// emergencies; prefer `schedule_upgrade` + `commit_upgrade` for + /// routine upgrades. + pub fn upgrade(env: Env, new_wasm_hash: BytesN<32>) { + upg::upgrade(&env, new_wasm_hash); + } + + /// Apply post-upgrade state-shape migrations and bump the version to + /// `target_version`. Admin-only; rejects downgrades. + pub fn migrate(env: Env, target_version: u32) { + upg::require_admin(&env); + upg::require_version_increase(&env, target_version); + + match target_version { + _ => {} + } + + upg::migration_completed(&env, target_version); + } + pub fn pause(env: Env) { upg::pause(&env); } diff --git a/soroban-contract/contracts/poap_nft/src/lib.rs b/soroban-contract/contracts/poap_nft/src/lib.rs index b9c7dd22..a0d3b7c2 100644 --- a/soroban-contract/contracts/poap_nft/src/lib.rs +++ b/soroban-contract/contracts/poap_nft/src/lib.rs @@ -191,6 +191,27 @@ impl PoapNft { upg::commit_upgrade(&env); } + /// Immediate (fast-path) upgrade. Admin-only, no timelock — see + /// `upgradeable::upgrade` for the full security note. Reserve for + /// emergencies; prefer `schedule_upgrade` + `commit_upgrade` for + /// routine upgrades. + pub fn upgrade(env: Env, new_wasm_hash: BytesN<32>) { + upg::upgrade(&env, new_wasm_hash); + } + + /// Apply post-upgrade state-shape migrations and bump the version to + /// `target_version`. Admin-only; rejects downgrades. + pub fn migrate(env: Env, target_version: u32) { + upg::require_admin(&env); + upg::require_version_increase(&env, target_version); + + match target_version { + _ => {} + } + + upg::migration_completed(&env, target_version); + } + pub fn pause(env: Env) { upg::pause(&env); } diff --git a/soroban-contract/contracts/tba_account/src/lib.rs b/soroban-contract/contracts/tba_account/src/lib.rs index 20656cca..dee34642 100644 --- a/soroban-contract/contracts/tba_account/src/lib.rs +++ b/soroban-contract/contracts/tba_account/src/lib.rs @@ -296,6 +296,27 @@ impl TbaAccount { upg::commit_upgrade(&env); } + /// Immediate (fast-path) upgrade. Admin-only, no timelock — see + /// `upgradeable::upgrade` for the full security note. Reserve for + /// emergencies; prefer `schedule_upgrade` + `commit_upgrade` for + /// routine upgrades. + pub fn upgrade(env: Env, new_wasm_hash: BytesN<32>) { + upg::upgrade(&env, new_wasm_hash); + } + + /// Apply post-upgrade state-shape migrations and bump the version to + /// `target_version`. Admin-only; rejects downgrades. + pub fn migrate(env: Env, target_version: u32) { + upg::require_admin(&env); + upg::require_version_increase(&env, target_version); + + match target_version { + _ => {} + } + + upg::migration_completed(&env, target_version); + } + pub fn pause(env: Env) { upg::pause(&env); } diff --git a/soroban-contract/contracts/tba_registry/src/lib.rs b/soroban-contract/contracts/tba_registry/src/lib.rs index 2698f3eb..5709112d 100644 --- a/soroban-contract/contracts/tba_registry/src/lib.rs +++ b/soroban-contract/contracts/tba_registry/src/lib.rs @@ -246,6 +246,27 @@ impl TbaRegistry { upg::commit_upgrade(&env); } + /// Immediate (fast-path) upgrade. Admin-only, no timelock — see + /// `upgradeable::upgrade` for the full security note. Reserve for + /// emergencies; prefer `schedule_upgrade` + `commit_upgrade` for + /// routine upgrades. + pub fn upgrade(env: Env, new_wasm_hash: BytesN<32>) { + upg::upgrade(&env, new_wasm_hash); + } + + /// Apply post-upgrade state-shape migrations and bump the version to + /// `target_version`. Admin-only; rejects downgrades. + pub fn migrate(env: Env, target_version: u32) { + upg::require_admin(&env); + upg::require_version_increase(&env, target_version); + + match target_version { + _ => {} + } + + upg::migration_completed(&env, target_version); + } + pub fn pause(env: Env) { upg::pause(&env); } diff --git a/soroban-contract/contracts/ticket_factory/src/lib.rs b/soroban-contract/contracts/ticket_factory/src/lib.rs index 88a3b120..4cb1e830 100644 --- a/soroban-contract/contracts/ticket_factory/src/lib.rs +++ b/soroban-contract/contracts/ticket_factory/src/lib.rs @@ -223,6 +223,27 @@ impl TicketFactory { upg::commit_upgrade(&env); } + /// Immediate (fast-path) upgrade. Admin-only, no timelock — see + /// `upgradeable::upgrade` for the full security note. Reserve for + /// emergencies; prefer `schedule_upgrade` + `commit_upgrade` for + /// routine upgrades. + pub fn upgrade(env: Env, new_wasm_hash: BytesN<32>) { + upg::upgrade(&env, new_wasm_hash); + } + + /// Apply post-upgrade state-shape migrations and bump the version to + /// `target_version`. Admin-only; rejects downgrades. + pub fn migrate(env: Env, target_version: u32) { + upg::require_admin(&env); + upg::require_version_increase(&env, target_version); + + match target_version { + _ => {} + } + + upg::migration_completed(&env, target_version); + } + pub fn pause(env: Env) { upg::pause(&env); } diff --git a/soroban-contract/contracts/ticket_nft/src/lib.rs b/soroban-contract/contracts/ticket_nft/src/lib.rs index 12a77cf8..6729a64d 100644 --- a/soroban-contract/contracts/ticket_nft/src/lib.rs +++ b/soroban-contract/contracts/ticket_nft/src/lib.rs @@ -404,6 +404,27 @@ impl TicketNft { upg::commit_upgrade(&env); } + /// Immediate (fast-path) upgrade. Admin-only, no timelock — see + /// `upgradeable::upgrade` for the full security note. Reserve for + /// emergencies; prefer `schedule_upgrade` + `commit_upgrade` for + /// routine upgrades. + pub fn upgrade(env: Env, new_wasm_hash: BytesN<32>) { + upg::upgrade(&env, new_wasm_hash); + } + + /// Apply post-upgrade state-shape migrations and bump the version to + /// `target_version`. Admin-only; rejects downgrades. + pub fn migrate(env: Env, target_version: u32) { + upg::require_admin(&env); + upg::require_version_increase(&env, target_version); + + match target_version { + _ => {} + } + + upg::migration_completed(&env, target_version); + } + pub fn pause(env: Env) { upg::pause(&env); } diff --git a/soroban-contract/contracts/upgradeable/src/lib.rs b/soroban-contract/contracts/upgradeable/src/lib.rs index bc7f4632..309ab3d6 100644 --- a/soroban-contract/contracts/upgradeable/src/lib.rs +++ b/soroban-contract/contracts/upgradeable/src/lib.rs @@ -45,6 +45,20 @@ pub struct AdminChangedEvent { pub new_admin: Address, } +/// Emitted when [`migration_completed`] runs successfully against a contract. +/// +/// Migrations are state-shape transformations applied AFTER the WASM swap. +/// Off-chain indexers should treat this event as "the contract at version +/// `from_version` has been migrated to `to_version` and the new schema is +/// now in effect". +#[contracttype] +#[derive(Clone, Debug, Eq, PartialEq)] +pub struct MigratedEvent { + pub contract_address: Address, + pub from_version: u32, + pub to_version: u32, +} + #[contracttype] #[derive(Clone)] pub enum UpgradeKey { @@ -202,6 +216,104 @@ pub fn transfer_admin(env: &Env, new_admin: Address) { .publish((Symbol::new(env, "AdminChanged"),), event); } +// ── Fast-path upgrade (no timelock) ────────────────────────────────────────── +// +// SECURITY NOTE +// ------------- +// `upgrade(...)` performs an immediate WASM swap with no timelock. It exists +// alongside the safer `schedule_upgrade` / `commit_upgrade` two-step flow for +// situations where the slower timelocked path is unsuitable (e.g. responding +// to a live exploit). Because it skips the 24-hour grace window, a compromised +// admin key can use this entry point to replace the contract code instantly, +// so projects deploying this library SHOULD prefer the timelocked path for +// routine upgrades and reserve `upgrade()` for emergencies. Both paths share +// the same admin-auth + version-bump invariants. + +/// Immediate (fast-path) upgrade: replace the contract WASM in a single call. +/// +/// # Authorisation +/// Requires the current admin's signature via `require_auth()` — see the +/// SECURITY NOTE above before exposing this from a contract. +/// +/// # Arguments +/// * `env` — the contract environment. +/// * `new_wasm_hash` — hash of the new WASM blob; must already be uploaded +/// on-chain via `env.deployer().upload_contract_wasm(...)`. +/// +/// # Side effects +/// 1. Authenticates the admin. +/// 2. Increments the version counter (`get_version(env) + 1`). +/// 3. Calls `env.deployer().update_current_contract_wasm(new_wasm_hash)` to +/// swap the bytecode in place. The contract address does **not** change. +/// 4. Emits an [`UpgradedEvent`] for off-chain monitoring. +pub fn upgrade(env: &Env, new_wasm_hash: BytesN<32>) { + require_admin(env); + + let old_version = get_version(env); + let new_version = bump_version(env); + + env.deployer() + .update_current_contract_wasm(new_wasm_hash.clone()); + + let event = UpgradedEvent { + contract_address: env.current_contract_address(), + new_wasm_hash, + old_version, + new_version, + }; + env.events() + .publish((Symbol::new(env, "Upgraded"),), event); +} + +// ── Version / migration helpers ────────────────────────────────────────────── + +/// Guard helper for `migrate(...)` entry points — panics if `target_version` +/// would be a downgrade or a no-op. +/// +/// Use this at the top of every contract-specific `migrate` function to +/// enforce the "version must strictly increase" invariant. Calling it when +/// `target_version <= get_version(env)` panics with `"downgrade not allowed"`, +/// which surfaces to off-chain callers as a contract revert. +pub fn require_version_increase(env: &Env, target_version: u32) { + let current = get_version(env); + assert!( + target_version > current, + "downgrade not allowed" + ); +} + +/// Mark an in-progress migration as complete and emit a [`MigratedEvent`]. +/// +/// Contracts call this from their `migrate(target_version)` function once +/// the contract-specific state-shape transformations have been applied. The +/// stored version is updated to `target_version` so subsequent calls to +/// `version()` reflect the migrated state. +/// +/// # Authorisation +/// **Does not** call `require_auth()` itself — the surrounding `migrate` +/// entry point is expected to have authenticated the admin already, and +/// Soroban auth frames don't permit a second `require_auth` against the +/// same admin within the same call. Callers must invoke +/// [`require_admin`] before reaching this function. +/// +/// # Panics +/// Panics if `target_version <= current_version` (no-op or downgrade). +pub fn migration_completed(env: &Env, target_version: u32) { + let from_version = get_version(env); + require_version_increase(env, target_version); + env.storage() + .instance() + .set(&UpgradeKey::Version, &target_version); + + let event = MigratedEvent { + contract_address: env.current_contract_address(), + from_version, + to_version: target_version, + }; + env.events() + .publish((Symbol::new(env, "Migrated"),), event); +} + // ── Storage TTL helpers ────────────────────────────────────────────────────── pub fn default_ttl_threshold() -> u32 { diff --git a/soroban-contract/contracts/upgradeable_reference/src/lib.rs b/soroban-contract/contracts/upgradeable_reference/src/lib.rs index e3aae688..fc339a34 100644 --- a/soroban-contract/contracts/upgradeable_reference/src/lib.rs +++ b/soroban-contract/contracts/upgradeable_reference/src/lib.rs @@ -95,6 +95,47 @@ impl UpgradeableReference { upg::commit_upgrade(&env); } + /// Immediate (fast-path) upgrade — replaces the contract WASM in one call. + /// + /// # Security + /// - Admin-only: `require_auth()` is enforced inside `upg::upgrade`. + /// - The new WASM must already be uploaded via + /// `env.deployer().upload_contract_wasm(...)`. + /// - This entry point skips the 24-hour timelock that gates + /// `schedule_upgrade` / `commit_upgrade`. Operators should reserve it + /// for emergencies (live exploit response) and prefer the timelocked + /// path for routine upgrades. + /// - Increments the on-chain version counter and emits an `Upgraded` + /// event for off-chain audit trails. + pub fn upgrade(env: Env, new_wasm_hash: BytesN<32>) { + upg::upgrade(&env, new_wasm_hash); + } + + /// Apply post-upgrade state-shape migrations and bump the version to + /// `target_version`. + /// + /// # Security + /// - Admin-only. + /// - Panics if `target_version <= current_version` (downgrade guard + /// enforced by `upg::require_version_increase`). + /// + /// Each future schema change adds a `match target_version` arm with the + /// transformation logic. The reference contract has no migrations yet, + /// so the body is a pass-through that records the new version. + pub fn migrate(env: Env, target_version: u32) { + upg::require_admin(&env); + upg::require_version_increase(&env, target_version); + + // Per-version migration logic lives here. Add new arms as the + // contract's storage shape evolves; the wildcard arm is a no-op + // for versions that don't need data migration. + match target_version { + _ => {} + } + + upg::migration_completed(&env, target_version); + } + pub fn pause(env: Env) { upg::pause(&env); } diff --git a/soroban-contract/contracts/upgradeable_reference/src/test.rs b/soroban-contract/contracts/upgradeable_reference/src/test.rs index 2b04ed2f..39dbac89 100644 --- a/soroban-contract/contracts/upgradeable_reference/src/test.rs +++ b/soroban-contract/contracts/upgradeable_reference/src/test.rs @@ -10,6 +10,18 @@ use upgradeable::UPGRADE_DELAY_LEDGERS; const START_LEDGER: u32 = 1_000; +// Compiled WASM of this contract, used as the post-upgrade target. Importing +// the contract's own WASM as the "v2" payload is enough to exercise the +// upgrade flow end-to-end (auth check, version bump, state preservation, real +// `update_current_contract_wasm` call) without needing a separate v2 codebase. +// +// Build with: `cargo build --target wasm32v1-none --release -p upgradeable_reference` +mod upgradeable_reference_v2 { + soroban_sdk::contractimport!( + file = "../../target/wasm32v1-none/release/upgradeable_reference.wasm" + ); +} + fn setup() -> (Env, UpgradeableReferenceClient<'static>, Address) { let env = Env::default(); env.mock_all_auths(); @@ -25,6 +37,13 @@ fn dummy_hash(env: &Env, byte: u8) -> BytesN<32> { BytesN::from_array(env, &[byte; 32]) } +/// Upload the v2 WASM and return its hash. Wraps the boilerplate so each +/// upgrade test reads as a single line. +fn upload_v2_hash(env: &Env) -> BytesN<32> { + env.deployer() + .upload_contract_wasm(upgradeable_reference_v2::WASM) +} + // ── Initialisation & version ───────────────────────────────────────────── #[test] @@ -100,6 +119,121 @@ fn cancel_then_commit_fails() { client.commit_upgrade(); } +// ── Fast-path upgrade (issue #205) ─────────────────────────────────────── + +#[test] +fn test_upgrade_authorized() { + let (env, client, _admin) = setup(); + assert_eq!(client.version(), 1); + + let new_hash = upload_v2_hash(&env); + client.upgrade(&new_hash); + + // After a successful upgrade the version counter has advanced. The + // contract address is unchanged — `client` continues to address the + // same instance. + assert_eq!(client.version(), 2); +} + +#[test] +#[should_panic] +fn test_upgrade_unauthorized() { + // Set up WITHOUT `mock_all_auths` so that the admin's signature is + // missing. `upg::upgrade` must reject the call before it touches any + // state. + let env = Env::default(); + env.ledger().set_sequence_number(START_LEDGER); + + let admin = Address::generate(&env); + + // Constructor itself uses `admin.require_auth()`, so we need to mock + // that single call but no others. After construction we drop the + // auth-mocking by registering a fresh contract from a separate env + // would be cleaner, but mock_auths with an empty allow-list achieves + // the same effect for the upgrade attempt below. + env.mock_all_auths(); + let contract_id = env.register(UpgradeableReference, (admin.clone(),)); + let client = UpgradeableReferenceClient::new(&env, &contract_id); + + // Re-arm auth so that NO signature is mocked — any subsequent + // `require_auth()` call must panic. + env.set_auths(&[]); + + let new_hash = upload_v2_hash(&env); + // Should panic inside `upg::upgrade -> require_admin -> require_auth`. + client.upgrade(&new_hash); +} + +#[test] +fn test_version_increments() { + let (env, client, _admin) = setup(); + let new_hash = upload_v2_hash(&env); + + assert_eq!(client.version(), 1); + client.upgrade(&new_hash); + assert_eq!(client.version(), 2); + client.upgrade(&new_hash); + assert_eq!(client.version(), 3); +} + +#[test] +fn test_state_preserved_after_upgrade() { + let (env, client, _admin) = setup(); + let caller = Address::generate(&env); + + // Build up some state pre-upgrade. + client.increment(&caller); + client.increment(&caller); + client.increment(&caller); + assert_eq!(client.get(), 3); + + // Swap WASM. The contract address (and therefore its storage entries) + // does not change — only the executable code does. + let new_hash = upload_v2_hash(&env); + client.upgrade(&new_hash); + + // Counter survives the upgrade because storage entries are addressed by + // the contract instance, not by the WASM hash. + assert_eq!(client.get(), 3); + assert_eq!(client.version(), 2); +} + +// ── Migration hook (issue #205, option B) ──────────────────────────────── + +#[test] +fn test_migrate_authorized_bumps_version() { + let (_env, client, _admin) = setup(); + assert_eq!(client.version(), 1); + + // Apply a hypothetical schema migration that takes us straight to v5 + // (the wildcard arm in `migrate` is a no-op; this exercises the + // version-bookkeeping path). + client.migrate(&5); + assert_eq!(client.version(), 5); +} + +// Soroban WASM contract panics surface to the host as `Error(WasmVm, +// InvalidAction)` rather than the original Rust panic message, so we use a +// bare `#[should_panic]` here. The downgrade guard's behaviour is verified +// by the absence-of-version-bump in the success-path tests above. +#[test] +#[should_panic] +fn test_migrate_rejects_no_op_or_downgrade() { + let (_env, client, _admin) = setup(); + // Current version is 1; migrating to 1 is a no-op and must be rejected + // (it would otherwise let an attacker stomp on the version counter). + client.migrate(&1); +} + +#[test] +#[should_panic] +fn test_migrate_rejects_strict_downgrade() { + let (env, client, _admin) = setup(); + let new_hash = upload_v2_hash(&env); + client.upgrade(&new_hash); // version is now 2 + client.migrate(&1); // attempt to roll back +} + // ── Admin transfer ─────────────────────────────────────────────────────── #[test] diff --git a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/cancel_then_commit_fails.1.json b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/cancel_then_commit_fails.1.json index 0e1ed1ff..eadccb9f 100644 --- a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/cancel_then_commit_fails.1.json +++ b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/cancel_then_commit_fails.1.json @@ -1,7 +1,8 @@ { "generators": { "address": 2, - "nonce": 0 + "nonce": 0, + "mux_id": 0 }, "auth": [ [ @@ -60,7 +61,7 @@ [] ], "ledger": { - "protocol_version": 22, + "protocol_version": 25, "sequence_number": 18280, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -69,222 +70,152 @@ "min_temp_entry_ttl": 16, "max_entry_ttl": 6312000, "ledger_entries": [ - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 801925984706572462 - } - }, - "durability": "temporary" - } + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "801925984706572462" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 801925984706572462 - } - }, - "durability": "temporary", - "val": "void" - } - }, - "ext": "v0" + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "1033654523790656264" + } + }, + "durability": "temporary", + "val": "void" + } }, - 6312999 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 1033654523790656264 - } - }, - "durability": "temporary" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 1033654523790656264 - } - }, - "durability": "temporary", - "val": "void" - } - }, - "ext": "v0" + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "5541220902715666415" + } + }, + "durability": "temporary", + "val": "void" + } }, - 6312999 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 5541220902715666415 - } - }, - "durability": "temporary" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 5541220902715666415 + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Counter" } - }, - "durability": "temporary", - "val": "void" + ] + }, + "durability": "persistent", + "val": { + "u32": 0 } - }, - "ext": "v0" + } }, - 6312999 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": { - "vec": [ - { - "symbol": "Counter" - } - ] - }, - "durability": "persistent" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": { - "vec": [ + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ { - "symbol": "Counter" - } - ] - }, - "durability": "persistent", - "val": { - "u32": 0 - } - } - }, - "ext": "v0" - }, - 1729000 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": "ledger_key_contract_instance", - "durability": "persistent" - } - }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": "ledger_key_contract_instance", - "durability": "persistent", - "val": { - "contract_instance": { - "executable": { - "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "key": { + "vec": [ + { + "symbol": "Admin" + } + ] + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } }, - "storage": [ - { - "key": { - "vec": [ - { - "symbol": "Admin" - } - ] - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } + { + "key": { + "vec": [ + { + "symbol": "Version" + } + ] }, - { - "key": { - "vec": [ - { - "symbol": "Version" - } - ] - }, - "val": { - "u32": 1 - } + "val": { + "u32": 1 } - ] - } + } + ] } } - }, - "ext": "v0" + } }, - 1729000 - ] - ], - [ - { - "contract_code": { - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_code": { - "ext": "v0", - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "code": "" - } - }, - "ext": "v0" + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } }, - 1729000 - ] - ] + "ext": "v0" + }, + "live_until": 1729000 + } ] }, "events": [] diff --git a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/commit_before_delay_fails.1.json b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/commit_before_delay_fails.1.json index d5edcc0c..0475ac2c 100644 --- a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/commit_before_delay_fails.1.json +++ b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/commit_before_delay_fails.1.json @@ -1,7 +1,8 @@ { "generators": { "address": 2, - "nonce": 0 + "nonce": 0, + "mux_id": 0 }, "auth": [ [ @@ -45,7 +46,7 @@ [] ], "ledger": { - "protocol_version": 22, + "protocol_version": 25, "sequence_number": 18279, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -54,208 +55,151 @@ "min_temp_entry_ttl": 16, "max_entry_ttl": 6312000, "ledger_entries": [ - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 801925984706572462 - } - }, - "durability": "temporary" - } + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "801925984706572462" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 801925984706572462 - } - }, - "durability": "temporary", - "val": "void" - } - }, - "ext": "v0" + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "5541220902715666415" + } + }, + "durability": "temporary", + "val": "void" + } }, - 6312999 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 5541220902715666415 - } - }, - "durability": "temporary" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 5541220902715666415 + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Counter" } - }, - "durability": "temporary", - "val": "void" + ] + }, + "durability": "persistent", + "val": { + "u32": 0 } - }, - "ext": "v0" + } }, - 6312999 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": { - "vec": [ - { - "symbol": "Counter" - } - ] - }, - "durability": "persistent" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": { - "vec": [ + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ { - "symbol": "Counter" - } - ] - }, - "durability": "persistent", - "val": { - "u32": 0 - } - } - }, - "ext": "v0" - }, - 1729000 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": "ledger_key_contract_instance", - "durability": "persistent" - } - }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": "ledger_key_contract_instance", - "durability": "persistent", - "val": { - "contract_instance": { - "executable": { - "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "key": { + "vec": [ + { + "symbol": "Admin" + } + ] + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } }, - "storage": [ - { - "key": { - "vec": [ - { - "symbol": "Admin" - } - ] - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } + { + "key": { + "vec": [ + { + "symbol": "PendingUpgrade" + } + ] }, - { - "key": { - "vec": [ - { - "symbol": "PendingUpgrade" - } - ] - }, - "val": { - "vec": [ - { - "bytes": "abababababababababababababababababababababababababababababababab" - }, - { - "u32": 1000 - } - ] - } + "val": { + "vec": [ + { + "bytes": "abababababababababababababababababababababababababababababababab" + }, + { + "u32": 1000 + } + ] + } + }, + { + "key": { + "vec": [ + { + "symbol": "Version" + } + ] }, - { - "key": { - "vec": [ - { - "symbol": "Version" - } - ] - }, - "val": { - "u32": 1 - } + "val": { + "u32": 1 } - ] - } + } + ] } } - }, - "ext": "v0" + } }, - 1729000 - ] - ], - [ - { - "contract_code": { - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_code": { - "ext": "v0", - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "code": "" - } - }, - "ext": "v0" + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } }, - 1729000 - ] - ] + "ext": "v0" + }, + "live_until": 1729000 + } ] }, "events": [] diff --git a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/commit_without_schedule_fails.1.json b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/commit_without_schedule_fails.1.json index 7d0edbc3..e4714f73 100644 --- a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/commit_without_schedule_fails.1.json +++ b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/commit_without_schedule_fails.1.json @@ -1,7 +1,8 @@ { "generators": { "address": 2, - "nonce": 0 + "nonce": 0, + "mux_id": 0 }, "auth": [ [ @@ -26,7 +27,7 @@ [] ], "ledger": { - "protocol_version": 22, + "protocol_version": 25, "sequence_number": 1000, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -35,156 +36,112 @@ "min_temp_entry_ttl": 16, "max_entry_ttl": 6312000, "ledger_entries": [ - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 801925984706572462 - } - }, - "durability": "temporary" - } + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "801925984706572462" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 801925984706572462 + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Counter" } - }, - "durability": "temporary", - "val": "void" + ] + }, + "durability": "persistent", + "val": { + "u32": 0 } - }, - "ext": "v0" + } }, - 6312999 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": { - "vec": [ - { - "symbol": "Counter" - } - ] - }, - "durability": "persistent" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": { - "vec": [ + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ { - "symbol": "Counter" - } - ] - }, - "durability": "persistent", - "val": { - "u32": 0 - } - } - }, - "ext": "v0" - }, - 1729000 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": "ledger_key_contract_instance", - "durability": "persistent" - } - }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": "ledger_key_contract_instance", - "durability": "persistent", - "val": { - "contract_instance": { - "executable": { - "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "key": { + "vec": [ + { + "symbol": "Admin" + } + ] + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } }, - "storage": [ - { - "key": { - "vec": [ - { - "symbol": "Admin" - } - ] - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } + { + "key": { + "vec": [ + { + "symbol": "Version" + } + ] }, - { - "key": { - "vec": [ - { - "symbol": "Version" - } - ] - }, - "val": { - "u32": 1 - } + "val": { + "u32": 1 } - ] - } + } + ] } } - }, - "ext": "v0" + } }, - 1729000 - ] - ], - [ - { - "contract_code": { - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_code": { - "ext": "v0", - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "code": "" - } - }, - "ext": "v0" + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } }, - 1729000 - ] - ] + "ext": "v0" + }, + "live_until": 1729000 + } ] }, "events": [] diff --git a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/increment_blocked_when_paused.1.json b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/increment_blocked_when_paused.1.json index 0cad5652..90fbd0a5 100644 --- a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/increment_blocked_when_paused.1.json +++ b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/increment_blocked_when_paused.1.json @@ -1,7 +1,8 @@ { "generators": { "address": 3, - "nonce": 0 + "nonce": 0, + "mux_id": 0 }, "auth": [ [ @@ -41,7 +42,7 @@ [] ], "ledger": { - "protocol_version": 22, + "protocol_version": 25, "sequence_number": 1000, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -50,201 +51,144 @@ "min_temp_entry_ttl": 16, "max_entry_ttl": 6312000, "ledger_entries": [ - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 801925984706572462 - } - }, - "durability": "temporary" - } + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "801925984706572462" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 801925984706572462 - } - }, - "durability": "temporary", - "val": "void" - } - }, - "ext": "v0" + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "5541220902715666415" + } + }, + "durability": "temporary", + "val": "void" + } }, - 6312999 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 5541220902715666415 - } - }, - "durability": "temporary" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 5541220902715666415 + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Counter" } - }, - "durability": "temporary", - "val": "void" + ] + }, + "durability": "persistent", + "val": { + "u32": 0 } - }, - "ext": "v0" + } }, - 6312999 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": { - "vec": [ - { - "symbol": "Counter" - } - ] - }, - "durability": "persistent" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": { - "vec": [ + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ { - "symbol": "Counter" - } - ] - }, - "durability": "persistent", - "val": { - "u32": 0 - } - } - }, - "ext": "v0" - }, - 1729000 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": "ledger_key_contract_instance", - "durability": "persistent" - } - }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": "ledger_key_contract_instance", - "durability": "persistent", - "val": { - "contract_instance": { - "executable": { - "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "key": { + "vec": [ + { + "symbol": "Admin" + } + ] + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } }, - "storage": [ - { - "key": { - "vec": [ - { - "symbol": "Admin" - } - ] - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } + { + "key": { + "vec": [ + { + "symbol": "Paused" + } + ] }, - { - "key": { - "vec": [ - { - "symbol": "Paused" - } - ] - }, - "val": { - "bool": true - } + "val": { + "bool": true + } + }, + { + "key": { + "vec": [ + { + "symbol": "Version" + } + ] }, - { - "key": { - "vec": [ - { - "symbol": "Version" - } - ] - }, - "val": { - "u32": 1 - } + "val": { + "u32": 1 } - ] - } + } + ] } } - }, - "ext": "v0" + } }, - 1729000 - ] - ], - [ - { - "contract_code": { - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_code": { - "ext": "v0", - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "code": "" - } - }, - "ext": "v0" + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } }, - 1729000 - ] - ] + "ext": "v0" + }, + "live_until": 1729000 + } ] }, "events": [] diff --git a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/increment_works_when_unpaused.1.json b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/increment_works_when_unpaused.1.json index fdac17a9..a29f65e3 100644 --- a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/increment_works_when_unpaused.1.json +++ b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/increment_works_when_unpaused.1.json @@ -1,7 +1,8 @@ { "generators": { "address": 3, - "nonce": 0 + "nonce": 0, + "mux_id": 0 }, "auth": [ [ @@ -64,7 +65,7 @@ [] ], "ledger": { - "protocol_version": 22, + "protocol_version": 25, "sequence_number": 1000, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -73,222 +74,152 @@ "min_temp_entry_ttl": 16, "max_entry_ttl": 6312000, "ledger_entries": [ - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 801925984706572462 - } - }, - "durability": "temporary" - } + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "801925984706572462" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 801925984706572462 + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Counter" } - }, - "durability": "temporary", - "val": "void" + ] + }, + "durability": "persistent", + "val": { + "u32": 2 } - }, - "ext": "v0" + } }, - 6312999 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": { - "vec": [ - { - "symbol": "Counter" - } - ] - }, - "durability": "persistent" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": { - "vec": [ + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ { - "symbol": "Counter" + "key": { + "vec": [ + { + "symbol": "Admin" + } + ] + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + }, + { + "key": { + "vec": [ + { + "symbol": "Version" + } + ] + }, + "val": { + "u32": 1 + } } ] - }, - "durability": "persistent", - "val": { - "u32": 2 } } - }, - "ext": "v0" + } }, - 1729000 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": "ledger_key_contract_instance", - "durability": "persistent" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": "ledger_key_contract_instance", - "durability": "persistent", - "val": { - "contract_instance": { - "executable": { - "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - }, - "storage": [ - { - "key": { - "vec": [ - { - "symbol": "Admin" - } - ] - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } - }, - { - "key": { - "vec": [ - { - "symbol": "Version" - } - ] - }, - "val": { - "u32": 1 - } - } - ] - } + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": "1033654523790656264" } - } - }, - "ext": "v0" + }, + "durability": "temporary", + "val": "void" + } }, - 1729000 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", - "key": { - "ledger_key_nonce": { - "nonce": 1033654523790656264 - } - }, - "durability": "temporary" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", - "key": { - "ledger_key_nonce": { - "nonce": 1033654523790656264 - } - }, - "durability": "temporary", - "val": "void" - } - }, - "ext": "v0" + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": "5541220902715666415" + } + }, + "durability": "temporary", + "val": "void" + } }, - 6312999 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", - "key": { - "ledger_key_nonce": { - "nonce": 5541220902715666415 - } - }, - "durability": "temporary" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", - "key": { - "ledger_key_nonce": { - "nonce": 5541220902715666415 - } - }, - "durability": "temporary", - "val": "void" - } - }, - "ext": "v0" + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } }, - 6312999 - ] - ], - [ - { - "contract_code": { - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_code": { - "ext": "v0", - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "code": "" - } - }, - "ext": "v0" - }, - 1729000 - ] - ] + "live_until": 1729000 + } ] }, "events": [] diff --git a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/initial_state_is_correct.1.json b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/initial_state_is_correct.1.json index acf8d860..1899856c 100644 --- a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/initial_state_is_correct.1.json +++ b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/initial_state_is_correct.1.json @@ -1,7 +1,8 @@ { "generators": { "address": 2, - "nonce": 0 + "nonce": 0, + "mux_id": 0 }, "auth": [ [ @@ -29,7 +30,7 @@ [] ], "ledger": { - "protocol_version": 22, + "protocol_version": 25, "sequence_number": 1000, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -38,156 +39,112 @@ "min_temp_entry_ttl": 16, "max_entry_ttl": 6312000, "ledger_entries": [ - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 801925984706572462 - } - }, - "durability": "temporary" - } + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "801925984706572462" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 801925984706572462 + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Counter" } - }, - "durability": "temporary", - "val": "void" + ] + }, + "durability": "persistent", + "val": { + "u32": 0 } - }, - "ext": "v0" + } }, - 6312999 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": { - "vec": [ - { - "symbol": "Counter" - } - ] - }, - "durability": "persistent" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": { - "vec": [ + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ { - "symbol": "Counter" - } - ] - }, - "durability": "persistent", - "val": { - "u32": 0 - } - } - }, - "ext": "v0" - }, - 1729000 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": "ledger_key_contract_instance", - "durability": "persistent" - } - }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": "ledger_key_contract_instance", - "durability": "persistent", - "val": { - "contract_instance": { - "executable": { - "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "key": { + "vec": [ + { + "symbol": "Admin" + } + ] + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } }, - "storage": [ - { - "key": { - "vec": [ - { - "symbol": "Admin" - } - ] - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } + { + "key": { + "vec": [ + { + "symbol": "Version" + } + ] }, - { - "key": { - "vec": [ - { - "symbol": "Version" - } - ] - }, - "val": { - "u32": 1 - } + "val": { + "u32": 1 } - ] - } + } + ] } } - }, - "ext": "v0" + } }, - 1729000 - ] - ], - [ - { - "contract_code": { - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_code": { - "ext": "v0", - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "code": "" - } - }, - "ext": "v0" + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } }, - 1729000 - ] - ] + "ext": "v0" + }, + "live_until": 1729000 + } ] }, "events": [] diff --git a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_migrate_authorized_bumps_version.1.json b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_migrate_authorized_bumps_version.1.json new file mode 100644 index 00000000..17a61067 --- /dev/null +++ b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_migrate_authorized_bumps_version.1.json @@ -0,0 +1,188 @@ +{ + "generators": { + "address": 2, + "nonce": 0, + "mux_id": 0 + }, + "auth": [ + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "__constructor", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "migrate", + "args": [ + { + "u32": 5 + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [] + ], + "ledger": { + "protocol_version": 25, + "sequence_number": 1000, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "801925984706572462" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "5541220902715666415" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Counter" + } + ] + }, + "durability": "persistent", + "val": { + "u32": 0 + } + } + }, + "ext": "v0" + }, + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "vec": [ + { + "symbol": "Admin" + } + ] + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + }, + { + "key": { + "vec": [ + { + "symbol": "Version" + } + ] + }, + "val": { + "u32": 5 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + "live_until": 1729000 + } + ] + }, + "events": [] +} \ No newline at end of file diff --git a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_migrate_rejects_no_op_or_downgrade.1.json b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_migrate_rejects_no_op_or_downgrade.1.json new file mode 100644 index 00000000..e4714f73 --- /dev/null +++ b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_migrate_rejects_no_op_or_downgrade.1.json @@ -0,0 +1,148 @@ +{ + "generators": { + "address": 2, + "nonce": 0, + "mux_id": 0 + }, + "auth": [ + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "__constructor", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [] + ], + "ledger": { + "protocol_version": 25, + "sequence_number": 1000, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "801925984706572462" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Counter" + } + ] + }, + "durability": "persistent", + "val": { + "u32": 0 + } + } + }, + "ext": "v0" + }, + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "vec": [ + { + "symbol": "Admin" + } + ] + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + }, + { + "key": { + "vec": [ + { + "symbol": "Version" + } + ] + }, + "val": { + "u32": 1 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + "live_until": 1729000 + } + ] + }, + "events": [] +} \ No newline at end of file diff --git a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_migrate_rejects_strict_downgrade.1.json b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_migrate_rejects_strict_downgrade.1.json new file mode 100644 index 00000000..18e21156 --- /dev/null +++ b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_migrate_rejects_strict_downgrade.1.json @@ -0,0 +1,218 @@ +{ + "generators": { + "address": 2, + "nonce": 0, + "mux_id": 0 + }, + "auth": [ + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "__constructor", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "upgrade", + "args": [ + { + "bytes": "500102ea154c5be1954457d777dfeff4b8bf98902c8d98019ab92d4981ec770a" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [] + ], + "ledger": { + "protocol_version": 25, + "sequence_number": 1000, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "801925984706572462" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "5541220902715666415" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Counter" + } + ] + }, + "durability": "persistent", + "val": { + "u32": 0 + } + } + }, + "ext": "v0" + }, + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "500102ea154c5be1954457d777dfeff4b8bf98902c8d98019ab92d4981ec770a" + }, + "storage": [ + { + "key": { + "vec": [ + { + "symbol": "Admin" + } + ] + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + }, + { + "key": { + "vec": [ + { + "symbol": "Version" + } + ] + }, + "val": { + "u32": 2 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": { + "v1": { + "ext": "v0", + "cost_inputs": { + "ext": "v0", + "n_instructions": 1295, + "n_functions": 43, + "n_globals": 4, + "n_table_entries": 0, + "n_types": 15, + "n_data_segments": 1, + "n_elem_segments": 0, + "n_imports": 16, + "n_exports": 18, + "n_data_segment_bytes": 316 + } + } + }, + "hash": "500102ea154c5be1954457d777dfeff4b8bf98902c8d98019ab92d4981ec770a", + "code": "0061736d0100000001520f60027e7e017e60037e7e7e017e60047e7e7e7e017e60017e017e6000017e60017f0060027e7e017f60000060037f7f7f0060027f7e0060017e0060017f017e6000017f60027f7f017e60047f7f7f7f017e026110016c01310000016c015f0001016c01370002016101300003016c01380000017801310000017601680001016c013600030178013700040162016a0000017801330004016201380003016c01300000016c01320000017601670000016d01390001032c2b05040605070809030a05040404070b0a0c030409050c0c0d0b070704030c0403050e0405030d030403040805030100110621047f01418080c0000b7f00418780c0000b7f0041bc82c0000b7f0041c082c0000b07d50112066d656d6f727902000d5f5f636f6e7374727563746f7200170561646d696e001a0e63616e63656c5f75706772616465001c0e636f6d6d69745f75706772616465002203676574002b09696e6372656d656e74002c0969735f706175736564002e076d696772617465002f0570617573650032107363686564756c655f7570677261646500340e7472616e736665725f61646d696e003607756e70617573650037077570677261646500380776657273696f6e0039015f03010a5f5f646174615f656e6403020b5f5f686561705f6261736503030ae81a2b5802017e027f024002400240109180808000220142011092808080000d00410021020c010b20014201108080808000220142ff01834204520d012001422088a72103410121020b20002003360204200020023602000f0b000b6002017f017e23808080800041106b22002480808080002000418080c0800041071095808080000240024020002802000d002000200029030810968080800020002802004101470d010b000b20002903082101200041106a24808080800020010b0f0020002001108c808080004201510b1a001091808080002000ad42208642048442011081808080001a0b23001091808080004201428480808080a0fa03428480808080c0970d1082808080001a0b5102017f017e23808080800041106b220324808080800020032001200210ba8080800042012104024020032802000d0020002003290308370308420021040b20002004370300200341106a2480808080000b4401017f23808080800041106b220224808080800020022001370308200241086a410110b58080800021012000420037030020002001370308200241106a2480808080000b54000240200042ff018342cd00510d00000b20001083808080001a200010988080800041011099808080004100109380808000109480808000428480808080a0fa03428480808080c0970d1084808080001a42020b15004100109e80808000200042021081808080001a0b1c004101109e808080002000ad42208642048442021081808080001a0b0800109b808080000b4101017e024002404100109e8080800022004202109280808000450d0020004202108080808000220042ff018342cd00510d01000b410d10a480808000000b20000b4201017f109d808080004103109e80808000109f8080800010a0808080002100428ee2e8999ae0d6f50010a1808080002000ad4220864204841085808080001a42020b0f00109b808080001083808080001a0bec0102017f017e23808080800041106b22012480808080000240024002400240024002400240200041ff01710e0400010203000b2001419b80c08000410510958080800020012802000d04200120012903081096808080000c030b200141a080c08000410710958080800020012802000d03200120012903081096808080000c020b200141a780c08000410610958080800020012802000d02200120012903081096808080000c010b200141ad80c08000410e10958080800020012802000d01200120012903081096808080000b200129030821022001290300500d010b000b200141106a24808080800020020b0d0020004202108d808080001a0b4602017f017e41012100024002404101109e8080800022014202109280808000450d0020014202108080808000220142ff01834204520d012001422088a721000b20000f0b000b6303017f017e017f23808080800041106b2201248080808000200120003703004202210241012103024003402003450d012003417f6a2103200021020c000b0b20012002370308200141086a410110b5808080002100200141106a24808080800020000b870305017f017e017f017e017f23808080800041306b2200248080808000109d80808000024002404103109e8080800022014202109280808000450d00024020014202108080808000220142ff018342cb00520d00410021020240034020024110460d01200041206a20026a4202370300200241086a21020c000b0b2001200041206aad4220864204844284808080201086808080001a200041086a200029032010a38080800020002802080d002000290328220342ff01834204510d020b000b411210a480808000000b2000290310210110a5808080002102024002402003422088a7220441fff87e4b0d0020022004418087016a490d014103109e80808000109f8080800010a080808000210210a680808000210420011087808080001a10888080800021032000200436021c200020023602182000200137031020002003370308418780c08000410810a78080800010a180808000200041086a10a8808080001085808080001a200041306a24808080800042020f0b10a980808000000b10aa80808000000b4201017e420121020240200142ff018342c800520d002001108b808080004280808080708342808080808004520d0020002001370308420021020b200020023703000b090010aa80808000000b0c00108a80808000422088a70b2b01017f024010a0808080002200417f460d00200041016a220010998080800020000f0b10a980808000000b4502017f017e23808080800041106b220224808080800020022000200110ba80808000024020022802004101470d00000b20022903082103200241106a24808080800020030b6c02017f017e23808080800041206b22012480808080002001200029030837031020012000290300370300200120003502104220864204843703182001200035021442208642048437030841a081c0800041042001410410b1808080002102200141206a24808080800020020b090010aa80808000000b0300000b4b02027f017e23808080800041106b2200248080808000200041086a10908080800020002802082101200035020c2102200041106a2480808080002002422086420484420420014101711b0b960101027f23808080800041106b2201248080808000024002400240200042ff018342cd00520d0010ad808080000d0120001083808080001a200141086a109080808000200128020c410020012802084101711b2202417f460d02200241016a2202109380808000109480808000200141106a2480808080002002ad4220864204840f0b000b10aa80808000000b411010a480808000000b4702017f017e4100210002404102109e8080800022014202109280808000450d00410121000240024020014202108080808000a741ff01710e020102000b000b410021000b20000b090010ad80808000ad0bc40102037f027e23808080800041206b22012480808080000240200042ff01834204510d00000b109d808080002000422088a7220210b080808000109d8080800010a0808080002103200210b0808080002002109980808000108880808000210441b482c08000410810a78080800010a1808080002105200120004284808080708337031820012003ad42208642048437031020012004370308200541e480c080004103200141086a410310b1808080001085808080001a200141206a24808080800042020b17000240200010a0808080004b0d0010aa80808000000b0b2e00024020012003460d00000b2000ad4220864204842002ad4220864204842001ad422086420484108f808080000b3a01017f109d80808000410110b38080800010a0808080002100428ed2aadceeac0310a1808080002000ad4220864204841085808080001a42020b1a004102109e808080002000ad42ff018342021081808080001a0bfc0102027f037e23808080800041206b22012480808080002001200010a3808080000240024020012802004101460d0020012903082100109d8080800010a58080800021024103109e8080800021032001200037030020012002ad422086420484220437030820032001410210b58080800042021081808080001a108880808000210320024180f97e4f0d0141a482c08000411010a78080800010a180808000210520012004370318200120003703102001200337030820012002418087016aad4220864204843703002005418482c0800041042001410410b1808080001085808080001a200141206a24808080800042020f0b000b10a980808000000b1a002000ad4220864204842001ad422086420484108e808080000b9b0102017f037e23808080800041206b22012480808080000240200042ff018342cd00510d00000b109d80808000109b80808000210220001098808080001088808080002103418f80c08000410c10a78080800010a1808080002104200120023703182001200037031020012003370308200441d481c080004103200141086a410310b1808080001085808080001a200141206a24808080800042020b3c01017f109d80808000410010b38080800010a0808080002100428ed2aadceeaccff50010a1808080002000ad4220864204841085808080001a42020baf0102037f017e23808080800041206b2201248080808000200141086a200010a380808000024020012802084101470d00000b20012903102100109d8080800010a080808000210210a680808000210320001087808080001a10888080800021042001200336021c200120023602182001200037031020012004370308418780c08000410810a78080800010a180808000200141086a10a8808080001085808080001a200141206a24808080800042020b0f0010a080808000ad4220864204840bdb0102017e047f02400240200241094b0d004200210320022104200121050340024020040d002003420886420e8421030c030b41012106024020052d0000220741df00460d0002400240200741506a41ff0171410a490d00200741bf7f6a41ff0171411a490d012007419f7f6a41ff0171411a4f0d04200741456a21060c020b200741526a21060c010b2007414b6a21060b20034206862006ad42ff01838421032004417f6a2104200541016a21050c000b0b2001ad4220864204842002ad42208642048410898080800021030b20004200370300200020033703080b0bc6020100418080c0000bbc02436f756e746572557067726164656441646d696e4368616e67656441646d696e56657273696f6e50617573656450656e64696e6755706772616465636f6e74726163745f6164647265737366726f6d5f76657273696f6e746f5f76657273696f6e0000003b001000100000004b0010000c000000570010000a0000006e65775f76657273696f6e6e65775f7761736d5f686173686f6c645f76657273696f6e003b001000100000007c0010000b000000870010000d000000940010000b0000006e65775f61646d696e6f6c645f61646d696e00003b00100010000000c000100009000000c900100009000000636f6d6d69745f61747363686564756c65645f6174000000ec001000090000003b00100010000000870010000d000000f50010000c000000557067726164655363686564756c65644d6967726174656400eb170e636f6e747261637473706563763000000002000000000000000000000007446174614b65790000000001000000000000000000000007436f756e746572000000000000000000000000036765740000000000000000010000000400000000000000000000000561646d696e0000000000000000000001000000130000000000000000000000057061757365000000000000000000000000000000000001a24170706c7920706f73742d757067726164652073746174652d7368617065206d6967726174696f6e7320616e642062756d70207468652076657273696f6e20746f0a607461726765745f76657273696f6e602e0a0a232053656375726974790a2d2041646d696e2d6f6e6c792e0a2d2050616e69637320696620607461726765745f76657273696f6e203c3d2063757272656e745f76657273696f6e602028646f776e67726164652067756172640a656e666f7263656420627920607570673a3a726571756972655f76657273696f6e5f696e63726561736560292e0a0a456163682066757475726520736368656d61206368616e67652061646473206120606d61746368207461726765745f76657273696f6e602061726d2077697468207468650a7472616e73666f726d6174696f6e206c6f6769632e20546865207265666572656e636520636f6e747261637420686173206e6f206d6967726174696f6e73207965742c0a736f2074686520626f6479206973206120706173732d7468726f7567682074686174207265636f72647320746865206e65772076657273696f6e2e0000000000076d6967726174650000000001000000000000000e7461726765745f76657273696f6e00000000000400000000000000000000000000000007756e7061757365000000000000000000000000000000022c496d6d6564696174652028666173742d7061746829207570677261646520e28094207265706c616365732074686520636f6e7472616374205741534d20696e206f6e652063616c6c2e0a0a232053656375726974790a2d2041646d696e2d6f6e6c793a2060726571756972655f6175746828296020697320656e666f7263656420696e7369646520607570673a3a75706772616465602e0a2d20546865206e6577205741534d206d75737420616c72656164792062652075706c6f61646564207669610a60656e762e6465706c6f79657228292e75706c6f61645f636f6e74726163745f7761736d282e2e2e29602e0a2d205468697320656e74727920706f696e7420736b697073207468652032342d686f75722074696d656c6f636b20746861742067617465730a607363686564756c655f7570677261646560202f2060636f6d6d69745f75706772616465602e204f70657261746f72732073686f756c6420726573657276652069740a666f7220656d657267656e6369657320286c697665206578706c6f697420726573706f6e73652920616e6420707265666572207468652074696d656c6f636b65640a7061746820666f7220726f7574696e652075706772616465732e0a2d20496e6372656d656e747320746865206f6e2d636861696e2076657273696f6e20636f756e74657220616e6420656d69747320616e20605570677261646564600a6576656e7420666f72206f66662d636861696e20617564697420747261696c732e00000007757067726164650000000001000000000000000d6e65775f7761736d5f68617368000000000003ee000000200000000000000000000000000000000776657273696f6e00000000000000000100000004000000000000008c496e6372656d656e742074686520636f756e7465722e2044656d6f6e7374726174657320746865207374616e6461726420706175736520677561726420706c6163656d656e743a0a60726571756972655f6e6f745f706175736564602072756e73206265666f726520616e792061757468656e7469636174696f6e206f72207374617465206368616e67652e00000009696e6372656d656e7400000000000001000000000000000663616c6c6572000000000013000000010000000400000000000000000000000969735f706175736564000000000000000000000100000001000000000000008c496e697469616c6973652074686520636f6e7472616374207769746820616e2061646d696e2e204d6972726f72732074686520776972696e6720757365642062792065766572790a70726f64756374696f6e20636f6e74726163743a2073746f72652061646d696e2c20736565642076657273696f6e20312c2073657420696e697469616c2073746174652e0000000d5f5f636f6e7374727563746f7200000000000001000000000000000561646d696e000000000000130000000000000000000000000000000e63616e63656c5f757067726164650000000000000000000000000000000000000000000e636f6d6d69745f757067726164650000000000000000000000000000000000000000000e7472616e736665725f61646d696e00000000000100000000000000096e65775f61646d696e00000000000013000000000000000000000000000000107363686564756c655f7570677261646500000001000000000000000d6e65775f7761736d5f68617368000000000003ee00000020000000000000000200000000000000000000000a557067726164654b65790000000000040000000000000016436f6e74726163742061646d696e6973747261746f7200000000000541646d696e000000000000000000003843757272656e7420636f6e74726163742076657273696f6e20287533322c206d6f6e6f746f6e6963616c6c7920696e6372656173696e67290000000756657273696f6e00000000000000001e576865746865722074686520636f6e7472616374206973207061757365640000000000065061757365640000000000000000003550656e64696e6720757067726164653a20286e65775f7761736d5f686173682c207363686564756c65645f61745f6c6564676572290000000000000e50656e64696e675570677261646500000000000100000131456d6974746564207768656e205b606d6967726174696f6e5f636f6d706c65746564605d2072756e73207375636365737366756c6c7920616761696e7374206120636f6e74726163742e0a0a4d6967726174696f6e73206172652073746174652d7368617065207472616e73666f726d6174696f6e73206170706c69656420414654455220746865205741534d20737761702e0a4f66662d636861696e20696e6465786572732073686f756c642074726561742074686973206576656e74206173202274686520636f6e74726163742061742076657273696f6e0a6066726f6d5f76657273696f6e6020686173206265656e206d6967726174656420746f2060746f5f76657273696f6e6020616e6420746865206e657720736368656d612069730a6e6f7720696e20656666656374222e000000000000000000000d4d696772617465644576656e74000000000000030000000000000010636f6e74726163745f6164647265737300000013000000000000000c66726f6d5f76657273696f6e00000004000000000000000a746f5f76657273696f6e0000000000040000000100000000000000000000000d55706772616465644576656e74000000000000040000000000000010636f6e74726163745f6164647265737300000013000000000000000b6e65775f76657273696f6e0000000004000000000000000d6e65775f7761736d5f68617368000000000003ee00000020000000000000000b6f6c645f76657273696f6e00000000040000000100000000000000000000001141646d696e4368616e6765644576656e74000000000000030000000000000010636f6e74726163745f616464726573730000001300000000000000096e65775f61646d696e0000000000001300000000000000096f6c645f61646d696e0000000000001300000001000000000000000000000015557067726164655363686564756c65644576656e74000000000000040000000000000009636f6d6d69745f6174000000000000040000000000000010636f6e74726163745f6164647265737300000013000000000000000d6e65775f7761736d5f68617368000000000003ee00000020000000000000000c7363686564756c65645f617400000004001e11636f6e7472616374656e766d6574617630000000000000001900000000006f0e636f6e74726163746d65746176300000000000000005727376657200000000000006312e39342e3100000000000000000008727373646b7665720000002f32352e332e31236535306439356166303239633833313936646431323266303135346261633366313330323339346200" + } + }, + "ext": "v0" + }, + "live_until": 5095 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + "live_until": 1729000 + } + ] + }, + "events": [] +} \ No newline at end of file diff --git a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_state_preserved_after_upgrade.1.json b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_state_preserved_after_upgrade.1.json new file mode 100644 index 00000000..3c93efaa --- /dev/null +++ b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_state_preserved_after_upgrade.1.json @@ -0,0 +1,337 @@ +{ + "generators": { + "address": 3, + "nonce": 0, + "mux_id": 0 + }, + "auth": [ + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "__constructor", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "increment", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "increment", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "increment", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "upgrade", + "args": [ + { + "bytes": "500102ea154c5be1954457d777dfeff4b8bf98902c8d98019ab92d4981ec770a" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [] + ], + "ledger": { + "protocol_version": 25, + "sequence_number": 1000, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "801925984706572462" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "2032731177588607455" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Counter" + } + ] + }, + "durability": "persistent", + "val": { + "u32": 3 + } + } + }, + "ext": "v0" + }, + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "500102ea154c5be1954457d777dfeff4b8bf98902c8d98019ab92d4981ec770a" + }, + "storage": [ + { + "key": { + "vec": [ + { + "symbol": "Admin" + } + ] + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + }, + { + "key": { + "vec": [ + { + "symbol": "Version" + } + ] + }, + "val": { + "u32": 2 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": "1033654523790656264" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": "4837995959683129791" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": "5541220902715666415" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": { + "v1": { + "ext": "v0", + "cost_inputs": { + "ext": "v0", + "n_instructions": 1295, + "n_functions": 43, + "n_globals": 4, + "n_table_entries": 0, + "n_types": 15, + "n_data_segments": 1, + "n_elem_segments": 0, + "n_imports": 16, + "n_exports": 18, + "n_data_segment_bytes": 316 + } + } + }, + "hash": "500102ea154c5be1954457d777dfeff4b8bf98902c8d98019ab92d4981ec770a", + "code": "0061736d0100000001520f60027e7e017e60037e7e7e017e60047e7e7e7e017e60017e017e6000017e60017f0060027e7e017f60000060037f7f7f0060027f7e0060017e0060017f017e6000017f60027f7f017e60047f7f7f7f017e026110016c01310000016c015f0001016c01370002016101300003016c01380000017801310000017601680001016c013600030178013700040162016a0000017801330004016201380003016c01300000016c01320000017601670000016d01390001032c2b05040605070809030a05040404070b0a0c030409050c0c0d0b070704030c0403050e0405030d030403040805030100110621047f01418080c0000b7f00418780c0000b7f0041bc82c0000b7f0041c082c0000b07d50112066d656d6f727902000d5f5f636f6e7374727563746f7200170561646d696e001a0e63616e63656c5f75706772616465001c0e636f6d6d69745f75706772616465002203676574002b09696e6372656d656e74002c0969735f706175736564002e076d696772617465002f0570617573650032107363686564756c655f7570677261646500340e7472616e736665725f61646d696e003607756e70617573650037077570677261646500380776657273696f6e0039015f03010a5f5f646174615f656e6403020b5f5f686561705f6261736503030ae81a2b5802017e027f024002400240109180808000220142011092808080000d00410021020c010b20014201108080808000220142ff01834204520d012001422088a72103410121020b20002003360204200020023602000f0b000b6002017f017e23808080800041106b22002480808080002000418080c0800041071095808080000240024020002802000d002000200029030810968080800020002802004101470d010b000b20002903082101200041106a24808080800020010b0f0020002001108c808080004201510b1a001091808080002000ad42208642048442011081808080001a0b23001091808080004201428480808080a0fa03428480808080c0970d1082808080001a0b5102017f017e23808080800041106b220324808080800020032001200210ba8080800042012104024020032802000d0020002003290308370308420021040b20002004370300200341106a2480808080000b4401017f23808080800041106b220224808080800020022001370308200241086a410110b58080800021012000420037030020002001370308200241106a2480808080000b54000240200042ff018342cd00510d00000b20001083808080001a200010988080800041011099808080004100109380808000109480808000428480808080a0fa03428480808080c0970d1084808080001a42020b15004100109e80808000200042021081808080001a0b1c004101109e808080002000ad42208642048442021081808080001a0b0800109b808080000b4101017e024002404100109e8080800022004202109280808000450d0020004202108080808000220042ff018342cd00510d01000b410d10a480808000000b20000b4201017f109d808080004103109e80808000109f8080800010a0808080002100428ee2e8999ae0d6f50010a1808080002000ad4220864204841085808080001a42020b0f00109b808080001083808080001a0bec0102017f017e23808080800041106b22012480808080000240024002400240024002400240200041ff01710e0400010203000b2001419b80c08000410510958080800020012802000d04200120012903081096808080000c030b200141a080c08000410710958080800020012802000d03200120012903081096808080000c020b200141a780c08000410610958080800020012802000d02200120012903081096808080000c010b200141ad80c08000410e10958080800020012802000d01200120012903081096808080000b200129030821022001290300500d010b000b200141106a24808080800020020b0d0020004202108d808080001a0b4602017f017e41012100024002404101109e8080800022014202109280808000450d0020014202108080808000220142ff01834204520d012001422088a721000b20000f0b000b6303017f017e017f23808080800041106b2201248080808000200120003703004202210241012103024003402003450d012003417f6a2103200021020c000b0b20012002370308200141086a410110b5808080002100200141106a24808080800020000b870305017f017e017f017e017f23808080800041306b2200248080808000109d80808000024002404103109e8080800022014202109280808000450d00024020014202108080808000220142ff018342cb00520d00410021020240034020024110460d01200041206a20026a4202370300200241086a21020c000b0b2001200041206aad4220864204844284808080201086808080001a200041086a200029032010a38080800020002802080d002000290328220342ff01834204510d020b000b411210a480808000000b2000290310210110a5808080002102024002402003422088a7220441fff87e4b0d0020022004418087016a490d014103109e80808000109f8080800010a080808000210210a680808000210420011087808080001a10888080800021032000200436021c200020023602182000200137031020002003370308418780c08000410810a78080800010a180808000200041086a10a8808080001085808080001a200041306a24808080800042020f0b10a980808000000b10aa80808000000b4201017e420121020240200142ff018342c800520d002001108b808080004280808080708342808080808004520d0020002001370308420021020b200020023703000b090010aa80808000000b0c00108a80808000422088a70b2b01017f024010a0808080002200417f460d00200041016a220010998080800020000f0b10a980808000000b4502017f017e23808080800041106b220224808080800020022000200110ba80808000024020022802004101470d00000b20022903082103200241106a24808080800020030b6c02017f017e23808080800041206b22012480808080002001200029030837031020012000290300370300200120003502104220864204843703182001200035021442208642048437030841a081c0800041042001410410b1808080002102200141206a24808080800020020b090010aa80808000000b0300000b4b02027f017e23808080800041106b2200248080808000200041086a10908080800020002802082101200035020c2102200041106a2480808080002002422086420484420420014101711b0b960101027f23808080800041106b2201248080808000024002400240200042ff018342cd00520d0010ad808080000d0120001083808080001a200141086a109080808000200128020c410020012802084101711b2202417f460d02200241016a2202109380808000109480808000200141106a2480808080002002ad4220864204840f0b000b10aa80808000000b411010a480808000000b4702017f017e4100210002404102109e8080800022014202109280808000450d00410121000240024020014202108080808000a741ff01710e020102000b000b410021000b20000b090010ad80808000ad0bc40102037f027e23808080800041206b22012480808080000240200042ff01834204510d00000b109d808080002000422088a7220210b080808000109d8080800010a0808080002103200210b0808080002002109980808000108880808000210441b482c08000410810a78080800010a1808080002105200120004284808080708337031820012003ad42208642048437031020012004370308200541e480c080004103200141086a410310b1808080001085808080001a200141206a24808080800042020b17000240200010a0808080004b0d0010aa80808000000b0b2e00024020012003460d00000b2000ad4220864204842002ad4220864204842001ad422086420484108f808080000b3a01017f109d80808000410110b38080800010a0808080002100428ed2aadceeac0310a1808080002000ad4220864204841085808080001a42020b1a004102109e808080002000ad42ff018342021081808080001a0bfc0102027f037e23808080800041206b22012480808080002001200010a3808080000240024020012802004101460d0020012903082100109d8080800010a58080800021024103109e8080800021032001200037030020012002ad422086420484220437030820032001410210b58080800042021081808080001a108880808000210320024180f97e4f0d0141a482c08000411010a78080800010a180808000210520012004370318200120003703102001200337030820012002418087016aad4220864204843703002005418482c0800041042001410410b1808080001085808080001a200141206a24808080800042020f0b000b10a980808000000b1a002000ad4220864204842001ad422086420484108e808080000b9b0102017f037e23808080800041206b22012480808080000240200042ff018342cd00510d00000b109d80808000109b80808000210220001098808080001088808080002103418f80c08000410c10a78080800010a1808080002104200120023703182001200037031020012003370308200441d481c080004103200141086a410310b1808080001085808080001a200141206a24808080800042020b3c01017f109d80808000410010b38080800010a0808080002100428ed2aadceeaccff50010a1808080002000ad4220864204841085808080001a42020baf0102037f017e23808080800041206b2201248080808000200141086a200010a380808000024020012802084101470d00000b20012903102100109d8080800010a080808000210210a680808000210320001087808080001a10888080800021042001200336021c200120023602182001200037031020012004370308418780c08000410810a78080800010a180808000200141086a10a8808080001085808080001a200141206a24808080800042020b0f0010a080808000ad4220864204840bdb0102017e047f02400240200241094b0d004200210320022104200121050340024020040d002003420886420e8421030c030b41012106024020052d0000220741df00460d0002400240200741506a41ff0171410a490d00200741bf7f6a41ff0171411a490d012007419f7f6a41ff0171411a4f0d04200741456a21060c020b200741526a21060c010b2007414b6a21060b20034206862006ad42ff01838421032004417f6a2104200541016a21050c000b0b2001ad4220864204842002ad42208642048410898080800021030b20004200370300200020033703080b0bc6020100418080c0000bbc02436f756e746572557067726164656441646d696e4368616e67656441646d696e56657273696f6e50617573656450656e64696e6755706772616465636f6e74726163745f6164647265737366726f6d5f76657273696f6e746f5f76657273696f6e0000003b001000100000004b0010000c000000570010000a0000006e65775f76657273696f6e6e65775f7761736d5f686173686f6c645f76657273696f6e003b001000100000007c0010000b000000870010000d000000940010000b0000006e65775f61646d696e6f6c645f61646d696e00003b00100010000000c000100009000000c900100009000000636f6d6d69745f61747363686564756c65645f6174000000ec001000090000003b00100010000000870010000d000000f50010000c000000557067726164655363686564756c65644d6967726174656400eb170e636f6e747261637473706563763000000002000000000000000000000007446174614b65790000000001000000000000000000000007436f756e746572000000000000000000000000036765740000000000000000010000000400000000000000000000000561646d696e0000000000000000000001000000130000000000000000000000057061757365000000000000000000000000000000000001a24170706c7920706f73742d757067726164652073746174652d7368617065206d6967726174696f6e7320616e642062756d70207468652076657273696f6e20746f0a607461726765745f76657273696f6e602e0a0a232053656375726974790a2d2041646d696e2d6f6e6c792e0a2d2050616e69637320696620607461726765745f76657273696f6e203c3d2063757272656e745f76657273696f6e602028646f776e67726164652067756172640a656e666f7263656420627920607570673a3a726571756972655f76657273696f6e5f696e63726561736560292e0a0a456163682066757475726520736368656d61206368616e67652061646473206120606d61746368207461726765745f76657273696f6e602061726d2077697468207468650a7472616e73666f726d6174696f6e206c6f6769632e20546865207265666572656e636520636f6e747261637420686173206e6f206d6967726174696f6e73207965742c0a736f2074686520626f6479206973206120706173732d7468726f7567682074686174207265636f72647320746865206e65772076657273696f6e2e0000000000076d6967726174650000000001000000000000000e7461726765745f76657273696f6e00000000000400000000000000000000000000000007756e7061757365000000000000000000000000000000022c496d6d6564696174652028666173742d7061746829207570677261646520e28094207265706c616365732074686520636f6e7472616374205741534d20696e206f6e652063616c6c2e0a0a232053656375726974790a2d2041646d696e2d6f6e6c793a2060726571756972655f6175746828296020697320656e666f7263656420696e7369646520607570673a3a75706772616465602e0a2d20546865206e6577205741534d206d75737420616c72656164792062652075706c6f61646564207669610a60656e762e6465706c6f79657228292e75706c6f61645f636f6e74726163745f7761736d282e2e2e29602e0a2d205468697320656e74727920706f696e7420736b697073207468652032342d686f75722074696d656c6f636b20746861742067617465730a607363686564756c655f7570677261646560202f2060636f6d6d69745f75706772616465602e204f70657261746f72732073686f756c6420726573657276652069740a666f7220656d657267656e6369657320286c697665206578706c6f697420726573706f6e73652920616e6420707265666572207468652074696d656c6f636b65640a7061746820666f7220726f7574696e652075706772616465732e0a2d20496e6372656d656e747320746865206f6e2d636861696e2076657273696f6e20636f756e74657220616e6420656d69747320616e20605570677261646564600a6576656e7420666f72206f66662d636861696e20617564697420747261696c732e00000007757067726164650000000001000000000000000d6e65775f7761736d5f68617368000000000003ee000000200000000000000000000000000000000776657273696f6e00000000000000000100000004000000000000008c496e6372656d656e742074686520636f756e7465722e2044656d6f6e7374726174657320746865207374616e6461726420706175736520677561726420706c6163656d656e743a0a60726571756972655f6e6f745f706175736564602072756e73206265666f726520616e792061757468656e7469636174696f6e206f72207374617465206368616e67652e00000009696e6372656d656e7400000000000001000000000000000663616c6c6572000000000013000000010000000400000000000000000000000969735f706175736564000000000000000000000100000001000000000000008c496e697469616c6973652074686520636f6e7472616374207769746820616e2061646d696e2e204d6972726f72732074686520776972696e6720757365642062792065766572790a70726f64756374696f6e20636f6e74726163743a2073746f72652061646d696e2c20736565642076657273696f6e20312c2073657420696e697469616c2073746174652e0000000d5f5f636f6e7374727563746f7200000000000001000000000000000561646d696e000000000000130000000000000000000000000000000e63616e63656c5f757067726164650000000000000000000000000000000000000000000e636f6d6d69745f757067726164650000000000000000000000000000000000000000000e7472616e736665725f61646d696e00000000000100000000000000096e65775f61646d696e00000000000013000000000000000000000000000000107363686564756c655f7570677261646500000001000000000000000d6e65775f7761736d5f68617368000000000003ee00000020000000000000000200000000000000000000000a557067726164654b65790000000000040000000000000016436f6e74726163742061646d696e6973747261746f7200000000000541646d696e000000000000000000003843757272656e7420636f6e74726163742076657273696f6e20287533322c206d6f6e6f746f6e6963616c6c7920696e6372656173696e67290000000756657273696f6e00000000000000001e576865746865722074686520636f6e7472616374206973207061757365640000000000065061757365640000000000000000003550656e64696e6720757067726164653a20286e65775f7761736d5f686173682c207363686564756c65645f61745f6c6564676572290000000000000e50656e64696e675570677261646500000000000100000131456d6974746564207768656e205b606d6967726174696f6e5f636f6d706c65746564605d2072756e73207375636365737366756c6c7920616761696e7374206120636f6e74726163742e0a0a4d6967726174696f6e73206172652073746174652d7368617065207472616e73666f726d6174696f6e73206170706c69656420414654455220746865205741534d20737761702e0a4f66662d636861696e20696e6465786572732073686f756c642074726561742074686973206576656e74206173202274686520636f6e74726163742061742076657273696f6e0a6066726f6d5f76657273696f6e6020686173206265656e206d6967726174656420746f2060746f5f76657273696f6e6020616e6420746865206e657720736368656d612069730a6e6f7720696e20656666656374222e000000000000000000000d4d696772617465644576656e74000000000000030000000000000010636f6e74726163745f6164647265737300000013000000000000000c66726f6d5f76657273696f6e00000004000000000000000a746f5f76657273696f6e0000000000040000000100000000000000000000000d55706772616465644576656e74000000000000040000000000000010636f6e74726163745f6164647265737300000013000000000000000b6e65775f76657273696f6e0000000004000000000000000d6e65775f7761736d5f68617368000000000003ee00000020000000000000000b6f6c645f76657273696f6e00000000040000000100000000000000000000001141646d696e4368616e6765644576656e74000000000000030000000000000010636f6e74726163745f616464726573730000001300000000000000096e65775f61646d696e0000000000001300000000000000096f6c645f61646d696e0000000000001300000001000000000000000000000015557067726164655363686564756c65644576656e74000000000000040000000000000009636f6d6d69745f6174000000000000040000000000000010636f6e74726163745f6164647265737300000013000000000000000d6e65775f7761736d5f68617368000000000003ee00000020000000000000000c7363686564756c65645f617400000004001e11636f6e7472616374656e766d6574617630000000000000001900000000006f0e636f6e74726163746d65746176300000000000000005727376657200000000000006312e39342e3100000000000000000008727373646b7665720000002f32352e332e31236535306439356166303239633833313936646431323266303135346261633366313330323339346200" + } + }, + "ext": "v0" + }, + "live_until": 5095 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + "live_until": 1729000 + } + ] + }, + "events": [] +} \ No newline at end of file diff --git a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_upgrade_authorized.1.json b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_upgrade_authorized.1.json new file mode 100644 index 00000000..7ec343e8 --- /dev/null +++ b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_upgrade_authorized.1.json @@ -0,0 +1,219 @@ +{ + "generators": { + "address": 2, + "nonce": 0, + "mux_id": 0 + }, + "auth": [ + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "__constructor", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "upgrade", + "args": [ + { + "bytes": "500102ea154c5be1954457d777dfeff4b8bf98902c8d98019ab92d4981ec770a" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [] + ], + "ledger": { + "protocol_version": 25, + "sequence_number": 1000, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "801925984706572462" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "5541220902715666415" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Counter" + } + ] + }, + "durability": "persistent", + "val": { + "u32": 0 + } + } + }, + "ext": "v0" + }, + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "500102ea154c5be1954457d777dfeff4b8bf98902c8d98019ab92d4981ec770a" + }, + "storage": [ + { + "key": { + "vec": [ + { + "symbol": "Admin" + } + ] + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + }, + { + "key": { + "vec": [ + { + "symbol": "Version" + } + ] + }, + "val": { + "u32": 2 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": { + "v1": { + "ext": "v0", + "cost_inputs": { + "ext": "v0", + "n_instructions": 1295, + "n_functions": 43, + "n_globals": 4, + "n_table_entries": 0, + "n_types": 15, + "n_data_segments": 1, + "n_elem_segments": 0, + "n_imports": 16, + "n_exports": 18, + "n_data_segment_bytes": 316 + } + } + }, + "hash": "500102ea154c5be1954457d777dfeff4b8bf98902c8d98019ab92d4981ec770a", + "code": "0061736d0100000001520f60027e7e017e60037e7e7e017e60047e7e7e7e017e60017e017e6000017e60017f0060027e7e017f60000060037f7f7f0060027f7e0060017e0060017f017e6000017f60027f7f017e60047f7f7f7f017e026110016c01310000016c015f0001016c01370002016101300003016c01380000017801310000017601680001016c013600030178013700040162016a0000017801330004016201380003016c01300000016c01320000017601670000016d01390001032c2b05040605070809030a05040404070b0a0c030409050c0c0d0b070704030c0403050e0405030d030403040805030100110621047f01418080c0000b7f00418780c0000b7f0041bc82c0000b7f0041c082c0000b07d50112066d656d6f727902000d5f5f636f6e7374727563746f7200170561646d696e001a0e63616e63656c5f75706772616465001c0e636f6d6d69745f75706772616465002203676574002b09696e6372656d656e74002c0969735f706175736564002e076d696772617465002f0570617573650032107363686564756c655f7570677261646500340e7472616e736665725f61646d696e003607756e70617573650037077570677261646500380776657273696f6e0039015f03010a5f5f646174615f656e6403020b5f5f686561705f6261736503030ae81a2b5802017e027f024002400240109180808000220142011092808080000d00410021020c010b20014201108080808000220142ff01834204520d012001422088a72103410121020b20002003360204200020023602000f0b000b6002017f017e23808080800041106b22002480808080002000418080c0800041071095808080000240024020002802000d002000200029030810968080800020002802004101470d010b000b20002903082101200041106a24808080800020010b0f0020002001108c808080004201510b1a001091808080002000ad42208642048442011081808080001a0b23001091808080004201428480808080a0fa03428480808080c0970d1082808080001a0b5102017f017e23808080800041106b220324808080800020032001200210ba8080800042012104024020032802000d0020002003290308370308420021040b20002004370300200341106a2480808080000b4401017f23808080800041106b220224808080800020022001370308200241086a410110b58080800021012000420037030020002001370308200241106a2480808080000b54000240200042ff018342cd00510d00000b20001083808080001a200010988080800041011099808080004100109380808000109480808000428480808080a0fa03428480808080c0970d1084808080001a42020b15004100109e80808000200042021081808080001a0b1c004101109e808080002000ad42208642048442021081808080001a0b0800109b808080000b4101017e024002404100109e8080800022004202109280808000450d0020004202108080808000220042ff018342cd00510d01000b410d10a480808000000b20000b4201017f109d808080004103109e80808000109f8080800010a0808080002100428ee2e8999ae0d6f50010a1808080002000ad4220864204841085808080001a42020b0f00109b808080001083808080001a0bec0102017f017e23808080800041106b22012480808080000240024002400240024002400240200041ff01710e0400010203000b2001419b80c08000410510958080800020012802000d04200120012903081096808080000c030b200141a080c08000410710958080800020012802000d03200120012903081096808080000c020b200141a780c08000410610958080800020012802000d02200120012903081096808080000c010b200141ad80c08000410e10958080800020012802000d01200120012903081096808080000b200129030821022001290300500d010b000b200141106a24808080800020020b0d0020004202108d808080001a0b4602017f017e41012100024002404101109e8080800022014202109280808000450d0020014202108080808000220142ff01834204520d012001422088a721000b20000f0b000b6303017f017e017f23808080800041106b2201248080808000200120003703004202210241012103024003402003450d012003417f6a2103200021020c000b0b20012002370308200141086a410110b5808080002100200141106a24808080800020000b870305017f017e017f017e017f23808080800041306b2200248080808000109d80808000024002404103109e8080800022014202109280808000450d00024020014202108080808000220142ff018342cb00520d00410021020240034020024110460d01200041206a20026a4202370300200241086a21020c000b0b2001200041206aad4220864204844284808080201086808080001a200041086a200029032010a38080800020002802080d002000290328220342ff01834204510d020b000b411210a480808000000b2000290310210110a5808080002102024002402003422088a7220441fff87e4b0d0020022004418087016a490d014103109e80808000109f8080800010a080808000210210a680808000210420011087808080001a10888080800021032000200436021c200020023602182000200137031020002003370308418780c08000410810a78080800010a180808000200041086a10a8808080001085808080001a200041306a24808080800042020f0b10a980808000000b10aa80808000000b4201017e420121020240200142ff018342c800520d002001108b808080004280808080708342808080808004520d0020002001370308420021020b200020023703000b090010aa80808000000b0c00108a80808000422088a70b2b01017f024010a0808080002200417f460d00200041016a220010998080800020000f0b10a980808000000b4502017f017e23808080800041106b220224808080800020022000200110ba80808000024020022802004101470d00000b20022903082103200241106a24808080800020030b6c02017f017e23808080800041206b22012480808080002001200029030837031020012000290300370300200120003502104220864204843703182001200035021442208642048437030841a081c0800041042001410410b1808080002102200141206a24808080800020020b090010aa80808000000b0300000b4b02027f017e23808080800041106b2200248080808000200041086a10908080800020002802082101200035020c2102200041106a2480808080002002422086420484420420014101711b0b960101027f23808080800041106b2201248080808000024002400240200042ff018342cd00520d0010ad808080000d0120001083808080001a200141086a109080808000200128020c410020012802084101711b2202417f460d02200241016a2202109380808000109480808000200141106a2480808080002002ad4220864204840f0b000b10aa80808000000b411010a480808000000b4702017f017e4100210002404102109e8080800022014202109280808000450d00410121000240024020014202108080808000a741ff01710e020102000b000b410021000b20000b090010ad80808000ad0bc40102037f027e23808080800041206b22012480808080000240200042ff01834204510d00000b109d808080002000422088a7220210b080808000109d8080800010a0808080002103200210b0808080002002109980808000108880808000210441b482c08000410810a78080800010a1808080002105200120004284808080708337031820012003ad42208642048437031020012004370308200541e480c080004103200141086a410310b1808080001085808080001a200141206a24808080800042020b17000240200010a0808080004b0d0010aa80808000000b0b2e00024020012003460d00000b2000ad4220864204842002ad4220864204842001ad422086420484108f808080000b3a01017f109d80808000410110b38080800010a0808080002100428ed2aadceeac0310a1808080002000ad4220864204841085808080001a42020b1a004102109e808080002000ad42ff018342021081808080001a0bfc0102027f037e23808080800041206b22012480808080002001200010a3808080000240024020012802004101460d0020012903082100109d8080800010a58080800021024103109e8080800021032001200037030020012002ad422086420484220437030820032001410210b58080800042021081808080001a108880808000210320024180f97e4f0d0141a482c08000411010a78080800010a180808000210520012004370318200120003703102001200337030820012002418087016aad4220864204843703002005418482c0800041042001410410b1808080001085808080001a200141206a24808080800042020f0b000b10a980808000000b1a002000ad4220864204842001ad422086420484108e808080000b9b0102017f037e23808080800041206b22012480808080000240200042ff018342cd00510d00000b109d80808000109b80808000210220001098808080001088808080002103418f80c08000410c10a78080800010a1808080002104200120023703182001200037031020012003370308200441d481c080004103200141086a410310b1808080001085808080001a200141206a24808080800042020b3c01017f109d80808000410010b38080800010a0808080002100428ed2aadceeaccff50010a1808080002000ad4220864204841085808080001a42020baf0102037f017e23808080800041206b2201248080808000200141086a200010a380808000024020012802084101470d00000b20012903102100109d8080800010a080808000210210a680808000210320001087808080001a10888080800021042001200336021c200120023602182001200037031020012004370308418780c08000410810a78080800010a180808000200141086a10a8808080001085808080001a200141206a24808080800042020b0f0010a080808000ad4220864204840bdb0102017e047f02400240200241094b0d004200210320022104200121050340024020040d002003420886420e8421030c030b41012106024020052d0000220741df00460d0002400240200741506a41ff0171410a490d00200741bf7f6a41ff0171411a490d012007419f7f6a41ff0171411a4f0d04200741456a21060c020b200741526a21060c010b2007414b6a21060b20034206862006ad42ff01838421032004417f6a2104200541016a21050c000b0b2001ad4220864204842002ad42208642048410898080800021030b20004200370300200020033703080b0bc6020100418080c0000bbc02436f756e746572557067726164656441646d696e4368616e67656441646d696e56657273696f6e50617573656450656e64696e6755706772616465636f6e74726163745f6164647265737366726f6d5f76657273696f6e746f5f76657273696f6e0000003b001000100000004b0010000c000000570010000a0000006e65775f76657273696f6e6e65775f7761736d5f686173686f6c645f76657273696f6e003b001000100000007c0010000b000000870010000d000000940010000b0000006e65775f61646d696e6f6c645f61646d696e00003b00100010000000c000100009000000c900100009000000636f6d6d69745f61747363686564756c65645f6174000000ec001000090000003b00100010000000870010000d000000f50010000c000000557067726164655363686564756c65644d6967726174656400eb170e636f6e747261637473706563763000000002000000000000000000000007446174614b65790000000001000000000000000000000007436f756e746572000000000000000000000000036765740000000000000000010000000400000000000000000000000561646d696e0000000000000000000001000000130000000000000000000000057061757365000000000000000000000000000000000001a24170706c7920706f73742d757067726164652073746174652d7368617065206d6967726174696f6e7320616e642062756d70207468652076657273696f6e20746f0a607461726765745f76657273696f6e602e0a0a232053656375726974790a2d2041646d696e2d6f6e6c792e0a2d2050616e69637320696620607461726765745f76657273696f6e203c3d2063757272656e745f76657273696f6e602028646f776e67726164652067756172640a656e666f7263656420627920607570673a3a726571756972655f76657273696f6e5f696e63726561736560292e0a0a456163682066757475726520736368656d61206368616e67652061646473206120606d61746368207461726765745f76657273696f6e602061726d2077697468207468650a7472616e73666f726d6174696f6e206c6f6769632e20546865207265666572656e636520636f6e747261637420686173206e6f206d6967726174696f6e73207965742c0a736f2074686520626f6479206973206120706173732d7468726f7567682074686174207265636f72647320746865206e65772076657273696f6e2e0000000000076d6967726174650000000001000000000000000e7461726765745f76657273696f6e00000000000400000000000000000000000000000007756e7061757365000000000000000000000000000000022c496d6d6564696174652028666173742d7061746829207570677261646520e28094207265706c616365732074686520636f6e7472616374205741534d20696e206f6e652063616c6c2e0a0a232053656375726974790a2d2041646d696e2d6f6e6c793a2060726571756972655f6175746828296020697320656e666f7263656420696e7369646520607570673a3a75706772616465602e0a2d20546865206e6577205741534d206d75737420616c72656164792062652075706c6f61646564207669610a60656e762e6465706c6f79657228292e75706c6f61645f636f6e74726163745f7761736d282e2e2e29602e0a2d205468697320656e74727920706f696e7420736b697073207468652032342d686f75722074696d656c6f636b20746861742067617465730a607363686564756c655f7570677261646560202f2060636f6d6d69745f75706772616465602e204f70657261746f72732073686f756c6420726573657276652069740a666f7220656d657267656e6369657320286c697665206578706c6f697420726573706f6e73652920616e6420707265666572207468652074696d656c6f636b65640a7061746820666f7220726f7574696e652075706772616465732e0a2d20496e6372656d656e747320746865206f6e2d636861696e2076657273696f6e20636f756e74657220616e6420656d69747320616e20605570677261646564600a6576656e7420666f72206f66662d636861696e20617564697420747261696c732e00000007757067726164650000000001000000000000000d6e65775f7761736d5f68617368000000000003ee000000200000000000000000000000000000000776657273696f6e00000000000000000100000004000000000000008c496e6372656d656e742074686520636f756e7465722e2044656d6f6e7374726174657320746865207374616e6461726420706175736520677561726420706c6163656d656e743a0a60726571756972655f6e6f745f706175736564602072756e73206265666f726520616e792061757468656e7469636174696f6e206f72207374617465206368616e67652e00000009696e6372656d656e7400000000000001000000000000000663616c6c6572000000000013000000010000000400000000000000000000000969735f706175736564000000000000000000000100000001000000000000008c496e697469616c6973652074686520636f6e7472616374207769746820616e2061646d696e2e204d6972726f72732074686520776972696e6720757365642062792065766572790a70726f64756374696f6e20636f6e74726163743a2073746f72652061646d696e2c20736565642076657273696f6e20312c2073657420696e697469616c2073746174652e0000000d5f5f636f6e7374727563746f7200000000000001000000000000000561646d696e000000000000130000000000000000000000000000000e63616e63656c5f757067726164650000000000000000000000000000000000000000000e636f6d6d69745f757067726164650000000000000000000000000000000000000000000e7472616e736665725f61646d696e00000000000100000000000000096e65775f61646d696e00000000000013000000000000000000000000000000107363686564756c655f7570677261646500000001000000000000000d6e65775f7761736d5f68617368000000000003ee00000020000000000000000200000000000000000000000a557067726164654b65790000000000040000000000000016436f6e74726163742061646d696e6973747261746f7200000000000541646d696e000000000000000000003843757272656e7420636f6e74726163742076657273696f6e20287533322c206d6f6e6f746f6e6963616c6c7920696e6372656173696e67290000000756657273696f6e00000000000000001e576865746865722074686520636f6e7472616374206973207061757365640000000000065061757365640000000000000000003550656e64696e6720757067726164653a20286e65775f7761736d5f686173682c207363686564756c65645f61745f6c6564676572290000000000000e50656e64696e675570677261646500000000000100000131456d6974746564207768656e205b606d6967726174696f6e5f636f6d706c65746564605d2072756e73207375636365737366756c6c7920616761696e7374206120636f6e74726163742e0a0a4d6967726174696f6e73206172652073746174652d7368617065207472616e73666f726d6174696f6e73206170706c69656420414654455220746865205741534d20737761702e0a4f66662d636861696e20696e6465786572732073686f756c642074726561742074686973206576656e74206173202274686520636f6e74726163742061742076657273696f6e0a6066726f6d5f76657273696f6e6020686173206265656e206d6967726174656420746f2060746f5f76657273696f6e6020616e6420746865206e657720736368656d612069730a6e6f7720696e20656666656374222e000000000000000000000d4d696772617465644576656e74000000000000030000000000000010636f6e74726163745f6164647265737300000013000000000000000c66726f6d5f76657273696f6e00000004000000000000000a746f5f76657273696f6e0000000000040000000100000000000000000000000d55706772616465644576656e74000000000000040000000000000010636f6e74726163745f6164647265737300000013000000000000000b6e65775f76657273696f6e0000000004000000000000000d6e65775f7761736d5f68617368000000000003ee00000020000000000000000b6f6c645f76657273696f6e00000000040000000100000000000000000000001141646d696e4368616e6765644576656e74000000000000030000000000000010636f6e74726163745f616464726573730000001300000000000000096e65775f61646d696e0000000000001300000000000000096f6c645f61646d696e0000000000001300000001000000000000000000000015557067726164655363686564756c65644576656e74000000000000040000000000000009636f6d6d69745f6174000000000000040000000000000010636f6e74726163745f6164647265737300000013000000000000000d6e65775f7761736d5f68617368000000000003ee00000020000000000000000c7363686564756c65645f617400000004001e11636f6e7472616374656e766d6574617630000000000000001900000000006f0e636f6e74726163746d65746176300000000000000005727376657200000000000006312e39342e3100000000000000000008727373646b7665720000002f32352e332e31236535306439356166303239633833313936646431323266303135346261633366313330323339346200" + } + }, + "ext": "v0" + }, + "live_until": 5095 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + "live_until": 1729000 + } + ] + }, + "events": [] +} \ No newline at end of file diff --git a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_upgrade_unauthorized.1.json b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_upgrade_unauthorized.1.json new file mode 100644 index 00000000..ec490303 --- /dev/null +++ b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_upgrade_unauthorized.1.json @@ -0,0 +1,179 @@ +{ + "generators": { + "address": 2, + "nonce": 0, + "mux_id": 0 + }, + "auth": [ + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "__constructor", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [] + ], + "ledger": { + "protocol_version": 25, + "sequence_number": 1000, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "801925984706572462" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Counter" + } + ] + }, + "durability": "persistent", + "val": { + "u32": 0 + } + } + }, + "ext": "v0" + }, + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "vec": [ + { + "symbol": "Admin" + } + ] + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + }, + { + "key": { + "vec": [ + { + "symbol": "Version" + } + ] + }, + "val": { + "u32": 1 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": { + "v1": { + "ext": "v0", + "cost_inputs": { + "ext": "v0", + "n_instructions": 1295, + "n_functions": 43, + "n_globals": 4, + "n_table_entries": 0, + "n_types": 15, + "n_data_segments": 1, + "n_elem_segments": 0, + "n_imports": 16, + "n_exports": 18, + "n_data_segment_bytes": 316 + } + } + }, + "hash": "500102ea154c5be1954457d777dfeff4b8bf98902c8d98019ab92d4981ec770a", + "code": "0061736d0100000001520f60027e7e017e60037e7e7e017e60047e7e7e7e017e60017e017e6000017e60017f0060027e7e017f60000060037f7f7f0060027f7e0060017e0060017f017e6000017f60027f7f017e60047f7f7f7f017e026110016c01310000016c015f0001016c01370002016101300003016c01380000017801310000017601680001016c013600030178013700040162016a0000017801330004016201380003016c01300000016c01320000017601670000016d01390001032c2b05040605070809030a05040404070b0a0c030409050c0c0d0b070704030c0403050e0405030d030403040805030100110621047f01418080c0000b7f00418780c0000b7f0041bc82c0000b7f0041c082c0000b07d50112066d656d6f727902000d5f5f636f6e7374727563746f7200170561646d696e001a0e63616e63656c5f75706772616465001c0e636f6d6d69745f75706772616465002203676574002b09696e6372656d656e74002c0969735f706175736564002e076d696772617465002f0570617573650032107363686564756c655f7570677261646500340e7472616e736665725f61646d696e003607756e70617573650037077570677261646500380776657273696f6e0039015f03010a5f5f646174615f656e6403020b5f5f686561705f6261736503030ae81a2b5802017e027f024002400240109180808000220142011092808080000d00410021020c010b20014201108080808000220142ff01834204520d012001422088a72103410121020b20002003360204200020023602000f0b000b6002017f017e23808080800041106b22002480808080002000418080c0800041071095808080000240024020002802000d002000200029030810968080800020002802004101470d010b000b20002903082101200041106a24808080800020010b0f0020002001108c808080004201510b1a001091808080002000ad42208642048442011081808080001a0b23001091808080004201428480808080a0fa03428480808080c0970d1082808080001a0b5102017f017e23808080800041106b220324808080800020032001200210ba8080800042012104024020032802000d0020002003290308370308420021040b20002004370300200341106a2480808080000b4401017f23808080800041106b220224808080800020022001370308200241086a410110b58080800021012000420037030020002001370308200241106a2480808080000b54000240200042ff018342cd00510d00000b20001083808080001a200010988080800041011099808080004100109380808000109480808000428480808080a0fa03428480808080c0970d1084808080001a42020b15004100109e80808000200042021081808080001a0b1c004101109e808080002000ad42208642048442021081808080001a0b0800109b808080000b4101017e024002404100109e8080800022004202109280808000450d0020004202108080808000220042ff018342cd00510d01000b410d10a480808000000b20000b4201017f109d808080004103109e80808000109f8080800010a0808080002100428ee2e8999ae0d6f50010a1808080002000ad4220864204841085808080001a42020b0f00109b808080001083808080001a0bec0102017f017e23808080800041106b22012480808080000240024002400240024002400240200041ff01710e0400010203000b2001419b80c08000410510958080800020012802000d04200120012903081096808080000c030b200141a080c08000410710958080800020012802000d03200120012903081096808080000c020b200141a780c08000410610958080800020012802000d02200120012903081096808080000c010b200141ad80c08000410e10958080800020012802000d01200120012903081096808080000b200129030821022001290300500d010b000b200141106a24808080800020020b0d0020004202108d808080001a0b4602017f017e41012100024002404101109e8080800022014202109280808000450d0020014202108080808000220142ff01834204520d012001422088a721000b20000f0b000b6303017f017e017f23808080800041106b2201248080808000200120003703004202210241012103024003402003450d012003417f6a2103200021020c000b0b20012002370308200141086a410110b5808080002100200141106a24808080800020000b870305017f017e017f017e017f23808080800041306b2200248080808000109d80808000024002404103109e8080800022014202109280808000450d00024020014202108080808000220142ff018342cb00520d00410021020240034020024110460d01200041206a20026a4202370300200241086a21020c000b0b2001200041206aad4220864204844284808080201086808080001a200041086a200029032010a38080800020002802080d002000290328220342ff01834204510d020b000b411210a480808000000b2000290310210110a5808080002102024002402003422088a7220441fff87e4b0d0020022004418087016a490d014103109e80808000109f8080800010a080808000210210a680808000210420011087808080001a10888080800021032000200436021c200020023602182000200137031020002003370308418780c08000410810a78080800010a180808000200041086a10a8808080001085808080001a200041306a24808080800042020f0b10a980808000000b10aa80808000000b4201017e420121020240200142ff018342c800520d002001108b808080004280808080708342808080808004520d0020002001370308420021020b200020023703000b090010aa80808000000b0c00108a80808000422088a70b2b01017f024010a0808080002200417f460d00200041016a220010998080800020000f0b10a980808000000b4502017f017e23808080800041106b220224808080800020022000200110ba80808000024020022802004101470d00000b20022903082103200241106a24808080800020030b6c02017f017e23808080800041206b22012480808080002001200029030837031020012000290300370300200120003502104220864204843703182001200035021442208642048437030841a081c0800041042001410410b1808080002102200141206a24808080800020020b090010aa80808000000b0300000b4b02027f017e23808080800041106b2200248080808000200041086a10908080800020002802082101200035020c2102200041106a2480808080002002422086420484420420014101711b0b960101027f23808080800041106b2201248080808000024002400240200042ff018342cd00520d0010ad808080000d0120001083808080001a200141086a109080808000200128020c410020012802084101711b2202417f460d02200241016a2202109380808000109480808000200141106a2480808080002002ad4220864204840f0b000b10aa80808000000b411010a480808000000b4702017f017e4100210002404102109e8080800022014202109280808000450d00410121000240024020014202108080808000a741ff01710e020102000b000b410021000b20000b090010ad80808000ad0bc40102037f027e23808080800041206b22012480808080000240200042ff01834204510d00000b109d808080002000422088a7220210b080808000109d8080800010a0808080002103200210b0808080002002109980808000108880808000210441b482c08000410810a78080800010a1808080002105200120004284808080708337031820012003ad42208642048437031020012004370308200541e480c080004103200141086a410310b1808080001085808080001a200141206a24808080800042020b17000240200010a0808080004b0d0010aa80808000000b0b2e00024020012003460d00000b2000ad4220864204842002ad4220864204842001ad422086420484108f808080000b3a01017f109d80808000410110b38080800010a0808080002100428ed2aadceeac0310a1808080002000ad4220864204841085808080001a42020b1a004102109e808080002000ad42ff018342021081808080001a0bfc0102027f037e23808080800041206b22012480808080002001200010a3808080000240024020012802004101460d0020012903082100109d8080800010a58080800021024103109e8080800021032001200037030020012002ad422086420484220437030820032001410210b58080800042021081808080001a108880808000210320024180f97e4f0d0141a482c08000411010a78080800010a180808000210520012004370318200120003703102001200337030820012002418087016aad4220864204843703002005418482c0800041042001410410b1808080001085808080001a200141206a24808080800042020f0b000b10a980808000000b1a002000ad4220864204842001ad422086420484108e808080000b9b0102017f037e23808080800041206b22012480808080000240200042ff018342cd00510d00000b109d80808000109b80808000210220001098808080001088808080002103418f80c08000410c10a78080800010a1808080002104200120023703182001200037031020012003370308200441d481c080004103200141086a410310b1808080001085808080001a200141206a24808080800042020b3c01017f109d80808000410010b38080800010a0808080002100428ed2aadceeaccff50010a1808080002000ad4220864204841085808080001a42020baf0102037f017e23808080800041206b2201248080808000200141086a200010a380808000024020012802084101470d00000b20012903102100109d8080800010a080808000210210a680808000210320001087808080001a10888080800021042001200336021c200120023602182001200037031020012004370308418780c08000410810a78080800010a180808000200141086a10a8808080001085808080001a200141206a24808080800042020b0f0010a080808000ad4220864204840bdb0102017e047f02400240200241094b0d004200210320022104200121050340024020040d002003420886420e8421030c030b41012106024020052d0000220741df00460d0002400240200741506a41ff0171410a490d00200741bf7f6a41ff0171411a490d012007419f7f6a41ff0171411a4f0d04200741456a21060c020b200741526a21060c010b2007414b6a21060b20034206862006ad42ff01838421032004417f6a2104200541016a21050c000b0b2001ad4220864204842002ad42208642048410898080800021030b20004200370300200020033703080b0bc6020100418080c0000bbc02436f756e746572557067726164656441646d696e4368616e67656441646d696e56657273696f6e50617573656450656e64696e6755706772616465636f6e74726163745f6164647265737366726f6d5f76657273696f6e746f5f76657273696f6e0000003b001000100000004b0010000c000000570010000a0000006e65775f76657273696f6e6e65775f7761736d5f686173686f6c645f76657273696f6e003b001000100000007c0010000b000000870010000d000000940010000b0000006e65775f61646d696e6f6c645f61646d696e00003b00100010000000c000100009000000c900100009000000636f6d6d69745f61747363686564756c65645f6174000000ec001000090000003b00100010000000870010000d000000f50010000c000000557067726164655363686564756c65644d6967726174656400eb170e636f6e747261637473706563763000000002000000000000000000000007446174614b65790000000001000000000000000000000007436f756e746572000000000000000000000000036765740000000000000000010000000400000000000000000000000561646d696e0000000000000000000001000000130000000000000000000000057061757365000000000000000000000000000000000001a24170706c7920706f73742d757067726164652073746174652d7368617065206d6967726174696f6e7320616e642062756d70207468652076657273696f6e20746f0a607461726765745f76657273696f6e602e0a0a232053656375726974790a2d2041646d696e2d6f6e6c792e0a2d2050616e69637320696620607461726765745f76657273696f6e203c3d2063757272656e745f76657273696f6e602028646f776e67726164652067756172640a656e666f7263656420627920607570673a3a726571756972655f76657273696f6e5f696e63726561736560292e0a0a456163682066757475726520736368656d61206368616e67652061646473206120606d61746368207461726765745f76657273696f6e602061726d2077697468207468650a7472616e73666f726d6174696f6e206c6f6769632e20546865207265666572656e636520636f6e747261637420686173206e6f206d6967726174696f6e73207965742c0a736f2074686520626f6479206973206120706173732d7468726f7567682074686174207265636f72647320746865206e65772076657273696f6e2e0000000000076d6967726174650000000001000000000000000e7461726765745f76657273696f6e00000000000400000000000000000000000000000007756e7061757365000000000000000000000000000000022c496d6d6564696174652028666173742d7061746829207570677261646520e28094207265706c616365732074686520636f6e7472616374205741534d20696e206f6e652063616c6c2e0a0a232053656375726974790a2d2041646d696e2d6f6e6c793a2060726571756972655f6175746828296020697320656e666f7263656420696e7369646520607570673a3a75706772616465602e0a2d20546865206e6577205741534d206d75737420616c72656164792062652075706c6f61646564207669610a60656e762e6465706c6f79657228292e75706c6f61645f636f6e74726163745f7761736d282e2e2e29602e0a2d205468697320656e74727920706f696e7420736b697073207468652032342d686f75722074696d656c6f636b20746861742067617465730a607363686564756c655f7570677261646560202f2060636f6d6d69745f75706772616465602e204f70657261746f72732073686f756c6420726573657276652069740a666f7220656d657267656e6369657320286c697665206578706c6f697420726573706f6e73652920616e6420707265666572207468652074696d656c6f636b65640a7061746820666f7220726f7574696e652075706772616465732e0a2d20496e6372656d656e747320746865206f6e2d636861696e2076657273696f6e20636f756e74657220616e6420656d69747320616e20605570677261646564600a6576656e7420666f72206f66662d636861696e20617564697420747261696c732e00000007757067726164650000000001000000000000000d6e65775f7761736d5f68617368000000000003ee000000200000000000000000000000000000000776657273696f6e00000000000000000100000004000000000000008c496e6372656d656e742074686520636f756e7465722e2044656d6f6e7374726174657320746865207374616e6461726420706175736520677561726420706c6163656d656e743a0a60726571756972655f6e6f745f706175736564602072756e73206265666f726520616e792061757468656e7469636174696f6e206f72207374617465206368616e67652e00000009696e6372656d656e7400000000000001000000000000000663616c6c6572000000000013000000010000000400000000000000000000000969735f706175736564000000000000000000000100000001000000000000008c496e697469616c6973652074686520636f6e7472616374207769746820616e2061646d696e2e204d6972726f72732074686520776972696e6720757365642062792065766572790a70726f64756374696f6e20636f6e74726163743a2073746f72652061646d696e2c20736565642076657273696f6e20312c2073657420696e697469616c2073746174652e0000000d5f5f636f6e7374727563746f7200000000000001000000000000000561646d696e000000000000130000000000000000000000000000000e63616e63656c5f757067726164650000000000000000000000000000000000000000000e636f6d6d69745f757067726164650000000000000000000000000000000000000000000e7472616e736665725f61646d696e00000000000100000000000000096e65775f61646d696e00000000000013000000000000000000000000000000107363686564756c655f7570677261646500000001000000000000000d6e65775f7761736d5f68617368000000000003ee00000020000000000000000200000000000000000000000a557067726164654b65790000000000040000000000000016436f6e74726163742061646d696e6973747261746f7200000000000541646d696e000000000000000000003843757272656e7420636f6e74726163742076657273696f6e20287533322c206d6f6e6f746f6e6963616c6c7920696e6372656173696e67290000000756657273696f6e00000000000000001e576865746865722074686520636f6e7472616374206973207061757365640000000000065061757365640000000000000000003550656e64696e6720757067726164653a20286e65775f7761736d5f686173682c207363686564756c65645f61745f6c6564676572290000000000000e50656e64696e675570677261646500000000000100000131456d6974746564207768656e205b606d6967726174696f6e5f636f6d706c65746564605d2072756e73207375636365737366756c6c7920616761696e7374206120636f6e74726163742e0a0a4d6967726174696f6e73206172652073746174652d7368617065207472616e73666f726d6174696f6e73206170706c69656420414654455220746865205741534d20737761702e0a4f66662d636861696e20696e6465786572732073686f756c642074726561742074686973206576656e74206173202274686520636f6e74726163742061742076657273696f6e0a6066726f6d5f76657273696f6e6020686173206265656e206d6967726174656420746f2060746f5f76657273696f6e6020616e6420746865206e657720736368656d612069730a6e6f7720696e20656666656374222e000000000000000000000d4d696772617465644576656e74000000000000030000000000000010636f6e74726163745f6164647265737300000013000000000000000c66726f6d5f76657273696f6e00000004000000000000000a746f5f76657273696f6e0000000000040000000100000000000000000000000d55706772616465644576656e74000000000000040000000000000010636f6e74726163745f6164647265737300000013000000000000000b6e65775f76657273696f6e0000000004000000000000000d6e65775f7761736d5f68617368000000000003ee00000020000000000000000b6f6c645f76657273696f6e00000000040000000100000000000000000000001141646d696e4368616e6765644576656e74000000000000030000000000000010636f6e74726163745f616464726573730000001300000000000000096e65775f61646d696e0000000000001300000000000000096f6c645f61646d696e0000000000001300000001000000000000000000000015557067726164655363686564756c65644576656e74000000000000040000000000000009636f6d6d69745f6174000000000000040000000000000010636f6e74726163745f6164647265737300000013000000000000000d6e65775f7761736d5f68617368000000000003ee00000020000000000000000c7363686564756c65645f617400000004001e11636f6e7472616374656e766d6574617630000000000000001900000000006f0e636f6e74726163746d65746176300000000000000005727376657200000000000006312e39342e3100000000000000000008727373646b7665720000002f32352e332e31236535306439356166303239633833313936646431323266303135346261633366313330323339346200" + } + }, + "ext": "v0" + }, + "live_until": 5095 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + "live_until": 1729000 + } + ] + }, + "events": [] +} \ No newline at end of file diff --git a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_version_increments.1.json b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_version_increments.1.json new file mode 100644 index 00000000..defaf01a --- /dev/null +++ b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/test_version_increments.1.json @@ -0,0 +1,259 @@ +{ + "generators": { + "address": 2, + "nonce": 0, + "mux_id": 0 + }, + "auth": [ + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "__constructor", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "upgrade", + "args": [ + { + "bytes": "500102ea154c5be1954457d777dfeff4b8bf98902c8d98019ab92d4981ec770a" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "upgrade", + "args": [ + { + "bytes": "500102ea154c5be1954457d777dfeff4b8bf98902c8d98019ab92d4981ec770a" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [] + ], + "ledger": { + "protocol_version": 25, + "sequence_number": 1000, + "timestamp": 0, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "801925984706572462" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "1033654523790656264" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "5541220902715666415" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Counter" + } + ] + }, + "durability": "persistent", + "val": { + "u32": 0 + } + } + }, + "ext": "v0" + }, + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "500102ea154c5be1954457d777dfeff4b8bf98902c8d98019ab92d4981ec770a" + }, + "storage": [ + { + "key": { + "vec": [ + { + "symbol": "Admin" + } + ] + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + }, + { + "key": { + "vec": [ + { + "symbol": "Version" + } + ] + }, + "val": { + "u32": 3 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": { + "v1": { + "ext": "v0", + "cost_inputs": { + "ext": "v0", + "n_instructions": 1295, + "n_functions": 43, + "n_globals": 4, + "n_table_entries": 0, + "n_types": 15, + "n_data_segments": 1, + "n_elem_segments": 0, + "n_imports": 16, + "n_exports": 18, + "n_data_segment_bytes": 316 + } + } + }, + "hash": "500102ea154c5be1954457d777dfeff4b8bf98902c8d98019ab92d4981ec770a", + "code": "0061736d0100000001520f60027e7e017e60037e7e7e017e60047e7e7e7e017e60017e017e6000017e60017f0060027e7e017f60000060037f7f7f0060027f7e0060017e0060017f017e6000017f60027f7f017e60047f7f7f7f017e026110016c01310000016c015f0001016c01370002016101300003016c01380000017801310000017601680001016c013600030178013700040162016a0000017801330004016201380003016c01300000016c01320000017601670000016d01390001032c2b05040605070809030a05040404070b0a0c030409050c0c0d0b070704030c0403050e0405030d030403040805030100110621047f01418080c0000b7f00418780c0000b7f0041bc82c0000b7f0041c082c0000b07d50112066d656d6f727902000d5f5f636f6e7374727563746f7200170561646d696e001a0e63616e63656c5f75706772616465001c0e636f6d6d69745f75706772616465002203676574002b09696e6372656d656e74002c0969735f706175736564002e076d696772617465002f0570617573650032107363686564756c655f7570677261646500340e7472616e736665725f61646d696e003607756e70617573650037077570677261646500380776657273696f6e0039015f03010a5f5f646174615f656e6403020b5f5f686561705f6261736503030ae81a2b5802017e027f024002400240109180808000220142011092808080000d00410021020c010b20014201108080808000220142ff01834204520d012001422088a72103410121020b20002003360204200020023602000f0b000b6002017f017e23808080800041106b22002480808080002000418080c0800041071095808080000240024020002802000d002000200029030810968080800020002802004101470d010b000b20002903082101200041106a24808080800020010b0f0020002001108c808080004201510b1a001091808080002000ad42208642048442011081808080001a0b23001091808080004201428480808080a0fa03428480808080c0970d1082808080001a0b5102017f017e23808080800041106b220324808080800020032001200210ba8080800042012104024020032802000d0020002003290308370308420021040b20002004370300200341106a2480808080000b4401017f23808080800041106b220224808080800020022001370308200241086a410110b58080800021012000420037030020002001370308200241106a2480808080000b54000240200042ff018342cd00510d00000b20001083808080001a200010988080800041011099808080004100109380808000109480808000428480808080a0fa03428480808080c0970d1084808080001a42020b15004100109e80808000200042021081808080001a0b1c004101109e808080002000ad42208642048442021081808080001a0b0800109b808080000b4101017e024002404100109e8080800022004202109280808000450d0020004202108080808000220042ff018342cd00510d01000b410d10a480808000000b20000b4201017f109d808080004103109e80808000109f8080800010a0808080002100428ee2e8999ae0d6f50010a1808080002000ad4220864204841085808080001a42020b0f00109b808080001083808080001a0bec0102017f017e23808080800041106b22012480808080000240024002400240024002400240200041ff01710e0400010203000b2001419b80c08000410510958080800020012802000d04200120012903081096808080000c030b200141a080c08000410710958080800020012802000d03200120012903081096808080000c020b200141a780c08000410610958080800020012802000d02200120012903081096808080000c010b200141ad80c08000410e10958080800020012802000d01200120012903081096808080000b200129030821022001290300500d010b000b200141106a24808080800020020b0d0020004202108d808080001a0b4602017f017e41012100024002404101109e8080800022014202109280808000450d0020014202108080808000220142ff01834204520d012001422088a721000b20000f0b000b6303017f017e017f23808080800041106b2201248080808000200120003703004202210241012103024003402003450d012003417f6a2103200021020c000b0b20012002370308200141086a410110b5808080002100200141106a24808080800020000b870305017f017e017f017e017f23808080800041306b2200248080808000109d80808000024002404103109e8080800022014202109280808000450d00024020014202108080808000220142ff018342cb00520d00410021020240034020024110460d01200041206a20026a4202370300200241086a21020c000b0b2001200041206aad4220864204844284808080201086808080001a200041086a200029032010a38080800020002802080d002000290328220342ff01834204510d020b000b411210a480808000000b2000290310210110a5808080002102024002402003422088a7220441fff87e4b0d0020022004418087016a490d014103109e80808000109f8080800010a080808000210210a680808000210420011087808080001a10888080800021032000200436021c200020023602182000200137031020002003370308418780c08000410810a78080800010a180808000200041086a10a8808080001085808080001a200041306a24808080800042020f0b10a980808000000b10aa80808000000b4201017e420121020240200142ff018342c800520d002001108b808080004280808080708342808080808004520d0020002001370308420021020b200020023703000b090010aa80808000000b0c00108a80808000422088a70b2b01017f024010a0808080002200417f460d00200041016a220010998080800020000f0b10a980808000000b4502017f017e23808080800041106b220224808080800020022000200110ba80808000024020022802004101470d00000b20022903082103200241106a24808080800020030b6c02017f017e23808080800041206b22012480808080002001200029030837031020012000290300370300200120003502104220864204843703182001200035021442208642048437030841a081c0800041042001410410b1808080002102200141206a24808080800020020b090010aa80808000000b0300000b4b02027f017e23808080800041106b2200248080808000200041086a10908080800020002802082101200035020c2102200041106a2480808080002002422086420484420420014101711b0b960101027f23808080800041106b2201248080808000024002400240200042ff018342cd00520d0010ad808080000d0120001083808080001a200141086a109080808000200128020c410020012802084101711b2202417f460d02200241016a2202109380808000109480808000200141106a2480808080002002ad4220864204840f0b000b10aa80808000000b411010a480808000000b4702017f017e4100210002404102109e8080800022014202109280808000450d00410121000240024020014202108080808000a741ff01710e020102000b000b410021000b20000b090010ad80808000ad0bc40102037f027e23808080800041206b22012480808080000240200042ff01834204510d00000b109d808080002000422088a7220210b080808000109d8080800010a0808080002103200210b0808080002002109980808000108880808000210441b482c08000410810a78080800010a1808080002105200120004284808080708337031820012003ad42208642048437031020012004370308200541e480c080004103200141086a410310b1808080001085808080001a200141206a24808080800042020b17000240200010a0808080004b0d0010aa80808000000b0b2e00024020012003460d00000b2000ad4220864204842002ad4220864204842001ad422086420484108f808080000b3a01017f109d80808000410110b38080800010a0808080002100428ed2aadceeac0310a1808080002000ad4220864204841085808080001a42020b1a004102109e808080002000ad42ff018342021081808080001a0bfc0102027f037e23808080800041206b22012480808080002001200010a3808080000240024020012802004101460d0020012903082100109d8080800010a58080800021024103109e8080800021032001200037030020012002ad422086420484220437030820032001410210b58080800042021081808080001a108880808000210320024180f97e4f0d0141a482c08000411010a78080800010a180808000210520012004370318200120003703102001200337030820012002418087016aad4220864204843703002005418482c0800041042001410410b1808080001085808080001a200141206a24808080800042020f0b000b10a980808000000b1a002000ad4220864204842001ad422086420484108e808080000b9b0102017f037e23808080800041206b22012480808080000240200042ff018342cd00510d00000b109d80808000109b80808000210220001098808080001088808080002103418f80c08000410c10a78080800010a1808080002104200120023703182001200037031020012003370308200441d481c080004103200141086a410310b1808080001085808080001a200141206a24808080800042020b3c01017f109d80808000410010b38080800010a0808080002100428ed2aadceeaccff50010a1808080002000ad4220864204841085808080001a42020baf0102037f017e23808080800041206b2201248080808000200141086a200010a380808000024020012802084101470d00000b20012903102100109d8080800010a080808000210210a680808000210320001087808080001a10888080800021042001200336021c200120023602182001200037031020012004370308418780c08000410810a78080800010a180808000200141086a10a8808080001085808080001a200141206a24808080800042020b0f0010a080808000ad4220864204840bdb0102017e047f02400240200241094b0d004200210320022104200121050340024020040d002003420886420e8421030c030b41012106024020052d0000220741df00460d0002400240200741506a41ff0171410a490d00200741bf7f6a41ff0171411a490d012007419f7f6a41ff0171411a4f0d04200741456a21060c020b200741526a21060c010b2007414b6a21060b20034206862006ad42ff01838421032004417f6a2104200541016a21050c000b0b2001ad4220864204842002ad42208642048410898080800021030b20004200370300200020033703080b0bc6020100418080c0000bbc02436f756e746572557067726164656441646d696e4368616e67656441646d696e56657273696f6e50617573656450656e64696e6755706772616465636f6e74726163745f6164647265737366726f6d5f76657273696f6e746f5f76657273696f6e0000003b001000100000004b0010000c000000570010000a0000006e65775f76657273696f6e6e65775f7761736d5f686173686f6c645f76657273696f6e003b001000100000007c0010000b000000870010000d000000940010000b0000006e65775f61646d696e6f6c645f61646d696e00003b00100010000000c000100009000000c900100009000000636f6d6d69745f61747363686564756c65645f6174000000ec001000090000003b00100010000000870010000d000000f50010000c000000557067726164655363686564756c65644d6967726174656400eb170e636f6e747261637473706563763000000002000000000000000000000007446174614b65790000000001000000000000000000000007436f756e746572000000000000000000000000036765740000000000000000010000000400000000000000000000000561646d696e0000000000000000000001000000130000000000000000000000057061757365000000000000000000000000000000000001a24170706c7920706f73742d757067726164652073746174652d7368617065206d6967726174696f6e7320616e642062756d70207468652076657273696f6e20746f0a607461726765745f76657273696f6e602e0a0a232053656375726974790a2d2041646d696e2d6f6e6c792e0a2d2050616e69637320696620607461726765745f76657273696f6e203c3d2063757272656e745f76657273696f6e602028646f776e67726164652067756172640a656e666f7263656420627920607570673a3a726571756972655f76657273696f6e5f696e63726561736560292e0a0a456163682066757475726520736368656d61206368616e67652061646473206120606d61746368207461726765745f76657273696f6e602061726d2077697468207468650a7472616e73666f726d6174696f6e206c6f6769632e20546865207265666572656e636520636f6e747261637420686173206e6f206d6967726174696f6e73207965742c0a736f2074686520626f6479206973206120706173732d7468726f7567682074686174207265636f72647320746865206e65772076657273696f6e2e0000000000076d6967726174650000000001000000000000000e7461726765745f76657273696f6e00000000000400000000000000000000000000000007756e7061757365000000000000000000000000000000022c496d6d6564696174652028666173742d7061746829207570677261646520e28094207265706c616365732074686520636f6e7472616374205741534d20696e206f6e652063616c6c2e0a0a232053656375726974790a2d2041646d696e2d6f6e6c793a2060726571756972655f6175746828296020697320656e666f7263656420696e7369646520607570673a3a75706772616465602e0a2d20546865206e6577205741534d206d75737420616c72656164792062652075706c6f61646564207669610a60656e762e6465706c6f79657228292e75706c6f61645f636f6e74726163745f7761736d282e2e2e29602e0a2d205468697320656e74727920706f696e7420736b697073207468652032342d686f75722074696d656c6f636b20746861742067617465730a607363686564756c655f7570677261646560202f2060636f6d6d69745f75706772616465602e204f70657261746f72732073686f756c6420726573657276652069740a666f7220656d657267656e6369657320286c697665206578706c6f697420726573706f6e73652920616e6420707265666572207468652074696d656c6f636b65640a7061746820666f7220726f7574696e652075706772616465732e0a2d20496e6372656d656e747320746865206f6e2d636861696e2076657273696f6e20636f756e74657220616e6420656d69747320616e20605570677261646564600a6576656e7420666f72206f66662d636861696e20617564697420747261696c732e00000007757067726164650000000001000000000000000d6e65775f7761736d5f68617368000000000003ee000000200000000000000000000000000000000776657273696f6e00000000000000000100000004000000000000008c496e6372656d656e742074686520636f756e7465722e2044656d6f6e7374726174657320746865207374616e6461726420706175736520677561726420706c6163656d656e743a0a60726571756972655f6e6f745f706175736564602072756e73206265666f726520616e792061757468656e7469636174696f6e206f72207374617465206368616e67652e00000009696e6372656d656e7400000000000001000000000000000663616c6c6572000000000013000000010000000400000000000000000000000969735f706175736564000000000000000000000100000001000000000000008c496e697469616c6973652074686520636f6e7472616374207769746820616e2061646d696e2e204d6972726f72732074686520776972696e6720757365642062792065766572790a70726f64756374696f6e20636f6e74726163743a2073746f72652061646d696e2c20736565642076657273696f6e20312c2073657420696e697469616c2073746174652e0000000d5f5f636f6e7374727563746f7200000000000001000000000000000561646d696e000000000000130000000000000000000000000000000e63616e63656c5f757067726164650000000000000000000000000000000000000000000e636f6d6d69745f757067726164650000000000000000000000000000000000000000000e7472616e736665725f61646d696e00000000000100000000000000096e65775f61646d696e00000000000013000000000000000000000000000000107363686564756c655f7570677261646500000001000000000000000d6e65775f7761736d5f68617368000000000003ee00000020000000000000000200000000000000000000000a557067726164654b65790000000000040000000000000016436f6e74726163742061646d696e6973747261746f7200000000000541646d696e000000000000000000003843757272656e7420636f6e74726163742076657273696f6e20287533322c206d6f6e6f746f6e6963616c6c7920696e6372656173696e67290000000756657273696f6e00000000000000001e576865746865722074686520636f6e7472616374206973207061757365640000000000065061757365640000000000000000003550656e64696e6720757067726164653a20286e65775f7761736d5f686173682c207363686564756c65645f61745f6c6564676572290000000000000e50656e64696e675570677261646500000000000100000131456d6974746564207768656e205b606d6967726174696f6e5f636f6d706c65746564605d2072756e73207375636365737366756c6c7920616761696e7374206120636f6e74726163742e0a0a4d6967726174696f6e73206172652073746174652d7368617065207472616e73666f726d6174696f6e73206170706c69656420414654455220746865205741534d20737761702e0a4f66662d636861696e20696e6465786572732073686f756c642074726561742074686973206576656e74206173202274686520636f6e74726163742061742076657273696f6e0a6066726f6d5f76657273696f6e6020686173206265656e206d6967726174656420746f2060746f5f76657273696f6e6020616e6420746865206e657720736368656d612069730a6e6f7720696e20656666656374222e000000000000000000000d4d696772617465644576656e74000000000000030000000000000010636f6e74726163745f6164647265737300000013000000000000000c66726f6d5f76657273696f6e00000004000000000000000a746f5f76657273696f6e0000000000040000000100000000000000000000000d55706772616465644576656e74000000000000040000000000000010636f6e74726163745f6164647265737300000013000000000000000b6e65775f76657273696f6e0000000004000000000000000d6e65775f7761736d5f68617368000000000003ee00000020000000000000000b6f6c645f76657273696f6e00000000040000000100000000000000000000001141646d696e4368616e6765644576656e74000000000000030000000000000010636f6e74726163745f616464726573730000001300000000000000096e65775f61646d696e0000000000001300000000000000096f6c645f61646d696e0000000000001300000001000000000000000000000015557067726164655363686564756c65644576656e74000000000000040000000000000009636f6d6d69745f6174000000000000040000000000000010636f6e74726163745f6164647265737300000013000000000000000d6e65775f7761736d5f68617368000000000003ee00000020000000000000000c7363686564756c65645f617400000004001e11636f6e7472616374656e766d6574617630000000000000001900000000006f0e636f6e74726163746d65746176300000000000000005727376657200000000000006312e39342e3100000000000000000008727373646b7665720000002f32352e332e31236535306439356166303239633833313936646431323266303135346261633366313330323339346200" + } + }, + "ext": "v0" + }, + "live_until": 5095 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + "live_until": 1729000 + } + ] + }, + "events": [] +} \ No newline at end of file diff --git a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/transfer_admin_updates_owner.1.json b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/transfer_admin_updates_owner.1.json index da018a4e..d092ef6d 100644 --- a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/transfer_admin_updates_owner.1.json +++ b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/transfer_admin_updates_owner.1.json @@ -1,7 +1,8 @@ { "generators": { "address": 3, - "nonce": 0 + "nonce": 0, + "mux_id": 0 }, "auth": [ [ @@ -45,7 +46,7 @@ [] ], "ledger": { - "protocol_version": 22, + "protocol_version": 25, "sequence_number": 1000, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -54,189 +55,132 @@ "min_temp_entry_ttl": 16, "max_entry_ttl": 6312000, "ledger_entries": [ - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 801925984706572462 - } - }, - "durability": "temporary" - } + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "801925984706572462" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 801925984706572462 - } - }, - "durability": "temporary", - "val": "void" - } - }, - "ext": "v0" + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "5541220902715666415" + } + }, + "durability": "temporary", + "val": "void" + } }, - 6312999 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 5541220902715666415 - } - }, - "durability": "temporary" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 5541220902715666415 + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Counter" } - }, - "durability": "temporary", - "val": "void" + ] + }, + "durability": "persistent", + "val": { + "u32": 0 } - }, - "ext": "v0" + } }, - 6312999 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": { - "vec": [ - { - "symbol": "Counter" - } - ] - }, - "durability": "persistent" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": { - "vec": [ + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ { - "symbol": "Counter" - } - ] - }, - "durability": "persistent", - "val": { - "u32": 0 - } - } - }, - "ext": "v0" - }, - 1729000 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": "ledger_key_contract_instance", - "durability": "persistent" - } - }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": "ledger_key_contract_instance", - "durability": "persistent", - "val": { - "contract_instance": { - "executable": { - "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "key": { + "vec": [ + { + "symbol": "Admin" + } + ] + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } }, - "storage": [ - { - "key": { - "vec": [ - { - "symbol": "Admin" - } - ] - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } + { + "key": { + "vec": [ + { + "symbol": "Version" + } + ] }, - { - "key": { - "vec": [ - { - "symbol": "Version" - } - ] - }, - "val": { - "u32": 1 - } + "val": { + "u32": 1 } - ] - } + } + ] } } - }, - "ext": "v0" + } }, - 1729000 - ] - ], - [ - { - "contract_code": { - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_code": { - "ext": "v0", - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "code": "" - } - }, - "ext": "v0" + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } }, - 1729000 - ] - ] + "ext": "v0" + }, + "live_until": 1729000 + } ] }, "events": [] diff --git a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/unpause_restores_increment.1.json b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/unpause_restores_increment.1.json index fcd1f621..75e174fe 100644 --- a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/unpause_restores_increment.1.json +++ b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/unpause_restores_increment.1.json @@ -1,7 +1,8 @@ { "generators": { "address": 3, - "nonce": 0 + "nonce": 0, + "mux_id": 0 }, "auth": [ [ @@ -74,7 +75,7 @@ ] ], "ledger": { - "protocol_version": 22, + "protocol_version": 25, "sequence_number": 1000, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -83,267 +84,184 @@ "min_temp_entry_ttl": 16, "max_entry_ttl": 6312000, "ledger_entries": [ - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 801925984706572462 - } - }, - "durability": "temporary" - } + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "801925984706572462" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 801925984706572462 - } - }, - "durability": "temporary", - "val": "void" - } - }, - "ext": "v0" + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "1033654523790656264" + } + }, + "durability": "temporary", + "val": "void" + } }, - 6312999 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 1033654523790656264 - } - }, - "durability": "temporary" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 1033654523790656264 - } - }, - "durability": "temporary", - "val": "void" - } - }, - "ext": "v0" + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "5541220902715666415" + } + }, + "durability": "temporary", + "val": "void" + } }, - 6312999 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 5541220902715666415 - } - }, - "durability": "temporary" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 5541220902715666415 + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Counter" } - }, - "durability": "temporary", - "val": "void" + ] + }, + "durability": "persistent", + "val": { + "u32": 1 } - }, - "ext": "v0" + } }, - 6312999 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": { - "vec": [ - { - "symbol": "Counter" - } - ] - }, - "durability": "persistent" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": { - "vec": [ + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ { - "symbol": "Counter" - } - ] - }, - "durability": "persistent", - "val": { - "u32": 1 - } - } - }, - "ext": "v0" - }, - 1729000 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": "ledger_key_contract_instance", - "durability": "persistent" - } - }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": "ledger_key_contract_instance", - "durability": "persistent", - "val": { - "contract_instance": { - "executable": { - "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "key": { + "vec": [ + { + "symbol": "Admin" + } + ] + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } }, - "storage": [ - { - "key": { - "vec": [ - { - "symbol": "Admin" - } - ] - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" - } + { + "key": { + "vec": [ + { + "symbol": "Paused" + } + ] }, - { - "key": { - "vec": [ - { - "symbol": "Paused" - } - ] - }, - "val": { - "bool": false - } + "val": { + "bool": false + } + }, + { + "key": { + "vec": [ + { + "symbol": "Version" + } + ] }, - { - "key": { - "vec": [ - { - "symbol": "Version" - } - ] - }, - "val": { - "u32": 1 - } + "val": { + "u32": 1 } - ] - } + } + ] } } - }, - "ext": "v0" + } }, - 1729000 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", - "key": { - "ledger_key_nonce": { - "nonce": 4837995959683129791 - } - }, - "durability": "temporary" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", - "key": { - "ledger_key_nonce": { - "nonce": 4837995959683129791 - } - }, - "durability": "temporary", - "val": "void" - } - }, - "ext": "v0" + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": { + "ledger_key_nonce": { + "nonce": "4837995959683129791" + } + }, + "durability": "temporary", + "val": "void" + } }, - 6312999 - ] - ], - [ - { - "contract_code": { - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_code": { - "ext": "v0", - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "code": "" - } - }, - "ext": "v0" + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } }, - 1729000 - ] - ] + "ext": "v0" + }, + "live_until": 1729000 + } ] }, "events": [] diff --git a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/version_unchanged_by_admin_transfer.1.json b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/version_unchanged_by_admin_transfer.1.json index da018a4e..d092ef6d 100644 --- a/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/version_unchanged_by_admin_transfer.1.json +++ b/soroban-contract/contracts/upgradeable_reference/test_snapshots/test/version_unchanged_by_admin_transfer.1.json @@ -1,7 +1,8 @@ { "generators": { "address": 3, - "nonce": 0 + "nonce": 0, + "mux_id": 0 }, "auth": [ [ @@ -45,7 +46,7 @@ [] ], "ledger": { - "protocol_version": 22, + "protocol_version": 25, "sequence_number": 1000, "timestamp": 0, "network_id": "0000000000000000000000000000000000000000000000000000000000000000", @@ -54,189 +55,132 @@ "min_temp_entry_ttl": 16, "max_entry_ttl": 6312000, "ledger_entries": [ - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 801925984706572462 - } - }, - "durability": "temporary" - } + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "801925984706572462" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 801925984706572462 - } - }, - "durability": "temporary", - "val": "void" - } - }, - "ext": "v0" + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "5541220902715666415" + } + }, + "durability": "temporary", + "val": "void" + } }, - 6312999 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 5541220902715666415 - } - }, - "durability": "temporary" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", - "key": { - "ledger_key_nonce": { - "nonce": 5541220902715666415 + "live_until": 6312999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Counter" } - }, - "durability": "temporary", - "val": "void" + ] + }, + "durability": "persistent", + "val": { + "u32": 0 } - }, - "ext": "v0" + } }, - 6312999 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": { - "vec": [ - { - "symbol": "Counter" - } - ] - }, - "durability": "persistent" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": { - "vec": [ + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ { - "symbol": "Counter" - } - ] - }, - "durability": "persistent", - "val": { - "u32": 0 - } - } - }, - "ext": "v0" - }, - 1729000 - ] - ], - [ - { - "contract_data": { - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": "ledger_key_contract_instance", - "durability": "persistent" - } - }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_data": { - "ext": "v0", - "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", - "key": "ledger_key_contract_instance", - "durability": "persistent", - "val": { - "contract_instance": { - "executable": { - "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + "key": { + "vec": [ + { + "symbol": "Admin" + } + ] + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } }, - "storage": [ - { - "key": { - "vec": [ - { - "symbol": "Admin" - } - ] - }, - "val": { - "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" - } + { + "key": { + "vec": [ + { + "symbol": "Version" + } + ] }, - { - "key": { - "vec": [ - { - "symbol": "Version" - } - ] - }, - "val": { - "u32": 1 - } + "val": { + "u32": 1 } - ] - } + } + ] } } - }, - "ext": "v0" + } }, - 1729000 - ] - ], - [ - { - "contract_code": { - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" - } + "ext": "v0" }, - [ - { - "last_modified_ledger_seq": 0, - "data": { - "contract_code": { - "ext": "v0", - "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "code": "" - } - }, - "ext": "v0" + "live_until": 1729000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } }, - 1729000 - ] - ] + "ext": "v0" + }, + "live_until": 1729000 + } ] }, "events": [] diff --git a/soroban-contract/contracts/vesting/src/lib.rs b/soroban-contract/contracts/vesting/src/lib.rs index dfbdedf7..7014f779 100644 --- a/soroban-contract/contracts/vesting/src/lib.rs +++ b/soroban-contract/contracts/vesting/src/lib.rs @@ -262,6 +262,27 @@ impl Vesting { upg::commit_upgrade(&env); } + /// Immediate (fast-path) upgrade. Admin-only, no timelock — see + /// `upgradeable::upgrade` for the full security note. Reserve for + /// emergencies; prefer `schedule_upgrade` + `commit_upgrade` for + /// routine upgrades. + pub fn upgrade(env: Env, new_wasm_hash: soroban_sdk::BytesN<32>) { + upg::upgrade(&env, new_wasm_hash); + } + + /// Apply post-upgrade state-shape migrations and bump the version to + /// `target_version`. Admin-only; rejects downgrades. + pub fn migrate(env: Env, target_version: u32) { + upg::require_admin(&env); + upg::require_version_increase(&env, target_version); + + match target_version { + _ => {} + } + + upg::migration_completed(&env, target_version); + } + pub fn pause(env: Env) { upg::pause(&env); } diff --git a/soroban-contract/contracts/vesting/test_snapshots/test/test_cliff_blocks_early_release.1.json b/soroban-contract/contracts/vesting/test_snapshots/test/test_cliff_blocks_early_release.1.json new file mode 100644 index 00000000..390ac5c1 --- /dev/null +++ b/soroban-contract/contracts/vesting/test_snapshots/test/test_cliff_blocks_early_release.1.json @@ -0,0 +1,347 @@ +{ + "generators": { + "address": 5, + "nonce": 0, + "mux_id": 0 + }, + "auth": [ + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "initialize", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "create_schedule", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "i128": "100000" + }, + { + "u64": "0" + }, + { + "u64": "500" + }, + { + "u64": "1000" + }, + { + "bool": false + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [] + ], + "ledger": { + "protocol_version": 25, + "sequence_number": 0, + "timestamp": 499, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "801925984706572462" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6311999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Schedule" + }, + { + "u32": 0 + } + ] + }, + "durability": "persistent", + "val": { + "map": [ + { + "key": { + "symbol": "beneficiary" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + } + }, + { + "key": { + "symbol": "cliff" + }, + "val": { + "u64": "500" + } + }, + { + "key": { + "symbol": "end" + }, + "val": { + "u64": "1000" + } + }, + { + "key": { + "symbol": "id" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "released" + }, + "val": { + "i128": "0" + } + }, + { + "key": { + "symbol": "revocable" + }, + "val": { + "bool": false + } + }, + { + "key": { + "symbol": "revoked" + }, + "val": { + "bool": false + } + }, + { + "key": { + "symbol": "start" + }, + "val": { + "u64": "0" + } + }, + { + "key": { + "symbol": "token" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + }, + { + "key": { + "symbol": "total_amount" + }, + "val": { + "i128": "100000" + } + } + ] + } + } + }, + "ext": "v0" + }, + "live_until": 1728000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "vec": [ + { + "symbol": "Admin" + } + ] + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + }, + { + "key": { + "vec": [ + { + "symbol": "Counter" + } + ] + }, + "val": { + "u32": 1 + } + }, + { + "key": { + "vec": [ + { + "symbol": "Version" + } + ] + }, + "val": { + "u32": 1 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + "live_until": 1728000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + "val": { + "i128": "100000" + } + }, + { + "key": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + }, + "val": { + "i128": "900000" + } + } + ] + } + } + } + }, + "ext": "v0" + }, + "live_until": 4095 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + "key": { + "ledger_key_nonce": { + "nonce": "5541220902715666415" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6311999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + "live_until": 1728000 + } + ] + }, + "events": [] +} \ No newline at end of file diff --git a/soroban-contract/contracts/vesting/test_snapshots/test/test_full_vest_after_duration.1.json b/soroban-contract/contracts/vesting/test_snapshots/test/test_full_vest_after_duration.1.json new file mode 100644 index 00000000..7b52ec08 --- /dev/null +++ b/soroban-contract/contracts/vesting/test_snapshots/test/test_full_vest_after_duration.1.json @@ -0,0 +1,358 @@ +{ + "generators": { + "address": 5, + "nonce": 0, + "mux_id": 0 + }, + "auth": [ + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "initialize", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "create_schedule", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "i128": "100000" + }, + { + "u64": "0" + }, + { + "u64": "500" + }, + { + "u64": "1000" + }, + { + "bool": false + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [], + [], + [] + ], + "ledger": { + "protocol_version": 25, + "sequence_number": 0, + "timestamp": 1000, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "801925984706572462" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6311999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Schedule" + }, + { + "u32": 0 + } + ] + }, + "durability": "persistent", + "val": { + "map": [ + { + "key": { + "symbol": "beneficiary" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + } + }, + { + "key": { + "symbol": "cliff" + }, + "val": { + "u64": "500" + } + }, + { + "key": { + "symbol": "end" + }, + "val": { + "u64": "1000" + } + }, + { + "key": { + "symbol": "id" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "released" + }, + "val": { + "i128": "100000" + } + }, + { + "key": { + "symbol": "revocable" + }, + "val": { + "bool": false + } + }, + { + "key": { + "symbol": "revoked" + }, + "val": { + "bool": false + } + }, + { + "key": { + "symbol": "start" + }, + "val": { + "u64": "0" + } + }, + { + "key": { + "symbol": "token" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + }, + { + "key": { + "symbol": "total_amount" + }, + "val": { + "i128": "100000" + } + } + ] + } + } + }, + "ext": "v0" + }, + "live_until": 1728000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "vec": [ + { + "symbol": "Admin" + } + ] + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + }, + { + "key": { + "vec": [ + { + "symbol": "Counter" + } + ] + }, + "val": { + "u32": 1 + } + }, + { + "key": { + "vec": [ + { + "symbol": "Version" + } + ] + }, + "val": { + "u32": 1 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + "live_until": 1728000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + "val": { + "i128": "0" + } + }, + { + "key": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + }, + "val": { + "i128": "900000" + } + }, + { + "key": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + }, + "val": { + "i128": "100000" + } + } + ] + } + } + } + }, + "ext": "v0" + }, + "live_until": 4095 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + "key": { + "ledger_key_nonce": { + "nonce": "5541220902715666415" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6311999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + "live_until": 1728000 + } + ] + }, + "events": [] +} \ No newline at end of file diff --git a/soroban-contract/contracts/vesting/test_snapshots/test/test_linear_release_midway.1.json b/soroban-contract/contracts/vesting/test_snapshots/test/test_linear_release_midway.1.json new file mode 100644 index 00000000..6c3b93a5 --- /dev/null +++ b/soroban-contract/contracts/vesting/test_snapshots/test/test_linear_release_midway.1.json @@ -0,0 +1,357 @@ +{ + "generators": { + "address": 5, + "nonce": 0, + "mux_id": 0 + }, + "auth": [ + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "initialize", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "create_schedule", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "i128": "100000" + }, + { + "u64": "0" + }, + { + "u64": "0" + }, + { + "u64": "1000" + }, + { + "bool": false + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [], + [] + ], + "ledger": { + "protocol_version": 25, + "sequence_number": 0, + "timestamp": 750, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "801925984706572462" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6311999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Schedule" + }, + { + "u32": 0 + } + ] + }, + "durability": "persistent", + "val": { + "map": [ + { + "key": { + "symbol": "beneficiary" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + } + }, + { + "key": { + "symbol": "cliff" + }, + "val": { + "u64": "0" + } + }, + { + "key": { + "symbol": "end" + }, + "val": { + "u64": "1000" + } + }, + { + "key": { + "symbol": "id" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "released" + }, + "val": { + "i128": "50000" + } + }, + { + "key": { + "symbol": "revocable" + }, + "val": { + "bool": false + } + }, + { + "key": { + "symbol": "revoked" + }, + "val": { + "bool": false + } + }, + { + "key": { + "symbol": "start" + }, + "val": { + "u64": "0" + } + }, + { + "key": { + "symbol": "token" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + }, + { + "key": { + "symbol": "total_amount" + }, + "val": { + "i128": "100000" + } + } + ] + } + } + }, + "ext": "v0" + }, + "live_until": 1728000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "vec": [ + { + "symbol": "Admin" + } + ] + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + }, + { + "key": { + "vec": [ + { + "symbol": "Counter" + } + ] + }, + "val": { + "u32": 1 + } + }, + { + "key": { + "vec": [ + { + "symbol": "Version" + } + ] + }, + "val": { + "u32": 1 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + "live_until": 1728000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + "val": { + "i128": "50000" + } + }, + { + "key": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + }, + "val": { + "i128": "900000" + } + }, + { + "key": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + }, + "val": { + "i128": "50000" + } + } + ] + } + } + } + }, + "ext": "v0" + }, + "live_until": 4095 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + "key": { + "ledger_key_nonce": { + "nonce": "5541220902715666415" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6311999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + "live_until": 1728000 + } + ] + }, + "events": [] +} \ No newline at end of file diff --git a/soroban-contract/contracts/vesting/test_snapshots/test/test_revoke_splits_correctly.1.json b/soroban-contract/contracts/vesting/test_snapshots/test/test_revoke_splits_correctly.1.json new file mode 100644 index 00000000..69305bcf --- /dev/null +++ b/soroban-contract/contracts/vesting/test_snapshots/test/test_revoke_splits_correctly.1.json @@ -0,0 +1,403 @@ +{ + "generators": { + "address": 5, + "nonce": 0, + "mux_id": 0 + }, + "auth": [ + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "initialize", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "create_schedule", + "args": [ + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + }, + { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + }, + { + "i128": "100000" + }, + { + "u64": "0" + }, + { + "u64": "0" + }, + { + "u64": "1000" + }, + { + "bool": true + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [ + [ + "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + { + "function": { + "contract_fn": { + "contract_address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "function_name": "revoke", + "args": [ + { + "u32": 0 + } + ] + } + }, + "sub_invocations": [] + } + ] + ], + [], + [] + ], + "ledger": { + "protocol_version": 25, + "sequence_number": 0, + "timestamp": 500, + "network_id": "0000000000000000000000000000000000000000000000000000000000000000", + "base_reserve": 0, + "min_persistent_entry_ttl": 4096, + "min_temp_entry_ttl": 16, + "max_entry_ttl": 6312000, + "ledger_entries": [ + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "801925984706572462" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6311999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM", + "key": { + "ledger_key_nonce": { + "nonce": "1033654523790656264" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6311999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": { + "vec": [ + { + "symbol": "Schedule" + }, + { + "u32": 0 + } + ] + }, + "durability": "persistent", + "val": { + "map": [ + { + "key": { + "symbol": "beneficiary" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + } + }, + { + "key": { + "symbol": "cliff" + }, + "val": { + "u64": "0" + } + }, + { + "key": { + "symbol": "end" + }, + "val": { + "u64": "1000" + } + }, + { + "key": { + "symbol": "id" + }, + "val": { + "u32": 0 + } + }, + { + "key": { + "symbol": "released" + }, + "val": { + "i128": "50000" + } + }, + { + "key": { + "symbol": "revocable" + }, + "val": { + "bool": true + } + }, + { + "key": { + "symbol": "revoked" + }, + "val": { + "bool": true + } + }, + { + "key": { + "symbol": "start" + }, + "val": { + "u64": "0" + } + }, + { + "key": { + "symbol": "token" + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M" + } + }, + { + "key": { + "symbol": "total_amount" + }, + "val": { + "i128": "100000" + } + } + ] + } + } + }, + "ext": "v0" + }, + "live_until": 1728000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "vec": [ + { + "symbol": "Admin" + } + ] + }, + "val": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + } + }, + { + "key": { + "vec": [ + { + "symbol": "Counter" + } + ] + }, + "val": { + "u32": 1 + } + }, + { + "key": { + "vec": [ + { + "symbol": "Version" + } + ] + }, + "val": { + "u32": 1 + } + } + ] + } + } + } + }, + "ext": "v0" + }, + "live_until": 1728000 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAHK3M", + "key": "ledger_key_contract_instance", + "durability": "persistent", + "val": { + "contract_instance": { + "executable": { + "wasm": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + "storage": [ + { + "key": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAD2KM" + }, + "val": { + "i128": "50000" + } + }, + { + "key": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAFCT4" + }, + "val": { + "i128": "0" + } + }, + { + "key": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4" + }, + "val": { + "i128": "900000" + } + }, + { + "key": { + "address": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAK3IM" + }, + "val": { + "i128": "50000" + } + } + ] + } + } + } + }, + "ext": "v0" + }, + "live_until": 4095 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_data": { + "ext": "v0", + "contract": "CAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAITA4", + "key": { + "ledger_key_nonce": { + "nonce": "5541220902715666415" + } + }, + "durability": "temporary", + "val": "void" + } + }, + "ext": "v0" + }, + "live_until": 6311999 + }, + { + "entry": { + "last_modified_ledger_seq": 0, + "data": { + "contract_code": { + "ext": "v0", + "hash": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", + "code": "" + } + }, + "ext": "v0" + }, + "live_until": 1728000 + } + ] + }, + "events": [] +} \ No newline at end of file