0

I deployed a T-REX token (version 3.9.4) to first Sepolia then also to a local ganache instance and my process (Token (and substructures) deployment -> Add Token agent -> Create Identity -> Register Identity -> Mint token) completes with every step save for the final step: the Minting. I didn't notice this at first because I was using a custom block gas limit (-l option on the cmd) and the process didn't run into any issues then.

My stack involves compiling then generating .abis with Truffle then using Web3J to generate java wrappers from those.

here's my truffle-config.js

module.exports = {
    contracts_directory: "./node_modules/@tokenysolutions/t-rex/contracts",
    compilers: {
        solc: {
            version: "0.8.17",
            settings: {
                optimizer: {
                    enabled: true,
                    runs: 1200
                }
            }
        }
    }
};

I experimented with a few different settings for the runs starting with 200, then 5, then 1200, but neither resulted in significant change.

My process relies on Web3j fundamentally, that is where I set my gas price and gas limit. I first experimented with the default values for both:

public static final BigInteger GAS_LIMIT = BigInteger.valueOf(9_000_000);
public static final BigInteger GAS_PRICE = BigInteger.valueOf(4_100_000_000L);

(this means that transaction gas limit is 9 million gas units and gas price is 4.1 billion Wei per unit).

I tried nudging either of these around, both up and down, but neither resolved my issue. That made sense, because the reported gas usage (as reported by ganache) is 42315 (in gas units). The same experiment resulted in essentially the same gas usage on Sepolia as well: https://sepolia.etherscan.io/vmtrace?txhash=0x2af24617fce5dc75f0ddfc88f6df31b13b1c1d52474cad9e0c3d04eacab9260c . This trace also shows that the available gas doesn't run out before the revert, or at least it appears to me that way.

I also don't get any specific error message, all I get on Sepolia is "execution reverted", and "revert" on ganache.

Ganache log example:

eth_sendRawTransaction

Transaction: 0x0522690a5a296160435af96d41b17c4235f8589e95fedfad4c9f6ebf301a3307 Gas usage: 42315 Block number: 55 Block time: Thu Jun 08 2023 14:49:36 GMT+0200 (Central European Summer Time) Runtime error: revert

How come this is seemingly resolved with the block gas limit being raised? What is the root cause of this problem? And how can I find a solution for it?

  • Can you share the contract source? The contract is reaching an error condition and it is failing there. – Ismael Jun 16 '23 at 01:53

0 Answers0