Skip to content

[Phase 4] polkadot.js Compatibility Testing (Issue #44)#61

Merged
gmajor-encrypt merged 1 commit intomasterfrom
feature/polkadotjs-compatibility
Mar 25, 2026
Merged

[Phase 4] polkadot.js Compatibility Testing (Issue #44)#61
gmajor-encrypt merged 1 commit intomasterfrom
feature/polkadotjs-compatibility

Conversation

@gmajor-encrypt
Copy link
Owner

Summary

This PR adds a compatibility testing framework to ensure php-scale-codec produces the same encoding results as polkadot.js SCALE codec reference.

Files Added

compat/ directory:

  • README.md - Documentation and usage
  • package.json - Node.js dependencies for polkadot.js tests
  • tests/test-vectors.json - Known good encoding values from polkadot.js
  • tests/php-compatibility-test.php - PHP test runner
  • tests/run-compatibility-tests.js - Node.js test runner
  • tests/generate-test-data.js - Test data generator

Makefile:

  • Added make compat target for running compatibility tests

Test Coverage

Category Types Status
Integers U8, U16, U32, U64, U128, I8, I16, I32, I64
Compact Compact integers
Boolean bool
String Text, String
Collections Vec
Option Option

Test Vectors

Test vectors in test-vectors.json contain:

  • Input values (including edge cases: min, max, 0)
  • Expected hex-encoded outputs from polkadot.js reference

Running Tests

# Run PHP compatibility tests
make compat

# Or directly
php compat/tests/php-compatibility-test.php

Tasks from Issue #44

  • Prepare test dataset
  • Write comparison test script
  • Compare encoding/decoding results for all types
  • Fix compatibility issues (to be identified after CI runs)
  • Establish continuous comparison testing

Closes #44

- Add compat/ directory with compatibility test framework
- Add test vectors for all SCALE types (from polkadot.js reference)
- Add PHP compatibility test runner
- Add Node.js test runner for comparison with polkadot.js
- Add `make compat` target
- Document test categories and usage

Test coverage:
- Integer types: U8, U16, U32, U64, U128, I8, I16, I32, I64
- Compact integers
- Boolean
- String/Text
- Vec<T>, Option<T>

Closes #44
@gmajor-encrypt gmajor-encrypt merged commit 7352651 into master Mar 25, 2026
1 check passed
@gmajor-encrypt gmajor-encrypt deleted the feature/polkadotjs-compatibility branch March 25, 2026 06:33
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

Successfully merging this pull request may close these issues.

[Phase 4] polkadot.js Compatibility Testing

1 participant