Semantics of min_ledger_time

I am a bit confused how I am supposed to use min_ledger_time_abs and min_ledger_time_rel.

Let’s say I have a command that takes quite a long time (relative to the skew) to interpret and I’m running on a ledger with a relatively short min and max skew (e.g. the 30s defaults is Sandbox). My command does not use getTime and I am happy for it to take a while to be recorded.

If I don’t set min_ledger_time, the submission fails because ledger time is before the allowed range. Now my understanding is that I can increase min_ledger_time_rel but if I increase it by too much my submission will fail because it is after the allowed range. Is that correct or will the submission be delayed automatically? If this is correct, does this mean that a short skew and long-running commands just don’t work with each other as it becomes increasingly hard to guess min_ledger_time_rel such that it falls within the given windows as command interpretation time increases?


Yes, that’s correct. When setting the min_ledger_time_rel you’re basically making a statement that the transaction will probably take a long time to compute upfront, and you want to give the participant enough time to finish the computation and send it to the ledger. You can set min_ledger_time_rel fairly generously, because the participant delays sending the transaction until ledger_effective_time - avg_transaction_latency.

An improvement to that (in terms of size of the time window) would be to send the transaction to the ledger at ledger_effective_time - min_skew.

Almost. With min_ledger_time_rel you give the participant more time to do the initial command interpretation. So setting min_ledger_time_rel to a value that is greater than the time it takes to interpret the command will always be beneficial (modulo contention on contracts/contract keys). If a transaction takes 10 seconds to validate but the skew window is only 5 seconds, even if you set min_ledger_time_rel to 15 seconds so that the command interpretation goes through successfully, it will actually not be processed within the permitted time window on the committer side.

In summary:

  1. There is no need to “guess” the absolute ledger time for a command submission, you can safely use min_ledger_time_rel for that.
  2. Transactions that take a long time to process and a small skew window just doesn’t work. The only chance you have for getting the transaction committed is to increase the skew window via the Config Admin Service if you happen to be an admin on the ledger.