Skip to content

Releases: software-mansion/protostar

v0.3.2

22 Aug 13:41
Compare
Choose a tag to compare

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 the deploy 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

17 Aug 16:33
Compare
Choose a tag to compare
  • added config keyword argument to declare and deploy_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

01 Aug 15:33
Compare
Choose a tag to compare
  • added fuzz testing
  • added migration scripts and migrate command
  • added declare command
  • added --report-slowest-tests flag to the test 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 from test command
  • fixed data transformer for expect_events cheatcode when unit testing 

v0.3.0-pre-release Cairo-lang 0.9.1

25 Jul 14:37
fa36a35
Compare
Choose a tag to compare
Pre-release
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

15 Jul 09:03
Compare
Choose a tag to compare
  • added store and load 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 the test command and improved handling of the standard output, which should improve debugging experience
  • added fast-collecting flag to the test command, which enables faster but unsafe test collecting algorithm
  • added no-progress-bar flag to the test 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

01 Jul 12:00
Compare
Choose a tag to compare
  • 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

1

v0.2.5 pre-release

29 Jun 09:50
26ef982
Compare
Choose a tag to compare
v0.2.5 pre-release Pre-release
Pre-release
  • added account-contract flag
  • added gas estimation per test case
  • fixed performance issue in large projects

v0.2.4 declare, prepare, deploy

24 Jun 09:03
Compare
Choose a tag to compare
  • added declare cheatcode
  • added prepare and deploy cheatcodes to allow using other cheatcodes to test constructors
  • improved mock_call and deploy_contract cheatcodes by integrating Starknet.py's data transformer
  • improved handling of compilation errors in test files during collecting phase
  • improved warp and roll 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 by deploy_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`

15 Jun 11:44
b4bafa1
Compare
Choose a tag to compare
Pre-release
@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

08 Jun 11:49
Compare
Choose a tag to compare
  • updated cairo-lang version to 0.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