@@ -319,21 +319,10 @@ func TestIntegrationEthereumEIP7702Transaction(t *testing.T) {
319319 authR := authSignedBytes [0 :32 ]
320320 authS := authSignedBytes [32 :64 ]
321321 authRecoveryId := ecdsaPrivateKey .GetRecoveryId (authR , authS , authMessage )
322- authYParity := []byte {}
323- if authRecoveryId != 0 {
324- authYParity = []byte {byte (authRecoveryId )}
325- }
326322
327- // Create authorization tuple: [chainId, contractAddress, nonce, yParity, r, s]
328- authorizationTuple := AuthorizationTuple {
329- chainId ,
330- contractAddressForAuthorization ,
331- nonce ,
332- authYParity ,
333- authR ,
334- authS ,
335- }
336- authorizationList := []AuthorizationTuple {authorizationTuple }
323+ // Create authorization: [chainId, address, nonce, yParity, r, s]
324+ authorization := NewAuthorization (chainId , contractAddressForAuthorization , _ethBytesToUint64 (nonce ), uint32 (authRecoveryId ), authR , authS )
325+ authorizationList := []Authorization {authorization }
337326
338327 messageBytes , err := getEIP7702CallData (chainId , nonce , maxPriorityGas , maxGas , gasLimitBytes , contractBytes , value , callDataBytes , accessList , authorizationList , ecdsaPrivateKey )
339328 require .NoError (t , err )
@@ -364,7 +353,7 @@ func TestIntegrationEthereumEIP7702Transaction(t *testing.T) {
364353 require .NoError (t , err )
365354}
366355
367- func getEIP7702CallData (chainId , nonce , maxPriorityGas , maxGas , gasLimitBytes , contractBytes , value , callDataBytes []byte , accessList [][]byte , authorizationList []AuthorizationTuple , ecdsaPrivateKey PrivateKey ) ([]byte , error ) {
356+ func getEIP7702CallData (chainId , nonce , maxPriorityGas , maxGas , gasLimitBytes , contractBytes , value , callDataBytes []byte , accessList [][]byte , authorizationList []Authorization , ecdsaPrivateKey PrivateKey ) ([]byte , error ) {
368357 objectsList := & RLPItem {}
369358 objectsList .AssignList ()
370359 objectsList .PushBack (NewRLPItem (VALUE_TYPE ).AssignValue (chainId ))
@@ -383,15 +372,10 @@ func getEIP7702CallData(chainId, nonce, maxPriorityGas, maxGas, gasLimitBytes, c
383372 }
384373 objectsList .PushBack (accessListItem )
385374
386- // Add authorization list: array of [chainId, contractAddress , nonce, yParity, r, s] tuples
375+ // Add authorization list: array of [chainId, address , nonce, yParity, r, s] tuples
387376 authorizationListItem := NewRLPItem (LIST_TYPE )
388- for _ , authTuple := range authorizationList {
389- // Each authorization entry is a tuple: [chainId, contractAddress, nonce, yParity, r, s]
390- authTupleItem := NewRLPItem (LIST_TYPE )
391- for i := 0 ; i < 6 ; i ++ {
392- authTupleItem .PushBack (NewRLPItem (VALUE_TYPE ).AssignValue (authTuple [i ]))
393- }
394- authorizationListItem .PushBack (authTupleItem )
377+ for _ , auth := range authorizationList {
378+ authorizationListItem .PushBack (auth ._toRLPItem ())
395379 }
396380 objectsList .PushBack (authorizationListItem )
397381
0 commit comments