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

Remove unnecessary constructors and data accounts from Solana contracts #1480

Open
LucasSte opened this issue Aug 8, 2023 · 2 comments
Open
Labels
solana The Solana target

Comments

@LucasSte
Copy link
Contributor

LucasSte commented Aug 8, 2023

After that PR #1474 is merged, constructors are left in an awkward situation. If a contract has no storage variables, no function will require a data account, but the constructor will still need an account to be initialized.

Take this example:

contract Foo {
    function bar(OtherContract c) public returns (string) {
        return c.call();
    }
}

Although bar does not require a data account, we still need to call Foo's construction and initialize its data account, which will never be used.

@LucasSte LucasSte added the solana The Solana target label Aug 8, 2023
@LucasSte LucasSte changed the title Remove unnecessary constructors from Solana contracts Remove unnecessary constructors and data accounts from Solana contracts Aug 8, 2023
@jporwal05
Copy link

If this can be picked up as good-first-issue for a rust and blockchain beginner then I would like to pick this up!

@LucasSte
Copy link
Contributor Author

LucasSte commented Sep 5, 2023

If this can be picked up as good-first-issue for a rust and blockchain beginner then I would like to pick this up!

This task requires a significant amount of work. One needs to understand Solana's account model and how we modeled Solidity contracts around a program account to come up with a plan.

After that, changes in sema and codegen are necessary, in addition to writing more tests and updating the current tests to work with the new changes. As this feature diverges from the current implementation of constructors, the documentation will need the respective updates.

I wouldn't classify this issue as good for beginners, but if you are motivated to spend several weeks on it, please reach me on Discord so we can discuss it further.

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

No branches or pull requests

3 participants
@jporwal05 @LucasSte and others