Skip to content

Commit

Permalink
Various cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
acolytec3 committed Apr 3, 2023
1 parent 0f7f191 commit afc9b65
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/client/test/miner/pendingBlock.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
equalsBytes,
getBlobs,
hexStringToBytes,
initKZG,
randomBytes,
} from '@ethereumjs/util'
import { VM } from '@ethereumjs/vm'
Expand Down
4 changes: 2 additions & 2 deletions packages/client/test/net/protocol/snapprotocol.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -468,13 +468,13 @@ tape('[SnapProtocol]', (t) => {
})

t.ok(
JSON.stringify(payload[0]) === JSON.stringify(bigIntToBuffer(reqId)),
JSON.stringify(payload[0]) === JSON.stringify(bigIntToBytes(reqId)),
'correctly encoded reqId'
)
t.ok(JSON.stringify(payload[1]) === JSON.stringify(root), 'correctly encoded root')
t.ok(JSON.stringify(payload[2]) === JSON.stringify(paths), 'correctly encoded paths')
t.ok(
JSON.stringify(payload[3]) === JSON.stringify(bigIntToBuffer(bytes)),
JSON.stringify(payload[3]) === JSON.stringify(bigIntToBytes(bytes)),
'correctly encoded bytes'
)
t.ok(payload)
Expand Down
2 changes: 1 addition & 1 deletion packages/util/src/blobHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const blobsToCommitments = (blobs: Uint8Array[]) => {
return commitments
}

export const blobsToProofs = (blobs: Buffer[]) => {
export const blobsToProofs = (blobs: Uint8Array[]) => {
const proofs = []
for (const blob of blobs) {
proofs.push(Buffer.from(kzg.computeBlobKzgProof(blob)))
Expand Down
5 changes: 5 additions & 0 deletions packages/util/src/kzg.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,10 @@ export let kzg: Kzg = {
*/
export function initKZG(kzgLib: Kzg, trustedSetupPath: string) {
kzg = kzgLib
try {
// Always try to free trusted setup before loading (in case loaded by different module)
kzg.freeTrustedSetup()
// eslint-disable-next-line
} catch {}
kzg.loadTrustedSetup(trustedSetupPath)
}
2 changes: 1 addition & 1 deletion packages/vm/test/tester/runners/GeneralStateTestsRunner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Block } from '@ethereumjs/block'
import { Blockchain } from '@ethereumjs/blockchain'
import { DefaultStateManager } from '@ethereumjs/statemanager'
import { Trie } from '@ethereumjs/trie'
import { bytesToHex, equalsBytes, toBytes } from '@ethereumjs/util'
import { Address, bytesToHex, equalsBytes, toBytes } from '@ethereumjs/util'

import { EVM } from '../../../../evm/src'
import { EEI } from '../../../src'
Expand Down

0 comments on commit afc9b65

Please sign in to comment.