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

Problem with ledge proxy #14

Open
chm10 opened this issue Jan 4, 2022 · 3 comments
Open

Problem with ledge proxy #14

chm10 opened this issue Jan 4, 2022 · 3 comments

Comments

@chm10
Copy link

chm10 commented Jan 4, 2022

Rocket not working with Vec<u8>

https://api.rocket.rs/v0.4/rocket/data/trait.FromData.html#provided-implementations

  • Vec<u8>
    Note: An implementation of FromData for Vec is only available when compiling in debug mode!
    Reads the entire request body into a Vec. If reading fails, returns a Failure with the corresponding io::Error.
    WARNING: Do not use this implementation for anything but debugging. This is because the implementation reads the entire body into memory; since the user controls the size of the body, this is an obvious vector for a denial of service attack.
root@76decc26b37c:/home/app/ledger_proxy# cargo install --path .
  Installing obu v0.1.0 (/home/app/ledger_proxy)
    Updating crates.io index
   Compiling obu v0.1.0 (/home/app/ledger_proxy)
error[E0277]: the trait bound `Vec<u8>: FromDataSimple` is not satisfied
  --> src/comns/api.rs:39:21
   |
39 | fn post_transaction(body: Vec<u8>)
   |                     ^^^^^^^^^^^^^ the trait `FromDataSimple` is not implemented for `Vec<u8>`
   |
   = note: required because of the requirements on the impl of `FromData<'_>` for `Vec<u8>`

For more information about this error, try `rustc --explain E0277`.
error: failed to compile `obu v0.1.0 (/home/app/ledger_proxy)`, intermediate artifacts can be found at `/home/app/ledger_proxy/target`

Caused by:
  could not compile `obu` due to previous error
@LudeeD
Copy link
Owner

LudeeD commented Jan 9, 2022

hey @chm10 you are posting this issue in a long abandoned project of mine, its my old thesis xD

Is there any reason for you to want to use this ?

@chm10
Copy link
Author

chm10 commented Feb 14, 2022

Hello, @LudeeD. Nice to meet you. I didn't see the reply.

I'm in the master's program at UNICAMP (Brazil university). I knew your co-orienteer (Carlos); he presented me your thesis that was close to the direction we wanted to step. So, I offered to continue your work and make some contributions. I checked your Github and found this repository https://github.com/LudeeD/dignitas. I tried to reproduce the environment for Transaction Processor, Gateway Server, and CLI. I created a Dockefile file to run the individual module.

To confirm if I'm reproducing your work right. First, I need to build and deploy the Sawtooth framework using docker-compose.yml. Second, I can install rust with a rust-nightly version or create an image with rust installed (I did this) that I will use to cargo run with different settings. Finally, I run the application with Android Studio for a trusted and non-trusted user (used to authenticate the transaction)?

Another question, is it a requirement for your system must have a trusted user for each report made by an untrusted user? Do you know if Sawtooth PBFT (Practical Byzantine Fault Tolerance) can consider an authorized user after some time of interaction with the system?

I have some trouble running your untrusted app and auditor app trusted user.
I don't understand how you started the node server/node client. And I don't know how you create a connection between your Kotlin application with the Dignitas service API.

Thank you for helping me.

Best Regards, Christian.

@chm10
Copy link
Author

chm10 commented Feb 14, 2022

For the ledge proxy, I find the problem. Most of the packages used for this project use a nightly version of rust. For example, the Rest API for rust (Rocket) has many nightly package versions. So I followed these settings and worked.

FROM rust:slim-buster as builder

WORKDIR /usr/src/ledger-proxy
COPY . .

RUN 	apt-get update &&\  
	apt-get -y upgrade &&\
	apt-get -y install curl gnupg2 
RUN echo "deb http://download.opensuse.org/repositories/network:/messaging:/zeromq:/release-stable/Debian_9.0/ ./" >> /etc/apt/sources.list
RUN curl -L "https://download.opensuse.org/repositories/network:/messaging:/zeromq:/release-stable/Debian_9.0/Release.key" | apt-key add -
# Install zeromq
RUN apt-get install -y pkg-config libssl-dev libzmq5-dev 

# Install ProtoBuffers
RUN yes | apt-get install protobuf-compiler

RUN rustup override set nightly

RUN cargo install --path .

CMD ["ledger-proxy"]

But I find a problem running another repository with Dignitas. 😢

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