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

[API] Make `enabled: false` actually disable the API

Open banool opened this issue 3 years ago • 5 comments

Description

Setting enabled: false for the API in the node config didn't actually disable the API.

Test Plan

Config:

$ cat /tmp/no_api.yaml | grep -A 1 api:
api:
  enabled: false

Full config: https://gist.github.com/banool/f9e25e8ebc13e00ece932d002cc2d949.

Invocation:

cargo run --release -p aptos -- node run-local-testnet --force-restart --config-path /tmp/no_api.yaml --assume-yes

Logs:

"api":{"enabled":false

Yet the API is still there:

$ curl 127.0.0.1:8080/v1
{"chain_id":4,"epoch":"0","ledger_version":"0","oldest_ledger_version":"0","ledger_timestamp":"0","node_role":"validator","oldest_block_height":"0","block_height":"0","git_hash":"65c05dbf1db83ee4986bec2b6676099dd4f8c24c"}

After this change though with the above repro:

$ curl 127.0.0.1:8080/v1
curl: (7) Failed to connect to 127.0.0.1 port 8080 after 6 ms: Connection refused

With enabled: true you can see the API comes back:

$ curl 127.0.0.1:8080/v1
{"chain_id":4,"epoch":"0","ledger_version":"0","oldest_ledger_version":"0","ledger_timestamp":"0","node_role":"validator","oldest_block_height":"0","block_height":"0","git_hash":"65c05dbf1db83ee4986bec2b6676099dd4f8c24c"}

This change is Reviewable

banool avatar Oct 24 '22 16:10 banool

Landing, we'll see if CI is happy with it or not.

banool avatar Oct 24 '22 16:10 banool

Forge is running suite land_blocking on 4a11456688de9a51a08bb672352c0a0faa7f30f4

github-actions[bot] avatar Oct 24 '22 17:10 github-actions[bot]

Forge is running suite compat on 2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> 4a11456688de9a51a08bb672352c0a0faa7f30f4

github-actions[bot] avatar Oct 24 '22 17:10 github-actions[bot]

:x: Forge suite land_blocking failure on 4a11456688de9a51a08bb672352c0a0faa7f30f4

Forge test runner terminated:
Trailing Log Lines:
{"level":"INFO","source":{"package":"forge","file":"testsuite/forge/src/backend/k8s/stateful_set.rs:161"},"thread_name":"main","hostname":"forge-e2e-pr-5244-1666631285-4a11456688de9a51a08bb672352c0a0faa","timestamp":"2022-10-24T17:31:23.951625Z","message":"Pod aptos-node-9-validator-0 at phase Running"}
{"level":"INFO","source":{"package":"forge","file":"testsuite/forge/src/backend/k8s/stateful_set.rs:111"},"thread_name":"main","hostname":"forge-e2e-pr-5244-1666631285-4a11456688de9a51a08bb672352c0a0faa","timestamp":"2022-10-24T17:32:23.957338Z","message":"StatefulSet aptos-node-9-validator has 0/1 replicas"}
{"level":"INFO","source":{"package":"forge","file":"testsuite/forge/src/backend/k8s/stateful_set.rs:161"},"thread_name":"main","hostname":"forge-e2e-pr-5244-1666631285-4a11456688de9a51a08bb672352c0a0faa","timestamp":"2022-10-24T17:32:23.961168Z","message":"Pod aptos-node-9-validator-0 at phase Running"}
{"level":"INFO","source":{"package":"forge","file":"testsuite/forge/src/backend/k8s/stateful_set.rs:111"},"thread_name":"main","hostname":"forge-e2e-pr-5244-1666631285-4a11456688de9a51a08bb672352c0a0faa","timestamp":"2022-10-24T17:33:23.965467Z","message":"StatefulSet aptos-node-9-validator has 0/1 replicas"}
{"level":"INFO","source":{"package":"forge","file":"testsuite/forge/src/backend/k8s/stateful_set.rs:161"},"thread_name":"main","hostname":"forge-e2e-pr-5244-1666631285-4a11456688de9a51a08bb672352c0a0faa","timestamp":"2022-10-24T17:33:23.969209Z","message":"Pod aptos-node-9-validator-0 at phase Running"}
{"level":"INFO","source":{"package":"forge","file":"testsuite/forge/src/backend/k8s/cluster_helper.rs:280"},"thread_name":"main","hostname":"forge-e2e-pr-5244-1666631285-4a11456688de9a51a08bb672352c0a0faa","timestamp":"2022-10-24T17:33:23.986487Z","message":"Deleting namespace forge-e2e-pr-5244: Some(NamespaceStatus { phase: Some(\"Terminating\") })"}
{"level":"INFO","source":{"package":"forge","file":"testsuite/forge/src/backend/k8s/cluster_helper.rs:388"},"thread_name":"main","hostname":"forge-e2e-pr-5244-1666631285-4a11456688de9a51a08bb672352c0a0faa","timestamp":"2022-10-24T17:33:23.986508Z","message":"aptos-node resources for Forge removed in namespace: forge-e2e-pr-5244"}
Failed to run tests:
Retry due to pod aptos-node-9-validator-0 status PodStatus { conditions: Some([PodCondition { last_probe_time: None, last_transition_time: Some(Time(2022-10-24T17:13:06Z)), message: None, reason: None, status: "True", type_: "Initialized" }, PodCondition { last_probe_time: None, last_transition_time: Some(Time(2022-10-24T17:13:06Z)), message: Some("containers with unready status: [validator]"), reason: Some("ContainersNotReady"), status: "False", type_: "Ready" }, PodCondition { last_probe_time: None, last_transition_time: Some(Time(2022-10-24T17:13:06Z)), message: Some("containers with unready status: [validator]"), reason: Some("ContainersNotReady"), status: "False", type_: "ContainersReady" }, PodCondition { last_probe_time: None, last_transition_time: Some(Time(2022-10-24T17:13:06Z)), message: None, reason: None, status: "True", type_: "PodScheduled" }]), container_statuses: Some([ContainerStatus { container_id: Some("docker://a4d7ace39b37aacc5d0f9268ca64b687b95fde5ae34c1ecd06f5fdaba33a74b4"), image: "323143817725.dkr.ecr.us-west-2.amazonaws.com/aptos/validator:4a11456688de9a51a08bb672352c0a0faa7f30f4", image_id: "docker-pullable://323143817725.dkr.ecr.us-west-2.amazonaws.com/aptos/validator@sha256:61de5974c1e3590b3990792c556c676637a59f45d8ee83515c060580ecf904bf", last_state: Some(ContainerState { running: None, terminated: None, waiting: None }), name: "validator", ready: false, restart_count: 0, state: Some(ContainerState { running: Some(ContainerStateRunning { started_at: Some(Time(2022-10-24T17:14:38Z)) }), terminated: None, waiting: None }) }]), host_ip: Some("192.168.58.18"), init_container_statuses: None, message: None, nominated_node_name: None, phase: Some("Running"), pod_ip: Some("192.168.125.242"), qos_class: Some("Guaranteed"), reason: None, start_time: Some(Time(2022-10-24T17:13:06Z)) }
Error: Retry due to pod aptos-node-9-validator-0 status PodStatus { conditions: Some([PodCondition { last_probe_time: None, last_transition_time: Some(Time(2022-10-24T17:13:06Z)), message: None, reason: None, status: "True", type_: "Initialized" }, PodCondition { last_probe_time: None, last_transition_time: Some(Time(2022-10-24T17:13:06Z)), message: Some("containers with unready status: [validator]"), reason: Some("ContainersNotReady"), status: "False", type_: "Ready" }, PodCondition { last_probe_time: None, last_transition_time: Some(Time(2022-10-24T17:13:06Z)), message: Some("containers with unready status: [validator]"), reason: Some("ContainersNotReady"), status: "False", type_: "ContainersReady" }, PodCondition { last_probe_time: None, last_transition_time: Some(Time(2022-10-24T17:13:06Z)), message: None, reason: None, status: "True", type_: "PodScheduled" }]), container_statuses: Some([ContainerStatus { container_id: Some("docker://a4d7ace39b37aacc5d0f9268ca64b687b95fde5ae34c1ecd06f5fdaba33a74b4"), image: "323143817725.dkr.ecr.us-west-2.amazonaws.com/aptos/validator:4a11456688de9a51a08bb672352c0a0faa7f30f4", image_id: "docker-pullable://323143817725.dkr.ecr.us-west-2.amazonaws.com/aptos/validator@sha256:61de5974c1e3590b3990792c556c676637a59f45d8ee83515c060580ecf904bf", last_state: Some(ContainerState { running: None, terminated: None, waiting: None }), name: "validator", ready: false, restart_count: 0, state: Some(ContainerState { running: Some(ContainerStateRunning { started_at: Some(Time(2022-10-24T17:14:38Z)) }), terminated: None, waiting: None }) }]), host_ip: Some("192.168.58.18"), init_container_statuses: None, message: None, nominated_node_name: None, phase: Some("Running"), pod_ip: Some("192.168.125.242"), qos_class: Some("Guaranteed"), reason: None, start_time: Some(Time(2022-10-24T17:13:06Z)) }
Debugging output:
NAME                                    READY   STATUS      RESTARTS   AGE
aptos-node-0-fullnode-eforge224-0       0/1     Running     0          22m
aptos-node-0-validator-0                0/1     Running     0          22m
aptos-node-1-fullnode-eforge224-0       0/1     Running     0          22m
aptos-node-1-validator-0                0/1     Running     0          22m
aptos-node-10-validator-0               0/1     Running     0          22m
aptos-node-11-validator-0               0/1     Running     0          22m
aptos-node-12-validator-0               0/1     Running     0          22m
aptos-node-13-validator-0               0/1     Running     0          22m
aptos-node-14-validator-0               0/1     Running     0          22m
aptos-node-15-validator-0               0/1     Running     0          22m
aptos-node-16-validator-0               0/1     Running     0          22m
aptos-node-17-validator-0               0/1     Running     0          22m
aptos-node-18-validator-0               0/1     Running     0          22m
aptos-node-19-validator-0               0/1     Running     0          22m
aptos-node-2-fullnode-eforge224-0       0/1     Running     0          22m
aptos-node-2-validator-0                0/1     Running     0          22m
aptos-node-3-fullnode-eforge224-0       0/1     Running     0          22m
aptos-node-3-validator-0                0/1     Running     0          22m
aptos-node-4-fullnode-eforge224-0       0/1     Running     0          22m
aptos-node-4-validator-0                0/1     Running     0          22m
aptos-node-5-fullnode-eforge224-0       0/1     Running     0          22m
aptos-node-5-validator-0                0/1     Running     0          22m
aptos-node-6-fullnode-eforge224-0       0/1     Running     0          22m
aptos-node-6-validator-0                0/1     Running     0          22m
aptos-node-7-fullnode-eforge224-0       0/1     Running     0          22m
aptos-node-7-validator-0                0/1     Running     0          22m
aptos-node-8-fullnode-eforge224-0       0/1     Running     0          22m
aptos-node-8-validator-0                0/1     Running     0          22m
aptos-node-9-fullnode-eforge224-0       0/1     Running     0          22m
aptos-node-9-validator-0                0/1     Running     0          22m
genesis-aptos-genesis-eforge224-6psqg   0/1     Completed   0          24m

github-actions[bot] avatar Oct 24 '22 17:10 github-actions[bot]

:x: Forge suite compat failure on 2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> 4a11456688de9a51a08bb672352c0a0faa7f30f4

Forge test runner terminated:
Trailing Log Lines:
{"level":"INFO","source":{"package":"forge","file":"testsuite/forge/src/backend/k8s/stateful_set.rs:161"},"thread_name":"main","hostname":"forge-compat-pr-5244-1666631302-2d8b1b57553d869190f61df1aaf7f31","timestamp":"2022-10-24T17:32:01.359338Z","message":"Pod aptos-node-4-validator-0 at phase Running"}
{"level":"INFO","source":{"package":"forge","file":"testsuite/forge/src/backend/k8s/stateful_set.rs:111"},"thread_name":"main","hostname":"forge-compat-pr-5244-1666631302-2d8b1b57553d869190f61df1aaf7f31","timestamp":"2022-10-24T17:33:01.364895Z","message":"StatefulSet aptos-node-4-validator has 0/1 replicas"}
{"level":"INFO","source":{"package":"forge","file":"testsuite/forge/src/backend/k8s/stateful_set.rs:161"},"thread_name":"main","hostname":"forge-compat-pr-5244-1666631302-2d8b1b57553d869190f61df1aaf7f31","timestamp":"2022-10-24T17:33:01.369083Z","message":"Pod aptos-node-4-validator-0 at phase Running"}
{"level":"INFO","source":{"package":"forge","file":"testsuite/forge/src/backend/k8s/stateful_set.rs:111"},"thread_name":"main","hostname":"forge-compat-pr-5244-1666631302-2d8b1b57553d869190f61df1aaf7f31","timestamp":"2022-10-24T17:34:01.374698Z","message":"StatefulSet aptos-node-4-validator has 0/1 replicas"}
{"level":"INFO","source":{"package":"forge","file":"testsuite/forge/src/backend/k8s/stateful_set.rs:161"},"thread_name":"main","hostname":"forge-compat-pr-5244-1666631302-2d8b1b57553d869190f61df1aaf7f31","timestamp":"2022-10-24T17:34:01.378003Z","message":"Pod aptos-node-4-validator-0 at phase Running"}
{"level":"INFO","source":{"package":"forge","file":"testsuite/forge/src/backend/k8s/cluster_helper.rs:280"},"thread_name":"main","hostname":"forge-compat-pr-5244-1666631302-2d8b1b57553d869190f61df1aaf7f31","timestamp":"2022-10-24T17:34:01.399121Z","message":"Deleting namespace forge-compat-pr-5244: Some(NamespaceStatus { phase: Some(\"Terminating\") })"}
{"level":"INFO","source":{"package":"forge","file":"testsuite/forge/src/backend/k8s/cluster_helper.rs:388"},"thread_name":"main","hostname":"forge-compat-pr-5244-1666631302-2d8b1b57553d869190f61df1aaf7f31","timestamp":"2022-10-24T17:34:01.399151Z","message":"aptos-node resources for Forge removed in namespace: forge-compat-pr-5244"}
Failed to run tests:
Retry due to pod aptos-node-4-validator-0 status PodStatus { conditions: Some([PodCondition { last_probe_time: None, last_transition_time: Some(Time(2022-10-24T17:13:23Z)), message: None, reason: None, status: "True", type_: "Initialized" }, PodCondition { last_probe_time: None, last_transition_time: Some(Time(2022-10-24T17:13:23Z)), message: Some("containers with unready status: [validator]"), reason: Some("ContainersNotReady"), status: "False", type_: "Ready" }, PodCondition { last_probe_time: None, last_transition_time: Some(Time(2022-10-24T17:13:23Z)), message: Some("containers with unready status: [validator]"), reason: Some("ContainersNotReady"), status: "False", type_: "ContainersReady" }, PodCondition { last_probe_time: None, last_transition_time: Some(Time(2022-10-24T17:13:23Z)), message: None, reason: None, status: "True", type_: "PodScheduled" }]), container_statuses: Some([ContainerStatus { container_id: Some("docker://5a7852b4391009bc3d671aaf7673a5af8b108c65d945ec430e02137615fb9a20"), image: "323143817725.dkr.ecr.us-west-2.amazonaws.com/aptos/validator:2d8b1b57553d869190f61df1aaf7f31a8fc19a7b", image_id: "docker-pullable://323143817725.dkr.ecr.us-west-2.amazonaws.com/aptos/validator@sha256:35c4f37510d7c03cabe6b6f84bcb45ec364822060d52c3b9114145a115f0c4dc", last_state: Some(ContainerState { running: None, terminated: None, waiting: None }), name: "validator", ready: false, restart_count: 0, state: Some(ContainerState { running: Some(ContainerStateRunning { started_at: Some(Time(2022-10-24T17:14:58Z)) }), terminated: None, waiting: None }) }]), host_ip: Some("192.168.33.173"), init_container_statuses: None, message: None, nominated_node_name: None, phase: Some("Running"), pod_ip: Some("192.168.12.116"), qos_class: Some("Guaranteed"), reason: None, start_time: Some(Time(2022-10-24T17:13:23Z)) }
Error: Retry due to pod aptos-node-4-validator-0 status PodStatus { conditions: Some([PodCondition { last_probe_time: None, last_transition_time: Some(Time(2022-10-24T17:13:23Z)), message: None, reason: None, status: "True", type_: "Initialized" }, PodCondition { last_probe_time: None, last_transition_time: Some(Time(2022-10-24T17:13:23Z)), message: Some("containers with unready status: [validator]"), reason: Some("ContainersNotReady"), status: "False", type_: "Ready" }, PodCondition { last_probe_time: None, last_transition_time: Some(Time(2022-10-24T17:13:23Z)), message: Some("containers with unready status: [validator]"), reason: Some("ContainersNotReady"), status: "False", type_: "ContainersReady" }, PodCondition { last_probe_time: None, last_transition_time: Some(Time(2022-10-24T17:13:23Z)), message: None, reason: None, status: "True", type_: "PodScheduled" }]), container_statuses: Some([ContainerStatus { container_id: Some("docker://5a7852b4391009bc3d671aaf7673a5af8b108c65d945ec430e02137615fb9a20"), image: "323143817725.dkr.ecr.us-west-2.amazonaws.com/aptos/validator:2d8b1b57553d869190f61df1aaf7f31a8fc19a7b", image_id: "docker-pullable://323143817725.dkr.ecr.us-west-2.amazonaws.com/aptos/validator@sha256:35c4f37510d7c03cabe6b6f84bcb45ec364822060d52c3b9114145a115f0c4dc", last_state: Some(ContainerState { running: None, terminated: None, waiting: None }), name: "validator", ready: false, restart_count: 0, state: Some(ContainerState { running: Some(ContainerStateRunning { started_at: Some(Time(2022-10-24T17:14:58Z)) }), terminated: None, waiting: None }) }]), host_ip: Some("192.168.33.173"), init_container_statuses: None, message: None, nominated_node_name: None, phase: Some("Running"), pod_ip: Some("192.168.12.116"), qos_class: Some("Guaranteed"), reason: None, start_time: Some(Time(2022-10-24T17:13:23Z)) }
Debugging output:
NAME                                    READY   STATUS      RESTARTS   AGE
aptos-node-0-validator-0                0/1     Running     0          22m
aptos-node-1-validator-0                0/1     Running     0          22m
aptos-node-2-validator-0                0/1     Running     0          22m
aptos-node-3-validator-0                0/1     Running     0          22m
aptos-node-4-validator-0                0/1     Running     0          22m
genesis-aptos-genesis-eforge182-hx94p   0/1     Completed   0          24m

github-actions[bot] avatar Oct 24 '22 17:10 github-actions[bot]

Codecov Report

Base: 68.2% // Head: 68.2% // Decreases project coverage by -0.0% :warning:

Coverage data is based on head (65c05db) compared to base (c58e5ae). Patch coverage: 100.0% of modified lines in pull request are covered.

:exclamation: Current head 65c05db differs from pull request most recent head f572cb7. Consider uploading reports for the commit f572cb7 to get more accurate results

Additional details and impacted files
@@            Coverage Diff            @@
##             main    #5244     +/-   ##
=========================================
- Coverage    68.2%    68.2%   -0.1%     
=========================================
  Files        1085     1085             
  Lines      162117   162117             
=========================================
- Hits       110645   110585     -60     
- Misses      51472    51532     +60     
Impacted Files Coverage Δ
config/src/config/state_sync_config.rs 83.0% <100.0%> (ø)
.../aptos-vm/src/parallel_executor/storage_wrapper.rs 55.2% <0.0%> (-29.0%) :arrow_down:
aptos-move/aptos-gas/src/transaction.rs 79.1% <0.0%> (-2.9%) :arrow_down:
...cached-packages/src/aptos_framework_sdk_builder.rs 48.3% <0.0%> (-1.8%) :arrow_down:
execution/executor/src/components/chunk_output.rs 80.3% <0.0%> (-1.2%) :arrow_down:
...ckup/backup-cli/src/storage/command_adapter/mod.rs 92.3% <0.0%> (-1.1%) :arrow_down:
types/src/proof/proptest_proof.rs 85.0% <0.0%> (-1.0%) :arrow_down:
...ackup-cli/src/backup_types/epoch_ending/restore.rs 75.0% <0.0%> (-0.8%) :arrow_down:
network/src/protocols/stream/mod.rs 78.9% <0.0%> (-0.8%) :arrow_down:
...ove/framework/src/natives/cryptography/bls12381.rs 94.8% <0.0%> (-0.6%) :arrow_down:
... and 7 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

codecov[bot] avatar Oct 24 '22 18:10 codecov[bot]

Forge is running suite land_blocking on f572cb7d30b20ef52b493dd6dd057bbf4e91de3c

github-actions[bot] avatar Oct 24 '22 18:10 github-actions[bot]

Forge is running suite compat on 2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> f572cb7d30b20ef52b493dd6dd057bbf4e91de3c

github-actions[bot] avatar Oct 24 '22 18:10 github-actions[bot]

:white_check_mark: Forge suite land_blocking success on f572cb7d30b20ef52b493dd6dd057bbf4e91de3c

performance benchmark with full nodes : 6521 TPS, 6096 ms latency, 19000 ms p99 latency,(!) expired 480 out of 2785040 txns
Test Ok

github-actions[bot] avatar Oct 24 '22 18:10 github-actions[bot]

:white_check_mark: Forge suite compat success on 2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> f572cb7d30b20ef52b493dd6dd057bbf4e91de3c

Compatibility test results for 2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> f572cb7d30b20ef52b493dd6dd057bbf4e91de3c (PR)
1. Check liveness of validators at old version: 2d8b1b57553d869190f61df1aaf7f31a8fc19a7b
compatibility::simple-validator-upgrade::liveness-check : 7641 TPS, 5084 ms latency, 7300 ms p99 latency,no expired txns
2. Upgrading first Validator to new version: f572cb7d30b20ef52b493dd6dd057bbf4e91de3c
compatibility::simple-validator-upgrade::single-validator-upgrade : 4716 TPS, 8428 ms latency, 11000 ms p99 latency,no expired txns
3. Upgrading rest of first batch to new version: f572cb7d30b20ef52b493dd6dd057bbf4e91de3c
compatibility::simple-validator-upgrade::half-validator-upgrade : 4585 TPS, 9201 ms latency, 12500 ms p99 latency,no expired txns
4. upgrading second batch to new version: f572cb7d30b20ef52b493dd6dd057bbf4e91de3c
compatibility::simple-validator-upgrade::rest-validator-upgrade : 7033 TPS, 5612 ms latency, 10400 ms p99 latency,no expired txns
5. check swarm health
Compatibility test for 2d8b1b57553d869190f61df1aaf7f31a8fc19a7b ==> f572cb7d30b20ef52b493dd6dd057bbf4e91de3c passed
Test Ok

github-actions[bot] avatar Oct 24 '22 18:10 github-actions[bot]