Questions tagged [revert]
The revert tag has no usage guidance.
40
questions
0
votes
1
answer
14
views
Can require() be used to revert low level call() that were made before it?
CODE:
(success, ) = contract.call(); // low level call
if (success) {
// do something
}
// instead of below check, can I just use require(condition)?
if (!condition) {
revert();
}
Instead of ...
0
votes
0
answers
49
views
Safe-core-sdk + fireblocks as signer: Provides different transaction hashes & transaction can be executed in web UI, but not with executeTransaction()
I'm using an Fireblocks account as a signer ( which uses MPC under the hood ) for my gnosis-safe.
There are two problems that I'm encountering:
The transaction hash from the safe-core-sdk and the one ...
1
vote
0
answers
11
views
I can't create a new instance of a contract from a factory contract when using a js script but unit test ok
I have 2 SC:
Factory contract that creates new instance of the 2nd contract via a function:
function createCollection(string memory _name, string memory _symbol, uint16 _maxNFT) public onlyOwner {
...
0
votes
1
answer
39
views
UniswapV2 addLiquidityETH revert ds-math-sub-underflow
I tried this code for many contracts, and sending ETH and approving were done well, but on the addliquidityETH section, I get an error: reverted with 'ds-math-sub-underflow'. I can't understand why.
...
0
votes
0
answers
32
views
Why is it reverted/cancelled?
Executions usually reverted (it transact, deduct fee but fail).
https://etherscan.io/tx/0x1ba2897733c8aacecad59593dd66ed333156645cb1c5d604a45524c9de34f91b
version = 2
provider = "https://mainnet....
0
votes
2
answers
41
views
Transaction gets reverted when using send web3 function
I have a basic smart contract that sets the hash of a string and retrieves it along with verification. The contract works perfectly fine, but the issue is with the .send method of web3 that reverts ...
0
votes
1
answer
16
views
Revert inside a for loop
If there is a revert inside a for loop that is inside a function, and the revert is triggered, will the whole function revert?
0
votes
0
answers
31
views
evm error: revert
This is my first smart contract. I booked a ticket and cancelled it in remix ide connected to metamask. Everything worked fine in remix ide. But my cancelling ticket test failed in foundry.
Test ...
0
votes
1
answer
16
views
Understanding the Purpose of 'revert' Statement in Constructor of Account Abstraction Repo
I'm using the bundler repo, and during a code review, I'm having trouble understanding why the revert is used in the constructor. The intention seems to be to trigger an error, but using revert in ...
6
votes
1
answer
105
views
MetaMask doesn't catch ERC20 reverts
When MetaMask interacts with most contracts, it seems to catch reverts and warn the user. However, when the user interacts with an ERC20 contract's transfer function, MetaMask does not catch a revert. ...
0
votes
1
answer
22
views
external call to non-existing address returns success
I have this simple contracts which forwards the calldata to and external contract:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
contract AccountTest {
/**
* execute a ...
0
votes
2
answers
261
views
How can I decode a low-level return data from a reverting call?
Take the following low-level call written in Solidity:
(bool success, bytes memory response) =
address(proxy).call(abi.encodeWithSelector(plugins.reverter.withReasonString.selector));
I ...
2
votes
2
answers
308
views
what is the correct way to define a custom error
I am someone new to Solidity and going through the custom errors part with REVERT I have found examples where the word "ERROR" is thrown inside CONTRACT
pragma solidity 0.8.18;
contract ...
0
votes
0
answers
27
views
revert statement causes infinite gas estimation in Remix
I wrote an Ownable contract snippet that uses revert instead of require on the OnlyOwner modifier. This causes remix to estimate infinite gas fees.
Does anyone know why?
// SPDX-License-Identifier: ...
1
vote
1
answer
34
views
Why doesn't this try/catch block catch the revert in `asset.symbol`?
I wrote this Solidity function:
function getAssetSymbol(IERC20Metadata asset) internal view returns (string memory) {
try asset.symbol() returns (string memory symbol) {
return symbol;
...
0
votes
1
answer
148
views
Solidity: call() with bubbling the revert reason
Consider the following Solidity code:
(bool success, ) = address(_token).call(
abi.encodePacked(
_RECEIVE_WITH_AUTHORIZATION_SELECTOR,
...
0
votes
0
answers
20
views
VM Exception while processing transaction: revert Tried all but Still getting error
Have tried all things, I am running the following program on Remix there i use Injected web3 Metamask but continously getting error when I call convertToUsd function and same code run through truffle ...
1
vote
2
answers
217
views
try/catch is not catching a revert of external contract
I have created a contract which allows the input of an external contract address. It is expected that the address is for an ERC20 contract. In order to handle the situation where the user enters a non ...
2
votes
2
answers
398
views
I can't deploy a contract with payable function
I am a total beginner and I just started the Patrick Collins's course on youtube.
I apologize for my stupid question but I didn't find similar topic and I have been struggling with this issue for 2 ...
1
vote
1
answer
300
views
Error: call revert exception (method="admin()", data="0x", errorArgs=null, errorName=null, errorSignature=null, reason=null, code=CALL_EXCEPTION)
I was trying to play with proxy pattern. But got stuck with this error.
Error: call revert exception [ See: https://links.ethers.org/v5-errors-CALL_EXCEPTION ] (method="admin()", data="...
3
votes
1
answer
55
views
Why does Remix does not show the description of the error anymore?
I am trying to run one of the methods of my smart contract using Remix and I am getting the following:
Why is not possible anymore to see if this is failing on a require, with the right description ...
1
vote
1
answer
573
views
Is it possible to reverse the gas used in case of using revert?
I try to refund gas to the minimum even after using revert with the following example.
uint A = IERC20(base).balanceOf(address(this));
IERC20(token).transfer(owner,1000000);
then I run swaps ...
2
votes
0
answers
65
views
Is there any way to bubble up custom errors without using low-level assembly?
Is there any way to bubble up custom errors without using low-level assembly?
Say you have a custom error defined like this:
contract For {
error Unauthorized();
function reverWithError() ...
0
votes
0
answers
14
views
unexplained error on contract
My contract is reverting for a random reason and I cannot find out why. I have set a revert message to all my requires() but when I try to send a transaction via remix it does not work for a specific ...
0
votes
0
answers
368
views
Please Help! Warning! Error encountered during contract execution [execution reverted]
After deploying Simple Arbitrage Contract I am trying to deposit eth but deposit is not happening and Debug is showing value 0 wei. While depositing only transaction fee is deducted from metamask not ...
1
vote
1
answer
459
views
Is there a way to handle `abi.decode` errors?
I am trying to decode a bytes value, and while writing tests, I was trying to pass invalid values to force an error.
Although I get the error missing revert data in call exception, I cannot find a way ...
0
votes
1
answer
217
views
Does forge enable you to test your revert messages?
I'm currently using the expectRevert construction and then just printing things out to see the msg, but is there a way to test this via an assertion? perhaps expectRevertWithMessage or something of ...
5
votes
1
answer
1k
views
Understanding eth_sendBundle, eth_sendPrivateTransaction and eth_sendRawTransaction
I want to understand the differences between the three RPC methods, so I can know which one is best for my use case. I am currently using eth_sendRawTransaction to submit transactions to the public ...
1
vote
3
answers
62
views
Why Does This Chainlink Example Code Revert?
I seem to be doing everything exactly as stated in the docs and example code I am following.
When I deploy this to polygon mumbai though and call "generateRandomNumber" it just reverts with ...
3
votes
2
answers
983
views
Yul/Inline Assembly: Revert with a custom error message
I am learning Yul for my Bachelor's thesis and I am currently stuck on understanding a small code segment with require and revert functions.
A simple require function in Solidity ...
require(...
1
vote
1
answer
445
views
ValueError:Gas estimation failed:'execution reverted'.This transaction will likely revert.If you wish to broadcast,you must set the gas limit manually
I get this error when trying to my deploy .sol contract: "ValueError: Gas estimation failed: 'execution reverted'. This transaction will likely revert. If you wish to broadcast, you must set the ...
0
votes
1
answer
74
views
Generic error revert message
I'm having a problem with a contract I've developed recently. I'm interacting with it using a dapp written using ReactJS. The problem is: when I call a specific function of this contract I'm getting ...
0
votes
2
answers
41
views
I'm trying to reverse an array but the transaction keeps getting reverted even though the logic seems right. Can someone help me out?
Here is the code :
// SPDX-License-Identifier: MIT
pragma solidity >=0.5.0 <0.9.0;
contract Day1 {
function reverseArray(uint[] memory arr1, uint length) public pure returns(uint[] memory){
...
0
votes
2
answers
2k
views
Error: VM Exception while processing transaction: reverted with reason string 'Didn't send enough!' on testing contract
Getting this error while testing one of functions functionality in the contract
AssertionError: Expected transaction to be reverted with You need to spend more ETH!!, but other exception was thrown: ...
2
votes
2
answers
321
views
How does the EVM internally revert the contract to the initial state when exceptions are present?
In error handling, assert and require statements revert the state of the contract to the initial state and then the transaction passes or fails depending on the code. I'm trying to understand how this ...
0
votes
2
answers
66
views
Don't understand why this overflows revert
I have a timelock on an ERC20 contract, from year 0 to 9, it works until year 4, but from year 5 onwards it reverts. It fails both on minting and checking (Using 52 seconds intead of weeks for testing)...
1
vote
1
answer
303
views
What are the two arguments in revert opcode?
I am trying to understand the revert opcode and how it works . I understood that it will stop the execution of current context and return 0 to the calling context.
It seems it also takes in 2 ...
1
vote
1
answer
226
views
to.be.revertedWith("Error Message ") returning failed test despite custom error matching "Error Message"
I'm running tests on a raffle smart contract from Patrick Collin's tutorial. I have custom errors in my Solidity file.
When running tests that expect the transaction to be reverted, every single time ...
0
votes
1
answer
114
views
Basic For loop fails in Solidity
I created a simple For loop that should return an array of numbers. But it fails with errored: VM error: revert
I guess there is something fundamental I am missing here, so I hope you guys can help ...
1
vote
1
answer
200
views
Is it possible to get the revert reason during CREATE?
I'm trying to return the revert reason of a revert that is triggered during a CREATE opcode.
I'm currently using
function deployCode(bytes memory bytecode) internal returns (address payable addr) {...