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 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 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?

@BlueHoopor
Copy link

BlueHoopor 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 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

#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
Development

No branches or pull requests

4 participants