Code Monkey home page Code Monkey logo

ape-ganache's People

Contributors

antazoey avatar bilbeyt avatar dtdang avatar fubuloubu avatar notpeopling2day avatar yaiba avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ape-ganache's Issues

incorrect mnemonic and test_accounts has no initial balance

Environment information

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

$ ape plugins list
ganache     0.4.0a1
  • Python Version: 3.9.7
  • OS: osx 12.3.1

What went wrong?

$ cat ape-config.yaml
test:
  mnemonic: test test test test test test test test test test test junk
  number_of_accounts: 5

Using ape console by ape console --network ethereum:local:ganache --verbosity DEBUG.

  1. the mnemonic ganache used to generate test_account is not what's configured in ape-config.yaml, below is the debug info when console starts:
DEBUG: HD Wallet
DEBUG: ==================
DEBUG: Mnemonic:      night crater logic spread endless aim vehicle bulb draw humble require equal
DEBUG: Base HD Path:  m/44'/60'/0'/0/{account_index}
  1. accounts.test_accounts generate from ape-config.yaml has no balance
In [1]: accounts.test_accounts[0]
Out[1]: <TestAccount 0x1e59ce931B4CFea3fe4B875411e280e173cB7A9C>

In [2]: accounts.test_accounts[0].balance
Out[2]: 0

How can it be fixed?

These two problems could be fixed by changing the ganache command line args, now it uses --wallet.seed {MNEMONIC}, which is wrong.
The correct args should be --wallet.mnemonic {MNEMONIC} --wallet.hdPath m/44'/60'/0'
Set --wallet.hdPath m/44'/60'/0' is necessary, because ganache's default is m/44'/60'/0'/0, which is different from eth-tester and ape-foundry

Contract calling another contract is not working

Environment information

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

$ ape plugins list
Installed Plugins:
  solidity    0.5.2
  ganache     0.5.0
  • Python Version: 3.10.8
  • OS: macOS

What went wrong?

I used ape test command, and i used the code like this:

request_manager.invalidateFill(request_id, FILL_ID, chain_id, sender=contracts.l1_messenger)

In which, contracts.l1_messenger and request_manager are contracts.

The output looks like this:

====================================================================================== FAILURES ======================================================================================
___________________________________________________________________ test_invalidation_before_and_after_resolution ____________________________________________________________________

self = [0xC225b4aC8C7Dd7397F4EEe919874614ECE5fE0E6, 0x5ea28528Ff26a13f0f18a9C4e554bbE54189D188, 0x83bf2F23f1A500212a78950A4a7...f28FB7a3FBF3669d64D1C1334eDf65, 0x965663E1bd56f473Efec10d5ebAF15c024101045, 0xAC3812bF4f0FbD26323b2D9e74C494421550e2d9]
account_str = '0xc9D78CD032abC6630B4845583c98eBe104e66b08'

    @__getitem__.register
    def __getitem_str(self, account_str: str):
        account_id = self.conversion_manager.convert(account_str, AddressType)

        for account in self.accounts:
            if account.address == account_id:
                return account

        can_impersonate = False
        err_message = f"No account with address '{account_id}'."
        try:
            if self.network_manager.active_provider:
>               can_impersonate = self.provider.unlock_account(account_id)

../../.virtualenvs/beamer/lib/python3.10/site-packages/ape/managers/accounts.py:92:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

args = (<ganache chain_id=1337>, '0xc9D78CD032abC6630B4845583c98eBe104e66b08'), kwargs = {}

    def inner(*args, **kwargs):
>       raise APINotImplementedError(
            f"Attempted to call method '{fn.__qualname__}', method not supported."
        )
E       ape.exceptions.APINotImplementedError: Attempted to call method 'ProviderAPI.unlock_account', method not supported.

../../.virtualenvs/beamer/lib/python3.10/site-packages/ape/utils/misc.py:255: APINotImplementedError

The above exception was the direct cause of the following exception:

contracts = Contracts(resolver=<Resolver 0x885C51DE25326436479A56CaFA9D14c57f969e8A>, fill_manager=<FillManager 0x08AfdD6a8AbA653F...0xc9D78CD032abC6630B4845583c98eBe104e66b08>, l2_messenger=<TestL2Messenger 0xd8912d0E27222d504Fc904d81e478a2be70Cd56C>)
request_manager = <RequestManager 0x268BdedEA20DeF5Cfe835B9332d2d1DF0803EBE1>

    def test_invalidation_before_and_after_resolution(contracts, request_manager):
        contracts.l1_messenger.setLastSender(contracts.resolver.address)

        address = make_address()
        request_id = RequestId(31 * b"0" + b"1")
        chain_id = ape.chain.chain_id

        assert not request_manager.isInvalidFill(request_id, FILL_ID)
>       request_manager.invalidateFill(request_id, FILL_ID, chain_id, sender=contracts.l1_messenger)

beamer/tests/contracts/test_l1_resolution.py:68:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../.virtualenvs/beamer/lib/python3.10/site-packages/ape/contracts/base.py:286: in __call__
    return contract_transaction(*function_arguments, **kwargs)
beamer/tests/conftest.py:42: in wrapper
    return func(*args, **kwargs)
../../.virtualenvs/beamer/lib/python3.10/site-packages/ape/contracts/base.py:212: in __call__
    txn = self.serialize_transaction(*args, **kwargs)
../../.virtualenvs/beamer/lib/python3.10/site-packages/ape/contracts/base.py:204: in serialize_transaction
    kwargs["sender"] = self.account_manager.test_accounts[kwargs["sender"].address]
../../.pyenv/versions/3.10.8/lib/python3.10/functools.py:926: in _method
    return method.__get__(obj, cls)(*args, **kwargs)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = [0xC225b4aC8C7Dd7397F4EEe919874614ECE5fE0E6, 0x5ea28528Ff26a13f0f18a9C4e554bbE54189D188, 0x83bf2F23f1A500212a78950A4a7...f28FB7a3FBF3669d64D1C1334eDf65, 0x965663E1bd56f473Efec10d5ebAF15c024101045, 0xAC3812bF4f0FbD26323b2D9e74C494421550e2d9]
account_str = '0xc9D78CD032abC6630B4845583c98eBe104e66b08'

    @__getitem__.register
    def __getitem_str(self, account_str: str):
        account_id = self.conversion_manager.convert(account_str, AddressType)

        for account in self.accounts:
            if account.address == account_id:
                return account

        can_impersonate = False
        err_message = f"No account with address '{account_id}'."
        try:
            if self.network_manager.active_provider:
                can_impersonate = self.provider.unlock_account(account_id)
            # else: fall through to `IndexError`
        except NotImplementedError as err:
>           raise IndexError(
                f"Your provider does not support impersonating accounts:\n{err_message}"
            ) from err
E           IndexError: Your provider does not support impersonating accounts:
E           No account with address '0xc9D78CD032abC6630B4845583c98eBe104e66b08'.

../../.virtualenvs/beamer/lib/python3.10/site-packages/ape/managers/accounts.py:95: IndexError

How can it be fixed?

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

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.