-
Notifications
You must be signed in to change notification settings - Fork 20
#295 iterative execution #332
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
Changes from 1 commit
90a4e56
143913b
16c9bff
f2c0303
57f3b53
3369f67
af721bb
e512bb8
8dc5e29
8dce2a5
cef8f21
1bf8383
9672438
2d42b73
ac2755c
3519c61
bf313a2
3093fcc
e3c4e33
9b57e53
ccffcf4
4d685db
6f63338
4546926
7befc6b
b5010f8
5ebf76a
b464b1e
79088c6
52173a0
4fe15e9
607e74e
d9f762a
842ec7d
78de121
47cf219
0eebc1f
cec7a38
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -379,21 +379,21 @@ def call_signed_with_holder_combined(self): | |
|
|
||
| def create_accounts_for_trx_if_needed(self): | ||
| if len(self.create_acc_trx.instructions): | ||
|
||
| logger.debug('create_accounts_for_trx') | ||
|
||
| precall_txs = Transaction() | ||
| precall_txs.add(self.create_acc_trx) | ||
| self.sender.send_measured_transaction(precall_txs, self.eth_trx, 'CreateAccountsForTrx') | ||
|
|
||
|
|
||
| def write_trx_to_holder_account(self): | ||
| logger.debug('write_trx_to_holder_account') | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does it really need here with no a context or it's rather a spam
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yep |
||
| msg = self.eth_trx.signature() + len(self.eth_trx.unsigned_msg()).to_bytes(8, byteorder="little") + self.eth_trx.unsigned_msg() | ||
|
|
||
| # Write transaction to transaction holder account | ||
| offset = 0 | ||
| receipts = [] | ||
| rest = msg | ||
| while len(rest): | ||
| (part, rest) = (rest[:1000], rest[1000:]) | ||
| # logger.debug("sender_sol %s %s %s", sender_sol, holder, acc.public_key()) | ||
| trx = self.instruction.make_write_transaction(offset, part) | ||
| receipts.append(self.sender.send_transaction_unconfirmed(trx)) | ||
| offset += len(part) | ||
|
|
@@ -461,7 +461,7 @@ def call_cancel(self): | |
|
|
||
|
|
||
| def call_continue_bucked(self, instruction_type): | ||
|
||
| logger.debug("Send bucked combined:") | ||
| logger.debug("Send bucked combined: %s", instruction_type) | ||
|
||
| steps = self.steps | ||
|
|
||
| addition_count = 0 | ||
|
||
|
|
@@ -471,21 +471,20 @@ def call_continue_bucked(self, instruction_type): | |
| addition_count = 1 | ||
|
|
||
| receipts = [] | ||
| for index in range(math.ceil(self.steps_emulated/steps) + addition_count): | ||
| for index in range(math.ceil(self.steps_emulated/self.steps) + addition_count): | ||
| try: | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This method is too heave, you can isolate some logically independent parts |
||
|
|
||
| trx = Transaction() | ||
| if instruction_type == CONTINUE_REGULAR: | ||
| trx = self.instruction.make_continue_instruction(steps, index) | ||
| elif instruction_type == CONTINUE_COMBINED: | ||
| trx = self.instruction.make_partial_call_or_continue_transaction(steps - index) | ||
| elif instruction_type == CONTINUE_HOLDER_COMB: | ||
| trx = self.instruction.make_partial_call_or_continue_from_account_data(steps, index) | ||
| else: | ||
| raise Exception("Unknown contionue type: {}".format(instruction_type)) | ||
| raise Exception("Unknown continue type: {}".format(instruction_type)) | ||
|
||
|
|
||
| result = self.sender.send_transaction_unconfirmed(trx) | ||
| receipts.append(result) | ||
| except Exception as err: | ||
| receipts.append(self.sender.send_transaction_unconfirmed(trx)) | ||
| except SendTransactionError as err: | ||
| logger.debug(str(err)) | ||
|
||
| if str(err).startswith("Transaction simulation failed: Error processing Instruction 0: custom program error: 0x1"): | ||
|
||
| pass | ||
|
|
@@ -495,6 +494,12 @@ def call_continue_bucked(self, instruction_type): | |
| steps = int(steps * 90 / 100) | ||
| else: | ||
| raise | ||
| except Exception as err: | ||
| logger.debug(str(err)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. f"Failed to call continue bucked, error: {err}"
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. fixed |
||
| if str(err).startswith('failed to get recent blockhash'): | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another one "umbrella" - |
||
| pass | ||
| else: | ||
| raise | ||
|
|
||
| return self.collect_bucked_results(receipts, instruction_type) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just
create_accounts_for_trxThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed