Skip to content

Commit bade9e4

Browse files
committed
Change of cycle length in Quebec protocol
1 parent cdf7d38 commit bade9e4

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

src/Constants.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@
3939

4040
FIRST_PARIS_LEVEL = 5726209
4141

42+
FIRST_QUEBEC_LEVEL = 7692289
43+
4244
TEZOS_RPC_PORT = 8732
4345

4446
SIGNER_PORT = 6732
@@ -81,14 +83,14 @@
8183
"MAINNET": {
8284
# General
8385
"NAME": "MAINNET",
84-
"MINIMAL_BLOCK_DELAY": 10,
85-
"BLOCKS_PER_CYCLE": 24576,
86+
"MINIMAL_BLOCK_DELAY": 8,
87+
"BLOCKS_PER_CYCLE": 30720,
8688
},
8789
CURRENT_TESTNET: {
8890
# General
8991
"NAME": CURRENT_TESTNET,
90-
"MINIMAL_BLOCK_DELAY": 5,
91-
"BLOCKS_PER_CYCLE": 12288,
92+
"MINIMAL_BLOCK_DELAY": 4,
93+
"BLOCKS_PER_CYCLE": 15360,
9294
},
9395
}
9496

src/api/block_api.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
from abc import ABC, abstractmethod
2-
from Constants import FIRST_GRANADA_LEVEL, FIRST_MUMBAI_LEVEL, FIRST_PARIS_LEVEL
2+
from Constants import (
3+
FIRST_GRANADA_LEVEL,
4+
FIRST_MUMBAI_LEVEL,
5+
FIRST_PARIS_LEVEL,
6+
FIRST_QUEBEC_LEVEL,
7+
)
38

49
# TODO: we should check if we are on mainnet, or a testnet
510
# we could add a get_current_protocol() method and check against it
@@ -15,10 +20,13 @@ def get_current_cycle_and_level(self):
1520
pass
1621

1722
def level_in_cycle(self, level):
18-
if level >= FIRST_PARIS_LEVEL:
23+
if level >= FIRST_QUEBEC_LEVEL:
24+
# Since protocol Quebec
25+
return (level - FIRST_QUEBEC_LEVEL) % self.nw["BLOCKS_PER_CYCLE"]
26+
elif level >= FIRST_PARIS_LEVEL:
1927
# Since protocol Paris
2028
return (level - FIRST_PARIS_LEVEL) % self.nw["BLOCKS_PER_CYCLE"]
21-
if level >= FIRST_MUMBAI_LEVEL:
29+
elif level >= FIRST_MUMBAI_LEVEL:
2230
# Since protocol Mumbai
2331
return (level - FIRST_MUMBAI_LEVEL) % self.nw["BLOCKS_PER_CYCLE"]
2432
elif level >= FIRST_GRANADA_LEVEL:

0 commit comments

Comments
 (0)