@@ -572,7 +572,7 @@ pub fn create_clear_tx_with_options(
572572 nonce : request_nonce,
573573 vk_hash : hex:: decode ( "005b97bb81b9ed64f9321049013a56d9633c115b076ae4144f2622d0da13d683" )
574574 . unwrap ( ) ,
575- version : "sp1-v3 .0.0" . to_string ( ) ,
575+ version : "sp1-v5 .0.0" . to_string ( ) ,
576576 mode : proof_mode as i32 ,
577577 strategy : FulfillmentStrategy :: Auction as i32 ,
578578 stdin_uri : "s3://spn-artifacts-production3/stdins/artifact_01jqcgtjr7es883amkx30sqkg9"
@@ -883,7 +883,7 @@ pub fn create_clear_tx_with_public_values_hash(
883883 nonce : request_nonce,
884884 vk_hash : hex:: decode ( "005b97bb81b9ed64f9321049013a56d9633c115b076ae4144f2622d0da13d683" )
885885 . unwrap ( ) ,
886- version : "sp1-v3 .0.0" . to_string ( ) ,
886+ version : "sp1-v5 .0.0" . to_string ( ) ,
887887 mode : proof_mode as i32 ,
888888 strategy : FulfillmentStrategy :: Auction as i32 ,
889889 stdin_uri : "s3://spn-artifacts-production3/stdins/artifact_01jqcgtjr7es883amkx30sqkg9"
@@ -1061,3 +1061,159 @@ pub fn create_clear_tx_with_mismatched_auctioneer(
10611061
10621062 tx
10631063}
1064+
1065+ /// Creates a clear transaction with a specific version string.
1066+ #[ allow( clippy:: too_many_arguments) ]
1067+ pub fn create_clear_tx_with_version (
1068+ requester_signer : & PrivateKeySigner ,
1069+ bidder_signer : & PrivateKeySigner ,
1070+ fulfiller_signer : & PrivateKeySigner ,
1071+ auctioneer_signer : & PrivateKeySigner ,
1072+ executor_signer : & PrivateKeySigner ,
1073+ verifier_signer : & PrivateKeySigner ,
1074+ request_nonce : u64 ,
1075+ bid_amount : U256 ,
1076+ bid_nonce : u64 ,
1077+ settle_nonce : u64 ,
1078+ fulfill_nonce : u64 ,
1079+ execute_nonce : u64 ,
1080+ proof_mode : ProofMode ,
1081+ execution_status : ExecutionStatus ,
1082+ needs_verifier_signature : bool ,
1083+ version : & str ,
1084+ ) -> VAppTransaction {
1085+ use spn_network_types:: HashableWithSender ;
1086+
1087+ // Create request body with custom version.
1088+ let request_body = RequestProofRequestBody {
1089+ nonce : request_nonce,
1090+ vk_hash : hex:: decode ( "005b97bb81b9ed64f9321049013a56d9633c115b076ae4144f2622d0da13d683" )
1091+ . unwrap ( ) ,
1092+ version : version. to_string ( ) ,
1093+ mode : proof_mode as i32 ,
1094+ strategy : FulfillmentStrategy :: Auction as i32 ,
1095+ stdin_uri : "s3://spn-artifacts-production3/stdins/artifact_01jqcgtjr7es883amkx30sqkg9"
1096+ . to_string ( ) ,
1097+ deadline : 1000 ,
1098+ cycle_limit : 1000 ,
1099+ gas_limit : 10000 ,
1100+ min_auction_period : 0 ,
1101+ whitelist : vec ! [ ] ,
1102+ domain : SPN_MAINNET_V1_DOMAIN . to_vec ( ) ,
1103+ auctioneer : auctioneer_signer. address ( ) . to_vec ( ) ,
1104+ executor : executor_signer. address ( ) . to_vec ( ) ,
1105+ verifier : verifier_signer. address ( ) . to_vec ( ) ,
1106+ public_values_hash : None ,
1107+ base_fee : "0" . to_string ( ) ,
1108+ max_price_per_pgu : "100000" . to_string ( ) ,
1109+ variant : TransactionVariant :: RequestVariant as i32 ,
1110+ treasury : signer ( "treasury" ) . address ( ) . to_vec ( ) ,
1111+ } ;
1112+
1113+ // Compute the request ID from the request body and signer.
1114+ let request_id = request_body
1115+ . hash_with_signer ( requester_signer. address ( ) . as_slice ( ) )
1116+ . expect ( "Failed to hash request body" ) ;
1117+
1118+ // Create and sign request.
1119+ let request = RequestProofRequest {
1120+ format : MessageFormat :: Binary as i32 ,
1121+ signature : proto_sign ( requester_signer, & request_body) . as_bytes ( ) . to_vec ( ) ,
1122+ body : Some ( request_body) ,
1123+ } ;
1124+
1125+ // Create bid body with computed request ID.
1126+ let bid_body = BidRequestBody {
1127+ nonce : bid_nonce,
1128+ request_id : request_id. to_vec ( ) ,
1129+ amount : bid_amount. to_string ( ) ,
1130+ domain : SPN_MAINNET_V1_DOMAIN . to_vec ( ) ,
1131+ prover : bidder_signer. address ( ) . to_vec ( ) ,
1132+ variant : TransactionVariant :: BidVariant as i32 ,
1133+ } ;
1134+
1135+ // Create and sign bid.
1136+ let bid = BidRequest {
1137+ format : MessageFormat :: Binary as i32 ,
1138+ signature : proto_sign ( bidder_signer, & bid_body) . as_bytes ( ) . to_vec ( ) ,
1139+ body : Some ( bid_body) ,
1140+ } ;
1141+
1142+ // Create settle body with computed request ID.
1143+ let settle_body = SettleRequestBody {
1144+ nonce : settle_nonce,
1145+ request_id : request_id. to_vec ( ) ,
1146+ winner : bidder_signer. address ( ) . to_vec ( ) ,
1147+ domain : SPN_MAINNET_V1_DOMAIN . to_vec ( ) ,
1148+ variant : TransactionVariant :: SettleVariant as i32 ,
1149+ } ;
1150+
1151+ // Create and sign settle.
1152+ let settle = SettleRequest {
1153+ format : MessageFormat :: Binary as i32 ,
1154+ signature : proto_sign ( auctioneer_signer, & settle_body) . as_bytes ( ) . to_vec ( ) ,
1155+ body : Some ( settle_body) ,
1156+ } ;
1157+
1158+ // Create execute body with computed request ID.
1159+ let execute_body = ExecuteProofRequestBody {
1160+ nonce : execute_nonce,
1161+ request_id : request_id. to_vec ( ) ,
1162+ execution_status : execution_status as i32 ,
1163+ public_values_hash : Some ( [ 0 ; 32 ] . to_vec ( ) ) , // Dummy public values hash
1164+ cycles : Some ( 1000 ) ,
1165+ pgus : Some ( 1000 ) ,
1166+ domain : SPN_MAINNET_V1_DOMAIN . to_vec ( ) ,
1167+ punishment : None ,
1168+ failure_cause : None ,
1169+ variant : TransactionVariant :: ExecuteVariant as i32 ,
1170+ } ;
1171+
1172+ // Create and sign execute.
1173+ let execute = ExecuteProofRequest {
1174+ format : MessageFormat :: Binary as i32 ,
1175+ signature : proto_sign ( executor_signer, & execute_body) . as_bytes ( ) . to_vec ( ) ,
1176+ body : Some ( execute_body) ,
1177+ } ;
1178+
1179+ // Create fulfill body with computed request ID.
1180+ let fulfill_body = FulfillProofRequestBody {
1181+ nonce : fulfill_nonce,
1182+ request_id : request_id. to_vec ( ) ,
1183+ proof : vec ! [ ] ,
1184+ domain : SPN_MAINNET_V1_DOMAIN . to_vec ( ) ,
1185+ variant : TransactionVariant :: FulfillVariant as i32 ,
1186+ reserved_metadata : None ,
1187+ } ;
1188+
1189+ // Create fulfill request.
1190+ let fulfill = FulfillProofRequest {
1191+ format : MessageFormat :: Binary as i32 ,
1192+ signature : proto_sign ( fulfiller_signer, & fulfill_body) . as_bytes ( ) . to_vec ( ) ,
1193+ body : Some ( fulfill_body) ,
1194+ } ;
1195+
1196+ // Add verifier signature if required.
1197+ let verify = if needs_verifier_signature {
1198+ let fulfill_id = fulfill
1199+ . body
1200+ . as_ref ( )
1201+ . unwrap ( )
1202+ . hash_with_signer ( fulfiller_signer. address ( ) . as_slice ( ) )
1203+ . expect ( "Failed to hash fulfill body" ) ;
1204+ use alloy:: signers:: SignerSync ;
1205+ Some ( verifier_signer. sign_message_sync ( & fulfill_id) . unwrap ( ) . as_bytes ( ) . to_vec ( ) )
1206+ } else {
1207+ None
1208+ } ;
1209+
1210+ VAppTransaction :: Clear ( ClearTransaction {
1211+ request,
1212+ bid,
1213+ settle,
1214+ execute,
1215+ fulfill : Some ( fulfill) ,
1216+ verify,
1217+ vk : None ,
1218+ } )
1219+ }
0 commit comments