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