vechain / thor

A general purpose blockchain highly compatible with Ethereum's ecosystem
GNU Lesser General Public License v3.0
795 stars 248 forks source link

Fix marshalling of CustomGenesis #730

Closed otherview closed 2 months ago

otherview commented 2 months ago

Description

Fix for genesis.CustomGenesis serialization. The (i *HexOrDecimal256) MarshalJSON() and the (b *Bytes32) MarshalJSON() were working incorrectly. This was found when the networkHub was trying to write genesis.CustomGenesis to file and thor nodes were loading the genesis back. Both operations were erroring with different reasons.

The PR also:

Type of change

Please delete options that are not relevant.

How Has This Been Tested?

Added tests

Checklist:

codecov-commenter commented 2 months ago

Codecov Report

Attention: Patch coverage is 75.00000% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 61.37%. Comparing base (88baecd) to head (0849209). Report is 1 commits behind head on master.

Files Patch % Lines
genesis/customnet.go 66.66% 1 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #730 +/- ## ========================================== + Coverage 61.34% 61.37% +0.03% ========================================== Files 194 194 Lines 18221 18223 +2 ========================================== + Hits 11177 11184 +7 + Misses 5961 5958 -3 + Partials 1083 1081 -2 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

otherview commented 2 months ago

Was able to confirm that this does not generate any errors in a running network.

Ran the following test:

I think it looks good to merge.