2

In early versions of the ABI encoder/EVM/Solidity, the budget for function parameters was 16 fixed-length variable or 8 variable-length variables.

The logic was simple enough - a budget of 16 slots with strings and bytes taking two slots.

Local reference type capacity has also increased from 13 to 15 memory assignments in tandem.

The old rule doesn't hold anymore. We seem to have a little more space. The following 2 examples compile and as you can see, it accommodates 11 and 15 strings, respectively.

Can someone explain the new budget rules and link to an authoritative source?

// SPDX-License-Identifier: UNLICENSED

pragma solidity 0.8.13;

contract AbiTest {
    string[] strStor;

    function callWithStrArgs(string memory one, string memory two,
        string memory three,string memory four,string memory 
        five,string memory six,string memory seven, string memory 
        eight, string memory nine, string memory ten, string memory 
        eleven) public pure {
          string memory loc = one;
          loc = two;
          loc = three;
          // and so on...      
    }

    function localTest() public {
        string memory one = "abc";
        string memory two = "abc";
        string memory three = "abc";
        string memory four = "abc";
        string memory five = "abc";
        string memory six = "abc";
        string memory seven = "abc";
        string memory eight = "abc";
        string memory nine = "abc";
        string memory ten = "abc";
        string memory eleven = "abc";
        string memory twelve = "abc";
        string memory thirteen = "abc";
        string memory fourteen = "abc";
        string memory fifteen = "abc";

        strStor.push(one);
        strStor.push(two);
        // and so on...     
    }
}  

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.