1818import com .hedera .node .app .service .contract .impl .utils .ConversionUtils ;
1919import com .hedera .pbj .runtime .io .buffer .Bytes ;
2020import edu .umd .cs .findbugs .annotations .NonNull ;
21- import java .math .BigInteger ;
2221import java .util .Set ;
2322import javax .inject .Inject ;
2423import javax .inject .Singleton ;
@@ -47,30 +46,31 @@ public TransactionBody decodeScheduleCall(@NonNull final HssCallAttempt attempt,
4746 // read parameters
4847 final Tuple call ;
4948 final Address to ;
50- final AccountID sender ;
49+ final AccountID payer ;
5150 final boolean waitForExpiry ;
5251 int paramIndex = 0 ;
5352 if (attempt .isSelector (ScheduleCallTranslator .SCHEDULE_CALL )) {
5453 call = ScheduleCallTranslator .SCHEDULE_CALL .decodeCall (attempt .inputBytes ());
5554 to = call .get (paramIndex ++);
56- sender = attempt .addressIdConverter (). convertSender ( attempt . senderAddress () );
55+ payer = attempt .senderId ( );
5756 waitForExpiry = true ;
58- } else if (attempt .isSelector (ScheduleCallTranslator .SCHEDULE_CALL_WITH_SENDER )) {
59- call = ScheduleCallTranslator .SCHEDULE_CALL_WITH_SENDER .decodeCall (attempt .inputBytes ());
57+ } else if (attempt .isSelector (ScheduleCallTranslator .SCHEDULE_CALL_WITH_PAYER )) {
58+ call = ScheduleCallTranslator .SCHEDULE_CALL_WITH_PAYER .decodeCall (attempt .inputBytes ());
6059 to = call .get (paramIndex ++);
61- sender = attempt .addressIdConverter ().convert (call .get (paramIndex ++));
60+ payer = attempt .addressIdConverter ().convert (call .get (paramIndex ++));
6261 waitForExpiry = true ;
63- } else if (attempt .isSelector (ScheduleCallTranslator .EXECUTE_CALL_ON_SENDER_SIGNATURE )) {
64- call = ScheduleCallTranslator .EXECUTE_CALL_ON_SENDER_SIGNATURE .decodeCall (attempt .inputBytes ());
62+ } else if (attempt .isSelector (ScheduleCallTranslator .EXECUTE_CALL_ON_PAYER_SIGNATURE )) {
63+ call = ScheduleCallTranslator .EXECUTE_CALL_ON_PAYER_SIGNATURE .decodeCall (attempt .inputBytes ());
6564 to = call .get (paramIndex ++);
66- sender = attempt .addressIdConverter ().convert (call .get (paramIndex ++));
65+ payer = attempt .addressIdConverter ().convert (call .get (paramIndex ++));
6766 waitForExpiry = false ;
6867 } else {
6968 throw new IllegalStateException ("Unexpected function selector" );
7069 }
71- final BigInteger expirySecond = call .get (paramIndex ++);
72- final BigInteger gasLimit = call .get (paramIndex ++);
73- final BigInteger value = call .get (paramIndex ++);
70+
71+ final long expirySecond = ConversionUtils .asLongLimitedToZeroOrMax (call .get (paramIndex ++));
72+ final long gasLimit = ConversionUtils .asLongLimitedToZeroOrMax (call .get (paramIndex ++));
73+ final long value = ConversionUtils .asLongLimitedToZeroOrMax (call .get (paramIndex ++));
7474 final byte [] callData = call .get (paramIndex );
7575
7676 // convert parameters
@@ -83,7 +83,7 @@ public TransactionBody decodeScheduleCall(@NonNull final HssCallAttempt attempt,
8383 scheduledTransactionBodyFor (contractId , gasLimit , value , callData ),
8484 keys ,
8585 expirySecond ,
86- sender ,
86+ payer ,
8787 waitForExpiry ));
8888 }
8989
@@ -92,9 +92,9 @@ public TransactionBody decodeScheduleCall(@NonNull final HssCallAttempt attempt,
9292 * <br>
9393 * - {@code scheduleCall(address,uint256,uint256,uint64,bytes)}
9494 * <br>
95- * - {@code scheduleCallWithSender (address,address,uint256,uint256,uint64,bytes)}
95+ * - {@code scheduleCallWithPayer (address,address,uint256,uint256,uint64,bytes)}
9696 * <br>
97- * - {@code executeCallOnSenderSignature (address,address,uint256,uint256,uint64,bytes)}
97+ * - {@code executeCallOnPayerSignature (address,address,uint256,uint256,uint64,bytes)}
9898 *
9999 * @param attempt the HSS call attempt
100100 * @param scheduleCreateTrx the 'schedule create' transaction body
@@ -116,34 +116,33 @@ public TransactionBody transactionBodyFor(
116116 * <br>
117117 * - {@code scheduleCall(address,uint256,uint256,uint64,bytes)}
118118 * <br>
119- * - {@code scheduleCallWithSender (address,address,uint256,uint256,uint64,bytes)}
119+ * - {@code scheduleCallWithPayer (address,address,uint256,uint256,uint64,bytes)}
120120 * <br>
121- * - {@code executeCallOnSenderSignature (address,address,uint256,uint256,uint64,bytes)}
121+ * - {@code executeCallOnPayerSignature (address,address,uint256,uint256,uint64,bytes)}
122122 *
123123 * @param scheduleTrx scheduled transaction body for this schedule create
124124 * @param keys the key set for scheduled calls
125125 * @param expirySecond an expiration time of the future call
126- * @param sender an account identifier of a `payer` for the scheduled transaction
126+ * @param payer an account identifier of a `payer` for the scheduled transaction
127127 * @param waitForExpiry a flag to delay execution until expiration
128128 * @return the 'schedule create' transaction body
129129 */
130130 @ VisibleForTesting
131131 public ScheduleCreateTransactionBody scheduleCreateTransactionBodyFor (
132132 @ NonNull final SchedulableTransactionBody scheduleTrx ,
133133 @ NonNull final Set <Key > keys ,
134- @ NonNull final BigInteger expirySecond ,
135- @ NonNull final AccountID sender ,
134+ final long expirySecond ,
135+ @ NonNull final AccountID payer ,
136136 boolean waitForExpiry ) {
137137 requireNonNull (scheduleTrx );
138138 requireNonNull (keys );
139- requireNonNull (expirySecond );
140- requireNonNull (sender );
139+ requireNonNull (payer );
141140 return ScheduleCreateTransactionBody .newBuilder ()
142141 .scheduledTransactionBody (scheduleTrx )
143142 // we need to set adminKey for make schedule not immutable and to be able to delete schedule
144143 .adminKey (keys .stream ().findFirst ().orElse (null ))
145- .expirationTime (Timestamp .newBuilder ().seconds (expirySecond . longValueExact () ))
146- .payerAccountID (sender )
144+ .expirationTime (Timestamp .newBuilder ().seconds (expirySecond ))
145+ .payerAccountID (payer )
147146 .waitForExpiry (waitForExpiry )
148147 .build ();
149148 }
@@ -153,9 +152,9 @@ public ScheduleCreateTransactionBody scheduleCreateTransactionBodyFor(
153152 * <br>
154153 * - {@code scheduleCall(address,uint256,uint256,uint64,bytes)}
155154 * <br>
156- * - {@code scheduleCallWithSender (address,address,uint256,uint256,uint64,bytes)}
155+ * - {@code scheduleCallWithPayer (address,address,uint256,uint256,uint64,bytes)}
157156 * <br>
158- * - {@code executeCallOnSenderSignature (address,address,uint256,uint256,uint64,bytes)}
157+ * - {@code executeCallOnPayerSignature (address,address,uint256,uint256,uint64,bytes)}
159158 *
160159 * @param contractId contract id for the future call
161160 * @param gasLimit a maximum limit to the amount of gas to use for future call
@@ -167,19 +166,14 @@ public ScheduleCreateTransactionBody scheduleCreateTransactionBodyFor(
167166 */
168167 @ VisibleForTesting
169168 public SchedulableTransactionBody scheduledTransactionBodyFor (
170- @ NonNull final ContractID contractId ,
171- @ NonNull final BigInteger gasLimit ,
172- @ NonNull final BigInteger value ,
173- @ NonNull byte [] callData ) {
169+ @ NonNull final ContractID contractId , final long gasLimit , final long value , @ NonNull byte [] callData ) {
174170 requireNonNull (contractId );
175- requireNonNull (gasLimit );
176- requireNonNull (value );
177171 requireNonNull (callData );
178172 return SchedulableTransactionBody .newBuilder ()
179173 .contractCall (ContractCallTransactionBody .newBuilder ()
180174 .contractID (contractId )
181- .gas (gasLimit . longValueExact () )
182- .amount (value . longValueExact () )
175+ .gas (gasLimit )
176+ .amount (value )
183177 .functionParameters (Bytes .wrap (callData )))
184178 .build ();
185179 }
0 commit comments