Skip to content

Commit 0f295e9

Browse files
authored
#356 Use same instruction iterative as bucked (#357)
* #354 Check result for errors * #356 Continue iterative transaction step by step with same instruction type as started * #356 refactoring
1 parent 9a6f4af commit 0f295e9

File tree

2 files changed

+4
-30
lines changed

2 files changed

+4
-30
lines changed

proxy/common_neon/neon_instruction.py

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -283,30 +283,6 @@ def make_noniterative_call_transaction(self, length_before: int = 0) -> Transact
283283
return trx
284284

285285

286-
def make_continue_transaction(self, steps, index=None) -> Transaction:
287-
data = bytearray.fromhex("14") + self.collateral_pool_index_buf + steps.to_bytes(8, byteorder="little")
288-
if index:
289-
data = data + index.to_bytes(8, byteorder="little")
290-
291-
return Transaction().add(TransactionInstruction(
292-
program_id = EVM_LOADER_ID,
293-
data = data,
294-
keys = [
295-
AccountMeta(pubkey=self.storage, is_signer=False, is_writable=True),
296-
297-
AccountMeta(pubkey=self.operator_account, is_signer=True, is_writable=True),
298-
AccountMeta(pubkey=self.collateral_pool_address, is_signer=False, is_writable=True),
299-
AccountMeta(pubkey=self.operator_neon_address, is_signer=False, is_writable=True),
300-
AccountMeta(pubkey=self.caller_token, is_signer=False, is_writable=True),
301-
AccountMeta(pubkey=SYS_PROGRAM_ID, is_signer=False, is_writable=False),
302-
303-
] + self.eth_accounts + [
304-
305-
AccountMeta(pubkey=SYSVAR_INSTRUCTION_PUBKEY, is_signer=False, is_writable=False),
306-
] + obligatory_accounts
307-
))
308-
309-
310286
def make_cancel_transaction(self) -> Transaction:
311287
return Transaction().add(TransactionInstruction(
312288
program_id = EVM_LOADER_ID,

proxy/common_neon/transaction_sender.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ def call_continue_step_by_step(self):
424424
def call_continue_step(self):
425425
step_count = self.steps
426426
while step_count > 0:
427-
trx = self.instruction.make_continue_transaction(step_count)
427+
trx = self.make_combined_trx(step_count, 0)
428428

429429
logger.debug("Step count {}".format(step_count))
430430
try:
@@ -453,7 +453,7 @@ def call_continue_bucked(self):
453453
receipts = []
454454
for index in range(math.ceil(self.steps_emulated/self.steps) + self.addition_count()):
455455
try:
456-
trx = self.make_bucked_trx(steps, index)
456+
trx = self.make_combined_trx(steps, index)
457457
receipts.append(self.sender.send_transaction_unconfirmed(trx))
458458
except SendTransactionError as err:
459459
logger.error(f"Failed to call continue bucked, error: {err.result}")
@@ -488,10 +488,8 @@ def addition_count(self):
488488
return addition_count
489489

490490

491-
def make_bucked_trx(self, steps, index):
492-
if self.instruction_type == self.CONTINUE_REGULAR:
493-
return self.instruction.make_continue_transaction(steps, index)
494-
elif self.instruction_type == self.CONTINUE_COMBINED:
491+
def make_combined_trx(self, steps, index):
492+
if self.instruction_type == self.CONTINUE_COMBINED:
495493
return self.instruction.make_partial_call_or_continue_transaction(steps - index)
496494
elif self.instruction_type == self.CONTINUE_HOLDER_COMB:
497495
return self.instruction.make_partial_call_or_continue_from_account_data(steps, index)

0 commit comments

Comments
 (0)