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

Simulate: Transaction via Tenderly #227

Merged
merged 26 commits into from
Apr 9, 2023
Merged

Conversation

bh2smith
Copy link
Contributor

@bh2smith bh2smith commented Apr 4, 2023

Introducing an interface for transaction simulation and an implementation (via Tenderly).

We test a successful simulation and another with invalid credentials that returns nothing. We will eventually combine this with the content in #220 so to simulate the full call data provided by the winning solver. From within the tenderly web-action we could access the credentials from the action context like so:

const tenderlyCredential = await context.secrets.get("TENDERLY_CREDENTIAL");

However we use env vars here in out tests (not sure of a better way).

@bh2smith bh2smith requested a review from a team April 4, 2023 11:06
@bh2smith bh2smith changed the base branch from main to fetch/winning-settlement April 4, 2023 11:06
@socket-security
Copy link

socket-security bot commented Apr 4, 2023

New dependency changes detected. Learn more about Socket for GitHub ↗︎


👍 No new dependency issues detected in pull request

Bot Commands

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of package-name@version specifiers. e.g. @SocketSecurity ignore [email protected] bar@* or ignore all packages with @SocketSecurity ignore-all

Pull request alert summary
Issue Status
Install scripts ✅ 0 issues
Native code ✅ 0 issues
Bin script shell injection ✅ 0 issues
Unresolved require ✅ 0 issues
Invalid package.json ✅ 0 issues
HTTP dependency ✅ 0 issues
Git dependency ✅ 0 issues
Potential typo squat ✅ 0 issues
Known Malware ✅ 0 issues
Telemetry ✅ 0 issues
Protestware/Troll package ✅ 0 issues

📊 Modified Dependency Overview:

➕ Added Package Capability Access +/- Transitive Count Publisher
[email protected] filesystem, environment +0 motdotla

@bh2smith bh2smith mentioned this pull request Apr 4, 2023
40 tasks
@bh2smith bh2smith marked this pull request as ready for review April 5, 2023 07:18
@bh2smith bh2smith force-pushed the simulate-settlement branch from e6de2ec to 812c1e8 Compare April 5, 2023 11:22
@bh2smith bh2smith changed the title Tenderly Simulate Transaction Simulate: Transaction via Tenderly Apr 5, 2023
Base automatically changed from fetch/winning-settlement to slippage-v2 April 6, 2023 08:57
Copy link
Contributor

@gentrexha gentrexha left a comment

Choose a reason for hiding this comment

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

Left some curiosity questions. LGTM!


export function isTenderlySimulationResponse(
value: any
): value is TenderlySimulationResponse {
Copy link
Contributor

Choose a reason for hiding this comment

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

Out of curiosity: Why isn't this a boolean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Very good question here! This is some typescript magic I was shown by @anxolin and @tukantje.

This return type is technically a Boolean, but also performs the type cast!

Copy link

Choose a reason for hiding this comment

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

Some context, this is called "type guards" https://www.typescriptlang.org/docs/handbook/advanced-types.html

@bh2smith bh2smith merged commit 06c9c5a into slippage-v2 Apr 9, 2023
@bh2smith bh2smith deleted the simulate-settlement branch April 9, 2023 21:26
@github-actions github-actions bot locked and limited conversation to collaborators Apr 9, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants