From abe885d7edddbd8528fe7e0d0cd0db590ce9dedb Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Wed, 18 Oct 2023 15:44:03 -0400 Subject: [PATCH] fix: update RPC types --- cmd/soroban-cli/src/commands/contract/extend.rs | 4 ++-- cmd/soroban-cli/src/commands/contract/read.rs | 4 ++-- cmd/soroban-cli/src/rpc/mod.rs | 10 +++++----- .../internal/test/simulate_transaction_test.go | 4 ++-- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/cmd/soroban-cli/src/commands/contract/extend.rs b/cmd/soroban-cli/src/commands/contract/extend.rs index 1cd5deea8..265b70f36 100644 --- a/cmd/soroban-cli/src/commands/contract/extend.rs +++ b/cmd/soroban-cli/src/commands/contract/extend.rs @@ -91,7 +91,7 @@ impl Cmd { if self.expiration_ledger_only { println!("{expiration_ledger_seq}"); } else { - println!("New expiration ledger: {expiration_ledger_seq}"); + println!("New ttl ledger: {expiration_ledger_seq}"); } Ok(()) @@ -175,7 +175,7 @@ impl Cmd { if operations[0].changes.is_empty() { let entry = client.get_full_ledger_entries(&keys).await?; - let expire = entry.entries[0].expiration_ledger_seq; + let expire = entry.entries[0].live_until_ledger_seq; if entry.latest_ledger + i64::from(extend_to) < i64::from(expire) { return Ok(expire); } diff --git a/cmd/soroban-cli/src/commands/contract/read.rs b/cmd/soroban-cli/src/commands/contract/read.rs index 4c47f8887..5a891c560 100644 --- a/cmd/soroban-cli/src/commands/contract/read.rs +++ b/cmd/soroban-cli/src/commands/contract/read.rs @@ -119,7 +119,7 @@ impl Cmd { .filter(|(k, _v)| keys.contains(k)) .map(|(key, (v, expiration))| { Ok(FullLedgerEntry { - expiration_ledger_seq: expiration.unwrap_or_default(), + live_until_ledger_seq: expiration.unwrap_or_default(), last_modified_ledger: latest_ledger, key, val: v.data, @@ -141,7 +141,7 @@ impl Cmd { for FullLedgerEntry { key, val, - expiration_ledger_seq, + live_until_ledger_seq: expiration_ledger_seq, last_modified_ledger, } in &entries.entries { diff --git a/cmd/soroban-cli/src/rpc/mod.rs b/cmd/soroban-cli/src/rpc/mod.rs index 4a3b3a355..7ce612fef 100644 --- a/cmd/soroban-cli/src/rpc/mod.rs +++ b/cmd/soroban-cli/src/rpc/mod.rs @@ -154,12 +154,12 @@ pub struct LedgerEntryResult { )] pub last_modified_ledger: u32, #[serde( - rename = "expirationLedgerSeq", + rename = "liveUntilLedgerSeqLedgerSeq", skip_serializing_if = "Option::is_none", deserialize_with = "deserialize_option_number_from_string", default )] - pub expiration_ledger_seq: Option, + pub live_until_ledger_seq_ledger_seq: Option, } #[derive(serde::Deserialize, serde::Serialize, Debug)] @@ -435,7 +435,7 @@ pub struct FullLedgerEntry { pub key: LedgerKey, pub val: LedgerEntryData, pub last_modified_ledger: u32, - pub expiration_ledger_seq: u32, + pub live_until_ledger_seq: u32, } #[derive(Debug)] @@ -794,12 +794,12 @@ soroban config identity fund {address} --helper-url "# key, xdr, last_modified_ledger, - expiration_ledger_seq, + live_until_ledger_seq_ledger_seq, }| { Ok(FullLedgerEntry { key: LedgerKey::from_xdr_base64(key)?, val: LedgerEntryData::from_xdr_base64(xdr)?, - expiration_ledger_seq: expiration_ledger_seq.unwrap_or_default(), + live_until_ledger_seq: live_until_ledger_seq_ledger_seq.unwrap_or_default(), last_modified_ledger: *last_modified_ledger, }) }, diff --git a/cmd/soroban-rpc/internal/test/simulate_transaction_test.go b/cmd/soroban-rpc/internal/test/simulate_transaction_test.go index 47f3de192..d73cba8bb 100644 --- a/cmd/soroban-rpc/internal/test/simulate_transaction_test.go +++ b/cmd/soroban-rpc/internal/test/simulate_transaction_test.go @@ -246,7 +246,7 @@ func TestSimulateTransactionSucceeds(t *testing.T) { assert.Equal(t, expectedTransactionData.Resources.Footprint, transactionData.Resources.Footprint) assert.InDelta(t, uint32(expectedTransactionData.Resources.Instructions), uint32(transactionData.Resources.Instructions), 200000) assert.InDelta(t, uint32(expectedTransactionData.Resources.ReadBytes), uint32(transactionData.Resources.ReadBytes), 10) - assert.InDelta(t, uint32(expectedTransactionData.Resources.WriteBytes), uint32(transactionData.Resources.WriteBytes), 100) + assert.InDelta(t, uint32(expectedTransactionData.Resources.WriteBytes), uint32(transactionData.Resources.WriteBytes), 300) assert.InDelta(t, int64(expectedTransactionData.ResourceFee), int64(transactionData.ResourceFee), 1000) // Then decode and check the result xdr, separately so we get a decent diff if it fails. @@ -1122,7 +1122,7 @@ func TestSimulateSystemEvent(t *testing.T) { require.NoError(t, err) assert.InDelta(t, 7260, uint32(transactionData.Resources.ReadBytes), 200) - assert.InDelta(t, 98339, int64(transactionData.ResourceFee), 10) + assert.InDelta(t, 98339, int64(transactionData.ResourceFee), 2000) assert.InDelta(t, 104, uint32(transactionData.Resources.WriteBytes), 15) require.GreaterOrEqual(t, len(response.Events), 3) }