Skip to content

Add an additional check that a datum being processed is already present in DAG rounds

When a datum in mempool is being processed (mempool_proc), the ledger accepts or declines it for adding in chain file. In case of DAG consensus, a generated event (dap_chain_cs_dag_event_t, for example, an emission) can be accepted multiple times because there's no check that the datum hash is already in the DAG rounds, and hence the same datum can appear in more than one event in chain. During processing the datum, there must be a check, whether its' hash already exists in DAG rounds not to be accepted twice.

An example of two events containing the same emission datum:

Event 0x0177B867A362BE15867516838AC229B165DF18EC52BD5EF731F6A19FF6ED9286:
		Header:
				version: 0x00
				round ID: 121637
				cell_id: 0x0000000000000000
				chain_id: 0x0000000000000000
				ts_created: Tue Nov  8 14:07:40 2022

				hashes:	count: 1
						hash: 0x044F30E930815B03C054D4985ED21E321D0F62B8246A6637E8E157AAB269E7BE
				datum:	datum_size: 10486
						version:=0x00
						type_id:=DATUM_TOKEN_EMISSION
						ts_create=Tue Nov  8 14:05:41 2022

						data_size=10471
				signs:	count: 4
						type: sig_dil	pkey_hash: 0xCB73427D1124F5EA8068EEFA5AEC91D37888561ED43E737AFD0D08A07BE67809
						type: sig_dil	pkey_hash: 0x16CE0C102C4288EB9816D0A411809424DB6D909DDDEFD5D67EF38F177DAF6511
						type: sig_dil	pkey_hash: 0x3B244B31B4DC6DD7791FE34A67712BDD7647648BB9089D0266A6CC245AF70DE4
						type: sig_dil	pkey_hash: 0xC86097F89235528299547068958B2F3625A655B4FE89301E17625930F222FFE2
emission: hash 0x6BC7E632218305968C0E592714C1291A21883AEB0E0EDCC72E68C86B81505477
	9.975(9975000000000000000) CELL, type: AUTH, version: 2
  to addr: Rj7J7MiX2bWy8sNybV8YT5hj5RxYCbjjBjjbUuM7tzUoYjr3FJCkRh2d1RRumdLYHMpE4GpvGiSQ9BBiDSr6EQfzN5Mq7RzhHbXR4Nvy
  signs_count: 3
  tsd_total_size: 240
signatures: 
1) 0xAD56D4158CB5BEDD0C2633D0A0E9E2708E8EFEC59DDBDEB59D76C0F3EF20B4D3, sig_dil, 2096 bytes
2) 0xE2A835AAFC642A84611ED116D606C87166A1E7B6CAD6EF0E188F3CEB008679BF, sig_dil, 2096 bytes
3) 0x590CA116C6216D0BA212838D1A04C4109A0745C344BAD4D847350CBF90BDAC14, sig_dil, 2096 bytes

================================================================================================

Event 0x29F58C8A7A764CCE39AB8380621F95A82DF4166221122A1606C2F0ED0329C16C:
		Header:
				version: 0x00
				round ID: 121636
				cell_id: 0x0000000000000000
				chain_id: 0x0000000000000000
				ts_created: Tue Nov  8 14:06:29 2022

				hashes:	count: 1
						hash: 0x131DCEBC2FDC8CF1DC7028182130E8B94FDF26198D2363ACF3F7811134DB3E93
				datum:	datum_size: 10486
						version:=0x00
						type_id:=DATUM_TOKEN_EMISSION
						ts_create=Tue Nov  8 14:05:41 2022

						data_size=10471
				signs:	count: 4
						type: sig_dil	pkey_hash: 0xCB73427D1124F5EA8068EEFA5AEC91D37888561ED43E737AFD0D08A07BE67809
						type: sig_dil	pkey_hash: 0x16CE0C102C4288EB9816D0A411809424DB6D909DDDEFD5D67EF38F177DAF6511
						type: sig_dil	pkey_hash: 0xC86097F89235528299547068958B2F3625A655B4FE89301E17625930F222FFE2
						type: sig_dil	pkey_hash: 0x3B244B31B4DC6DD7791FE34A67712BDD7647648BB9089D0266A6CC245AF70DE4
emission: hash 0x6BC7E632218305968C0E592714C1291A21883AEB0E0EDCC72E68C86B81505477
	9.975(9975000000000000000) CELL, type: AUTH, version: 2
  to addr: Rj7J7MiX2bWy8sNybV8YT5hj5RxYCbjjBjjbUuM7tzUoYjr3FJCkRh2d1RRumdLYHMpE4GpvGiSQ9BBiDSr6EQfzN5Mq7RzhHbXR4Nvy
  signs_count: 3
  tsd_total_size: 240
signatures: 
1) 0xAD56D4158CB5BEDD0C2633D0A0E9E2708E8EFEC59DDBDEB59D76C0F3EF20B4D3, sig_dil, 2096 bytes
2) 0xE2A835AAFC642A84611ED116D606C87166A1E7B6CAD6EF0E188F3CEB008679BF, sig_dil, 2096 bytes
3) 0x590CA116C6216D0BA212838D1A04C4109A0745C344BAD4D847350CBF90BDAC14, sig_dil, 2096 bytes