Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
Merge pull request #3451 from LiskHQ/3309-move-exceptions
Browse files Browse the repository at this point in the history
Move exceptions.js file to be part of config.json to simplify config structure - Closes #3309
  • Loading branch information
shuse2 authored Apr 30, 2019
2 parents d6f5f4e + d7def20 commit 0e61f8b
Show file tree
Hide file tree
Showing 11 changed files with 438 additions and 314 deletions.
12 changes: 8 additions & 4 deletions framework/src/modules/chain/logic/round.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,18 +306,22 @@ class Round {
const roundRewards = [...this.scope.roundRewards] || [];

// Apply exception for round if required
if (exceptions.rounds[this.scope.round]) {
if (exceptions.rounds[this.scope.round.toString()]) {
// Apply rewards factor
roundRewards.forEach((reward, subIndex) => {
roundRewards[subIndex] = new Bignum(reward.toPrecision(15))
.multipliedBy(exceptions.rounds[this.scope.round].rewards_factor)
.multipliedBy(
exceptions.rounds[this.scope.round.toString()].rewards_factor
)
.integerValue(Bignum.ROUND_FLOOR);
});

// Apply fees factor and bonus
roundFees = new Bignum(roundFees.toPrecision(15))
.multipliedBy(exceptions.rounds[this.scope.round].fees_factor)
.plus(exceptions.rounds[this.scope.round].fees_bonus)
.multipliedBy(
exceptions.rounds[this.scope.round.toString()].fees_factor
)
.plus(exceptions.rounds[this.scope.round.toString()].fees_bonus)
.integerValue(Bignum.ROUND_FLOOR);
}

Expand Down
2 changes: 1 addition & 1 deletion framework/test/mocha/unit/modules/chain/logic/round.js
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,7 @@ describe('round', () => {
it('should not mutate roundRewards if round exception exists', () => {
const [rewards_factor, fees_factor, fees_bonus] = [2, 2, 10000000];
global.exceptions.rounds = {
[scope.round]: { rewards_factor, fees_factor, fees_bonus },
[scope.round.toString()]: { rewards_factor, fees_factor, fees_bonus },
};
const roundRewards = _.clone(validLocalScope.roundRewards);

Expand Down
231 changes: 231 additions & 0 deletions lisk/EXCEPTIONS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,231 @@
## Exceptions

During the development of Lisk Core, we found some edge cases when the existing data on the network becomes invalid. Either it was because of a bug or some protocol change. To maintain state of the chain we have to consider that particular data valid in that particular scope. This concept of making some invalid data to be valid in the network is known to us as exceptions. To see the full list of available exception categories see the following [exception schema](https://github.com/LiskHQ/lisk-sdk/blob/ca7a626f5d231f07ac784b4f6b58ed72dfa9aaa3/framework/src/modules/chain/defaults/config.js#L110)

Below is the list of exceptions on each network with some details.

### Mainnet

```
rounds: {
27040: { rewards_factor: 2, fees_factor: 2, fees_bonus: 10000000 },
},
senderPublicKey: [
'6140297682817553271', // 12526
'17693199811026162972', // 12532
'12745015510836138583', // 34991
'15516237395249255875', // 34998
'6377354815333756139', // 34998
'12466861689592168447', // 35027
'2778306120620555464', // 36819
'1371513618457310858', // 43162
'17975182010363461275', // 660458
'7393365363305861496', // 734924
'10835780973515164613', // 734941
'16597985030226429007', // 734946
'16651448368467202930', // 734972
'2716517134501650091', // 734909
'3580178084951037889', // 735111
'5153508874902580125', // 735179
],
signatures: [
'5676385569187187158', // 868797
'5384302058030309746', // 869890
'9352922026980330230', // 925165
],
// For cases where block contains second signature transaction as well as other transactions
// from the same account without including signSignature for other transactions.
signSignature: ['7708475706877354541', '8340539534878295232'],
// transfer transaction with null byte in the data field
// SELECT * FROM transfer WHERE position('\x00' in data) > 0;
transactionWithNullByte: ['11815860355204320743'], // 7292474
multisignatures: [
'14122550998639658526', // 1189962
],
votes: [
'5524930565698900323', // 20407
'11613486949732674475', // 123300
'14164134775432642506', // 123333
],
recipientLeadingZero: {
// transaction ID to address map
// select id, "recipientId" from trs where left("recipientId", 1) = '0' and "recipientId" != '0L' ORDER BY "rowId"
'12466861689592168447': '07280969963593626387L',
'14828166242732404834': '03708552248146906277L',
'7881241259922057838': '000000133700000L',
'15335820464138247723': '00000000000000000000L',
'10790881043084628952': '00000000000000L',
'8222472670929877652': '0644846081578550031L',
'321301056789688144': '00702085012798728072L',
'17221198586575098918': '0670887445780012928L',
'8985252027779519944': '0461359979913215833L',
'16386368722107610263': '0918279345171678541L',
'8809409684590273069': '017643479995130895701L',
'6407377315551276342': '0605255118852574422L',
'16457701476824471729': '011359068057580646659L',
'10942592924825056609': '00454859010000000000L',
},
recipientExceedingUint64: {
// transaction ID to address map
// select id, "recipientId" from (select id, "recipientId", CAST(left("recipientId", -1) AS numeric) AS address_number FROM trs ORDER BY "rowId") as converted_table WHERE address_number > 18446744073709551615
'4808146167169807212': '88888888888888888888L',
'8662249085950135942': '111291927890909688453L',
'3512842658681414759': '45552822168800676881L',
'16490300774781935982': '102578089172695223748L',
'952064562393713903': '158417393714384967784L',
'11106640899982774712': '66767893317355082007L',
'14173229905148528539': '79378290046298522419L',
'10002297844266128985': '82995860846885414674L',
'15618125819389758504': '146740799137033984447L',
'14272734810070193586': '27431371898457477021L',
'2183159486043742102': '122761091781844220769L',
'939135978005147115': '115512977373004367295L',
'16460700234760525809': '167592467447211905329L',
'2756544599198077295': '24914870879919111310L',
'7926138601823684757': '658085858590467165179L',
'12636129598615060450': '65674106542041665570L',
'3402607277804364801': '136650599037076114683L',
'1040149454925709310': '62102519165446322358L',
'12358300408347126016': '36002663650389933742L',
'16085334466827014444': '61294630583900822405L',
'3054377757145973904': '23339304444138683202L',
'15607047602866731136': '163791171589406644447L',
'13087133649353348448': '114118779455743828526L',
'101792401786565558': '60908836751653554044L',
'12661581926779974683': '163791171589406644447L',
'13602311678584165723': '71066000334892806863L',
'1431099360354287373': '26123009066683693893L',
'15415858778872512497': '113843230015664032748L',
'6428153862282818223': '19818282826136809774L',
'11259766765373809175': '123396601130007835060L',
'9458819938766898698': '83930832964751654400L',
'15777929444386211489': '90572553121175565083L',
'2398720519848481371': '115247857947648814503L',
'3920240924573375078': '28266953424177981656L',
'836098833121929369': '163709399912253300453L',
'12637095980567585324': '101738091419252525441L',
'516933903766323623': '527528572855252525252L',
'7874437747681346480': '163994490445041326334L',
'6762151515473413512': '112878737683770362496L',
'4894138504028948034': '116244144370251521378L',
'2865853236604099445': '48172455550954660929L',
'4740161550333445515': '91150325309845111438L',
'1459096958324133814': '52227326644342588233L',
'17599831349987747578': '172751402580997820397L',
'16887688753571112156': '134870701874274944551L',
'11215230856097582828': '33882703892445210381L',
'14140283825150563894': '161348288408228933736L',
'10531191392368229062': '57178850733351210759L',
},
precedent: {
disableDappTransfer: 6901027, // Disable Dapp Transfer at this block height
},
// <version>: { start: <start_height>, end: <end_height> }
blockVersions: {
0: { start: 1, end: 6901027 },
},
```

### Testnet

```
blockRewards: [
'11807740622680299921', // 2161
'5714016151987080352', // 2162
],
senderPublicKey: [
'5252526207733553499', // 464289
],
signatures: [
'3274071402587084244', // 595491
'10403141873189588012', // 624550
'16896494584440078079', // 631670
],
// transfer transaction previously with null byte in the data field
// SELECT * FROM transfer WHERE position('\x00' in data) > 0;
transactionWithNullByte: ['10589655532517440995'], // 6109391
multisignatures: [
'8191213966308378713', // 952880
'8031165757158212499', // 979109
'6741135886562440478', // 982288
],
votes: [
'16272500600161825502', // 336424
'17197328760149985951', // 341635
'18231026627962552928', // 917323
'15449731671927352923', // 492382
'13473660246370752329', // 1305925
],
inertTransactions: [
'16394286522174687330', // 1318685 - Vote transaction
'12298100805070303137', // 3057955 - Delegate transaction
],
recipientLeadingZero: {
// transaction ID to address map
// select id, "recipientId" from trs where left("recipientId", 1) = '0' and "recipientId" != '0L' ORDER BY "rowId"
'12710869213547423905': '000123L',
'4595252596856199985': '000123L',
'4962453608347426857': '06076671634347365051L',
'14029161570134180080': '03333333333333333333L',
'11850546615651855419': '0123L',
'16785481052094374144': '0123L',
'1962750879300467095': '014377589660081535605L',
},
recipientExceedingUint64: {
// transaction ID to address map
// select id, "recipientId" from (select id, "recipientId", CAST(left("recipientId", -1) AS numeric) AS address_number FROM trs ORDER BY "rowId") as converted_table WHERE address_number > 18446744073709551615
'393955899193580559': '19961131544040416558L',
'2595217996098726177': '20906309950204158498L',
'2851909953078287800': '221360928884514619392L',
'7551953192792882354': '442721857769029238784L',
'6669246371367929130': '442721857769029238784L',
'14879617323763807152': '442721857769029238784L',
'3854891010578818255': '424275113695319687168L',
'5463681318391195043': '129127208515966861312L',
},
precedent: {
disableDappTransfer: 5594491, // Disable Dapp Transfer at this block height
},
// <version>: { start: <start_height>, end: <end_height> }
blockVersions: {
0: { start: 1, end: 5932033 },
},
// For round vote exceptions, we do not update the votes for the delegates included in the transaction
roundVotes: ['17197328760149985951'],
duplicatedSignatures: {
'15181013796707110990': [
'2ec5bbc4ff552f991262867cd8f1c30a417e4596e8343d882b7c4fc86288b9e53592031f3de75ffe8cf4d431a7291b76c758999bb52f46a4da62a27c8901b60a',
'36d5c7da5f54007e22609105570fad04597f4f2b00d46baba603c213eaed8de55e9f3e5d0f39789dbc396330b2d9d4da46b7d67187075e86220bc0341c3f7802',
],
'7424755700677996971': [
'e54fc5499e1c75c32d8b68590e6259a48ba764ff2dd3044aa3d46f463a06d309c11a281e819e8f7c80d875327a01e87bc1f5b9cd093d5b092495897c8b2bf90c',
'2eb06bf528d60231a6b93a4d03b02200c938692e8a92d51d4dbaf94087b2e1261a904eb00cba4a0ed7e9d7e6a996666d4cfe3b7011a64252a8a286b8111b4701',
],
},
/**
* In modules/delegates.js we are using generateDelegateList
* to get the list of forgers for the round. However, we are
* also caching this list to reduce calls to the database.
* In the rounds below, using cache, creates forks.
* See: https://github.com/LiskHQ/lisk/pull/2543#pullrequestreview-178505587
*
* So we are using the exception key below to skip caching for the rounds provided in the array.
* */
ignoreDelegateListCacheForRounds: [
19,
20,
21,
22,
26,
27,
29,
31,
34,
42,
58,
61,
81,
83,
116,
],
```
17 changes: 0 additions & 17 deletions lisk/config/alphanet/exceptions.js

This file was deleted.

17 changes: 0 additions & 17 deletions lisk/config/betanet/exceptions.js

This file was deleted.

17 changes: 0 additions & 17 deletions lisk/config/devnet/exceptions.js

This file was deleted.

Loading

0 comments on commit 0e61f8b

Please sign in to comment.