-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: merge genesisapplier & genesisdeployment (#63)
* genesis package * nits
- Loading branch information
1 parent
7df3085
commit f0ef708
Showing
36 changed files
with
39 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package genesis | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
"math/big" | ||
|
||
"github.com/ethereum/go-ethereum/core" | ||
) | ||
|
||
func ApplyChainID(genesisJson []byte, chainId *big.Int) ([]byte, error) { | ||
var genesis core.Genesis | ||
if err := json.Unmarshal(genesisJson, &genesis); err != nil { | ||
return nil, fmt.Errorf("unable to parse genesis json: %w", err) | ||
} | ||
|
||
if genesis.Config.ChainID.Cmp(chainId) != 0 { | ||
genesis.Config.ChainID = chainId | ||
} | ||
|
||
result, err := json.Marshal(genesis) | ||
if err != nil { | ||
return nil, fmt.Errorf("error marshaling genesis: %w", err) | ||
} | ||
|
||
return result, nil | ||
} |
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
package genesisdeployment | ||
package genesis | ||
|
||
import ( | ||
_ "embed" | ||
|
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.