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

relay-retarget script #292

Merged
merged 2 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
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
24 changes: 12 additions & 12 deletions sdk/Dockerfile → Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@ RUN apt-get update \
&& apt-get install --no-install-recommends -y tini curl ca-certificates git \
&& rm -rf /var/lib/apt/lists/*

RUN mkdir -p /home/node/app/node_modules && chown -R node:node /home/node/app
RUN curl -L https://foundry.paradigm.xyz | bash && \
. /root/.bashrc && \
/root/.foundry/bin/foundryup && \
cp /root/.foundry/bin/* /usr/local/bin/

WORKDIR /home/node/app
COPY . ./
COPY --chown=node:node . .

RUN corepack enable \
&& corepack prepare pnpm@latest-9 --activate \
&& npm ci \
&& npm run build

RUN curl -L https://foundry.paradigm.xyz | bash && \
. /root/.bashrc && \
foundryup && \
mv /root/.foundry/bin/* /usr/local/bin
&& chown -R node:node /home/node/app

USER node
RUN mkdir /home/node/.npm/
COPY --chown=node:node . .
RUN forge install

WORKDIR /home/node/app/sdk
RUN npm ci && npm run build

WORKDIR /home/node/app/dist/
ENTRYPOINT [ "tini", "--", "node" ]
15 changes: 8 additions & 7 deletions sdk/src/scripts/relay-retarget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,13 +103,14 @@ async function main(): Promise<void> {

const retargetHeaders = await getRetargetHeaders(esploraClient, nextRetargetHeight, proofLength);

let env = [
`RELAY_ADDRESS=${relayAddress}`,
`RETARGET_HEADERS=${retargetHeaders}`,
`PRIVATE_KEY=${privateKey}`,
];

exec(`${env.join(" ")} forge script ../script/RelayRetarget.s.sol:RelayRetargetScript --rpc-url '${rpcUrl}' --broadcast --priority-gas-price 1`,
let env = {
'RELAY_ADDRESS': relayAddress,
'RETARGET_HEADERS': retargetHeaders,
'PRIVATE_KEY': privateKey,
};

exec(`forge script ../script/RelayRetarget.s.sol:RelayRetargetScript --rpc-url '${rpcUrl}' --broadcast --priority-gas-price 1`,
{ env: { ...process.env, ...env } },
(err: any, stdout: string, stderr: string) => {
if (err) {
throw new Error(`Failed to run command: ${err}`);
Expand Down
Loading