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

Improve local test utils #109

Merged
merged 5 commits into from
Nov 25, 2023
Merged

Improve local test utils #109

merged 5 commits into from
Nov 25, 2023

Conversation

Siegrift
Copy link
Collaborator

@Siegrift Siegrift commented Nov 22, 2023

Rationale

Minor improvements to the local test configuration to make it runnable on other chains. I used that to deploy the contracts on Polygon testnet and run the Pushers and Signed APIs locally.

These are the contracts:

I've used the same dAPIs that were used in the local test, but I've set them up with 1% deviation.

@Siegrift Siegrift self-assigned this Nov 22, 2023
@Siegrift Siegrift changed the title Make local test configuration more versatile WIP: Make local test configuration more versatile Nov 22, 2023
@Siegrift Siegrift changed the title WIP: Make local test configuration more versatile Add CloudFormation template, improve local test utils Nov 22, 2023
};

newActiveDapisHtml += JSON.stringify(dapiInfo, null, 2) + '\n\n';
}
document.getElementById('activeDapis').innerHTML = newActiveDapisHtml;
}, 1000);
}, 3000);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Increased to avoid spamming public RPC providers too much.

@@ -50,6 +50,36 @@ export const deriveRole = (adminRole: string, roleDescription: string) => {
);
};

export const refundFunder = async (funderWallet: ethers.Wallet) => {
Copy link
Collaborator Author

@Siegrift Siegrift Nov 22, 2023

Choose a reason for hiding this comment

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

This is not called, but you can call it manually by editing the script (call this instead of deploying the contracts and funding the sponsor wallets).

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I needed to add tx.wait() for each transaction (otherwise I got errors).

@@ -174,8 +220,8 @@ export const deploy = async (funderWallet: ethers.Wallet, provider: ethers.provi
// Register merkle tree hashes
const timestamp = Math.floor(Date.now() / 1000);
const apiTreeValues = [
[pusher1Wallet.address, `${pusher1.signedApis[0].url}/default`], // NOTE: Pusher pushes to the "/" of the signed API, but we need to query it additional path.
[pusher2Wallet.address, `${pusher2.signedApis[0].url}/default`], // NOTE: Pusher pushes to the "/" of the signed API, but we need to query it additional path.
[pusher1Wallet.address, joinUrl(pusher1.signedApis[0].url, 'default')], // NOTE: Pusher pushes to the "/" of the signed API, but we need to query it additional path.
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

One of my deployments didn't work because of a double slash in the URL.

@Siegrift Siegrift requested review from aquarat and metobom and removed request for metobom November 22, 2023 17:24
@Siegrift Siegrift changed the title Add CloudFormation template, improve local test utils Improve local test utils Nov 22, 2023
Copy link
Collaborator Author

@Siegrift Siegrift left a comment

Choose a reason for hiding this comment

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

I'm gonna merge since I am probably the only one running this example now. Feel free to leave comments.

@Siegrift Siegrift merged commit 29b740b into main Nov 25, 2023
4 checks passed
@Siegrift Siegrift deleted the polygon-local-run branch November 25, 2023 09:08
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.

1 participant