Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
90a4e56
#291 extract transaction sender class
otselnik Nov 14, 2021
143913b
#291 move perm accs to transaction sender
otselnik Nov 16, 2021
16c9bff
#291 fix state
otselnik Nov 22, 2021
f2c0303
#291 fix errors
otselnik Nov 23, 2021
57f3b53
Merge remote-tracking branch 'origin/develop' into 291_proxy_refactoring
otselnik Nov 23, 2021
3369f67
#291 merge fixes
otselnik Nov 23, 2021
af721bb
#291 refactoring
otselnik Nov 23, 2021
e512bb8
#291 move EXTRA_GAS to environment
otselnik Nov 23, 2021
8dc5e29
#291 capitalize CONFIRMATION_CHECK_DELAY
otselnik Nov 23, 2021
8dce2a5
#291 sort imports
otselnik Nov 23, 2021
cef8f21
#291 relative paths
otselnik Nov 24, 2021
1bf8383
#291 Should be fixed in #326
otselnik Nov 24, 2021
9672438
#291 testing chnages
otselnik Nov 24, 2021
2d42b73
fix storage account check
sinev-valentine Nov 24, 2021
ac2755c
Merge remote-tracking branch 'origin/develop' into 291_proxy_refactoring
otselnik Nov 24, 2021
3519c61
Merge branch '371_add_FinalizedStorage_to_check' into 291_proxy_refac…
otselnik Nov 24, 2021
bf313a2
#291 rename `trx_with_create_and_airdrop` -> `make_trx_with_create_an…
otselnik Nov 24, 2021
3093fcc
Merge remote-tracking branch 'origin/develop' into 291_proxy_refactoring
otselnik Nov 24, 2021
e3c4e33
#295 fix state
otselnik Nov 24, 2021
9b57e53
#291 iterative combined
otselnik Nov 25, 2021
ccffcf4
#295 do not get measurments
otselnik Nov 25, 2021
4d685db
#291 pull request fixes
otselnik Nov 25, 2021
6f63338
Merge remote-tracking branch 'origin/develop' into 291_proxy_refactoring
otselnik Nov 25, 2021
4546926
Merge branch '291_proxy_refactoring' into 295_iterative_execution
otselnik Nov 25, 2021
7befc6b
#295 turn combined instructions ON
otselnik Nov 29, 2021
b5010f8
#295 make neon_instructions return transasactions
otselnik Nov 29, 2021
5ebf76a
Merge remote-tracking branch 'origin/develop' into 291_proxy_refactoring
otselnik Dec 2, 2021
b464b1e
#291 merge fix
otselnik Dec 2, 2021
79088c6
#295 get rid of `USE_COMBINED_START_CONTINUE`
otselnik Dec 2, 2021
52173a0
Merge branch '291_proxy_refactoring' into 295_iterative_execution
otselnik Dec 2, 2021
4fe15e9
#295 requested fixes
otselnik Dec 2, 2021
607e74e
Merge remote-tracking branch 'origin/develop' into 295_iterative_exec…
otselnik Dec 2, 2021
d9f762a
#295 call_continue_bucked refactoring
otselnik Dec 2, 2021
842ec7d
#295 fix
otselnik Dec 3, 2021
78de121
#295 leave only combined iterative transactions
otselnik Dec 3, 2021
47cf219
#295 move constants into class
otselnik Dec 3, 2021
0eebc1f
#295 refactoring
otselnik Dec 3, 2021
cec7a38
Merge remote-tracking branch 'origin/develop' into 295_iterative_exec…
otselnik Dec 6, 2021
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
#295 turn combined instructions ON
  • Loading branch information
otselnik committed Nov 29, 2021
commit 7befc6bdfa5dad3c2ccab1ee68679e253e43678a
8 changes: 4 additions & 4 deletions proxy/common_neon/neon_instruction.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,9 +384,9 @@ def make_partial_call_or_continue_instruction(self, steps: int = 0) -> Transacti
AccountMeta(pubkey=self.storage, is_signer=False, is_writable=True),

