cspr-rad / kairos

Apache License 2.0
4 stars 0 forks source link

Validate e2e #173

Closed koxu1996 closed 3 months ago

koxu1996 commented 3 months ago

I am testing what happens with CI tests, when batch is rejected.

koxu1996 commented 3 months ago

Context

During recording Kairos demo, I observed that withdraw functionality does not work as intended: L1 balance was not updated, even though logs indicated everything is okay:

2024-07-30T06:06:39.386386Z  INFO kairos_server::state: Proving server returned success
2024-07-30T06:06:39.500972Z  INFO kairos_server::state::submit_batch: Deploy successful: SuccessResponse { jsonrpc: "2.0", id: Number(-5821002906725155678), result: PutDeployResult { api_version: ProtocolVersion(SemVer { major: 1, minor: 0, patch: 0 }), deploy_hash: DeployHash(4bfedc9cacd98af05859ebbc9d7fbcf6d9e55d5f01e26b08947826b3ebbc4823) } }

It was clearly silent failure in Kairos Server - deploy was submitted successfuly, however execution result was simply not checked:

➜ casper-client get-deploy \
  --node-address http://127.0.0.1:11101/rpc 4bfedc9cacd98af05859ebbc9d7fbcf6d9e55d5f01e26b08947826b3ebbc4823 | grep -i -C3 failure
      {
        "block_hash": "3b8fcc3a3212191f195ba41b6158860a1cd5e5be6a0b7f7c72cad61f30105f0d",
        "result": {
          "Failure": {
            "effect": {
              "operations": [],
              "transforms": [
➜ casper-client get-deploy \
  --node-address http://127.0.0.1:11101/rpc 4bfedc9cacd98af05859ebbc9d7fbcf6d9e55d5f01e26b08947826b3ebbc4823 | grep -i -C3 error
            },
            "transfers": [],
            "cost": "7157560450",
            "error_message": "User error: 0"
          }
        }
      }

This error is returned for unsuccessful Receipt serialization:

https://github.com/cspr-rad/kairos/blob/95190703e048bcf03ed2c80912b400d7460ca072/kairos-contracts/demo-contract/contract/src/main.rs#L101-L103

Both silent faliure and deserialization issues are supposed to be fixed by #174 - not tested yet.

koxu1996 commented 3 months ago

@Avi-D-coder After applying error detection from #174, silent failure turned into crash:

thread 'tokio-runtime-worker' panicked at kairos-server/src/state/submit_batch.rs:97:6:
could not get deploy: User error: 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

At least User error: 0 was captured :relieved:.

However, after applying full changes, user balance is still not updated. I got the following panic:

thread 'tokio-runtime-worker' panicked at kairos-server/src/state/submit_batch.rs:97:6:
could not get deploy: Interpreter error: trap: Code(Unreachable)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Avi-D-coder commented 3 months ago

@Avi-D-coder After applying error detection from #174, silent failure turned into crash:

thread 'tokio-runtime-worker' panicked at kairos-server/src/state/submit_batch.rs:97:6:
could not get deploy: User error: 0
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

At least User error: 0 was captured 😌.

However, after applying full changes, user balance is still not updated. I got the following panic:

thread 'tokio-runtime-worker' panicked at kairos-server/src/state/submit_batch.rs:97:6:
could not get deploy: Interpreter error: trap: Code(Unreachable)
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

i'll take another look after the meeting.

koxu1996 commented 3 months ago

Receipt deserialization was fixed in https://github.com/cspr-rad/kairos/pull/174, CCTL issue found in https://github.com/cspr-rad/kairos/pull/177 (too low memory limit).