From a836751875550e62d13db045aaa779c8a1f266cc Mon Sep 17 00:00:00 2001 From: Jochem Brouwer Date: Tue, 13 Aug 2024 19:44:42 +0200 Subject: [PATCH] vm/evm: remove more auth(call) references --- packages/evm/src/evm.ts | 6 +++--- packages/evm/src/exceptions.ts | 2 -- packages/evm/src/message.ts | 7 ------- packages/evm/src/opcodes/EIP2929.ts | 4 ++-- packages/evm/src/params.ts | 2 -- packages/vm/examples/vmWithEIPs.ts | 4 ++-- packages/vm/test/api/EIPs/eip-6110.spec.ts | 2 +- 7 files changed, 8 insertions(+), 19 deletions(-) diff --git a/packages/evm/src/evm.ts b/packages/evm/src/evm.ts index 936a287512..ec96b35180 100644 --- a/packages/evm/src/evm.ts +++ b/packages/evm/src/evm.ts @@ -247,7 +247,7 @@ export class EVM implements EVMInterface { protected async _executeCall(message: MessageWithTo): Promise { let gasLimit = message.gasLimit - const fromAddress = message.authcallOrigin ?? message.caller + const fromAddress = message.caller if (this.common.isActivatedEIP(6800)) { const sendsValue = message.value !== BIGINT_0 @@ -393,7 +393,7 @@ export class EVM implements EVMInterface { protected async _executeCreate(message: Message): Promise { let gasLimit = message.gasLimit - const fromAddress = message.authcallOrigin ?? message.caller + const fromAddress = message.caller if (this.common.isActivatedEIP(6800)) { if (message.depth === 0) { @@ -1038,7 +1038,7 @@ export class EVM implements EVMInterface { if (account.balance < BIGINT_0) { throw new EvmError(ERROR.INSUFFICIENT_BALANCE) } - const result = this.journal.putAccount(message.authcallOrigin ?? message.caller, account) + const result = this.journal.putAccount(message.caller, account) if (this.DEBUG) { debug(`Reduced sender (${message.caller}) balance (-> ${account.balance})`) } diff --git a/packages/evm/src/exceptions.ts b/packages/evm/src/exceptions.ts index abc2ab269b..9063f818ed 100644 --- a/packages/evm/src/exceptions.ts +++ b/packages/evm/src/exceptions.ts @@ -23,8 +23,6 @@ export enum ERROR { INVALID_INPUT_LENGTH = 'invalid input length', INVALID_EOF_FORMAT = 'invalid EOF format', - AUTHCALL_UNSET = 'attempting to AUTHCALL without AUTH set', - // BLS errors BLS_12_381_INVALID_INPUT_LENGTH = 'invalid input length', BLS_12_381_POINT_NOT_ON_CURVE = 'point not on curve', diff --git a/packages/evm/src/message.ts b/packages/evm/src/message.ts index ccc758f2d1..c22d74ce3f 100644 --- a/packages/evm/src/message.ts +++ b/packages/evm/src/message.ts @@ -38,7 +38,6 @@ interface MessageOpts { */ createdAddresses?: Set delegatecall?: boolean - authcallOrigin?: Address gasRefund?: bigint blobVersionedHashes?: Uint8Array[] accessWitness?: AccessWitnessInterface @@ -69,11 +68,6 @@ export class Message { */ createdAddresses?: Set delegatecall: boolean - /** - * This is used to store the origin of the AUTHCALL, - * the purpose is to figure out where `value` should be taken from (not from `caller`) - */ - authcallOrigin?: Address gasRefund: bigint // Keeps track of the gasRefund at the start of the frame (used for journaling purposes) /** * List of versioned hashes if message is a blob transaction in the outer VM @@ -97,7 +91,6 @@ export class Message { this.selfdestruct = opts.selfdestruct this.createdAddresses = opts.createdAddresses this.delegatecall = opts.delegatecall ?? defaults.delegatecall - this.authcallOrigin = opts.authcallOrigin this.gasRefund = opts.gasRefund ?? defaults.gasRefund this.blobVersionedHashes = opts.blobVersionedHashes this.accessWitness = opts.accessWitness diff --git a/packages/evm/src/opcodes/EIP2929.ts b/packages/evm/src/opcodes/EIP2929.ts index a82c17e700..a273d96baa 100644 --- a/packages/evm/src/opcodes/EIP2929.ts +++ b/packages/evm/src/opcodes/EIP2929.ts @@ -18,7 +18,7 @@ export function accessAddressEIP2929( address: Uint8Array, common: Common, chargeGas = true, - isSelfdestructOrAuthcall = false, + isSelfdestruct = false, ): bigint { if (!common.isActivatedEIP(2929)) return BIGINT_0 @@ -33,7 +33,7 @@ export function accessAddressEIP2929( return common.param('coldaccountaccessGas') } // Warm: (selfdestruct beneficiary address reads are not charged when warm) - } else if (chargeGas && !isSelfdestructOrAuthcall) { + } else if (chargeGas && !isSelfdestruct) { return common.param('warmstoragereadGas') } return BIGINT_0 diff --git a/packages/evm/src/params.ts b/packages/evm/src/params.ts index 22507da33b..fc30de4968 100644 --- a/packages/evm/src/params.ts +++ b/packages/evm/src/params.ts @@ -97,8 +97,6 @@ export const paramsEVM: ParamsDict = { invalidGas: 0, // Base fee of the INVALID opcode selfdestructGas: 0, // Base fee of the SELFDESTRUCT opcode prevrandaoGas: 0, // TODO: these below 0-gas additons might also point to non-clean implementations in the code base - authGas: 0, // ...allowing access to non-existing gas parameters. Might be worth to fix at some point. - authcallGas: 0, // evm stackLimit: 1024, // Maximum size of VM stack allowed callCreateDepth: 1024, // Maximum depth of call/create stack diff --git a/packages/vm/examples/vmWithEIPs.ts b/packages/vm/examples/vmWithEIPs.ts index 690ae60e5e..73e976161b 100644 --- a/packages/vm/examples/vmWithEIPs.ts +++ b/packages/vm/examples/vmWithEIPs.ts @@ -2,8 +2,8 @@ import { Common, Mainnet } from '@ethereumjs/common' import { VM } from '@ethereumjs/vm' const main = async () => { - const common = new Common({ chain: Mainnet, eips: [3074] }) + const common = new Common({ chain: Mainnet, eips: [7702] }) const vm = await VM.create({ common }) - console.log(`EIP 3074 is active in the VM - ${vm.common.isActivatedEIP(3074)}`) + console.log(`EIP 7702 is active in the VM - ${vm.common.isActivatedEIP(7702)}`) } void main() diff --git a/packages/vm/test/api/EIPs/eip-6110.spec.ts b/packages/vm/test/api/EIPs/eip-6110.spec.ts index 276d6d47b0..3dd7d0142a 100644 --- a/packages/vm/test/api/EIPs/eip-6110.spec.ts +++ b/packages/vm/test/api/EIPs/eip-6110.spec.ts @@ -28,7 +28,7 @@ const common = new Common({ // Remove 7002 so won't trigger error common['_activatedEIPsCache'] = [ 2565, 2929, 2718, 2930, 1559, 3198, 3529, 3541, 4345, 5133, 3675, 4399, 3651, 3855, 3860, 4895, - 1153, 4844, 4788, 5656, 6780, 7516, 2537, 3074, 6110, 7685, + 1153, 4844, 4788, 5656, 6780, 7516, 2537, 6110, 7685, ] const DEPOSIT_CONTRACT_ADDRESS = getPresetChainConfig('mainnet') .depositContractAddress! as PrefixedHexString