aptos-core icon indicating copy to clipboard operation
aptos-core copied to clipboard

Python SDK Async Client Update

Open johnstonematt opened this issue 1 year ago • 1 comments
trafficstars

Description

Doc Strings

Updated doc strings to match the documentation in the Aptos API Spec.

New Methods for API Endpoints:

Added new methods for the following endpoints:

  • Account:
    • account_module()
    • account_modules()
  • Blocks:
    • blocks_by_height()
    • blocks_by_version()
  • Events:
    • events_by_creation_number()
    • events_by_event_handle()
  • Transactions:
    • transactions()
    • transactions_by_account()
  • View:
    • view()

Removed Code Duplication

  • Added _get and _post utility methods.
  • Removed simulate_bcs_transaction() duplication within simulate_transaction().

Gitignore

Added a couple things to the Python SDK .gitignore, namely .idea/ (for IntelliJ developers) and playground.py (a testing script).

Test Plan

There is currently no testing for the AsyncClient in the Python SDK. I would like to implement tests using Pytest in a later PR.

johnstonematt avatar Dec 13 '23 12:12 johnstonematt

⏱️ 12h 36m total CI duration on this PR
Job Cumulative Duration Recent Runs
rust-unit-tests 3h 32m 🟩🟩🟩🟩 (+2 more)
windows-build 2h 11m 🟩🟥🟩🟩🟩 (+2 more)
rust-smoke-tests 1h 32m 🟩🟩🟩
rust-lints 1h 8m 🟩🟩🟩🟩🟩 (+2 more)
execution-performance / single-node-performance 1h 🟩🟩🟩
forge-framework-upgrade-test / forge 46m 🟥🟥
check 29m 🟩🟩🟩🟩🟩 (+2 more)
forge-e2e-test / forge 28m 🟩🟩
rust-images / rust-all 18m 🟩🟩
general-lints 15m 🟩🟩🟩🟩🟩 (+2 more)
check-dynamic-deps 15m 🟩🟩🟩🟩🟩 (+2 more)
forge-compat-test / forge 14m 🟥🟥🟩
run-tests-main-branch 8m 🟩🟩
cli-e2e-tests / run-cli-tests 7m 🟥🟩
semgrep/ci 3m 🟩🟩🟩🟩🟩 (+2 more)
node-api-compatibility-tests / node-api-compatibility-tests 2m 🟩🟩
file_change_determinator 1m 🟩🟩🟩🟩🟩 (+2 more)
permission-check 42s 🟥🟥🟩🟥🟩 (+8 more)
permission-check 42s 🟥🟥🟩🟥🟩 (+8 more)
permission-check 36s 🟥🟥🟩🟥🟩 (+8 more)
permission-check 34s 🟥🟥🟩🟥🟩 (+8 more)
execution-performance / file_change_determinator 32s 🟩🟩🟩
file_change_determinator 26s 🟩🟩
execution-performance / sequential-execution-performance 22s 🟩🟩🟩
execution-performance / parallel-execution-performance 22s 🟩🟩🟩
file_change_determinator 20s 🟩🟩
permission-check 7s 🟩🟥🟩
determine-docker-build-metadata 4s 🟩🟩

🚨 2 jobs on the last run were significantly faster/slower than expected

Job Duration vs 7d avg Delta
cli-e2e-tests / run-cli-tests 7m 9m -20%
forge-e2e-test / forge 13m 19m -30%

settingsfeedbackdocs ⋅ learn more about trunk.io

trunk-io[bot] avatar Dec 13 '23 12:12 trunk-io[bot]

@johnstonematt , lemme know when I should review again. Thanks for your efforts!

davidiw avatar Jan 08 '24 13:01 davidiw

@davidiw I ran all the commands you mentioned, all of them passed except make lint which failed with 1 missing-import error in aptos_sdk/secp256k1_ecdsa.py.

I ran the test commands in the main branch as well (un-edited by my PR) and saw the same results - all passed except the missing-import error in the same file.

Let me know if you would like me to copy and paste the results of the commands.

johnstonematt avatar Jan 08 '24 13:01 johnstonematt

Forge is running suite realistic_env_max_load on 87440061de19f8a651931e4ce1dbecaa9933dfd2

github-actions[bot] avatar Jan 09 '24 12:01 github-actions[bot]

:white_check_mark: Forge suite realistic_env_max_load success on 87440061de19f8a651931e4ce1dbecaa9933dfd2

two traffics test: inner traffic : committed: 7032 txn/s, latency: 5527 ms, (p50: 5100 ms, p90: 7100 ms, p99: 12300 ms), latency samples: 3038180
two traffics test : committed: 100 txn/s, latency: 2425 ms, (p50: 2200 ms, p90: 2800 ms, p99: 8000 ms), latency samples: 1740
Latency breakdown for phase 0: ["QsBatchToPos: max: 0.210, avg: 0.198", "QsPosToProposal: max: 0.177, avg: 0.161", "ConsensusProposalToOrdered: max: 0.585, avg: 0.562", "ConsensusOrderedToCommit: max: 0.579, avg: 0.531", "ConsensusProposalToCommit: max: 1.136, avg: 1.094"]
Max round gap was 1 [limit 4] at version 1444127. Max no progress secs was 6.789915 [limit 10] at version 1444127.
Test Ok

github-actions[bot] avatar Jan 09 '24 13:01 github-actions[bot]

Forge is running suite framework_upgrade on aptos-node-v1.8.3 ==> 37929de64233558896658d5412221607eb27a944

github-actions[bot] avatar Jan 09 '24 19:01 github-actions[bot]

Forge is running suite realistic_env_max_load on 37929de64233558896658d5412221607eb27a944

github-actions[bot] avatar Jan 09 '24 19:01 github-actions[bot]

Forge is running suite compat on aptos-node-v1.8.3 ==> 37929de64233558896658d5412221607eb27a944

github-actions[bot] avatar Jan 09 '24 19:01 github-actions[bot]

:white_check_mark: Forge suite realistic_env_max_load success on 37929de64233558896658d5412221607eb27a944

two traffics test: inner traffic : committed: 7355 txn/s, latency: 5281 ms, (p50: 5100 ms, p90: 6500 ms, p99: 11100 ms), latency samples: 3170180
two traffics test : committed: 100 txn/s, latency: 2454 ms, (p50: 2300 ms, p90: 2700 ms, p99: 8600 ms), latency samples: 1840
Latency breakdown for phase 0: ["QsBatchToPos: max: 0.206, avg: 0.197", "QsPosToProposal: max: 0.157, avg: 0.152", "ConsensusProposalToOrdered: max: 0.604, avg: 0.575", "ConsensusOrderedToCommit: max: 0.532, avg: 0.504", "ConsensusProposalToCommit: max: 1.106, avg: 1.079"]
Max round gap was 1 [limit 4] at version 1569483. Max no progress secs was 4.330751 [limit 10] at version 1569483.
Test Ok

github-actions[bot] avatar Jan 09 '24 19:01 github-actions[bot]

:white_check_mark: Forge suite compat success on aptos-node-v1.8.3 ==> 37929de64233558896658d5412221607eb27a944

Compatibility test results for aptos-node-v1.8.3 ==> 37929de64233558896658d5412221607eb27a944 (PR)
1. Check liveness of validators at old version: aptos-node-v1.8.3
compatibility::simple-validator-upgrade::liveness-check : committed: 3312 txn/s, latency: 6688 ms, (p50: 6000 ms, p90: 9700 ms, p99: 20700 ms), latency samples: 178900
2. Upgrading first Validator to new version: 37929de64233558896658d5412221607eb27a944
compatibility::simple-validator-upgrade::single-validator-upgrade : committed: 1829 txn/s, latency: 15782 ms, (p50: 18600 ms, p90: 22300 ms, p99: 22600 ms), latency samples: 93280
3. Upgrading rest of first batch to new version: 37929de64233558896658d5412221607eb27a944
compatibility::simple-validator-upgrade::half-validator-upgrade : committed: 1850 txn/s, latency: 15613 ms, (p50: 18400 ms, p90: 21900 ms, p99: 22300 ms), latency samples: 92540
4. upgrading second batch to new version: 37929de64233558896658d5412221607eb27a944
compatibility::simple-validator-upgrade::rest-validator-upgrade : committed: 3247 txn/s, latency: 9778 ms, (p50: 9900 ms, p90: 18400 ms, p99: 20100 ms), latency samples: 126640
5. check swarm health
Compatibility test for aptos-node-v1.8.3 ==> 37929de64233558896658d5412221607eb27a944 passed
Test Ok

github-actions[bot] avatar Jan 09 '24 19:01 github-actions[bot]

:x: Forge suite framework_upgrade failure on aptos-node-v1.8.3 ==> 37929de64233558896658d5412221607eb27a944

Compatibility test results for aptos-node-v1.8.3 ==> 37929de64233558896658d5412221607eb27a944 (PR)
Upgrade the nodes to version: 37929de64233558896658d5412221607eb27a944
Test Failed: API error: Unknown error error sending request for url (http://aptos-node-3-validator.forge-framework-upgrade-pr-11321.svc:8080/v1/estimate_gas_price): error trying to connect: dns error: failed to lookup address information: Name or service not known

Stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: __libc_start_main
  14: <unknown>
Trailing Log Lines:
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: __libc_start_main
  14: <unknown>


Swarm logs can be found here: See fgi output for more information.
thread 'main' panicked at testsuite/forge/src/backend/k8s/swarm.rs:676:18:
called `Result::unwrap()` on an `Err` value: ApiError: namespaces "forge-framework-upgrade-pr-11321" not found: NotFound (ErrorResponse { status: "Failure", message: "namespaces \"forge-framework-upgrade-pr-11321\" not found", reason: "NotFound", code: 404 })

Caused by:
    namespaces "forge-framework-upgrade-pr-11321" not found: NotFound

Stack backtrace:
   0: <unknown>
   1: <unknown>
   2: <unknown>
   3: <unknown>
   4: <unknown>
   5: <unknown>
   6: <unknown>
   7: <unknown>
   8: <unknown>
   9: <unknown>
  10: <unknown>
  11: <unknown>
  12: <unknown>
  13: <unknown>
  14: <unknown>
  15: __libc_start_main
  16: <unknown>
stack backtrace:
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Debugging output:

github-actions[bot] avatar Jan 09 '24 19:01 github-actions[bot]