-
Notifications
You must be signed in to change notification settings - Fork 215
unit tests for merging same account accesses #6965
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
Conversation
| c.AddStateAccess(&data.StateAccess{ | ||
| Type: data.Write, | ||
| TxHash: []byte("hash"), | ||
| MainTrieKey: []byte(strconv.Itoa(0)), |
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.
Better use []byte("account1") or something like this instead of []byte(strconv.Itoa(0)). It is more readable. Change in all these tests. Use []byte(strconv.Itoa(i)) only if you add state accesses from a loop
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.
fixed
| TxHash: []byte("hash"), | ||
| MainTrieKey: []byte(strconv.Itoa(1)), | ||
| MainTrieVal: []byte("mainTrieVal1"), | ||
| AccountChanges: &data.AccountChanges{ |
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.
Can extract this in a variable and use that variable on L588 when you check that the same account change was returned.
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.
fixed
| TxHash: []byte("txHash"), | ||
| AccountChanges: defaultAccChanges, | ||
| MainTrieVal: []byte(fmt.Sprintf("mainTrieVal%d", i)), | ||
| Operation: uint32(math.Pow(2, float64(i%6))), |
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.
declare a slice like
operations := []uint32{
data.NotSet,
data.GetCode,
data.SaveAccount,
data.GetAccount,
data.WriteCode,
data.RemoveDataTrie,
data.GetDataTrieValue,
}
and use operations[i%len(operations)] here. It is more clear this way.
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.
replaced
cd42a94
into
merge-same-account-accessess
Reasoning behind the pull request
Proposed changes
Testing procedure
Pre-requisites
Based on the Contributing Guidelines the PR author and the reviewers must check the following requirements are met:
featbranch created?featbranch merging, do all satellite projects have a proper tag insidego.mod?