SIMD-0047

Syscall and Sysvar for last restart slot

Author: Godmode Galactus (Mango Markets) · Category: Core Protocol GitHub →

Feature Gate Status

Mainnet Active E653
Testnet Active E657
Devnet Active E726

HooKD5NC9QNxk25QuzCssB8ecrEzGt6eXEPBUxWp1LaR

TL;DR

Create a new syscall and sysvar that can be used to get the last restart slot. A new Sysvar : `SysvarLastRestartS1ot1111111111111111111111` Method signature for syscall: `fn sol_get_last_restart_slot() -> Slot`

Summary

Create a new syscall and sysvar that can be used to get the last restart slot. A new Sysvar : `SysvarLastRestartS1ot1111111111111111111111` Method signature for syscall: `fn sol_get_last_restart_slot() -> Slot`

Motivation

In Solana, when the cluster cannot reach consensus, it is currently restarted using `ledger-tool` with a hard fork on a slot. All participating nodes need to restart their validator specifying the hard fork slot. Once all nodes participating in the restart effort exceed 80% of the total stakes, the restart is successful, and the cluster continues from the hard fork slot. So hard fork is a tool to intentionally fork off the nodes not participating in the restart effort. Program developers may find it useful to know that a cluster restart has recently occurred. This information can help them prevent arbitrage and liquidation caused by outdated oracle price account states. However, the cluster's restart process takes several hours; in that time, the world can change, causing asset prices to fluctuate. As the cluster updates the state of all accounts, malicious actors could take advantage of the delay by conducting trades using outdated prices, anticipating that they will soon catch up to the actual prices of real-world assets. Knowing that cluster restart has been done recently, programs can manage these cases more appropriately.

Key Changes

  • Should be of type unsigned int 64 bits.
  • Should be indicative of when the cluster was restarted
  • Should be monotonically increasing
  • Should be less than equal to the current slot
  • Should be synchronized in the whole cluster
  • Can also be indicative of a slow block
  • The first restart slot should be 0

Impact

Programs managing time-sensitive states may upgrade to use this syscall to better manage exceptional events like restarts. We expect this change to improve the robustness of Solana's financial markets as outlined above. Programs will need to be recompiled and redeployed (upgraded) to adopt this feature. Interface changes (e.g. account inputs) are not required.

Backwards Compatibility

The programs using the new syscall could not be used on Solana version which does not implement this feature. Existing programs that do not use this feature are not impacted at all. Feature gate should be used to enable this feature when the majority of the cluster is using the required version.

Security Considerations

None