Skip to content
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

Fix rpc.BlockNumberOrHash unmarshaling #4218

Merged
merged 2 commits into from
May 20, 2022
Merged

Conversation

mandrigin
Copy link
Collaborator

rpc.BlockNumberOrHash can be unmarshalled from a JSON dictionary.

I found that if you provide an empty or an invalid dictionary, it still unmarshalls successfully but with nil values. That crashes method handlers.

Added tests and error handling for this case.

		26: {`{}`, true, BlockNumberOrHash{}},
		27: {`{"jsonrpc":"2.0","result":{"code":418,"message":"blabla"},"id":""}]`, true, BlockNumberOrHash{}},

@AskAlexSharov AskAlexSharov merged commit 7f02ff8 into devel May 20, 2022
@AskAlexSharov AskAlexSharov deleted the fix-block-unmarshaling branch May 20, 2022 09:04
AlexeyAkhunov added a commit that referenced this pull request May 21, 2022
* allow --syncmode=snap for bor-mainnnet (#4206)

* save

* save

* allow --syncmode=snap for bor-mainnnet #4206

* allow snap sync for mumbai chain (#4208)

* save

* mumbai

* Bor: GetTransactionReceipt (#4209)

* fixed miner.sigfile option (#4210)

* Snap: reduced memory footprint on building huffman table (#4214)

* save

* save

* save

* save

* Remove dependency on leveldb (#4213)

* save

* save

* save

* save

* save

* save

* methods to read single txn by txnID (#4215)

* It's safe now to open snapshots at app start (#4216)

* removed obsolete trie variant (#4172)

* up gods lib version (#4217)

* Fix `rpc.BlockNumberOrHash` unmarshaling (#4218)

* add test

* fix unmarshaling bug

Co-authored-by: Igor Mandrigin <[email protected]>

* return err on invalid syncmode (#4219)

* save

* save

* save

* fixed kiln bug (#4221)

* Clean headers pointers when removing links (#4222)

* Clean headers pointers when removing links

* Replace the lock

Co-authored-by: Alexey Sharp <[email protected]>

* Makefile: pass docker build arguments (#4212)

Dockerfile requires some --build-arg options.
Fix "docker" target to pass them.
Fix GIT_TAG to reflect the most recent tag related to HEAD, instead of an unrelated most recent tag.
Use it as the image VERSION.

Image tags need to be passed explicitly if needed:

    DOCKER_FLAGS='-t erigon:latest' make docker

* Update erigon-lib and version

Co-authored-by: Alex Sharov <[email protected]>
Co-authored-by: Giulio rebuffo <[email protected]>
Co-authored-by: Artem Tsebrovskiy <[email protected]>
Co-authored-by: Igor Mandrigin <[email protected]>
Co-authored-by: Igor Mandrigin <[email protected]>
Co-authored-by: Alexey Sharp <[email protected]>
Co-authored-by: battlmonstr <[email protected]>
AlexeyAkhunov added a commit that referenced this pull request May 21, 2022
* allow --syncmode=snap for bor-mainnnet (#4206)

* save

* save

* allow --syncmode=snap for bor-mainnnet #4206

* allow snap sync for mumbai chain (#4208)

* save

* mumbai

* Bor: GetTransactionReceipt (#4209)

* fixed miner.sigfile option (#4210)

* Snap: reduced memory footprint on building huffman table (#4214)

* save

* save

* save

* save

* Remove dependency on leveldb (#4213)

* save

* save

* save

* save

* save

* save

* methods to read single txn by txnID (#4215)

* It's safe now to open snapshots at app start (#4216)

* removed obsolete trie variant (#4172)

* up gods lib version (#4217)

* Fix `rpc.BlockNumberOrHash` unmarshaling (#4218)

* add test

* fix unmarshaling bug

Co-authored-by: Igor Mandrigin <[email protected]>

* return err on invalid syncmode (#4219)

* save

* save

* save

* fixed kiln bug (#4221)

* Clean headers pointers when removing links (#4222)

* Clean headers pointers when removing links

* Replace the lock

Co-authored-by: Alexey Sharp <[email protected]>

* Makefile: pass docker build arguments (#4212)

Dockerfile requires some --build-arg options.
Fix "docker" target to pass them.
Fix GIT_TAG to reflect the most recent tag related to HEAD, instead of an unrelated most recent tag.
Use it as the image VERSION.

Image tags need to be passed explicitly if needed:

    DOCKER_FLAGS='-t erigon:latest' make docker

* More header download diagnostics (#4224)

Co-authored-by: Alexey Sharp <[email protected]>

* Clean anchors, forward sort of headers (#4225)

Co-authored-by: Alexey Sharp <[email protected]>

Co-authored-by: Alex Sharov <[email protected]>
Co-authored-by: Giulio rebuffo <[email protected]>
Co-authored-by: Artem Tsebrovskiy <[email protected]>
Co-authored-by: Igor Mandrigin <[email protected]>
Co-authored-by: Igor Mandrigin <[email protected]>
Co-authored-by: Alexey Sharp <[email protected]>
Co-authored-by: battlmonstr <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants