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

Error: malformed request when jsonrpc id is a string #46

Open
Muhammad-Altabba opened this issue Nov 23, 2022 · 1 comment
Open

Error: malformed request when jsonrpc id is a string #46

Muhammad-Altabba opened this issue Nov 23, 2022 · 1 comment

Comments

@Muhammad-Altabba
Copy link

Steps to reproduce

Using in3 as an HTTP provider to send a JSON request to that uses Uuid for the jsonrpc id.

Using web3.js version 4.0.1-alpha.1:

// use the In3Client as Http-Provider for web3.js
const web3 = new Web3(
	new In3Client({
		proof: 'standard',
		signatureCount: 1,
		requestCount: 2,
		chainId: 'mainnet',
	}).createWeb3Provider(),
);

// get the last block number
const block = await web3.eth.getBlockNumber();
console.log(block);

Expected behavior

To accept a string for the Json Rpc id. According the the specification https://www.jsonrpc.org/specification

id
An identifier established by the Client that MUST contain a String, Number, or NULL value if included....

Actual behavior

Got the error:

Error malformed request fetching request {"id":"33ad76b8-5a51-488b-9880-7227668e95cf","method":"eth_blockNumber","params":[],"jsonrpc":"2.0"} from http://rpc.bc-labs.dev/mainnet

System configuration

Incubed version

3.3.3

Request

{"id":"33ad76b8-5a51-488b-9880-7227668e95cf","method":"eth_blockNumber","params":[],"jsonrpc":"2.0"}

Incubed Configuration

Using in3 with web3.js version 4.0.1-alpha.1

Chain

Tested with mainchain. But is supposed to exist regardless of the chain.

Muhammad-Altabba added a commit to web3/web3.js that referenced this issue Nov 23, 2022
@leonardotc
Copy link
Contributor

Hello Muhammad (long time man). Thank you for reporting. We are prioritizing this.

