forked from ethereum/go-ethereum
-
Notifications
You must be signed in to change notification settings - Fork 5
feat(params): UnmarshalChainJSONConfig and MarshalChainConfigJSON
#92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
48 commits
Select commit
Hold shift + click to select a range
2ba967e
feat(params): `UnmarshalChainConfig` function
qdm12 4ba9321
`UnmarshalChainConfig` -> `UnmarshalChainConfigJSON`
qdm12 91f207c
Add extra field type to extra json decoding error
qdm12 9bcff55
Do not wrap error and use `%s` instead of `%w`
qdm12 512977d
rework UnmarshalChainConfigJSON
qdm12 8490a1b
update function comment
qdm12 0e3a68d
rework UnmarshalChainConfigJSON
qdm12 27688fe
reuseJSONRoot argument
qdm12 e8af129
inline body of unmarshalJSONWithRegisteredExtra and remove it
qdm12 ec9a9b3
use switch for shorter code
qdm12 5c4ac6c
chore: simplify code
qdm12 7497ab5
move UnmarshalChainConfigJSON below UnmarshalJSON chainConfig method
qdm12 a0d25d1
chore: split function into two functions `unmarshalChainConfigJSONExt…
qdm12 f0abde5
Update comment
qdm12 b20476d
Test fix: `.extra` -> `.Extra`
qdm12 81ee012
chore: merge encode/decode subtests in one
qdm12 46d8485
update function comment
qdm12 1c63271
Update TestUnmarshalChainConfigJSON
qdm12 f5dad1e
only use body of unmarshalChainConfigJSONExtraNotRegistered for every…
qdm12 03e825e
Add test cases to TestUnmarshalChainConfigJSON
qdm12 70b32e8
Make `UnmarshalChainConfigJSON` non generic to support `extra` interf…
qdm12 bf4557f
Revert function to be generic
qdm12 51cdb56
Return an error if extra argument is nil
qdm12 1ca9a4d
MarshalChainConfigJSON with test
qdm12 a9cd1d0
Update ChainConfig MarshalJSON comment
qdm12 86d9d03
Remove unneeded comments
qdm12 b8beaa9
style: inline variables
qdm12 f13f0f4
docs: fix typo in comment
qdm12 881dd0a
hotfix: fix TestUnmarshalChainConfigJSON
qdm12 ac3c989
UnmarshalChainConfigJSON decodes only once for re-use root case
qdm12 725250d
Use want* for test case fields
qdm12 afd7476
style: UnmarshalChainConfigJSON does not use switch anymore
qdm12 3120a53
`extraConstructors` -> `ec`
qdm12 5c3975f
Improved error wrapping for nil extra argument to `UnmarshalChainConf…
qdm12 496c608
Use short if forms for error checking
qdm12 98164b0
Use `C` instead of `T` for extra generic type
qdm12 740abb5
Clarify comment for `UnmarshalJSON`
qdm12 d1bea23
Clarify comment for `UnmarshalChainConfigJSON`
qdm12 ec81c21
Improve error wrappings
qdm12 5871a77
Simplify comment for `MarshalJSON`
qdm12 7d7aca1
Comment simplified for `MarshalChainConfigJSON`
qdm12 c9094dd
Don't use field names for inlined types in `UnmarshalChainConfigJSON`
qdm12 76f9928
Don't use field names for inlined types in `MarshalChainConfigJSON`
qdm12 3e068f5
Variable renamings in `TestChainConfigJSONRoundTrip`
qdm12 32fe286
Add error wrappings within `toJSONRawMessages`
qdm12 e3d25ea
Use regex for error messages expectations in tests
qdm12 b48fb8a
New unit tests focus on error cases only
qdm12 fa1a15b
Revert `TestChainConfigJSONRoundTrip` to its original state
qdm12 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for this and the extras too we should just return a raw error and decorate it in
toJSONRawMessages()instead, for consistency. I'd add a suggestion but GitHub review UI sucks and I can't comment on unmodified code in the same file.fmt.Errorf("encoding %T into %T: %s", v, msgs, err)on line 154.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think
fmt.Errorf("encoding %T into %T: %s", v, msgs, err)is a bit confusing, since technically we are encoding then decoding into a different Go element (map). I still thinkconverting config to JSON raw messagesexplains it alright. I've added error wrappings in 359448d66f0a15e7f62b8aaef7bd734872690975 but it might be a bit too-muchey, feel free to let me know and i'll drop that commit.