stellar / soroban-examples

Example Soroban Contracts
Apache License 2.0
65 stars 68 forks source link

Added profile.release and release-with-logs to Logging example Cargo.toml #228

Closed anupsdf closed 1 year ago

anupsdf commented 1 year ago

Added profile.release and release-with-logs to Logging example Cargo.toml. Since the example wants users to run with these profile options. Also, added soroban-sdk version here because without it I was getting an error Status(HostFunctionError(InputArgsInvalid)) when invoking the contract.

After this fix, I can see the debug statement Hello Symbol(friend) but there is also an error after that.

#0: debug: Hello Symbol(friend)
error: debug events unsupported: DebugEvent {
    msg: Some(
        "Hello {}",
    ),
    args: [
        Val(
        Symbol(friend),
    ),
    ],
}
leighmcculloch commented 1 year ago

@anupsdf It sounds like you might be building the logging crate in isolation separate to the workspace. In the example repo all the examples build in context of the virtual workspace Cargo.toml file at the root.

Given that people engage with examples in the docs in isolation, then here a big connected soup, maybe we should rethink the virtual workspace in the examples repo and remove it.

While it will be a little annoying to have to update the version of the SDK in multiple files, it will create a better developer experience for developers trying out one or two examples. We should optimize for their experience.

cc @sisuresh @dmkozh @paulbellamy

dmkozh commented 1 year ago

Given that people engage with examples in the docs in isolation, then here a big connected soup, maybe we should rethink the virtual workspace in the examples repo and remove it.

Agree here, virtual workspace is pretty confusing and I'm sure I'm not the only one who initially tried to just run an example from the example directory and failed. My point was that if we do use it, then we should benefit from it. But probably a more intuitive solution is really to make every example standalone, which is of course a lot of boilerplate, but also is much friendlier to the people new to Rust.

anupsdf commented 1 year ago

The main issue was that some examples had dependencies with other examples causing errors. I will close this one and create a new PR to fix the dependencies.