rename methods and variables, clarify comments (#8155)

Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
This commit is contained in:
daniellehrner
2025-01-23 07:08:03 +01:00
committed by GitHub
parent a1e087d5b5
commit 7840e8b4fb
9 changed files with 26 additions and 26 deletions

View File

@@ -70,7 +70,7 @@ abstract class AbstractCodeDelegationAccount implements Account {
}
@Override
public boolean hasCodeDelegation() {
public boolean hasDelegatedCode() {
return true;
}

View File

@@ -66,7 +66,7 @@ public interface Account extends AccountState {
*
* @return true if the account has delegated code otherwise false.
*/
default boolean hasCodeDelegation() {
default boolean hasDelegatedCode() {
return false;
}
}

View File

@@ -78,7 +78,7 @@ public interface AccountState {
/**
* The optional EVM bytecode if the account has set a 7702 code delegation.
*
* @return the code of the target account (which may be empty).
* @return the code of the target account that this account delegates to (which may be empty).
*/
default Optional<Bytes> getCodeDelegationTargetCode() {
return Optional.empty();

View File

@@ -191,7 +191,7 @@ public abstract class AbstractCallOperation extends AbstractOperation {
final Account contract = frame.getWorldUpdater().get(to);
if (contract != null && contract.hasCodeDelegation()) {
if (contract != null && contract.hasDelegatedCode()) {
if (contract.getCodeDelegationTargetCode().isEmpty()) {
throw new RuntimeException("A delegated code account must have delegated code");
}
@@ -357,7 +357,7 @@ public abstract class AbstractCallOperation extends AbstractOperation {
return CodeV0.EMPTY_CODE;
}
if (account.hasCodeDelegation()) {
if (account.hasDelegatedCode()) {
return evm.getCode(
account.getCodeDelegationTargetHash().get(), account.getCodeDelegationTargetCode().get());
}

View File

@@ -125,7 +125,7 @@ public abstract class AbstractExtCallOperation extends AbstractCallOperation {
Address to = Words.toAddress(toBytes);
final Account contract = frame.getWorldUpdater().get(to);
if (contract != null && contract.hasCodeDelegation()) {
if (contract != null && contract.hasDelegatedCode()) {
if (contract.getCodeDelegationTargetCode().isEmpty()) {
throw new RuntimeException("A delegated code account must have delegated code");
}

View File

@@ -55,7 +55,7 @@ abstract class AbstractExtCodeOperation extends AbstractOperation {
return Bytes.EMPTY;
}
return account.hasCodeDelegation()
return account.hasDelegatedCode()
? CodeDelegationHelper.getCodeDelegationForRead()
: account.getCode();
}
@@ -68,7 +68,7 @@ abstract class AbstractExtCodeOperation extends AbstractOperation {
* @return the code hash or the hash of the special 7702 designator
*/
protected Hash getCodeHash(final Account account) {
if (account.hasCodeDelegation()) {
if (account.hasDelegatedCode()) {
return Hash.hash(CodeDelegationHelper.getCodeDelegationForRead());
}

View File

@@ -43,7 +43,7 @@ public class CodeDelegationGasCostHelper {
*/
public static long codeDelegationGasCost(
final MessageFrame frame, final GasCalculator gasCalculator, final Account account) {
if (!account.hasCodeDelegation()) {
if (!account.hasDelegatedCode()) {
return 0;
}