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

Decentralized sequencer support #182

Merged
merged 39 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
d41001e
Introducing memo version enum
EvgenKor Dec 13, 2023
e8ded85
Extra data struct
EvgenKor Dec 17, 2023
299e0ae
Merge branch 'develop' into enhancement/memo-format
EvgenKor Jan 10, 2024
01eebd7
Passing new tx fields
EvgenKor Jan 18, 2024
009b0da
Parsing new calldata format
EvgenKor Jan 19, 2024
e80d161
Calldata length reference
EvgenKor Jan 22, 2024
06bab48
Introducing calldataVersion optional field into the Pool config object
EvgenKor Jan 22, 2024
853fba3
Fee estimating routines (proxy + prover fees)
EvgenKor Jan 23, 2024
07d1816
Exporting TxFee
EvgenKor Jan 23, 2024
ca76d61
Fix memo parsing
EvgenKor Jan 30, 2024
990482b
Publishing beta
EvgenKor Feb 5, 2024
022aeb8
Hardcoding prover fee and proxy address, updating wasm lib
EvgenKor Feb 12, 2024
734d973
Fix issues (testing)
EvgenKor Feb 13, 2024
5774a23
Introducing Proxy service object
EvgenKor Feb 13, 2024
94ae8f4
Introducing Sequencer abstraction (Relayer | Proxy)
EvgenKor Feb 15, 2024
52eb17a
Fix issues
EvgenKor Feb 15, 2024
ca0f9a9
Updated pool config interface
EvgenKor Feb 15, 2024
a79004d
Calculating min tx amount (1/20 of token by default)
EvgenKor Feb 16, 2024
50b6619
Fetching proxy address and prover fee
EvgenKor Feb 24, 2024
aa0a8de
Increasing beta version
EvgenKor Feb 24, 2024
655f0f3
Fix exports
EvgenKor Feb 24, 2024
f2d94d5
Increasing beta verion
EvgenKor Feb 24, 2024
7de22b5
Removing ExtraItem interface
EvgenKor Feb 26, 2024
bdb602d
Updating wasm lib
EvgenKor Feb 27, 2024
801ded0
Code review fixes
EvgenKor Feb 28, 2024
d97e821
Increasing beta ver
EvgenKor Feb 29, 2024
c37cea2
Best proxy selection (by fee)
EvgenKor Mar 22, 2024
c48dc72
Fix
EvgenKor Mar 23, 2024
c35f9be
Introducing prover fee
EvgenKor Mar 29, 2024
2aaa3a0
Prioritizing sequencers from the outside
EvgenKor Apr 18, 2024
20e46b5
Increasing beta: 6.0.0-beta6
EvgenKor May 6, 2024
8e8a2f1
Job monitoring improvements
EvgenKor May 10, 2024
f8fc5cc
pendingDeltaIndex field processing (sequencer/info endpoint)
EvgenKor May 27, 2024
2543a26
New dd abi
EvgenKor Jun 27, 2024
b106d0c
Moving DD decoding function [wip]
EvgenKor Jul 10, 2024
4ec7173
Decoding DD calldata
EvgenKor Jul 11, 2024
d1fb8e9
Fix typo
AllFi Aug 1, 2024
122a7d1
Merge branch 'develop' into enhancement/memo-format
EvgenKor Aug 2, 2024
d99f76c
Merge branch 'develop' into enhancement/memo-format
EvgenKor Aug 30, 2024
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
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": "[email protected]:zkBob/libzkbob-client-js.git",
"author": "Dmitry Vdovin <[email protected]>",
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.

454 changes: 254 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
Loading