soroban-cli icon indicating copy to clipboard operation
soroban-cli copied to clipboard

Use the network setting for max TTL extension

Open dmkozh opened this issue 1 year ago • 2 comments

During TTL extension operation ledgers_to_extend is incorrectly truncated to MAX_LEDGERS_TO_EXTEND constant. Instead, the max ledgers to extend should be read from the network config, specifically from the stateArchivalSettings.maxEntryTTL setting for the respective network. The check could probably happen on the simulation side, so it could be sufficient for CLI to simply remove the truncation code.

dmkozh avatar Feb 20 '24 20:02 dmkozh

@dmkozh Where is this network endpoint? Is it through Horizon? Currently we only use soroban-rpc. Do you suggest this should be a compile time constant?

willemneal avatar May 28 '24 13:05 willemneal

No, this is not a constant, which is the reason for the issue. You need to fetch the stateArchivalSettings ledger entry and use maxEntryTTL from it. I'm not sure if RPC provides a shortcut for that, but if you just use the getLedgerEntry API using a ledger key, then your key would be of type CONFIG_SETTING with configSettingID set to CONFIG_SETTING_STATE_ARCHIVAL.

dmkozh avatar May 28 '24 16:05 dmkozh