Comments (3)
- I would add an
entry
/exit_blocks
inFunction
. - Should we consider the possibility for a function/subroutine to have more than 1 entry point? I haven't see this happening in other smart contract platform; but because here we can have custom CFG, if we have a function that is an irreducible loop it could happen? Hopefully not, as we should still have 1 entry point, but better to consider it in advance
- For the user configuration, I think we should not use a dictionary, but a class. We should also load the information from a yaml, or something similar
from tealer.
User Configuration
Contract = {
/* name of the contract, e.g pool. Every contract should have a unique name */
"name": string;
/* filesystem path of the contract, (relative path)*/
"path": string;
/* Type of the contract: one of LogicSig, ApprovalProgram or ClearStateProgram*/
"type": string;
/* Contract's teal version */
"version": int;
/* Names of subroutines present in the contract */
"subroutines": string[];
/* Functions/User operations */
"functions": Function[];
}
Function = {
/* execution path to reach the function's entry block.
The execution path is part of the method dispatcher CFG.
The execution path is array of strings. For example, ["B0", "B1", "B3", "B4"]
The basic blocks "B0", "B1", "B3", "B4" are part of the method dispatcher. The code in these blocks check for function identifier and route to the function accordingly.
The block "B4" is start of the function code.
*/
"execution_path": string[];
/* Name of the operation, function. used as identity in "group_configurations". Should be unique for a contract. */
"function_name": string;
}
Transaction = {
/* A unique id for this transaction. The id is only used to refer this transaction in other transactions of the group configuration. Example: "T1" */
"tx_id": string;
/* Type of the transaction: one of "pay", "keyreg", "acfg", "axfer", "afrz", "appl" or "txn". "txn" can be used to represent any type of transaction" */
"txn_type": string?;
/* if the transaction is to be signed with a LogicSig, specify the contract name and the function name */
"logic_sig": {
"contract": string;
"function": string;
}?;
/* if the transaction is an application call. specify the contract and the function being called */
"application": {
"contract": string;
"function": string;
}?;
/* Transaction's index in the group. if the transaction MUST be present at a predefined index in the group and contracts in the group use an absolute index to access fields of this transaction then specify that index in this field. if the transaction is always the first transaction
in the group then the "absolute_index" should be `0`.
*/
"absolute_index": int?;
/* Relative index of other transactions from this transactions in the group. The relative index specified are predefined and static. The relative index should not depend on any other runtime information, for example, on application arguments. Such relative indices are not completely supported. Not supported completely in the sense that if the contracts in this transaction perform validations on that transaction, Tealer will not be able to consider these validations when analyzing that transaction.
*/
"relative_indexes": [
{
/* id specified in the Transaction "id" field. Need a better field name */
"other_tx_id": string;
/* relative index of "other_tx_id" transaction from this transaction.
For example, if "other_tx_id" transaction must preceed this transaction then relative index is `-1`.
The contract executed in this transaction will access "other_tx_id" transaction using "(Txn.GroupIndex) - 1" */
"relative_index": int;
}?;
]?;
}
GroupConfig = Transaction[]
UserConfig = {
"contracts": Contract[],
"group_configurations": GroupConfig[],
}
from tealer.
Example config:
name: protocol name
contracts:
- name: contract1
path: contracts/contract1.teal
type: LogicSig
version: 6
subroutines:
- sub1
- sub2
functions:
- name: function1
execution_path: [B0, B1, B2]
entry: B2
exit: [B10, B11]
- name: function2
execution_path: [B0, B1, B3]
entry: B3
exit: [B12, B13]
- name: contract2
path: contracts/contract2.teal
type: ApprovalProgram
version: 6
subroutines:
- opt
- delete
functions:
- name: init
execution_path: [B0, B1]
entry: B1
exit: [B13]
- name: clear
execution_path: [B0, B2]
entry: B2
exit: [B13]
groups:
- - txn_id: T1
txn_type: pay
logic_sig:
contract: contract1
function: function1
absolute_index: 0
- txn_id: T2
txn_type: appl
application:
contract: contract2
function: init
absolute_index: 1
- - txn_id: T1
txn_type: axfer
- txn_id: T2
txn_type: appl
logic_sig:
contract: contract1
function: function2
application:
contract: contract2
function: clear
relative_indexes:
- other_txn_id: T1
relative_index: -1
from tealer.
Related Issues (20)
- Use data flow analysis to find constraints on transaction fields in a contract HOT 1
- Update output format to reduce the number of output files
- Detect call to inner transaction without a fixed fee
- Detect paths missing ClearState transaction check
- Update linter + CI
- Add support for instruction "aliases"
- Recover method // push 4 bytes HOT 1
- Add CODEOWNERS
- Add issue template
- Add printer to output possible values of transaction fields in json
- Detect contracts lacking validations on asset id field of asset transfer transaction
- Add printer to list methods, ids and it's args of ARC-4 application.
- Have proper tests related to "usage"
- Have a uniform output directory and filenames
- Fix execution paths generated by group-size detector HOT 1
- Code quality/project standards alignment
- update installation instructions
- pypi package availability HOT 2
- tealer detect with --exclude flag fails HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tealer.