Skip to content
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

[transaction test] refactoring publishing flow to test_context #6529

Merged
merged 10 commits into from
Feb 23, 2023

Conversation

angieyth
Copy link
Contributor

@angieyth angieyth commented Feb 7, 2023

Description

In this PR I move some helper functions from resource_groups.rs to text_context.rs to be shared forward.

Test Plan

Test 2 modified tests to make sure they work as before
also add RUST_MIN_STACK=4297152 in the command to avoid the stack overflow error
RUST_MIN_STACK=4297152 cargo test test_read_resource_group
RUST_MIN_STACK=4297152 cargo test test_get_txn_execute_failed_by_invalid_entry_function

Here's the list of the current tests in transaction_tests.rs
https://www.notion.so/aptoslabs/2eb26689160a46379ebe0ab6327679ac?v=27ededd87b5d4e328d42c9cf8eab6dc6

@angieyth angieyth marked this pull request as draft February 7, 2023 19:54
@angieyth angieyth marked this pull request as ready for review February 7, 2023 20:07
@angieyth angieyth requested a review from areshand as a code owner February 8, 2023 23:31
@angieyth angieyth force-pushed the angie/transaction_tests branch from a45ba8e to 4591e5c Compare February 8, 2023 23:53
@angieyth angieyth requested a review from movekevin February 8, 2023 23:53
api/src/tests/resource_groups.rs Outdated Show resolved Hide resolved
api/src/tests/resource_groups.rs Outdated Show resolved Hide resolved
api/src/tests/resource_groups.rs Outdated Show resolved Hide resolved
api/src/tests/resource_groups.rs Outdated Show resolved Hide resolved
api/src/tests/transactions_test.rs Show resolved Hide resolved
api/test-context/src/test_context.rs Outdated Show resolved Hide resolved
api/test-context/src/test_context.rs Outdated Show resolved Hide resolved
@@ -815,38 +817,35 @@ async fn test_get_txn_execute_failed_by_entry_function_invalid_function_name() {
.await;
}

#[ignore] // Re-enable when change is moved to new publish flow
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
async fn test_get_txn_execute_failed_by_entry_function_execution_failure() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Are you planning to update other module publishing tests in this same PR or a separate one?

Copy link
Contributor Author

@angieyth angieyth Feb 9, 2023

Choose a reason for hiding this comment

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

I'll do that in the following PR.

