Skip to content

add simple foundry scripts for live testing #825

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

Open
wants to merge 15 commits into
base: main
Choose a base branch
from

Conversation

jhweintraub
Copy link

@jhweintraub jhweintraub commented Apr 9, 2025

To better perform live testing on deployed contracts this PR creates some simple foundry scripts instead of relying on transporter, etherscan, or go scripts.

  1. Sending a message via CCIP
  2. Manually executing a message on a destination chain

It also includes changes to github actions to exclude scripts from testing and coverage requirements

@jhweintraub jhweintraub requested a review from a team as a code owner April 9, 2025 17:04
@jhweintraub jhweintraub changed the title add simple foundry scripts for off-chain testing add simple foundry scripts for live testing Apr 9, 2025
0xsuryansh
0xsuryansh previously approved these changes Apr 26, 2025

uint64 public s_sourceChainSelector;
uint64 public s_sequenceNumber;
bytes public s_manualExecutionData;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm assuming a user is supposed to fill every param here? There's no docs on anything so not 100% sure.

How useful is this script if you need to construct the tx manually?

Copy link
Member

@0xsuryansh 0xsuryansh Apr 29, 2025

Choose a reason for hiding this comment

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

Better to inject the values using env
We can make a .env.example file which shows all the keys which will be used to inject the values to these variables

Copy link
Author

Choose a reason for hiding this comment

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

  1. There's no way to get the sequence number dynamically on chain from the script it needs to be provided manually. I will include some comments for the user that they can get the sequencer number from the CCIP explorer front-end as well. I don't think using an ENV is any simpler if you still have to fill in the data it just adds more friction if you need to change things.
  2. The script is useful for simulating and debugging manual executions in foundry locally. During the Ronin situation recently we had to test manual executions. You can get manual execution data from a variety of other tools and I will include links to those on how to use them.

data: s_data,
tokenAmounts: tokens,
feeToken: address(0),
extraArgs: s_extraArgs
Copy link
Member

Choose a reason for hiding this comment

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

Better to take specific extra args fields as input (maybe through env) and build the struct and encode it in this script

Copy link
Author

Choose a reason for hiding this comment

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

While that would be better, as the number of different extra Args structs grows as we add more non-evm chains this may become unwieldy and unnecessary complex. This pattern is also present in some of our other example contracts such as PingPong so I feel like it is reasonable to expect the user to generate this themselves if required.

@0xsuryansh 0xsuryansh self-requested a review April 29, 2025 07:38
@0xsuryansh 0xsuryansh dismissed their stale review April 29, 2025 07:42

Re-reviewing

Copy link

github-actions bot commented May 5, 2025

Metric feat/foundry_testingScripts main
Coverage 72.6% 72.1%

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.

3 participants