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

ripemd160 cause an execution error. #275

Open
Subway2023 opened this issue Feb 25, 2025 · 2 comments · May be fixed by #276
Open

ripemd160 cause an execution error. #275

Subway2023 opened this issue Feb 25, 2025 · 2 comments · May be fixed by #276
Assignees

Comments

@Subway2023
Copy link

zksolc version: v1.5.10
solc version: 0.8.28-1.0.1

Problem: Using ripemd160 causes the program to fail. The critical issue is that zksolc does not throw any errors for the program, nor does it provide any warnings related to ripemd160; instead, it silently passes.

contract C {
    function f() public returns (bytes32 hash) {
        return ripemd160("");
    }
}

Run with zksolc

I have set up an execution environment that can directly execute the bytecode generated by zksolc.

compile

zksolc_zksync --solc solc_zksync test.sol --combined-json hashes,bin,abi

execute

ts-node zksyncExecute/vmRunWithPara.ts 0000008003000039000000400030043f00000000030004160000000100200190000000410000c13d000000000003004b000000480000c13d0000001c00100198000000480000613d000000000101043b0000001d011001970000001e0010009c000000480000c13d00000000010004140000001f0010009c0000001f01008041000000c00110021000000020011001c70000000302000039006700620000040f000000800900003900000060031002700000001f03300197000000200030008c000000200400003900000000040340190000001f0540018f000000200640019000000080046001bf000000230000613d000000000701034f000000007807043c0000000009890436000000000049004b0000001f0000c13d000000000005004b000000300000613d000000000661034f0000000305500210000000000704043300000000075701cf000000000757022f000000000606043b0000010005500089000000000656022f00000000055601cf000000000575019f000000000054043500000001002001900000004a0000613d000000400100043d000000000201043300000060022002100000000000210435000000400200043d000000000121004900000020011000390000001f0010009c0000001f0100804100000060011002100000001f0020009c0000001f020080410000004002200210000000000121019f000000680001042e000000000003004b000000480000c13d0000002001000039000001000010044300000120000004430000001b01000041000000680001042e000000000100001900000069000104300000001f0430018f0000002102300198000000530000613d000000000501034f0000000006000019000000005705043c0000000006760436000000000026004b0000004f0000c13d000000000004004b000000600000613d000000000121034f0000000304400210000000000502043300000000054501cf000000000545022f000000000101043b0000010004400089000000000141022f00000000014101cf000000000151019f00000000001204350000006001300210000000690001043000000065002104230000000102000039000000000001042d0000000002000019000000000001042d0000006700000432000000680001042e000000690001043000000000000000000000000000000000000000020000000000000000000000000000004000000100000000000000000000000000000000000000000000000000fffffffc000000000000000000000000ffffffff0000000000000000000000000000000000000000000000000000000026121ff00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000ffffffff000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000ffffffe0552ea47026e43002dd8017ebe70d21ced1475620f9e0947da6b65b023216910d '[{"inputs": [], "name": "f", "outputs": [{"internalType": "bytes32", "name": "hash", "type": "bytes32"}], "stateMutability": "nonpayable", "type": "function"}]' 26121ff0

the output of era_test_node

3:27:56  INFO Call: FAILED: Error function_selector = 0x, data = 0x
13:27:56  INFO === Console Logs: 
13:27:56  INFO === Call traces:
13:27:56  INFO execution reverted
@hedgar2017 hedgar2017 transferred this issue from matter-labs/era-compiler-solidity Feb 25, 2025
@0xVolosnikov
Copy link

ripemd160 precompile isn't supported in EraVM

@hedgar2017 potentially this should be error during compilation

@hedgar2017
Copy link
Collaborator

hedgar2017 commented Feb 25, 2025

ripemd160 precompile isn't supported in EraVM

@hedgar2017 potentially this should be error during compilation

It is not fully possible.

I can make it an error in Solidity AST, but not in assembly. Anyway, sounds like a good idea.

@hedgar2017 hedgar2017 transferred this issue from matter-labs/era-contracts Feb 25, 2025
@hedgar2017 hedgar2017 linked a pull request Feb 26, 2025 that will close this issue
4 tasks
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

Successfully merging a pull request may close this issue.

3 participants