anoma / anoma-archive

Reference implementation of the Anoma protocols in Rust.
https://anoma.net
GNU General Public License v3.0
425 stars 176 forks source link

Improvements to e2e logging #1202

Closed james-chf closed 2 years ago

james-chf commented 2 years ago

Relates to anoma/namada#150

If a failure happens, log command

Error:
   0: Reached a timeout for expect type of command
      Command: /opt/workspace/heliax/repos/anoma/abcipp/target/debug/anomac --base-dir /var/folders/cy/fxxsxwd56yg67d68vxj6l52h0000gn/T/.tmpq7k0N2 --mode full transfer --source Bertha --target Albert --token XAN --amount 10.1 --fee-amount 0 --gas-limit 0 --fee-token XAN --ledger-address 127.0.0.1:28657
       Needle: Transaction applied

Location:
   tests/src/e2e/setup.rs:487

  ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ BACKTRACE ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
                                ⋮ 10 frames hidden ⋮
  11: anoma_tests::e2e::setup::AnomaCmd::exp_string::{{closure}}::h7a448153db6d5ac3
      at /opt/workspace/heliax/repos/anoma/abcipp/tests/src/e2e/setup.rs:487
  12: core::result::Result<T,E>::map_err::h173d24cf5428418f
      at /rustc/cacc75c82ebe15cf63d31034fcf7f1016cddf0e2/library/core/src/result.rs:855
  13: anoma_tests::e2e::setup::AnomaCmd::exp_string::h12e21a8761bc416f
      at /opt/workspace/heliax/repos/anoma/abcipp/tests/src/e2e/setup.rs:486
  14: anoma_tests::e2e::ledger_tests::ledger_many_txs_in_a_block::{{closure}}::{{closure}}::h974d35ab3a39a1b6
      at /opt/workspace/heliax/repos/anoma/abcipp/tests/src/e2e/ledger_tests.rs:999
                                ⋮ 13 frames hidden ⋮

In any case, log the command being run

> Running:
/opt/workspace/heliax/repos/anoma/abcipp/target/debug/anomac --base-dir /var/folders/cy/fxxsxwd56yg67d68vxj6l52h0000gn/T/.tmpq7k0N2 --mode full transfer --source Bertha --target Albert --token XAN --amount 10.1 --fee-amount 0 --gas-limit 0 --fee-token XAN --ledger-address 127.0.0.1:28657
Fraccaman commented 2 years ago

we have ANOMA_LOG_COLOR env variable to disable/enable ANSI sequenes. Maybe it can help.

james-chf commented 2 years ago

e2e::ledger_tests::ledger_many_txs_in_a_block failed in two consecutive CI runs for ABCI++ but not for ABCI

james-chf commented 2 years ago

I am still trying to figure out why e2e::ledger_tests::ledger_many_txs_in_a_block is failing for ABCI++. It does fail locally for me. The same test does pass in v0.6.1 with ABCI++ so this PR has changed something to make it start failing.

I've tried increasing the consensus timeout and reducing the number of spawned anomac tx commands from 3 to 1, but the test still fails with errors like:

Error:
   0: Reached a timeout for expect type of command
      Command: /opt/workspace/heliax/repos/anoma/abcipp/target/debug/anomac --base-dir /var/folders/cy/fxxsxwd56yg67d68vxj6l52h0000gn/T/.tmpiLotIB --mode full transfer --source Bertha --target Albert --token XAN --amount 10.1 --fee-amount 0 --gas-limit 0 --fee-token XAN --ledger-address 127.0.0.1:28657
       Needle: Transaction accepted

Interestingly this error happens even though the timeout for that command is 40s and the test completes in less than 40s.

james-chf commented 2 years ago

This PR can pass CI now, the test failure was happening as when calling session.with_log in expectrl, a new instance was returned without the existing session configuration copied over e.g. max timeout. So the test was failing due to too short of a timeout.

james-chf commented 2 years ago

I will try integrating https://github.com/anoma/anoma/pull/1188 into this PR

james-chf commented 2 years ago

going to make this PR agnostic to expectrl so that it can be used even while we revert to rexpect in https://github.com/anoma/anoma/pull/1219

james-chf commented 2 years ago

pls update wasm

james-chf commented 2 years ago

I've taken the expectrl logging-to-file out of this PR (maybe we can achieve something similar with rexpect as well though I probably won't have time to work on it soon). Maybe some of the commits in this branch can be squished down but apart from that think this is good to go!

james-chf commented 2 years ago

changed back to log with expectrl

tzemanovic commented 2 years ago

merged via https://github.com/anoma/namada/pull/222