Skip to content

Commit

Permalink
Change chains for unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
chrstph-dvx committed Aug 29, 2024
1 parent a326949 commit ef6ab80
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions src/decorators/publicActionsParentChain.unit.test.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,25 @@
import { it, expect, describe } from 'vitest';

import { createPublicClient, http, padHex, zeroAddress } from 'viem';
import { mainnet } from '../chains';
import { sepolia } from '../chains';
import { publicActionsParentChain } from './publicActionsParentChain';
import { arbitrum } from 'viem/chains';

const arbOneSequencerInbox = '0x1c479675ad559DC151F6Ec7ed3FbF8ceE79582B6';

const client = createPublicClient({
chain: mainnet,
const arbSepoliaSequencerInbox = '0x6c97864CE4bEf387dE0b3310A44230f7E3F1be0D';
const sepoliaClient = createPublicClient({
chain: sepolia,
transport: http(),
}).extend(publicActionsParentChain({ sequencerInbox: arbSepoliaSequencerInbox }));
const arbitrumClient = createPublicClient({
chain: arbitrum,
transport: http(),
}).extend(publicActionsParentChain({ sequencerInbox: arbOneSequencerInbox }));
}).extend(
publicActionsParentChain({ sequencerInbox: '0x995a9d3ca121D48d21087eDE20bc8acb2398c8B1' }),
);

describe('Getters', () => {
it('[maxTimeVariation] Should return max time variation', async () => {
const maxTimeVariation = await client.getMaxTimeVariation();
const maxTimeVariation = await sepoliaClient.getMaxTimeVariation();
expect(maxTimeVariation).toEqual({
delayBlocks: 5760n,
futureBlocks: 64n,
Expand All @@ -23,23 +29,28 @@ describe('Getters', () => {
});

it('[isBatchPoster] Should return if an address is a batch poster', async () => {
const isZeroAddressBatchPoster = await client.isBatchPoster({
const isZeroAddressBatchPoster = await arbitrumClient.isBatchPoster({
batchPoster: zeroAddress,
});
expect(isZeroAddressBatchPoster).toBeFalsy();

const isBatchPosterOnXai = await arbitrumClient.isBatchPoster({
batchPoster: '0x7F68dba68E72a250004812fe04F1123Fca89aBa9',
});
expect(isBatchPosterOnXai).toBeTruthy();
});

it('[isValidKeysetHash] Should return if a keysetHash is a valid one', async () => {
const isEmptyHashValidKeysetHash = await client.isValidKeysetHash({
const isEmptyHashValidKeysetHash = await arbitrumClient.isValidKeysetHash({
keysetHash: padHex('0x'),
});
expect(isEmptyHashValidKeysetHash).toBeFalsy();

// Test on Nova
const isAValidKeysetHashOnNova = await client.isValidKeysetHash({
keysetHash: '0x01191accc7ad5a8020e6c6d122984540e9fc48d0457bda63e0a32c8c31994f4a',
sequencerInbox: '0x211e1c4c7f1bf5351ac850ed10fd68cffcf6c21b',
// Test on ProofOfPlay
const isAValidKeysetHashOnPoP = await arbitrumClient.isValidKeysetHash({
keysetHash: '0xc2c008db9d0d25ca30d60080f5ebd3d114dbccd95f2bd2df05446eae6b1acadf',
sequencerInbox: '0xa58F38102579dAE7C584850780dDA55744f67DF1',
});
expect(isAValidKeysetHashOnNova).toBeTruthy();
expect(isAValidKeysetHashOnPoP).toBeTruthy();
});
});

0 comments on commit ef6ab80

Please sign in to comment.