Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Remove storageRead call from http_api to chain - Closes #2989 #3018

Merged
merged 5 commits into from
Mar 7, 2019

Conversation

michielmulders
Copy link
Contributor

What was the problem?

storageRead was intended to make the non-breaking changes for the network layer. Any kind of formatting you need for blocks for the APIs, should be done in API module itself. So directly use storage.entities.Block.get, and format the response how the API is required.

How did I fix it?

Remove channel.invoke call to storageRead in http_api module and move the API specific formatting logic for a block to the http_api module.

How to test it?

Run tests.

Comments

We can move the functionality of parseBlockFromDatabase into a helper object later.

Review checklist

@michielmulders michielmulders changed the title Remove storageRead call from http_api to chain Remove storageRead call from http_api to chain - Closes #2989 Mar 4, 2019
height: parseInt(raw.height),
previousBlock: raw.previousBlockId,
numberOfTransactions: parseInt(raw.numberOfTransactions),
totalAmount: new Bignum(raw.totalAmount),
Copy link
Collaborator

Choose a reason for hiding this comment

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

if this is return as a JSON, this should be string, and same for other Bignum instances

framework/src/modules/http_api/controllers/blocks.js Outdated Show resolved Hide resolved
framework/src/modules/http_api/controllers/blocks.js Outdated Show resolved Hide resolved
@michielmulders michielmulders removed the request for review from MaciejBaj March 5, 2019 09:37
@michielmulders michielmulders requested review from shuse2 and 2snEM6 March 5, 2019 15:30
2snEM6
2snEM6 previously approved these changes Mar 5, 2019
2snEM6
2snEM6 previously approved these changes Mar 6, 2019
shuse2
shuse2 previously approved these changes Mar 6, 2019
Copy link
Contributor

@MaciejBaj MaciejBaj left a comment

Choose a reason for hiding this comment

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

@michielmulders michielmulders dismissed stale reviews from shuse2 and 2snEM6 via e0372f3 March 6, 2019 13:44
@michielmulders michielmulders requested a review from MaciejBaj March 6, 2019 13:54
@MaciejBaj MaciejBaj merged commit 5ebf507 into development Mar 7, 2019
@MaciejBaj MaciejBaj deleted the 2989-remove_storage_read_chain branch March 7, 2019 15:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Remove usage of storageRead function on Chain actions
4 participants