@@ -288,6 +289,7 @@ dependencies = [
"aptos-types",
"aptos-vm",
"aptos-vm-validator",
"bcs 0.1.4 (git+https://github.com/aptos-labs/bcs.git?rev=d31fab9d81748e2594be5cd5cdf845786a30562d)",
Copy link
Contributor

Choose a reason for hiding this comment

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

Where did this come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure... I don't think I need this? how should I remove?

@angieyth angieyth force-pushed the angie/transaction_tests branch from c2130ee to 62ea52e Compare February 9, 2023 20:22
@angieyth
Copy link
Contributor Author

angieyth commented Feb 9, 2023

In the last commit

  1. address comments
  2. rebased and made changes on the top of [Quorum Store] Implementation of quorum store components #6055

@angieyth angieyth force-pushed the angie/transaction_tests branch from ff280da to 35d4056 Compare February 10, 2023 18:39
@@ -296,8 +295,15 @@ impl TestContext {
TransactionFactory::new(self.context.chain_id())
}

pub fn root_account(&self) -> LocalAccount {
LocalAccount::new(aptos_test_root_address(), self.root_key.private_key(), 0)
pub async fn root_account(&self) -> LocalAccount {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just avoid fetching the sequence number altogether by storing it in the test_context? This would avoid having to make this root_account function async as well.

Copy link
Contributor Author

@angieyth angieyth Feb 14, 2023

Choose a reason for hiding this comment

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

but in this way we have to make new_text_context() an async func. I think it's fine either way.

api/test-context/src/test_context.rs Outdated Show resolved Hide resolved
self.commit_mempool_txns(1).await;
account
}
pub async fn create_user_account(&self, account: &LocalAccount) -> SignedTransaction {
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this still useful if create_account already takes care of submitting the tx? Can we remove this somehow?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think it's still useful because we test different things during submitting the txn. that being said, I think we can replace some with the new create_account(). I don't want to keep growing this PR. I can do it in the following ones.

self.create_user_account_by(&mut tc, account)
}

pub fn mint_user_account(&self, account: &LocalAccount) -> SignedTransaction {
let mut tc = self.root_account();
pub async fn mint_user_account(&self, account: &LocalAccount) -> SignedTransaction {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here. This is already part of create_account now

api/test-context/src/test_context.rs Outdated Show resolved Hide resolved
api/test-context/src/test_context.rs Outdated Show resolved Hide resolved
api/test-context/src/test_context.rs Outdated Show resolved Hide resolved
account_address: &AccountAddress,
resource: &str,
) -> Option<Value> {
let request = format!("/accounts/{}/resources", account_address);
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not use the API for fetching a specific resource instead of fetching them all then filtering for the right one?

Copy link
Contributor Author

@angieyth angieyth Feb 14, 2023

Choose a reason for hiding this comment

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

If we use context.get() it throws an error when the resource doesn't exist.

self.get(&request).await
}

pub fn build_package(
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we need separate build_package and publish_package?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

it comes from #6055. In that PR the author split the function into 2, I moved those functions here.

@@ -438,18 +512,29 @@ impl TestContext {
.unwrap();
}

pub async fn get_sequence_number(&self, account: AccountAddress) -> u64 {
let account_resource = self
.api_get_account_resource(account, "0x1", "account", "Account")
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you know why we need to pass "0x1", "account", "Account" to api_get_account_resource? The account resource is always at the same path

@angieyth angieyth force-pushed the angie/transaction_tests branch from 35d4056 to 57b3c2e Compare February 15, 2023 01:08
.await;
self.commit_mempool_txns(1).await;
account
}
Copy link
Contributor

@movekevin movekevin Feb 15, 2023

Choose a reason for hiding this comment

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

nit: add an empty line in between functions

@angieyth angieyth requested a review from davidiw February 17, 2023 18:55
@@ -0,0 +1,9 @@
[package]
name = "TransactationTests"
Copy link
Contributor

Choose a reason for hiding this comment

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

TransactionTests

@gregnazario
Copy link
Contributor

Please run scripts/rust_lint.sh for formatting

@angieyth angieyth force-pushed the angie/transaction_tests branch 2 times, most recently from c4a88a7 to a1887a6 Compare February 23, 2023 17:45
@angieyth angieyth force-pushed the angie/transaction_tests branch from a1887a6 to cd9744b Compare February 23, 2023 21:57
@angieyth angieyth enabled auto-merge (squash) February 23, 2023 23:01
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link
Contributor

✅ Forge suite land_blocking success on cd9744b371a93137c3bc44f09f69d6897b823af2

performance benchmark with full nodes : 5823 TPS, 6811 ms latency, 8700 ms p99 latency,no expired txns
Test Ok

@github-actions
Copy link
Contributor

✅ Forge suite compat success on testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> cd9744b371a93137c3bc44f09f69d6897b823af2

Compatibility test results for testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> cd9744b371a93137c3bc44f09f69d6897b823af2 (PR)
1. Check liveness of validators at old version: testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b
compatibility::simple-validator-upgrade::liveness-check : 7728 TPS, 4974 ms latency, 7000 ms p99 latency,no expired txns
2. Upgrading first Validator to new version: cd9744b371a93137c3bc44f09f69d6897b823af2
compatibility::simple-validator-upgrade::single-validator-upgrade : 5058 TPS, 7862 ms latency, 10800 ms p99 latency,no expired txns
3. Upgrading rest of first batch to new version: cd9744b371a93137c3bc44f09f69d6897b823af2
compatibility::simple-validator-upgrade::half-validator-upgrade : 4701 TPS, 8413 ms latency, 10900 ms p99 latency,no expired txns
4. upgrading second batch to new version: cd9744b371a93137c3bc44f09f69d6897b823af2
compatibility::simple-validator-upgrade::rest-validator-upgrade : 6728 TPS, 5657 ms latency, 10300 ms p99 latency,no expired txns
5. check swarm health
Compatibility test for testnet_2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> cd9744b371a93137c3bc44f09f69d6897b823af2 passed
Test Ok

@angieyth angieyth merged commit 1755e84 into main Feb 23, 2023
@angieyth angieyth deleted the angie/transaction_tests branch February 23, 2023 23:48
@github-actions
Copy link
Contributor

✅ Forge suite framework_upgrade success on cb4ba0a57c998c60cbab65af31a64875d2588ca5 ==> cd9744b371a93137c3bc44f09f69d6897b823af2

Compatibility test results for cb4ba0a57c998c60cbab65af31a64875d2588ca5 ==> cd9744b371a93137c3bc44f09f69d6897b823af2 (PR)
Upgrade the nodes to version: cd9744b371a93137c3bc44f09f69d6897b823af2
framework_upgrade::framework-upgrade::full-framework-upgrade : 6600 TPS, 5730 ms latency, 9600 ms p99 latency,no expired txns
5. check swarm health
Compatibility test for cb4ba0a57c998c60cbab65af31a64875d2588ca5 ==> cd9744b371a93137c3bc44f09f69d6897b823af2 passed
Test Ok

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