-
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
Conversation
|
|
||
|
|
||
| def create_account_with_seed_trx(self, account, seed, lamports, space): | ||
| def create_account_with_seed_trx(self, account, seed, lamports, space) -> Transaction: |
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.
- Dima, if you get started to use annotations use them on the arguments too
- Is it either
eth_account,pda_accountorassociated_token_account
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.
In my opinion, it is a good start, but for adding annotations everywhere, there should be a separate issue.
|
|
||
|
|
||
| def make_continue_instruction(self, steps, index=None) -> Transaction: | ||
| def make_continue_transaction(self, steps, index=None) -> Transaction: |
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.
The same. Annotations on arguments
| )) | ||
|
|
||
|
|
||
| def make_partial_call_or_continue_instruction(self, steps: int = 0) -> TransactionInstruction: |
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.
Annotations
|
|
||
| def make_partial_call_or_continue_instruction(self, steps: int = 0) -> TransactionInstruction: | ||
| data = bytearray.fromhex("0D") + self.collateral_pool_index_buf + steps.to_bytes(8, byteorder="little") + self.msg | ||
| return TransactionInstruction( |
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.
Isn't it better if it would be separated on two parts. The part that is passed in - is too long
instraction =
...
return instructionThere 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.
This remark could be connected to the previous definition as well
| data = bytearray.fromhex("0E") + self.collateral_pool_index_buf + steps.to_bytes(8, byteorder='little') | ||
| if index: | ||
| data = data + index.to_bytes(8, byteorder="little") | ||
| return Transaction().add(TransactionInstruction( |
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.
transaction = Transaction()
transaction.add(...)
# or extend_trx_with
# or instruction = make_continue_instruction
return transaction()| else: | ||
| raise | ||
| except Exception as err: | ||
| logger.debug(str(err)) |
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.
f"Failed to call continue bucked, error: {err}"
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.
fixed
| raise | ||
| except Exception as err: | ||
| logger.debug(str(err)) | ||
| if str(err).startswith('failed to get recent blockhash'): |
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.
Another one "umbrella" - SolanaError?
| return result['result']['transaction']['signatures'][0] | ||
|
|
||
|
|
||
| def call_continue_bucked(self, 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.
Annotations?
|
|
||
|
|
||
| def collect_bucked_results(self, receipts, reason): | ||
| logger.debug("Collect bucked results:") |
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.
It would be better to move logging up to one level because you're already logging the logic there.
logger.debug(f"Collected bucked results: {receipts}")
This method resembles just a getter with no interaction
| logger.debug("receipts %s", receipts) | ||
| result_list = self.sender.collect_results(receipts, eth_trx=self.eth_trx, reason=reason) | ||
| for result in result_list: | ||
| # self.sender.get_measurements(result) |
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.
It is not needed more
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.
Disagree
* #291 extract transaction sender class * #291 move perm accs to transaction sender * #291 fix state * #291 fix errors * #291 merge fixes * #291 refactoring * #291 move EXTRA_GAS to environment * #291 capitalize CONFIRMATION_CHECK_DELAY * #291 sort imports * #291 relative paths * #291 Should be fixed in #326 * #291 testing chnages * fix storage account check * #291 rename `trx_with_create_and_airdrop` -> `make_trx_with_create_and_airdrop` * #295 fix state * #291 iterative combined * #295 do not get measurments * #291 pull request fixes * #295 turn combined instructions ON * #295 make neon_instructions return transasactions * #291 merge fix * #295 get rid of `USE_COMBINED_START_CONTINUE` * #295 requested fixes * #295 call_continue_bucked refactoring * #295 fix * #295 leave only combined iterative transactions * #295 move constants into class * #295 refactoring Co-authored-by: sinev-valentine <[email protected]>
Returns
USE_COMBINED_START_CONTINUE=YESto CI configuration.Store
steps_executedreturned fromneon-cliemulator to use in optimized continue execution.Added 2 new strategies to
IterativeTransactionSenderclass:call_signed_iterative_combinedandcall_signed_with_holder_combinedforPartialCombinedandPartialWithHolderCombinedcorrespondingly.Iterative execution tries to calculate a count of transactions needed for eth trx execution from steps returned from the emulator and sends transactions of chosen strategy type, simultaneously to solana and then waits for response with trx execution result. If there was no execution result in transaction receipts or execution failed
IterativeTransactionSendertries to execute the transaction by sending continues one by one.