-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Qi Zhou
committed
Oct 8, 2024
1 parent
4daac24
commit 7ab9ae1
Showing
7 changed files
with
70 additions
and
44 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,29 @@ | ||
package chainconfig | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/ethereum-optimism/optimism/op-program/chainconfig/test" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
// TestGetCustomRollupConfig tests loading the custom rollup configs from test embed FS. | ||
func TestGetCustomRollupConfig(t *testing.T) { | ||
config, err := rollupConfigByChainID(901, test.TestCustomChainConfigFS) | ||
require.NoError(t, err) | ||
require.Equal(t, config.L1ChainID.Uint64(), uint64(900)) | ||
require.Equal(t, config.L2ChainID.Uint64(), uint64(901)) | ||
|
||
_, err = rollupConfigByChainID(900, test.TestCustomChainConfigFS) | ||
require.Error(t, err) | ||
} | ||
|
||
// TestGetCustomChainConfig tests loading the custom chain configs from test embed FS. | ||
func TestGetCustomChainConfig(t *testing.T) { | ||
config, err := chainConfigByChainID(901, test.TestCustomChainConfigFS) | ||
require.NoError(t, err) | ||
require.Equal(t, config.ChainID.Uint64(), uint64(901)) | ||
|
||
_, err = chainConfigByChainID(900, test.TestCustomChainConfigFS) | ||
require.Error(t, err) | ||
} |
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 @@ | ||
{} |
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
6 changes: 3 additions & 3 deletions
6
op-program/chainconfig/configs/rollup.json → .../chainconfig/test/configs/901-rollup.json
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,6 @@ | ||
package test | ||
|
||
import "embed" | ||
|
||
//go:embed configs/*json | ||
var TestCustomChainConfigFS embed.FS |