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

Decoding string slices from logs #1151

Closed
hal3e opened this issue Oct 4, 2023 · 1 comment
Closed

Decoding string slices from logs #1151

hal3e opened this issue Oct 4, 2023 · 1 comment
Assignees
Labels
blocked epic An epic is a high-level master issue for large pieces of work.

Comments

@hal3e
Copy link
Contributor

hal3e commented Oct 4, 2023

String slices can not be decoded by the SDK when they are logged. Issue to track on the sway side: FuelLabs/sway#5110

If fixed, remove the error from:

    fn can_decode_log_with_type<T: Parameterize>() -> Result<()> {
        match T::param_type()
            ParamType::StringSlice => Err(error!(
                InvalidData,
                "String slices can not be decoded from logs. Convert the slice to `str[N]` with `__to_str_array`"
            )),
            _ => Ok(()),
        }
    }
@hal3e hal3e added the blocked label Oct 4, 2023
@hal3e hal3e self-assigned this Oct 4, 2023
@hal3e hal3e mentioned this issue Oct 4, 2023
6 tasks
hal3e added a commit that referenced this issue Jan 29, 2024
closes: #1247,
#1151,
#901,
#898

This PR adds support for sway's experimental encoding in logs. The new
encoder is enabled with the `experimental` rustflag.

To run the tests, first build the forc projects with: 
`forc build --path packages/fuels --experimental-new-encoding` then run
the tests with:
 `RUSTFLAGS='--cfg experimental' cargo test --test logs`
 
 What was done:
 - added `ExperimentalBoundedDecoder`
 - updated how `RawSlice` was  encoded and decoded
 - added tests for the new encoding
 - add new CI step that runs tests with the new `experimental` flag
 
 BREAKING CHANGE:
 - change `RawSlice` encoding and decoding
@kamyar-tm kamyar-tm added the epic An epic is a high-level master issue for large pieces of work. label Feb 15, 2024
@hal3e
Copy link
Contributor Author

hal3e commented Feb 20, 2024

This issue is resolved in #1259

@hal3e hal3e closed this as completed Feb 20, 2024
ak-tech007 added a commit to ak-tech007/Rust-SDK that referenced this issue Dec 6, 2024
closes: FuelLabs/fuels-rs#1247,
FuelLabs/fuels-rs#1151,
FuelLabs/fuels-rs#901,
FuelLabs/fuels-rs#898

This PR adds support for sway's experimental encoding in logs. The new
encoder is enabled with the `experimental` rustflag.

To run the tests, first build the forc projects with: 
`forc build --path packages/fuels --experimental-new-encoding` then run
the tests with:
 `RUSTFLAGS='--cfg experimental' cargo test --test logs`
 
 What was done:
 - added `ExperimentalBoundedDecoder`
 - updated how `RawSlice` was  encoded and decoded
 - added tests for the new encoding
 - add new CI step that runs tests with the new `experimental` flag
 
 BREAKING CHANGE:
 - change `RawSlice` encoding and decoding
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked epic An epic is a high-level master issue for large pieces of work.
Projects
None yet
Development

No branches or pull requests

2 participants