Releases: starkware-libs/cairo-lang
Releases · starkware-libs/cairo-lang
v0.11.0-pre
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
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
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
v0.10.2-pre
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
StarkNet:
- Add
DeployAccount
transaction (which will replace theDeploy
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 invokeDeployAccount
- Split the
starknet deploy_account
CLI command intostarknet new_account
andstarknet 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 theDeployAccount
transaction
- Split the
- 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
touint256.cairo
v0.10.1-pre
StarkNet:
- Add
DeployAccount
transaction (which will replace theDeploy
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 invokeDeployAccount
- Split the
starknet deploy_account
CLI command intostarknet new_account
andstarknet 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 theDeployAccount
transaction
- Split the
- 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
touint256.cairo
v0.10.0
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
anddeclare
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.
- Split
- 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
- Add a fee field to
- New API and StarkNet CLI commands:
- API changes
- New fields in transaction trace:
validate_invocation
andfee_transfer_invocation
. get_block
andget_transaction
:- Add
nonce
andversion
fields to invoke transactions - Add L1 handler type
- Add
- New fields in transaction trace:
- 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:
andend
) - Add
()
around the condition ofif
statements - Remove the
member
keyword in structs - Change comment to use
//
instead of#
- Use
..., ap++
instead of...; ap++
in low level Cairo code
- You can use the
-
Support return types that are not tuples. For example,
func foo() -> felt
(instead offunc foo() -> (r: felt)
)- As a result, it's now mandatory to specify return types.
func foo() -> (res)
should be replaced byfunc foo() -> (res: felt)
. Thecairo-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
. Thecairo-migrate
script also fixes calls to those functions
- As a result, it's now mandatory to specify return types.
-
Support using functions as expressions
- This only applies to functions with
-> felt
signature, whoseap
change is known at compile-time (e.g., recursive functions cannot be used this way)
- This only applies to functions with
-
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
oruint256_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).
- Fix a bug in
-
Add Cairo code for the recursive STARK verifier
Technical changes:
- Move from
python3.7
topython3.9
v0.10.0-pre
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
anddeclare
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.
- Split
- 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
- Add a fee field to
- New API and StarkNet CLI commands:
- API changes
- New fields in transaction trace:
validate_invocation
andfee_transfer_invocation
. get_block
andget_transaction
:- Add
nonce
andversion
fields to invoke transactions - Add L1 handler type
- Add
- New fields in transaction trace:
- 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:
andend
) - Add
()
around the condition ofif
statements - Remove the
member
keyword in structs - Change comment to use
//
instead of#
- Use
..., ap++
instead of...; ap++
in low level Cairo code
- You can use the
- Support return types that are not tuples. For example,
func foo() -> felt
(instead offunc foo() -> (r: felt)
)- As a result, it's now mandatory to specify return types.
func foo() -> (res)
should be replaced byfunc foo() -> (res: felt)
. Thecairo-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
. Thecairo-migrate
script also fixes calls to those functions
- As a result, it's now mandatory to specify return types.
- Support using functions as expressions
- This only applies to functions with
-> felt
signature, whoseap
change is known at compile-time (e.g., recursive functions cannot be used this way)
- This only applies to functions with
- 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
topython3.9
v0.9.1
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)
- Add
- 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 bystarknet 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)
- Add
- Support
--dry_run
to get the transaction information without signing or sending it
- Change the default block number to
- 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
inif
statements (if x == y and z == w
). Note that at the moment other boolean combinations are not supported