-
Notifications
You must be signed in to change notification settings - Fork 1k
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
Allow multiple scripts per "smart contract" - One for verification and one for invocation #919
Comments
I think this is complicated, and makes things even harder for developers... I've thought about this some time before... the thing is that Triggers are different ways of calling the same script. If dividing this, we would need to solve other things: how to manage funds from an application script? how to link those two things together? |
Hi @igormcoelho, Developers don't understand triggers. Similar to what I said in #894, the trigger is the blockchain point of view, this doesn't help developers understanding the platform.
If we deploy these two scripts separately, the manifest file can reference the script hash of the verification script, and not only that: I believe that in most cases, the scripthash used will be an account script hash, meaning they could use their own accounts instead of having to add this new file or implementing custom logic. Regarding the compiler, if we adopt #837, we can't compile code that won't run, so we need to adjust it anyway. How are we going to protect the developer from committing a mistake? |
#837 is still under discussion, the current format is not good yet. Double script is a possibility, issue is that we have three triggers already, with a possibility of creating a fourth one in the future. |
@igormcoelho we could have a map for the multiple trigger types |
We could have scripts for json encoding / decoding, referenced in the application manifest. This idea also fits well with a "micro-service" architecture, because we can reuse scripts that are already deployed in the blockchain. If people agree with the same "model", they can share the same json serializer/deserializer |
@lock9, I think it makes things worse and would require Dynamic Invoke between both. I think the complexity for safety would be even more complex as Igor highlighted. Simple addresses would require a connection betweem two scripts. |
@vncoelho why dynamic invoke? If it is declared in the manifest, it is not dynamic, right? If we have this disclosed in the manifest, we can have different contexts for these different scripts. Json conversion for example, doesn't need any storage, it is completely stateless! And regarding the complexity: It is more complex for us, or for the dApp developer? Because I'm thinking like a "smart contract developer". You shouldn't care about complexity having a team like this 😏 |
@igormcoelho I think this will be needed for #772, isn't it? We are going to need to reference other scripts, won't we? |
In fact, the idea is to simply call another contract, as a regular Call. What is really useful for this here, is exception handling. This allows simulating "virtual methods" and "polymorphism"... if such method exists on "base contract", it executes, otherwise it throws (UnknownMethodException). So we catch this "fault" and execute our own method. |
@igormcoelho talking about #772, there are 3 scenarios to consider when using inheritance:
I think that we can add these rules in the manifest file, during compilation (complicated?). What do you think? We can make neo more modular if we can add references to other scripts, to be run in "different contexts". I say this because there are some scripts, can be optimized to be run concurrently, "if they meet some criteria" (like being stateless). All of this can be done using the manifest file! So:
@erikzhang your opinion is very important to me (for all of us I guess), could you share your ideas about this? |
In fact, I have a very different point of view for 772 (inheritance), which is quite simpler in fact... if we support exceptions, we naturally will have inheritance (together with @lightszero compile-based entrypoint approach). Another (unanswered) question to me is: do we have non-standard entrypoint methods on Neo3? I don't know it yet. |
Hi,
I think that we could divide Verification and Application triggers into two different smart contract files and use the manifest file to link them.
Instead of checking the trigger type, the developer implements the verification script in a different file.
Why:
The text was updated successfully, but these errors were encountered: