CosmWasm / wasmd

Basic cosmos-sdk app with web assembly smart contracts
Other
364 stars 386 forks source link

Improve block time estimation to stabilize system tests #1838

Closed webmaster128 closed 4 months ago

codecov[bot] commented 4 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 54.89%. Comparing base (945de3a) to head (faa5fb9).

Additional details and impacted files [![Impacted file tree graph](https://app.codecov.io/gh/CosmWasm/wasmd/pull/1838/graphs/tree.svg?width=650&height=150&src=pr&token=rxXgFH3QTf&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CosmWasm)](https://app.codecov.io/gh/CosmWasm/wasmd/pull/1838?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CosmWasm) ```diff @@ Coverage Diff @@ ## main #1838 +/- ## ========================================== + Coverage 54.87% 54.89% +0.02% ========================================== Files 64 64 Lines 9770 9770 ========================================== + Hits 5361 5363 +2 + Misses 3864 3863 -1 + Partials 545 544 -1 ``` [see 1 file with indirect coverage changes](https://app.codecov.io/gh/CosmWasm/wasmd/pull/1838/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=CosmWasm)
webmaster128 commented 4 months ago

The issue that popped up after this PR on main is a different one than before:

--- FAIL: TestRecursiveSmartQuery (12.61s)
    system.go:429: Reset chain
    fraud_test.go:58: Await node is up: tcp://localhost:26657
    system.go:275: Checking node status: tcp://localhost:26657
    system.go:287: Node started. Current block: 1
    fraud_test.go:58: Start new block listener
    cli.go:213: +++ running `wasmd tx wasm store ./testdata/hackatom.wasm.gzip --from=node0 --gas=1500000 --fees=2stake --broadcast-mode sync --output json --yes --chain-id testing --home /home/circleci/project/tests/system/testnet --keyring-backend test --output json --node tcp://localhost:26657`
    cli.go:213: +++ running `wasmd q tx F8AE9EC1C5D6094AC737EE4C6EE17DCC79D2361F53D582C97904C0DBBFB1725B --output json --node tcp://localhost:26657`
    cli.go:213: +++ running `wasmd q tx F8AE9EC1C5D6094AC737EE4C6EE17DCC79D2361F53D582C97904C0DBBFB1725B --output json --node tcp://localhost:26657`
    cli.go:168: tx committed: true
    cli.go:213: +++ running `wasmd tx wasm instantiate 1 {"verifier":"wasm182pnxgrntjtzq5lx7sksv0wmjdmktuas4fhlc986avmm0s763g4shl2lpt", "beneficiary":"wasm1f5sc5adeuzcrqzwxu565j297et0m6azzd4gx42dm9x33279zufuq35g9et"} --label=testing --from=node0 --no-admin --fees=1stake --broadcast-mode sync --output json --yes --chain-id testing --home /home/circleci/project/tests/system/testnet --keyring-backend test --output json --node tcp://localhost:26657`
    cli.go:213: +++ running `wasmd q tx 5F7322C18FAC12CC072C56328FA540E3CA5FC99E1588C29023835C020A13F0E4 --output json --node tcp://localhost:26657`
    cli.go:213: +++ running `wasmd q tx 5F7322C18FAC12CC072C56328FA540E3CA5FC99E1588C29023835C020A13F0E4 --output json --node tcp://localhost:26657`
    cli.go:168: tx committed: true
    cli.go:213: +++ running `wasmd q wasm contract-state smart wasm14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s0phg4d {"recurse":{"depth":4294967295, "work":0}} --output json --node tcp://192.168.32.3:26657`
    cli.go:213: +++ running `wasmd q wasm contract-state smart wasm14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s0phg4d {"recurse":{"depth":4294967295, "work":0}} --output json --node tcp://192.168.32.3:26658`
    cli.go:213: +++ running `wasmd q wasm contract-state smart wasm14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s0phg4d {"recurse":{"depth":4294967295, "work":0}} --output json --node tcp://192.168.32.3:26659`
    cli.go:213: +++ running `wasmd q wasm contract-state smart wasm14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9s0phg4d {"recurse":{"depth":4294967295, "work":0}} --output json --node tcp://192.168.32.3:26660`
    fraud_test.go:71: Timeout - no block within 3s

where the failing test code is

func TestRecursiveSmartQuery(t *testing.T) {
    sut.ResetDirtyChain(t)
    sut.StartChain(t)
    cli := NewWasmdCLI(t, sut, verbose)

    initMsg := fmt.Sprintf(`{"verifier":%q, "beneficiary":%q}`, randomBech32Addr(), randomBech32Addr())
    maliciousContractAddr := cli.WasmInstantiate(cli.WasmStore("./testdata/hackatom.wasm.gzip", "--from=node0", "--gas=1500000", "--fees=2stake"), initMsg)

    msg := fmt.Sprintf(`{"recurse":{"depth":%d, "work":0}}`, math.MaxUint32)

    // when
    for _, n := range sut.AllNodes(t) {
        cli.WithRunErrorMatcher(ErrInvalidQuery).WithNodeAddress(n.RPCAddr()).
            QuerySmart(maliciousContractAddr, msg)
    }
    sut.AwaitNextBlock(t) // line 71
}

Not getting any block within 3s is strange at a 1s block time (900ms commit timeout). But I also don't know why the query test cares about getting another block at the end of the test.