Skip to content

Releases: starkware-libs/cairo-lang

v0.11.0-pre

22 Feb 14:53
Compare
Choose a tag to compare
v0.11.0-pre Pre-release
Pre-release

Starknet:

  • Initial support of Cairo1.0 contracts:
    • New declare transaction version for declaring Cairo1.0 contracts
    • Only a few syscalls are currently supported.
  • Changes to on-chain data format. Include the Cairo1.0 declared classes and changes to the class hash of a given contract instance. See more information here
  • Support for Poseidon hash

Cairo:

  • New builtins:
    • Poseidon hash function (efficient, STARK-friendly hash function)
    • Keccak hash function (currently, the keccak builtin cannot be used in Starknet)

v0.10.3

05 Dec 08:49
Compare
Choose a tag to compare

StarkNet:

  • Performance - Separate the state commitment computation from the execution of the transactions
  • Add starknet-class-hash command to compute the class hash of a compiled StarkNet contract

Cairo:

  • Autoformatter: Automatically break lines inside expressions

v0.10.3-pre

29 Nov 14:41
Compare
Choose a tag to compare
v0.10.3-pre Pre-release
Pre-release

StarkNet:

  • Performance - Separate the state commitment computation from the execution of the transactions
  • Add starknet-class-hash command to compute the class hash of a compiled StarkNet contract

Cairo:

  • Autoformatter: Automatically break lines inside expressions

v0.10.2

17 Nov 03:21
Compare
Choose a tag to compare

StarkNet:

  • Sequencing performance improvements
  • Builtin ratio changes, which affects builtin costs
  • Add estimate_fee_bulk API that computes the fee of multiple transactions that will be executed consecutively

v0.10.2-pre

09 Nov 12:22
Compare
Choose a tag to compare
v0.10.2-pre Pre-release
Pre-release

StarkNet:

  • Sequencing performance improvements
  • Builtin ratio changes, which affects builtin costs
  • Add estimate_fee_bulk API that computes the fee of multiple transactions that will be executed consecutively

v0.10.1

18 Oct 07:04
Compare
Choose a tag to compare

StarkNet:

  • Add DeployAccount transaction (which will replace the Deploy transaction for deploying account contracts). To use it, you should first add enough funds to your account address to pay the transaction fee, and then you can invoke DeployAccount
    • Split the starknet deploy_account CLI command into starknet new_account and starknet deploy_account
    • Account contracts that are expected to be deployed this way should implement the __validate_deploy__() entry point, which should check the signature of the DeployAccount transaction
  • Improve L1 fee computation: the fee is computed according to the diff of the storage state
  • API: Remove entry_point_type field from transaction information

Cairo:

  • Add uint256_mul_div_mod to uint256.cairo

v0.10.1-pre

06 Oct 09:00
Compare
Choose a tag to compare
v0.10.1-pre Pre-release
Pre-release

StarkNet:

  • Add DeployAccount transaction (which will replace the Deploy transaction for deploying account contracts). To use it, you should first add enough funds to your account address to pay the transaction fee, and then you can invoke DeployAccount
    • Split the starknet deploy_account CLI command into starknet new_account and starknet deploy_account
    • Account contracts that are expected to be deployed this way should implement the __validate_deploy__() entry point, which should check the signature of the DeployAccount transaction
  • Improve L1 fee computation: the fee is computed according to the diff of the storage state
  • API: Remove entry_point_type field from transaction information

Cairo:

  • Add uint256_mul_div_mod to uint256.cairo

v0.10.0

05 Sep 12:32
Compare
Choose a tag to compare

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)
  • Bug fixes:

    • Fix a bug in uint256_unsigned_div_rem which allowed a malicious prover to return a wrong result. Contracts using this function or any other function which uses it (uint256_signed_div_rem or uint256_shr for the standard library) should be recompiled & redeployed with version >= 0.10.0.
    • 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

v0.10.0-pre

29 Aug 16:01
Compare
Choose a tag to compare
v0.10.0-pre Pre-release
Pre-release

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

v0.9.1

20 Jul 09:26
Compare
Choose a tag to compare
v0.9.1 Pre-release
Pre-release

StarkNet:

  • API changes:
    • Add get_block_traces API - returns all the transaction traces of a given block
    • Add a list of declared contracts in get_state_update
    • Add a 0x prefix for class hash in the API
    • Add starknet_version field for blocks (only applies to new blocks)
  • StarkNet CLI:
    • Change the default block number to pending
    • Using a wallet is the default, --no_wallet must be specified explicitly to override this
    • Deploying contracts:
      • Add deploy_contract function to the account contract created by starknet deploy_account
      • Use this function to deploy contract (unless using --no_wallet). In particular, deploy should be used after declaring the contract (it expects the contract class hash)
    • Support --dry_run to get the transaction information without signing or sending it
  • Support deploy_from_zero in the deploy syscall to deploy a contract to an address that does not depend on the deployer

Cairo:

  • Support and in if statements (if x == y and z == w). Note that at the moment other boolean combinations are not supported