-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Extended RPC Method Support and Block Payload Enhancement to enable fork testing #6126
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 :) |
@simbadMarino could you explain more of the feature that you want Tron to support? |
@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. |
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: