@@ -384,8 +384,8 @@ where
384384 Ok ( ( ) )
385385}
386386
387- /// Verifies invalid transfers fraud proof.
388- pub fn verify_invalid_transfers_fraud_proof <
387+ /// Verifies invalid block fees fraud proof.
388+ pub fn verify_invalid_block_fees_fraud_proof <
389389 CBlock ,
390390 DomainNumber ,
391391 DomainHash ,
@@ -405,37 +405,38 @@ pub fn verify_invalid_transfers_fraud_proof<
405405where
406406 CBlock : BlockT ,
407407 Balance : PartialEq + Decode + Encode + Zero + Default ,
408+ DomainHashing : Hasher < Out = DomainHash > ,
408409 DomainNumber : Encode + Zero ,
409410 DomainHash : Clone + Encode + Default + Copy ,
410- DomainHashing : Hasher < Out = DomainHash > ,
411411{
412412 let storage_key = fraud_proof_runtime_interface:: domain_storage_key (
413413 domain_runtime_code,
414- DomainStorageKeyRequest :: Transfers ,
414+ DomainStorageKeyRequest :: BlockFees ,
415415 )
416416 . ok_or ( VerificationError :: FailedToGetDomainStorageKey ) ?;
417417
418- let transfers = StorageProofVerifier :: < DomainHashing > :: get_decoded_value :: < Transfers < Balance > > (
419- bad_receipt. final_state_root ( ) ,
420- storage_proof. clone ( ) ,
421- StorageKey ( storage_key) ,
422- )
423- . map_err ( |err| {
424- VerificationError :: StorageProof ( storage_proof:: VerificationError :: TransfersStorageProof (
425- err,
426- ) )
427- } ) ?;
418+ let block_fees =
419+ StorageProofVerifier :: < DomainHashing > :: get_decoded_value :: < BlockFees < Balance > > (
420+ bad_receipt. final_state_root ( ) ,
421+ storage_proof. clone ( ) ,
422+ StorageKey ( storage_key) ,
423+ )
424+ . map_err ( |err| {
425+ VerificationError :: StorageProof (
426+ storage_proof:: VerificationError :: BlockFeesStorageProof ( err) ,
427+ )
428+ } ) ?;
428429
429430 // if the rewards matches, then this is an invalid fraud proof since rewards must be different.
430- if bad_receipt. transfers ( ) == & transfers {
431+ if bad_receipt. block_fees ( ) == & block_fees {
431432 return Err ( VerificationError :: InvalidProof ) ;
432433 }
433434
434435 Ok ( ( ) )
435436}
436437
437- /// Verifies invalid block fees fraud proof.
438- pub fn verify_invalid_block_fees_fraud_proof <
438+ /// Verifies invalid transfers fraud proof.
439+ pub fn verify_invalid_transfers_fraud_proof <
439440 CBlock ,
440441 DomainNumber ,
441442 DomainHash ,
@@ -455,30 +456,29 @@ pub fn verify_invalid_block_fees_fraud_proof<
455456where
456457 CBlock : BlockT ,
457458 Balance : PartialEq + Decode + Encode + Zero + Default ,
458- DomainHashing : Hasher < Out = DomainHash > ,
459459 DomainNumber : Encode + Zero ,
460460 DomainHash : Clone + Encode + Default + Copy ,
461+ DomainHashing : Hasher < Out = DomainHash > ,
461462{
462463 let storage_key = fraud_proof_runtime_interface:: domain_storage_key (
463464 domain_runtime_code,
464- DomainStorageKeyRequest :: BlockFees ,
465+ DomainStorageKeyRequest :: Transfers ,
465466 )
466467 . ok_or ( VerificationError :: FailedToGetDomainStorageKey ) ?;
467468
468- let block_fees =
469- StorageProofVerifier :: < DomainHashing > :: get_decoded_value :: < BlockFees < Balance > > (
470- bad_receipt. final_state_root ( ) ,
471- storage_proof. clone ( ) ,
472- StorageKey ( storage_key) ,
473- )
474- . map_err ( |err| {
475- VerificationError :: StorageProof (
476- storage_proof:: VerificationError :: BlockFeesStorageProof ( err) ,
477- )
478- } ) ?;
469+ let transfers = StorageProofVerifier :: < DomainHashing > :: get_decoded_value :: < Transfers < Balance > > (
470+ bad_receipt. final_state_root ( ) ,
471+ storage_proof. clone ( ) ,
472+ StorageKey ( storage_key) ,
473+ )
474+ . map_err ( |err| {
475+ VerificationError :: StorageProof ( storage_proof:: VerificationError :: TransfersStorageProof (
476+ err,
477+ ) )
478+ } ) ?;
479479
480480 // if the rewards matches, then this is an invalid fraud proof since rewards must be different.
481- if bad_receipt. block_fees ( ) == & block_fees {
481+ if bad_receipt. transfers ( ) == & transfers {
482482 return Err ( VerificationError :: InvalidProof ) ;
483483 }
484484
0 commit comments