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

Call to a smart-contract method fails with error code 12 EVMC_PRECOMPILE_FAILURE #1

Closed
e00dan opened this issue Apr 13, 2021 · 4 comments

Comments

@e00dan
Copy link
Contributor

e00dan commented Apr 13, 2021

I'm trying to deploy following smart-contract and the deployment worked after a small workaround, but calling the method fails.

Smart-contract code: https://gist.github.com/Kuzirashi/4ecc4f9f7b6fbdc60d3ba9384ca226a8
Compiled smart-contract artifacts including bytecode and abi: https://gist.github.com/Kuzirashi/282610d5d34aca64d7d991a68805ca6a

image

const contract = new web3.eth.Contract( HeadTail.abi, HeadTail.address );

function get() {
    contract.methods.userOneAddress().call();
}

function set() {
    contract.methods.depositUserOne().send({
      from: ethereum.selectedAddress,
      gas: 5000000,
      value: '0x01'
    });
}
godwoken_1   | [contract debug]: BEGIN set_storage
godwoken_1   | [contract debug]: END set_storage
godwoken_1   | [contract debug]: BEGIN get_storage
godwoken_1   | [contract debug]: END get_storage
godwoken_1   | [contract debug]: BEGIN set_storage
godwoken_1   | [contract debug]: END set_storage
godwoken_1   | [contract debug]: from_id => 5
godwoken_1   | [contract debug]: to_id => 7
godwoken_1   | [contract debug]: transfer value => 777
godwoken_1   | [contract debug]: transfer failed
godwoken_1   | [2021-04-13T16:13:06.133Z] [error] JSONRPC Server Error: Error: Chain submit L2Transaction failed: invalid exit code 12 Error: Chain submit L2Transaction failed: invalid exit code 12
godwoken_1   |     at ChainService.submitL2Transaction (/code/godwoken/packages/godwoken/lib/index.js:36:40)
godwoken_1   |     at JsonrpcServer.submitL2Transaction (/code/godwoken/packages/runner/src/jsonrpc_server.ts:75:36)
godwoken_1   |     at PromiseServer.<anonymous> (/code/godwoken/packages/runner/src/jsonrpc_server.ts:59:34)
godwoken_1   |     at module.exports.Method.execute (/code/godwoken/packages/runner/node_modules/jayson/lib/method.js:127:18)
godwoken_1   |     at module.exports.PromiseMethod.execute (/code/godwoken/packages/runner/node_modules/jayson/promise/lib/method.js:39:51)
godwoken_1   |     at /code/godwoken/packages/runner/node_modules/jayson/lib/server/index.js:315:12
godwoken_1   |     at maybeParse (/code/godwoken/packages/runner/node_modules/jayson/lib/server/index.js:440:5)
godwoken_1   |     at PromiseServer.Server.call (/code/godwoken/packages/runner/node_modules/jayson/lib/server/index.js:243:3)
godwoken_1   |     at /code/godwoken/packages/runner/node_modules/jayson/lib/server/middleware.js:36:12
godwoken_1   |     at call (/code/godwoken/node_modules/connect/index.js:239:7)

I see the error code meaning can be found here: https://github.com/ethereum/evmc/blob/5915690317989b02fd73d5aa338e4edfa120a452/include/evmc/evmc.h#L211 and is:

EVMC_PRECOMPILE_FAILURE = 12,
@RetricSu
Copy link
Collaborator

0.0.6 polyjuice is too old and buggy. later when we upgrade kicker to targeting the latest master branch of godwoken, this should get fixed.

@RetricSu
Copy link
Collaborator

I have reproduce this problem, it turns out it is not triggering polyjuice bug but a createCreator wrong param problem in godwoken-kicker. I will pull a quick fix for this soon.

@RetricSu RetricSu reopened this Apr 14, 2021
@RetricSu
Copy link
Collaborator

@kuzirashi update to latest godwoken-kicker should fix.

@e00dan
Copy link
Contributor Author

e00dan commented Apr 14, 2021

Solved.

@e00dan e00dan closed this as completed Apr 14, 2021
jjyr pushed a commit to jjyr/godwoken-kicker that referenced this issue Jul 17, 2021
jjyr pushed a commit to jjyr/godwoken-kicker that referenced this issue Jul 17, 2021
[debug] success => 279
LLVMSymbolizer: error reading file: No such file or directory

=================================================================
==1038102==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 6770 byte(s) in 286 object(s) allocated from:
    #0 0x49908d in malloc /home/nnelson/Documents/llvm-project/llvm/utils/release/final/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:145:3
    godwokenrises#1 0x54a4f0 in hex2bin(char const*, unsigned char**, unsigned long*) /home/flouse/godwoken-polyjuice/polyjuice-tests/fuzz/../../c/tests/./test_utils.h:11:21
    godwokenrises#2 0x7ffcb5cfcea7  ([stack]+0x1fea7)

Direct leak of 5720 byte(s) in 286 object(s) allocated from:
    #0 0x49908d in malloc /home/nnelson/Documents/llvm-project/llvm/utils/release/final/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:145:3
    godwokenrises#1 0x54a4f0 in hex2bin(char const*, unsigned char**, unsigned long*) /home/flouse/godwoken-polyjuice/polyjuice-tests/fuzz/../../c/tests/./test_utils.h:11:21
    godwokenrises#2 0x4084ff  (/home/flouse/godwoken-polyjuice/polyjuice-tests/fuzz/build/test_rlp+0x4084ff)

Direct leak of 5720 byte(s) in 286 object(s) allocated from:
    #0 0x49908d in malloc /home/nnelson/Documents/llvm-project/llvm/utils/release/final/llvm-project/compiler-rt/lib/asan/asan_malloc_linux.cpp:145:3
    godwokenrises#1 0x54a4f0 in hex2bin(char const*, unsigned char**, unsigned long*) /home/flouse/godwoken-polyjuice/polyjuice-tests/fuzz/../../c/tests/./test_utils.h:11:21
    godwokenrises#2 0x7f5fc8bf11af  (/lib/x86_64-linux-gnu/libstdc++.so.6+0x2151af)

SUMMARY: AddressSanitizer: 18210 byte(s) leaked in 858 allocation(s).
jjyr pushed a commit to jjyr/godwoken-kicker that referenced this issue Jul 17, 2021
## ERROR: AddressSanitizer: global-buffer-overflow
WRITE of size 3 at 0x0000012ac7a0 thread T0
    #0 0x4b4313 in vsprintf /home/nnelson/Documents/llvm-project/llvm/utils/release/final/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:1668:1
    godwokenrises#1 0x4b5293 in sprintf /home/nnelson/Documents/llvm-project/llvm/utils/release/final/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:1711:1
    godwokenrises#2 0x58ffbe in debug_print_data(char const*, unsigned char const*, unsigned int) /godwoken-polyjuice/polyjuice-tests/fuzz/c/polyjuice_utils.h:24:15
    godwokenrises#3 0x5b0fc5 in handle_message(gw_context_t*, unsigned int, unsigned int, evmc_address*, evmc_message const*, evmc_result*) /godwoken-polyjuice/polyjuice-tests/fuzz/c/polyjuice.h:1092:3
    godwokenrises#4 0x5b65f8 in run_polyjuice() /godwoken-polyjuice/polyjuice-tests/fuzz/c/polyjuice.h:1176:28
    godwokenrises#5 0x5b792a in LLVMFuzzerTestOneInput /godwoken-polyjuice/polyjuice-tests/fuzz/polyjuice_generator_fuzzer.cc:113:3
    godwokenrises#6 0x45e971 in fuzzer::Fuzzer::ExecuteCallback(unsigned char const*, unsigned long) /home/nnelson/Documents/llvm-project/llvm/utils/release/final/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:559:15
    godwokenrises#7 0x45e0b5 in fuzzer::Fuzzer::RunOne(unsigned char const*, unsigned long, bool, fuzzer::InputInfo*, bool*) /home/nnelson/Documents/llvm-project/llvm/utils/release/final/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:471:3
    godwokenrises#8 0x45fef7 in fuzzer::Fuzzer::ReadAndExecuteSeedCorpora(std::__Fuzzer::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /home/nnelson/Documents/llvm-project/llvm/utils/release/final/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:771:7
    godwokenrises#9 0x4600f9 in fuzzer::Fuzzer::Loop(std::__Fuzzer::vector<fuzzer::SizedFile, fuzzer::fuzzer_allocator<fuzzer::SizedFile> >&) /home/nnelson/Documents/llvm-project/llvm/utils/release/final/llvm-project/compiler-rt/lib/fuzzer/FuzzerLoop.cpp:800:3
    godwokenrises#10 0x450295 in fuzzer::FuzzerDriver(int*, char***, int (*)(unsigned char const*, unsigned long)) /home/nnelson/Documents/llvm-project/llvm/utils/release/final/llvm-project/compiler-rt/lib/fuzzer/FuzzerDriver.cpp:847:6
    godwokenrises#11 0x477092 in main /home/nnelson/Documents/llvm-project/llvm/utils/release/final/llvm-project/compiler-rt/lib/fuzzer/FuzzerMain.cpp:20:10
    godwokenrises#12 0x7f10dbdbe564 in __libc_start_main csu/../csu/libc-start.c:332:16
    godwokenrises#13 0x424e9d in _start (/godwoken-polyjuice/polyjuice-tests/fuzz/build/polyjuice_generator_fuzzer_log+0x424e9d)

0x0000012ac7a0 is located 0 bytes to the right of global variable 'debug_buffer' defined in 'c/generator/../polyjuice_utils.h:18:13' (0x129c7a0) of size 65536
SUMMARY: AddressSanitizer: global-buffer-overflow /home/nnelson/Documents/llvm-project/llvm/utils/release/final/llvm-project/compiler-rt/lib/asan/../sanitizer_common/sanitizer_common_interceptors.inc:1668:1 in vsprintf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants