|
1 | 1 | import { ApiPromise, WsProvider } from '@polkadot/api'; |
2 | 2 | import { TransactionReceipt } from '@ethersproject/abstract-provider'; |
3 | | -import { |
4 | | - acala1102030a, |
5 | | - acala1102030b, |
6 | | - acala1555311a, |
7 | | - acala1555311b, |
8 | | - acala1563383, |
9 | | - acala2669090, |
10 | | - acala2859806, |
11 | | - karura1824665, |
12 | | - karura2043397b, |
13 | | - karura2449983a, |
14 | | - karura2449983b, |
15 | | - karura2826860, |
16 | | - karura2936174, |
17 | | - karura3524761, |
18 | | - karura3597964, |
19 | | - karura3607973, |
20 | | -} from './receipt-snapshots'; |
21 | | -import { afterAll, beforeAll, describe, expect, it } from 'vitest'; |
| 3 | +import { afterAll, beforeAll, describe, it } from 'vitest'; |
| 4 | +import { options } from '@acala-network/api'; |
| 5 | + |
22 | 6 | import { getAllReceiptsAtBlock } from '../../utils/parseBlock'; |
23 | 7 | import { hexlifyRpcResult, sleep } from '../../utils'; |
24 | | -import { options } from '@acala-network/api'; |
25 | 8 |
|
26 | 9 | interface FormatedReceipt { |
27 | 10 | to?: string; |
@@ -94,125 +77,130 @@ describe.concurrent('getAllReceiptsAtBlock', () => { |
94 | 77 | await apiA.disconnect(); |
95 | 78 | }); |
96 | 79 |
|
97 | | - describe.concurrent('transfer kar', async () => { |
98 | | - it('basic one', async () => { |
| 80 | + describe.concurrent('transfer kar', () => { |
| 81 | + it('basic one', async ({ expect }) => { |
99 | 82 | const blockNumber = 3607973; |
100 | 83 | const receipts = await getAllReceiptsAtBlockNumber(apiK, blockNumber); |
101 | 84 |
|
102 | 85 | expect(receipts.length).to.equal(1); |
103 | | - expect(receipts[0]).to.deep.equal(karura3607973); |
| 86 | + expect(receipts).toMatchSnapshot(); |
104 | 87 | }); |
105 | 88 | }); |
106 | 89 |
|
107 | 90 | describe.concurrent('contract creation', () => { |
108 | | - it('basic one', async () => { |
| 91 | + it('basic one', async ({ expect }) => { |
109 | 92 | const blockNumber = 3524761; |
110 | 93 | const receipts = await getAllReceiptsAtBlockNumber(apiK, blockNumber); |
111 | 94 |
|
112 | 95 | expect(receipts.length).to.equal(1); |
113 | | - expect(receipts[0]).to.deep.equal(karura3524761); |
| 96 | + expect(receipts).toMatchSnapshot(); |
114 | 97 | }); |
115 | 98 |
|
116 | | - it('with logs + legacy gas', async () => { |
| 99 | + it('with logs + legacy gas', async ({ expect }) => { |
117 | 100 | const blockNumber = 1824665; |
118 | 101 | const receipts = await getAllReceiptsAtBlockNumber(apiK, blockNumber); |
119 | 102 |
|
120 | 103 | expect(receipts.length).to.equal(1); |
121 | | - expect(receipts[0]).to.deep.equal(karura1824665); |
122 | | - }); |
123 | | - |
124 | | - it('2 contract creation failed', async () => { |
125 | | - const blockNumber = 1102030; |
126 | | - const receipts = await getAllReceiptsAtBlockNumber(apiA, blockNumber); |
127 | | - |
128 | | - expect(receipts.length).to.equal(2); |
129 | | - expect(receipts[0]).to.deep.equal(acala1102030a); |
130 | | - expect(receipts[1]).to.deep.equal(acala1102030b); |
| 104 | + expect(receipts).toMatchSnapshot(); |
131 | 105 | }); |
132 | 106 | }); |
133 | 107 |
|
134 | 108 | describe.concurrent('contract call', () => { |
135 | | - it('aggregatedDex.swapWithExactSupply => transfer 1 erc20', async () => { |
| 109 | + it('aggregatedDex.swapWithExactSupply => transfer 1 erc20', async ({ expect }) => { |
136 | 110 | const blockNumber = 2826860; |
137 | 111 | const receipts = await getAllReceiptsAtBlockNumber(apiK, blockNumber); |
138 | 112 |
|
139 | 113 | expect(receipts.length).to.equal(1); |
140 | | - expect(receipts[0]).to.deep.equal(karura2826860); |
| 114 | + expect(receipts).toMatchSnapshot(); |
141 | 115 | }); |
142 | 116 |
|
143 | | - it('evm.call => tranfer 2 erc20', async () => { |
| 117 | + it('evm.call => tranfer 2 erc20', async ({ expect }) => { |
144 | 118 | const blockNumber = 3597964; |
145 | 119 | const receipts = await getAllReceiptsAtBlockNumber(apiK, blockNumber); |
146 | 120 |
|
147 | 121 | expect(receipts.length).to.equal(1); |
148 | | - expect(receipts[0]).to.deep.equal(karura3597964); |
| 122 | + expect(receipts).toMatchSnapshot(); |
149 | 123 | }); |
150 | 124 |
|
151 | | - it('evm.call + aggregatedDex.swapWithExactSupply', async () => { |
| 125 | + it('evm.call + aggregatedDex.swapWithExactSupply', async ({ expect }) => { |
152 | 126 | const blockNumber = 2449983; |
153 | 127 | const receipts = await getAllReceiptsAtBlockNumber(apiK, blockNumber); |
154 | 128 |
|
155 | 129 | expect(receipts.length).to.equal(2); |
156 | | - expect(receipts[0]).to.deep.equal(karura2449983a); |
157 | | - expect(receipts[1]).to.deep.equal(karura2449983b); |
| 130 | + expect(receipts).toMatchSnapshot(); |
158 | 131 | }); |
159 | 132 |
|
160 | | - it('negative usedStorage', async () => { |
| 133 | + it('negative usedStorage', async ({ expect }) => { |
161 | 134 | const blockNumber = 2043397; |
162 | 135 | const receipts = await getAllReceiptsAtBlockNumber(apiK, blockNumber); |
163 | 136 |
|
164 | 137 | expect(receipts.length).to.equal(2); |
165 | | - expect(receipts[1]).to.deep.equal(karura2043397b); |
| 138 | + expect(receipts).toMatchSnapshot(); |
166 | 139 | }); |
167 | 140 | }); |
168 | 141 |
|
169 | 142 | describe.concurrent('orphan tx', () => { |
170 | | - it('1 orphan tx', async () => { |
| 143 | + it('1 orphan tx', async ({ expect }) => { |
171 | 144 | const blockNumber = 1563383; |
172 | 145 | const receipts = await getAllReceiptsAtBlockNumber(apiA, blockNumber); |
173 | 146 |
|
174 | 147 | expect(receipts.length).to.equal(1); |
175 | | - expect(receipts[0]).to.deep.equal(acala1563383); |
| 148 | + expect(receipts).toMatchSnapshot(); |
176 | 149 | }); |
177 | 150 |
|
178 | | - it('1 successful orphan + 1 failed orphan', async () => { |
| 151 | + it('1 successful orphan + 1 failed orphan', async ({ expect }) => { |
179 | 152 | const blockNumber = 1555311; |
180 | 153 | const receipts = await getAllReceiptsAtBlockNumber(apiA, blockNumber); |
181 | 154 |
|
182 | 155 | expect(receipts.length).to.equal(2); |
183 | | - expect(receipts[0]).to.deep.equal(acala1555311a); |
184 | | - expect(receipts[1]).to.deep.equal(acala1555311b); |
| 156 | + expect(receipts).toMatchSnapshot(); |
| 157 | + }); |
| 158 | + |
| 159 | + it('9 contract creation failed by technicalCommittee', async ({ expect }) => { |
| 160 | + const blockNumber = 1102030; |
| 161 | + const receipts = await getAllReceiptsAtBlockNumber(apiA, blockNumber); |
| 162 | + |
| 163 | + expect(receipts.length).to.equal(9); |
| 164 | + expect(receipts).toMatchSnapshot(); |
| 165 | + }); |
| 166 | + |
| 167 | + it('batch approve + draw lottery', async ({ expect }) => { |
| 168 | + const blockNumber = 6066931; |
| 169 | + const receipts = await getAllReceiptsAtBlockNumber(apiA, blockNumber); |
| 170 | + |
| 171 | + expect(receipts.length).to.equal(2); |
| 172 | + expect(receipts).toMatchSnapshot(); |
185 | 173 | }); |
186 | 174 | }); |
187 | 175 |
|
188 | 176 | describe.concurrent('erc20 XCM', () => { |
189 | | - it('basic xcm', async () => { |
| 177 | + it('basic xcm', async ({ expect }) => { |
190 | 178 | const blockNumber = 2936174; |
191 | 179 | const receipts = await getAllReceiptsAtBlockNumber(apiK, blockNumber); |
192 | 180 |
|
193 | 181 | expect(receipts.length).to.equal(1); |
194 | | - expect(receipts[0]).to.deep.equal(karura2936174); |
| 182 | + expect(receipts).toMatchSnapshot(); |
195 | 183 | }); |
196 | 184 |
|
197 | | - it('with some other random txs in the block', async () => { |
| 185 | + it('with some other random txs in the block', async ({ expect }) => { |
198 | 186 | const blockNumber = 2669090; |
199 | 187 | const receipts = await getAllReceiptsAtBlockNumber(apiA, blockNumber); |
200 | 188 |
|
201 | 189 | expect(receipts.length).to.equal(1); |
202 | | - expect(receipts[0]).to.deep.equal(acala2669090); |
| 190 | + expect(receipts).toMatchSnapshot(); |
203 | 191 | }); |
204 | 192 |
|
205 | | - it('multiple xcms', async () => { |
| 193 | + it('multiple xcms', async ({ expect }) => { |
206 | 194 | const blockNumber = 2859806; |
207 | 195 | const receipts = await getAllReceiptsAtBlockNumber(apiA, blockNumber); |
208 | 196 |
|
209 | 197 | expect(receipts.length).to.equal(1); |
210 | | - expect(receipts[0]).to.deep.equal(acala2859806); |
| 198 | + expect(receipts).toMatchSnapshot(); |
211 | 199 | }); |
212 | 200 | }); |
213 | 201 |
|
214 | 202 | describe.concurrent.skip('other types', () => { |
215 | | - it('failed EVM extrinsic - 0 gasLimit', async () => { |
| 203 | + it('failed EVM extrinsic - 0 gasLimit', async ({ expect }) => { |
216 | 204 | // TODO: construct a similar one on karura |
217 | 205 | }); |
218 | 206 | }); |
|
0 commit comments