Is there a way to debug transactions in RSK network, which could be the best way? - debugging

We are running an RSK node, some smart contract transactions show internal errors, but the message related to the failed require condition doesn't appear in those error messages...
We only see "internal error" and are unable to see which specific error occurred.

If your contract emits messages in the reversions, then you can find them out by using debug_traceTransaction.
NOTE: The debug RPC module is enabled by default in RSK config, but this is disabled on public nodes.
Furthermore, the RSK public nodes do not expose this feature, and you must run your own node in order to do so.
The following assumes that you have a local node running with RPC exposed on port 4444.
First, you need to enable debug module in your config file:
modules = [
...
{
"name": "debug",
"version": "1.0",
"enabled": "true",
},
...
]
Then, you can execute the RPC method passing the
transaction ID as a parameter, like in this example:
curl \
-X POST \
-H "Content-Type:application/json" \
--data '{"jsonrpc":"2.0","method":"debug_traceTransaction","params":["0xa9ae08f01437e32973649cc13f6db44e3ef370cbcd38a6ed69806bd6ea385e49"],"id":1}' \
http://localhost:4444
You will get the following response
(truncated for brevity):
{
...
"result": "08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000001e536166654d6174683a207375627472616374696f6e206f766572666c6f770000",
"error": "",
"reverted": true,
...
}
Finally, convert result from hexadecimal to ASCII,
to obtain a readable message:
Ãy SafeMath: subtraction overflow

Related

PCEP-SR draft version 6, SR Explicit Route Object/Record Route Object subobjects

I am setting up Segment routing via Pathman-SR with ODL Nitrogen Controller and vMX Juniper routers. To allow this, I have to change IANA subojbects code points, but I am unable to do it...
Followed this documenntations, but still no result:
https://docs.opendaylight.org/en/stable-carbon/user-guide/pcep-user-guide.html#segment-routing
https://test-odl-docs.readthedocs.io/en/latest/user-guide/pcep-user-guide.html
I tried to update configuration via REST API, but when I send PUT request:
/restconf/config/pcep-segment-routing-app-config:pcep-segment-routing-app-config
with the body:
<pcep-segment-routing-config xmlns="urn:opendaylight:params:xml:ns:yang:controller:pcep:segment-routing-app-config">
<iana-sr-subobjects-type>true</iana-sr-subobjects-type>
</pcep-segment-routing-config>
I get the following error:
{
"errors": {
"error": [
{
"error-type": "protocol",
"error-tag": "invalid-value",
"error-message": "URI has bad format. Possible reasons:\n 1. \"pcep-segment-routing-app-config:pcep-segment-routing-app-config\" was not found in parent data node.\n 2. \"pcep-segment-routing-app-config:pcep-segment-routing-app-config\" is behind mount point. Then it should be in format \"/yang-ext:mount/pcep-segment-routing-app-config:pcep-segment-routing-app-config\"."
}
]
}
}
I think there is a typo in the URL in the doc, you have to use /restconf/config/pcep-segment-routing-app-config:pcep-segment-routing-config
You can check this guide for reference:
https://docs.opendaylight.org/projects/bgpcep/en/stable-neon/pcep/pcep-user-guide-active-stateful-pce.html#iana-code-points

Spring WebFlux not streaming response

