Merge branch 'main' into zkbesu

# Conflicts:
#	.github/workflows/acceptance-tests.yml
#	.github/workflows/pre-review.yml
#	build.gradle
This commit is contained in:
Fabio Di Fabio
2024-09-06 16:30:57 +02:00
153 changed files with 6623 additions and 3475 deletions

View File

@@ -20,10 +20,13 @@ import java.math.BigInteger;
import java.util.Optional;
/**
* SetCodeAuthorization is a data structure that represents the authorization to set code on a EOA
* account.
* CodeDelegation is a data structure that represents the authorization to delegate code of an EOA
* account to another account.
*/
public interface SetCodeAuthorization {
public interface CodeDelegation {
/** The cost of delegating code on an existing account. */
long PER_AUTH_BASE_COST = 2_500L;
/**
* Return the chain id.
*
@@ -53,11 +56,11 @@ public interface SetCodeAuthorization {
Optional<Address> authorizer();
/**
* Return a valid nonce or empty otherwise. A nonce is valid if the size of the list is exactly 1
* Return the nonce
*
* @return all the optional nonce
* @return the nonce
*/
Optional<Long> nonce();
long nonce();
/**
* Return the recovery id.

View File

@@ -236,16 +236,16 @@ public interface Transaction {
int getSize();
/**
* Returns the set code transaction payload if this transaction is a 7702 transaction.
* Returns the code delegations if this transaction is a 7702 transaction.
*
* @return the set code transaction payloads
* @return the code delegations
*/
Optional<List<SetCodeAuthorization>> getAuthorizationList();
Optional<List<CodeDelegation>> getCodeDelegationList();
/**
* Returns the size of the authorization list.
*
* @return the size of the authorization list
*/
int authorizationListSize();
int codeDelegationListSize();
}

View File

@@ -29,10 +29,10 @@ public enum TransactionType {
/** Blob transaction type. */
BLOB(0x03),
/** Eip7702 transaction type. */
SET_CODE(0x04);
DELEGATE_CODE(0x04);
private static final Set<TransactionType> ACCESS_LIST_SUPPORTED_TRANSACTION_TYPES =
Set.of(ACCESS_LIST, EIP1559, BLOB, SET_CODE);
Set.of(ACCESS_LIST, EIP1559, BLOB, DELEGATE_CODE);
private static final EnumSet<TransactionType> LEGACY_FEE_MARKET_TRANSACTION_TYPES =
EnumSet.of(TransactionType.FRONTIER, TransactionType.ACCESS_LIST);
@@ -86,7 +86,7 @@ public enum TransactionType {
TransactionType.ACCESS_LIST,
TransactionType.EIP1559,
TransactionType.BLOB,
TransactionType.SET_CODE
TransactionType.DELEGATE_CODE
})
.filter(transactionType -> transactionType.typeValue == serializedTypeValue)
.findFirst()
@@ -132,12 +132,21 @@ public enum TransactionType {
return this.equals(BLOB);
}
/**
* Does transaction type support delegate code.
*
* @return the boolean
*/
public boolean supportsDelegateCode() {
return this.equals(DELEGATE_CODE);
}
/**
* Does transaction type require code.
*
* @return the boolean
*/
public boolean requiresSetCode() {
return this.equals(SET_CODE);
public boolean requiresCodeDelegation() {
return this.equals(DELEGATE_CODE);
}
}