-
Notifications
You must be signed in to change notification settings - Fork 7
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
Implementation of the debug_getAccessibleState and debug_dbGet methods #398
base: develop
Are you sure you want to change the base?
Implementation of the debug_getAccessibleState and debug_dbGet methods #398
Conversation
// of the next block. | ||
// The (from, to) parameters are the sequence of blocks to search, which can go | ||
// either forwards or backwards | ||
func (d *Debug) GetAccessibleState(from, to BlockNumber) (interface{}, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return uint64 instead of interface
// DbGet returns the raw value of a key stored in the database. | ||
// | ||
//nolint:stylecheck | ||
func (d *Debug) DbGet(key string) (interface{}, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Return []byte instead of interface.
There is a question from which database data needs to be returned, state or blockchain? IMO we should check both, but in that case we need to extend blockchain API with Get method. Although it's not complicated I am not sure if it's worth it. For now we can keep it this way, returning value only from state DB.
@@ -74,6 +74,10 @@ func (s *Snapshot) GetCode(hash types.Hash) ([]byte, bool) { | |||
return s.state.GetCode(hash) | |||
} | |||
|
|||
func (s *Snapshot) Get(hash types.Hash) ([]byte, bool, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need for this method.
@@ -30,6 +30,7 @@ type readSnapshot interface { | |||
GetStorage(addr types.Address, root types.Hash, key types.Hash) types.Hash | |||
GetAccount(addr types.Address) (*Account, error) | |||
GetCode(hash types.Hash) ([]byte, bool) | |||
Get(hash types.Hash) ([]byte, bool, error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need for this method.
@@ -47,6 +47,14 @@ func (m *mockSnapshot) GetCode(hash types.Hash) ([]byte, bool) { | |||
return nil, false | |||
} | |||
|
|||
func (m *mockSnapshot) Has(hash types.Hash) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed.
Description
Implementation of the debug_getAccessibleState and debug_dbGet methods
Changes include
Breaking changes
Checklist
Testing
Manual tests
Documentation update
Additional comments