-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add logging for submit_exit_signatures error (#211)
- Loading branch information
1 parent
c2c013c
commit 6cecf70
Showing
8 changed files
with
101 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,39 @@ | ||
import logging | ||
|
||
from eth_typing import HexStr | ||
from web3 import Web3 | ||
|
||
from src.common.clients import execution_client | ||
from src.common.contracts import vault_contract | ||
from src.common.typings import HarvestParams | ||
from src.common.utils import format_error | ||
from src.config.networks import ETH_NETWORKS | ||
from src.config.settings import settings | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
||
async def submit_harvest_transaction(harvest_params: HarvestParams) -> None: | ||
async def submit_harvest_transaction(harvest_params: HarvestParams) -> HexStr | None: | ||
if settings.network not in ETH_NETWORKS: | ||
raise NotImplementedError('networks other than Ethereum not supported') | ||
|
||
logger.info('Submitting harvest transaction...') | ||
tx = await vault_contract.functions.updateState( | ||
( | ||
harvest_params.rewards_root, | ||
harvest_params.reward, | ||
harvest_params.unlocked_mev_reward, | ||
harvest_params.proof, | ||
) | ||
).transact() | ||
logger.info('Waiting for transaction %s confirmation', Web3.to_hex(tx)) | ||
try: | ||
tx = await vault_contract.functions.updateState( | ||
( | ||
harvest_params.rewards_root, | ||
harvest_params.reward, | ||
harvest_params.unlocked_mev_reward, | ||
harvest_params.proof, | ||
) | ||
).transact() | ||
except Exception as e: | ||
logger.error('Failed to harvest: %s', format_error(e)) | ||
if settings.verbose: | ||
logger.exception(e) | ||
return None | ||
|
||
tx_hash = Web3.to_hex(tx) | ||
logger.info('Waiting for transaction %s confirmation', tx_hash) | ||
await execution_client.eth.wait_for_transaction_receipt(tx, timeout=300) | ||
return tx_hash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters