-
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_traceChain method #411
Implementation of the debug_traceChain method #411
Conversation
@@ -843,6 +927,50 @@ func (d *Debug) GetAccessibleState(from, to BlockNumber) (interface{}, error) { | |||
) | |||
} | |||
|
|||
// ChaindbProperty returns leveldb properties of the key-value database. | |||
func (d *Debug) ChaindbProperty(property 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.
ChaindbProperty doesn't have a param as an input. It returns leveldb stats. Stat() method in ethdb/leveldb/leveldb.go.
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.
Oh, I’m not following. I need to think. This is the final code:
// Stat returns a particular internal stat of the database.
func (kv *KVStorage) Stat(property string) (string, error) {
return kv.db.GetProperty(property)
}
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.
Try to test what happens if you send "" as a property name. In that case you want to return DB stats, which is correct, but LevelDB has a method Stat() to return all stats. I am not sure it will work like this. If we can make it working to return all properties (stats) when sending "" and to return only 1 property when sending property name then keep it as it is. Geth has a different implementation to always return Stat() and there is no param property in ChaindbProperty() method, but as said we can go with your implementation if it works ok for all cases :)
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.
@@ -55,6 +55,18 @@ type State interface { | |||
// Returns: | |||
// - bool: A boolean indicating whether the item exists. | |||
Has(hash types.Hash) bool | |||
|
|||
// Stat returns a particular internal stat of the database. | |||
Stat(property string) (string, 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.
No input param.
@@ -107,6 +110,22 @@ func (kv *KVStorage) Has(k []byte) (bool, error) { | |||
return ok, nil | |||
} | |||
|
|||
// Stat returns a particular internal stat of the database. | |||
func (kv *KVStorage) Stat(property string) (string, 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.
No input param.
@@ -37,6 +38,8 @@ type Storage interface { | |||
Batch() Batch | |||
SetCode(hash types.Hash, code []byte) error | |||
GetCode(hash types.Hash) ([]byte, bool) | |||
Stat(property string) (string, 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.
No input param.
Description
Implementation of the debug_traceChain method
Changes include
Breaking changes
Checklist
Testing
Manual tests
Documentation update
Additional comments