Releases: software-mansion/protostar
Releases · software-mansion/protostar
v0.3.2
In case of the following error: [ERROR] Protostar <VERSION> is not compatible with provided protostar.toml.
Update the protostar_version
in the protostar.toml
to your Protostar version e.g.:
["protostar.config"]
protostar_version = "0.3.2"
(This change shouldn't be necessary. We had a bug in the deployment script introduced in v0.3.1.)
Changelog
- added handling of hexadecimal values in
--inputs
and--sign
arguments in thedeploy
command, see #637 - added initial activity indicator when Protostar boots
and some internal improvements in preparation for new features to come!
v0.3.1 Minor improvements
- added
config
keyword argument todeclare
anddeploy_contract
migration cheatcodes - added
call
migration cheatcode - added
protostar_version
verification - improved feedback messages
- changed testing default target to current working directory rather than test directory
- removed
fuzz_simplification_runs
(This release includes many changes under the hood.)
v0.3.0 Fuzz testing & Migration scripts
- added fuzz testing
- added migration scripts and
migrate
command - added
declare
command - added
--report-slowest-tests
flag to thetest
command - added support for configuring required arguments in the
protostar.toml
- improved test collecting performance
- improved documentation structure
- improved testing output by adding test case execution time info
- updated
cairo-lang
version to 0.9.1 - removed
--stdout-on-success
flag - removed limitation: test file can't import a file with a constructor expecting arguments
- removed
fast-collecting
flag fromtest
command - fixed data transformer for
expect_events
cheatcode when unit testing
v0.3.0-pre-release Cairo-lang 0.9.1
Capturing named streams. (#500) * Draft waiting for fuzzing * Unfinished * Still unfinished * Still unfinished * Done * Fixed naming bug * Removed unused imports * Minor adjustments * Removed unnecessary include * Added unit tests, fixed setup bug * Simplified OutputRecorder.redirect() Co-authored-by: Marek Kaput <[email protected]> * Added redirect typing Co-authored-by: Marek Kaput <[email protected]> * Fixed typing issues Co-authored-by: Marek Kaput <[email protected]>
v0.2.6 store/load cheatcodes, QoL
- added
store
andload
cheatcodes, which modify any contract storage - added
exit-first
flag to the test command, which interrupts testing when any test fails - added
stdout-on-success
flag to thetest
command and improved handling of the standard output, which should improve debugging experience - added
fast-collecting
flag to thetest
command, which enables faster but unsafe test collecting algorithm - added
no-progress-bar
flag to thetest
command - added upgrade checker, which displays an information when a new version of the Protostar is available
- added logging execution time
- improved performance of cheatcodes using data transformer
- improved
context
hint local used by__setup__
by allowing assigning any object - fixed data transformer issues for contracts deployed in the
__setup__
function - removed
account-contract
flags from test and build commands — Protostar detects account contracts from now on
v0.2.5 fixes and resource usage info
- added resource usage information next to test case testing result
- added
--disable-hint-validation
flag to the test command - added
--account-contract
to enable compilation of contracts containing__execute__
function - improved
expect_events
cheatcode by supporting data transformation - fixed
list assignment index out of range
error - fixed freezing issue in larger projects
v0.2.5 pre-release
- added
account-contract
flag - added gas estimation per test case
- fixed performance issue in large projects
v0.2.4 declare, prepare, deploy
- added
declare
cheatcode - added
prepare
anddeploy
cheatcodes to allow using other cheatcodes to test constructors - improved
mock_call
anddeploy_contract
cheatcodes by integrating Starknet.py's data transformer - improved handling of compilation errors in test files during collecting phase
- improved
warp
androll
cheatcodes to be usable in the integration testing approach - changed
deploy_contract
to declare the contract before deploying - fixed
mock_call
not affecting calls in contracts deployed bydeploy_contract
- fixed SSL error when running
upgrade
command - minor fixes and improvements
How to upgrade Protostar
Run protostar upgrade
.
In case of issues, run the following script:
curl -L https://raw.githubusercontent.com/software-mansion/protostar/master/install.sh | bash
Example
# ...
%{
declared = declare("./src/main.cairo")
prepared = prepare(declared, {"initial_balance": 42})
start_prank(123, target_contract_address=prepared.contract_address)
deploy(prepared)
%}
# ...
src/main.cairo
%lang starknet
from starkware.cairo.common.math import assert_nn
from starkware.cairo.common.cairo_builtins import HashBuiltin
from starkware.starknet.common.syscalls import get_caller_address
@storage_var
func owner() -> (res : felt):
end
@storage_var
func balance() -> (res : felt):
end
@view
func get_owner{syscall_ptr : felt*, pedersen_ptr : HashBuiltin*, range_check_ptr}() -> (res : felt):
let (res) = owner.read()
return (res)
end
@view
func get_balance{syscall_ptr : felt*, pedersen_ptr : HashBuiltin*, range_check_ptr}() -> (
res : felt
):
let (res) = balance.read()
return (res)
end
@constructor
func constructor{syscall_ptr : felt*, pedersen_ptr : HashBuiltin*, range_check_ptr}(
initial_balance : felt
):
let (res) = get_caller_address()
balance.write(initial_balance)
owner.write(res)
return ()
end
tests/test_main.cairo
%lang starknet
from starkware.cairo.common.cairo_builtins import HashBuiltin
@contract_interface
namespace MainContract:
func get_owner() -> (res : felt):
end
func get_balance() -> (res : felt):
end
end
@external
func test_owner{syscall_ptr : felt*, range_check_ptr, pedersen_ptr : HashBuiltin*}():
alloc_locals
local contract_address : felt
%{
declared = declare("./src/main.cairo")
prepared = prepare(declared, {"initial_balance": 42})
ids.contract_address = prepared.contract_address
start_prank(123, target_contract_address=prepared.contract_address)
deploy(prepared)
%}
let (owner) = MainContract.get_owner(contract_address)
let (balance) = MainContract.get_balance(contract_address)
assert owner = 123
assert balance = 42
return ()
end
v0.2.4 pre-release `declare_contract`
@external
func test_deploy_declared_contract{syscall_ptr : felt*, range_check_ptr}():
alloc_locals
local class_hash : felt
%{
ids.class_hash = declare_contract("./tests/integration/cheatcodes/declare_contract/basic_contract.cairo").class_hash
%}
let (local calldata: felt*) = alloc()
let (contract_address) = deploy(class_hash, 42, 0, calldata)
BasicContract.increase_balance(contract_address, 12)
let (balance) = BasicContract.get_balance(contract_address)
assert balance = 12
return ()
end
v0.2.3 cairo-lang 0.9.0
- updated
cairo-lang
version to0.9.0
How to upgrade Protostar
Run protostar upgrade
.
In case of issues, run the following script:
curl -L https://raw.githubusercontent.com/software-mansion/protostar/master/install.sh | bash