Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge last changes from develop
  • Loading branch information
afalaleev committed Jan 5, 2022
commit c3894041fd06e4d17e0b2363fa0b12ad9addddab
55 changes: 14 additions & 41 deletions proxy/common_neon/transaction_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@
from .emulator_interactor import call_emulated
from .layouts import ACCOUNT_INFO_LAYOUT
from .neon_instruction import NeonInstruction
from .solana_interactor import SolanaInteractor, \
check_if_program_exceeded_instructions, check_for_errors
from ..environment import EVM_LOADER_ID
from .solana_interactor import SolanaInteractor, check_if_continue_returned, check_for_errors,\
check_if_program_exceeded_instructions, check_if_accounts_blocked, get_logs_from_reciept
from ..environment import EVM_LOADER_ID, RETRY_ON_BLOCKED
from ..plugin.eth_proto import Trx as EthTrx
from ..indexer.utils import get_trx_results

Expand Down Expand Up @@ -327,7 +327,16 @@ def call_signed_noniterative(self):
for _i in range(RETRY_ON_BLOCKED):
result = self.sender.send_measured_transaction(call_txs_05, self.eth_trx, 'CallFromRawEthereumTX')

return (get_trx_results(result["result"]), result['result']['transaction']['signatures'][0])
if check_for_errors(result):
if check_if_program_exceeded_instructions(result):
raise Exception("Program failed to complete")
elif check_if_accounts_blocked(result):
time.sleep(0.5)
continue
else:
raise Exception(json.dumps(result['meta']))
else:
return (get_trx_results(result), result['transaction']['signatures'][0])


class IterativeTransactionSender:
Expand Down Expand Up @@ -464,38 +473,12 @@ def call_continue(self):
return self.call_cancel()


def call_continue_step_by_step(self):
while True:
logger.debug("Continue iterative step:")
result = self.call_continue_step()
get_result = get_trx_results(result["result"])
if get_result is not None:
return (get_result, result['result']['transaction']['signatures'][0])


def call_continue_step(self):
step_count = self.steps
while step_count > 0:
trx = self.make_combined_trx(step_count, 0)

logger.debug("Step count {}".format(step_count))
try:
result = self.sender.send_measured_transaction(trx, self.eth_trx, self.instruction_type)
return result
except SendTransactionError as err:
if check_if_program_exceeded_instructions(err.result):
step_count = int(step_count * 90 / 100)
else:
raise
raise Exception("Can't execute even one EVM instruction")


def call_cancel(self):
trx = self.instruction.make_cancel_transaction()

logger.debug("Cancel")
result = self.sender.send_measured_transaction(trx, self.eth_trx, 'CancelWithNonce')
return (([], "0x0", 0, [], result['result']['slot']), result['result']['transaction']['signatures'][0])
return (([], "0x0", 0, [], result['slot']), result['transaction']['signatures'][0])


def send_and_confirm_continue(self, trxs: List[Transaction], none_receipts: List[str], retry_on_blocked: int = 1, step_count: int = 1) -> ContinueReturn:
Expand Down Expand Up @@ -532,7 +515,6 @@ def send_and_confirm_continue(self, trxs: List[Transaction], none_receipts: List
found_errors = True
else:
none_receipts.append(receipt)

return self.ContinueReturn(success_signature, none_receipts, logs, found_errors, try_one_step, retry_on_blocked, step_count)


Expand Down Expand Up @@ -570,12 +552,3 @@ def make_combined_trx(self, steps, index):
else:
raise Exception("Unknown continue type: {}".format(self.instruction_type))


def collect_bucked_results(self, receipts, reason):
logger.debug(f"Collected bucked results: {receipts}")
result_list = self.sender.collect_results(receipts, eth_trx=self.eth_trx, reason=reason)
for result in result_list:
self.sender.get_measurements(result)
get_result = get_trx_results(result["result"])
if get_result:
return (get_result, result['result']['transaction']['signatures'][0])
You are viewing a condensed version of this merge commit. You can view the full changes here.