Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#356 Use same instruction iterative as bucked #357

Merged
merged 5 commits into from
Dec 8, 2021
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 remote-tracking branch 'origin/develop' into 356_use_same_instr…
…uction_iterative_as_bucked
otselnik committed Dec 7, 2021
commit 731ecc1b0bc5e6a1462fa44cb6eddbefe37a70ea
35 changes: 31 additions & 4 deletions proxy/common_neon/solana_interactor.py
Original file line number Diff line number Diff line change
@@ -190,8 +190,35 @@ def extract_measurements_from_receipt(receipt):
return result


def check_if_program_exceeded_instructions(err_result):
error_arr = get_from_dict(err_result, "err", "InstructionError")
def get_error_definition_from_reciept(receipt):
err_from_reciept = get_from_dict(receipt, 'result', 'meta', 'err', 'InstructionError')
if err_from_reciept is not None:
return err_from_reciept

err_from_reciept_result = get_from_dict(receipt, 'meta', 'err', 'InstructionError')
if err_from_reciept_result is not None:
return err_from_reciept_result

err_from_send_trx_error = get_from_dict(receipt, 'data', 'err', 'InstructionError')
if err_from_send_trx_error is not None:
return err_from_send_trx_error

err_from_prepared_receipt = get_from_dict(receipt, 'err', 'InstructionError')
if err_from_prepared_receipt is not None:
return err_from_prepared_receipt

return None



def check_for_errors(receipt):
if get_error_definition_from_reciept(receipt) is not None:
return True
return False


def check_if_program_exceeded_instructions(receipt):
error_arr = get_error_definition_from_reciept(receipt)
if error_arr is not None and isinstance(error_arr, list):
error_type = error_arr[1]
if isinstance(error_type, str):
@@ -202,8 +229,8 @@ def check_if_program_exceeded_instructions(err_result):
return False


def check_if_storage_is_empty_error(err_result):
error_arr = get_from_dict(err_result, "err", "InstructionError")
def check_if_storage_is_empty_error(receipt):
error_arr = get_error_definition_from_reciept(receipt)
if error_arr is not None and isinstance(error_arr, list):
error_dict = error_arr[1]
if isinstance(error_dict, dict) and 'Custom' in error_dict:
6 changes: 3 additions & 3 deletions proxy/common_neon/transaction_sender.py
Original file line number Diff line number Diff line change
@@ -323,8 +323,8 @@ def call_signed_noniterative(self):
call_txs_05.add(self.instruction.make_noniterative_call_transaction(len(call_txs_05.instructions)))
result = self.sender.send_measured_transaction(call_txs_05, self.eth_trx, 'CallFromRawEthereumTX')

if get_from_dict(result, 'result', 'meta', 'err') is not None:
if check_if_program_exceeded_instructions(result['result']['meta']):
if check_for_errors(result):
if check_if_program_exceeded_instructions(result):
raise Exception("Program failed to complete")
raise Exception(json.dumps(result['result']['meta']))

@@ -367,7 +367,7 @@ def create_accounts_for_trx(self):
precall_txs = Transaction()
precall_txs.add(self.create_acc_trx)
result = self.sender.send_measured_transaction(precall_txs, self.eth_trx, 'CreateAccountsForTrx')
if get_from_dict(result, 'result', 'meta', 'err', 'InstructionError') is not None:
if check_for_errors(result):
raise Exception("Failed to create account for trx")


You are viewing a condensed version of this merge commit. You can view the full changes here.