Muhammad-Altabba added a commit to web3/web3.js that referenced this issue Dec 6, 2022
* fix: sending tx with injected provider (#5651)

Co-authored-by: Marin Petrunic <marin.petrunic@gmail.com>

* adding a test for using `ganache` provider

* enable the jsonrpc `id` to optionally be incremented starting from a number
 (Inspired by: #5373 (comment) and needed as a work around for blockchainsllc/in3#46)

* test with `in3` as a provider & skip `in3` test if it takes too long

* increase integration test timeout at web3 package

* add a test for using `hardhat` provider

* improve how legacy providers, such as hardhat, is used

* implement `isPromise` that works in the browsers

* refactor external providers tests

* update CHANGELOG.md
jdevcs added a commit to web3/web3.js that referenced this issue Dec 8, 2022
* Update CHANGELOG version headers

* Contract call with tuple is missing param names (#5613)

* call special output type

* fix

* fix: enable outputs to have param names (#5624)

* hot fix

* add type if only one param

* overloaded inputs types

* fix resolver tests

* add type tests

* simplify types

* revert registry unit test

* test firefox

* revert firefox test

* update changelogs

Co-authored-by: Marin Petrunić <mpetrunic@users.noreply.github.com>

* Fix `isHex` and `isHexStrict` for some edge cases and enrich their tests (#5655)

* Change `isHex` to return true for negative numbers (for example `-123`)
* Change both `isHex` and `isHexStrict` to return `false` for `-0x`
* Change `isHex` to return `false` for empty strings ''.

* Remove erroneous set provider code for Contract constructor (#5669)

* Remove erroneous set provider code for Contract constructor. Add Contract constructor provider set test

* Update CHANGELOGs

* Debugging failing integration tests

* Apply suggestions from code review

* Use getSystemTestProvider instead of hardcoded string

* Refactor ternaries in Contract constructor to if statements

* Correct CHANGELOG entries

* Remove unneeded checks in if statements

* Test with injected external providers (#5652)

* fix: sending tx with injected provider (#5651)

Co-authored-by: Marin Petrunic <marin.petrunic@gmail.com>

* adding a test for using `ganache` provider

* enable the jsonrpc `id` to optionally be incremented starting from a number
 (Inspired by: #5373 (comment) and needed as a work around for blockchainsllc/in3#46)

* test with `in3` as a provider & skip `in3` test if it takes too long

* increase integration test timeout at web3 package

* add a test for using `hardhat` provider

* improve how legacy providers, such as hardhat, is used

* implement `isPromise` that works in the browsers

* refactor external providers tests

* update CHANGELOG.md

* Use Error ABI to parse errors when sending a transaction (#5662)

* use Error ABI when sending a transaction

* update CHANGELOG.md for #5587

* Remove merge conflict marker

Co-authored-by: Oleksii Kosynskyi <oleksii.kosynskyi@gmail.com>
Co-authored-by: Marin Petrunić <mpetrunic@users.noreply.github.com>
Co-authored-by: Muhammad Altabba <24407834+Muhammad-Altabba@users.noreply.github.com>
Co-authored-by: jdevcs <junaid@chainsafe.io>
spacesailor24 added a commit to web3/web3.js that referenced this issue Dec 8, 2022
* Version bump and build for v4.0.1-alpha.2

* Release/4.0.1 alpha.2 changelog update 3 (#5689)

* Update CHANGELOG version headers

* Update CHANGELOGs

* Revert package version bump for web3-packagetemplate

* Release/4.0.1 alpha.2 merge conflicts (#5692)

* Update CHANGELOG version headers

* Contract call with tuple is missing param names (#5613)

* call special output type

* fix

* fix: enable outputs to have param names (#5624)

* hot fix

* add type if only one param

* overloaded inputs types

* fix resolver tests

* add type tests

* simplify types

* revert registry unit test

* test firefox

* revert firefox test

* update changelogs

Co-authored-by: Marin Petrunić <mpetrunic@users.noreply.github.com>

* Fix `isHex` and `isHexStrict` for some edge cases and enrich their tests (#5655)

* Change `isHex` to return true for negative numbers (for example `-123`)
* Change both `isHex` and `isHexStrict` to return `false` for `-0x`
* Change `isHex` to return `false` for empty strings ''.

* Remove erroneous set provider code for Contract constructor (#5669)

* Remove erroneous set provider code for Contract constructor. Add Contract constructor provider set test

* Update CHANGELOGs

* Debugging failing integration tests

* Apply suggestions from code review

* Use getSystemTestProvider instead of hardcoded string

* Refactor ternaries in Contract constructor to if statements

* Correct CHANGELOG entries

* Remove unneeded checks in if statements

* Test with injected external providers (#5652)

* fix: sending tx with injected provider (#5651)

Co-authored-by: Marin Petrunic <marin.petrunic@gmail.com>

* adding a test for using `ganache` provider

* enable the jsonrpc `id` to optionally be incremented starting from a number
 (Inspired by: #5373 (comment) and needed as a work around for blockchainsllc/in3#46)

* test with `in3` as a provider & skip `in3` test if it takes too long

* increase integration test timeout at web3 package

* add a test for using `hardhat` provider

* improve how legacy providers, such as hardhat, is used

* implement `isPromise` that works in the browsers

* refactor external providers tests

* update CHANGELOG.md

* Use Error ABI to parse errors when sending a transaction (#5662)

* use Error ABI when sending a transaction

* update CHANGELOG.md for #5587

* Remove merge conflict marker

Co-authored-by: Oleksii Kosynskyi <oleksii.kosynskyi@gmail.com>
Co-authored-by: Marin Petrunić <mpetrunic@users.noreply.github.com>
Co-authored-by: Muhammad Altabba <24407834+Muhammad-Altabba@users.noreply.github.com>
Co-authored-by: jdevcs <junaid@chainsafe.io>

* Release patch/4.0.1 alpha.2/solve merge conflicts (#5697)

* Update CHANGELOG version headers

* Remove merge conflict markers

* Remove double CHANGELOG entry

Co-authored-by: Oleksii Kosynskyi <oleksii.kosynskyi@gmail.com>
Co-authored-by: Marin Petrunić <mpetrunic@users.noreply.github.com>
Co-authored-by: Muhammad Altabba <24407834+Muhammad-Altabba@users.noreply.github.com>
Co-authored-by: jdevcs <junaid@chainsafe.io>
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

No branches or pull requests

2 participants