iotaledger / entangled

enTangle'd is an amalgamation of all things Tangle
Apache License 2.0
113 stars 66 forks source link

ciri: can't send transaction message from c-iota-workshop (send_hello) #1439

Open bernardoaraujor opened 4 years ago

bernardoaraujor commented 4 years ago

Describe the bug The first example of c-iota-workshop (hello_world), which just prints out info about the server, runs fine with cIRI:

$ ./bazel-bin/examples/hello_world -h bernardoaraujor.ydns.eu -p 14265
appName cIRI-mainnet 
appVersion 0.1.0-alpha 
latestMilestone UNVTSIKMIQRVWVXUBTAIXVYIVNHYLFPFKZXQSGDOVKANMKCLSWFDIHVPWGNDBNGNTQMNBWX99KGJA9999 
latestMilestoneIndex 1189733
milestoneStratIndex 0
neighbors 1 
packetsQueueSize 0 
time 1569601997498
tips 2 
transactionsToRequest 7

However the second example (send_hello) doesn't work.

Here's the source code. I forked from iota-community to add CLI parameters instead of hardcoded hostname and port: https://github.com/bernardoaraujor/c-iota-workshop/blob/master/examples/e02_send_hello.c

Here's the behaviour when I execute it:

bernardo@bernardo-UX51VZA:~/dev/c-iota-workshop$ ./bazel-bin/examples/send_hello -h bernardoaraujor.ydns.eu -p 14265
send transfer HTTP service error
Transaction failed with error code: 1156
bernardo@bernardo-UX51VZA:~/dev/c-iota-workshop$ ./bazel-bin/examples/send_hello -h bernardoaraujor.ydns.eu -p 14265
send transfer IRI response:
Transaction failed with error code: 1095

And here's the error message on cIRI logs (from error 1156... error 1095 didn't show anything):

2019-09-27 18:50:24:       api_http:    ERR: cIRI HTTP API currently does not support parsing such large requests.

To Reproduce Steps to reproduce the behavior:

  1. Clone https://github.com/bernardoaraujor/c-iota-workshop
  2. Build examples $ bazel build ...
  3. Execute send_hello example: $ ./bazel-bin/examples/send_hello -h 51.158.64.80 -p 14265
  4. Check cIRI logs.

Expected behavior When I point to an IRI full node, I get this response:

$ ./bazel-bin/examples/send_hello -h 185.244.195.45 -p 14265
send transfer OK
bundle hash: ZRKWZLHQSWJKDV9YBGBQZHRXFTPMOLTBBYXQCDJGSAFCJTKFSVSK9AGLVKXXQJYRGAYXGILNCBSWRSSGC
Transaction was sent.

Which is confirmed at: https://thetangle.org/address/TOKLOARHKXQCVPPVVIPIJGLUTLTKFHYGMBBLOXJFYGSARLOTYFFSDZNYCOBOCNPGRMJWZCQBNOROUCE9G

Additional context Philipp Blum (@citrullin) and I will make a presentation of IOTA on the upcoming Yocto Project Summit 2019. We want to do a live demo based on cIRI and the examples from c-iota-workshop. The presentation is scheduled for November 1st. It would be great to have all 6 examples working with cIRI until then.

oopsmonk commented 4 years ago

the error 1156 and 1095 are reported by CClient means something wrong from the IRI.

you can use error_2_string to show a readable text in your code. https://github.com/bernardoaraujor/c-iota-workshop/blob/master/examples/e02_send_hello.c#L100

oopsmonk commented 4 years ago

@thibault-martinez @tsvisabo The error message is ERR: cIRI HTTP API currently does not support parsing such large requests. from cIRI's http server. What is the limitation of requests on cIRI?

thibault-martinez commented 4 years ago

This seems to be a limitation of libmicrohttpd. A more complex architecture has to be set up to allow bigger payloads. I never like this library 😅

Citrullin commented 4 years ago

@thibault-martinez Are you able to do this before October 31.? We need a running cIRI in combination with CClient for the Yocto Summit. ^^

thibault-martinez commented 4 years ago

I'm not working on cIRI at all at the moment so I can't tell. I'll investigate to understand how long this task could be and I will see if it's doable any time soon.

Citrullin commented 4 years ago

@thibault-martinez Thanks. I will talk to Lewis about the result then. Would be nice to have a working solution for the Yocto summit. :)

bernardoaraujor commented 4 years ago

Is there a way to reduce payload size from e02_send_hello.c?

thibault-martinez commented 4 years ago

Sorry I don't know, I didn't write it. @Citrullin did ?

Citrullin commented 4 years ago

@thibault-martinez I don't think you can reduce the size. Just a simple zero value tx with some text. But @oopsmonk is probably better in answering this.

oopsmonk commented 4 years ago

it's just one transaction in the bundle if cIRI cannot handle it that means it cannot process any transaction requests.

bernardoaraujor commented 4 years ago

@oopsmonk what's the effort estimation to enable support for transaction requests?

oopsmonk commented 4 years ago

@bernardoaraujor the problem is caused by http implementation in cIRI, not related to libmicrohttpd. the error message does not describe the issue correctly. I think @thibault-martinez or @tsvisabo can help to solve it.