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

The invalid XDM fraud proof is unsound and maybe unnecessary #2738

Closed
NingLin-P opened this issue May 3, 2024 · 2 comments · Fixed by #2760
Closed

The invalid XDM fraud proof is unsound and maybe unnecessary #2738

NingLin-P opened this issue May 3, 2024 · 2 comments · Fixed by #2760

Comments

@NingLin-P
Copy link
Member

Currently, the invalid XDM fraud proof is verified by calling into the is_valid_xdm domain runtime API with the genesis state of the domain:

let domain_initial_state = consensus_api
.domain_instance_data(consensus_block_hash.into(), domain_id)
.expect("Runtime Api must not fail. This is unrecoverable error")?
.0
.raw_genesis
.into_storage();
domain_stateless_runtime.set_storage(domain_initial_state);
let encoded_extrinsic = opaque_extrinsic.encode();
domain_stateless_runtime
.is_valid_xdm(encoded_extrinsic)
.expect("Runtime api must not fail. This is an unrecoverable error")

while the actual xdm verification is not stateless and involves runtime state like current channel nonce that is not included in the genesis state. So in the invalid XDM FP verification the is_valid_xdm will always return false, if there is a valid XDM the attacker can submit FP to claim the XDM is invalid and the honest bundle author will be slash, this scenario is not covered in the test unfortunately.

Looking closer, the invalid XDM is actually covered by the illegal tx FP, which is essentially proving the pre_dispath result of an extrinsic and the pre_dispath of the XDM included the XDM verification, moreover unlike the current invalid XDM FP, the illegal tx FP is using an execution proof which includes all the required state during pre_dispath, so the invalid XDM can be proved by the illegal tx FP and the current invalid XDM FP is unnecessary.

cc @vedhavyas @dariolina

@dariolina
Copy link
Member

If it can be covered within illegal tx proof, I'm all pro removing an XDM fraud proof type

@vedhavyas
Copy link
Member

Agree. This is mostly a remnent from our previous XDM validation.
I have no concern removing this and use the illegal tx FP itself 👍🏼

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 a pull request may close this issue.

3 participants