Skip to main content

Questions tagged [warnings]

Questions are related to the warnings appearing in the code.

Filter by
Sorted by
Tagged with
1 vote
2 answers
102 views

Contract code size is 24798 bytes and exceeds 24576 bytes

I have a contract that all of the functions either change the state or return data from storage. I have tried the techniques to reduce the size and it helped a bit. However, I need to add a couple ...
Bengican Altunsu's user avatar
0 votes
2 answers
47 views

Compilation Warning: Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting name of variable

I am getting a compilation error Warning: Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable. --> contracts/...
sounxk's user avatar
  • 1
0 votes
1 answer
63 views

"Warning: Unreachable code" in solidity when overriding a function to make it fail and that is used elsewhere

I have the following code sample pragma solidity ^0.8.13; error MyError(); abstract contract A { function f1() public pure virtual returns(bool); function f2() public pure virtual returns(...
tazous's user avatar
  • 1
1 vote
1 answer
188 views

How to silence warnings in return variables when they are not used?

I have the following function in solidity: function validateAndPayForPaymasterTransaction( bytes32, bytes32, Transaction calldata _transaction ) external payable override onlyBootloader ...
Falcon Stakepool's user avatar
0 votes
1 answer
151 views

Warning: This declaration shadows an existing declaration

Can you please help me out with this code, where I get the six warnings shown bellow? As a result, the withdrawal doesn't go through with the specified amount. But I don't know how to get around it. ...
f22daniel's user avatar
  • 353
-1 votes
1 answer
57 views

Remix (static analysis) gives a warning on protected selfdestruct

I have the following SC containing the protected selfdestruct: // SPDX-License-Identifier: MIT pragma solidity ^0.5.1; contract Discontinue { address payable owner ; constructor () public { ...
zak100's user avatar
  • 1,406
0 votes
0 answers
88 views

how can i fix these loop warnings and gas fee warnings. the code is compiled fine just want to update these warnings before launch

Here's the contract code to the token "alex". Below are the warnings from remix. Thanks for any assistance // SPDX-License-Identifier: MIT pragma solidity 0.8.4; contract alex { ...
tay's user avatar
  • 1
1 vote
0 answers
365 views

tx fee exceeds the configured cap while deploying in contracts in private network in geth

While deploying my contracts over private network which is configured in geth I am getting the following warnings. It seems suspicious to me as if some intruder is trying to breach the network. I ...
NinjaMAN's user avatar
  • 419
3 votes
3 answers
5k views

compilerMetadata is modifying/artifacts/NAME_OF_CONTRACT.json

I have been getting a compiler warning in the online remix IDE that is not quite clear to me (the contract compiles and deploys without any errors): compilerMetadata is modifying/artifacts/...
Niccola_Tartaglia's user avatar
2 votes
1 answer
7k views

Warning: Unnamed return variable can remain unassigned. Add an explicit return with value to all non-reverting code paths or name the variable

I have a hash table: mapping(address => address[]) private airlineVotes; I am looking to return the table using the function: function addAirlineVotes(address newAirline, address senderAddress) ...
alpo's user avatar
  • 164
0 votes
1 answer
425 views

Duplicate contract name

I have two contracts. Contract A is given by: //A.sol pragma solidity ^0.5.8; contract A { address owner; constructor() public{ owner = msg.sender; } function transferTo(address to,...
zak100's user avatar
  • 1,406
1 vote
0 answers
43 views

Question about Remix warnings: gas cost and same name of variable

When I try to compile the following contract on Remix: pragma solidity ^0.5.9; contract good{ mapping (address =>uint) public balances; function withdraw () public { uint balance = ...
zak100's user avatar
  • 1,406
4 votes
1 answer
801 views

VS code Expected identifier, got 'LParen'solc

I keep getting this error/warning on my vscode when I emit events and build constructors. or After a bit of googling I understand it is something about my compiler, since solc <0.4.18 does not ...
João Quintanilha's user avatar
5 votes
1 answer
1k views

VS Code and Solidity files have a lot of warnings

Every time I use VS Code to develop Solidity, files I have a lot of this weird warnings saying: no-trailing-whitespace: Line contains trailing whitespace I googled a bit and I understand why they ...
João Quintanilha's user avatar
0 votes
3 answers
3k views

Remix Warning: Function state mutability can be restricted to pure

Which is the best, view or pure instead of constant? library SafeMath { function mul(uint256 a, uint256 b) internal constant returns (uint256) { uint256 c = a * b; assert(a == 0 || c / a == ...
upracha's user avatar
  • 59
1 vote
1 answer
142 views

Static Analysis raised 9 warning(s) that requires your attention. Click here to show the warning(s)

I receive these warnings in REMIX so the question is: Can I compile my contract and then verify it regardless of these warnings? pragma solidity ^0.4.25; library SafeMath { function mul(uint256 a,...
upracha's user avatar
  • 59
0 votes
2 answers
770 views

Remix warning - Is constant but potentially should not be.

I am getting the warning on the code shown below. Could you please assist me know to resolve this warning ? warning message - "Is constant but potentially should not be"
iappmaker's user avatar
  • 813
0 votes
1 answer
144 views

Why does this trivial function has "Gas requirement high: infinite"?

I wrote this trivial contract in Remix: pragma solidity ^0.4.24; contract HelloWorld { function greet() public pure returns (bytes32) { return bytes32('Hello World!'); } } I got ...
Erel Segal-Halevi's user avatar
0 votes
1 answer
276 views

How can I read the entire Solidity warning in the Remix browser?

When I get a Solidity warning in the Remix browser, I can usually just hover over the warning symbol to the left of the editor and read the error message. But, this time the end of the error message ...
Ron Allen Smith's user avatar
0 votes
2 answers
80 views

Initializing full array warning

I initialized a full uint256 array like this: uint256[2**256-1] private test; And I get this warning for the compiler: Warning: Variable covers a large part of storage and thus makes collisions ...
Tadej Vengust's user avatar
0 votes
1 answer
179 views

Yellow flags, simple replacement?

Can anyone give me a straight answer, (not trained stranded in no man lands) do I just change the words from (functions to Constructor) yellow warnings below. browser/ballot.sol:77:5: Warning: ...
ABonney's user avatar
  • 25
4 votes
2 answers
4k views

Remix Warning - No visibility specified, Violate Checks-Effects-Interaction pattern, Function state mutability can be restricted to pure - Can ignore?

Two months ago, I wrote a smart contract with Remix.ethereum.org. Line 1 of my code has: pragma solidity ^0.4.11; It compiled fine with no errors and nor warnings. I tested every function in ...
Curt's user avatar
  • 307