Migrating from Wake 4.x#
In version 5.0.0, a new testing EVM execution engine based on revm was introduced. This brings several breaking changes as well as new features.
Breaking changes#
Renamed symbols#
- The
default_chainalias no longer exists, usechaininstead TransactionRevertedErrorwas renamed toRevertErrorUnknownTransactionRevertedErrorwas renamed toUnknownRevertError
Dropped development chain support#
Ganache is no longer supported. Hardhat's development chain support is considered deprecated.
bytearray replaced with bytes#
All pytypes functions and dataclass attributes that represent Solidity bytes are now represented by Python bytes instead of bytearray. This affects:
- Low-level
Account.callfunction - Return value of
Account.transact random_bytesfunction- Other similar API functions
Configured accounts must be re-imported#
All accounts configured through wake accounts CLI commands must be manually deleted and imported again:
- Remove existing accounts:
wake accounts remove <alias> - Import accounts again:
wake accounts import <alias>
Removed type kwarg from functions interacting with contracts#
Transaction type can no longer be specified through the type keyword argument. Instead, the transaction type is derived automatically from the passed arguments.
New features#
revm-based execution backend#
The new execution backend with amazing performance can be used by setting the following in wake.toml:
Note: There is no JSON-RPC available for this testing backend.
Support for EIP-7702 transactions#
A new function was implemented to sign EIP-7702 authorizations:
Account.sign_authorization(
address: Account | Address | int | str,
chain_id: int | None = None,
nonce: int | None = None
) -> SignedAuthorization
All contract interaction functions now support an authorization_list: Optional[List[SignedAuthorization]] keyword argument accepting an optional list of such signed authorizations.
ExternalEvent and ExternalError API#
Events and errors originating in forked contracts are now resolved into specialized class instances when possible (i.e., when ABI is available either on Sourcify or Etherscan with an API key set).
This feature is currently only supported with revm testing chain.
ExternalEvent class:
- Provides
_event_full_nameattribute with the canonical name of the event - Other attributes named according to the event parameters in ABI
ExternalError class:
- Provides
_error_full_nameattribute with the canonical name of the error - Other attributes named according to the error parameters in ABI
Support for Trezor hardware wallets#
An Account instance may be created using a new function:
Request access list for reverting transactions#
API calls requesting EIP-2930 access lists now support:
- New
revert_on_failurekeyword argument (set toTrueby default) - Setting it to
Falseallows requesting an access list even for failing transactions
Support for Linux ARM#
ARM Linux is now supported through 3rd party nikitastupin/solc repository containing solc binaries for this platform.
pytypes_resolver for enforcing event and error resolution#
It is possible to override the resolution of events and errors for any Account using pytypes_resolver.
where IUSDT is a Solidity interface generated into pytypes.
This feature can be used to enforce user-friendly resolution of "external contracts" (e.g. forked contracts, low-level deployed contracts with init code) and in cases when implicit resolution doesn't work correctly.
pytypes_resolver must always be assigned to the Account that performs the event emit (LOGn instruction) or performs the revert. In a proxy-implementation setup, pytypes_resolver must be set on the implementation contract to correctly resolve events and errors originating from the code of the implementation contract. It may be set for the proxy as well if it defines its own events or errors.
This feature is currently only supported with revm testing chain.
EIP-712 encoded data for all structs#
All instances of structs generated in pytypes now offer two helper functions for easier debugging of signatures provided by Account.sign_structured: