Questions tagged [compiler]

A compiler is a computer program that translates a higher-level programming language into a lower-level language. For example: Solidity is compiled into EVM opcodes.

Filter by
Sorted by
Tagged with
0 votes
1 answer
10 views

Reliably disassamble bytecode to opcodes across various evm versions

Is there a reliable way of disassembling bytecode into opcodes across different EVM versions, to make it agnostic to the EVM version used during compilation? As the second best option - is there a ...
Stas Buzuluk's user avatar
1 vote
1 answer
54 views

Run optimizer on opcodes

According to documentation, one of the steps of solidity compilation is the optimization on opcodes level, with the following set of rules. How can I apply optimization directly on opcodes? Details ...
Stas Buzuluk's user avatar
1 vote
1 answer
34 views

Can't run Fe language on M2 MacOS Ventura: bad CPU type in executable

I tried installing Fe lang on M2 MacOS Ventura through Homebrew and by downloading the executable but both installation options ended up with me seeing the following error. zsh: bad CPU type in ...
ferit's user avatar
  • 507
1 vote
1 answer
23 views

Call or assignment expected. Getting this error while upgrading solidity version

I am not aware of the Assembly code. I copied the ERC1820 registry contract from here. This is written in 0.5.3. When I tried to compile it with 0.8.0 it gave me this error : I know it's because of ...
Serenity's user avatar
2 votes
1 answer
68 views

Determine compiler used to create a given bytecode

Context The method that the solc compiler uses to set storage slots for a mapping is slightly different from how the Vyper compiler does so. In Vyper, it's keccak256(slotMapping, key), while in ...
Another0xDev's user avatar
2 votes
1 answer
53 views

Possible way to hack Solidity into executing a function directly from a struct as a method? (v0.8.20)

pragma solidity 0.8.20; contract SolidityLimitTest { mapping (address => Hack) private Hackable; struct Hack { uint amount; function(uint) returns (uint) ten_x; } ...
Ashraile's user avatar
1 vote
1 answer
179 views

What solidity version is used when you give a range to the compiler e.g. pragma solidity >0.7.0 <0.9.0?

I am new to Solidity but have learned you can tell the compiler to use a range of Solidity versions e.g ^0.8.10 || > 0.7.0 < 0.9.0 when deploying smart contracts. My question is how does the ...
davidastro's user avatar
1 vote
1 answer
41 views

How to fix naming scheme and undeclared identifier errors?

I have a question about something that has been bugging me for quite some time now. I am a bit confused on naming schemes in solidity and how I should go about it. For example, the biggest thing for ...
EGstacking's user avatar
5 votes
1 answer
1k views

How to configure multiple solidity compiler versions in foundry?

I have a foundry project with files that have multiple solidity versions(0.7.x and 0.8.x). hardhat can relatively easily be configured to compile all files in the project as follows: https://hardhat....
MShakeG's user avatar
  • 1,443
1 vote
1 answer
21 views

Hardhat compile code on file change (like remix)

Is there any way (preferably an official Hardhat plugin) to automatically compile the Smart Contracts' code on file change? I'd want to have the same developer experience as when using Remix, or ...
Alexander Herranz's user avatar
0 votes
0 answers
9 views

Problem with veryfing contract

Hi I had my smart contract previously deployed and verified. However mythril warned me of floating pragma so I changed version explicitly to pragma solidity 0.8.1; I deployed it tot testnet using ...
Łukasz Johnnie Wolski's user avatar
1 vote
1 answer
27 views

can't find contract after compile successfully in remix: No Contract Compiled Yet

I compile this file in 0.4.8 successfully, pragma solidity 0.4.8; contract A { function f(uint[] arr) constant external returns (uint len) { assembly { pop arr := len }...
LEVI_104's user avatar
0 votes
1 answer
71 views

Compiler version error in Visual Studio Code

I started getting this error... Source file requires different compiler version (current compiler is 0.7.3+commit.9bfce1f6.Emscripten.clang) - note that nightly builds are considered to be strictly ...
Falcon Stakepool's user avatar
0 votes
0 answers
153 views

Having trouble finding and uninstalling local solc versions to enable solc-select

Years ago, I used Homebrew to install ethereum and solidity. Lately, I've been trying to use solc-select, but as its documentation states, it doesn't work when there's a local copy of solc already ...
StuckInThePast's user avatar
1 vote
1 answer
28 views

Compiler doesn't show a warning if empty function is not marked as pure

When compiling a function without marking its state mutability as pure, the compiler shows the following warning: Warning: Function state mutability can be restricted to pure For example: contract ...
BonisTech's user avatar
  • 536
1 vote
1 answer
90 views

How to disable log that when compile?

I using script "yarn hardhat compile" alway log like image. I want to disable that.
sea.dev's user avatar
  • 13
1 vote
1 answer
48 views

developing a contract that distributes tokens

I am developing a contract that distributes tokens and has already implemented the main functionality. The contract accepts tokens from the owner and distributes them by 1KK to each address from the ...
Lll Cilician's user avatar
1 vote
1 answer
121 views

Get bytecode offset(entrypoint) for the function in solidity contract

Suppose, I have the following source code: contract Test { function add(uint a, uint b) public returns(uint) { return a + b; } } And bytecode after compilation: ...
shermike's user avatar
1 vote
1 answer
51 views

I do not understand how to fix the error: "req.add"

// SPDX-License-Identifier: MIT pragma solidity 0.8.19; import "@chainlink/contracts/src/v0.8/ChainlinkClient.sol"; contract RealEstateDataConsumer is ChainlinkClient { uint256 ...
Vidhan Mangla's user avatar
1 vote
1 answer
78 views

Compilation is successful but getting bytecode = "0x"

I am trying to compile this very simple smart contract but I am getting its bytecode = "0x": // SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.0; import "@openzeppelin/...
Falcon Stakepool's user avatar
2 votes
1 answer
339 views

Adding viaIR: true option Brownie

I'm getting 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. ...
aliercanozgokce's user avatar
1 vote
1 answer
79 views

Solc: Source file requires different compiler version

in my brownie project i have imported LinkTokenReceiver.sol contract which its pragma solidity is pragma solidity ^0.7.0;, which means that it requires compiler version equal or greater than 0.7.0, ...
noro meb's user avatar
  • 328
1 vote
2 answers
495 views

Operator == not compatible with types string memory and string memory [duplicate]

function hasRole(uint256 tokenId, string memory role) public view returns (bool) { string[] memory userRoles = tokenToRoles[tokenId]; uint256 userRolesLength = userRoles.length; unchecked {...
dd0sxx's user avatar
  • 175
1 vote
0 answers
91 views

How do I use a remapping with solidity compiler?

If my contract is importing for example "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/IERC20.sol", how do I make it work? I know import_remappings ...
danisa's user avatar
  • 11
0 votes
0 answers
23 views

Run manticore return 'Stack too deep when compiling inline assembly: Variable headStart is 1 slot(s) too deep inside the stack' error

I compile my project just fine but when I run manticore for my solidity file, it return Stack too deep error. I did some research but none of which I found work. Here is the config I'm setting: ...
marethyu's user avatar
  • 113
0 votes
1 answer
170 views

Compiler version error

I am following a YouTube tutorial and I have the following contract (in Remix): // SPDX-License-Identifier: MIT pragma solidity >= 0.6.0 < 0.9.0; import "@chainlink/contracts/src/v0.8/...
DJ Quimoso's user avatar
0 votes
3 answers
344 views

Contract is below size limit, but Hardhat says it's not?

When I run npx hardhat compile, Hardhat says one of my contracts is above the size limit. But hardhat-contract-sizer says it's not. See below: Versions: hardhat-contract-sizer version: ^2.5.1 ...
António Gonçalves's user avatar
4 votes
1 answer
2k views

Is it possible to get the "creation bytecode" of an already deployed contract in Solidity?

I am looking to get some already deployed code working for myself. With ethers.js I can get the bytecode in the following way ethers.getCode("CONTRACT ADDRESS") However, this is a ...
zen's user avatar
  • 41
1 vote
1 answer
297 views

Problem with Solidity compiler

recently I started doing solidity tutorial. Everything was going okay on remix but when i switched to VS Code I got compiler error I changed it to: but it doesnt solve the question why 0.8.8 ...
joaszek's user avatar
  • 11
2 votes
0 answers
28 views

Why No Constant Linking?

Similarly to library linking https://docs.soliditylang.org/en/latest/using-the-compiler.html?highlight=compiler%20options#library-linking why is there no constant linking for the compiler? The only ...
mermeladeK's user avatar
1 vote
1 answer
38 views

Hi Everyone. Newbie here in solidity . I am getting the common erro "ParserError: Expected '(' but got identifier" with my code

I am getting the common error "ParserError: Expected '(' but got identifier" with my codeb. I have tried to solve it using the existing solutions but seems my knowledge is limited, hence not ...
Jakku's user avatar
  • 11
1 vote
0 answers
204 views

Trouble with Solidity Compiler Version when combining Aave and Openzeppelin in Foundry

I'm trying to follow this tutorial by Patrick Collins on Flashloans but in Foundry: https://www.youtube.com/watch?v=Aw7yvGFtOvI&t=328s When in try to forge build I get the following error: : src\...
banyan's user avatar
  • 21
2 votes
1 answer
267 views

How to enable multiple compiler versions in solc js?

I'm trying to compile contract A(located in A.sol) that has a dependency on contract B(located in B.sol) using solc-js, where A has solidity version 0.8.0 and B version 0.7.6. The solcjs version that ...
MShakeG's user avatar
  • 1,443
1 vote
1 answer
73 views

Brownie doesnt compile but says it did

if i run brownie compile i get INFO: Could not find files for the given pattern(s). Brownie v1.19.0 - Python development framework for Ethereum Project has been compiled. Build artifacts saved at C:\...
Toshiro Nakamoto's user avatar
1 vote
1 answer
805 views

Is it possible to compile to YUL?

So the solidity compiler compiles solidity first to YUL and then to machine code. Is it possible to compile it just to YUL and look it over? It would be really helpful to learn how YUL works. Thanks.
Kuly14's user avatar
  • 322
1 vote
1 answer
982 views

I can not import openzeppelin, but get error 'File import callback not supported'

I get 'File import callback not supported' when I try to compile my simple solidity contract, that imports ERC721. Can anybody help? Here is what I have already done: I have installed openzeppelin in ...
utroelski's user avatar
1 vote
1 answer
723 views

TypeError: Invalid URL at new NodeError when typing the command npx hardhat run scripts/deployGoldenFoxNFT.js --network rinkeby

I run into this error when i try to run with Hardhat. Any idea of what it can be the solution? Thanks a lot in advance
LAURA IOANA's user avatar
0 votes
0 answers
38 views

CompilingError: Stack too deep, try removing local variables [duplicate]

I have a function that lists an NFT on a marketplace for sale. In the process, it keeps records by saving data in a struct inside nested maps represented by the NFT address and token ID. I am running ...
Weivy's user avatar
  • 1
0 votes
1 answer
292 views

Variable declaration

I am new to solidity.Below is the snippet of solidity source code which I came across :- pragma solidity ^0.5.1; library SafeMath { function sub(uint256 a, uint256 b) internal pure returns (...
Brijesh's user avatar
  • 43
1 vote
0 answers
86 views

Pure function that reads from storage, compiler bug?

I just came across this while testing around with the Diamond Storage pattern. Here is a 'pure' function that reads from storage. This had me wondering, is there actually any difference between pure ...
phaze's user avatar
  • 1,555
0 votes
2 answers
52 views

Remix compiler error on my last code line 187 - any solution?

My code below still popping one error on line 187 - if.... on remix.ethereum compiler - any solution? pragma solidity ^0.4.4; contract Token { /// @return total amount of tokens function totalSupply()...
SkyPilot's user avatar
1 vote
1 answer
687 views

unexpected revert behaviour using custom errors in pure function

in the code below, if a revert using the custom error inside the pure function it reverts with a different error (below). If I do the same things without pure, it reverts with the custom error as ...
sola24's user avatar
  • 1,188
1 vote
0 answers
36 views

Why Is My Smart Contract Not Able To Be Optimized?

I have a smart contract that is barely below the limits of the solidity compiler. When I try to enable optimization at 200 runs I get this error: CompilerError: Stack too deep when compiling inline ...
Jim's user avatar
  • 173
3 votes
1 answer
438 views

How to configure EVM in IntelliJ with Solidity plugin

There is a related question/answer from 5 years ago but back then the plugin only provided syntax highlighting. Now, I know I can compile from the solidity file opened in IntelliJ, clicking on a play/...
mehrlicht's user avatar
0 votes
2 answers
953 views

hardhat beginner "Nothing to compile" error

following hardhat beginner tutorial. This is how I did it, first run "npx hardhat " command and created basic sample project. After that run following command npm install --save-dev @...
yasurid's user avatar
1 vote
3 answers
174 views

Which compiler version should I use?

// SPDX-License-Identifier: MIT pragma solidity >=0.6.0 <0.9.0; import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; import "@chainlink/contracts/src/v0....
Hitesh's user avatar
  • 21
2 votes
0 answers
135 views

Truffle compiles different binary than RemixIde, even with same compiler version and evm version

The code: pragma solidity <0.9.0; contract Callee { address public a; address public b; function test(uint256 i) public returns(uint256){ a=address(this); b=msg....
aj3423's user avatar
  • 251
1 vote
1 answer
37 views

Any document for the layout of the smart contract binary?

I'm trying to write a disassembler to disassemble the binary code of smart contract. There are trailing bytes at the end, which causes disassemble problem. For example, the last few lines of this ...
aj3423's user avatar
  • 251
2 votes
1 answer
1k views

How to complie smart contract in node.js [solc version: ^0.8.13]

I would like to complie my smart contract code at node.js. Although solc version at package.json and solidity version at smart contract code are same, it doesn't work. complie.js const path= require('...
jjjoo's user avatar
  • 23
2 votes
0 answers
115 views

ParserError: Expected '{' but got reserved keyword 'override' ) external override returns (bool) { ^------^

Can someone fix the code problem below? I compile in remix.ethereum.org , it show ParserError: Expected ';' but got '}' } external override The code: pragma solidity 0.5.8; /** Ropsten instances:...
funny cartoon's user avatar