-
Notifications
You must be signed in to change notification settings - Fork 0
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
Feature/stateupdate demo #1
base: master
Are you sure you want to change the base?
Conversation
plugins/stateupdate/stateupdate.go
Outdated
if err != nil { | ||
log.Error("Failed to load control data", "error", err) | ||
} | ||
if SUcount >= len(expectedData) { |
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.
I am not sure what you are trying to accomplish here. SUcount will be the number of times that the stateUpdate function is called and your decompressed control data should always have a length greater than the count.
plugins/stack-demo/stack-demo.go
Outdated
} | ||
|
||
func (*demoModule) Blockchain() { | ||
|
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.
Bring the Blockchain implementation from here into stateupdate.go ultimately we'll want this test to be stand alone so we don't want to import more than one plugin.
plugins/stateupdate/stateupdate.go
Outdated
} | ||
|
||
func compareStateUpdates() { | ||
expectedData, err := stateDataDecompress() |
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.
We don't want to decompress the control data file every time that stateupdate() is called. What I would suggest is setting the control data as a global variable and decompressing it once, either in Blockchain() or InitializeNode.
plugins/stateupdate/stateupdate.go
Outdated
"storages": storage, | ||
"code": codeUpdates, | ||
} | ||
StateUpdates[nbr] = stateUpdate |
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.
I would pass the stateUpdate map, which is ultimately our test data, into your compare stateUpdate function here. Then within the comparison function I would simply pull out the control data which corresponds to the block number you have saved as nbr.
No description provided.