Skip to content

Compilation Errors with Resolc #190

@0xOmarA

Description

@0xOmarA

Description

There are a number of contracts that fail to compile through resolc. These failures can roughly be grouped into two categories: one group that fails due to recursion and another group that fails due to discovery of files. We're seeing these errors with version 0.3.0 of resolc.

The recursion error is the following:

Failed to create the drivers for the various platforms: Failed to create driver for revive-dev-node-polkavm-resolc: Failed to initialize the execution state of the platform: Failed to produce the pre-linking compiled contracts: Compilation callback failed (cache miss path): Encountered an error in the compilation: UnimplementedFeatureError: Copying nested calldata dynamic arrays to storage is not implemented in the old code generator.
 --> /private/var/folders/kp/pk_hkgpn0618g0pp4sm8srm40000gn/T/tmp.SUqpJePl7Q/resolc-compiler-tests/fixtures/solidity/translated_semantic_tests/array/copying/array_nested_calldata_to_storage/array_nested_calldata_to_storage.sol:2:1:
  |
2 | contract c {
  | ^ (Relevant source part starts here and spans across multiple lines).
FAILED, Failed to create the drivers for the various platforms: Failed to create driver for revive-dev-node-polkavm-resolc: Failed to initialize the execution state of the platform: Failed to produce the pre-linking compiled contracts: Compilation callback failed (cache miss path): Encountered an error in the compilation: CompilerError: Stack too deep. Try compiling with `--via-ir` (cli) or the equivalent `viaIR: true` (standard JSON) while enabling the optimizer. Otherwise, try removing local variables.
  --> /private/var/folders/kp/pk_hkgpn0618g0pp4sm8srm40000gn/T/tmp.SUqpJePl7Q/./resolc-compiler-tests/fixtures/solidity/simple/function/many_arguments_2.sol:52:40:
   |
52 |             result = result && main(i, p1, p2, p3, p4, p5, p6, p7, p8, p9, p10, p11, p12, p13, p14, p15, p16, p17, p18, p19, p20) == uint256(i) * i;

The file discovery error is the following:

Failed to create the drivers for the various platforms: Failed to create driver for revive-dev-node-polkavm-resolc: Failed to initialize the execution state of the platform: Failed to produce the pre-linking compiled contracts: Compilation callback failed (cache miss path): Compilation failed with an error: Contract `/private/var/folders/kp/pk_hkgpn0618g0pp4sm8srm40000gn/T/tmp.SUqpJePl7Q/resolc-compiler-tests/fixtures/solidity/complex/library_call_tuple/main.sol:C` compiling error: The contract `/private/var/folders/kp/pk_hkgpn0618g0pp4sm8srm40000gn/T/tmp.SUqpJePl7Q/resolc-compiler-tests/fixtures/solidity/complex/library_call_tuple/main.sol:C` LLVM IR generator definition pass error: Library `/private/var/folders/kp/pk_hkgpn0618g0pp4sm8srm40000gn/T/tmp.SUqpJePl7Q/resolc-compiler-tests/fixtures/solidity/complex/library_call_tuple/main.sol:L` not found in the projectThe contract `/private/var/folders/kp/pk_hkgpn0618g0pp4sm8srm40000gn/T/tmp.SUqpJePl7Q/resolc-compiler-tests/fixtures/solidity/complex/library_call_tuple/main.sol:C` LLVM IR generator definition pass error: Library `/private/var/folders/kp/pk_hkgpn0618g0pp4sm8srm40000gn/T/tmp.SUqpJePl7Q/resolc-compiler-tests/fixtures/solidity/complex/library_call_tuple/main.sol:L` not found in the project

I should note that these contracts compile just fine through solc and when ran on Geth VS Geth they run with no issues.

Reproduction Script

The following script can be used to reproduce this error:

curl "https://gist.githubusercontent.com/0xOmarA/61900df5e9f8eb4d18dbcc04b9396d74/raw/b069ef349c0aeef6621ee9bbfbbf7085187aeb58/script.sh" \
    | sh -s ~/PATH_TO_YOUR_POLKADOT_SDK

Metadata

Metadata

Assignees

No one assigned

    Labels

    Matter LabPVMProblem occurs at the execution stage for PVMerror: CompilerProblem occurs at the compiling stage

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions