MerosCrypto / Meros

An instant and feeless cryptocurrency for the future, secured by the Merit Caching Consensus Mechanism.
https://meroscrypto.io
Other
83 stars 19 forks source link

Improvements to the new RPC. #292

Open kayabaNerve opened 3 years ago

kayabaNerve commented 3 years ago

The new RPC (#279) is having planned features removed in order for it to continue in a timely fashion.

The most notable is the lack of HTTP pipelining. That said, we also have a lack of spec compliance thanks to a lack of GET/HEAD support (just returning a 404). We arguably shouldn't bother with the 404, yet I do want it noted.

Finally, there's a lack of testing, mainly due to the implicitness/irrelevance of a lot of this stuff.

Untested HTTP errors:

Un-explicitly tested RPC routes:

I also want to add in a RPC method, merit_getSupply, to get the current Meros supply. It'd be defined as:

### `getSupply`

`getSupply` replies with the total amount of minted Meros in existence. The result is an int of the current supply.

Notable similarities with #272.

kayabaNerve commented 3 years ago

Some of these, generally the RPC routes, do need to be tested before launching.

kayabaNerve commented 3 years ago

Another casualty is the multi-account support of the personal RPC (not the multi-address support; referring to BIP 44). It's not needed and greatly simplifies the APIs. In the future, they can be added via optional fields.

Also removing hardened address generation.

kayabaNerve commented 3 years ago

personal_getTransactionHistory will be needed for the Wallet GUI.

personal_getBalance to compliment transactions_getBalance as personal_getUTXOs compliments transactions_getUTXOs would be great.

kayabaNerve commented 3 years ago

The above commit adds a task of expanding the WalletDB test as well.

kayabaNerve commented 3 years ago

Some of the following should've been done as part of the main PR. That said, it's dragged on too long, and I really just want to merge it. None of these need to be done, from a technical perspective, and they do generally fall under our extremely comprehensive commentary about testing.

The last one is actually somewhat important; Meros won't handle this edge case. A UTXO mutated in such a way won't become present on step 4 under the current codebase.

kayabaNerve commented 3 years ago

merit_getSyncProgress would also be a useful RPC route, notably for the GUI, When syncing to the point we need a block list, we can set known chain length to the result of the list BEFORE verifying the headers, yet also noting the chain as "untrusted" until AFTER we verify them. Current progress is defined as how many block bodies we've processed.

kayabaNerve commented 3 years ago

Should likely be network_getSyncProgress.

kayabaNerve commented 3 years ago

The above getTransactionHistory is untested; the Personal Send test would be great to shim its test into.