Code Monkey home page Code Monkey logo

ape-starknet's People

Contributors

antazoey avatar ca11ab1e avatar dtdang avatar tserg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ape-starknet's Issues

Support loading devnet state from path

Overview

Support the --load-path LOAD_PATH flag argument in the starknet-devnet subprocess for local network.

Specification

  • The user can save a state file (JSON?) and use the config starknet: local: state: path/to/file and have it always use that state when starting.
  • When using the networks context manager, the user can set chain state in the provider_settings kwarg to allow loading the starknet devnet provider from a state.
  • When the user calls provider.update_settings() with new state, the process gets restarted with that new state.

Dependencies

Include links to any open issues that must be resolved before this feature can be implemented.

Declare command timeout

Environment information

  • ape and plugin versions:
$ ape --version
# 0.4.0

$ ape plugins list
# Installed Plugins:
  starknet    0.4.0a0
  solidity    0.4.0
  hardhat     0.4.0
  cairo       0.4.0a0
  • Python Version:Python 3.9.13
  • OS: linux

What went wrong?

Please include information like:

  • When provider.declare() command is used ServerDisconnectedError: Server disconnected error is received. If I use declare for different contract with lesser LOC, there is no problem. Timeout default value should be increased for contracts with high loc.

    def declare(name: str) -> int:
        project = ape.project.get_contract(contract)
        return project.provider.declare(project).class_hash
    
Output:
self = <aiohttp.client_proto.ResponseHandler object at 0x7f30ca3b42e0>

    async def read(self) -> _T:
        if not self._buffer and not self._eof:
            assert not self._waiter
            self._waiter = self._loop.create_future()
            try:
               await self._waiter
               aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected

../../.cache/pypoetry/virtualenvs/sithswap-jcoMElJJ-py3.9/lib/python3.9/site-packages/aiohttp/streams.py:616: ServerDisconnectedError
INFO     starknet_stdout_subprocessProviderLogger:providers.py:1064 b'[2022-08-22 11:37:25 +0300] [28700] [INFO] 127.0.0.1 - - [22/Aug/2022:11:37:25 +0300] "GET / HTTP/1.1" 404 232 "-" "Python-urllib/3.9"\n'
INFO     starknet_stdout_subprocessProviderLogger:providers.py:1064 b'[2022-08-22 11:37:38 +0300] [28700] [INFO] 127.0.0.1 - - [22/Aug/2022:11:37:38 +0300] "GET / HTTP/1.1" 404 232 "-" "Python-urllib/3.9"\n'
INFO     starknet_stdout_subprocessProviderLogger:providers.py:1064 b'[2022-08-22 11:38:10 +0300] [28647] [CRITICAL] WORKER TIMEOUT (pid:28700)\n'
INFO     starknet_stdout_subprocessProviderLogger:providers.py:1054 * Listening on http://127.0.0.1:8545/ (Press CTRL+C to quit)
===================================================== short test summary info =====================================================
ERROR tests/cairo/test_SithSwapV1Factory.py::test_factory - aiohttp.client_exceptions.ServerDisconnectedError: Server disconnected

How can it be fixed?

Fill this in if you have ideas on how the bug could be fixed.

Can accidentally lose freshly deployed accounts

Overview

If you spend ages deploying an account and mess up or accidentally close out of the part with the password prompt, the account was just deployed for no reason. This could be bad!

Specification

  • Show account address ASAP in the deploy process
  • Prompt for the passphrase before deploying and get everything squared away earlier on. That way, if you create an account, you can close the shell and the account will still get created in the background.

It is safer and more async!

Dependencies

Include links to any open issues that must be resolved before this feature can be implemented.

[CI] Wrong ape-starknet version installed?

Looking at the latest CI run, I can read the the installed ape-starknet version is 0.1.dev1+gf849c33-.

Here are revelant logs:

Building wheels for collected packages: starknet.py, ape-starknet
  # (...)
  Building wheel for ape-starknet (pyproject.toml): started
  Building wheel for ape-starknet (pyproject.toml): finished with status 'done'
  Created wheel for ape-starknet: filename=ape_starknet-0.1.dev1+gf849c33-py3-none-any.whl size=33633 sha256=8728d8ff2469eeecfae43c74eb4e255a1bc392d315bb3d4c13a93731595af0b2
  Stored in directory: /home/runner/.cache/pip/wheels/6e/5e/74/d0e00c28c149775ac95ac0aa8f31b4a1c2c3596935addaa008
Successfully built starknet.py ape-starknet

Use the mypy configuration file

Overview

There are lots of type: ignore comments in imports.

Would you be interested in a PR to create the mypy configuration file to skip that specific check?

Specification

Here is the minimal mypy.ini file:

[mypy]
ignore_missing_imports = true

And a complete example (my preference):

[mypy]
# Ensure we know what we do
warn_redundant_casts = true
warn_unused_ignores = true
warn_unused_configs = true
# warn_unreachable = true  (to check)

# Imports management
ignore_missing_imports = true
follow_imports = normal

Dependencies

None.

L1 <> L2 Communication support

Overview

Show how to do L1 <> L2 communication using plugin

Specification

  • Write that test that calls a method in Starknet contract send_message_to_l1(). Go through the full flow to get the message consumed.
  • Do the opposite! Send a message to the Starknet Ethereum contract and have it consumed on the Starknet side.
  • Document the flow!

Dependencies

Lib tools to use: https://starknetpy.readthedocs.io/en/latest/messages.html

Understanding of the flow: https://www.slideshare.net/TinaBregovi/starknet-l1l2-messaging-workshop

Issues with event logs

Environment information

  • ape and plugin versions:
$ ape --version
0.3.4

$ ape plugins list
Installed Plugins:
  cairo       0.3.0a1
  starknet    commit 573ffec279b513154a2240e8cae9720f082c1309
  • Python Version: 3.9.13
  • OS: linux

What went wrong?

Transaction event logs are not accurate regarding 2 aspects.

The code demonstrating issues can be found on PR #49 to ease the process.

For the next lines, let's say we have such a receipt (it's the one from the token_contract.transfer(...) PR call):

receipt = {
    "contract_address": "0x689B5912B28116e838e391ad6fAA2b6B739006691aA78373d96dB4AE310cfE3",
    "block_number": 1,
    "data": b"",
    "events": [
        {
            "from_address": 3168006825980949969250163460867888544633008708955342843088143995484769986594,
            "keys": [271746229759260285552388728919865295615886751538523744128730118297934206697],
            "data": [
                2957188269200184411255999937111091253445605066208535325081986593780030033891,
                593601037788204467271687388622907973095701257945468643371780138908223826245,
                10,
                0,
            ],
        },
        {
            "from_address": 3168006825980949969250163460867888544633008708955342843088143995484769986594,
            "keys": [1495344490136071460114920061035658809061971367051424659723723519153313545494],
            "data": [
                2957188269200184411255999937111091253445605066208535325081986593780030033891,
                1000000000000000000000,
                0,
                10,
                0,
                593601037788204467271687388622907973095701257945468643371780138908223826245,
            ],
        },
    ],
    "required_confirmations": 0,
    "status": 4,
    "transaction_hash": "0x049d789622108a9358e7971cecac6c2ac804af74c64a427c72fe9ac0ffd90fc9",
    "value": 0,
    "type": 3,
    "block_hash": "0x042f3bcd0af625683b06c9da4614865b71cd5462e4e5ededbde8a182af75e9e0",
    "actual_fee": 0,
    "entry_point_selector": 617075754465154585683856897856256838130216341506379215893724690153393808813,
    "max_fee": 0,
    "return_value": 1,
}

And we want to get all Transfer logs from that receipt:

logs = list(receipt.decode_logs(token_contract.Transfer))

Let's display event arguments:

>>> for idx, log in enumerate(logs, 1):
...    print(idx, log.event_arguments)
1 {'from_': 2957188269200184411255999937111091253445605066208535325081986593780030033891, 'to': 593601037788204467271687388622907973095701257945468643371780138908223826245, 'value': 10}
2 {'from_': 2957188269200184411255999937111091253445605066208535325081986593780030033891, 'to': 1000000000000000000000, 'value': 0}
  • Problem 1: filtering: instead of getting 1 Transfer log, we get 2 logs (Transfer + Mint).
  • Problem 2: uint256: the handling of uint256 values is not correct (for any uint256, we should get a Tuple[int, int]).
  • Problem 3: order: I bet that's a side-effect of the problem 2 where values are non sense (see the second log to value for instance), and even the argument count is broken (Mint has 4 arguments).

How can it be fixed?

  • First, by handling correctly uint256 values, problem 2, and 3, will be gone.
  • Then, by checking how event types are compared, maybe is there a small glitch making the comparison not working somewhere.

Use `fee_token` request to get fee token address

Overview

To better handles changes to fee token in devnet, use the /fee_token request to capture the fee token addres.
Then, cache it to avoid subsequent requests.

Specification

  • Add cached property fee_token to DevnetClient
  • Have TokenManager use that request to return the address of the fee token instead of the hardcoded one.

Dependencies

Include links to any open issues that must be resolved before this feature can be implemented.

Use Ape artifact for OZ account creation

Overview

then we can delete the random _deploy() helper that is in the provider because it is a bit confusing!
Also it would be great way to showcase the SDK feature some more and show how we can include it with a plugin.

Or maybe just import the contract type dict.

Specification

  • Compile the OpenZeppelin account contract into a PackageManifest using Ape
  • Include the manifest as an artifact of the ape-starknet plugin
  • Deploy the accounts the aApe way in the Starknet accounts plugin!!!

Dependencies

Include links to any open issues that must be resolved before this feature can be implemented.

Handle Multicall Receipts

Overview

Account __execute__method can handle multiple calls but the Receipt API currently struggles with that

Specification

Describe the syntax and semantics of how you would like to see this feature implemented. The more detailed the better!

Remember, your feature is much more likely to be included if it does not involve any breaking changes.

Dependencies

Include links to any open issues that must be resolved before this feature can be implemented.

feat: struct support

Environment information

When interacting with a contract that accepts structs as inputs, I am unable to properly provide the values

What went wrong?

An example: use acc.transfer().. The result us a Uint256 struct. The failure causes transfer() (and normal contract methods) to not work.

How can it be fixed?

something something Starknet(EcosystemAPI).decode_calldata()

Wrongful re-compilation and inconsistent caching behaviors

Ape will not always see contracts that need re-compilation upon changes, this was noticed both in standalone compilation mode (single command) and also as part of ape-starknet flow for running tests, furthermore, during the latter Ape will output that relevant contracts are being re-compiled however test behavior remains unchanged until the .pytest_cache folder is deleted (signaling that Ape either A) did not correctly re-compile all contracts that needed to B) is still loading the old artifacts for running the test)

feat: expand block ID support

Overview

currently, "latest", "earliest" and negative block numbers (start from the end) do not function!

Specification

provider.get_block("latest")
provider.get_block(-1)

Dependencies

Include links to any open issues that must be resolved before this feature can be implemented.

Remove DeployTransaction

Overview

  • Remove DeployTransaction
  • Implement deploy() API methods in Ape by making an InvokeFunctionTransaction against the Universal Deployer Contract

Specification

The UDC contract method name is deployContract.
You can see its implementation inputs here: https://github.com/OpenZeppelin/cairo-contracts/blob/main/src/openzeppelin/utils/presets/UniversalDeployer.cairo#L29-L33
We should automatically craft an InvokeFunctionTransaction using this method and expected call data.
The contract address of the UDC should be hardcoded or gathered from a library.

Dependencies

Include links to any open issues that must be resolved before this feature can be implemented.

Caller address not supported in constructor.

Overview

Provide a simple overview of what you wish to see added. Please include:

  • Ape currently not supports caller address in constructor.
  • With latest cairo update, caller address is supported in constructor.

Specification

Deploying a contract with sender address fails currently.

factory = project.deploy(1,2,sender=deployer)
AccountsError: Can only call Starknet invoke transactions

Support running protostar tests

Overview

Allow to run protostar cairo tests along side ape to support diverse projects

Specification

You will likely have to copy, import, or adjust the test collector from the protostar package and have it work while also collecting the ape tests.

  • Have protostar / cairo tests run alongside normal ape tests.

Dependencies

https://github.com/software-mansion/protostar

`No content to fetch` compile error

Environment information

ape compile fails after first compile completed with No content to fetch. error.

  • ape and plugin versions:
$ ape --version
#  `0.4.4`

$ ape plugins list
Installed Plugins:
  starknet    0.4.0a0
  cairo       0.4.0a0
  solidity    0.4.0
  hardhat     0.4.1
  • Python Version: Python 3.9.13
  • OS: linux

What went wrong?

After ape compile completed, other compile commands fails.

Please include information like:

* ape compile

Traceback (most recent call last):
  File "/home/tevrat/cairo_venv/bin/ape", line 8, in <module>
    sys.exit(cli())
  File "/home/tevrat/cairo_venv/lib/python3.9/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/tevrat/cairo_venv/lib/python3.9/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/tevrat/cairo_venv/lib/python3.9/site-packages/ape/_cli.py", line 40, in invoke
    return super().invoke(ctx)
  File "/home/tevrat/cairo_venv/lib/python3.9/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/tevrat/cairo_venv/lib/python3.9/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/tevrat/cairo_venv/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/tevrat/cairo_venv/lib/python3.9/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/tevrat/cairo_venv/lib/python3.9/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/tevrat/cairo_venv/lib/python3.9/site-packages/ape_compile/_cli.py", line 53, in cli
    contract_types = cli_ctx.project_manager.load_contracts(
  File "/home/tevrat/cairo_venv/lib/python3.9/site-packages/ape/managers/project/manager.py", line 505, in load_contracts
    manifest = self._project.create_manifest(file_paths, use_cache=use_cache)
  File "/home/tevrat/cairo_venv/lib/python3.9/site-packages/ape/managers/project/types.py", line 137, in create_manifest
    needs_compiling = set(filter(does_need_compiling, source_paths))
  File "/home/tevrat/cairo_venv/lib/python3.9/site-packages/ape/managers/project/types.py", line 126, in does_need_compiling
    cached_checksum = cached_source.calculate_checksum()
  File "/home/tevrat/cairo_venv/lib/python3.9/site-packages/ethpm_types/source.py", line 143, in calculate_checksum
    content = self.fetch_content()
  File "/home/tevrat/cairo_venv/lib/python3.9/site-packages/ethpm_types/source.py", line 109, in fetch_content
    raise ValueError("No content to fetch.")
ValueError: No content to fetch.

Fill this in if you have ideas on how the bug could be fixed.

Cannot compile Cairo contracts after upgrading to latest version of ape-starknet

Environment information

  • ape and plugin versions:
$ ape --version
0.5.1

$ ape plugins list
Installed Plugins:
  starknet    0.5.0a0
  cairo       0.5.0a0

$ pip freeze | ag ape-starknet
ape-starknet==0.5.0a0
  • Python Version: 3.8.5
  • OS: Ubuntu 20.04

What went wrong?

In a brand new virtual environment, running Python 3.8.5, I installed ape-starknet using pip install ape-starknet and then installed the Cairo and StarkNet plugins with: ape plugins install starknet cairo. The last command showed an error during execution:

WARNING: Ecosystem 'starknet' is not a registered ecosystem.
INFO: Installing starknet...
SUCCESS: Plugin 'starknet==0.5.0a0' has been installed.
INFO: Installing cairo...
ERROR: ape-starknet 0.5.0a0 has requirement starknet.py==0.6.0a0, but you'll have starknet-py 0.6.1a0 which is incompatible.
SUCCESS: Plugin 'cairo==0.5.0a0' has been installed.

but the plugin appears to be successfully installed according to the output and also ape plugins list. I also noticed that there is no ape-cairo dependency inside the virtual environment following the installation of the plugin (not sure if that is an issue, but prior to this upgrade the package was installed):

$ pip freeze | ag ape
ape-starknet==0.5.0a0
eth-ape==0.5.1

Now, when I try to compile any Cairo smart contract, I get the following error:

$ ape compile contracts/Staking.cairo
INFO: Compiling 'Staking.cairo'.
Traceback (most recent call last):
  File "/home/sancho/.pyenv/versions/3.8.5/bin/ape", line 8, in <module>
    sys.exit(cli())
  File "/home/sancho/.pyenv/versions/3.8.5/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/home/sancho/.pyenv/versions/3.8.5/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/home/sancho/.pyenv/versions/3.8.5/lib/python3.8/site-packages/ape/_cli.py", line 40, in invoke
    return super().invoke(ctx)
  File "/home/sancho/.pyenv/versions/3.8.5/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/sancho/.pyenv/versions/3.8.5/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/sancho/.pyenv/versions/3.8.5/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/sancho/.pyenv/versions/3.8.5/lib/python3.8/site-packages/click/decorators.py", line 84, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/home/sancho/.pyenv/versions/3.8.5/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/home/sancho/.pyenv/versions/3.8.5/lib/python3.8/site-packages/ape_compile/_cli.py", line 53, in cli
    contract_types = cli_ctx.project_manager.load_contracts(
  File "/home/sancho/.pyenv/versions/3.8.5/lib/python3.8/site-packages/ape/managers/project/manager.py", line 501, in load_contracts
    manifest = self._project.create_manifest(file_paths, use_cache=use_cache)
  File "/home/sancho/.pyenv/versions/3.8.5/lib/python3.8/site-packages/ape/managers/project/types.py", line 159, in create_manifest
    compiled_contract_types = self.compiler_manager.compile(list(needs_compiling))
  File "/home/sancho/.pyenv/versions/3.8.5/lib/python3.8/site-packages/ape/managers/compilers.py", line 98, in compile
    compiled_contracts = self.registered_compilers[extension].compile(
  File "/home/sancho/.pyenv/versions/3.8.5/lib/python3.8/site-packages/ape_cairo/compiler.py", line 119, in compile
    source = StarknetCompilationSource(str(contract_path))
  File "/home/sancho/.pyenv/versions/3.8.5/lib/python3.8/typing.py", line 729, in __call__
    result = self.__origin__(*args, **kwargs)
  File "/home/sancho/.pyenv/versions/3.8.5/lib/python3.8/typing.py", line 339, in __call__
    raise TypeError(f"Cannot instantiate {self!r}")
TypeError: Cannot instantiate typing.Union

The same contract compiles using starknet-compile without errors.

How can it be fixed?

Traces Support

Overview

Implement show_trace() method on Receipts so that we can view pretty Starknet traces.
See this core-ape PR for Ethereum's flavor: https://github.com/ApeWorX/ape/pull/746/files

Specification

def show_trace():
   # Fetch Starknet trace and display help info, such as calls, calldata, return data, call type

See the trace schema here: https://www.starknet.io/docs/0.10.0/hello_starknet/cli.html#get-transaction-trace

Dependencies

  • Will likely have to update evm-trace to support Starknet style traces.

CI/CD is failing!

Won't release until this is fixed but it started happening once the latest cairo-lang got yanked.

bug: Cannot invoke transactions on proxy contracts

When calling methods directly from their address on contracts that are proxies, things fail.

Example common proxy contracts in this ecosystem:

  • Accounts from Argent-X are proxies.
  • The ETH ERC20 contract is a proxy.

Both have issues on mainnet regarding ABIs. The logic for InvokeTransaction makes it difficult to use ABIs from the implementation address while invoking against the proxy address.

Discussions have been occurring with the starknet.py team about this as well as we figure out what to do.
software-mansion/starknet.py#128

Optimize the plugin where possible

Overview

We all know Starknet is pretty slow currently.
Let's figure out way to optimize on our end to improve the experience.

Specification

  • Spend time finding ways to optimize
  • Fix things as we can
  • For bigger optimizations, create new tickets
  • Points-box this to 3 points to prevent ticket scope creep.

Dependencies

Include links to any open issues that must be resolved before this feature can be implemented.

Support starknet.py full node

Overview

Support full node.

Specification

When the user specifies a URI that is not testnet or mainnet, have it use a FullnodeClient from Starknet.py instead of the GatewayClient it uses currently.

The more challenging part here (with unknowns) is any potential differences that arise. Hopefully it is minimal in which case this a simple feature to support.

NOTE This will be needed for using Alchemy as a Starknet provider

Dependencies

Understanding of full node.

Review imports at the beginning of work.

Unknowns

Schema might be different vs the current returned value

Support easily adding braavos accounts the same we do for argentx

Overview

Have an enum value for the class hash so users dont have to know it

Specification

Describe the syntax and semantics of how you would like to see this feature implemented. The more detailed the better!

Remember, your feature is much more likely to be included if it does not involve any breaking changes.

Dependencies

Include links to any open issues that must be resolved before this feature can be implemented.

Unable to sign empty call data on external methods

Environment information

Latest

What went wrong?

If you have an external method with no arguments like this:

@external
func get_array{
        syscall_ptr : felt*, pedersen_ptr : HashBuiltin*,
        range_check_ptr}() -> (arr_len: felt, arr: felt*):
    const ARRAY_SIZE = 3
    let (ptr) = alloc()
    assert [ptr] = 1
    assert [ptr + 1] = 2
    assert [ptr + 2] = 3
    let (current_count) = array_get_counter.read()
    array_get_counter.write(current_count + 1)
    return (ARRAY_SIZE, ptr)
end

We are able unable to use an AccountClient to make the call.
We get an error from sign_calldata() (in Starknet.py) because we are trying to sign empty calldata.

The error does not occur if the method is @view instead of @external and it does not call if you use the normal client instead of the account client (only works on Devnet)

How can it be fixed?

  • Avoid signing empty call data somehow? Will maybe have to by-pass the signature check in Ape

Implement `get_transactions_by_block()` API

Overview

As of https://github.com/ApeWorX/ape/pull/776/files, there is a new API method to implement in the provider that should get the transactions in a block.

Specification

What have I drafted so far:

provider.py changes:

    def get_transactions_by_block(self, block_id: HexBytes) -> Iterator[TransactionAPI]:
        block = self._get_block(block_id)
        for txn in block.transactions:
            yield self.network.ecosystem.create_transaction(**txn)

Starknet ecosystem API changes:

    def create_transaction(self, **kwargs) -> TransactionAPI:
        txn_type = kwargs.pop("type", kwargs.pop("tx_type"))
        txn_cls: Union[Type[InvokeFunctionTransaction], Type[DeployTransaction]]
        if txn_type == TransactionType.INVOKE_FUNCTION:
            txn_cls = InvokeFunctionTransaction
        elif txn_type == TransactionType.DEPLOY:
            txn_cls = DeployTransaction

        txn_data = {**kwargs}
        if "max_fee" in txn_data and not isinstance(txn_data["max_fee"], int):
            txn_data["max_fee"] = self.encode_primitive_value(txn_data["max_fee"])

        if "signature" in txn_data and not isinstance(txn_data["signature"], TransactionSignature):
            txn_data["signature"] = TransactionSignature(
                v=0, r=HexBytes(txn_data["signature"][0]), s=HexBytes(txn_data["signature"][1])
            )

        # if "method_abi" not in txn_data:
        #     contract = self.chain_manager.contracts.get(txn_data["contract_address"])

        return txn_cls(**txn_data)

I believe this will require ApeWorX/ape-cairo#20

Dependencies

Include links to any open issues that must be resolved before this feature can be implemented.

Support lite-mode

Overview

Support devnet lite mode

Specification

User's can update their settings:

  • Allow settings in ape-config.yaml:
starknet:
  provider:
    local:
      lite_mode: True  # Defaults to False

Network setting for local can be set to local

And then set the CLI flag accordingly.

Could also be set via provider settings

https://github.com/Shard-Labs/starknet-devnet/blob/master/README.md#lite-mode

Dependencies

Include links to any open issues that must be resolved before this feature can be implemented.

fix block size

Environment information

Block size is not being calculated correctly.

What went wrong?

Please include information like:

  • what command you ran
  • the code that caused the failure (see this link for help with formatting code)
  • full output of the error you received

How can it be fixed?

Fill this in if you have ideas on how the bug could be fixed.

estimate_gas never gets called

Going to show how estimate gas works, noticed it was never getting called.
Bout to open A PR to fix this along with adding the explorer for betting proxy support

Support switching providers in-test

Currently, support for switching network providers "in-flight" during the execution of test code remains broken, e.g. within a test case, can't jump from interacting with a Hardhat VM contract to interacting with a (Starknet) Devnet contract, even when forcibly selecting the new provider, the previous one will still be used to interact with the Starknet network thereby failing the test run

Bug: attach Return Data to Receipts

What went wrong?

I know we want to do this in Ape too, but maybe there is an easy way to do it in Starknet without waiting.

We want return values on receipts.

How can it be fixed?

  • First check if data already present in response
  • Otherwise, seek other means (the trace?) Find the returndata somewhere!

Implement `set_balance()`

Overview

set_balance() can be implemented in the devnet provider by doing this:

   from starknet_devnet.state import state

    tx_hash = await state.starknet_wrapper.fee_token.mint(
        to_address=address, amount=amount
    )

Specification

Describe the syntax and semantics of how you would like to see this feature implemented. The more detailed the better!

Remember, your feature is much more likely to be included if it does not involve any breaking changes.

Dependencies

Include links to any open issues that must be resolved before this feature can be implemented.

Allow to estimate gas cost on the devnet

It is possible to estimate gas cost from the devnet since several versions now, maybe could we remove that condition block then?

def estimate_gas_cost(self, txn: TransactionAPI) -> int:
if self.network.name == LOCAL_NETWORK_NAME:
return self.default_gas_cost

I guess it would unlock part of our tests at SithSwap.

Note: I open an issue because I tried removing that code, and it broke all tests:

BadRequest: HTTP error ocurred. Status: 500. Text: {"message":"Error at pc=0:6:\nGot an exception while executing a hint.\nCairo traceback (most recent call last):\nUnknown location (pc=0:1324)\nUnknown location (pc=0:1301)\nUnknown location (pc=0:611)\nUnknown location (pc=0:889)\n\nTraceback (most recent call last):\n  File \"<hint0>\", line 3, in <module>\nAssertionError: assert_not_zero failed: 0 = 0.","status_code":500}

Maybe opened PRs will help, especially #46? ๐Ÿค”

Compile error, TypeError: data must be str, not Content [APE-1593]

Environment information

  • ape and plugin versions:
$ ape --version
# 0.6.26

$ ape plugins list
# Installed Plugins
  cairo       0.6.1
  starknet    0.6.0
  • Python Version: 3.9.12
  • OS: macOS

What went wrong?

Please include information like:

  • what command you ran
    ape compile

  • the code that caused the failure (see this link for help with formatting code)

if source.content:
    destination_path.parent.mkdir(parents=True, exist_ok=True)
    destination_path.touch()
    destination_path.write_text(source.content)
  • full output of the error you received
Traceback (most recent call last):
  File "/Users/usesr/Downloads/shefcraft/venv/bin/ape", line 8, in <module>
    sys.exit(cli())
  File "/Users/usesr/Downloads/shefcraft/venv/lib/python3.9/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "/Users/usesr/Downloads/shefcraft/venv/lib/python3.9/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
  File "/Users/usesr/Downloads/shefcraft/venv/lib/python3.9/site-packages/ape/_cli.py", line 37, in invoke
    return super().invoke(ctx)
  File "/Users/usesr/Downloads/shefcraft/venv/lib/python3.9/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/usesr/Downloads/shefcraft/venv/lib/python3.9/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/usesr/Downloads/shefcraft/venv/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/usesr/Downloads/shefcraft/venv/lib/python3.9/site-packages/click/decorators.py", line 92, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "/Users/usesr/Downloads/shefcraft/venv/lib/python3.9/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "/Users/usesr/Downloads/shefcraft/venv/lib/python3.9/site-packages/ape_compile/_cli.py", line 83, in cli
    contract_types = cli_ctx.project_manager.load_contracts(
  File "/Users/usesr/Downloads/shefcraft/venv/lib/python3.9/site-packages/ape/managers/project/manager.py", line 668, in load_contracts
    manifest = self.local_project.create_manifest(
  File "/Users/usesr/Downloads/shefcraft/venv/lib/python3.9/site-packages/ape/managers/project/types.py", line 179, in create_manifest
    compiled_contract_types = self._compile(project_sources)
  File "/Users/usesr/Downloads/shefcraft/venv/lib/python3.9/site-packages/ape/managers/project/types.py", line 211, in _compile
    return self.compiler_manager.compile(project_sources.sources_needing_compilation)
  File "/Users/usesr/Downloads/shefcraft/venv/lib/python3.9/site-packages/ape/managers/compilers.py", line 148, in compile
    compiled_contracts = compiler.compile(paths_to_compile, base_path=contracts_folder)
  File "/Users/usesr/Downloads/shefcraft/venv/lib/python3.9/site-packages/ape_cairo/compiler.py", line 240, in compile
    self.load_dependencies()
  File "/Users/usesr/Downloads/shefcraft/venv/lib/python3.9/site-packages/ape_cairo/compiler.py", line 226, in load_dependencies
    destination_path.write_text(source.content)
  File "/Users/usesr/opt/anaconda3/lib/python3.9/pathlib.py", line 1283, in write_text
    raise TypeError('data must be str, not %s' %
TypeError: data must be str, not Content

How can it be fixed?

file: ape_cairo/compiler.py", line 226, in load_dependencies

if source.content:
    destination_path.parent.mkdir(parents=True, exist_ok=True)
    destination_path.touch()
    destination_path.write_text(str(source.content)) # change source.content to str(source.content)

Fill this in if you have ideas on how the bug could be fixed.

Handle publish API from explorer

Overview

  • Implement publish_contract API method in the explorer.
  • Consider separating ape-voyager into its own plugin

Specification

Use this feature: https://voyager.online/verify
except programmatically, the same way as done with ape-etherscan

  • Allow publish=True on deploy
  • Allow explorer.publish_contract() to work

Dependencies

Include links to any open issues that must be resolved before this feature can be implemented.

accounts export command

Overview

Similarly to accounts in Ethereum, let's offer a private key export CLI command for starknet acounts

Specification

ape starknet accounts export <alias:>

Dependencies

Include links to any open issues that must be resolved before this feature can be implemented.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.