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

Rosetta Implementation Cleanup (Stage 3 of Node API Overhaul) #3390

Merged
merged 17 commits into from
Oct 17, 2020

Conversation

Daniel-VDM
Copy link
Contributor

@Daniel-VDM Daniel-VDM commented Oct 15, 2020

Stage 3 Cleanup of Node API Overhaul

This PR clean's up the Rosetta implementation for the initial release. A large part of this PR is just moving functions/methods/tests around and putting useful util functions deeper into the codebase.

I've also fixed a bug in the pre-staking era block reward calculation. Essentially the calculation needs to be processed in the order of the committee slots to handle some floating-point precision rounding. I've noted that this order is important in the fix. This error was caught using the rosetta-CLI (thx god for that tool 😄 ).

Lastly, I've renamed all of the transfer operations to native transfer operations where applicable. This is in anticipation of integrating HRC20 tokens to rosetta's data & construction API at some point down the line.

Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* Move TestNewAccountIdentifier & TestGetAddress to account_test.go

Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* Move Respective unit tests to own files
* Expose GetOperations & GetStakingOperations
* Expose FormatTransaction, FormatCrossShardReceiverTransaction,
FormatGenesisTransaction, FormatPreStakingRewardTransaction & FormatUndelegationPayoutTransaction

Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* Make docs consistent for mempool.go

Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* This is in anticipation of HRC20 token support with rosetta
* Rename various native operation functions accordingly
* Add documentation to explain what a native token is

Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
* Move getPreStakingRewardTransactionIdentifiers to block_special.go
* Add epoch to block metadata
* Update unit tests

Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
@Daniel-VDM Daniel-VDM added the rpc RPC or API label Oct 15, 2020
@Daniel-VDM Daniel-VDM self-assigned this Oct 15, 2020
Copy link
Contributor

@LeoHChen LeoHChen left a comment

Choose a reason for hiding this comment

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

LGTM in general. Good you catch the issue using tool.

core/types/receipt.go Show resolved Hide resolved
hmy/blockchain.go Show resolved Hide resolved
hmy/staking.go Outdated Show resolved Hide resolved
@Daniel-VDM Daniel-VDM force-pushed the rosetta-tx-format-refactor branch from 0cba857 to 7587bcb Compare October 16, 2020 00:46
Copy link
Contributor

@LeoHChen LeoHChen left a comment

Choose a reason for hiding this comment

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

two minor function calls.

node/node_explorer.go Outdated Show resolved Hide resolved
node/worker/worker.go Outdated Show resolved Hide resolved
internal/chain/engine.go Outdated Show resolved Hide resolved
* Refactor all uses of length check `ShardState`
* [hmy] Refactor IsCommitteeSelectionBlock to use chain.IsCommitteeSelectionBlock
* Address PR comments

Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
@Daniel-VDM Daniel-VDM force-pushed the rosetta-tx-format-refactor branch from 7587bcb to 1cfff86 Compare October 16, 2020 20:11
Signed-off-by: Daniel Van Der Maden <dvandermaden0@berkeley.edu>
@Daniel-VDM Daniel-VDM merged commit b088d6d into harmony-one:main Oct 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rpc RPC or API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants