-
Notifications
You must be signed in to change notification settings - Fork 148
Allow array of single value to pass CHECKSIG #54
Comments
Do you want to unify CHEKSIG and CHECKMULTISIG? |
I think thats the idea, but that would increase execution time for all regular |
@shargon in fact, I don't want to unify, because the "canonical" (or standard) structure of a CHECKSIG is more simple than CHECKMULTISIG, and this expects more parameters. What I want to do is to allow CHECKSIG to succeed if user passes the following invocation script:
@ixje The advantage I see is that all standard verification scripts could naturally expect arrays as input. The benefits could be seen easily in our NEO-SMACCO composer (that creates smart accounts based on simple json): http://neoresearch.io/smacco-demo/ |
Follow-up to to discussion at: neo-project#54
Ok, I implemented the feature hahaha easier to discuss with an implementation proposal ;) |
the example implementation was helpful to clarify the intention. I left my comments there. |
Agree with @ixje. On the other hand, I have plans to remove |
@ixje thanks a lot for the comments. |
This opcodes will be syscalls? @erikzhang I agree with the weird dependence of GetMessage, should be moved outside |
We can use Line 382 in 94a91ae
According to my plan, in NEO 3.0, all contracts will have a uniform entry point for all triggers: object Main(string operation, object[] args) For So the system will trigger the contract like this: verify(tx, message, signature); The bool verify(Transaction tx, byte[] message, byte[] signature)
{
byte[] pubkey = {};
return OpCodes.VERIFY(message, signature, pubkey);
} |
The plan is good @erikzhang ! I just think we don't need to pass the transaction or the message itself by parameters, as they could be accessible already on ApplicationEngine. May I suggest the operation object Main(string operation, object[] args) {
return (operation=="verify") && (args.Length==1) && verify((byte[])args[0], GetMessage(), pubkey_x);
} So, if you allow me to go even deeper, I guess Using this logic, any user should be able to submit a "future checksig" this way:
So, we could support it already by just checking if signature bytearray is in fact |
I created a proposed "verify" validation on CHECKSIG that would work in your current proposal Erik. I will take last parameter from args as if it was the signature, so even if things change regarding the first two system parameters (tx and message), it will work anyway. This way, wallets can already start building Neo 3.0 compatible invocations. neo-vm/src/neo-vm/ExecutionEngine.cs Lines 600 to 613 in 9033a97
|
Let's refine this proposal first. Please don't start writing code for it. |
Let me organize the steps: Step 1, the wallet provides a signature or other parameters in
Step 2, when other nodes verify the transaction, they need to perform an additional packaging operation on the items in the stack and push
At this point, the parameters in the form of a unified entry point are ready. Step 3, after that, the node should execute
It may seem a bit verbose and may need to be optimized. The first optimization scheme is to combine
The second optimization scheme is to remove the two SYSCALLs and instead automatically pass in the parameter message in step 2:
Then the
Which way is better? |
Sorry about the rush coding Erik hahaha I was just giving an example to clarify the discussion and show how it could be easily integrated even on current CHECKSIG for smooth transition :)
And nodes verify that top stack items are: bytearray and array, respectively, otherwise it fails execution automatically. Then the rest could be done in verification script itself. It would be also nice to have a unified |
Invocation:
Verification:
This looks perfect except that the |
Very good Erik! This is a nice format! Some time ago I did some proposal for us to allow hashing the names of interop functions.... if we adopt 8 bytes it could cut some space in many applications. |
Maybe we should implement this proposal first: neo-project/neo#264 |
Now it's neo-project/neo related. |
Guys, do you think that's ok to change line
neo-vm/src/neo-vm/ExecutionEngine.cs
Line 588 in ab5f939
The idea is that we could use the exactly same mechanism for single sigs and multi sigs, that can simplify a few things. Something like this:
https://github.com/neo-project/neo-vm/blob/master/src/neo-vm/ExecutionEngine.cs#L618-L619
I can make the PR, just wondering if that's too crazy :)
The text was updated successfully, but these errors were encountered: