Skip to content

Instantly share code, notes, and snippets.

@dtmrc
dtmrc / gist:a816563a96e374fb3722e13e4becbc9f
Created December 25, 2023 18:26 — forked from jdaviderb/gist:9773aedc2c7aaf83653295c4c95ebec3
How solana calculate Clock::get()?.unix_timestamp;
> It's strongly desired by some users to have a network-controlled best effort timestamp associated with the production time of each block. One such example is https://en.bitcoin.it/wiki/Block_timestamp
>
> Some important properties of this timestamp are:
>
> 1. Drift of no worse than a couple hours from the actual block production time
> 2. Replaying the ledger at a later time results in the same block production time
> 3. The block production time is not controlled by a single centralized oracle, but ideally is a function that uses inputs from all validators
>
> A rough proposal would be to require validators to submit their current UTC time every N minutes. A median time is then constructed from the latest submission and block times are then computed as `last_median_time + slot_offset * 400ms` until the next median time is constructed.
>
@dtmrc
dtmrc / README.md
Created February 13, 2024 18:27 — forked from pythoninthegrass/README.md
sysctl.conf stand-in on macOS 10.15+

com.startup.sysctl.plist

As of at least macOS Catalina 10.15.3, /etc/sysctl.conf values are no longer respected and/or the file straight up doesn't exist (confirmed on macOS Monterey 12.4.)

Ran across a fio shm error: failed to setup shm segment while benchmarking SSDs. The fix was to set shmmni to 4096. The following has to happen:

  • Disable SIP
    • Disclaimer from Apple

      Warning

      Disable SIP only temporarily to perform necessary tasks, and reenable it as soon as possible. Failure to reenable SIP when you are done testing leaves your computer vulnerable to malicious code.