Skip to content
This repository has been archived by the owner on Nov 5, 2023. It is now read-only.

Update bundle receipt to match ethers transaction response #480

Merged

Conversation

JohnGuilding
Copy link
Collaborator

@JohnGuilding JohnGuilding commented Jan 23, 2023

What is this PR doing?

  1. Updates the bundle receipt type returned from the aggregator to closer match an ethers response type.
  2. Update test in BundleServiceSubmitting.test.ts to ensure receiptFromBundle works and returns the bundle hash.
  3. Update types in the client module (Aggregator.ts)
  4. Update the provider _getTransactionReceipt method to return the updated type.
  5. Update provider tests.
  6. Skip signer test that was causing issues.

How can these changes be manually tested?

  1. Hit lookupReceipt endpoint and observe updated bundle receipt
  2. Send a local transaction with Quill to ensure the changes have not broken how Quill retrieves transaction receipts.

Does this PR resolve or contribute to any issues?

#435

Checklist

  • I have manually tested these changes
  • Post a link to the PR in the group chat

Guidelines

  • If your PR is not ready, mark it as a draft
  • The resolve conversation button is for reviewers, not authors
    • (But add a 'done' comment or similar)

@github-actions github-actions bot added aggregator Aggregator backend related clients contracts Smart contract related documentation Improvements or additions to documentation labels Jan 23, 2023
@JohnGuilding JohnGuilding marked this pull request as ready for review January 23, 2023 15:47
);

// Assert
// TODO: bls-wallet #412 Update values returned in bundle receipt to more closely match ethers transaction response
const expectedBlockNumber = await blsProvider.getBlockNumber();
expect(transactionReceipt).to.be.an("object").that.deep.includes({
Copy link
Collaborator Author

@JohnGuilding JohnGuilding Jan 23, 2023

Choose a reason for hiding this comment

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

These assertions are more verbose but feel like the tradeoff is worth it unless anyone has suggestions on making them more concise.

If someone edits the return value in the BundleService, either by removing a property or changing property types, the test will fail. Note the test does not fail if someone adds an invalid property to the bundle receipt see comment

/**
* The bundle receipt returned from a BLS Wallet Aggregator instance. It is a combination of an ethers {@link ContractReceipt} and a {@link BlsWallet} type.
*/
export type BundleReceipt = ContractReceipt & {
Copy link
Collaborator Author

@JohnGuilding JohnGuilding Jan 23, 2023

Choose a reason for hiding this comment

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

Been thinking about validation in this file. I tried adding a property to the return type for receiptFromBundle - invalidProperty: "invalid property”, and it was successfully propagated to the provider. When we’re using our own aggregator, we have confidence the bundleReceipt will have certain properties, and as mentioned in this comment, our integration tests will pick up certain changes to the returned bundleReceipt. But what if a third party developer is using the client module/provider and decides to use their own aggregator. In this case, invalid responses could reach client module code.

My question is, should we validate incoming responses so that we don’t allow invalid data into the client module? Maybe a future issue?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think that is probably a good future issue. Just my opinion but I think validating the contract receipt right now might be a little scope creep. This is probably something we can handle if people start using other aggregators that don't follow our pattern here.

/**
* The BLS Wallet specific values in a {@link BundleReceipt}.
*/
export type BlsWallet = {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Can't decide if I like this name, any suggestions welcome.

Few random ideas:
BlsWalletReceipt
BlsTransactionReceipt
BlsBundleReceipt
BundleTransactionsReceipt
Bundles
BlsBundles

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah I agree, I think it would be good to have the word receipt in the name. Maybe something like BlsBundleReceipt sounds good 👍

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

BlsBundleReceipt sounds good to me, will update

Copy link
Contributor

@blakecduncan blakecduncan left a comment

Choose a reason for hiding this comment

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

Nice, this looks good!

I think this is the process that is typically used for client updates. But the only additional thing I would do is push up an experimental version of the client library. That way we can update the client version in the aggregator and the extension and make sure everything is working together. Then I think in a future PR if everything is working as expected we can create a new official release.

@@ -217,17 +217,17 @@ describe("Signer contract interaction tests", function () {
});

// TODO: Investigate why safeMint() fails with a BLS wallet address. Note - it passes in isolation
it("safeMint() call fails with BLS wallet address", async function () {
it.skip("safeMint() call fails with BLS wallet address", async function () {
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we still want this skipped?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It seems to be passing in isolation but then failing when run with other tests. Thought it would be better to skip it in case it causes issues like some other integration tests have, then implement a fix for it. I can add a follow up issue to look into it so it's tracked.

Let me know if you have any additional thoughts

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Follow up #484

Copy link
Contributor

Choose a reason for hiding this comment

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

Nope, that sounds good! I just wanted to make sure it wasn't an accidental add.

/**
* The bundle receipt returned from a BLS Wallet Aggregator instance. It is a combination of an ethers {@link ContractReceipt} and a {@link BlsWallet} type.
*/
export type BundleReceipt = ContractReceipt & {
Copy link
Contributor

Choose a reason for hiding this comment

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

Will this updated type break anything in the extension?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Tested the extension locally and is able to get the transaction receipt successfully. The transaction hashes lined up with what was logged in the aggregator logs.

Thinking about it, I might check it works on testnet as well as locally - then I can check the transaction hash works on etherscan

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just tested successfully via quill running a local aggregator pointing at arbitrum goerli.

The extension does not query the hash via bundleReceipt.bundleHash, so it still works (if it did query the hash this way, it would break).

It appears to save the bundle hash here so it doesn't have to query it.

It also uses the returned bundle hash here to get the transaction receipt.

Can't see anywhere else it could break to my knowledge.

@JohnGuilding JohnGuilding force-pushed the update-bundle-receipt-to-match-ethers-transaction-response branch from 05f8972 to 6dbee9f Compare January 24, 2023 15:51
@github-actions github-actions bot added the extension Browser extension related label Jan 24, 2023
@github-actions github-actions bot added the aggregator-proxy Aggregator proxy related label Jan 24, 2023
Copy link
Contributor

@blakecduncan blakecduncan left a comment

Choose a reason for hiding this comment

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

thanks for the updates 👍

@JohnGuilding JohnGuilding merged commit 016c1e5 into main Jan 26, 2023
@JohnGuilding JohnGuilding deleted the update-bundle-receipt-to-match-ethers-transaction-response branch January 26, 2023 13:14
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
aggregator Aggregator backend related aggregator-proxy Aggregator proxy related clients contracts Smart contract related documentation Improvements or additions to documentation extension Browser extension related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants