Skip to content

Conversation

@Rjected
Copy link
Contributor

@Rjected Rjected commented Jul 28, 2023

Motivation

I was trying to use cast as an engine API debug tool for reth, when I realized that ethers-rs does not have easy bearer token generation, and cast rpc did not have JWT secret support.

Solution

Added bearer token generation utilities in gakonst/ethers-rs#2529, which are used in this PR. This PR is dependent on the ethers PR, which is why there are patches.

TODO

  • Idea from @gakonst: cast rpc --jwt <file>, which takes in a file, replaying the RPC calls in the file line-by-line. Similar to hurl
  • Clarify jwt arg and env variable to make sure the user knows the input should be a hex-encoded JWT secret, not a token
    • should there be an option to use a raw token?
    • allow taking a file as input? for example the jwt.hex that reth outputs.
  • Remove patches
  • Add usage docs

@Rjected Rjected marked this pull request as draft July 29, 2023 00:00
@rkrasiuk rkrasiuk added T-feature Type: feature C-cast Command: cast labels Aug 2, 2023
@Evalir Evalir mentioned this pull request Aug 6, 2023
@Evalir
Copy link
Member

Evalir commented Aug 21, 2023

hey @Rjected is this mostly g2g? do you want us to take over?

@Rjected
Copy link
Contributor Author

Rjected commented Aug 21, 2023

hey @Rjected is this mostly g2g? do you want us to take over?

yeah I plan to do the following today:

  • add some usage docs
  • change flag name to jwt-secret

The hurl idea is cool but is probably out of scope for this PR, so once I do the above two this is good to go.
Another thing I probably won't have time for:

  • file input

@Evalir
Copy link
Member

Evalir commented Aug 21, 2023

That's alright, this is already pretty great—we can incrementally improve in future prs!

@Rjected Rjected marked this pull request as ready for review August 21, 2023 19:36
@Rjected
Copy link
Contributor Author

Rjected commented Aug 21, 2023

@Evalir this is RFR!

Copy link
Member

@Evalir Evalir left a comment

Choose a reason for hiding this comment

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

bro cooked with this one

lgtm! just pushed a smol commit to use const-hex, which we already have at the workspace level

(ci failure unrelated, merging when it passes)

@Evalir Evalir merged commit 6676e81 into foundry-rs:master Aug 21, 2023
mikelodder7 pushed a commit to LIT-Protocol/foundry that referenced this pull request Sep 12, 2023
* feat(cast): add JWT secret configuration

* set patches to branch

* fix cli test

* remove patches

* change `jwt` to `jwt-secret`

* change usages oops

* fix rpc_jwt_secret docs, add usage docs

* chore: use const-hex

---------

Co-authored-by: Enrique Ortiz <hi@enriqueortiz.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-cast Command: cast T-feature Type: feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants