@@ -32,6 +32,7 @@ use stacks_common::deps_common::bitcoin::blockdata::transaction::Transaction;
3232use stacks_common:: deps_common:: bitcoin:: network:: serialize:: deserialize as btc_deserialize;
3333use stacks_common:: deps_common:: bitcoin:: util:: hash:: Sha256dHash ;
3434
35+ use crate :: vm:: analysis:: errors:: get_nth_argument;
3536use crate :: vm:: contexts:: { ExecutionState , InvocationContext } ;
3637use crate :: vm:: costs:: cost_functions:: ClarityCostFunction ;
3738use crate :: vm:: costs:: runtime_cost;
@@ -149,7 +150,7 @@ pub fn special_verify_merkle_proof(
149150) -> Result < Value , VmExecutionError > {
150151 check_argument_count ( 5 , args) ?;
151152
152- let leaf_value = eval ( & args [ 0 ] , exec_state, invoke_ctx, context) ?;
153+ let leaf_value = eval ( get_nth_argument ( 0 , args ) ? , exec_state, invoke_ctx, context) ?;
153154 let leaf = match buff_to_array_32 ( leaf_value. as_ref ( ) ) {
154155 Some ( b) => b,
155156 None => {
@@ -161,7 +162,7 @@ pub fn special_verify_merkle_proof(
161162 }
162163 } ;
163164
164- let root_value = eval ( & args [ 1 ] , exec_state, invoke_ctx, context) ?;
165+ let root_value = eval ( get_nth_argument ( 1 , args ) ? , exec_state, invoke_ctx, context) ?;
165166 let root = match buff_to_array_32 ( root_value. as_ref ( ) ) {
166167 Some ( b) => b,
167168 None => {
@@ -173,7 +174,7 @@ pub fn special_verify_merkle_proof(
173174 }
174175 } ;
175176
176- let tx_index_value = eval ( & args [ 2 ] , exec_state, invoke_ctx, context) ?;
177+ let tx_index_value = eval ( get_nth_argument ( 2 , args ) ? , exec_state, invoke_ctx, context) ?;
177178 let tx_index = match tx_index_value. as_ref ( ) {
178179 Value :: UInt ( v) => * v,
179180 _ => {
@@ -185,7 +186,7 @@ pub fn special_verify_merkle_proof(
185186 }
186187 } ;
187188
188- let tx_count_value = eval ( & args [ 3 ] , exec_state, invoke_ctx, context) ?;
189+ let tx_count_value = eval ( get_nth_argument ( 3 , args ) ? , exec_state, invoke_ctx, context) ?;
189190 let tx_count = match tx_count_value. as_ref ( ) {
190191 Value :: UInt ( v) => * v,
191192 _ => {
@@ -197,7 +198,7 @@ pub fn special_verify_merkle_proof(
197198 }
198199 } ;
199200
200- let siblings_value = eval ( & args [ 4 ] , exec_state, invoke_ctx, context) ?;
201+ let siblings_value = eval ( get_nth_argument ( 4 , args ) ? , exec_state, invoke_ctx, context) ?;
201202 let siblings_data = match siblings_value. as_ref ( ) {
202203 Value :: Sequence ( SequenceData :: List ( ListData { data, .. } ) ) => data. clone ( ) ,
203204 _ => {
@@ -252,7 +253,7 @@ pub fn special_get_bitcoin_tx_output(
252253) -> Result < Value , VmExecutionError > {
253254 check_argument_count ( 2 , args) ?;
254255
255- let tx_value = eval ( & args [ 0 ] , exec_state, invoke_ctx, context) ?;
256+ let tx_value = eval ( get_nth_argument ( 0 , args ) ? , exec_state, invoke_ctx, context) ?;
256257 let tx_bytes = match tx_value. as_ref ( ) {
257258 Value :: Sequence ( SequenceData :: Buffer ( BuffData { data } ) ) => data. clone ( ) ,
258259 _ => {
@@ -264,7 +265,7 @@ pub fn special_get_bitcoin_tx_output(
264265 }
265266 } ;
266267
267- let vout_value = eval ( & args [ 1 ] , exec_state, invoke_ctx, context) ?;
268+ let vout_value = eval ( get_nth_argument ( 1 , args ) ? , exec_state, invoke_ctx, context) ?;
268269 let vout = match vout_value. as_ref ( ) {
269270 Value :: UInt ( v) => * v,
270271 _ => {
0 commit comments