Coder Social home page Coder Social logo

coretime-migration's Introduction

Coretime Migration

This repository intends to calculate, given an estimated block height for the start of coretime sales, until when each paraID will have a core on the relay chain.

Usage

  1. Clone this repository
  2. Install dependencies with npm install
  3. Run the project
    • For Polkadot: [not available yet]
    • For Kusama: npm run start or npm run start chain=kusama

Methodology

Coretime sale cycles are dictated by the region length, given by the amount of timeslices in a region and the amount of blocks on a timeslice.

region_length = 5040 timeslice
timeslice = 80 blocks

At the same time, coretime sales are set to start at a specific block height. So sale1 will start at block_height = X, and sale2 will start at block_height = X+region_length.

If the objective is to calculate at which block height does a specific n sale start, then the above can be represented as:

    saleBlock = CORETIME_SALES_START + (region_length * timeslice) * (n-1)
    
    where:
    - CORETIME_SALES_START is the time at which the first sale starts
    - region_length is the length in timeslices of a region
    - timeslice is the number of blocks on a timeslice
    - n is the targeted sale

Parachains

Currently each parachain on Polkadot has a slot measured in Lease Periods. Therefore there needs to be a translation from the current Lease Periods to the intended coretime sale cycles.

The coretime migration code is designed to allow teams to have a core until the next available sale start. So if a specific lease period ends at block X which is between sales Y and Z (with Z > Y), then this team will have a core assigned until sales at block Z start, and will have to renew during the sales at block Y.

This has been the basis of the calculation of this tool.

Output

The output of the tool looks something like this:

{
    paraID: 2084,
    name: 'Calamari',
    coreUntilBlock: 23160700,
    renewCoreAtSaleNumber: 1
},

Each paraID that has a slot on Kusama and/or Polkadot will be represented in this list. The output shows until which block the paraID has a core (coreUntilBlock) and at which coretime sale the paraID has to renew its core.

In this case, paraID 2084 will have a core until block 23_160_700, however will have to renew this core during sale cycle 1.

IMPORTANT โš ๏ธ This tool has a fixed estimated time of coretime sales here. If need be, change this number accordingly when using it.

coretime-migration's People

Contributors

sbalaguer avatar seadanda avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.