-
Notifications
You must be signed in to change notification settings - Fork 3.8k
[enhancement] [2.1rc] ACTION_RETURN_VALUE enabling read only functions #9822
Comments
This is personally the approach I use as well and I think some of Liquid's products uses it as well:
It feels hacky to do this and having a proper way like Ethereum view fns would be ideal. |
As explained by Aaron from greymass:
|
As Michael pointed out on Telegram, large query transactions may reach the hard transaction limit of 30ms, or the accounts CPU limits. As query transactions don't enter the blockchain, there should be a mechanism to allow large query txs (strategy 1) or long txs that don't enter the blockchain (strategy 2) while also considering the security of the API and prevention of DDOS attacks. API nodes should always be able to choose if these features are exposed. |
This is really helpful input, thanks guys! We're working on this, although I don't yet have an ETA to share. Please keep the feedback coming! |
From Aarin Hagerty
|
From @abourget
|
See Telegram December 16-19 https://t.me/c/1139062279/252476
Issue
Blockchain clients can only use
get_tables
API to read blockchain data. This has several problems for application developers:A few workarounds exist for the above problem:
With ACTION_RETURN_VALUE
With the new functionality of ACTION_RETURN_VALUE #8327 in EOSIO 2.1rc, there is a way to create such complex queries on the server, guaranteeing consistency with the EOSIO database. An example query would be to return all accounts with a balance > 1000 SYS and that have more than 10 SYS staked that currently has an active name bid. An action can now be created which returns a vector of these accounts. This functionality works when the action is executed on the node by adding it to the blockchain, which may be valid on private EOSIO networks but is not feasable on public networks such as EOS where CPU costs prohibit this. A workaround exists to add an additional action to the tx with an action that always fails, which is not neat, a familiar or obvious strategy for application developers.
This issue highlights that it may be feasible to build the following features to enhance ACTION_RETURN_VALUE for the benefit of application developers.
Proposals:
push_transactions
to specify that the tx should not be added to the blockchain. This would let clients send the tx to the node, the node would execute and provide the execution result but not add it to the blockchain. This is a more general approach, in addition to allowing for tx results to be read and hence txs to query the blockchain, this would additionally support write txs and give developers the ability to easily get an expectation on the consequences of a tx before it is sent. (this is different to the --dont-broadcast parameter of cleos's push transaction API (or similar parameters in eosjs), which doesn't even send the tx to the node, just prints the serialized data)An additional benefit of either of the above would mean that the write AND read code for each smart contract would be logically coupled together. While not a functional requirement, this would make code management easier for application developers.
An additional benefit, useful for private networks, is that read transactions can have authorization checks using
require_auth
and allow data privacy at the node API level. this is currently only possible with a middleware layer above the nodeos API, or nodeos plugins.The text was updated successfully, but these errors were encountered: