Skip to content

statement-store: Add wire protocol V1 encode/decode edge case tests#3187

Merged
AndreiEres merged 3 commits into
mainfrom
ae-statement-wire-protocol-tests
Apr 15, 2026
Merged

statement-store: Add wire protocol V1 encode/decode edge case tests#3187
AndreiEres merged 3 commits into
mainfrom
ae-statement-wire-protocol-tests

Conversation

@AndreiEres

Copy link
Copy Markdown
Contributor

Part of #3142

Extended wire protocol V1 tests to match polkadot-sdk coverage: added field ordering violations (duplicates, out-of-order), malformed bytes (invalid discriminants, corrupted proof variant, inflated field count), truncated payloads (empty, partial expiry, partial proof), and cross-compatibility hex vectors for Ed25519 and Secp256k1Ecdsa proofs generated from polkadot-sdk.

Comment thread lib/src/network/codec/statement.rs Outdated

// Ed25519 proof: signature=[0xAA; 64], signer=[0xBB; 32], expiry=1000, data=[1,2,3]
// Generated by polkadot-sdk's Statement::encode()
let ed25519_bytes = hex::decode("0c0001aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb02e803000000000000080c010203").unwrap();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can we split this into lines under 100 characters please?

Comment thread lib/src/network/codec/statement.rs Outdated

// Secp256k1Ecdsa proof: signature=[0x77; 65], signer=[0x88; 33], expiry=500
// Generated by polkadot-sdk's Statement::encode()
let secp_bytes = hex::decode("080002777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777777788888888888888888888888888888888888888888888888888888888888888888802f401000000000000").unwrap();

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

< 100 characters please :)

@AndreiEres AndreiEres enabled auto-merge (squash) April 15, 2026 12:34
@AndreiEres AndreiEres merged commit 4320ce0 into main Apr 15, 2026
26 checks passed
@AndreiEres AndreiEres deleted the ae-statement-wire-protocol-tests branch April 15, 2026 12:47
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.

3 participants