github starkware-libs/cairo-lang v0.10.0-pre

latest releases: v0.13.2, v0.13.2a0, v0.13.1...
pre-release2 years ago

StarkNet:

  • Contract (breaking changes):
    • @external and @view functions should be imported directly by the main compiled file. Otherwise, they will not be usable as external functions
    • Forbid using the same storage variable name in two modules
  • New transaction version (version 1) for invoke and declare transactions:
    • Transactions of version 0 are deprecated and will not be supported in StarkNet from the next version (v0.11.0). Please update your systems to use the new version
    • Note that to use transactions of version 1 you will need to upgrade your account contracts
    • Add nonce field to the transactions. Nonce validation is now part of the StarkNet protocol and is enforced to be executed sequentially
    • Invoke:
      • Split __execute__ to two functions: __validate__ (only validates the transaction) and __execute__ (only executes the transaction)
      • Remove the selector (which is now always __execute__) field, following the above change.
    • Declare:
      • declare transaction should now be sent from an account (and is validated using __validate_declare__ in the account contract)
  • Support fee for sending L1 messages. At this point, it's not mandatory and messages with no fee will still be handled. Starting from the next version it will become mandatory.
    • Add a fee field to LogMessageToL2 event in the L1 Core Contract
  • New API and StarkNet CLI commands:
    • get_nonce - Returns the next expected nonce of an account contract (see here)
    • simulate_transaction - Simulates the transaction and returns the transaction trace and estimated fee (see here)
    • estimate_message_fee - Estimates the message fee (see here)
  • API changes
    • New fields in transaction trace: validate_invocation and fee_transfer_invocation.
    • get_block and get_transaction:
      • Add nonce and version fields to invoke transactions
      • Add L1 handler type
  • Onchain data:
    • Remove the contract constructor arguments
    • Add the new nonce
    • See here
  • Support the EC-op builtin. This allows doing arbitrary elliptic curve operations on the STARK-friendly curve. In particular, it is now possible to verify that an ECDSA signature fails
  • Add the solidity code of the StarkNet Core Contract to the repo
  • Refactor StarkNet code to use an abstract class called State, which provides a cleaner definition of the StarkNet state interface.

Cairo:

  • Syntax changes in Cairo (to make it more similar to rust and C++):
    • You can use the cairo-migrate script to convert old code to the new syntax. Use the -i flag to apply the changes to the files
    • End statements with ;
      • Note that new lines are still part of the language at this point, and you cannot put more than one instruction per line. This will change in Cairo1.0.
    • Use { … } for code blocks (instead of : and end)
    • Add () around the condition of if statements
    • Remove the member keyword in structs
    • Change comment to use // instead of #
    • Use ..., ap++ instead of ...; ap++ in low level Cairo code
  • Support return types that are not tuples. For example, func foo() -> felt (instead of func foo() -> (r: felt))
    • As a result, it's now mandatory to specify return types. func foo() -> (res) should be replaced by func foo() -> (res: felt). The cairo-migrate tool does that automatically.
    • Return statement accepts expressions, rather than only tuples. For example, you can write let x = (5,); return x;
    • A few standard library functions were changed to return felt. The cairo-migrate script also fixes calls to those functions
  • Support using functions as expressions
    • This only applies to functions with -> felt signature, whose ap change is known at compile-time (e.g., recursive functions cannot be used this way)
  • Fix a bug in the secp signature verification code that allowed a malicious prover to ignore the value of v (this does not let the prover fake a signature, but allows it to claim that a valid signature is invalid).
  • Add Cairo code for the recursive STARK verifier

Technical changes:

  • Move from python3.7 to python3.9

Don't miss a new cairo-lang release

NewReleases is sending notifications on new releases.