Skip to content

Commit

Permalink
vm/evm: remove more auth(call) references
Browse files Browse the repository at this point in the history
  • Loading branch information
jochem-brouwer committed Aug 13, 2024
1 parent 1b064f7 commit a836751
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 19 deletions.
6 changes: 3 additions & 3 deletions packages/evm/src/evm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ export class EVM implements EVMInterface {

protected async _executeCall(message: MessageWithTo): Promise<EVMResult> {
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
Expand Down Expand Up @@ -393,7 +393,7 @@ export class EVM implements EVMInterface {

protected async _executeCreate(message: Message): Promise<EVMResult> {
let gasLimit = message.gasLimit
const fromAddress = message.authcallOrigin ?? message.caller
const fromAddress = message.caller

if (this.common.isActivatedEIP(6800)) {
if (message.depth === 0) {
Expand Down Expand Up @@ -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})`)
}
Expand Down
2 changes: 0 additions & 2 deletions packages/evm/src/exceptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
7 changes: 0 additions & 7 deletions packages/evm/src/message.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ interface MessageOpts {
*/
createdAddresses?: Set<PrefixedHexString>
delegatecall?: boolean
authcallOrigin?: Address
gasRefund?: bigint
blobVersionedHashes?: Uint8Array[]
accessWitness?: AccessWitnessInterface
Expand Down Expand Up @@ -69,11 +68,6 @@ export class Message {
*/
createdAddresses?: Set<PrefixedHexString>
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
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions packages/evm/src/opcodes/EIP2929.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down
2 changes: 0 additions & 2 deletions packages/evm/src/params.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions packages/vm/examples/vmWithEIPs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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()
2 changes: 1 addition & 1 deletion packages/vm/test/api/EIPs/eip-6110.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a836751

Please sign in to comment.