Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@pugachAG
Copy link
Contributor

No description provided.

@pugachAG pugachAG force-pushed the delayed-receipts-example-test branch 2 times, most recently from 0d7399e to 5ababd0 Compare October 26, 2025 20:22
@codecov
Copy link

codecov bot commented Oct 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 70.75%. Comparing base (6803453) to head (55f52ef).

Additional details and impacted files
@@             Coverage Diff             @@
##           master   #14481       +/-   ##
===========================================
+ Coverage   16.85%   70.75%   +53.89%     
===========================================
  Files         895      895               
  Lines      194314   194411       +97     
  Branches   194314   194411       +97     
===========================================
+ Hits        32757   137553   +104796     
+ Misses     159652    50843   -108809     
- Partials     1905     6015     +4110     
Flag Coverage Δ
pytests 0.38% <0.00%> (-0.01%) ⬇️
pytests-nightly 1.37% <0.00%> (-0.01%) ⬇️
unittests 68.73% <100.00%> (?)
unittests-nightly 68.52% <100.00%> (?)
unittests-spice 16.23% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pugachAG pugachAG requested a review from attila0x2A October 28, 2025 14:05
@pugachAG pugachAG marked this pull request as ready for review October 28, 2025 14:05
@pugachAG pugachAG requested a review from a team as a code owner October 28, 2025 14:05
Copy link
Contributor

@attila0x2A attila0x2A left a comment

Choose a reason for hiding this comment

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

I am not a big fan of examining trie - see related comment.

If there's no way around it - lgtm.

Comment on lines 88 to 104
let trie = rpc_node.trie(
env.test_loop_data(),
rpc_node.head(env.test_loop_data()).last_block_hash,
ShardId::new(0),
);
let delayed_receipt_indices: DelayedReceiptIndices =
near_store::get(&trie, &TrieKey::DelayedReceiptIndices).unwrap().unwrap();
assert_eq!(
delayed_receipt_indices,
DelayedReceiptIndices { first_index: 0, next_available_index: 1 }
);
let delayed_receipt: StateStoredReceipt = near_store::get(
&trie,
&TrieKey::DelayedReceipt { index: delayed_receipt_indices.first_index },
)
.unwrap()
.unwrap();
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if this is actionable or makes sense, but e2e tests are generally meant to test things from a user's point of view. In our case I think it's fair to assume that user is able to observe the chain, but I am not sure if it's fair to assume they can access the trie directly. Would it be possible to use some API to get required information here or maybe check that last tx finishes execution one block later? (Especially for an example: depending on internals of the trie feels a lot like depending on implementation details, which might make tests brittle generally.)

As an example this might break with spice or become flaky since last block may not have chunk extra.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is a very good point, thanks! updated in be36b5d

Copy link
Contributor

Choose a reason for hiding this comment

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

lgtm, thanks

Comment on lines +62 to +72
SignedTransaction::call(
next_nonce(),
user_account.clone(),
user_account.clone(),
&create_user_test_signer(&user_account),
Balance::ZERO,
"burn_gas_raw".to_owned(),
gas_to_burn.as_gas().to_le_bytes().to_vec(),
gas_limit,
rpc_node.head(env.test_loop_data()).last_block_hash,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

As an idea not related to this PR it might make sense to make it easier to create txs with rpc nodes (since likely rpc nodes are the ones usually used for sending txs). In that api deriving user signer, nonce and latest block hash can be automatic.

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, 100% agree, I plan adding that to test loop tooling soon

@pugachAG pugachAG force-pushed the delayed-receipts-example-test branch from 820f77d to 55f52ef Compare October 28, 2025 17:56
@pugachAG pugachAG force-pushed the delayed-receipts-example-test branch from 80e5015 to be36b5d Compare October 28, 2025 18:21
@pugachAG pugachAG requested a review from attila0x2A October 28, 2025 18:23
@pugachAG
Copy link
Contributor Author

@attila0x2A I've updated assertion logic to avoid looking into trie, could you please take another look 🙏

Comment on lines +79 to +81
pub fn block(&self, test_loop_data: &TestLoopData, block_hash: CryptoHash) -> Arc<Block> {
self.client(test_loop_data).chain.get_block(&block_hash).unwrap()
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Also not related to this PR, but it would be very good to modify existing code that doesn't use all the new helpers to use them. Maybe a good use-case for ai.
With inconsistency as is it's hard to make sure that all the new tests would use the new helpers.

@pugachAG pugachAG added this pull request to the merge queue Oct 28, 2025
Merged via the queue into master with commit dd72a7a Oct 28, 2025
25 checks passed
@pugachAG pugachAG deleted the delayed-receipts-example-test branch October 28, 2025 21:09
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.

3 participants