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

TRC: Trigger constant contract #31

Closed
llwslc opened this issue Apr 3, 2019 · 4 comments
Closed

TRC: Trigger constant contract #31

llwslc opened this issue Apr 3, 2019 · 4 comments

Comments

@llwslc
Copy link

@llwslc llwslc commented Apr 3, 2019

tip: 31
title: TRC-31 Trigger constant contract
author: llwslc<llwslc@gmail.com> 
discussions to: https://github.com/tronprotocol/TIPs/issues/31
category: TRC
status: in process
created: 2019-4-3

Abstract

This TIP specifies a new api, which triggers the constant contract without ABI.

Motivation

Many developers hope not upload the ABI, and trigger the contract by their judgment.

Specification

A new api, triggerConstantContract, is introduced.

// api.proto
rpc TriggerConstantContract (TriggerSmartContract) returns (TransactionExtention) {}

The triggerConstantContract parameters are the same as the triggerContract.

triggerConstantContract contract_address method args isHex

Http interface example:

curl -X POST  http://127.0.0.1:8090/wallet/triggerconstantcontract -d {"contract_address":"4189139CB1387AF85E3D24E212A008AC974967E561","function_selector":"foo(uint256,uint256)","parameter":"00000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002","owner_address":"41D1E7A6BC354106CB410E65FF8B181C600FF14292"}'

In case the type of method is not constant will gets error.

Backwards Compatibility

There are no backwards compatibility concerns.

Test Cases

  1. Trigger the constant method by triggerConstantContract.
  2. Trigger the non-constant method by triggerConstantContract.
@taihaofu
Copy link
Contributor

@taihaofu taihaofu commented Apr 4, 2019

Good point! I like the idea to explicitly trigger constant function. So, how would you deal with our origin triggerSmartContract? Should we simply keep it the same as before?

@jeancky
Copy link

@jeancky jeancky commented Apr 4, 2019

What happens when encounter the following situations?

  1. triggerConstantContract a non-constant function with ABI
  2. triggerConstantContract a non-constant function without ABI
  3. triggerConstantContract a constant function with ABI
  4. triggerConstantContract a constant function without ABI
  5. triggerContract a non-constant function with ABI
  6. triggerContract a non-constant function without ABI
  7. triggerContract a constant function with ABI
  8. triggerContract a constant function without ABI

@llwslc
Copy link
Author

@llwslc llwslc commented Apr 8, 2019

  1. triggerConstantContract a non-constant function with ABI throw an exception.
  2. triggerConstantContract a non-constant function without ABI throw an exception.
  3. triggerConstantContract a constant function with ABI return results.
  4. triggerConstantContract a constant function without ABI return results.
  5. triggerContract a non-constant function with ABI push transactions on Blockchain.
  6. triggerContract a non-constant function without ABI push transactions on Blockchain.
  7. triggerContract a constant function with ABI return results.
  8. triggerContract a constant function without ABI push transactions on Blockchain.

@jiangyy0824
Copy link
Contributor

@jiangyy0824 jiangyy0824 commented Jan 15, 2020

#11

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants