-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #75 from 0xPolygonHermez/feature/73-support_validium
Feature/73 support validium
- Loading branch information
Showing
60 changed files
with
12,734 additions
and
549 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,65 @@ | ||
package config_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/0xPolygonHermez/zkevm-synchronizer-l1/config" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
const ConfigFileWithUnknownFieldTest = ` | ||
[Log] | ||
Environment = "development" # "production" or "development" | ||
Level = "info" | ||
Outputs = ["stderr"] | ||
ThisIsAnUnknownField = "unknown" | ||
` | ||
const ConfigFileOkTest = ` | ||
[Log] | ||
Environment = "development" # "production" or "development" | ||
Level = "info" | ||
Outputs = ["stderr"] | ||
#ThisIsAnUnknownField = "unknown" | ||
` | ||
|
||
const ConfigFileValidiumTranslatorTest = ` | ||
[Etherman.Validium.Translator] | ||
FullMatchRules = [ | ||
{Old="http://dataavailability-003.cdk-validium-cardona-03.zkevm.polygon.private:8444", New="https://dataavailability-003-cdk-validium-cardona-03-zkevm.polygondev.tools"}, | ||
{Old="http://dataavailability-002.cdk-validium-cardona-03.zkevm.polygon.private:8444", New="https://dataavailability-002-cdk-validium-cardona-03-zkevm.polygondev.tools"}, | ||
{Old="http://dataavailability-001.cdk-validium-cardona-03.zkevm.polygon.private:8444", New="https://dataavailability-001-cdk-validium-cardona-01-zkevm.polygondev.tools"} | ||
] | ||
` | ||
|
||
const ConfigFileValidiumTranslatorWrongFieldsInMapTest = ` | ||
[Etherman.Validium.Translator] | ||
FullMatchRules = [ | ||
{NoExpectedField="http://dataavailability-003.cdk-validium-cardona-03.zkevm.polygon.private:8444", New="https://dataavailability-003-cdk-validium-cardona-03-zkevm.polygondev.tools"}, | ||
{Old="http://dataavailability-002.cdk-validium-cardona-03.zkevm.polygon.private:8444", New="https://dataavailability-002-cdk-validium-cardona-03-zkevm.polygondev.tools"}, | ||
{Old="http://dataavailability-001.cdk-validium-cardona-03.zkevm.polygon.private:8444", New="https://dataavailability-001-cdk-validium-cardona-01-zkevm.polygondev.tools"} | ||
] | ||
` | ||
|
||
func TestLoadConfigUnknownFieldFails(t *testing.T) { | ||
fileExtension := "toml" | ||
_, err := config.LoadFileFromString(string(ConfigFileWithUnknownFieldTest), fileExtension) | ||
require.Error(t, err) | ||
} | ||
|
||
func TestLoadConfigUnknownFieldInMapFails(t *testing.T) { | ||
t.Skip("This test is not working as expected, need a deep dive into Viper library") | ||
fileExtension := "toml" | ||
_, err := config.LoadFileFromString(string(ConfigFileValidiumTranslatorWrongFieldsInMapTest), fileExtension) | ||
require.Error(t, err) | ||
} | ||
|
||
func TestLoadConfigCommentedUnknownFieldOk(t *testing.T) { | ||
fileExtension := "toml" | ||
_, err := config.LoadFileFromString(string(ConfigFileOkTest), fileExtension) | ||
require.NoError(t, err) | ||
} | ||
func TestLoadConfigValdiumTranslatorOk(t *testing.T) { | ||
fileExtension := "toml" | ||
_, err := config.LoadFileFromString(string(ConfigFileValidiumTranslatorTest), fileExtension) | ||
require.NoError(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
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,9 @@ | ||
package dataavailability | ||
|
||
// DABackendType is the data availability protocol for the CDK | ||
type DABackendType string | ||
|
||
const ( | ||
// DataAvailabilityCommittee is the DAC protocol backend | ||
DataAvailabilityCommittee DABackendType = "DataAvailabilityCommittee" | ||
) |
Oops, something went wrong.