Skip to content

Conversation

@otselnik
Copy link
Contributor

@otselnik otselnik commented Nov 29, 2021

Returns USE_COMBINED_START_CONTINUE=YES to CI configuration.
Store steps_executed returned from neon-cli emulator to use in optimized continue execution.
Added 2 new strategies to IterativeTransactionSender class: call_signed_iterative_combined and call_signed_with_holder_combined for PartialCombined and PartialWithHolderCombined correspondingly.
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 IterativeTransactionSender tries to execute the transaction by sending continues one by one.



def create_account_with_seed_trx(self, account, seed, lamports, space):
def create_account_with_seed_trx(self, account, seed, lamports, space) -> Transaction:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. Dima, if you get started to use annotations use them on the arguments too
  2. Is it either eth_account, pda_account or associated_token_account

Copy link
Contributor Author

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:
Copy link
Contributor

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:
Copy link
Contributor

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(
Copy link
Contributor

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 instruction

Copy link
Contributor

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(
Copy link
Contributor

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))
Copy link
Contributor

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}"

Copy link
Contributor Author

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'):
Copy link
Contributor

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):
Copy link
Contributor

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:")
Copy link
Contributor

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)
Copy link
Contributor

@rozhkovdmitrii rozhkovdmitrii Dec 2, 2021

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disagree

@rozhkovdmitrii rozhkovdmitrii linked an issue Dec 2, 2021 that may be closed by this pull request
Base automatically changed from 291_proxy_refactoring to develop December 2, 2021 13:47
@s-medvedev s-medvedev merged commit 4045e90 into develop Dec 6, 2021
@s-medvedev s-medvedev deleted the 295_iterative_execution branch December 6, 2021 18:07
vasiliy-zaznobin pushed a commit that referenced this pull request Dec 7, 2021
* #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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add combined iterative transactions to sender class

6 participants