Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Taiko Client on Powdr #850

Open
1 of 5 tasks
CeciliaZ030 opened this issue Dec 18, 2023 · 8 comments
Open
1 of 5 tasks

Run Taiko Client on Powdr #850

CeciliaZ030 opened this issue Dec 18, 2023 · 8 comments

Comments

@CeciliaZ030
Copy link

CeciliaZ030 commented Dec 18, 2023

TODOs:

  • Run EVM in riscv/tests/riscv.rs. Latest attempt did not work with error in riscv_executor::execute_ast in main branch:
thread 'test_evm' panicked at /home/phoebe/projects/powdr/riscv_executor/src/lib.rs:757:66:
index out of bounds: the len is 0 but the index is 0
stack backtrace:
   0: rust_begin_unwind
             at /rustc/a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01/library/std/src/panicking.rs:645:5
   1: core::panicking::panic_fmt
             at /rustc/a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01/library/core/src/panicking.rs:72:14
   2: core::panicking::panic_bounds_check
             at /rustc/a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01/library/core/src/panicking.rs:208:5
   3: <usize as core::slice::index::SliceIndex<[T]>>::index
             at /rustc/a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01/library/core/src/slice/index.rs:255:10
   4: core::slice::index::<impl core::ops::index::Index<I> for [T]>::index
             at /rustc/a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01/library/core/src/slice/index.rs:18:9
   5: <alloc::vec::Vec<T,A> as core::ops::index::Index<I>>::index
             at /rustc/a96d57bdb6d2bb6d233d7d5aaefc2995ab99be01/library/alloc/src/vec/mod.rs:2770:9
   6: riscv_executor::Executor<F>::eval_expression
             at /home/phoebe/projects/powdr/riscv_executor/src/lib.rs:757:66
   7: riscv_executor::execute_ast
             at /home/phoebe/projects/powdr/riscv_executor/src/lib.rs:820:31
   8: riscv::common::verify_riscv_asm_string
             at ./tests/common/mod.rs:17:5
   9: riscv::verify_riscv_crate
             at ./tests/riscv.rs:232:5
  10: riscv::test_evm
             at ./tests/riscv.rs:22:5
  11: riscv::test_evm::{{closure}}
             at ./tests/riscv.rs:20:14

@leonardoalt If you can help us with the first step running the revm that'd be amazing! 😊

@leonardoalt
Copy link
Member

This is great!

@CeciliaZ030 for the first EVM test, how did you run it? With cargo run or test? My guess is that the input bytecode is missing or wrong.

With cargo run:
cargo run --release rust riscv/tests/riscv_data/evm/ -o /tmp/test_revm -f -i "11,97,2,154,96,0,82,96,32,96,0,243"

With cargo test, the inputs were indeed broken and I fixed it here: #851 . If you checkout that branch, you can run it directly with

cargo test --release test_evm -- --ignored --nocapture --exact

I think that test also runs the PIL witness verifier from pilcom, so you'll need to clone https://github.com/0xPolygonHermez/pilcom and run export PILCOM=<cloned pilcom dir> before running cargo test above.

For the second item, you can take a look here at how to call powdr's RISCV executor (needed for continuations and before witness generation):

https://github.com/powdr-labs/powdr_revm/blob/main/bin/src/main.rs#L57

Also note that we're currently refactoring some of the public API entry-points, so my suggestion above might be updated soon.

@CeciliaZ030
Copy link
Author

CeciliaZ030 commented Dec 18, 2023

Thanks very much! @leonardoalt
With cargo run --release rust riscv/tests/riscv_data/evm/ -o /tmp/test_revm -f -i "11,97,2,154,96,0,82,96,32,96,0,243", it runs to the witness generation but it fails at some row with constrain not satisfied:

"Looping failed. Trying to generate regularly again. (Use RUST_LOG=debug to see whether this happens more often.)"

Not sure if this is intended? I haven't gotten to the proving step yet so it shouldn't require PIL

@leonardoalt
Copy link
Member

Ah this is actually fine, this is at the end of witness generation, it's just some special case for the last row. Witgen is just logging too much and I agree that looks confusing

@CeciliaZ030
Copy link
Author

Hi @leonardoalt, now I'm running from my fork of the latest Zeth, because our BlockBuilder is modified within Zeth. Pls check this out CeciliaZ030/zeth#1
Now the I've had a RICS-V binary compiled with all no_std dependency, but during ASM compilation I have this issue:

    Finished release [optimized] target(s) in 4.77s
The assembly code references an external routine / label that is not available:
__runtime_start
thread 'main' panicked at /home/phoebe/.cargo/git/checkouts/powdr-5ad669c296f4e377/8b00b33/asm_utils/src/reachability.rs:96:13:
explicit panic
stack backtrace:
   0: rust_begin_unwind
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:595:5
   1: core::panicking::panic_fmt
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/panicking.rs:67:14
   2: core::panicking::panic
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/panicking.rs:117:5
   3: asm_utils::reachability::find_reachable_labels
             at /home/phoebe/.cargo/git/checkouts/powdr-5ad669c296f4e377/8b00b33/asm_utils/src/reachability.rs:96:13
   4: asm_utils::reachability::filter_reachable_from
             at /home/phoebe/.cargo/git/checkouts/powdr-5ad669c296f4e377/8b00b33/asm_utils/src/reachability.rs:24:9
   5: riscv::compiler::compile
             at /home/phoebe/.cargo/git/checkouts/powdr-5ad669c296f4e377/8b00b33/riscv/src/compiler.rs:127:5
   6: riscv::compile_riscv_asm_bundle
             at /home/phoebe/.cargo/git/checkouts/powdr-5ad669c296f4e377/8b00b33/riscv/src/lib.rs:107:21
   7: riscv::compile_rust
             at /home/phoebe/.cargo/git/checkouts/powdr-5ad669c296f4e377/8b00b33/riscv/src/lib.rs:72:5
   8: bin_powdr::main
             at ./bin-powdr/src/main.rs:7:41
   9: core::ops::function::FnOnce::call_once
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Basically my binary is missing label __runtime_start? Not sure if it's a RISC-V compiler versioning issue...

@CeciliaZ030
Copy link
Author

CeciliaZ030 commented Jan 8, 2024

Update: adding verify_pipeline but failed at witness generation. Continuation input issue?
https://github.com/CeciliaZ030/zeth/blob/a2003821e09bc129f10456e7682e5ecf3eb79691/bin-powdr/src/main.rs#L23

[2024-01-08T20:13:45Z DEBUG executor::witgen::vm_processor] 
    Set RUST_LOG=trace to understand why these values were (not) chosen.
[2024-01-08T20:13:45Z DEBUG executor::witgen::vm_processor] Assuming zero for unknown values, the following identities fail:
        main.instr_load_bootloader_input { main.X, main.Y } in { main.BOOTLOADER_INPUT_ADDRESS, main.bootloader_input_value };:
            This machine call could not be completed. Either some inputs are missing or the machine is under-constrained.
    
thread 'main' panicked at /home/phoebe/.cargo/git/checkouts/powdr-5ad669c296f4e377/64b18bc/executor/src/witgen/vm_processor.rs:441:9:
Witness generation failed.

Backtrace

   Finished release [optimized] target(s) in 0.07s
[2024-01-08T20:00:09Z ERROR executor::witgen::vm_processor] 
    Error: Row 12 failed. Set RUST_LOG=debug for more information.
    
thread 'main' panicked at /home/phoebe/.cargo/git/checkouts/powdr-5ad669c296f4e377/64b18bc/executor/src/witgen/vm_processor.rs:441:9:
Witness generation failed.
stack backtrace:
   0: rust_begin_unwind
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/std/src/panicking.rs:595:5
   1: core::panicking::panic_fmt
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/panicking.rs:67:14
   2: executor::witgen::vm_processor::VmProcessor<T,Q>::report_failure_and_panic_underconstrained
   3: executor::witgen::vm_processor::VmProcessor<T,Q>::compute_row::{{closure}}
             at /home/phoebe/.cargo/git/checkouts/powdr-5ad669c296f4e377/64b18bc/executor/src/witgen/vm_processor.rs:258:26
   4: core::result::Result<T,E>::map_err
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/result.rs:829:27
   5: executor::witgen::vm_processor::VmProcessor<T,Q>::compute_row
             at /home/phoebe/.cargo/git/checkouts/powdr-5ad669c296f4e377/64b18bc/executor/src/witgen/vm_processor.rs:246:13
   6: executor::witgen::vm_processor::VmProcessor<T,Q>::run
             at /home/phoebe/.cargo/git/checkouts/powdr-5ad669c296f4e377/64b18bc/executor/src/witgen/vm_processor.rs:153:42
   7: executor::witgen::generator::Generator<T>::process
             at /home/phoebe/.cargo/git/checkouts/powdr-5ad669c296f4e377/64b18bc/executor/src/witgen/generator.rs:225:26
   8: executor::witgen::generator::Generator<T>::run
             at /home/phoebe/.cargo/git/checkouts/powdr-5ad669c296f4e377/64b18bc/executor/src/witgen/generator.rs:136:21
   9: executor::witgen::WitnessGenerator<T,Q>::generate
             at /home/phoebe/.cargo/git/checkouts/powdr-5ad669c296f4e377/64b18bc/executor/src/witgen/mod.rs:142:9
  10: pipeline::pipeline::Pipeline<T>::advance::{{closure}}
             at /home/phoebe/.cargo/git/checkouts/powdr-5ad669c296f4e377/64b18bc/pipeline/src/pipeline.rs:478:25
  11: core::bool::<impl bool>::then
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/bool.rs:60:24
  12: pipeline::pipeline::Pipeline<T>::advance
             at /home/phoebe/.cargo/git/checkouts/powdr-5ad669c296f4e377/64b18bc/pipeline/src/pipeline.rs:467:74
  13: pipeline::pipeline::Pipeline<T>::advance_to
             at /home/phoebe/.cargo/git/checkouts/powdr-5ad669c296f4e377/64b18bc/pipeline/src/pipeline.rs:669:13
  14: pipeline::test_util::verify_pipeline
             at /home/phoebe/.cargo/git/checkouts/powdr-5ad669c296f4e377/64b18bc/pipeline/src/test_util.rs:52:5
  15: bin_powdr::main
             at ./bin-powdr/src/main.rs:23:5
  16: core::ops::function::FnOnce::call_once
             at /rustc/cc66ad468955717ab92600c770da8c1601a4ff33/library/core/src/ops/function.rs:250:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

 *  The terminal process "cargo 'run', '--package', 'bin-powdr', '--bin', 'bin-powdr', '--all-features'" terminated with exit code: 101. 
 *  Terminal will be reused by tasks, press any key to close it. 

@leonardoalt
Copy link
Member

@CeciliaZ030 yea we need to call the continuations library instead of calling verify there directly. Let me open a PR to your code

@CeciliaZ030
Copy link
Author

Update:

@leonardoalt
Copy link
Member

@CeciliaZ030 what does the second item entail on our side?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants