Skip to content

Commit

Permalink
[consensus] block metadata uses a bitmap of validators
Browse files Browse the repository at this point in the history
Convert block metadata to use a bitmap of validators to denote voters
instead of the previous list of voters. This will make the block metadata
smaller; it will be especially noticeable with a large set of validators
and a small number of transactions.

This change deprecates the existing previous_block_votes column in indexer.
The new column previous_block_votes_bitmap contains the information as a
bitmap. For users of indexer (e.g., explorer) to map this to the actual
addresses, the sorted validator list per epoch is also needed. This is
future work.

Closes: aptos-labs#712
  • Loading branch information
bchocho authored and aptos-bot committed May 10, 2022
1 parent 5c92e8a commit e0545dd
Show file tree
Hide file tree
Showing 43 changed files with 594 additions and 214 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@
}
},
{
"bytecode": "0xa11ceb0b050000000b01000e020e0e031c5704730405773107a801f303089b052006bb05580a9306190cac06c0010dec0706000000010002000300040005000600070800000806000210040106010009000100000a010200000b030100000c01040006150101000516060100041707040001180202000619080100021a0a010106031b010200031c010100011d020200061e010100051f06010001200202000221060b010609091009050c03030a050500010302060c030101020107080001060c010503060c050301080102070b020109000900010b0201090005426c6f636b064572726f7273054576656e740f5265636f6e66696775726174696f6e055374616b650f53797374656d4164647265737365730954696d657374616d700d426c6f636b4d657461646174610d4e6577426c6f636b4576656e740e626c6f636b5f70726f6c6f677565186765745f63757272656e745f626c6f636b5f68656967687419696e697469616c697a655f626c6f636b5f6d657461646174610e69735f696e697469616c697a6564066865696768740e65706f63685f696e7465726e616c106e65775f626c6f636b5f6576656e74730b4576656e7448616e646c6505726f756e640870726f706f7365721470726576696f75735f626c6f636b5f766f7465731174696d655f6d6963726f7365636f6e6473106173736572745f6f7065726174696e67096173736572745f766d1469735f63757272656e745f76616c696461746f721072657175697265735f61646472657373127570646174655f676c6f62616c5f74696d650a656d69745f6576656e74196c6173745f7265636f6e66696775726174696f6e5f74696d650b7265636f6e6669677572650d6e6f745f7075626c69736865640e6173736572745f67656e65736973146173736572745f636f72655f7265736f7572636511616c72656164795f7075626c6973686564106e65775f6576656e745f68616e646c6500000000000000000000000000000000000000000000000000000000000000010308000000000000000003080100000000000000052000000000000000000000000000000000000000000000000000000000000000000520000000000000000000000000000000000000000000000000000000000a550c180002030d030e030f0b0201080101020411031205130a0514030000000100053511040e0011050a040702210308050b080c05050e0a0411060c050b050313070111072707032a000c060e000a040a0211080a06100014060100000000000000160a060f00150a060f010b010b040b030a02120138000b02110a170b061002142403330534110b020101000100010a110303050700110c2707032b0010001402020100000113110d0a00110e110320030b0b00010700110f270a000600000000000000000b010b00380112002d0002030000000103070329000200000002000100",
"bytecode": "0xa11ceb0b050000000b01000e020e0e031c5704730405773207a901f90308a2052006c205580a9a061b0cb506c2010df70706000000010002000300040005000600070800000806000210040106010009000100000a010200000b030100000c0104000616010100051706010004180704000119020200061a080100021b0a010106031c010200031d010100011e020200061f010100052006010001210202000222060b010609091009060c03030a01050300010302060c030101020107080001060c010503060c050301080102070b020109000900010b0201090005426c6f636b064572726f7273054576656e740f5265636f6e66696775726174696f6e055374616b650f53797374656d4164647265737365730954696d657374616d700d426c6f636b4d657461646174610d4e6577426c6f636b4576656e740e626c6f636b5f70726f6c6f677565186765745f63757272656e745f626c6f636b5f68656967687419696e697469616c697a655f626c6f636b5f6d657461646174610e69735f696e697469616c697a6564066865696768740e65706f63685f696e7465726e616c106e65775f626c6f636b5f6576656e74730b4576656e7448616e646c650565706f636805726f756e641470726576696f75735f626c6f636b5f766f7465730870726f706f7365721174696d655f6d6963726f7365636f6e6473106173736572745f6f7065726174696e67096173736572745f766d1469735f63757272656e745f76616c696461746f721072657175697265735f61646472657373127570646174655f676c6f62616c5f74696d650a656d69745f6576656e74196c6173745f7265636f6e66696775726174696f6e5f74696d650b7265636f6e6669677572650d6e6f745f7075626c69736865640e6173736572745f67656e65736973146173736572745f636f72655f7265736f7572636511616c72656164795f7075626c6973686564106e65775f6576656e745f68616e646c6500000000000000000000000000000000000000000000000000000000000000010308000000000000000003080100000000000000052000000000000000000000000000000000000000000000000000000000000000000520000000000000000000000000000000000000000000000000000000000a550c180002030d030e030f0b0201080101020511031203130a01140515030000000100053611040e0011050a040702210308050b080c06050e0a0411060c060b060313070111072707032a000c070e000a040a0511080a07100014060100000000000000160a070f00150a070f010b010b020b030b040a05120138000b05110a170b071002142403340535110b020101000100010a110303050700110c2707032b0010001402020100000113110d0a00110e110320030b0b00010700110f270a000600000000000000000b010b00380112002d0002030000000103070329000200000002000100",
"abi": {
"address": "0x1",
"name": "Block",
Expand Down Expand Up @@ -1037,16 +1037,20 @@
"generic_type_params": [],
"fields": [
{
"name": "round",
"name": "epoch",
"type": "u64"
},
{
"name": "proposer",
"type": "address"
"name": "round",
"type": "u64"
},
{
"name": "previous_block_votes",
"type": "vector<address>"
"type": "vector<bool>"
},
{
"name": "proposer",
"type": "address"
},
{
"name": "time_microseconds",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@
}
},
{
"bytecode": "0xa11ceb0b050000000b01000e020e0e031c5704730405773107a801f303089b052006bb05580a9306190cac06c0010dec0706000000010002000300040005000600070800000806000210040106010009000100000a010200000b030100000c01040006150101000516060100041707040001180202000619080100021a0a010106031b010200031c010100011d020200061e010100051f06010001200202000221060b010609091009050c03030a050500010302060c030101020107080001060c010503060c050301080102070b020109000900010b0201090005426c6f636b064572726f7273054576656e740f5265636f6e66696775726174696f6e055374616b650f53797374656d4164647265737365730954696d657374616d700d426c6f636b4d657461646174610d4e6577426c6f636b4576656e740e626c6f636b5f70726f6c6f677565186765745f63757272656e745f626c6f636b5f68656967687419696e697469616c697a655f626c6f636b5f6d657461646174610e69735f696e697469616c697a6564066865696768740e65706f63685f696e7465726e616c106e65775f626c6f636b5f6576656e74730b4576656e7448616e646c6505726f756e640870726f706f7365721470726576696f75735f626c6f636b5f766f7465731174696d655f6d6963726f7365636f6e6473106173736572745f6f7065726174696e67096173736572745f766d1469735f63757272656e745f76616c696461746f721072657175697265735f61646472657373127570646174655f676c6f62616c5f74696d650a656d69745f6576656e74196c6173745f7265636f6e66696775726174696f6e5f74696d650b7265636f6e6669677572650d6e6f745f7075626c69736865640e6173736572745f67656e65736973146173736572745f636f72655f7265736f7572636511616c72656164795f7075626c6973686564106e65775f6576656e745f68616e646c6500000000000000000000000000000000000000000000000000000000000000010308000000000000000003080100000000000000052000000000000000000000000000000000000000000000000000000000000000000520000000000000000000000000000000000000000000000000000000000a550c180002030d030e030f0b0201080101020411031205130a0514030000000100053511040e0011050a040702210308050b080c05050e0a0411060c050b050313070111072707032a000c060e000a040a0211080a06100014060100000000000000160a060f00150a060f010b010b040b030a02120138000b02110a170b061002142403330534110b020101000100010a110303050700110c2707032b0010001402020100000113110d0a00110e110320030b0b00010700110f270a000600000000000000000b010b00380112002d0002030000000103070329000200000002000100",
"bytecode": "0xa11ceb0b050000000b01000e020e0e031c5704730405773207a901f90308a2052006c205580a9a061b0cb506c2010df70706000000010002000300040005000600070800000806000210040106010009000100000a010200000b030100000c0104000616010100051706010004180704000119020200061a080100021b0a010106031c010200031d010100011e020200061f010100052006010001210202000222060b010609091009060c03030a01050300010302060c030101020107080001060c010503060c050301080102070b020109000900010b0201090005426c6f636b064572726f7273054576656e740f5265636f6e66696775726174696f6e055374616b650f53797374656d4164647265737365730954696d657374616d700d426c6f636b4d657461646174610d4e6577426c6f636b4576656e740e626c6f636b5f70726f6c6f677565186765745f63757272656e745f626c6f636b5f68656967687419696e697469616c697a655f626c6f636b5f6d657461646174610e69735f696e697469616c697a6564066865696768740e65706f63685f696e7465726e616c106e65775f626c6f636b5f6576656e74730b4576656e7448616e646c650565706f636805726f756e641470726576696f75735f626c6f636b5f766f7465730870726f706f7365721174696d655f6d6963726f7365636f6e6473106173736572745f6f7065726174696e67096173736572745f766d1469735f63757272656e745f76616c696461746f721072657175697265735f61646472657373127570646174655f676c6f62616c5f74696d650a656d69745f6576656e74196c6173745f7265636f6e66696775726174696f6e5f74696d650b7265636f6e6669677572650d6e6f745f7075626c69736865640e6173736572745f67656e65736973146173736572745f636f72655f7265736f7572636511616c72656164795f7075626c6973686564106e65775f6576656e745f68616e646c6500000000000000000000000000000000000000000000000000000000000000010308000000000000000003080100000000000000052000000000000000000000000000000000000000000000000000000000000000000520000000000000000000000000000000000000000000000000000000000a550c180002030d030e030f0b0201080101020511031203130a01140515030000000100053611040e0011050a040702210308050b080c06050e0a0411060c060b060313070111072707032a000c070e000a040a0511080a07100014060100000000000000160a070f00150a070f010b010b020b030b040a05120138000b05110a170b071002142403340535110b020101000100010a110303050700110c2707032b0010001402020100000113110d0a00110e110320030b0b00010700110f270a000600000000000000000b010b00380112002d0002030000000103070329000200000002000100",
"abi": {
"address": "0x1",
"name": "Block",
Expand Down Expand Up @@ -1037,16 +1037,20 @@
"generic_type_params": [],
"fields": [
{
"name": "round",
"name": "epoch",
"type": "u64"
},
{
"name": "proposer",
"type": "address"
"name": "round",
"type": "u64"
},
{
"name": "previous_block_votes",
"type": "vector<address>"
"type": "vector<bool>"
},
{
"name": "proposer",
"type": "address"
},
{
"name": "time_microseconds",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@
}
},
{
"bytecode": "0xa11ceb0b050000000b01000e020e0e031c5704730405773107a801f303089b052006bb05580a9306190cac06c0010dec0706000000010002000300040005000600070800000806000210040106010009000100000a010200000b030100000c01040006150101000516060100041707040001180202000619080100021a0a010106031b010200031c010100011d020200061e010100051f06010001200202000221060b010609091009050c03030a050500010302060c030101020107080001060c010503060c050301080102070b020109000900010b0201090005426c6f636b064572726f7273054576656e740f5265636f6e66696775726174696f6e055374616b650f53797374656d4164647265737365730954696d657374616d700d426c6f636b4d657461646174610d4e6577426c6f636b4576656e740e626c6f636b5f70726f6c6f677565186765745f63757272656e745f626c6f636b5f68656967687419696e697469616c697a655f626c6f636b5f6d657461646174610e69735f696e697469616c697a6564066865696768740e65706f63685f696e7465726e616c106e65775f626c6f636b5f6576656e74730b4576656e7448616e646c6505726f756e640870726f706f7365721470726576696f75735f626c6f636b5f766f7465731174696d655f6d6963726f7365636f6e6473106173736572745f6f7065726174696e67096173736572745f766d1469735f63757272656e745f76616c696461746f721072657175697265735f61646472657373127570646174655f676c6f62616c5f74696d650a656d69745f6576656e74196c6173745f7265636f6e66696775726174696f6e5f74696d650b7265636f6e6669677572650d6e6f745f7075626c69736865640e6173736572745f67656e65736973146173736572745f636f72655f7265736f7572636511616c72656164795f7075626c6973686564106e65775f6576656e745f68616e646c6500000000000000000000000000000000000000000000000000000000000000010308000000000000000003080100000000000000052000000000000000000000000000000000000000000000000000000000000000000520000000000000000000000000000000000000000000000000000000000a550c180002030d030e030f0b0201080101020411031205130a0514030000000100053511040e0011050a040702210308050b080c05050e0a0411060c050b050313070111072707032a000c060e000a040a0211080a06100014060100000000000000160a060f00150a060f010b010b040b030a02120138000b02110a170b061002142403330534110b020101000100010a110303050700110c2707032b0010001402020100000113110d0a00110e110320030b0b00010700110f270a000600000000000000000b010b00380112002d0002030000000103070329000200000002000100",
"bytecode": "0xa11ceb0b050000000b01000e020e0e031c5704730405773207a901f90308a2052006c205580a9a061b0cb506c2010df70706000000010002000300040005000600070800000806000210040106010009000100000a010200000b030100000c0104000616010100051706010004180704000119020200061a080100021b0a010106031c010200031d010100011e020200061f010100052006010001210202000222060b010609091009060c03030a01050300010302060c030101020107080001060c010503060c050301080102070b020109000900010b0201090005426c6f636b064572726f7273054576656e740f5265636f6e66696775726174696f6e055374616b650f53797374656d4164647265737365730954696d657374616d700d426c6f636b4d657461646174610d4e6577426c6f636b4576656e740e626c6f636b5f70726f6c6f677565186765745f63757272656e745f626c6f636b5f68656967687419696e697469616c697a655f626c6f636b5f6d657461646174610e69735f696e697469616c697a6564066865696768740e65706f63685f696e7465726e616c106e65775f626c6f636b5f6576656e74730b4576656e7448616e646c650565706f636805726f756e641470726576696f75735f626c6f636b5f766f7465730870726f706f7365721174696d655f6d6963726f7365636f6e6473106173736572745f6f7065726174696e67096173736572745f766d1469735f63757272656e745f76616c696461746f721072657175697265735f61646472657373127570646174655f676c6f62616c5f74696d650a656d69745f6576656e74196c6173745f7265636f6e66696775726174696f6e5f74696d650b7265636f6e6669677572650d6e6f745f7075626c69736865640e6173736572745f67656e65736973146173736572745f636f72655f7265736f7572636511616c72656164795f7075626c6973686564106e65775f6576656e745f68616e646c6500000000000000000000000000000000000000000000000000000000000000010308000000000000000003080100000000000000052000000000000000000000000000000000000000000000000000000000000000000520000000000000000000000000000000000000000000000000000000000a550c180002030d030e030f0b0201080101020511031203130a01140515030000000100053611040e0011050a040702210308050b080c06050e0a0411060c060b060313070111072707032a000c070e000a040a0511080a07100014060100000000000000160a070f00150a070f010b010b020b030b040a05120138000b05110a170b071002142403340535110b020101000100010a110303050700110c2707032b0010001402020100000113110d0a00110e110320030b0b00010700110f270a000600000000000000000b010b00380112002d0002030000000103070329000200000002000100",
"abi": {
"address": "0x1",
"name": "Block",
Expand Down Expand Up @@ -1037,16 +1037,20 @@
"generic_type_params": [],
"fields": [
{
"name": "round",
"name": "epoch",
"type": "u64"
},
{
"name": "proposer",
"type": "address"
"name": "round",
"type": "u64"
},
{
"name": "previous_block_votes",
"type": "vector<address>"
"type": "vector<bool>"
},
{
"name": "proposer",
"type": "address"
},
{
"name": "time_microseconds",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,7 @@
}
},
{
"bytecode": "0xa11ceb0b050000000b01000e020e0e031c5704730405773107a801f303089b052006bb05580a9306190cac06c0010dec0706000000010002000300040005000600070800000806000210040106010009000100000a010200000b030100000c01040006150101000516060100041707040001180202000619080100021a0a010106031b010200031c010100011d020200061e010100051f06010001200202000221060b010609091009050c03030a050500010302060c030101020107080001060c010503060c050301080102070b020109000900010b0201090005426c6f636b064572726f7273054576656e740f5265636f6e66696775726174696f6e055374616b650f53797374656d4164647265737365730954696d657374616d700d426c6f636b4d657461646174610d4e6577426c6f636b4576656e740e626c6f636b5f70726f6c6f677565186765745f63757272656e745f626c6f636b5f68656967687419696e697469616c697a655f626c6f636b5f6d657461646174610e69735f696e697469616c697a6564066865696768740e65706f63685f696e7465726e616c106e65775f626c6f636b5f6576656e74730b4576656e7448616e646c6505726f756e640870726f706f7365721470726576696f75735f626c6f636b5f766f7465731174696d655f6d6963726f7365636f6e6473106173736572745f6f7065726174696e67096173736572745f766d1469735f63757272656e745f76616c696461746f721072657175697265735f61646472657373127570646174655f676c6f62616c5f74696d650a656d69745f6576656e74196c6173745f7265636f6e66696775726174696f6e5f74696d650b7265636f6e6669677572650d6e6f745f7075626c69736865640e6173736572745f67656e65736973146173736572745f636f72655f7265736f7572636511616c72656164795f7075626c6973686564106e65775f6576656e745f68616e646c6500000000000000000000000000000000000000000000000000000000000000010308000000000000000003080100000000000000052000000000000000000000000000000000000000000000000000000000000000000520000000000000000000000000000000000000000000000000000000000a550c180002030d030e030f0b0201080101020411031205130a0514030000000100053511040e0011050a040702210308050b080c05050e0a0411060c050b050313070111072707032a000c060e000a040a0211080a06100014060100000000000000160a060f00150a060f010b010b040b030a02120138000b02110a170b061002142403330534110b020101000100010a110303050700110c2707032b0010001402020100000113110d0a00110e110320030b0b00010700110f270a000600000000000000000b010b00380112002d0002030000000103070329000200000002000100",
"bytecode": "0xa11ceb0b050000000b01000e020e0e031c5704730405773207a901f90308a2052006c205580a9a061b0cb506c2010df70706000000010002000300040005000600070800000806000210040106010009000100000a010200000b030100000c0104000616010100051706010004180704000119020200061a080100021b0a010106031c010200031d010100011e020200061f010100052006010001210202000222060b010609091009060c03030a01050300010302060c030101020107080001060c010503060c050301080102070b020109000900010b0201090005426c6f636b064572726f7273054576656e740f5265636f6e66696775726174696f6e055374616b650f53797374656d4164647265737365730954696d657374616d700d426c6f636b4d657461646174610d4e6577426c6f636b4576656e740e626c6f636b5f70726f6c6f677565186765745f63757272656e745f626c6f636b5f68656967687419696e697469616c697a655f626c6f636b5f6d657461646174610e69735f696e697469616c697a6564066865696768740e65706f63685f696e7465726e616c106e65775f626c6f636b5f6576656e74730b4576656e7448616e646c650565706f636805726f756e641470726576696f75735f626c6f636b5f766f7465730870726f706f7365721174696d655f6d6963726f7365636f6e6473106173736572745f6f7065726174696e67096173736572745f766d1469735f63757272656e745f76616c696461746f721072657175697265735f61646472657373127570646174655f676c6f62616c5f74696d650a656d69745f6576656e74196c6173745f7265636f6e66696775726174696f6e5f74696d650b7265636f6e6669677572650d6e6f745f7075626c69736865640e6173736572745f67656e65736973146173736572745f636f72655f7265736f7572636511616c72656164795f7075626c6973686564106e65775f6576656e745f68616e646c6500000000000000000000000000000000000000000000000000000000000000010308000000000000000003080100000000000000052000000000000000000000000000000000000000000000000000000000000000000520000000000000000000000000000000000000000000000000000000000a550c180002030d030e030f0b0201080101020511031203130a01140515030000000100053611040e0011050a040702210308050b080c06050e0a0411060c060b060313070111072707032a000c070e000a040a0511080a07100014060100000000000000160a070f00150a070f010b010b020b030b040a05120138000b05110a170b071002142403340535110b020101000100010a110303050700110c2707032b0010001402020100000113110d0a00110e110320030b0b00010700110f270a000600000000000000000b010b00380112002d0002030000000103070329000200000002000100",
"abi": {
"address": "0x1",
"name": "Block",
Expand Down Expand Up @@ -1037,16 +1037,20 @@
"generic_type_params": [],
"fields": [
{
"name": "round",
"name": "epoch",
"type": "u64"
},
{
"name": "proposer",
"type": "address"
"name": "round",
"type": "u64"
},
{
"name": "previous_block_votes",
"type": "vector<address>"
"type": "vector<bool>"
},
{
"name": "proposer",
"type": "address"
},
{
"name": "time_microseconds",
Expand Down
Loading

0 comments on commit e0545dd

Please sign in to comment.