mirror of https://github.com/hyperledger/besu
Add 0x check for Address, Bytes, and Bytes32 in GraphQl requests (#1057)
Produce error response if any of Address, Bytes or Bytes32 values inside GraphQl requests are not prefixed with 0x as defined by the spec. Fix old tests that used values that are not prefixed with 0x and add additional tests to confirm Address, Bytes and Bytes32 values will be rejected if not prefixed with 0x. Signed-off-by: Mak Muftic <mak@nodefactory.io>pull/1198/head
parent
9c409258b1
commit
ba491c7ee0
@ -0,0 +1,21 @@ |
|||||||
|
{ |
||||||
|
"request": "{block(number :\"0x8\") {number call (data : {from : \"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\", to: \"0x6295ee1b4f6dd65047762f924ecd367c17eabf8f\", data :\"12a7b914\"}){data status}}}" |
||||||
|
, |
||||||
|
"response": { |
||||||
|
"errors": [ |
||||||
|
{ |
||||||
|
"message": "Validation error of type WrongType: argument 'data.data' with value 'StringValue{value='12a7b914'}' is not a valid 'Bytes' - Bytes value '12a7b914' is not prefixed with 0x @ 'block/call'", |
||||||
|
"locations": [ |
||||||
|
{ |
||||||
|
"line": 1, |
||||||
|
"column": 37 |
||||||
|
} |
||||||
|
], |
||||||
|
"extensions": { |
||||||
|
"classification": "ValidationError" |
||||||
|
} |
||||||
|
} |
||||||
|
] |
||||||
|
}, |
||||||
|
"statusCode": 400 |
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
{ |
||||||
|
"request": "{account(blockNumber:\"0x19\", address: \"6295ee1b4f6dd65047762f924ecd367c17eabf8f\") { balance } }", |
||||||
|
"response": { |
||||||
|
"errors": [ |
||||||
|
{ |
||||||
|
"message": "Validation error of type WrongType: argument 'address' with value 'StringValue{value='6295ee1b4f6dd65047762f924ecd367c17eabf8f'}' is not a valid 'Address' - Address value '6295ee1b4f6dd65047762f924ecd367c17eabf8f' is not prefixed with 0x @ 'account'", |
||||||
|
"locations": [ |
||||||
|
{ |
||||||
|
"line": 1, |
||||||
|
"column": 30 |
||||||
|
} |
||||||
|
], |
||||||
|
"extensions": { |
||||||
|
"classification": "ValidationError" |
||||||
|
} |
||||||
|
} |
||||||
|
] |
||||||
|
}, |
||||||
|
"statusCode": 400 |
||||||
|
} |
@ -0,0 +1,20 @@ |
|||||||
|
{ |
||||||
|
"request": "{block (hash : \"c8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6\") {number } }", |
||||||
|
"response": { |
||||||
|
"errors": [ |
||||||
|
{ |
||||||
|
"message": "Validation error of type WrongType: argument 'hash' with value 'StringValue{value='c8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6'}' is not a valid 'Bytes32' - Bytes32 value 'c8df1f061abb4d0c107b2b1a794ade8780b3120e681f723fe55a7be586d95ba6' is not prefixed with 0x @ 'block'", |
||||||
|
"locations": [ |
||||||
|
{ |
||||||
|
"line": 1, |
||||||
|
"column": 9 |
||||||
|
} |
||||||
|
], |
||||||
|
"extensions": { |
||||||
|
"classification": "ValidationError" |
||||||
|
} |
||||||
|
} |
||||||
|
] |
||||||
|
}, |
||||||
|
"statusCode": 400 |
||||||
|
} |
Loading…
Reference in new issue