-
Notifications
You must be signed in to change notification settings - Fork 20.2k
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
params: fix golint warnings #16853
Merged
Merged
params: fix golint warnings #16853
Changes from 2 commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
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
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
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 |
---|---|---|
|
@@ -23,15 +23,16 @@ import ( | |
"github.com/ethereum/go-ethereum/common" | ||
) | ||
|
||
// Genesis hashes to enforce below configs on. | ||
var ( | ||
MainnetGenesisHash = common.HexToHash("0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3") // Mainnet genesis hash to enforce below configs on | ||
TestnetGenesisHash = common.HexToHash("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d") // Testnet genesis hash to enforce below configs on | ||
MainnetGenesisHash = common.HexToHash("0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3") | ||
TestnetGenesisHash = common.HexToHash("0x41941023680923e0fe4d74a34bdac8141f2540e3ae90623718e47d66d1ca4a2d") | ||
) | ||
|
||
var ( | ||
// MainnetChainConfig is the chain parameters to run a node on the main network. | ||
MainnetChainConfig = &ChainConfig{ | ||
ChainId: big.NewInt(1), | ||
ChainID: big.NewInt(1), | ||
HomesteadBlock: big.NewInt(1150000), | ||
DAOForkBlock: big.NewInt(1920000), | ||
DAOForkSupport: true, | ||
|
@@ -46,7 +47,7 @@ var ( | |
|
||
// TestnetChainConfig contains the chain parameters to run a node on the Ropsten test network. | ||
TestnetChainConfig = &ChainConfig{ | ||
ChainId: big.NewInt(3), | ||
ChainID: big.NewInt(3), | ||
HomesteadBlock: big.NewInt(0), | ||
DAOForkBlock: nil, | ||
DAOForkSupport: true, | ||
|
@@ -61,7 +62,7 @@ var ( | |
|
||
// RinkebyChainConfig contains the chain parameters to run a node on the Rinkeby test network. | ||
RinkebyChainConfig = &ChainConfig{ | ||
ChainId: big.NewInt(4), | ||
ChainID: big.NewInt(4), | ||
HomesteadBlock: big.NewInt(1), | ||
DAOForkBlock: nil, | ||
DAOForkSupport: true, | ||
|
@@ -101,7 +102,7 @@ var ( | |
// that any network, identified by its genesis block, can have its own | ||
// set of configuration options. | ||
type ChainConfig struct { | ||
ChainId *big.Int `json:"chainId"` // Chain id identifies the current chain and is used for replay protection | ||
ChainID *big.Int `json:"chainID"` // Chain id identifies the current chain and is used for replay protection | ||
|
||
HomesteadBlock *big.Int `json:"homesteadBlock,omitempty"` // Homestead switch block (nil = no fork, 0 = already homestead) | ||
|
||
|
@@ -154,7 +155,7 @@ func (c *ChainConfig) String() string { | |
engine = "unknown" | ||
} | ||
return fmt.Sprintf("{ChainID: %v Homestead: %v DAO: %v DAOSupport: %v EIP150: %v EIP155: %v EIP158: %v Byzantium: %v Constantinople: %v Engine: %v}", | ||
c.ChainId, | ||
c.ChainID, | ||
c.HomesteadBlock, | ||
c.DAOForkBlock, | ||
c.DAOForkSupport, | ||
|
@@ -172,27 +173,32 @@ func (c *ChainConfig) IsHomestead(num *big.Int) bool { | |
return isForked(c.HomesteadBlock, num) | ||
} | ||
|
||
// IsDAO returns whether num is either equal to the DAO fork block or greater. | ||
// IsDAOFork returns whether num is either equal to the DAO fork block or greater. | ||
func (c *ChainConfig) IsDAOFork(num *big.Int) bool { | ||
return isForked(c.DAOForkBlock, num) | ||
} | ||
|
||
// IsEIP150 returns whether num is either equal to the IsEIP150 fork block or greater. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think you need There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You're right - I've updated to be more sensical. |
||
func (c *ChainConfig) IsEIP150(num *big.Int) bool { | ||
return isForked(c.EIP150Block, num) | ||
} | ||
|
||
// IsEIP155 returns whether num is either equal to the IsEIP155 fork block or greater. | ||
func (c *ChainConfig) IsEIP155(num *big.Int) bool { | ||
return isForked(c.EIP155Block, num) | ||
} | ||
|
||
// IsEIP158 returns whether num is either equal to the IsEIP158 fork block or greater. | ||
func (c *ChainConfig) IsEIP158(num *big.Int) bool { | ||
return isForked(c.EIP158Block, num) | ||
} | ||
|
||
// IsByzantium returns whether num is either equal to the IsByzantium fork block or greater. | ||
func (c *ChainConfig) IsByzantium(num *big.Int) bool { | ||
return isForked(c.ByzantiumBlock, num) | ||
} | ||
|
||
// IsConstantinople returns whether num is either equal to the IsConstantinople fork block or greater. | ||
func (c *ChainConfig) IsConstantinople(num *big.Int) bool { | ||
return isForked(c.ConstantinopleBlock, num) | ||
} | ||
|
@@ -251,7 +257,7 @@ func (c *ChainConfig) checkCompatible(newcfg *ChainConfig, head *big.Int) *Confi | |
if isForkIncompatible(c.EIP158Block, newcfg.EIP158Block, head) { | ||
return newCompatError("EIP158 fork block", c.EIP158Block, newcfg.EIP158Block) | ||
} | ||
if c.IsEIP158(head) && !configNumEqual(c.ChainId, newcfg.ChainId) { | ||
if c.IsEIP158(head) && !configNumEqual(c.ChainID, newcfg.ChainID) { | ||
return newCompatError("EIP158 chain ID", c.EIP158Block, newcfg.EIP158Block) | ||
} | ||
if isForkIncompatible(c.ByzantiumBlock, newcfg.ByzantiumBlock, head) { | ||
|
@@ -324,15 +330,16 @@ func (err *ConfigCompatError) Error() string { | |
// Rules is a one time interface meaning that it shouldn't be used in between transition | ||
// phases. | ||
type Rules struct { | ||
ChainId *big.Int | ||
ChainID *big.Int | ||
IsHomestead, IsEIP150, IsEIP155, IsEIP158 bool | ||
IsByzantium bool | ||
} | ||
|
||
// Rules ensures c's ChainID is not nil. | ||
func (c *ChainConfig) Rules(num *big.Int) Rules { | ||
chainId := c.ChainId | ||
if chainId == nil { | ||
chainId = new(big.Int) | ||
chainID := c.ChainID | ||
if chainID == nil { | ||
chainID = new(big.Int) | ||
} | ||
return Rules{ChainId: new(big.Int).Set(chainId), IsHomestead: c.IsHomestead(num), IsEIP150: c.IsEIP150(num), IsEIP155: c.IsEIP155(num), IsEIP158: c.IsEIP158(num), IsByzantium: c.IsByzantium(num)} | ||
return Rules{ChainID: new(big.Int).Set(chainID), IsHomestead: c.IsHomestead(num), IsEIP150: c.IsEIP150(num), IsEIP155: c.IsEIP155(num), IsEIP158: c.IsEIP158(num), IsByzantium: c.IsByzantium(num)} | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This one changes our genesis format, please revert. Yes, it's wrong, but it's part of the API, so if you uppercase it, Go will refuse to parse the jsons.
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.
Just to clarify, the field name is fine as you changed it, just the json tag needs to be reverted.
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.
Great ok - updated.