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

Improve precompile counting test #2742

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions precompiles/precompile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,20 +190,27 @@ func TestPrecompilesPerArbosVersion(t *testing.T) {
log.SetDefault(log.NewLogger(glogger))

expectedNewMethodsPerArbosVersion := map[uint64]int{
0: 89,
0: 98,
5: 3,
10: 2,
11: 4,
20: 8,
30: 38,
30: 39,
31: 1,
}

precompiles := Precompiles()
newMethodsPerArbosVersion := make(map[uint64]int)
for _, precompile := range precompiles {
for _, method := range precompile.Precompile().methods {
version := arbmath.MaxInt(method.arbosVersion, precompile.Precompile().arbosVersion)
innerPrecompile := precompile.Precompile()
newMethodsPerArbosVersion[innerPrecompile.arbosVersion]++
Copy link
Contributor

Choose a reason for hiding this comment

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

add a comment explaining it and/or rename newMethodsper.. to newEntriesPer..

_, isDebug := precompile.(*DebugPrecompile)
if isDebug {
// Debug methods are disabled on production chains
continue
}
for _, method := range innerPrecompile.methods {
version := arbmath.MaxInt(method.arbosVersion, innerPrecompile.arbosVersion)
newMethodsPerArbosVersion[version]++
}
}
Expand Down
Loading