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
#239 check instruction owner
  • Loading branch information
otselnik committed Oct 21, 2021
commit 4a578333e21ffc69fa20d31799655205b22776ee
22 changes: 16 additions & 6 deletions proxy/plugin/solana_rest_api_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -452,12 +452,22 @@ def check_if_program_exceeded_instructions(err_result):


def check_if_continue_returned(result):
for inner in (result['result']['meta']['innerInstructions']):
for event in inner['instructions']:
log = base58.b58decode(event['data'])
instruction = log[:1]
if int().from_bytes(instruction, "little") == 6: # OnReturn evmInstruction code
return (True, result['result']['transaction']['signatures'][0])
tx_info = result['result']
accounts = tx_info["transaction"]["message"]["accountKeys"]
evm_loader_instructions = []

for idx, trx in enumerate(tx_info["transaction"]["message"]["instructions"]):
if accounts[trx["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
logger.debug("Result:\n%s"%json.dumps(result, indent=3))
return (True, tx_info['transaction']['signatures'][0])
return (False, ())


Expand Down