-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
problem: no response on invalid request to proxy
rel: #43
- Loading branch information
Showing
13 changed files
with
7,148 additions
and
26 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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
25 changes: 25 additions & 0 deletions
25
testing/simple-upstream/src/main/groovy/testing/ResourceResponse.groovy
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package testing | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper | ||
|
||
class ResourceResponse { | ||
|
||
ObjectMapper objectMapper | ||
|
||
ResourceResponse(ObjectMapper objectMapper) { | ||
this.objectMapper = objectMapper | ||
} | ||
|
||
Object getResource(String name) { | ||
String json = BlocksHandler.class.getResourceAsStream("/" + name)?.text | ||
if (json == null) { | ||
return null | ||
} | ||
return objectMapper.readValue(json, Map) | ||
} | ||
|
||
CallHandler.Result respondWith(String name) { | ||
return CallHandler.Result.ok(getResource(name)) | ||
} | ||
|
||
} |
This file contains 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
15 changes: 15 additions & 0 deletions
15
testing/simple-upstream/src/main/groovy/testing/TestcaseHandler.groovy
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,29 @@ | ||
package testing | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper | ||
|
||
class TestcaseHandler implements CallHandler { | ||
|
||
ObjectMapper objectMapper | ||
ResourceResponse resourceResponse | ||
|
||
TestcaseHandler(ObjectMapper objectMapper) { | ||
this.objectMapper = objectMapper | ||
this.resourceResponse = new ResourceResponse(objectMapper) | ||
} | ||
|
||
@Override | ||
Result handle(String method, List<Object> params) { | ||
// https://github.com/emeraldpay/dshackle/issues/35 | ||
if (method == "eth_call" | ||
&& params[0].to?.toLowerCase() == "0x542156d51D10Db5acCB99f9Db7e7C91B74E80a2c".toLowerCase()) { | ||
return Result.error(-32015, "VM execution error.") | ||
} | ||
// https://github.com/emeraldpay/dshackle/issues/43 | ||
if (method == "debug_traceTransaction" | ||
&& params[0].toLowerCase() == "0xd949bc0fe1a5d16f4522bc47933554dcc4ada0493ff71ee1973b2410257af9fe".toLowerCase()) { | ||
return resourceResponse.respondWith("trace-0xd949bc.json") | ||
} | ||
return null | ||
} | ||
} |
Oops, something went wrong.