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

rpc: implement getcontractstate RPC #662

Closed
wants to merge 4 commits into from

Conversation

AnnaShaleva
Copy link
Member

closes #342

@AnnaShaleva AnnaShaleva added feature Completely new functionality rpc RPC server and client labels Feb 13, 2020
@codecov
Copy link

codecov bot commented Feb 13, 2020

Codecov Report

Merging #662 into master will increase coverage by 0.06%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #662      +/-   ##
==========================================
+ Coverage   65.08%   65.14%   +0.06%     
==========================================
  Files         125      125              
  Lines       10568    10588      +20     
==========================================
+ Hits         6878     6898      +20     
  Misses       3412     3412              
  Partials      278      278
Impacted Files Coverage Δ
pkg/rpc/server.go 80.69% <100%> (+1.09%) ⬆️
pkg/rpc/errors.go 61.9% <100%> (+4.01%) ⬆️
pkg/rpc/prometheus.go 100% <100%> (ø) ⬆️

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 0461827...ad124e0. Read the comment docs.

pkg/rpc/server.go Outdated Show resolved Hide resolved
Name: "getcontractstate_called",
Namespace: "neogo",
},
)
Copy link
Member

Choose a reason for hiding this comment

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

gofmt.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

if cs != nil {
results = wrappers.NewContractState(cs)
} else {
results = "Unknown contract"
Copy link
Member

Choose a reason for hiding this comment

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

Is it returned as an error or as a result in C# node?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is returned as en error, done


// NewContractState creates a new Contract wrapper.
func NewContractState(c *state.Contract) ContractState {
scriptHash, err := util.Uint160DecodeBytesBE(c.ScriptHash().BytesLE())
Copy link
Member

Choose a reason for hiding this comment

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

I'm not sure what are you doing here, c.ScriptHash() is already an Uint160, if you need to reverse the byte order it has a Reverse method.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done: used c.ScriptHash().Reverse()

@roman-khimov
Copy link
Member

Also, documentation should be updated.

@AnnaShaleva AnnaShaleva force-pushed the feature/getcontractstate branch 2 times, most recently from fa995fd to 8800cc5 Compare February 14, 2020 16:30
@roman-khimov roman-khimov deleted the feature/getcontractstate branch March 3, 2020 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Completely new functionality rpc RPC server and client
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RPC: implement getcontractstate
3 participants