AccountMeta(pubkey=SYSVAR_INSTRUCTION_PUBKEY, is_signer=False, is_writable=False),
AccountMeta(pubkey=self.operator, is_signer=True, is_writable=True),
AccountMeta(pubkey=self.operator_pda_account, is_signer=True, is_writable=True),
AccountMeta(pubkey=self.collateral_pool_address, is_signer=False, is_writable=True),
AccountMeta(pubkey=self.operator_token, is_signer=False, is_writable=True),
AccountMeta(pubkey=self.operator_associated_token_address, is_signer=False, is_writable=True),
AccountMeta(pubkey=self.caller_token, is_signer=False, is_writable=True),
AccountMeta(pubkey=SYS_PROGRAM_ID, is_signer=False, is_writable=False),

Expand Down Expand Up @@ -415,9 +415,9 @@ def make_partial_call_or_continue_from_account_data(self, steps, index=None) ->
AccountMeta(pubkey=self.holder, is_signer=False, is_writable=True),
AccountMeta(pubkey=self.storage, is_signer=False, is_writable=True),

AccountMeta(pubkey=self.operator, is_signer=True, is_writable=True),
AccountMeta(pubkey=self.operator_pda_account, is_signer=True, is_writable=True),
AccountMeta(pubkey=self.collateral_pool_address, is_signer=False, is_writable=True),
AccountMeta(pubkey=self.operator_token, is_signer=False, is_writable=True),
AccountMeta(pubkey=self.operator_associated_token_address, is_signer=False, is_writable=True),
AccountMeta(pubkey=self.caller_token, is_signer=False, is_writable=True),
AccountMeta(pubkey=SYS_PROGRAM_ID, is_signer=False, is_writable=False),

Expand Down
23 changes: 14 additions & 9 deletions proxy/common_neon/transaction_sender.py
Original file line number Diff line number Diff line change
Expand Up @@ -379,21 +379,21 @@ def call_signed_with_holder_combined(self):

def create_accounts_for_trx_if_needed(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

Just create_accounts_for_trx

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

if len(self.create_acc_trx.instructions):
Copy link
Contributor

Choose a reason for hiding this comment

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

len = len(self.create_acc_trx.instructions)
if  len == 0 
     return

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

logger.debug('create_accounts_for_trx')
Copy link
Contributor

Choose a reason for hiding this comment

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

logger.debug(f"Create account for trx: {len}")

Copy link
Contributor

Choose a reason for hiding this comment

The 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

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

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

Choose a reason for hiding this comment

The 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

Copy link
Contributor Author

Choose a reason for hiding this comment

The 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)
Expand Down Expand Up @@ -461,7 +461,7 @@ def call_cancel(self):


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?

logger.debug("Send bucked combined:")
logger.debug("Send bucked combined: %s", 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.

f python string?

steps = self.steps

addition_count = 0
Copy link
Contributor

Choose a reason for hiding this comment

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

This block looks suspiciously, to tell you the truth

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

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

f python string?


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

Choose a reason for hiding this comment

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

logger.error(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

if str(err).startswith("Transaction simulation failed: Error processing Instruction 0: custom program error: 0x1"):
Copy link
Contributor

Choose a reason for hiding this comment

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

You should extend SolanaErrors enum with it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Need explanaition

pass
Expand All @@ -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))
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

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?

pass
else:
raise

return self.collect_bucked_results(receipts, instruction_type)

Expand Down
2 changes: 1 addition & 1 deletion proxy/run-proxy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ if [ "$CONFIG" == "ci" ]; then
[[ -z "$SOLANA_URL" ]] && export SOLANA_URL="http://solana:8899"
[[ -z "$EXTRA_GAS" ]] && export EXTRA_GAS=100000
[[ -z "$NEON_CLI_TIMEOUT" ]] && export NEON_CLI_TIMEOUT="0.5"
[[ -z "$USE_COMBINED_START_CONTINUE" ]] && export USE_COMBINED_START_CONTINUE="NO"
[[ -z "$USE_COMBINED_START_CONTINUE" ]] && export USE_COMBINED_START_CONTINUE="YES"
[[ -z "$CONTINUE_COUNT_FACTOR" ]] && export CONTINUE_COUNT_FACTOR="3"
[[ -z "$MINIMAL_GAS_PRICE" ]] && export MINIMAL_GAS_PRICE=0
[[ -z "$POSTGRES_HOST" ]] && export POSTGRES_HOST="postgres"
Expand Down