Tuesday, March 5, 2024

Re: Deploy multiple smart contracts on a single address and interact with them with web3.py

here is an article on managing the *stack too deep* error 
https://soliditydeveloper.com/stacktoodeep

here is also a stackexchange conversation related to it
https://ethereum.stackexchange.com/questions/19587/how-to-fix-stack-too-deep-error

On Tue, Mar 5, 2024 at 6:22 PM Yao Marius SODOKIN <yaomariussodokin@gmail.com> wrote:
ok thanks you sir, 
As far as storage variables concerned, I want create many instances of a contrat in my web API, then I use Structs for most of variables, That why I use really locals variables in my functions. if you have resources on it, you recommend to me

Le mar. 5 mars 2024 à 18:08, kolapo goodness <goodnesskolapo@gmail.com> a écrit :
evm (ethereum virtual machine) uses the stack data structure and the depth is 1024 so if you get a stack too deep error you should check your solidity code and can also implement some slot packing techniques. the main issue comes from one or more of your functions where you're using a lot of variables if you can reduce it by loading directly from storage instead of local variables that can also solve the problem

On Mon, Mar 4, 2024 at 11:46 PM Yao Marius SODOKIN <yaomariussodokin@gmail.com> wrote:
Hello dear all,
I am developing a decentralized application;

It implements smart contracts with solidity. each object represents a smart contract. So I wrote the Transaction, Project, User contracts. I want to deploy these contracts to a single address; and interact with them from my REST API developed in Django Rest Framework, using the web3.py library

The problem I have is:
1-I wrote the code of the three contracts in a single contract, this contract is heavy and cannot be compiled
2- I finally wrote the contracts differently, deployed them to different addresses, and from another contract I want to interact with these contracts. This allows me to interact with a single contract from my API in order to call on others. The size of this contract is also too much and cannot be compiled.
here is the error message:

CompilerError: Stack too deep. Try compiling with `--via-ir` (cli) or the equivalent `viaIR: true` (standard JSON) while enabling the optimizer. Otherwise, try removing local variables. When compiling inline assembly: Variable headStart is 1 slot(s) too deep inside the stack. Stack too deep. Try compiling with `--via-ir` (cli) or the equivalent `viaIR: true` (standard JSON) while enabling the optimizer. Otherwise, try removing local variables.

How to do ? or what alternative or means used? The objective is to interact with smart contracts deployed from my API in Django Rest Framework

Thanks

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACiPtiLzQnM9nH%3DiCYaggX4yM9i2kv2-i1dByZGwvDmE1RbkZw%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEtv5e%2B%3Dcksv83F8b_RbgT8kfruGdN%2B6KiLz4JOLyP%3DeMKVVzg%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CACiPtiLZFyDEBTGiRmXkDQeM8xf_u_OqavSFwYXSKcg4X0%3DwDw%40mail.gmail.com.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEtv5eLAv-q-gdXF58Zfu0TBGSzqo2KMHBVh3AKO0n%3DpAqVpHg%40mail.gmail.com.

No comments:

Post a Comment