I was expecting this code to stream events to the client (code is in Kotlin but Java is very similar)
#RestController
object CustomerController {
#GetMapping("/load", produces = arrayOf("application/stream+json"))
fun load(): Flux<String> {
var flux = Flux.fromIterable(ResultIterable())
flux.subscribe({println(it)})
return flux
}
}
ResultIterable is an iterable that generates a string on regular intervals. An infinite stream basically.
I don't see any output, it hangs forever.
I do see the string being printed on regular intervals (println(it)).
I am using the following curl:
curl -X GET http://localhost:8080/load -H 'accept: application/stream+json' -H 'cache-control: no-cache' -H 'content-type: application/stream+json'
Your error is here:
flux.subscribe({println(it)})
You subscribe to the Flux and consume it directly in the method.
When this Flux reaches the Reactor Netty HTTP container, there is nothing to consume already.
If you really would like println() each item, consider to use doOnNext() instead and really leave that subscribe() to the container.
Also you have to really follow Server Side Events rules:
The server-side event stream syntax is simple. Set the "Content-Type" header to "text/event-stream".
https://www.w3schools.com/html/html5_serversentevents.asp
So, when I do this:
#GetMapping("/load", produces = [MediaType.TEXT_EVENT_STREAM_VALUE])
fun load() =
Flux.just("foo", "bar", "baz")
.doOnNext({ println(it) })
I start to get Server Side Events in my connected client:
C:\tmp\so50823339>curl -X GET http://localhost:8080/load
data:foo
data:bar
data:baz
C:\tmp\so50823339>
where at the same time I get logs on the server for the mentioned doOnNext():
2018-06-12 17:33:37.453 INFO 6800 --- [ main] c.e.s.s.So50823339ApplicationKt : Started So50823339ApplicationKt in 3.112 seconds (JVM running for 3.924)
foo
bar
baz

Ansible Tower API not accepting token

I am performing the following POST in a Tower server:
http://<my-tower-url>/api/v2/job_templates/10/launch/
Headers:
Content-Type:application/json
Authorization:sometokenhere
And getting back the error:
{"detail":"Authentication credentials were not provided."}
Have also tried the following:
Headers:
Content-Type:application/json
Authorization:Token sometokenhere
as suggested here.
Same happens when passing raw username/password in the POST body as follows (and skipping the Authorization header):
{
"username": "myusername",
"password": "mypass",
"inventory": "inventoryname",
"verbosity": 0,
"extra_vars": {
"var1": "somevar1",
"var2": "somevar2",
"var3": "somevar3",
"var4": "somevar4",
"var5": "somevar5"
}
}
Any idea why this is not working?
Authorization: Bearer <oauth2-token-value>
See here, Section "3. OAuth 2 Token Authentication", part "Curl Example".
I ended up using basic auth as follows:
1.create the user which you want to run your ci jobs with
2.perform the following post at the respective CI job:
curl -o /dev/null -s -w \"%{http_code}\n\" -X POST http://<my-tower-url>/api/v2/job_templates/10/launch/ \
-H \"authorization: Basic $MY_AUTH_TOKEN\" \
-H \"content-type: application/json\" \
-d \"#awx_data.json
Where
awx_data.json is a file holding the actual POST body
MY_AUTH_TOKEN is the tyical base64 encoded username+password of the above user
You can also assign the above result and check it against 201 which is what AWX returns upon successful job creation.
Polling the AWX server to check if the job was successfully finished is another story of course.

Querying remote registry service on machine <IP Address> resulted in exception: Unable to change open service manager

My cluster Config file as follows
`
{
"name": "SampleCluster",
"clusterConfigurationVersion": "1.0.0",
"apiVersion": "01-2017",
"nodes":
[
{
"nodeName": "vm0",
"iPAddress": "here is my VPS ip",
"nodeTypeRef": "NodeType0",
"faultDomain": "fd:/dc1/r0",
"upgradeDomain": "UD0"
},
{
"nodeName": "vm1",
"iPAddress": "here is my another VPS ip",
"nodeTypeRef": "NodeType0",
"faultDomain": "fd:/dc1/r1",
"upgradeDomain": "UD1"
},
{
"nodeName": "vm2",
"iPAddress": "here is my another VPS ip",
"nodeTypeRef": "NodeType0",
"faultDomain": "fd:/dc1/r2",
"upgradeDomain": "UD2"
}
],
"properties": {
"reliabilityLevel": "Bronze",
"diagnosticsStore":
{
"metadata": "Please replace the diagnostics file share with an actual file share accessible from all cluster machines.",
"dataDeletionAgeInDays": "7",
"storeType": "FileShare",
"IsEncrypted": "false",
"connectionstring": "c:\\ProgramData\\SF\\DiagnosticsStore"
},
"nodeTypes": [
{
"name": "NodeType0",
"clientConnectionEndpointPort": "19000",
"clusterConnectionEndpointPort": "19001",
"leaseDriverEndpointPort": "19002",
"serviceConnectionEndpointPort": "19003",
"httpGatewayEndpointPort": "19080",
"reverseProxyEndpointPort": "19081",
"applicationPorts": {
"startPort": "20001",
"endPort": "20031"
},
"isPrimary": true
}
],
"fabricSettings": [
{
"name": "Setup",
"parameters": [
{
"name": "FabricDataRoot",
"value": "C:\\ProgramData\\SF"
},
{
"name": "FabricLogRoot",
"value": "C:\\ProgramData\\SF\\Log"
}
]
}
]
}
}
It is almost identical to standalone service fabric download demo file for untrusted cluster except my VPS ip. I enabled remote registry service.I ran the
\TestConfiguration.ps1 -ClusterConfigFilePath \ClusterConfig.Unsecure.MultiMachine.json but i got the following error.
Unable to change open service manager handle because 5
Unable to query service configuration because System.InvalidOperationException: Unable to change open service manager ha
ndle because 5
at System.Fabric.FabricDeployer.FabricDeployerServiceController.GetServiceStartupType(String machineName, String serv
iceName)
Querying remote registry service on machine <IP Address> resulted in exception: Unable to change open service manager
handle because 5.
Unable to change open service manager handle because 5
Unable to query service configuration because System.InvalidOperationException: Unable to change open service manager ha
ndle because 5
at System.Fabric.FabricDeployer.FabricDeployerServiceController.GetServiceStartupType(String machineName, String serv
iceName)
Querying remote registry service on machine <Another IP Address> resulted in exception: Unable to change open service manager
handle because 5.
Best Practices Analyzer determined environment has an issue. Please see additional BPA log output in DeploymentTraces
LocalAdminPrivilege : True
IsJsonValid : True
IsCabValid :
RequiredPortsOpen : True
RemoteRegistryAvailable : False
FirewallAvailable :
RpcCheckPassed :
NoConflictingInstallations :
FabricInstallable :
DataDrivesAvailable :
Passed : False
Test Config failed with exception: System.InvalidOperationException: Best Practices Analyzer determined environment has
an issue. Please see additional BPA log output in DeploymentTraces folder.
at System.Management.Automation.MshCommandRuntime.ThrowTerminatingError(ErrorRecord errorRecord)
I don't understand the problem.VPSs are not locally connected. All are public IP.I don't know, this may b an issue. how do I make virtual LAN among these VPS?Can anyone give me some direction about this error?Anyone helps me is greatly appreciated.
Edit: I used VM term insted of VPS.
Finally I make this working. Actually all the nodes are in a network, i thought it wasn't. I enable file sharing. I try to access the shared file from the node where I ran configuration test to the all other nodes. I have to give the credentials of logins. And then it works like a charm.

Kony service giving 1012 opstatus Request failed error and not giving response

I have a kony sample app where I am trying to do a build and the app has one web service in it for fetching categories of some product. I have the following code also that I wrote:
function GetCategories() {
var inputparam = {
"appID": "bbuy",
"serviceID": "GetCategories",
"catId": "cat00000",
"channel": "rc",
"httpheaders": {}
};
kony.net.invokeServiceAsync("http://192.168.42.134/middleware/MWservlet",inputparam, serv_GetCategoriesCallback);
}
I am getting no response for this. Getting 1012 opstatus and the message is saying "Request failed" error.
kony.net.invokeServiceAsync("http://192.168.42.134/middleware/MWservlet",inputparam, serv_GetCategoriesCallback);
In the above line, you have not given the port number in the MWservlet URL.(e.g. 8080) Give that and check.
Also, make sure all input params are being fed to the service and that they correspond to the exact naming convention followed in the service editor.
Visit :
Find the below link. i hope it gives you a solution
http://developer.kony.com/twiki/pub/Portal/Docs/API_Reference/Content/Network_APIs.htm#net.invo2
Check the mandatory and optional fields of Inputparam

Resources