1

I notice that when I call a function to add an item to an array in one of my contracts, the ABI of the contract changes. The array is declared as

Proposal[] public proposals;

and the method that adds looks like this:

function newProposal(
        address beneficiary,
        uint etherAmount,
        string JobDescription,
        bytes transactionBytecode
    )
        onlyShareholders
        returns (uint proposalID)
    {
        for(uint i = 0; i < proposals.length; i++)
          if (sha3(proposals[i].description) == sha3(JobDescription))
            throw;

        proposalID = proposals.length++;
        Proposal p = proposals[proposalID];
        p.recipient = beneficiary;
        p.amount = etherAmount;
        p.description = JobDescription;
        p.proposalHash = sha3(beneficiary, etherAmount, transactionBytecode);
        p.votingDeadline = now + debatingPeriodInMinutes * 1 minutes;
        p.executed = false;
        p.proposalPassed = false;
        p.numberOfVotes = 0;
        ProposalAdded(proposalID, beneficiary, etherAmount, JobDescription);
        numProposals = proposalID+1;

        return proposalID;
    }

Interface:

..., { "name": "description", "type": "string", "value": "Let's change the world!" },...

My question is why and when does the ABI change, and weather it has any effect on the geth client instances to which I have already added the ABI by specifying the contract's deployment ABI and address.

  • how are you verifying that ABI is changing? If the contract is deployed and you are calling the function on deployed contract then ABI shall remain same, as per my understanding. – Sanchit Jun 28 '17 at 18:03
  • That part of the interface ("Let's change the world!") was not present when I deployed the contract, it only appeared after I called the newProposal for the first time extanding the proposals array. – Alessandro Jun 28 '17 at 20:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.