tronprotocol / java-tron

Java implementation of the Tron whitepaper
GNU Lesser General Public License v3.0
3.64k stars 1.36k forks source link

BAD_JUMP_DESTINATION #5880

Open charil10 opened 1 week ago

charil10 commented 1 week ago

Hello, I have deployed the custom Tron based Blockchain, I am facing an issue when I am hitting a function of smart contract it gives me this result:BAD_JUMP_DESTINATION

this is the transaction receipt:

{
    "ret": [
        {
            "contractRet": "BAD_JUMP_DESTINATION"
        }
    ],
    "signature": [
        "ee39b9c4c572b95019f038d90b26e1731f7f7b7f8f2421848be3082ace43285f15b6616f8aaaa7c7a25d4e330dd9c5573efc78c3a1c0c20d1227584079f43d0b1c"
    ],
    "txID": "eaa768753e5aa74e59663b76bdcff29e2770a7678862859351eb7dc40d6ca6da",
    "raw_data": {
        "contract": [
            {
                "parameter": {
                    "value": {
                        "data": "052ed893",
                        "owner_address": "PLXWqw3TnAQYszDqFB2cWwAJSs9HwiXMT8",
                        "contract_address": "PT27XKvFJ8JTkDVsaebxQEpsspbcddnEkK"
                    },
                    "type_url": "type.googleapis.com/protocol.TriggerSmartContract"
                },
                "type": "TriggerSmartContract"
            }
        ],
        "ref_block_bytes": "1138",
        "ref_block_hash": "a7441b5e7e6db554",
        "expiration": 1719208284000,
        "fee_limit": 150000000,
        "timestamp": 1719208227072
    },
    "raw_data_hex": "0a0211382208a7441b5e7e6db55440e09eb2c684325a6d081f12690a31747970652e676f6f676c65617069732e636f6d2f70726f746f636f6c2e54726967676572536d617274436f6e747261637412340a153782f047f4468351014dffff5bd88ab7888bacf90a121537ca29a1a6f496292fd6348aea3c681a89d7d131e12204052ed8937080e2aec68432900180a3c347"
}

QUESTIONS: What is the meaning of this error and what is the cause of this error. How Can I fix and solve this issue.

Following is the code of function which Im interacting.:

   function sendToRecipients() public payable onlyOwner isActivated {
        require(
            block.timestamp >= lastDistribution + distributionDelay,
            "Distribution can only occur once per day"
        );
        require(
            getContractBalance() >= FIXED_AMOUNT,
            "Insufficient funds in contract"
        );
        lastDistribution = block.timestamp;
        address[] memory newArray = getFilteredAdd();
        for (uint256 i = 0; i < newArray.length; i++) {
            if (newArray[i] != DEAD_ADDRESS) {
                payable(newArray[i]).transfer(FIXED_AMOUNT);
            }
        }
    }
yanghang8612 commented 1 week ago

Please refer to another issue. This developer seems to have encountered a similar problem to yours.

Can I ask if the network you are deploying the contract to is using one of the java-tron releases, or is it compiled from source code that has been modified by the developer?

charil10 commented 1 week ago

yes I have changed the source code of the java tron as per my requirments. but the changes I have changed the prefix of addresses only @yanghang8612 , the issue you are referring is kinda same I guess it occure when We use arrays in the smart contract

yanghang8612 commented 1 week ago

You can try deploying this contract on the nile testnet and sending the same transactions to test if the exception still occurs.

Here is the nile link

charil10 commented 1 week ago

@yanghang8612 I have changed the source code of VM, so I dont think it will cause any issue on Nile testnet as before deployment we tested on it. My question is is there any changes in 4.7.3Version of TVM related to address and transactions, which result bad destination

yanghang8612 commented 1 week ago

The version - 4.7.3 of java-tron is a non-mandatory upgrade, which contains no corresponding changes to TVM related to address and transactions.

charil10 commented 1 week ago

@yanghang8612 can you please tell me the possible reasons to get this error : BAD_JUMP_DESTINATION I will try to fix the cases and will upload fixed build on mainnet.

yanghang8612 commented 1 week ago