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

Decentralized sequencer support #182

merged 39 commits into from
Aug 30, 2024

Conversation

EvgenKor
Copy link
Collaborator

@EvgenKor EvgenKor commented Feb 26, 2024

The changes introduced by this PR are intended to implement the decentralized sequencer architecture as described here

The following major changes were made:

  • a new entity called sequencer was introduced. It's unify relayer and proxy subsystems
  • an optional string array proxyUrls was added to the Pool config (relayerUrls field is also optional now). Depending on which of the fields defined the library selects obsolete relayer-based interaction scheme or the modern one based on proxies and provers. The Pool config must include one of proxyUrls OR relayerUrls field. Defining both of these properties will cause an internal error. Also the delegatedProverUrls field becomes optional
  • introduced ProxyFee interface which extends RelayerFee with proxyAddress: string and proverFee: bigint fields:
interface ProxyFee {
  fee: {
    deposit: bigint;
    transfer: bigint;
    withdrawal: bigint;
    permittableDeposit: bigint;
  };
  oneByteFee: bigint;
  nativeConvertFee: bigint;
  proxyAddress: string;
  proverFee: bigint
}
  • all RelayerFee entries was substituted with SequencesFee = RelayerFee | ProxyFee. It describes the fee returned by a sequencer
  • introduced TxFee interface which described atomic transaction fee properties. It consist of proxy/prover/total fee, and proxy address. It's an universal interface for the any sequencer. In case of relayer the proxy address and prover fee aren't used and proxy fee interpret as a relayer fee
interface TxFee { // all numeric values are in the pool dimension
    proxyAddress: string; // L1-address of the proxy
    total: bigint;        // total fee estimation
    proxyPart: bigint;    // proxy fee of commiting tx to the pool contract
    proverPart: bigint;   // prover fee of including tx to the Merkle tree
}
  • ZkBobClient.getRelayerFee was renamed to ZkBobClient.getSequencerFee
  • ZkBobClient.atomicTxFee returns TxFee object instead of bigint
  • minTxAmount routine now returns 1/20 part of the token as a minimal transaction amount. You can override it with the associated optional property of the Pool definition (as before)
  • ZkBobClient.getRelayerState was renamed to ZkBobClient.getSequencerState
  • ZkBobClient.getRelayerOptimisticState was renamed to ZkBobClient.getSequencerOptimisticState
  • ZkBobClient.getRelayerVersion was renamed to ZkBobClient.getSequencerVersion
  • ZkBobClient.getProverVersion was renamed to ZkBobClient.getDelegatedProverVersion
  • FeeAmont.relayerFee was replaced with FeeAmont.sequencerFee
  • the old hardcoded address prefix for Sepolia pool (pool_id = 0) zkbob_sepolia: was substituted with zkbob_sepold:

The library was published as a beta and using in the following chain:

@EvgenKor EvgenKor marked this pull request as ready for review February 26, 2024 19:44
Copy link

@AllFi AllFi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me.

src/networks/evm/index.ts Outdated Show resolved Hide resolved
src/client.ts Outdated Show resolved Hide resolved
src/client.ts Outdated Show resolved Hide resolved
src/services/proxy.ts Outdated Show resolved Hide resolved
@EvgenKor EvgenKor merged commit e074115 into develop Aug 30, 2024
1 check passed
@EvgenKor EvgenKor deleted the enhancement/memo-format branch August 30, 2024 09:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants