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

feat: add EL sim utility fn to send big raw blob txs #5661

Merged
merged 1 commit into from
Jun 20, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion packages/beacon-node/test/utils/runEl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {shell} from "../sim/shell.js";

/* eslint-disable @typescript-eslint/naming-convention */
/* eslint-disable no-console */
let txRpcId = 1;

export enum ELStartMode {
PreMerge = "pre-merge",
Expand Down Expand Up @@ -219,10 +220,25 @@ export async function sendTransaction(url: string, transaction: Record<string, u
await shell(
`curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[${JSON.stringify(
transaction
)}],"id":67}' ${url}`
)}],"id":${txRpcId++}}' ${url}`
);
}

/**
* Send a big raw transaction by writing to the json file first and then curl post the file
*/
export async function sendRawTransactionBig(
url: string,
transactionRawHex: string,
dataFilePath: string
): Promise<void> {
fs.writeFileSync(
dataFilePath,
`{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["${transactionRawHex}"],"id":${txRpcId++}}`
);
await shell(`curl -d @${dataFilePath} -H "Content-Type: application/json" -X POST ${url}; rm ${dataFilePath}`);
}

export async function getBalance(url: string, account: string): Promise<string> {
const response: string = await shell(
`curl -X POST -H "Content-Type: application/json" --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["${account}","latest"],"id":67}' ${url}`
Expand Down