0xPolygon / kurtosis-cdk

A Kurtosis package that deploys a private, portable, and modular Polygon CDK devnet
https://docs.polygon.technology/cdk
Apache License 2.0
42 stars 72 forks source link

fix: zkevm config diff tool #81

Closed leovct closed 5 months ago

leovct commented 5 months ago

Description

The zkevm-config-diff tool extracts default configurations from zkevm components. For zkevm components written in go, it generates the default configurations using the Default() method and writes the configurations to files using the viper.WriteConfigAs() method. Unfortunately, this method doesn't support fields in a go mapstruct very well and will skip some fields if they have a nil value.

For example, here is the result of fmt.Println(viper.AllSettings()) where you can clearly see that some sections of sequencer.streamserver have been ignored like chainId. image

On the left, the default sequencer.streamserver section we should get and on the right, the result we get. image

This PR removes the need to use viper to write the default configuration file. Instead, it marshals the structure to JSON, normalizes the files with jq and converts them back to TOML using yq.

References (if applicable)

Follow up of #56

sonarcloud[bot] commented 5 months ago

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
0.0% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarCloud