Skip to content

Commit a5e725c

Browse files
ScottyPoiScottyPoi
andauthored
Testdata: Signers (#4167)
* testdata: export signers from testdata * block/tests: use testdata signers in tests * blockchain/tests: use testdata signers in tests * client/tests: use testdata signers in tests * evm/tests: use testdata signers in tests * statemanager/tests: use testdata signers in tests * vm/tests: use testdata signers in tests * testdata: add description to signers.ts * fix typo * lint fix --------- Co-authored-by: ScottyPoi <scott.simpson@ethereum.org>
1 parent e35961c commit a5e725c

31 files changed

+571
-703
lines changed

packages/block/test/clique.spec.ts

Lines changed: 5 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Common, Hardfork } from '@ethereumjs/common'
2-
import { Address, createZeroAddress, hexToBytes } from '@ethereumjs/util'
2+
import { createZeroAddress } from '@ethereumjs/util'
33
import { assert, describe, it } from 'vitest'
44

55
import {
@@ -13,7 +13,7 @@ import {
1313
createSealedCliqueBlockHeader,
1414
} from '../src/index.ts'
1515

16-
import { goerliChainConfig } from '@ethereumjs/testdata'
16+
import { SIGNER_A, goerliChainConfig } from '@ethereumjs/testdata'
1717

1818
describe('[Header]: Clique PoA Functionality', () => {
1919
const common = new Common({ chain: goerliChainConfig, hardfork: Hardfork.Chainstart })
@@ -83,22 +83,8 @@ describe('[Header]: Clique PoA Functionality', () => {
8383
)
8484
})
8585

86-
type Signer = {
87-
address: Address
88-
privateKey: Uint8Array
89-
publicKey: Uint8Array
90-
}
91-
92-
const A: Signer = {
93-
address: new Address(hexToBytes('0x0b90087d864e82a284dca15923f3776de6bb016f')),
94-
privateKey: hexToBytes('0x64bf9cc30328b0e42387b3c82c614e6386259136235e20c1357bd11cdee86993'),
95-
publicKey: hexToBytes(
96-
'0x40b2ebdf4b53206d2d3d3d59e7e2f13b1ea68305aec71d5d24cefe7f24ecae886d241f9267f04702d7f693655eb7b4aa23f30dcd0c3c5f2b970aad7c8a828195',
97-
),
98-
}
99-
10086
it('Signing', () => {
101-
const cliqueSignerKey = A.privateKey
87+
const cliqueSignerKey = SIGNER_A.privateKey
10288

10389
let header = createSealedCliqueBlockHeader(
10490
{ number: 1, extraData: new Uint8Array(97) },
@@ -107,9 +93,9 @@ describe('[Header]: Clique PoA Functionality', () => {
10793
)
10894

10995
assert.strictEqual(header.extraData.length, 97)
110-
assert.isTrue(cliqueVerifySignature(header, [A.address]), 'should verify signature')
96+
assert.isTrue(cliqueVerifySignature(header, [SIGNER_A.address]), 'should verify signature')
11197
assert.isTrue(
112-
cliqueSigner(header).equals(A.address),
98+
cliqueSigner(header).equals(SIGNER_A.address),
11399
'should recover the correct signer address',
114100
)
115101

0 commit comments

Comments
 (0)