Skip to content

Commit

Permalink
fix timestamp test (#454)
Browse files Browse the repository at this point in the history
* fix timestamp test

* Update test_transaction_step_from_account.py
  • Loading branch information
kristinaNikolaevaa authored Nov 18, 2024
1 parent fa4bcef commit ba03fc4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion contracts/common/Block.sol
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ contract BlockTimestamp {

function addDataToMapping(uint256 _value1, uint256 _value2) public {
uint256 currentTimestamp = block.timestamp % 1000000;
for (uint256 i = 0; i < 5; i++) {
for (uint256 i = 0; i < 20; i++) {
Data memory newData = Data({
value1: _value1,
value2: _value2
Expand Down
27 changes: 10 additions & 17 deletions integration/tests/neon_evm/test_transaction_step_from_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -873,18 +873,6 @@ def test_trx_steps_with_number_timestamp(
operator_balance_pubkey = evm_loader.get_operator_balance_pubkey(operator_keypair)
evm_loader.write_transaction_to_holder_account(signed_tx, holder, operator_keypair)

def send_transaction_steps_for_holder(accounts):
resp = evm_loader.send_transaction_step_from_account(
operator_keypair,
operator_balance_pubkey,
treasury_pool,
holder,
accounts,
EVM_STEPS,
operator_keypair,
)
return resp

def get_account_override(eth_account):
sender_address = eth_account.eth_address.hex()
sender_account_info = neon_api_client.get_balance(sender_address)["value"][0]
Expand All @@ -904,7 +892,15 @@ def make_trace_config(block_params, overrides):

# State of the sender account should be fetched before the first iteration.
sender_overrides = get_account_override(sender_with_tokens)
send_transaction_steps_for_holder(initial_accounts)
evm_loader.send_transaction_step_from_account(
operator_keypair,
operator_balance_pubkey,
treasury_pool,
holder,
initial_accounts,
EVM_STEPS,
operator_keypair,
)

# Fetch block params after the first iteration as stored in the holder.
block_params = get_block_params()
Expand All @@ -920,11 +916,8 @@ def make_trace_config(block_params, overrides):

# Fetch new account list that depends on the re-emulation.
new_accounts = [Pubkey.from_string(item["pubkey"]) for item in emulate_result["solana_accounts"]]
evm_loader.execute_transaction_steps_from_account(operator_keypair,treasury_pool,holder,new_accounts)

# Run the rest of iterations with the new account list.
send_transaction_steps_for_holder(new_accounts)
send_transaction_steps_for_holder(new_accounts)
send_transaction_steps_for_holder(new_accounts)

check_holder_account_tag(holder, FINALIZED_STORAGE_ACCOUNT_INFO_LAYOUT, TAG_FINALIZED_STATE)

Expand Down

0 comments on commit ba03fc4

Please sign in to comment.