Skip to content

feat(cli): send generic eip-712 transaction#176

Closed
fabiooshiro wants to merge 3 commits intocartesi:chore/bump-espresso-reader-to-0.3.0from
Calindra:feature/l2-send
Closed

feat(cli): send generic eip-712 transaction#176
fabiooshiro wants to merge 3 commits intocartesi:chore/bump-espresso-reader-to-0.3.0from
Calindra:feature/l2-send

Conversation

@fabiooshiro
Copy link

@fabiooshiro fabiooshiro commented Mar 13, 2025

Draft implementation related to the discussion at #171

cartesi send generic --help
Usage: cartesi send generic [options]

Sends generics inputs to the application, optionally in interactive mode.

Options:
  --dapp <address>                       Application address
  --chain-id <id>                        Chain ID
  --rpc-url <url>                        RPC URL
  --mnemonic <phrase>                    Mnemonic passphrase
  --mnemonic-index <index>               Mnemonic account index (default: 0)
  --input <input>                        input payload
  --input-encoding <input-encoding>      input encoding (choices: "hex", "string", "abi")
  --type <type>                          Transaction type (choices: "evm", "eip712", default: "evm")
  --eip712-tx-url <url>                  EIP-712 base url (default: "http://localhost:8080/transaction")
  --input-abi-params <input-abi-params>  input abi params
  -h, --help                             display help for command

Usage

cartesi send generic --type=eip712 --input=0xdeadbeef
✔ Chain Foundry
✔ RPC URL http://127.0.0.1:8545
✔ Wallet Mnemonic
✔ Mnemonic test test test test test test test test test test test junk
✔ Account 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 9999.980803715081379185 ETH
✔ Application address 0x75135d8ADb7180640d29d822D9AD59E83E8695b2
✔ Input sent: 0xd1748d033ccbb7e669548350bf7a53336dfdaf79dcb077f2ff745a0446d60127

@changeset-bot
Copy link

changeset-bot bot commented Mar 13, 2025

⚠️ No Changeset found

Latest commit: 359bcde

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@fabiooshiro fabiooshiro marked this pull request as ready for review March 20, 2025 13:25
new Option(
"--node-base-url <url>",
"Node base url",
).default("http://localhost:8080"),

Choose a reason for hiding this comment

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

Shouldn't this option refer to the URL of the transaction submission service to be used?
Maybe something like --eip712-tx-url, with a default value of http://localhost:8080/transaction?

};

const DEFAULT_SEND_CONFIG: Readonly<SendOptions> = {
baseUrl: "http://localhost:8080",

Choose a reason for hiding this comment

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

Should this be http://localhost:8080/transaction? Isn't this duplicating the option config in generic.ts? (pardon my ignorance)

};

/** Sends a transaction to L2 */
export const sendToL2 = async (

Choose a reason for hiding this comment

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

Given that we decided to call the command send --type=eip712, wouldn't it make more sense to call this method sendEip712() or something like that? Similar reasoning applies to other xyzL2() methods above

@fabiooshiro fabiooshiro force-pushed the feature/l2-send branch 2 times, most recently from 68b70cc to 5ec208c Compare March 25, 2025 13:13
@fabiooshiro fabiooshiro requested a review from miltonjonat March 25, 2025 13:20
Copy link
Member

@tuler tuler left a comment

Choose a reason for hiding this comment

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

Hold this to wait for next node alpha along with updated compatible espresso-reader

@fabiooshiro fabiooshiro changed the base branch from prerelease/v2-alpha to chore/bump-espresso-reader-to-0.3.0 May 13, 2025 18:43
@endersonmaia endersonmaia force-pushed the chore/bump-espresso-reader-to-0.3.0 branch 4 times, most recently from 128eb04 to 8838eeb Compare May 15, 2025 18:17
@endersonmaia
Copy link
Contributor

I'm getting this error when trying to send:

❯ cartesi-dev send generic --type=eip712 --input=0xdeadbeef                        10:54 

✔ Chain Foundry
✔ RPC URL http://127.0.0.1:8545
HTTP request failed.

URL: http://127.0.0.1:8545
Request body: {"method":"eth_chainId"}

Details: fetch failed
Version: viem@2.21.32

@endersonmaia
Copy link
Contributor

I think this needs a rebase.

@endersonmaia endersonmaia force-pushed the chore/bump-espresso-reader-to-0.3.0 branch from 0572649 to 1b2334b Compare May 16, 2025 14:02
@fabiooshiro fabiooshiro force-pushed the feature/l2-send branch 2 times, most recently from 8b7d29b to bcf32e1 Compare May 18, 2025 00:00
@fabiooshiro
Copy link
Author

rebased

@endersonmaia
Copy link
Contributor

Command cartesi send generic --type=eip712 --input=0xdeadbeeff

Sending two inputs and I get this from espresso-reader logs:

espresso_reader-1  | 2025-05-19T13:55:24.094 ERR Should query nonce before submit
espresso_reader-1  | 2025-05-19T13:55:25.854 INF Espresso input msgSender=0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 nonce=0 payload=0xdeadbeef appAddrss=0x8096bed6951c9444dc17b2c048fc69329b26980c tx-id=0x07cd1383c5e4397bda3056247931e89666a95830d3f8e53ba47fa47aa10a9eaf
espresso_reader-1  | 2025-05-19T14:31:19.414 ERR Should query nonce before submit
espresso_reader-1  | 2025-05-19T14:31:21.007 INF Espresso input msgSender=0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266 nonce=0 payload=0xdeadb00f appAddrss=0x8096bed6951c9444dc17b2c048fc69329b26980c tx-id=0xe8d5093f503018657bb84375a7468b01d1c2e0e3ade989e92df580f4726e554d
espresso_reader-1  | 2025-05-19T14:31:21.008 ERR Espresso nonce is incorrect. May be a duplicate tx "nonce from espresso"=0 "nonce in db"=1

Not sure if it's an issue for this PR, since the inputs is being sent.

@endersonmaia endersonmaia force-pushed the chore/bump-espresso-reader-to-0.3.0 branch from 7f014f9 to 54f1c12 Compare May 19, 2025 16:42
@endersonmaia endersonmaia deleted the branch cartesi:chore/bump-espresso-reader-to-0.3.0 May 19, 2025 16:42
@fabiooshiro
Copy link
Author

@endersonmaia Since the branch cartesi:chore/bump-espresso-reader-to-0.3.0 was deleted, I rebased and reopened the PR #275

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.

6 participants