Skip to content

Commit

Permalink
Remove L2_ROLLUP and L1_PROVIDER_URL
Browse files Browse the repository at this point in the history
  • Loading branch information
makoto committed May 8, 2024
1 parent 7fbb0b4 commit 1a62678
Show file tree
Hide file tree
Showing 6 changed files with 4 additions and 158 deletions.
4 changes: 1 addition & 3 deletions scroll-gateway/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ npm install -g bun
cd scroll-gateway
bun install
touch .dev.vars
## set L1_PROVIDER_URL, L2_PROVIDER_URL, L2_ROLLUP
## set L2_PROVIDER_URL
yarn dev
```

Expand All @@ -24,9 +24,7 @@ cd scroll-gateway
npm install -g wrangler
wrngler login
wrangler secret put L1_PROVIDER_URL
wrangler secret put L2_PROVIDER_URL
wrangler secret put L2_ROLLUP
yarn deploy
```

Expand Down
19 changes: 1 addition & 18 deletions scroll-gateway/src/ScrollProofService.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/* eslint-disable prettier/prettier */
import { EVMProofHelper, type IProofService } from '@ensdomains/evm-gateway';
import { AbiCoder, concat, Contract, ethers, type AddressLike, } from 'ethers';
import { AbiCoder, concat, ethers, type AddressLike, } from 'ethers';

import rollupAbi from "./abi/rollupABI.js";
export interface ScrollProvableBlock {
number: number
}
Expand All @@ -14,26 +13,16 @@ export interface ScrollProvableBlock {
*/
export class ScrollProofService implements IProofService<ScrollProvableBlock> {
private readonly l2Provider: ethers.JsonRpcProvider;
private readonly rollup: Contract;
private readonly helper: EVMProofHelper;


constructor(
l1Provider: ethers.JsonRpcProvider,
l2Provider: ethers.JsonRpcProvider,
l2RollupAddress: string
) {
this.l2Provider = l2Provider;
this.rollup = new Contract(
l2RollupAddress,
rollupAbi,
l1Provider
);
this.helper = new EVMProofHelper(l2Provider);
}

async getStorageAt(block: ScrollProvableBlock, address: AddressLike, slot: bigint): Promise<string> {
console.log(typeof(this.rollup))
return this.helper.getStorageAt(block.number, address, slot);
}

Expand Down Expand Up @@ -67,7 +56,6 @@ export class ScrollProofService implements IProofService<ScrollProvableBlock> {
...storageProof,
]);
}
console.log({compressedProofs})
const res:any = AbiCoder.defaultAbiCoder().encode(
[
'tuple(uint256 batchIndex)',
Expand All @@ -82,11 +70,6 @@ export class ScrollProofService implements IProofService<ScrollProvableBlock> {
},
]
);
console.log({
blockNumber:Number(block.number), address,
batchIndex, slots, proof,
res
})
return res;
}
/**
Expand Down
112 changes: 0 additions & 112 deletions scroll-gateway/src/abi/rollupABI.ts

This file was deleted.

5 changes: 0 additions & 5 deletions scroll-gateway/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,12 @@ import { ScrollProofService, type ScrollProvableBlock } from './ScrollProofServi
export type ScrollGateway = EVMGateway<ScrollProvableBlock>;

export async function makeScrollGateway(
l1providerUrl: string,
l2providerUrl: string,
l2RollupAddress: string
): Promise<ScrollGateway> {
const l1Provider = new JsonRpcProvider(l1providerUrl);
const l2Provider = new JsonRpcProvider(l2providerUrl);
return new EVMGateway(
new ScrollProofService(
l1Provider,
l2Provider,
l2RollupAddress
)
);
}
Expand Down
15 changes: 1 addition & 14 deletions scroll-gateway/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,35 +6,22 @@ import { ScrollProofService } from './ScrollProofService.js';

const program = new Command()
.option('-p, --port <port>', 'port to listen on', '8080')
.option(
'-u, --l1-provider-url <url>',
'l1 provider url',
'http://localhost:8545/'
)
.option(
'-v, --l2-provider-url <url>',
'l2 provider url',
'http://localhost:9545/'
)
.option(
'-o --l2-rollup-address <address>',
'address for L2 outbox on the L1',
process.env.ROLLUP_ADDRESS
);

program.parse();

(async () => {
const options = program.opts();

const l1Provider = new JsonRpcProvider(options.l1ProviderUrl);
const l2Provider = new JsonRpcProvider(options.l2ProviderUrl);

const gateway = new EVMGateway(
new ScrollProofService(
l1Provider,
l2Provider,
options.l2RollupAddress
l2Provider
)
);
const server = new Server();
Expand Down
7 changes: 1 addition & 6 deletions scroll-gateway/src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ let app: Router;

async function fetch(request: CFWRequest, env: Env) {
const {
L1_PROVIDER_URL,
L2_PROVIDER_URL,
L2_ROLLUP,
GATEWAY_DOMAIN,
ENDPOINT_URL,
} = env;
Expand All @@ -35,14 +33,11 @@ async function fetch(request: CFWRequest, env: Env) {
const EVMGateway = (await import('@ensdomains/evm-gateway')).EVMGateway;
const ScrollProofService = (await import('./ScrollProofService.js'))
.ScrollProofService;
const l1Provider = new ethers.JsonRpcProvider(L1_PROVIDER_URL);
const l2Provider = new ethers.JsonRpcProvider(L2_PROVIDER_URL);

const gateway = new EVMGateway(
new ScrollProofService(
l1Provider,
l2Provider,
L2_ROLLUP
l2Provider
)
);

Expand Down

0 comments on commit 1a62678

Please sign in to comment.