Skip to content

Commit 8d870a5

Browse files
authored
Merge pull request #1961 from opentensor/improve-evm-test
improve evm test stability
2 parents ffa23bc + a9fafae commit 8d870a5

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

evm-tests/src/substrate.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,30 +168,31 @@ export async function waitForTransactionCompletion(api: TypedApi<typeof devnet>,
168168
// })
169169
}
170170

171+
171172
export async function getTransactionWatchPromise(tx: Transaction<{}, string, string, void>, signer: PolkadotSigner,) {
172173
return new Promise<void>((resolve, reject) => {
173174
// store the txHash, then use it in timeout. easier to know which tx is not finalized in time
174175
let txHash = ""
175176
const subscription = tx.signSubmitAndWatch(signer).subscribe({
176177
next(value) {
177-
console.log("Event:", value);
178178
txHash = value.txHash
179179

180180
// TODO investigate why finalized not for each extrinsic
181181
if (value.type === "finalized") {
182182
console.log("Transaction is finalized in block:", value.txHash);
183183
subscription.unsubscribe();
184+
clearTimeout(timeoutId);
184185
if (!value.ok) {
185186
console.log("Transaction threw an error:", value.dispatchError)
186187
}
187188
// Resolve the promise when the transaction is finalized
188189
resolve();
189-
190190
}
191191
},
192192
error(err) {
193193
console.error("Transaction failed:", err);
194194
subscription.unsubscribe();
195+
clearTimeout(timeoutId);
195196
// Reject the promise in case of an error
196197
reject(err);
197198

@@ -201,7 +202,7 @@ export async function getTransactionWatchPromise(tx: Transaction<{}, string, str
201202
}
202203
});
203204

204-
setTimeout(() => {
205+
const timeoutId = setTimeout(() => {
205206
subscription.unsubscribe();
206207
console.log('unsubscribed because of timeout for tx {}', txHash);
207208
reject()
File renamed without changes.

runtime/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
215215
// `spec_version`, and `authoring_version` are the same between Wasm and native.
216216
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
217217
// the compatible custom types.
218-
spec_version: 302,
218+
spec_version: 303,
219219
impl_version: 1,
220220
apis: RUNTIME_API_VERSIONS,
221221
transaction_version: 1,

0 commit comments

Comments
 (0)