Skip to content

Contract error for public returns #476

@lydiagarms

Description

@lydiagarms

Overview

For a contract where there are public returns but no secret returns, we get an error in the contracts, because 1 (the default return where the are no secret returns) is not included in the public inputs.

Tasks

Describe which contracts are affected
// SPDX-License-Identifier: CC0

pragma solidity ^0.8.0;

contract AddressesToIntegers {

secret address public lastAddress;
secret uint256 public lastUint;
address public lastAddressPub;
uint256 public lastUintPub;

function convertToInteger(secret address value, address pubValue) public returns (uint256) {
    lastAddress = value;
    lastUint = uint256(uint160(value));
    lastAddressPub = pubValue;
    lastUintPub = uint256(uint160(pubValue));
    return lastUintPub;
}

function convertToAddress(secret uint256 value, uint256 pubValue) public returns (address) {
    lastUint = value;
    lastAddress = address(uint160(value));
    lastUintPub = pubValue;
    lastAddressPub = address(uint160(pubValue));
    return lastAddressPub;
}

}

Describe the bug that should be fixed
In the ganache container we get the reverted error with message: 'Length of inputs[] or vk.query is incorrect!'.

The error comes from the fact that in the shield contract we have "updatedInputs.customInputs = new uint;", when setting inputs in the verify function, we also ignore the final public input 1 in the verify function. However, as there are no secret returns, 1 is the return for the circuit.

Definition of done

When is this task complete?
The above error should not happen for the included test contract.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions