soroban-cli
soroban-cli copied to clipboard
Use the network setting for max TTL extension
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 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?
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
.