Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

implement wait() method for QiTx response #317

Merged
merged 3 commits into from
Oct 17, 2024

Conversation

alejoacosta74
Copy link
Contributor

No description provided.

Copy link
Member

@rileystephens28 rileystephens28 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The wait mechanism looks good to go.

I would like to avoid changing any of the interfaces that force passing in unnecessary inputs like hash and zone when they are not needed. I know that this was done because Qi transactions where not producing correct QIP10 hashes and this was the only way to get this to work but we need to test again against latest go-quai and remove whatever is not needed.

Comment on lines 316 to 331
}
case 'qiTransaction': {
assert(zone != null, 'zone is required for qiTransaction event', 'MISSING_ARGUMENT');
assert(hash != null, 'hash is required for qiTransaction event', 'MISSING_ARGUMENT');
return { type: _event, tag: _event, hash, zone };
}
}
}

if (isHexString(_event, 32)) {
const hash = _event.toLowerCase();
zone = toZone(hash.slice(0, 4));
zone = zone ?? toZone(hash.slice(0, 4));
return { type: 'transaction', tag: getTag('tx', { hash }), hash, zone };
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we add an extra hash argument to the getSubscription method if we are already handling hash events for regular transactions? Cant we just use that same pattern?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have re implemented the Qi Tx wait() logic under the assumption that the tx input hash is permuted following QIP10.

@@ -1674,8 +1686,8 @@ export class AbstractProvider<C = FetchRequest> implements Provider {
return this._wrapBlock(params, network);
}

async getTransaction(hash: string): Promise<null | TransactionResponse> {
const zone = toZone(this.shardFromHash(hash));
async getTransaction(hash: string, _zone?: Zone): Promise<null | TransactionResponse> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's revisit this once go-quai and the genallocs get updated. I believe the core team is going to enforce QIP10 hashes so we should be able to rely on zone derived from hash and drop the zone input.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have re implemented the Qi Tx wait() logic under the assumption that the tx input hash is permuted following QIP10.

@rileystephens28 rileystephens28 merged commit 0f5e496 into dominant-strategies:alpha Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants