Skip to content

Commit

Permalink
moved karura getblockbynumber tests to parseblock test
Browse files Browse the repository at this point in the history
  • Loading branch information
shunjizhan committed Oct 9, 2024
1 parent 0fd23c7 commit 96c42c7
Show file tree
Hide file tree
Showing 2 changed files with 131 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,111 @@ exports[`getAllReceiptsAtBlock > contract creation > with logs + legacy gas 1`]
]
`;

exports[`getAllReceiptsAtBlock > different evm tx count > when there are 0 EVM transactions 1`] = `[]`;

exports[`getAllReceiptsAtBlock > different evm tx count > when there are 1 EVM transactions 1`] = `
[
{
"blockHash": "0xab9f0519e9f9885861da35765dad61161c5f939c66b4c4b7091f7e9555e9f92f",
"blockNumber": "0x1bbf96",
"contractAddress": "0x0000000000000000000000000000000000000801",
"cumulativeGasUsed": "0x0",
"effectiveGasPrice": "0x4ced5668c50",
"from": "0x0000000000000000000000000000000000000000",
"gasUsed": "0x3181f",
"logs": [],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"status": "0x1",
"to": null,
"transactionHash": "0x79090e3e64da12012839fb40f95ad03703a6d3c999c262b4196796f9753861ca",
"transactionIndex": "0x0",
"type": "0x0",
},
]
`;

exports[`getAllReceiptsAtBlock > different evm tx count > when there are 2 EVM transactions 1`] = `
[
{
"blockHash": "0xbdae06c67294bca57bffd390c997d6730a837e1c11252d9bba00cac7384c1f16",
"blockNumber": "0x25623f",
"contractAddress": null,
"cumulativeGasUsed": "0x0",
"effectiveGasPrice": "0x15fde28667",
"from": "0x9cb3b68e0c48c53b70f465bda3ba6481a9cb7720",
"gasUsed": "0x2a9f7",
"logs": [
{
"address": "0x0000000000000000000100000000000000000084",
"blockHash": "0xbdae06c67294bca57bffd390c997d6730a837e1c11252d9bba00cac7384c1f16",
"blockNumber": "0x25623f",
"data": "0x0000000000000000000000000000000000000000000000000001550f7dca7000",
"logIndex": "0x0",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x00000000000000000000000030385059196602a1498f5f8ef91f3450e3a7b27a",
"0x0000000000000000000000009cb3b68e0c48c53b70f465bda3ba6481a9cb7720",
],
"transactionHash": "0x7b0361f47dc0be798cb9f7d115d74d68960e685714c515df81dd1a17e3db0cff",
"transactionIndex": "0x0",
},
{
"address": "0x30385059196602a1498f5f8ef91f3450e3a7b27a",
"blockHash": "0xbdae06c67294bca57bffd390c997d6730a837e1c11252d9bba00cac7384c1f16",
"blockNumber": "0x25623f",
"data": "0x0000000000000000000000009cb3b68e0c48c53b70f465bda3ba6481a9cb77200000000000000000000000000000000000000000000000000001550f7dca70000000000000000000000000000000000000000000000000000000000062f8bc54000000000000000000000000000000000000000000000000000000000025623f0000000000000000000000009cb3b68e0c48c53b70f465bda3ba6481a9cb7720",
"logIndex": "0x1",
"topics": [
"0xcb3fe4174668d512bcb57104a92bc21df0b8fdeb1cacc3575aa50b74a3e5ad5a",
"0xeac06b4f60edb2a940a2170eea5cef018dc569f5d98b8176f5da7ea640c9bd27",
"0x0000000000000000000000000000000000000000000100000000000000000084",
"0x0000000000000000000000000000000000000000000000000000000000000004",
],
"transactionHash": "0x7b0361f47dc0be798cb9f7d115d74d68960e685714c515df81dd1a17e3db0cff",
"transactionIndex": "0x0",
},
],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"status": "0x1",
"to": "0x30385059196602a1498f5f8ef91f3450e3a7b27a",
"transactionHash": "0x7b0361f47dc0be798cb9f7d115d74d68960e685714c515df81dd1a17e3db0cff",
"transactionIndex": "0x0",
"type": "0x0",
},
{
"blockHash": "0xbdae06c67294bca57bffd390c997d6730a837e1c11252d9bba00cac7384c1f16",
"blockNumber": "0x25623f",
"contractAddress": null,
"cumulativeGasUsed": "0x0",
"effectiveGasPrice": "0xb460f6718",
"from": "0xc760da3c525c8511938c35613684c3f6175c01a5",
"gasUsed": "0xc26d",
"logs": [
{
"address": "0x1f3a10587a20114ea25ba1b388ee2dd4a337ce27",
"blockHash": "0xbdae06c67294bca57bffd390c997d6730a837e1c11252d9bba00cac7384c1f16",
"blockNumber": "0x25623f",
"data": "0x0000000000000000000000000000000000000000000000000000000025342e5d",
"logIndex": "0x0",
"topics": [
"0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef",
"0x000000000000000000000000c760da3c525c8511938c35613684c3f6175c01a5",
"0x000000000000000000000000f7abcfa42bf7e7d43d3d53c665ded80fdafb5244",
],
"transactionHash": "0x9824e1111ba926db7df3091ec45344f224a3086daf5580eaf7ab3e6bf5a6dde6",
"transactionIndex": "0x1",
},
],
"logsBloom": "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"status": "0x1",
"to": "0x1f3a10587a20114ea25ba1b388ee2dd4a337ce27",
"transactionHash": "0x9824e1111ba926db7df3091ec45344f224a3086daf5580eaf7ab3e6bf5a6dde6",
"transactionIndex": "0x1",
"type": "0x0",
},
]
`;

exports[`getAllReceiptsAtBlock > erc20 XCM > basic xcm 1`] = `
[
{
Expand Down
26 changes: 26 additions & 0 deletions packages/eth-providers/src/__tests__/parseBlock.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,32 @@ describe.concurrent('getAllReceiptsAtBlock', () => {
});
});

describe.concurrent('different evm tx count', () => {
it('when there are 0 EVM transactions', async ({ expect }) => {
const blockNumber = 1818188;
const receipts = await getAllReceiptsAtBlockNumber(apiK, blockNumber);

expect(receipts.length).to.equal(0);
expect(receipts).toMatchSnapshot();
});

it('when there are 1 EVM transactions', async ({ expect }) => {
const blockNumber = 1818518;
const receipts = await getAllReceiptsAtBlockNumber(apiK, blockNumber);

expect(receipts.length).to.equal(1);
expect(receipts).toMatchSnapshot();
});

it('when there are 2 EVM transactions', async ({ expect }) => {
const blockNumber = 2449983;
const receipts = await getAllReceiptsAtBlockNumber(apiK, blockNumber);

expect(receipts.length).to.equal(2);
expect(receipts).toMatchSnapshot();
});
});

describe.concurrent.skip('other types', () => {
// it('failed EVM extrinsic - 0 gasLimit', async ({ expect }) => {
// // TODO: construct a similar one on karura
Expand Down

0 comments on commit 96c42c7

Please sign in to comment.