Skip to content

Commit 099a4a0

Browse files
committed
lint
1 parent a6c38a2 commit 099a4a0

File tree

5 files changed

+24
-33
lines changed

5 files changed

+24
-33
lines changed

packages/statemanager/src/statelessVerkleStateManager.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -332,7 +332,7 @@ export class StatelessVerkleStateManager implements EVMStateManagerInterface {
332332

333333
async getTreeKeyForCodeChunk(address: Address, chunkId: number) {
334334
const { treeIndex, subIndex } = getTreeIndicesForCodeChunk(chunkId)
335-
return getKey(await getStem(this.verkleCrypto, address, treeIndex), toBytes(subIndex))
335+
return getKey(getStem(this.verkleCrypto, address, treeIndex), toBytes(subIndex))
336336
}
337337

338338
chunkifyCode(code: Uint8Array) {
@@ -348,7 +348,7 @@ export class StatelessVerkleStateManager implements EVMStateManagerInterface {
348348
async getTreeKeyForStorageSlot(address: Address, storageKey: bigint) {
349349
const { treeIndex, subIndex } = getTreeIndexesForStorageSlot(storageKey)
350350

351-
return getKey(await getStem(this.verkleCrypto, address, treeIndex), toBytes(subIndex))
351+
return getKey(getStem(this.verkleCrypto, address, treeIndex), toBytes(subIndex))
352352
}
353353

354354
async checkChunkWitnessPresent(address: Address, codeOffset: number) {
@@ -419,7 +419,7 @@ export class StatelessVerkleStateManager implements EVMStateManagerInterface {
419419
}
420420

421421
// Get the contract code size
422-
const codeSizeKey = this.getTreeKeyForCodeSize(await getStem(this.verkleCrypto, address, 0))
422+
const codeSizeKey = this.getTreeKeyForCodeSize(getStem(this.verkleCrypto, address, 0))
423423
const codeSizeLE = hexToBytes(this._state[bytesToHex(codeSizeKey)] ?? '0x')
424424
const codeSize = bytesToInt32(codeSizeLE, true)
425425
// allocate the code and copy onto it from the available witness chunks
@@ -531,7 +531,7 @@ export class StatelessVerkleStateManager implements EVMStateManagerInterface {
531531
* @param address - Address to clear the storage of
532532
*/
533533
async clearContractStorage(address: Address): Promise<void> {
534-
const stem = await getStem(this.verkleCrypto, address, 0)
534+
const stem = getStem(this.verkleCrypto, address, 0)
535535
const codeHashKey = this.getTreeKeyForCodeHash(stem)
536536
this._storageCache?.clearContractStorage(address)
537537
// Update codeHash to `c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470`
@@ -550,7 +550,7 @@ export class StatelessVerkleStateManager implements EVMStateManagerInterface {
550550
}
551551
}
552552

553-
const stem = await getStem(this.verkleCrypto, address, 0)
553+
const stem = getStem(this.verkleCrypto, address, 0)
554554
const versionKey = this.getTreeKeyForVersion(stem)
555555
const balanceKey = this.getTreeKeyForBalance(stem)
556556
const nonceKey = this.getTreeKeyForNonce(stem)
@@ -637,7 +637,7 @@ export class StatelessVerkleStateManager implements EVMStateManagerInterface {
637637
}
638638

639639
if (this._accountCacheSettings.deactivate) {
640-
const stem = await getStem(this.verkleCrypto, address, 0)
640+
const stem = getStem(this.verkleCrypto, address, 0)
641641
const balanceKey = this.getTreeKeyForBalance(stem)
642642
const nonceKey = this.getTreeKeyForNonce(stem)
643643
const codeHashKey = this.getTreeKeyForCodeHash(stem)

packages/statemanager/test/statelessVerkleStateManager.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ describe('StatelessVerkleStateManager: Kaustinen Verkle Block', () => {
106106
stateManager.initVerkleExecutionWitness(block.header.number, block.executionWitness)
107107

108108
const address = Address.fromString('0x9791ded6e5d3d5dafca71bb7bb2a14187d17e32e')
109-
const stem = await getStem(stateManager.verkleCrypto, address, 0)
109+
const stem = getStem(stateManager.verkleCrypto, address, 0)
110110

111111
const balanceKey = stateManager.getTreeKeyForBalance(stem)
112112
const nonceKey = stateManager.getTreeKeyForNonce(stem)

packages/verkle/test/crypto.spec.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,20 +12,16 @@ describe('Verkle cryptographic helpers', () => {
1212
verkle = await loadVerkleCrypto()
1313
})
1414

15-
it('getStem(): returns the expected stems', async () => {
15+
it('getStem(): returns the expected stems', () => {
1616
// Empty address
1717
assert.equal(
18-
bytesToHex(
19-
await getStem(verkle, Address.fromString('0x0000000000000000000000000000000000000000'))
20-
),
18+
bytesToHex(getStem(verkle, Address.fromString('0x0000000000000000000000000000000000000000'))),
2119
'0xbf101a6e1c8e83c11bd203a582c7981b91097ec55cbd344ce09005c1f26d19'
2220
)
2321

2422
// Non-empty address
2523
assert.equal(
26-
bytesToHex(
27-
await getStem(verkle, Address.fromString('0x71562b71999873DB5b286dF957af199Ec94617f7'))
28-
),
24+
bytesToHex(getStem(verkle, Address.fromString('0x71562b71999873DB5b286dF957af199Ec94617f7'))),
2925
'0x274cde18dd9dbb04caf16ad5ee969c19fe6ca764d5688b5e1d419f4ac6cd16'
3026
)
3127
})

packages/vm/src/runBlock.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -456,9 +456,8 @@ export async function accumulateParentBlockHash(
456456
async function putBlockHash(vm: VM, hash: Uint8Array, number: bigint) {
457457
// generate access witness
458458
if (vm.common.isActivatedEIP(6800) === true) {
459-
const { treeIndex, subIndex } = getTreeIndexesForStorageSlot(number)
460-
// just create access witnesses without charging for the gas
461-
await (
459+
const { treeIndex, subIndex } = getTreeIndexesForStorageSlot(number)(
460+
// just create access witnesses without charging for the gas
462461
vm.stateManager as StatelessVerkleStateManager
463462
).accessWitness!.touchAddressOnWriteAndComputeGas(historyAddress, treeIndex, subIndex)
464463
}
@@ -681,7 +680,7 @@ export async function rewardAccount(
681680
let account = await evm.stateManager.getAccount(address)
682681
if (account === undefined) {
683682
if (common?.isActivatedEIP(6800) === true) {
684-
await (
683+
;(
685684
evm.stateManager as StatelessVerkleStateManager
686685
).accessWitness!.touchAndChargeProofOfAbsence(address)
687686
}
@@ -692,9 +691,10 @@ export async function rewardAccount(
692691

693692
if (common?.isActivatedEIP(6800) === true) {
694693
// use this utility to build access but the computed gas is not charged and hence free
695-
await (
696-
evm.stateManager as StatelessVerkleStateManager
697-
).accessWitness!.touchTxExistingAndComputeGas(address, { sendsValue: true })
694+
;(evm.stateManager as StatelessVerkleStateManager).accessWitness!.touchTxExistingAndComputeGas(
695+
address,
696+
{ sendsValue: true }
697+
)
698698
}
699699
return account
700700
}

packages/vm/src/runTx.ts

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -327,14 +327,14 @@ async function _runTx(this: VM, opts: RunTxOpts): Promise<RunTxResult> {
327327

328328
let upfrontAwGas = BIGINT_0
329329
if (this.common.isActivatedEIP(6800)) {
330-
upfrontAwGas += await txAccesses!.touchTxOriginAndComputeGas(caller)
330+
upfrontAwGas += txAccesses!.touchTxOriginAndComputeGas(caller)
331331
const sendsValue = tx.value !== BIGINT_0
332332
if (tx.to !== undefined) {
333-
upfrontAwGas += await txAccesses!.touchTxExistingAndComputeGas(tx.to, { sendsValue })
333+
upfrontAwGas += txAccesses!.touchTxExistingAndComputeGas(tx.to, { sendsValue })
334334
debug(`Sender upfront awGas requirement for non contract creation tx is ${upfrontAwGas}`)
335335
} else {
336336
const contractTo = new Address(generateAddress(caller.bytes, bigIntToBytes(nonce)))
337-
upfrontAwGas += await txAccesses!.touchAndChargeContractCreateInit(contractTo, { sendsValue })
337+
upfrontAwGas += txAccesses!.touchAndChargeContractCreateInit(contractTo, { sendsValue })
338338
debug(
339339
`Sender upfront awGas requirement is contract creation at=${short(
340340
contractTo.bytes
@@ -600,9 +600,7 @@ async function _runTx(this: VM, opts: RunTxOpts): Promise<RunTxResult> {
600600
let minerAccount = await state.getAccount(miner)
601601
if (minerAccount === undefined) {
602602
if (this.common.isActivatedEIP(6800)) {
603-
await (state as StatelessVerkleStateManager).accessWitness!.touchAndChargeProofOfAbsence(
604-
miner
605-
)
603+
;(state as StatelessVerkleStateManager).accessWitness!.touchAndChargeProofOfAbsence(miner)
606604
}
607605
minerAccount = new Account()
608606
}
@@ -615,12 +613,9 @@ async function _runTx(this: VM, opts: RunTxOpts): Promise<RunTxResult> {
615613

616614
if (this.common.isActivatedEIP(6800)) {
617615
// use this utility to build access but the computed gas is not charged and hence free
618-
await (state as StatelessVerkleStateManager).accessWitness!.touchTxExistingAndComputeGas(
619-
miner,
620-
{
621-
sendsValue: true,
622-
}
623-
)
616+
;(state as StatelessVerkleStateManager).accessWitness!.touchTxExistingAndComputeGas(miner, {
617+
sendsValue: true,
618+
})
624619
}
625620

626621
// Put the miner account into the state. If the balance of the miner account remains zero, note that

0 commit comments

Comments
 (0)