Skip to content

Commit

Permalink
tests: update anvil fork block number
Browse files Browse the repository at this point in the history
  • Loading branch information
jxom committed May 6, 2024
1 parent fbc9af9 commit 242ff09
Show file tree
Hide file tree
Showing 37 changed files with 1,897 additions and 1,224 deletions.
2 changes: 1 addition & 1 deletion src/accounts/utils/signTransaction.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ describe('eip4844', async () => {
expect(signature).toMatchSnapshot()
})

test.skip('w/ prepareTransactionRequest', async () => {
test('w/ prepareTransactionRequest', async () => {
const blobs = toBlobs({ data: stringToHex(blobData) })
const request = await prepareTransactionRequest(client, {
account: privateKeyToAccount(accounts[0].privateKey),
Expand Down
8 changes: 4 additions & 4 deletions src/actions/public/call.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const mintWithParams4bytes = '0xa0712d68'
const fourTwenty =
'00000000000000000000000000000000000000000000000000000000000001a4'
const sixHundred =
'0000000000000000000000000000000000000000000000000000000000000258'
'0000000000000000000000000000000000000000000000000000000000aaaaaa'

const sourceAccount = accounts[0]

Expand Down Expand Up @@ -106,13 +106,13 @@ describe('ccip', () => {
to: contractAddress!,
}),
).rejects.toMatchInlineSnapshot(`
[CallExecutionError: Execution reverted with reason: custom error 556f1830:000000000000000000000000124ddf9b…00000000000000000000000000000000 (576 bytes).
[CallExecutionError: Execution reverted with reason: custom error 556f1830:000000000000000000000000cc5bc84c…00000000000000000000000000000000 (576 bytes).
Raw Call Arguments:
to: 0x124ddf9bdd2ddad012ef1d5bbd77c00f05c610da
to: 0xcc5bc84c3fdbcf262aadd9f76652d6784293dd9e
data: 0xbf40fac1000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000096a786f6d2e7669656d0000000000000000000000000000000000000000000000
Details: execution reverted: custom error 556f1830:000000000000000000000000124ddf9b…00000000000000000000000000000000 (576 bytes)
Details: execution reverted: custom error 556f1830:000000000000000000000000cc5bc84c…00000000000000000000000000000000 (576 bytes)
Version: viem@1.0.2]
`)

Expand Down
4 changes: 2 additions & 2 deletions src/actions/public/estimateContractGas.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ describe('wagmi', () => {
...wagmiContractConfig,
account: '0xa5cc3c03994DB5b0d9A5eEdD10CabaB0813678AC',
functionName: 'mint',
args: [69420n],
args: [13371337n],
}),
).toBeDefined()
expect(
Expand Down Expand Up @@ -206,7 +206,7 @@ describe('local account', () => {
...wagmiContractConfig,
account: privateKeyToAccount(accounts[0].privateKey),
functionName: 'mint',
args: [69420n],
args: [13371337n],
}),
).toBeDefined()
})
Expand Down
4 changes: 2 additions & 2 deletions src/actions/public/estimateGas.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ test('args: gas', async () => {
).toMatchInlineSnapshot('21000n')
})

test.skip('args: blobs', async () => {
test('args: blobs', async () => {
expect(
await estimateGas(client, {
account: accounts[0].address,
Expand All @@ -134,7 +134,7 @@ test.skip('args: blobs', async () => {
to: accounts[1].address,
maxFeePerBlobGas: parseGwei('20'),
}),
).toMatchInlineSnapshot('21000n')
).toMatchInlineSnapshot('53001n')
})

describe('local account', () => {
Expand Down
5 changes: 2 additions & 3 deletions src/actions/public/getBlobBaseFee.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,7 @@ import { getBlobBaseFee } from './getBlobBaseFee.js'

const client = anvilMainnet.getClient()

// TODO: Don't skip once implemented on nodes.
test.skip('default', async () => {
test('default', async () => {
const baseFee = await getBlobBaseFee(client)
expect(baseFee).toMatchInlineSnapshot()
expect(baseFee).toMatchInlineSnapshot('1n')
})
790 changes: 502 additions & 288 deletions src/actions/public/getBlock.test.ts

Large diffs are not rendered by default.

92 changes: 46 additions & 46 deletions src/actions/public/getFeeHistory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,39 +16,39 @@ test('default', async () => {
).toMatchInlineSnapshot(`
{
"baseFeePerGas": [
13539253648n,
13242020772n,
13091396207n,
12779459001n,
13197182029n,
5213557505n,
4699268689n,
5240957424n,
5087991129n,
5092610982n,
],
"gasUsedRatio": [
0.4121863333333333,
0.45450103333333336,
0.4046894,
0.6307482666666666,
0.10542196666666669,
0.9610834333333332,
0.38325316666666664,
0.5036319666666667,
],
"oldestBlock": 16280767n,
"oldestBlock": 19808247n,
"reward": [
[
120746352n,
1500000000n,
36460746352n,
1000000000n,
2000000000n,
39786442495n,
],
[
0n,
1500000000n,
61757979228n,
369076887n,
118577352971n,
],
[
92613505n,
1500000000n,
20336529954n,
0n,
41648601n,
6972600081n,
],
[
0n,
1500000000n,
20228167552n,
162008871n,
7900000000n,
],
],
}
Expand All @@ -75,25 +75,25 @@ test('args: blockCount', async () => {
).toMatchInlineSnapshot(`
{
"baseFeePerGas": [
13091396207n,
12779459001n,
13197182029n,
5240957424n,
5087991129n,
5092610982n,
],
"gasUsedRatio": [
0.4046894,
0.6307482666666666,
0.38325316666666664,
0.5036319666666667,
],
"oldestBlock": 16280769n,
"oldestBlock": 19808249n,
"reward": [
[
92613505n,
1500000000n,
20336529954n,
0n,
41648601n,
6972600081n,
],
[
0n,
1500000000n,
20228167552n,
162008871n,
7900000000n,
],
],
}
Expand All @@ -110,29 +110,29 @@ test('args: rewardPercentiles', async () => {
).toMatchInlineSnapshot(`
{
"baseFeePerGas": [
13091396207n,
12779459001n,
13197182029n,
5240957424n,
5087991129n,
5092610982n,
],
"gasUsedRatio": [
0.4046894,
0.6307482666666666,
0.38325316666666664,
0.5036319666666667,
],
"oldestBlock": 16280769n,
"oldestBlock": 19808249n,
"reward": [
[
92613505n,
1500000000n,
1500000000n,
2000000000n,
20336529954n,
0n,
10000000n,
41648601n,
500000000n,
6972600081n,
],
[
0n,
759000000n,
1500000000n,
1500000000n,
20228167552n,
90000000n,
162008871n,
500000000n,
7900000000n,
],
],
}
Expand Down
44 changes: 22 additions & 22 deletions src/actions/public/getFilterChanges.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ describe('contract events', () => {
'Transfer'
>[]
>(logs)
expect(logs.length).toBe(1056)
expect(logs.length).toBe(881)
})

test('args: strict', async () => {
Expand All @@ -353,7 +353,7 @@ describe('contract events', () => {
'Transfer'
>[]
>(logs)
expect(logs.length).toBe(783)
expect(logs.length).toBe(698)
})

test('args: singular `from`', async () => {
Expand Down Expand Up @@ -831,11 +831,11 @@ describe('events', () => {

let logs = await getFilterChanges(client, { filter })
assertType<Log<bigint, number, boolean, typeof event.default>[]>(logs)
expect(logs.length).toBe(1056)
expect(logs.length).toBe(881)
expect(logs[0].args).toEqual({
from: '0x00000000003b3cc22aF3aE1EAc0440BcEe416B40',
to: '0x393ADf60012809316659Af13A3117ec22D093a38',
value: 1162592016924672n,
from: '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
to: '0x3785ca1128D2EfdDFec1a87ddb5686B59C7138F8',
value: 100000000000000000n,
})
expect(logs[0].eventName).toEqual('Transfer')

Expand All @@ -855,17 +855,17 @@ describe('events', () => {

assertType<Log<bigint, number, boolean, typeof event.default, true>[]>(logs)

expect(logs.length).toBe(783)
expect(logs.length).toBe(698)

expectTypeOf(logs[0].args).toEqualTypeOf<{
from: Address
to: Address
value: bigint
}>()
expect(logs[0].args).toEqual({
from: '0x00000000003b3cc22aF3aE1EAc0440BcEe416B40',
to: '0x393ADf60012809316659Af13A3117ec22D093a38',
value: 1162592016924672n,
from: '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
to: '0x3785ca1128D2EfdDFec1a87ddb5686B59C7138F8',
value: 100000000000000000n,
})
expectTypeOf(logs[0].eventName).toEqualTypeOf<'Transfer'>()
expect(logs[0].eventName).toEqual('Transfer')
Expand All @@ -887,17 +887,17 @@ describe('events', () => {
logs,
)

expect(logs.length).toBe(1056)
expect(logs.length).toBe(881)

expectTypeOf(logs[0].args).toEqualTypeOf<{
from?: Address
to?: Address
value?: bigint
}>()
expect(logs[0].args).toEqual({
from: '0x00000000003b3cc22aF3aE1EAc0440BcEe416B40',
to: '0x393ADf60012809316659Af13A3117ec22D093a38',
value: 1162592016924672n,
from: '0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
to: '0x3785ca1128D2EfdDFec1a87ddb5686B59C7138F8',
value: 100000000000000000n,
})
expectTypeOf(logs[0].eventName).toEqualTypeOf<'Transfer'>()
expect(logs[0].eventName).toEqual('Transfer')
Expand All @@ -917,15 +917,15 @@ describe('events', () => {
let logs = await getFilterChanges(client, { filter })
assertType<Log<bigint, number, boolean, typeof event.unnamed, true>[]>(logs)

expect(logs.length).toBe(783)
expect(logs.length).toBe(698)

expectTypeOf(logs[0].args).toEqualTypeOf<
readonly [`0x${string}`, `0x${string}`, bigint]
>()
expect(logs[0].args).toEqual([
'0x00000000003b3cc22aF3aE1EAc0440BcEe416B40',
'0x393ADf60012809316659Af13A3117ec22D093a38',
1162592016924672n,
'0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
'0x3785ca1128D2EfdDFec1a87ddb5686B59C7138F8',
100000000000000000n,
])
expectTypeOf(logs[0].eventName).toEqualTypeOf<'Transfer'>()
expect(logs[0].eventName).toEqual('Transfer')
Expand All @@ -946,7 +946,7 @@ describe('events', () => {
logs,
)

expect(logs.length).toBe(1056)
expect(logs.length).toBe(881)

expectTypeOf(logs[0].args).toEqualTypeOf<
| readonly []
Expand All @@ -955,9 +955,9 @@ describe('events', () => {
| readonly [`0x${string}`]
>()
expect(logs[0].args).toEqual([
'0x00000000003b3cc22aF3aE1EAc0440BcEe416B40',
'0x393ADf60012809316659Af13A3117ec22D093a38',
1162592016924672n,
'0x7a250d5630B4cF539739dF2C5dAcb4c659F2488D',
'0x3785ca1128D2EfdDFec1a87ddb5686B59C7138F8',
100000000000000000n,
])

expectTypeOf(logs[0].eventName).toEqualTypeOf<'Transfer'>()
Expand Down

0 comments on commit 242ff09

Please sign in to comment.