Skip to content
Merged
Show file tree
Hide file tree
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
Fix after merge develop
  • Loading branch information
afalaleev committed Jan 6, 2022
commit dd8e52a84821e85416b78b5c79e9234ec094b36b
20 changes: 0 additions & 20 deletions proxy/common_neon/solana_interactor.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,26 +341,6 @@ def check_if_storage_is_empty_error(receipt):
return False


def check_if_continue_returned(result):
tx_info = result
accounts = tx_info["transaction"]["message"]["accountKeys"]
evm_loader_instructions = []

for idx, instruction in enumerate(tx_info["transaction"]["message"]["instructions"]):
if accounts[instruction["programIdIndex"]] == EVM_LOADER_ID:
evm_loader_instructions.append(idx)

for inner in (tx_info['meta']['innerInstructions']):
if inner["index"] in evm_loader_instructions:
for event in inner['instructions']:
if accounts[event['programIdIndex']] == EVM_LOADER_ID:
instruction = base58.b58decode(event['data'])[:1]
if int().from_bytes(instruction, "little") == 6: # OnReturn evmInstruction code
return tx_info['transaction']['signatures'][0]

return None


def get_logs_from_reciept(receipt):
log_from_reciept = get_from_dict(receipt, 'result', 'meta', 'logMessages')
if log_from_reciept is not None:
Expand Down
19 changes: 11 additions & 8 deletions proxy/common_neon/transaction_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from .emulator_interactor import call_emulated
from .layouts import ACCOUNT_INFO_LAYOUT
from .neon_instruction import NeonInstruction
from .solana_interactor import SolanaInteractor, check_if_continue_returned, check_for_errors,\
from .solana_interactor import SolanaInteractor, 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
Expand Down Expand Up @@ -345,8 +345,9 @@ class IterativeTransactionSender:
CONTINUE_HOLDER_COMB = 'ExecuteTrxFromAccountDataIterativeOrContinue'

class ContinueReturn:
def __init__(self, success_signature, none_receipts, logs, found_errors, try_one_step, retry_on_blocked, step_count):
def __init__(self, success_signature, got_result, none_receipts, logs, found_errors, try_one_step, retry_on_blocked, step_count):
self.success_signature = success_signature
self.got_result = got_result
self.none_receipts = none_receipts
self.logs = logs
self.found_errors = found_errors
Expand Down Expand Up @@ -433,7 +434,7 @@ def call_continue(self):
continue_result = self.send_and_confirm_continue(trxs, none_receipts)

if continue_result.success_signature is not None:
return continue_result.success_signature
return (continue_result.got_result, continue_result.success_signature)
none_receipts = continue_result.none_receipts
logs += continue_result.logs
found_errors = continue_result.found_errors or found_errors
Expand All @@ -449,7 +450,7 @@ def call_continue(self):
continue_result = self.send_and_confirm_continue([trx], none_receipts, retry_on_blocked, step_count)

if continue_result.success_signature is not None:
return continue_result.success_signature
return (continue_result.got_result, continue_result.success_signature)
none_receipts = continue_result.none_receipts
logs += continue_result.logs
found_errors = continue_result.found_errors or found_errors
Expand Down Expand Up @@ -486,6 +487,7 @@ def send_and_confirm_continue(self, trxs: List[Transaction], none_receipts: List
try_one_step = False
logs = []
success_signature = None
success_got_result = None

receipts = self.sender.send_multiple_transactions_unconfirmed(trxs)
receipts += none_receipts
Expand All @@ -498,9 +500,10 @@ def send_and_confirm_continue(self, trxs: List[Transaction], none_receipts: List
if not check_error(result):
self.success_steps += 1
self.sender.get_measurements(result)
signature = check_if_continue_returned(result)
if signature is not None:
success_signature = signature
got_result = get_trx_results(result)
if got_result is not None:
success_signature = result['transaction']['signatures'][0]
success_got_result = got_result
elif check_if_accounts_blocked(result):
logger.debug("Blocked account")
retry_on_blocked -= 1
Expand All @@ -515,7 +518,7 @@ 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)
return self.ContinueReturn(success_signature, success_got_result, none_receipts, logs, found_errors, try_one_step, retry_on_blocked, step_count)


def steps_count(self):
Expand Down