Skip to content
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

Ensure Schema compliance with execution-apis schema #372

Merged
merged 8 commits into from
Jul 26, 2022

Conversation

ar-conmit
Copy link
Collaborator

Signed-off-by: Anton Rusev [email protected]

Description:

  • Add openrpc.spec.ts test file to relay
  • Change getBlockTransactionCountByHash and getBlockTransactionCountByNumber to return string instead of number to conform the ethereum RPC schema

Related issue(s):

Fixes #295

Notes for reviewer:

Checklist

  • Documented (Code comments, README, etc.)
  • Tested (unit, integration, etc.)

@codecov-commenter
Copy link

codecov-commenter commented Jul 22, 2022

Codecov Report

Merging #372 (57557c5) into main (5fd35e3) will increase coverage by 7.67%.
The diff coverage is 50.00%.

@@            Coverage Diff             @@
##             main     #372      +/-   ##
==========================================
+ Coverage   65.66%   73.34%   +7.67%     
==========================================
  Files           8        8              
  Lines         798      799       +1     
  Branches      130      131       +1     
==========================================
+ Hits          524      586      +62     
+ Misses        237      171      -66     
- Partials       37       42       +5     
Impacted Files Coverage Δ
packages/relay/src/lib/eth.ts 81.51% <50.00%> (+12.58%) ⬆️
packages/relay/src/lib/precheck.ts 89.39% <0.00%> (+19.69%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5fd35e3...57557c5. Read the comment docs.

Copy link
Collaborator

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. Some clarification and improvements

docs/openrpc.json Outdated Show resolved Hide resolved
validateResponseSchema(methodsResponseSchema.eth_chainId, response);
});

it('should execute "eth_coinbase"', async function () {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it('should execute "eth_coinbase"', async function () {
it('should execute "eth_coinbase"', function () {

validateResponseSchema(methodsResponseSchema.eth_call, response);
});

it('should execute "eth_chainId"', async function () {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it('should execute "eth_chainId"', async function () {
it('should execute "eth_chainId"', function () {

expect(isValid).to.be.true;
});

it('should execute "eth_accounts"', async function () {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it('should execute "eth_accounts"', async function () {
it('should execute "eth_accounts"', function () {

validateResponseSchema(methodsResponseSchema.net_version, response);
});

it('should execute "web3_clientVersion"', async function () {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it('should execute "web3_clientVersion"', async function () {
it('should execute "web3_clientVersion"', function () {

validateResponseSchema(methodsResponseSchema.net_listening, response);
});

it('should execute "net_version"', async function () {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it('should execute "net_version"', async function () {
it('should execute "net_version"', function () {

validateResponseSchema(methodsResponseSchema.eth_syncing, response);
});

it('should execute "net_listening"', async function () {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
it('should execute "net_listening"', async function () {
it('should execute "net_listening"', function () {

Signed-off-by: Anton Rusev <[email protected]>
Signed-off-by: Anton Rusev <[email protected]>
Signed-off-by: Anton Rusev <[email protected]>
@ar-conmit ar-conmit requested a review from Nana-EC July 25, 2022 09:08
Nana-EC
Nana-EC previously approved these changes Jul 25, 2022
Copy link
Collaborator

@Nana-EC Nana-EC left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LG.
Minor suggestion

@@ -778,13 +778,13 @@ export class EthImpl implements Eth {
input: contractResult.function_parameters,
maxPriorityFeePerGas: maxPriorityFee,
maxFeePerGas: maxFee,
nonce: contractResult.nonce,
nonce: contractResult.nonce === null ? null : EthImpl.numberTo0x(contractResult.nonce),
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Add a nullable param to EthImpl.numberTo0x().
With default true and use this logic here and a few places.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest to create a new static function eg. EthImpl.nullableNumberTo0x. If we modify numberTo0x we will need to refactor/touch a lot of rpc methods because they rely on the returned type of numberTo0x to be a string

@sonarcloud
Copy link

sonarcloud bot commented Jul 26, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@ar-conmit ar-conmit merged commit 5af00f9 into main Jul 26, 2022
@ar-conmit ar-conmit deleted the 295-openrpc-integration-test branch July 26, 2022 07:13
@Nana-EC Nana-EC added this to In progress in Development via automation Jul 26, 2022
@Nana-EC Nana-EC added this to the 0.5.0 milestone Jul 26, 2022
@Nana-EC Nana-EC moved this from In progress to Done in Development Jul 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request limechain P1
Projects
Development

Successfully merging this pull request may close these issues.

Ensure Schema compliance with execution-apis schema
3 participants