Git Product home page Git Product logo

strict-encoding's Issues

InvalidChar may be confusing in some instances

The InvalidRString::InvalidChar error contains the character that has been found to be invalid, but it may not match the character in the original string.

As an example, trying to issue an asset using a Unicode character in the ticker or name trigger this issue.

More specifically, issuing a NIA asset with name name with ℧nicode characters throws the error:

string 'name with ℧nicode characters' contains invalid character 'â'

This probably happens because the string is parsed 1 byte at a time and the 1st byte of the Unicode character happens to correspond to the â ASCII character, and this may lead do confusion.

Since the invalid character cannot be correctly interpreted in some cases, it may be better to omit it and just report the string that failed, or report the position of the invalid character in the string (which I think should always be correct) instead of its ASCII representation.

Add strict_check method to StrictDecode

For checking internal data consistency upon decoding operation

impl<const VERSION: u8> StrictDecode for ___ {
  fn strict_check(&self) -> Result<(), DecodeError> {
    // ...
  }
}

The method should have a default implementation which should not error.

`--no-default-features` on `strict-encoding` not taking effect

Here is the output of cargo build -p strict_encoding -v --no-default-features:

rustc --crate-name strict_encoding --edition=2021 rust/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi,artifacts,future-incompat --diagnostic-width=181 --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C split-debuginfo=unpacked -C debuginfo=2 --cfg 'feature="default"' --cfg 'feature="derive"' --cfg 'feature="strict_encoding_derive"' -C metadata=e188277cae2a4737 -C extra-filename=-e188277cae2a4737 --out-dir /Users/yudaikiyofuji/IdeaProjects/strict-encoding/target/debug/deps -C incremental=/Users/yudaikiyofuji/IdeaProjects/strict-encoding/target/debug/incremental -L dependency=/Users/yudaikiyofuji/IdeaProjects/strict-encoding/target/debug/deps --extern amplify=/Users/yudaikiyofuji/IdeaProjects/strict-encoding/target/debug/deps/libamplify-be50d4e6df4ec592.rmeta --extern strict_encoding_derive=/Users/yudaikiyofuji/IdeaProjects/strict-encoding/target/debug/deps/libstrict_encoding_derive-627116894db1dd46.dylib

You can see the feature default is unexpectedly activated. This is likely because we have a dev-dependency strict_encoding_test which is circularly dependent on strict-encoding.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.