From 12106560f3d9f5b1467ced9ebed667f0770a1fe6 Mon Sep 17 00:00:00 2001 From: Elad Gildnur Date: Sun, 22 Sep 2024 18:15:12 +0300 Subject: [PATCH 1/2] Add the TON spec --- cookbook/specs/ton.json | 518 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 518 insertions(+) create mode 100644 cookbook/specs/ton.json diff --git a/cookbook/specs/ton.json b/cookbook/specs/ton.json new file mode 100644 index 000000000..44260eb71 --- /dev/null +++ b/cookbook/specs/ton.json @@ -0,0 +1,518 @@ +{ + "proposal": { + "title": "Add Specs: Ton", + "description": "Adding new specification support for relaying Ton data on Lava", + "specs": [ + { + "index": "TON", + "name": "ton mainnet", + "enabled": true, + "reliability_threshold": 268435455, + "data_reliability_enabled": true, + "block_distance_for_finalized_data": 2, + "blocks_in_finalization_proof": 3, + "average_block_time": 4500, + "allowed_block_lag_for_qos_sync": 3, + "shares": 1, + "min_stake_provider": { + "denom": "ulava", + "amount": "47500000000" + }, + "api_collections": [ + { + "enabled": true, + "collection_data": { + "api_interface": "rest", + "internal_path": "", + "type": "GET", + "add_on": "" + }, + "apis": [ + { + "name": "/api/v3/masterchainInfo", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/api/v3/blocks", + "block_parsing": { + "parser_arg": [ + "0", + "seqno" + ], + "parser_func": "PARSE_CANONICAL" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0, + "parsers": [ + { + "parse_path": ".params.seqno", + "parse_type": "BLOCK_LATEST" + } + ] + }, + { + "name": "/api/v3/masterchainBlockShardState", + "block_parsing": { + "parser_arg": [ + "0", + "seqno" + ], + "parser_func": "PARSE_CANONICAL" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0, + "parsers": [ + { + "parse_path": ".params.seqno", + "parse_type": "BLOCK_LATEST" + } + ] + }, + { + "name": "/api/v3/addressBook", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/api/v3/masterchainBlockShards", + "block_parsing": { + "parser_arg": [ + "0", + "seqno" + ], + "parser_func": "PARSE_CANONICAL" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0, + "parsers": [ + { + "parse_path": ".params.seqno", + "parse_type": "BLOCK_LATEST" + } + ] + }, + { + "name": "/api/v3/transactions", + "block_parsing": { + "parser_arg": [ + "0", + "seqno" + ], + "parser_func": "PARSE_CANONICAL" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0, + "parsers": [ + { + "parse_path": ".params.seqno", + "parse_type": "BLOCK_LATEST" + } + ] + }, + { + "name": "/api/v3/transactionsByMasterchainBlock", + "block_parsing": { + "parser_arg": [ + "0", + "seqno" + ], + "parser_func": "PARSE_CANONICAL" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0, + "parsers": [ + { + "parse_path": ".params.seqno", + "parse_type": "BLOCK_LATEST" + } + ] + }, + { + "name": "/api/v3/transactionsByMessage", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/api/v3/adjacentTransactions", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/api/v3/messages", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/api/v3/nft/collections", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/api/v3/nft/items", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/api/v3/nft/transfers", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/api/v3/jetton/masters", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/api/v3/jetton/wallets", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/api/v3/jetton/transfers", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/api/v3/jetton/burns", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/api/v3/account", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/api/v3/wallet", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + } + ], + "headers": [], + "inheritance_apis": [], + "parse_directives": [ + { + "function_template": "/api/v3/masterchainInfo", + "function_tag": "GET_BLOCKNUM", + "result_parsing": { + "parser_arg": [ + "0", + "last", + "seqno" + ], + "parser_func": "PARSE_CANONICAL" + }, + "api_name": "/api/v3/masterchainInfo" + }, + { + "function_template": "/api/v3/blocks?workchain=-1&shard=8000000000000000&seqno=%d", + "function_tag": "GET_BLOCK_BY_NUM", + "result_parsing": { + "parser_arg": [ + "0", + "blocks", + "0", + "seqno" + ], + "parser_func": "PARSE_CANONICAL" + }, + "api_name": "/api/v3/blocks" + } + ], + "verifications": [], + "extensions": [] + }, + { + "enabled": true, + "collection_data": { + "api_interface": "rest", + "internal_path": "", + "type": "POST", + "add_on": "" + }, + "apis": [ + { + "name": "/api/v3/message", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/api/v3/runGetMethod", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + }, + { + "name": "/api/v3/estimateFee", + "block_parsing": { + "parser_arg": [ + "latest" + ], + "parser_func": "DEFAULT" + }, + "compute_units": 10, + "enabled": true, + "category": { + "deterministic": true, + "local": false, + "subscription": false, + "stateful": 0 + }, + "extra_compute_units": 0 + } + ], + "headers": [], + "inheritance_apis": [], + "parse_directives": [], + "verifications": [], + "extensions": [] + } + ] + } + ] + }, + "deposit": "10000000ulava" +} \ No newline at end of file From a2f0c4a39695fd64a5fab3387471cb487633181c Mon Sep 17 00:00:00 2001 From: Yarom Swisa Date: Tue, 24 Sep 2024 14:19:33 +0300 Subject: [PATCH 2/2] add verification --- cookbook/specs/ton.json | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/cookbook/specs/ton.json b/cookbook/specs/ton.json index 44260eb71..5accbbb60 100644 --- a/cookbook/specs/ton.json +++ b/cookbook/specs/ton.json @@ -437,7 +437,27 @@ "api_name": "/api/v3/blocks" } ], - "verifications": [], + "verifications": [ + { + "name": "chain-id", + "parse_directive": { + "function_template": "/api/v3/masterchainInfo", + "function_tag": "VERIFICATION", + "result_parsing": { + "parser_arg": [ + "0" + ], + "parser_func": "PARSE_CANONICAL" + }, + "api_name": "/api/v3/masterchainInfo" + }, + "values": [ + { + "expected_value": "*" + } + ] + } + ], "extensions": [] }, {