Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Solidity] Tuple Support #1647

Draft
wants to merge 155 commits into
base: master
Choose a base branch
from
Draft

[Solidity] Tuple Support #1647

wants to merge 155 commits into from

Conversation

JacobYiu
Copy link

@JacobYiu JacobYiu commented Feb 6, 2024

No description provided.

JacobYiu and others added 30 commits November 29, 2023 12:56
Sync Forked Repo With Main Repo
@@ -2602,7 +2830,7 @@ bool solidity_convertert::get_func_decl_ref(
exprt &new_expr)
{
// Function to configure new_expr that has a +ve referenced id, referring to a function declaration
// This allow to get func symbol before we add it to the symbol table
// This allow to get func syfmbol before we add it to the symbol table
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo

return output;
}

std::vector<nlohmann::json> solidity_convertert::make_struct_elementary_types(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can obtain the type info in the typeDescriptions node in each component, right?

You can do something like:

   if (get_expr(args.at(i), members.at(i)["typeDescriptions"], init))
        return true;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have yet to delete this function in case I may use it in the future for an unknown reason. I will delete it shortly

std::string label = std::to_string(expr["id"].get<int>());
std::string name, id;
name = "tuple#" + label;
id = "sol:@C@" + current_contractName + "@" + name;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above

// e.g. (uint age, uint money) = (....);
if(context.find_symbol(id) != nullptr)
{
std::cout << "Could not find symbol" << std::endl;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe just log_error

@@ -40,7 +41,7 @@ solidity_convertert::solidity_convertert(

bool solidity_convertert::convert()
{
// This function consists of two parts:
// This function consists of two output:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we keep the word "parts"

@ChenfengWei0
Copy link
Collaborator

Overall, it looks good. Just some small comments:

  1. As said, for each tuple comment, we can obtain the type info from typeDescriptions nodes. However, I am also okay with the current implementation. You can stick to the make_struct_elementary_types if you are unfamiliar with the get_expr solution I mentioned.
  2. tupleQueueIds. Do you know if it will work when handling interaction between contracts e.g. inheritance? Will there be an ID conflict?
contract Base
{
  uint x;
  bool y;
  constructor() { (x,y) = (1,true); }
}

contract Derived is Base
{
  function test() public 
  {
    assert(y == true);
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants