RPC Differences Documentation and RPC Testing Toolkit (#241)

* Added RPC testing toolkit with docs

* Add documentation

* fix comments

---------

Co-authored-by: Amar Singh <asinghchrony@protonmail.com>
This commit is contained in:
Nikita Khateev
2024-07-25 17:22:11 +04:00
committed by Gustavo Gonzalez
parent 29c6332022
commit cdba7fea87
5 changed files with 1557 additions and 0 deletions
+1
View File
@@ -4,6 +4,7 @@
* EVM Template Guides
** xref:guides/contract_migration.adoc[Contract Migration]
** xref:guides/predeployed_contracts.adoc[Predeployed Contracts]
** xref:guides/rpc_differences.adoc[RPC Differences]
* Runtimes
** xref:runtimes/generic.adoc[Generic Runtime]
* Runtime Descriptions
@@ -0,0 +1,14 @@
:source-highlighter: highlight.js
:highlightjs-languages: rust
:github-icon: pass:[<svg class="icon"><use href="#github-icon"/></svg>]
= RPC Differences
The EVM in a Substrate node has almost the same RPC calls common to all nodes. But some of them are not applicable for Frontier.
These are the calls that behave differently than would be expected by regular Ethereum nodes:
* `eth_sign` / `eth_signTransaction` -- these methods do not exist in the Frontier and this template because it, unlike Ethereum nodes, does not hold any keys.
* `eth_syncing` -- it can have additional fields `warp_chunks_amount` and `warp_chunks_processed` that describe warp syncing process.
Other calls comply to the same scheme as Ethereum nodes provide.
File diff suppressed because it is too large Load Diff
+19
View File
@@ -0,0 +1,19 @@
## RPC Testing Toolkit
This is a Postman collection to test your the RPC deployment of you smart contract. To use it you should prepare your environment and test toolkit for testing:
* Open the collection in Postman, and open the variables in it.
* Fill the `url` with HTTP RPC url and `chain_id` with your chain's chain id.
* Obtain three funded accounts. You may provide them through the chainspec.
* Put first address to the `alice_addr` variable and their balance to the `alice_balance`.
* Make a transfer transaction from the second address to any address.
* Put its hash to the `tx_hash` variable
* Put the block number of this transaction to `tx_block_number` and `block_number`. Put the number of transactions in this block (highly likely it will be 1) to the `block_tx_count`.
* Put the hash of the block with this transaction to `tx_block_hash` and `block_hash`.
* Put the index of the transaction in the block to `tx_index`. Highly likely it will be 0.
* Put the address you have sent the transaction from to `tx_from` variable.
* Take a third address and deploy the smart contract `TestContract.sol` from it.
* Put the address of the deployed contract to the `test_contract` variable.
* Put the code from the compiled contract to the `contract_code` variable. It can be found in a resulting JSON file under `deployedBytecode` key.
When you complete these preparation steps, run the requests from the collection. If some of them are not passing, run them as a single request and see what the request have returned to debug it.
+13
View File
@@ -0,0 +1,13 @@
contract Storage {
uint pos0;
constructor() {
pos0 = 1234;
}
// You can read from a state variable without sending a transaction.
function get() public view returns (uint) {
return pos0;
}
}