-
Notifications
You must be signed in to change notification settings - Fork 200
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hardcode pre gingerbread block gas limits for existing chains (#2216)
Ensures that mainnet, alfajores and baklava will return the correct gas limit on pre gingerbread blocks when running in eth compatibility mode. See this ticket for more detail and the correct gas limit values: #2214
- Loading branch information
Showing
3 changed files
with
116 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package params | ||
|
||
import "math/big" | ||
|
||
type GasLimits struct { | ||
// changes holds all gas limit changes, it is assumed that the first change ocurrs at block 0. | ||
changes []LimitChange | ||
} | ||
|
||
type LimitChange struct { | ||
block *big.Int | ||
gasLimit uint64 | ||
} | ||
|
||
func (g *GasLimits) Limit(block *big.Int) uint64 { | ||
// Grab the gas limit at block 0 | ||
curr := g.changes[0].gasLimit | ||
for _, c := range g.changes[1:] { | ||
if block.Cmp(c.block) < 0 { | ||
return curr | ||
} | ||
curr = c.gasLimit | ||
} | ||
return curr | ||
} |