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

Bug: Failed to parse wasm module: Validation Error #38

Open
i-zhen opened this issue Jan 20, 2024 · 0 comments
Open

Bug: Failed to parse wasm module: Validation Error #38

i-zhen opened this issue Jan 20, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@i-zhen
Copy link
Contributor

i-zhen commented Jan 20, 2024

Bug Report

1. Minimal reproduce step (Required)

Following e2e test case caused the bug randomly:

fn parampack_encode_test() {
    let mut runtime_and_abi = build_mock_runtime(
        r#"module_name = "EthEntrypoint"
        contract EthEntrypoint {
            state {
                chain_id: u64,
            }
            pub fn EthEntrypoint.EthEntrypoint.init(%0: u64, )  {
                0:
                    storage_store(get_storage_path("chain_id": str, ) !ir_storage_path_extra_args !1 , %0: u64, ) !ir_debug_location !0
                    ret() !ir_debug_location !0
            }

            pub fn EthEntrypoint.EthEntrypoint.create_eoa_account(%0: str, )  {
                1:
                    let %1: %ir.builtin.parampack !ir_debug_location !2 = call(@ir.builtin.encode_params(%0: str, storage_load(get_storage_path("chain_id": str, ) !ir_storage_path_extra_args !3 , ) -> u64 , ) -> %ir.builtin.parampack, )
                    ret() !ir_debug_location !2
            }

        }
        meta !0 = !{8: u32, 8: u32, "test.sonar": str, }
        meta !1 = !{0: u32, }
        meta !2 = !{12: u32, 12: u32, "test.sonar": str, }
        meta !3 = !{1: u32, }
        "#,
    );
    let mut runtime = runtime_and_abi.0;
    let abi = runtime_and_abi.1;
    // ABI
    assert_eq!(abi.methods.len(), 2);
    assert_eq!(abi.methods[1].inputs.len(), 1);
    // Deploy contract and call contract constructor.
    runtime.constructor(hex::decode("00").unwrap().as_slice());
    // Contract method call.
}

2. What did you expect to see? (Required)

Pass the test.

3. What did you see instead (Required)

Failed to parse wasm module: Validation("Function #45 reading/validation error: At instruction Call(50)(@10): Expected value of type Specific(I64) on top of stack. Got Specific(I32)")

@i-zhen i-zhen added the bug Something isn't working label Jan 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants