Skip to content

Latest commit

 

History

History
132 lines (92 loc) · 6.03 KB

README.md

File metadata and controls

132 lines (92 loc) · 6.03 KB

Scale-codec-comparator

To date, there are 10 published implementations of the SCALE Codec. Since each is implemented by a different team & the reference implementation still introduces small fixes, it would be beneficial to compile a table of feature-completeness. This would provide (some) assurance that the implementation in a given language is safe & sound to use.

Scale-codec-comarator provides the FFI function of the parity-scale-codec library, which can compare the implementation results of various SCALE Codecs

GitHub action is integrated to run unit tests using the FFI of Rust lib

Comparator Result Badges

scale.go php-scale-codec scale.rb py-scale-codec polkadot.js go-substrate-rpc-client cScale scale-codec-js-library as-scale-codec scale-codec-cpp scale-ts

The tests of the following scale libraries have been completed

Build

make

FFI

The FFI are definitions here https://github.com/gmajor-encrypt/scale-codec-comparator/blob/main/src/scale_ffi.h

How to Compare

We use the reference implementation as the standard result to compare with the results of other implementations of the SCALE Codec test. If the test fails, the implementation is inconsistent with parity-scale. You can simply get the test results from the top badges.

How to test

scale.go

cd scale.go && go test -v ./...

php-scale-codec

cd php-scale-codec && composer install && make

scale.rb

cd scale.rb && bundle install && bundle exec rspec spec/base_spec.rb

polkadot-js

cd polkadot-js && npm install && npm run test

py-scale-codec

 cd py-scale-codec && pip install -r requirements.txt && python -m unittest discover

scale-ts

cd scale-ts && npm install && npm run test

scale-codec-js-library

cd scale-codec-js-library && npm install && npm run test

go-substrate-rpc-client

cd go-substrate-rpc-client && go test -v ./...

as-scale-codec

cd as-scale-codec-wasm && npm run asbuild  ## build as-scale-codec wasm
cd ../as-scale-codec && npm run test

cScale

cd cScale && git submodule update --init --recursive && cmake --build . && ./MyProject

scale-codec-cpp

cd scale-codec-cpp && cmake . && cmake --build . --target scaleCodecCpp -j 8 && ./scaleCodecCpp

Auto Test

Dependabot here declares that all the above libs will be automatically updated and tested through pull requests if there is a new version. Here are a few examples:

  • polkadot.js #5
  • substrate-codec-php #4

License

The package is available as open source under the terms of the MIT License