cspr-rad / kairos

Apache License 2.0
2 stars 0 forks source link

Feature/contract submit batch #120

Closed jonas089 closed 2 months ago

jonas089 commented 2 months ago

Objective of this PR: Add Batch verifier entry point to the demo contract

Todo before merge:

Optional (but likely appreciated):

Post demo todos (irrelevant to the demo):

Avi-D-coder commented 2 months ago

Status update: I think the contract is running out of gas. The test data (proofs) can be generated by running cargo test --features=metal,write-test-proofs and modifying the include_bytes!. The risc0 1image_id1 is not stable between nix build and devshell.

The test data can only be generated in the devshell not nix, that will be fine once the image_id is stable.

Avi-D-coder commented 2 months ago

I have now confirmed we run out of gas on larger proofs. The two simple batches that start with an empty trie are verifiable in the contract wasm. The large proofs are verifiable outside of the contract wasm, they start running the risc0 verifying code and then the runtime give the unreadable error.

Avi-D-coder commented 2 months ago

All tests except the end to end pass. kairos: output: deploy size of 1466131 bytes exceeds limit of 1048576

Please review.

Avi-D-coder commented 2 months ago

We need to increase the deploy size and increase the gas limit for the more complex batch tests.

koxu1996 commented 2 months ago

@Avi-D-coder I was using the following commands to increase max deployment size to 4 MiB in my local NCTL:

sed -i 's|\(max_deploy_size = \)[0-9_]\+|\14_194_304|' ~/casper-node/resources/local/chainspec.toml.in
sed -i 's|\(max_body_bytes = \)[0-9_]\+|\18_388_608|g' ~/casper-node/resources/local/config.toml

Notably, max_body_bytes must be adjusted as well (total size of put_deploy request's body that contains serialized deploy) - approximately doubled in size comparing to max_deploy_size.

Avi-D-coder commented 2 months ago

merge https://github.com/cspr-rad/kairos/pull/125 before this pr.