Skip to content

Commit

Permalink
Merging the develop branch into the main branch, v6.0.0
Browse files Browse the repository at this point in the history
Decentralized sequencers
  • Loading branch information
EvgenKor authored Oct 11, 2024
2 parents 34a72ff + eaac94d commit b472775
Show file tree
Hide file tree
Showing 23 changed files with 1,175 additions and 573 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zkbob-client-js",
"version": "5.5.3",
"version": "6.0.0",
"description": "zkBob integration library",
"repository": "git@github.com:zkBob/libzkbob-client-js.git",
"author": "Dmitry Vdovin <voidxnull@gmail.com>",
Expand Down Expand Up @@ -30,8 +30,8 @@
"graphql": "16.7.1",
"hdwallet-babyjub": "^0.0.2",
"idb": "^7.0.0",
"libzkbob-rs-wasm-web": "1.6.0",
"libzkbob-rs-wasm-web-mt": "1.6.0",
"libzkbob-rs-wasm-web": "1.7.0-beta5",
"libzkbob-rs-wasm-web-mt": "1.7.0-beta5",
"promise-throttle": "^1.1.2",
"regenerator-runtime": "^0.13.9",
"tronweb": "^5.3.0",
Expand Down
4 changes: 2 additions & 2 deletions src/address-prefixes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export const hardcodedPrefixes: ZkAddressPrefix[] = [
// Staging address prefixes
{
poolId: 0x000000,
prefix: 'zkbob_sepolia',
name: 'BOB on Sepolia testnet'
prefix: 'zkbob_sepold',
name: 'BOB on Sepolia testnet [the first dev pool, deprecated]'
},
{
poolId: 0xffff02,
Expand Down
206 changes: 147 additions & 59 deletions src/client-provider.ts

Large diffs are not rendered by default.

471 changes: 271 additions & 200 deletions src/client.ts

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { TxCalldataVersion } from "./tx";
import { bufToHex } from "./utils";
import { hash } from 'tweetnacl';

Expand Down Expand Up @@ -27,16 +28,17 @@ export enum DepositType {
SaltedPermit = 'permit', // based on EIP-2612 (salt was added to the signing message)
PermitV2 = 'permit2', // Uniswap Permit2 scheme (used for WETH)
AuthUSDC = 'usdc', // EIP-3009 (for most of USDC deployments)
AuthPolygonUSDC = 'usdc-polygon', // EIP-3009 (used by USDC token on Polygon)
AuthPolygonUSDC = 'usdc-polygon', // EIP-3009 (used by USDC.e token on Polygon)
}

export interface Pool {
chainId: number;
poolAddress: string;
tokenAddress: string,
relayerUrls: string[];
delegatedProverUrls: string[];
depositScheme: DepositType;
relayerUrls?: string[];
proxyUrls?: string[];
delegatedProverUrls?: string[];
coldStorageConfigPath?: string;
minTxAmount?: bigint;
feeDecimals?: number;
Expand Down
6 changes: 5 additions & 1 deletion src/emergency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,10 +151,14 @@ export class ForcedExitProcessor {
// create regular withdraw tx
const oneTx: IWithdrawData = {
amount: requestedAmount.toString(),
fee: '0',
to: this.network.addressToBytes(toAddress),
native_amount: '0',
energy_amount: '0',
proxy: this.network.addressToBytes(''),
prover: this.network.addressToBytes(''),
proxy_fee: '0',
prover_fee: '0',
data: [],
};
const oneTxData = await this.state.createWithdrawalOptimistic(oneTx, ZERO_OPTIMISTIC_STATE);

Expand Down
9 changes: 5 additions & 4 deletions src/errors.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ServiceType } from "./services/common";
import { SequencerJob } from "./services/relayer";

export class BobError extends Error {
constructor(message: string) {
Expand Down Expand Up @@ -101,14 +102,14 @@ export class NetworkError extends BobError {
}

export class RelayerJobError extends BobError {
constructor(public jobId: number, public reason: string) {
super(`Job ${jobId} failed with reason: ${reason}`);
constructor(public job: SequencerJob, public reason: string) {
super(`Job ${job.toString()} failed with reason: ${reason}`);
}
}

export class PoolJobError extends BobError {
constructor(public jobId: number, public txHash: string, public reason: string) {
super(`Tx ${txHash} (job ${jobId}) was reverted on the contract with reason: ${reason}`);
constructor(public job: SequencerJob, public txHash: string, public reason: string) {
super(`Tx ${txHash} (job ${job.toString()}) was reverted on the contract with reason: ${reason}`);
}
}

Expand Down
Loading

0 comments on commit b472775

Please sign in to comment.