Introducing SN 0.13.6

Starknet v0.13.6

Introducing S-Two to Starknet

Enable resource counting, and temporarily disable Cairo Native

Introducing S-Two to Starknet

SN version 0.13.6 upgrade is a configuration change done to support integration by the S-Two prover. S-Two, the next generation of STARK provers, uses the Circle-STARK technology to achieve substantially better performances compared to Stone (the current prover that proves SN), as well as any other proving stack we are aware of. Compared to Stone, S-Two is supposed to give the following benefits:

  • Reduced proof time - initial measurements shows that S-Two may prove SN block with 2B L2 gas resources under three minutes, compared to around 24 minutes with Stone. This significant performance boost is essential to the long-term decentralization algorithm of SN, as it will allow a “you can push the proof to L1 if you want” finality status after only three minutes. It will also help to push L1 finality down even more in certain situations (for example, when SN is congested)
  • Significantly cheaper proving - the cost for proving a SN block with S-two is supposed to go down a factor of at least two, with significant improvements expected in future versions. Ensuring that proof generation is cheap is a must have for scaled, cheap future SN.

However, as S-Two works over a smaller field, there are some limitations on the size of traces that it can prove. These limitations will be addressed in later Stwo versions, but for S-two MVP and SN to be compatible, there are several modifications needed on SN’s end to ensure that no “unprovable” blocks are created. In addition, SN was designed with the Stone prover in mind, and much of its core tech stack is optimized for Stone. These choices are often suboptimal for Stwo. These include mostly the OS hash (Posiedon) that is optimized for Stone. Mitigating this and changing the OS hash to a Stwo-friendly one to significantly improve performance will be discussed for prioritization for future SN versions.

Enable resource counting, and temporarily disable Cairo Native

As implied from the above, S-Two actually significantly changes the relative “cost” of different builtins within Starknet with respect to each other. Cairo steps are suddenly orders of magnitude faster to prove, yet Stwo doesn’t help Posiedon at all (meaning that Poseidon, compared to Cairo-step, is suddenly more expensive). A similar phenomenon happens with another cryptographic primitive - EC_OP. This means that the number of different builtins that can fit within a specific block shifts when moving to S-Two. To support this change, we could have done one of two things:

  1. Reflect this change in the prices - i.e. close block based on L2gas, make the basic L2gas price cheaper thanks to Stwo, but increase the L2gas amount of builtins such as Posiedon and EC_OP.
  2. Leave the prices and L2gas amounts as they are, and ensure that blocks are not too large for S-Two through individual builtin counting which is decoupled from the L2gas metric. This means also disabling Cairo native, that doesn’t support individual builtin counting

We are opting for the latter, for:

  1. Avoiding surprises in pricing model of existing transactions on SN. Especially since with version 0.14 SN is planned to move to L2gas-based pricing in STRKs, and any modification to the current SN pricing would be short lived.
  2. The bounds enforced by S-Two are well above what any transaction on SN have made in the past, and thus very unlikely to be noticed in the short term. In the longer term, S-Two optimizations will remove these issues all together.
  3. Cairo native is disabled on SN mainnet anyway

This means that:

  • Prices for different use-case, as well as consumptions, are unchanged with version 0.13.6
  • Cairo Native is disabled for 0.13.6, and it will be disabled also for 0.14.0. We will re-enable Cairo native after we add to it more features around resource counting (tentatively over the second half of Q3)