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

NEP: Triggers for NeoContract #15

Merged
merged 8 commits into from
May 9, 2018
Merged

NEP: Triggers for NeoContract #15

merged 8 commits into from
May 9, 2018

Conversation

erikzhang
Copy link
Member

Trigger is a mechanism for triggering execution for smart contracts. This NEP defines 4 kinds of triggers, they are Verification, VerificationR, Application and ApplicationR.


==Abstract==

Trigger is a mechanism for triggering execution for smart contracts. This NEP defines 4 kinds of triggers, they are <code>Verification</code>, <code>VerificationR</code>, <code>Application</code> and <code>ApplicationR</code>.
Copy link

Choose a reason for hiding this comment

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

Since writing "two kinds of triggers " in Section "Rationale", you might wanna change "4 kinds of triggers" to "four different kinds of triggers"


==Rationale==

Currently, we have two kinds of triggers in NeoContract: <code>Verification</code> and <code>Application</code>. These two triggers make smart contracts to be able to verify the transactions and modify the states of the blockchain.
Copy link

Choose a reason for hiding this comment

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

"These two triggers make smart contracts to be able to verify the transactions"

should maybe be changed to:

"These two triggers make smart contracts able to verify transactions"


===Verification===

This trigger indicates that the contract is being invoked as a verification function. The verification function can accept multiple parameters, and should return a boolean value that indicates the validity of the transaction or block.
Copy link

Choose a reason for hiding this comment

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

"This trigger" could be made clearer by changing it into "The VerificationR trigger indicates"


===VerificationR===

This trigger indicates that the contract is being invoked as a verification function because it is specified as a target of an output of the transaction. The verification function can accept no parameter, and should return a boolean value that indicates the validity of the transaction.
Copy link

Choose a reason for hiding this comment

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

Maybe "The verification function can accept no parameter" should be changed into "The verification function accepts no parameter" or "... function does not accept any parameter" or "... function takes no parameters"


===Application===

This trigger indicates that the contract is being invoked as an application function. The application function can accept multiple parameters, change the states of the blockchain, and return any type of value.
Copy link

Choose a reason for hiding this comment

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

"The Application trigger indicates that.."


===ApplicationR===

This trigger indicates that the contract is being invoked as an application function because it is specified as a target of an output of the transaction. The application function can accept no parameter, change the states of the blockchain, and return any type of value.
Copy link

Choose a reason for hiding this comment

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

"The application function can accept no parameter" same as above: "takes no parameters" or any of the other suggestions :)

@localhuman
Copy link
Contributor

  • Would the Verification and VerificationR triggers be run for each transaction? Or is VerificationR only run on transactions which have a non-standard verification script?

  • What does the R in VerificationR stand for?

  • Would VerificationR have full read-write access for blockchain data? Could it create another contract?

@Nikolaj-K
Copy link

I supposed "reject"?
Is the argument scheme of Main (operation and then args) more than a suggestion?

@canesin
Copy link

canesin commented Oct 17, 2017

@erikzhang wouldn't neo-project/neo#84 eliminate the need for this ?

@erikzhang
Copy link
Member Author

@localhuman

  1. VerificationR will be triggered only if the deployed contract has been specified as the target of an output of transaction. Immediate contract won't be triggered as VerificationR or ApplicationR.
  2. R means "recipient" or "receiver".
  3. No, Verification and VerificationR can't change the states of blockchain.

@RavenXce
Copy link

RavenXce commented Feb 8, 2018

Is anyone assigned to this? Also I'm assuming the new triggers must only apply to InvocationTransaction?

@erikzhang
Copy link
Member Author

They apply to every TransactionOutput if the output is a deployed contract.

@erikzhang erikzhang merged commit 7d43598 into master May 9, 2018
@erikzhang erikzhang deleted the Triggers branch May 9, 2018 05:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants