apeworx / ape-ganache Goto Github PK
View Code? Open in Web Editor NEWGanache network provider plugin for the Ape Framework
Home Page: https://www.apeworx.io/
License: Apache License 2.0
Ganache network provider plugin for the Ape Framework
Home Page: https://www.apeworx.io/
License: Apache License 2.0
Truffle is sunsetting their tools within the next 90 days, so we should work towards archiving this plugin and helping people migrate to others:
https://twitter.com/trufflesuite/status/1704946902393860589
ape
and plugin versions:$ ape --version
0.5.7
$ ape plugins list
Installed Plugins:
solidity 0.5.2
ganache 0.5.0
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
Fill this in if you have ideas on how the bug could be fixed.
ape
and plugin versions:$ ape --version
0.4.5
$ ape plugins list
ganache 0.4.0a1
$ 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
.
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}
accounts.test_accounts
generate from ape-config.yaml
has no balanceIn [1]: accounts.test_accounts[0]
Out[1]: <TestAccount 0x1e59ce931B4CFea3fe4B875411e280e173cB7A9C>
In [2]: accounts.test_accounts[0].balance
Out[2]: 0
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.