-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Extended RPC Method Support and Block Payload Enhancement #6126
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
Comments
Hello Kiln team, thanks! tronprotocol devs: Please help us supporting Kiln on this feature as this is a roadblock for several enterprise-grade platforms to enable TRON Staking capabilities like Fireblocks, Ledger Enterprise, VanEck, TRUST, etc . Let's discuss potential solutions and what would be the best to increase TRON interoperability further :) |
@blockketten Let's discuss the |
@blockketten In Ethereum JSON-RPC, the method What are your suggestions for addressing this limitation? |
@blockketten Thank you for your suggestions. We will consider implementing Tron's Mainnet forking testing tool. It is quite necessary. |
@blockketten Let's discuss the |
Thank you for your answers, @317787106 and @Federico2014! In the Tron developer docs, it states that Tron does maintain a state trie. Can you clarify what you mean when you say that it does not maintain a state trie? Also, what are the precise limitations of the Tron data structure that prevent real time accounting of address transaction counts? @Federico2014 Do you mean that you will implement forking functionality into TronBox? If so, how can we track progress on this? |
@blockketten The column |
@blockketten We plan to implement this fork function first through command line tools to confirm its feasibility. After that, we will communicate with the Tronbox team to support this function. However, it is still in the early stages. After we sort out the relevant information recently, we will make a schedule, and update the progress on the issues of the java-tron project. |
@Federico2014 is there an ETA for at least a Beta release of the fork function so Kiln and other teams can begin testing? |
@simbadMarino We will try our best to make the fork CLI tool available in the next release of java-tron. The specific date is not confirmed yet. |
Thanks @Federico2014 ! This will greatly increase TRON's interoperability. Kudos to the team for prioritizing this feature! :) Happy New Year, everyone! |
To support fork testing, does Tron require significant architectural changes, and how will these changes impact the existing Tron network and smart contracts? |
@endiaoekoe It doesn't require architectural changes. We will add the fork tool in the Toolkit, which does not influence the existing Tron network and smart contracts. |
@blockketten |
@blockketten @simbadMarino @angrynurd We have added the shadow fork tool in tron-docker, please refer to the guidance and try it. If you have any problems, please tell us in time. |
+1 on the importance of this issue. As Tron is EVM-like, it needs to support EVM tooling if it is to see continued legitimate development. Fork testing is a basic essential to an EVM development stack. @Federico2014 can the docker requirements be abstracted away so that users call a single tron-hosted rpc with a block height argument? Fork testing should be IMO provided by the chain, not a burden on devs. |
@pegahcarter You are right, fork testing should not be on devs. But I am afraid it is not feasible to use a single tron-hosted rpc. Fork testing should satisfy diversified demands. We may need further research. |
Hello guys, circling back here, is this the right feature branch to track stateRoot implementation into TRON's JSON-RPC compatible API? If yes, do you have an ETA for it to be ready? This would significantly improve TRON's compatibility with the broader web3 ecosystem. If no, would you please point to the right PR if available? Thanks a lot ! |
Yes, this branch state-trie is archived data. Unlike ETH, Tron's stateRoot is non-consensual, and Tron implements a switch to turn it on itself at any height. |
Thanks, @halibobo1205, for the confirmation. I have some additional questions:
Thanks! |
@simbadMarino, |
Thanks for the heads up @halibobo1205 , do you have any estimation on getting this out the experimental phase? |
The archive node is still under development, and its current implementation is not as comprehensive as Ethereum. May I ask what your main requirements are for the archive node? Are you looking for historical state queries? @simbadMarino |
Yes @halibobo1205 , historical state queries, ideally, we'd like to have the JSON-RPC on TRON to match the Ethereum one, a major blocker for EVM dev tooling to integrate TRON relies on the stateRoot field missing on TRON (Arbitrary Block Number parameter). I did some comparison between TRON and Ethereum for missing and partially implemented JSON-RPC methods and got the following table: Source: https://github.com/simbadMarino/ethereum-tron-json-rpc/blob/tron/src/data/TRON%20methods.md After asking some partners like Kiln, thegraph and others, the most critical ones to fully implement are:
If we do we are effectively closing some major gaps we've been having in TRON in terms of EVM interoperability, meaning we will be able to easily build on top of already existing popular dev tools and infrastructure, services and SDK. This will speed up TRON integration, reduce integration costs and overall improving the dev experience when building on TRON. I hope this helps to clarify further :) Thanks again for the support! |
@simbadMarino For the following four methods, we will conduct detailed research to evaluate whether they can be supported: cc @waynercheung
|
Can this be marked as done? @Federico2014 @blockketten |
@halibobo1205, can we use this issue to track missing important JSON-RPC methods? I believe there's no other issue tracking this particular topic. |
Hi @simbadMarino , so till now, the most critical JSON-RPC to fully implement as below:
And the following apis still need detailed research to check if can be implemented in the archive node:
right? |
@halibobo1205 I think so. |
correct @waynercheung |
@simbadMarino How about tracking this issue on #6289? |
Sounds good @waynercheung , lets track it in #6289 |
I implemented JSON-RPC proxy for making TRON more Ethereum-compatible. Currently very few features are supported. Check it here: https://github.com/u59149403/tjrp |
@u59149403 , Thank you for the thoughtful suggestion! Implementing a proxy layer (e.g., a gateway or using OpenResty with Lua) to enhance compatibility for unsupported features is indeed a promising approach. However, this falls outside the scope of the java-tron project itself and is better suited for discussion in a separate community or implementation space. |
ok, this issue maybe closed later. |
Background
Tron’s VM supports most of the features of modern solidity and it would be possible for us to build products on Tron in a similar fashion to what we do on EVM chains but most modern development tools do not work with Tron. Most of the differences lay at the RPC level, making it very hard to run core security tests (fork tests are not possible using Foundry, just basic forks do not work either)
Forking is a hard technical requirement for us, we need to be able to perform tests on our contracts with live state to ensure things are working properly. Currently we haven’t found any solution to get a fork (even tenderly has no support for tron unfortunately), so we tried to perform these manually using anvil / forge.
We found that Foundry is unable to perform the fork tests due to some diffs in the returned payload by the json RPCs.
Methods required to fork
By running fork tests on eth mainnet behind a proxy, we identified most of the methods required to perform them
Unfortunately, Foundry is unable to work with Tron’s RPCs, as unmarshalling data returned by the endpoint fails.
Probable root cause
After some digging, we identified the possible root cause for this. The block payload from the tron rpc is lacking the
stateRoot
field content, which is always equal to0x
This single field could be the only reason why some of the Foundry tools are not working properly and crashing whenever some block payloads are deserialized.
Mocking the stateRoot
To move further in our testing, we used mitmproxy to proxy all requests made to the RPC and manually mock the stateRoot in the
eth_getBlockByNumber
queries. We now hit another issueThe
eth_getTransactionCount
is not defined on the tron RPC.Mocking the transaction count result
Next step is now to intercept
eth_getTransactionCount
methods and return a mocked value. We hit another core issue when theeth_getCode
query is madeWhen replaying these queries manually, we can see that the method is unable to support arbitrary block tag values for the
getCode
query (only supportslatest
)Deep state management issue
It seems that most issues are coming from the ability for the tron rpc nodes to retrieve state specific data. First, the inability to provide a
stateRoot
in the block body shows that there might be a completely different state handling from what the evm chains are used to do.Same thing for
eth_getCode
where we are completely unable to retrieve anything that is not at the tip of the chain.Rationale
Fork testing is essential for secure smart contract development as, it allows testing contracts against live network state. Currently, industry-standard tools like Foundry cannot perform fork tests on Tron due to RPC limitations, limiting the ecosystem development of Tron.
Use cases:
Specification
The following features are requested in the RPC implementation for Tron:
Block Payload Enhancement
Extended RPC Method Support
Test Specification
Success criteria:
Scope Of Impact
Implementation
The Kiln team is willing to help test and provide feedback during implementation.
The text was updated successfully, but these errors were encountered: