๋ฉ์ธ ๋ท, db-sync 6.0.1, ์ง๋ถ ์ฃผ์ stake1u838ke609j09ezrgj5nwnplvc7g3cq62pa2n9z0x6w3clhsagtp86
๋ฑ๋ก ๋ด์ญ
SELECT stake_registration.addr_id, block.epoch_no, block.time
FROM stake_address
LEFT JOIN stake_registration ON stake_registration.addr_id = stake_address.id
LEFT JOIN tx ON tx.id = stake_registration.tx_id
LEFT JOIN block ON block.id = tx.block_id
WHERE stake_address.view = 'stake1u838ke609j09ezrgj5nwnplvc7g3cq62pa2n9z0x6w3clhsagtp86';
addr_id | epoch_no | time
---------+----------+---------------------
38278 | 208 | 2020-08-01 07:45:51
38278 | 233 | 2020-12-01 22:31:13
(2 rows)
๋ฑ๋ก ์ทจ์ ๋ด์ญ
SELECT stake_deregistration.addr_id, block.epoch_no, block.time
FROM stake_address
LEFT JOIN stake_deregistration ON stake_deregistration.addr_id = stake_address.id
LEFT JOIN tx ON tx.id = stake_deregistration.tx_id
LEFT JOIN block ON block.id = tx.block_id
WHERE stake_address.view = 'stake1u838ke609j09ezrgj5nwnplvc7g3cq62pa2n9z0x6w3clhsagtp86';
addr_id | epoch_no | time
---------+----------+---------------------
38278 | 232 | 2020-12-01 18:25:59
(1 row)
๋ณด์๋ค์ํผ, ์ฃผ์๋ 232 ์ํฌํฌ๊ฐ ๋๋ ๋ ๋ฑ๋ก๋์ง ์์์ผ๋ฉฐ ์ํฌํฌ 231์ ๋ํ ๋ณด์์์ด ์ฃผ์๋ก ๋ถ๋ฐฐ๋์ง ์์์ผํฉ๋๋ค.
SELECT reward.*, block.epoch_no AS block_epoch_no, block.time
FROM reward
LEFT JOIN block ON block.id = reward.block_id
WHERE reward.addr_id = 38278 AND reward.epoch_no = 231;
id | addr_id | amount | epoch_no | pool_id | block_id | block_epoch_no | time
---------+---------+-----------+----------+---------+----------+----------------+---------------------
1041508 | 38278 | 192969560 | 231 | 144 | 5023676 | 233 | 2020-12-01 21:44:51
(1 row)
: ํ์ด์ค ํ :
์ ์ ๋์ ์ด๊ฒ์๋ณด๊ณ ๊ฐ์๊ธฐ ์ฒซ ๋ฒ์งธ ์ฟผ๋ฆฌ๊ฐ @dmitrystas ๊ฐ ๋ณด์ฌ์ค ๊ฒ์ ๋ณด์ฌ์ฃผ์ง ์๋๋ค๋ ๊ฒ์ ๊นจ๋ฌ์์ต๋๋ค. tx.id = stake_registration.tx_id
์ ๊ฐ์
ํ ๋ค์ ๊ฑฐ๋์์ block.epoch_no
๋ฅผ ๊ฐ์ ธ ์ค๋ฉด ์คํ
์ดํฌ ๋ฑ๋ก / ํด์ฒด๊ฐ ๋ฐ์ํ๋ ์๋๋ฅผ ์ป์ ์ ์์ง๋ง ์ค์ ๋ก ํ์ฑํ ๋ ์๊ธฐ๋ ์ป์ ์ ์์ต๋๋ค.
์คํ
์ด ํน๊ณผ ๊ด๋ จ๋ ๋๋ถ๋ถ์ ์์
์ ๊ฒฝ์ฐ N
์ํฌํฌ์์ ๋ฐ์ํ๋ ๋์ (๋ฑ๋ก, ์คํ
์ด ํน ๊ธ์ก ์ฆ๊ฐ ๋ฑ)์ด N + 2
ํ์ฑํ ๋ฉ๋๋ค.
์ฆ, ์ฒซ ๋ฒ์งธ ์ฟผ๋ฆฌ๋ ์ค์ ๋ก ๋ค์๊ณผ ๊ฐ์์ผํฉ๋๋ค.
cexplorer=# SELECT stake_registration.addr_id, block.epoch_no + 2 as epoch_no, block.time FROM stake_address
INNER JOIN stake_registration ON stake_registration.addr_id = stake_address.id
INNER JOIN tx ON tx.id = stake_registration.tx_id INNER JOIN block ON block.id = tx.block_id
WHERE stake_address.view = 'stake1u838ke609j09ezrgj5nwnplvc7g3cq62pa2n9z0x6w3clhsagtp86';
addr_id | epoch_no | time
---------+----------+---------------------
38266 | 210 | 2020-08-01 07:45:51
38266 | 235 | 2020-12-01 22:31:13
๊ทธ๋ฆฌ๊ณ ๋ ๋ฒ์งธ :
cexplorer=# SELECT stake_deregistration.addr_id, block.epoch_no + 2 as epoch_no, block.time FROM stake_address
INNER JOIN stake_deregistration ON stake_deregistration.addr_id = stake_address.id
INNER JOIN tx ON tx.id = stake_deregistration.tx_id INNER JOIN block ON block.id = tx.block_id
WHERE stake_address.view = 'stake1u838ke609j09ezrgj5nwnplvc7g3cq62pa2n9z0x6w3clhsagtp86';
addr_id | epoch_no | time
---------+----------+---------------------
38266 | 234 | 2020-12-01 18:25:59
@dmitrystas ๊ทธ ๋ชจ๋ ๊ฒ์ด active_epoch_no
๋ฐ๋ ์ด stake_registration
๋ฐ stake_deregistration
I์ด (๊ฐ)์ด ๊ฐ์ ํ
์ด๋ธ์ delegation
ํ
์ด๋ธ์?
@erikd ์๋
ํ์ธ์. ๊ทธ๊ฒ์ ์๋ ๋ฌธ์ ์
๋๋ค https://github.com/Emurgo/yoroi-frontend/issues/1832#issue -754776885
์๋ง๋ ์ ์ฉ ํ ์ ์์ต๋๋ค
Yoroi & Adalite๋ ์๋ชป๋ 192 FAKE ADA ๋ณด์์ ๋ณด์ฌ ์ฃผ์ง๋ง ์ค์ ๋ก๋ 0์
๋๋ค. ๋ง์ง๋ง 2 ๊ฐ์ ๋ณด์์ adawallet.io๋ฅผ ํตํด ์ธ์ถ๋ฉ๋๋ค (db-sync๋ฅผ ์ฌ์ฉํ์ง ์์).
๋จ๊ณ๋ณ ๋ฌธ์ ์ ๋ํ ๊ฐ๋จํ ์ค๋ช
:
1) ์ํฌํฌ 232 . ๋๋ ๋ณด์์ ์ฒ ํํ๊ณ ๋์์ ์คํ
์ด ํน ํค ๋ฅผ
2) ์ํฌํฌ 233 . ํค๊ฐ ๋ฑ๋ก ๋ ๊ฒฝ์ฐ ๋จผ์ ๋จ์ ๋ณด์์ ๋ฐ์์ผํ๋๋ฐ, ๊ทธ๋ ์ง ์์ ๊ฒฝ์ฐ Yoroi๊ฐ 192ADA๋ฅผ ๋ฐ์๋ค๊ณ ํ์ํฉ๋๋ค. ์ถ๊ธ์ ์๋ํ๋ฉด Yoroi๊ฐ ์ค๋ฅ๋ฅผ ๋ฐ์์ํต๋๋ค. db-sync show reward 0ADA๋ฅผ ์ฌ์ฉํ์ง ์๋ ๋ค๋ฅธ ์ง๊ฐ
3) ์ํฌํฌ 233 . ๋ค์ ๊ฐ์ ํ์ ์์ํฉ๋๋ค. ํค๊ฐ ๋ฑ๋ก๋์์ต๋๋ค . ์ง์ ํ ๋ณด์ 0. Yoroi ๋ณด์ 192.
4) ์ํฌํฌ 234 . ๋จ์ ๋ ๋ฒ์งธ ๋ณด์ 135ADA๋ฅผ๋ฐ์ต๋๋ค. ์ค์ ๋ณด์ ์์ก์ 135ADA์
๋๋ค.
Yoroi๋ 327ADA (192 + 135)๋ฅผ ๋ณด์ฌ์ค๋๋ค. ์๋ก์ด๋ฅผ ํตํด ์ด๋ค ๋ณด์๋ ์ธ์ถ ํ ์ ์์ต๋๋ค. ๊ฑฐ๋๋ฅผ ๋ณด๋ด๋ ๋์ ์๋ฒ์์ ์ค๋ฅ๋ฅผ ๋ฐ์์ต๋๋ค.
5) ์ํฌํฌ 235 . ๋ง์ง๋ง ์ธ ๋ฒ์งธ ๋ณด์ ์ธ 145ADA๋ฅผ ๋ฐ์์ต๋๋ค. ์ค์ ๋ณด์ ์์ก์ 280ADA (135 + 145)์
๋๋ค.
Yoroi๋ 472ADA๋ฅผ ๋ณด์ฌ์ค๋๋ค. (192 + 135 + 145) Yoroi๋ฅผ ํตํด ์ด๋ค ๋ณด์๋ ์ธ์ถ ํ ์ ์์ต๋๋ค. ํธ๋์ญ์
์ ๋ณด๋ด๋ ๋์ ์๋ฒ์์ ์ค๋ฅ๋ฅผ ๋ฐ์์ต๋๋ค.
6) ์ํฌํฌ 235 . db-syns๋ฅผ ์ฌ์ฉํ์ง ์๋ adawallet.io๋ฅผ ํตํด ์ํํ๊ฒ 280ADA๋ฅผ ์ธ์ถํ๊ณ ์ ํํ ๋ณด์ ์์ก์ ๋ณด์ฌ์ค๋๋ค 280ADA
7) 280ADA์ ์ค์ ๋ณด์์ด ์ฒ ํ ๋ ํ์๋ (0ADA๋ก ๋จ์ ์์) Yoroi๋ ์ฌ์ ํ ๋ณด์ ์์ก 192ADA๋ฅผ ๋ณด์ฌ์ค๋๋ค.
Yoroi๋ ์ฌ์ ํ ๋ณด์ ์์ก 192ADA๋ฅผ ๋ณด์ฌ์ค๋๋ค.
์ ์ด๋ ๋ ๊ฐ์ง ๊ฐ๋ฅ์ฑ์ด ์์ต๋๋ค.
db-sync
๋ฒ๊ทธ๊ฐ ์์ต๋๋ค๋๋ db-sync
๋ง ์ฒ๋ฆฌํฉ๋๋ค. ์ฆ, Yoroi์ ์ ๋ณด๊ฐ ์๋ SQL ์ฟผ๋ฆฌ๋ก ๋ฌธ์ ๊ฐ ํ์๋์ด์ผํฉ๋๋ค.
stake1u838ke609j09ezrgj5nwnplvc7g3cq62pa2n9z0x6w3clhsagtp86
๊ฐ ์ฌ๊ธฐ์ ๊ด์ฌ์ ๋์์ด๋ฉ๋๊น?
@erikd yes ์คํ
์ดํฌ ํค๋ ์คํ
์ดํฌ์
๋๋ค.
Yoroi๋ฟ๋ง ์๋๋ผ Adalite.io ๋ฐ adastat.net์๋ ํด๋น ๋ฒ๊ทธ๊ฐ ์์ต๋๋ค.
Theese์๋ ํด๋น ๋ฒ๊ทธ๊ฐ ์์ต๋๋ค : cardanoscan.io ๋ฐ adawallet.io
์ผ๋ถ ์จ๋ผ์ธ ์ง๊ฐ์๋์ด ๋ฒ๊ทธ๊ฐ ์๊ณ ๋ค๋ฅธ ์ง๊ฐ์๋ ๋ฒ๊ทธ๊ฐ์๊ณ ์ด ๋ชจ๋ ๊ฒ์ด db-sync
์ ์์กดํ๋ค๋ฉด ๋ฌธ์ ๋ db-sync
์์์ ๊ฐ๋ฅ์ฑ์ด ๋งค์ฐ ๋ฎ์ต๋๋ค.
@erikd ํ์ง๋ง adawallet.io๋ db-sync๋ฅผ ์ฌ์ฉํ์ง ์๊ณ ์ฌ๋ฐ๋ฅธ ๋ณด์ ์์ก (0ADA)์ ๋ณด์ฌ ์ฃผ๋ฏ๋ก ๋ง์ง๋ง ๋ณด์์ ์ธ์ถ ํ ์ ์์ต๋๋ค.
๋ค์ ์ด๊ฒ์ ์ด๊ฒ์ด db-sync
๋ฒ๊ทธ๊ฐ ์๋๋ผ Yoroi ๋ฒ๊ทธ์์ ์์ฌํฉ๋๋ค.
์ถ์ ๊ตฝ๊ธฐ์์๋์ด ๋ฒ๊ทธ๊ฐ ๋ฐ์ํ์ต๋๋ค.
์ด๊ฒ์ ํ์คํ cardano-db-sync ๋ฒ๊ทธ์ด๋ฉฐ Yoroi๋ฟ๋ง ์๋๋ผ cardano-db-sync์ ์ฌ๋ฌ ๋ค๋ฅธ ์ฌ์ฉ์์๊ฒ ์ํฅ์ ๋ฏธ์น๋ ๋ฐฉ์์ ๊ณ ๋ คํ ๋ Yoroi ๋ฒ๊ทธ๊ฐ ์๋๋๋ค. cardanoscan๊ณผ adawallet์ ๋ชจ๋ cardano-db-sync๋ฅผ ์ฌ์ฉํ์ง ์์ผ๋ฏ๋ก ์ํฅ์๋ฐ์ง ์์ต๋๋ค.
@IlyaSofronov์์ ์ ๊ณต ํ ์ฃผ์์ ๋ํ ๋ณด์ ๋ด์ญ์ ์ ๊ณตํ๋ SQL ์ฟผ๋ฆฌ๋ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
select stake_address.hash_raw as "stakeAddress"
, "totalReward".*
from stake_address
left outer join (
SELECT addr_id, amount, epoch_no
FROM reward
) as "totalReward" on stake_address.id = "totalReward".addr_id
where encode(stake_address.hash_raw, 'hex') = 'e1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde'
๋ค์ ๊ฒฐ๊ณผ๋ฅผ ์ ๊ณตํฉ๋๋ค
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 162720747 | 211
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 162485461 | 212
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 167344099 | 213
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 167043060 | 214
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 200722225 | 215
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 191413549 | 216
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 143111843 | 217
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 147836812 | 218
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 154740829 | 219
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 145433327 | 220
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 165631299 | 221
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 151825651 | 222
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 169141624 | 223
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 165184716 | 224
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 148899668 | 225
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 157838234 | 226
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 223252352 | 227
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 147889017 | 228
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 151858721 | 229
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 165782849 | 230
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 192969560 | 231
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 135711434 | 232
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 145964545 | 233
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 100702 | 235
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 102078 | 236
์ฐธ๊ณ :์ด ํ์ ํฉ๊ณ๋ 3,765,004,402์ ๋๋ค.
{
"remainingAmount": "193172340",
"rewards": "3765004402",
"withdrawals": "3571832062",
}
๋ฐฑ์๋๊ฐ rewards
๊ฐ์ ๋ํ db-sync ํ์ ํฉ๊ณ๋ฅผ ๋ฐํํ๋ ๊ฒ์ ๋ณผ ์ ์์ต๋๋ค (์ด ๋ฌธ์ ๊ฐ ๋์ค์ ๋ฐ์ํ ์ด์ ๋ฅผ ์ค๋ช
ํฉ๋๋ค).
์ด ๋ฒ๊ทธ์ ์ํฅ์๋ฐ์ง ์๋๋ค๋ ๊ฒ์ ์๊ณ ์๋ cardanoscan์ ๊ฐ์ ํฉ์ฐ ํ์ฌ withdrawals
๊ธ์ก์ด ์ ํํ์ง ํ์ธํ ์๋ ์์ต๋๋ค.
remainingAmount
์ (๋) rewards - withdrawals
์ด ์คํ ์ด ํน ํค์ ๋ด์ญ์ ๋ณด๋ฉด ๋ค์์ ํ์ธํ ์ ์์ต๋๋ค.
๋ด cardano-node ์ธ์คํด์ค์ ๋ฐ๋ฅด๋ฉด ์ด๊ฒ์ ์คํ ์ด ํน ์ฃผ์ ๋ด์ ํ์ฌ ๊ฐ์ ๋๋ค.
[
{
"address": "stake1u838ke609j09ezrgj5nwnplvc7g3cq62pa2n9z0x6w3clhsagtp86",
"delegation": "pool1kkfkdces5mdcyc9dn2hgg3463jggjvw3h89nejjarkz25uavaqu",
"rewardAccountBalance": 202780
}
]
๋ฐ๋ผ์ ๋ ธ๋์ ๋ฐ๋ผ ์ง๊ฐ์ ์์ก์ด epoch 235 + epoch 236 (100702 + 102078 = 202780)์์ ์ ์ ์์ต๋๋ค.
cardanoscan ์ ๋ณด๋ฉด ์ง๊ฐ์ ์ ์ฒด ์ถ๊ธ ๋ด์ญ์ ๋ณผ ์ ์์ต๋๋ค. ๊ฐ ์ธ์ถ์ ํด๋นํ๋ ๋ด์ฉ์ ์ดํด ๋ณด๊ฒ ์ต๋๋ค.
| Epoch ์ฒ ํ | ์ธ์ถ ๊ธ์ก | db-sync epoch ํ ํฌํจ |
| ----------------- | ------------------ | ------------ ----------------- |
| 228 | 2601.373144 | 211, 212, ..., 225, 226 |
| 230 | 371.141369 | 227, 228 |
| 232 | 317.641570 | 229, 230 |
| 234 | 135.711434 | 232 |
| 235 | 145.964545 | 233 |
๊ทธ๋ฌ๋ cardano-db-sync (192969560)์ epoch 231์ ์ด๋ค ์ค ์ด๋ ๊ฒ๋ ํฌํจ๋์ง ์์์ ์ ์ ์์ต๋๋ค!
๋ฌผ๋ก ๋ฐฑ์๋ ์๋ต "remainingAmount": "193172340",
๋ฅผ๋ณด๊ณ ์๋ชป ํฌํจ ๋ epoch 231์ ์ ๊ฑฐํ๋ฉด 193172340 - 192969560 = 202780
์ด๋ ํ ๋
ธ๋์์ ์์๋๋ ๊ฒฐ๊ณผ์
๋๋ค!
๋ด ์กฐ์ฌ์ ๋ฐ๋ฅด๋ฉด cardano-db-sync๊ฐ ๋ณด์ ๋ด์ญ ๊ฒฐ๊ณผ์ 231 ํ์ ํฌํจํด์๋ ์๋๋ ๊ฒ ๊ฐ์ต๋๋ค.
์ฒซ ๋ฒ์งธ ์ฟผ๋ฆฌ๋ฅผ ๋จ์ํํ๊ณ ๋์ผํ ๊ฒฐ๊ณผ๋ฅผ ์ป์๋์ง ํ์ธํ์ต๋๋ค.
๋ฐฑ์๋์ ํ์ฌ (์๋ชป๋) ์ํ
๋จ์ผ ์์ค์์ ๋ชจ๋ ์ ๋ณด๋ฅผ ์ป๊ณ ์ถ์ต๋๋ค.
cexplorer=# select sum (amount) from stake_address
left outer join (SELECT addr_id, amount, epoch_no
FROM reward) as "totalReward" on stake_address.id = "totalReward".addr_id
where stake_address.hash_raw = '\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde' ;
sum
------------
3765004402
๊ณผ:
cexplorer=# select sum (amount) from withdrawal where addr_id = 38266;
sum
------------
3571832062
๋ ๋ค ๋น์ ์ ์์น์ ์ผ์นํฉ๋๋ค.
ํฅ๋ฏธ๋กญ๊ฒ๋ 3571832062 + 192969560 + 202780 - 3765004402
์ฌ๊ธฐ์ 3571832062
๋ ์ธ์ถ ํฉ๊ณ์ด๊ณ 3765004402
๋ ๋ณด์ ํฉ๊ณ์
๋๋ค. ๋ค๋ฅธ ๊ฐ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค. 202780
๋ ์ธ์ถ ํ ๋ณด์ ์์ก์ ๋ํ ์์น์ด๊ณ 192969560
๋ 231
์ํฌํฌ์ ๋ํ ๋ณด์์
๋๋ค.
cexplorer=# select stake_address.view as "stakeAddress", "totalReward".* from stake_address
left outer join (SELECT addr_id, amount, epoch_no FROM reward) as "totalReward"
on stake_address.id = "totalReward".addr_id
where stake_address.hash_raw = '\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde'
and epoch_no = 231 ;
stakeAddress | addr_id | amount | epoch_no
-------------------------------------------------------------+---------+-----------+----------
stake1u838ke609j09ezrgj5nwnplvc7g3cq62pa2n9z0x6w3clhsagtp86 | 38266 | 192969560 | 231
๊ทธ๋ ๋ค๋ฉด ๊ทธ ๋ณด์์ 231
( db-sync
๋จ์ํ ์์ฅ ์ํ์์ ๊บผ๋ด ์ถ๊ฐ ์ฒ๋ฆฌ์์ด ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ์ฝ์
ํจ)๊ฐ ๋ง์ต๋๊น? ํด๋น ์คํ
์ดํฌ ์ฃผ์์ ๋ํ ์คํ
์ดํฌ ๋ฑ๋ก ๋ด์ญ์ ์ดํด ๋ณด๊ฒ ์ต๋๋ค.
cexplorer=# select stake_address.hash_raw, stake_registration.tx_id, block.epoch_no
as tx_epoch_no, (block.epoch_no + 2) as active_epoch_no
from stake_registration inner join stake_address on stake_registration.addr_id = stake_address.id
inner join tx on tx.id = stake_registration.tx_id inner join block on tx.block_id = block.id
where stake_address.hash_raw = '\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde' ;
hash_raw | tx_id | tx_epoch_no | active_epoch_no
--------------------------------------------------------------+---------+-------------+-----------------
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 2449294 | 208 | 210
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 3103705 | 233 | 235
(2 rows)
cexplorer=# select stake_address.hash_raw, stake_deregistration.tx_id, block.epoch_no
as tx_epoch_no, (block.epoch_no + 2) as active_epoch_no from stake_deregistration
inner join stake_address on stake_deregistration.addr_id = stake_address.id
inner join tx on tx.id = stake_deregistration.tx_id inner join block
on tx.block_id = block.id
where stake_address.hash_raw = '\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde' ;
hash_raw | tx_id | tx_epoch_no | active_epoch_no
--------------------------------------------------------------+---------+-------------+-----------------
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 3101670 | 232 | 234
๋ฑ๋ก ๋ฐ ๋ฑ๋ก ์ทจ์ ๋ชจ๋์ ๋ํด tx_id
(๋ฑ๋ก / ํด์ ๋ฅผ ํฌํจํ๋ tx์ ID), tx_epoch_no
(tx๊ฐ ํฌํจ ๋ epoch) ๋ฐ active_epoch_no
(๋ฑ๋ก / ํด์ฒด๊ฐ ํ์ฑํ๋๋ ์๋).
ํ์ฑํ ๋ ์ํฌํฌ ๋ฒํธ๋ฅผ ๋ณด๋ฉด ์คํ
์ดํฌ ๋ฑ๋ก์ด ์ํฌํฌ [210 .. 233]
๋ฐ [235 ..]
์ ํ์ฑํ๋์ด ์์ด์ผํฉ๋๋ค. ์ด๊ฒ์์ด ์ฃผ์์ ๋ํ ์ค์ ๋ณด์๊ณผ ์ผ์นํฉ๋๋ค.
cexplorer=# select stake_address.hash_raw as "stakeAddress", "totalReward".* from stake_address
left outer join (SELECT addr_id, amount, epoch_no FROM reward) as "totalReward"
on stake_address.id = "totalReward".addr_id
where stake_address.hash_raw = '\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde' ;
stakeAddress | addr_id | amount | epoch_no
--------------------------------------------------------------+---------+-----------+----------
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 162720747 | 211
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 162485461 | 212
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 167344099 | 213
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 167043060 | 214
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 200722225 | 215
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 191413549 | 216
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 143111843 | 217
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 147836812 | 218
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 154740829 | 219
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 145433327 | 220
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 165631299 | 221
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 151825651 | 222
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 169141624 | 223
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 165184716 | 224
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 148899668 | 225
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 157838234 | 226
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 223252352 | 227
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 147889017 | 228
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 151858721 | 229
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 165782849 | 230
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 192969560 | 231
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 135711434 | 232
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 145964545 | 233
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 100702 | 235
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 102078 | 236
(25 rows)
์ฆ, 234
์ ์ธํ ๋ชจ๋ ์ธ๋์ ๋ํ ๋ณด์์ด ์์ต๋๋ค.
๋ฐ๋ผ์ ๋๋ ๋น์ ์ ๊ฒฐ๋ก ์ ์๊ฐํฉ๋๋ค.
๋ด ์กฐ์ฌ์ ๋ฐ๋ฅด๋ฉด cardano-db-sync๊ฐ ๋ณด์ ๋ด์ญ ๊ฒฐ๊ณผ์ 231 ํ์ ํฌํจํด์๋ ์๋๋ ๊ฒ ๊ฐ์ต๋๋ค.
์ ํํ์ง ์์ ๊ฒฝ์ฐ ํด๋น ์คํ
์ดํฌ ์ฃผ์์๋ 231
์ํฌํฌ์ ๋ํ ๋ณด์์ด ์์ด์ผํฉ๋๋ค .
๋ํ ๊ทํ์ ์๊ฒฌ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
๋ฐฑ์๋์ ํ์ฌ (์๋ชป๋) ์ํ
{
"remainingAmount": "193172340",
"๋ณด์": "3765004402",
"์ถ๊ธ": "3571832062",
}
์ค์ ๋ก ์ ํํฉ๋๋ค. ๋ณด์ ๊ฐ์น์ ์ธ์ถ ๊ฐ์น์ ์ฐจ์ด๋ ํ์ฌ ์ธ์ถ๋์ง ์์ ๋ณด์ ์์ก์ ๋๋ค.
์ค์ ๋ก ์ ํํฉ๋๋ค. ๋ณด์ ๊ฐ์น์ ์ธ์ถ ๊ฐ์น์ ์ฐจ์ด๋ ํ์ฌ ์ธ์ถ๋์ง ์์ ๋ณด์ ์์ก์ ๋๋ค.
์ฐ๋ฆฌ๋ ๋
ธ๋๊ฐ ์ ์์ผ๋ก ๋์ ์๊ณ ์๊ธฐ ๋๋ฌธ์ ๊ทธ ๊ฒฝ์ฐ๊ฐ ๋ ์ ์์ต๋๋ค 202780
๊ณ์ ์ ๋ํ ๋ณด์์ ๊ท ํ ๋ฑ์ด ์๋ 193172340
์ฆ, 234๋ฅผ ์ ์ธํ ๋ชจ๋ ์๋์ ๋ํ ๋ณด์์ด ์์ต๋๋ค.
๋ ์๋๊ฐ ๋๋ฝ ๋ ๊ฒ์ผ๋ก ์์ํด์ผํฉ๋๋ค.
๋๋ฝ ๋ 234
epoch๋ (2)์ ํด๋นํ๊ณ 231์ (1)์ ํด๋นํ๋ค๊ณ ์๊ฐํฉ๋๋ค. (1)
๋ ์๋๊ฐ ๋๋ฝ ๋ ๊ฒ์ผ๋ก ์์ํด์ผํฉ๋๋ค.
์? ์ด ์คํ ์ดํฌ ์ฃผ์์ ๋ํ ์ด์์ ๋ฐ๋ฅด๋ฉด :
| ์ด์ | tx_epoch_no | active_epoch_no |
| ------------------- | --------------------- | ------- --------- |
| ๋ฑ๋ก | 208 | 210 |
| deregistraion | 232 | 234 |
| ๋ฑ๋ก | 233 | 235 |
๋จ์ผ ์ํฌํฌ ( 234
)์ ๋ํด์๋ง ๋ฑ๋ก์ด ์ทจ์๋์์ผ๋ฉฐ ํด๋น ์ํฌํฌ์ ๋ํ ๋ณด์์๋ฐ์ง ๋ชปํ์ต๋๋ค.
๋ณด์์ด์๋ ๋ ์๋๊ฐ์๋ ์ด์ ๋ ๋ฌด์์ ๋๊น? ๋๋ ๋น์ ์ด ์ธ๊ธ ํ ๋ ๊ฐ์ง ์ฌ๋ก๊ฐ ์ค์ ๋ก ๋์ผํ ๊ฒ์ด๋ผ๊ณ ํ์ ํ๋ฏ๋ก ๋ณด์ ์์ด๋ ๋จ ํ๋์ ์๋ ๋ง ์งํ๋ฉ๋๋ค.
Slack์ @SebastienGllmt ๋ ๋ค์๊ณผ ๊ฐ์ด ๋งํ์ต๋๋ค.
๋ฑ๋ก ์ทจ์๋ 2 epoch๊ฐ ์๋๋ผ ์ฆ์ ์ํ๋๋ค๋ ์ ์์ ํน๋ณํฉ๋๋ค.
๋ฑ๋ก ์ทจ์๊ฐ ์ฆ์ ์งํ๋๋ฉด tx_epoch_no == 232
ํ์ผ๋ฏ๋ก 231์ ๋ํ ๋ณด์๋ฟ๋ง ์๋๋ผ epochs [231..234]
๋ํ ๋ณด์์ด ๋ชจ๋ ์์ค๋ฉ๋๋ค.
@JaredCorduan ์ด ํ์ํ๋ค๊ณ ์๊ฐํฉ๋๋ค.
@SebastienGllmt ์ ์ค๋ช ์ ์์ฅ ๊ท์น๊ณผ ์ผ์นํฉ๋๋ค.
์คํ
์ดํฌ ์๊ฒฉ ์ฆ๋ช
์ด ๋ฑ๋ก ์ทจ์๋๋ ๊ฒ์ ๋ค์ ์ฒ ํ์ ์ธ "์ธ์ "์ด์ง๋ง ๋ค์๊ณผ ๊ฐ์ด ํํํฉ๋๋ค. ๋ฑ๋ก ์ทจ์๋ ์ฆ์ ์ด๋ฃจ์ด ์ง์ง๋ง ๋ณด์์ ์ง์ฐ๋ฉ๋๋ค. ์๊ฒฉ ์ฆ๋ช
์ด e
์ํฌํฌ์์ ๋ฑ๋ก ์ทจ์๋๋ฉด e / e+1
๊ฒฝ๊ณ ( e-2 / e -1
๊ฒฝ๊ณ์์ ์ฐ์ ์ค๋
์ท์์ ๋ฐ์)์์ ๋ณด์์ ๋ฐ๊ฒ๋๋ฉฐ ๋ํ ์ ๋ํ ๋ณด์์๋ฐ์ e+1 / e+2
๊ฒฝ๊ณ (์ ์ฐ์ ์ค๋
์ท์์ ๋์ค๋ e-1 / e
๊ฒฝ๊ณ).
๋ช ๋ช ๋ฒ๊ณผ ์ฝ๊ฐ์ ํผ๋์ด์๋ ๊ฒ ๊ฐ์ต๋๋ค.
dbs-ync
์ POV์์ : :
tx_epoch_no
: ๋ฑ๋ก / ํด์ฒด ์ธ์ฆ์์ ๊ฑฐ๋๋ฅผ ํฌํจํ๋ ์๋.active_epoch_no
: ๊ธฐ๋ณธ์ ์ผ๋ก tx_epoch_no + 2
, ์คํ
์ดํฌ ์ฃผ์ ๋ณ๊ฒฝ์ด ํ์ฑํ๋๋ ์๋.epoch_no
reward
ํ
์ด๋ธ์ epoch_no
: ๋ณด์์ด ํ๋ ๋ ์ค์ ์๋.์คํ ์ดํฌ ์๊ฒฉ ์ฆ๋ช ์ด epoch 232 ํธ๋์ญ์ ์ ๋ฑ๋ก ์ทจ์ ์ธ์ฆ์์์๋ ๊ฒฝ์ฐ 232/233 ๊ฒฝ๊ณ์์ ์ฐ์ ์ค๋ ์ท์ ํฌํจ๋์ง ์์ต๋๋ค. ์ด๋ 235/236 ๊ฒฝ๊ณ์์ ์ ๋ฌ๋๋ ๋ณด์ ์ ๋ฐ์ดํธ์ ์ผ๋ถ๊ฐ ์๋์ ์๋ฏธํฉ๋๋ค. @erikd ์ ์ฉ์ด๋ก๋ 234 ๊ฐ์ ๋ณด์์ด ์์ต๋๋ค. ๋ํ, (์ฌ) ๋ฑ๋ก ์ธ์ฆ์๊ฐ 233๊ธฐ์ ๊ฑฐ๋์ ๋ค์ด๊ฐ๋ค๋ฉด ๋์น _only_ ๋ณด์ ์ ๋ฐ์ดํธ๊ฐ ๋ ๊ฒ์ ๋๋ค.
"์ธ์ ๋ฑ๋ก ์ทจ์", "๋ณด์", "ํ์ฑํ์๊ธฐ"๋ฑ๊ณผ ๊ฐ์ ํญ๋ชฉ์ด ๋ช ํํ์ง ์์ ๊ฒฝ์ฐ ํผ๋ ์ค๋ฌ์ธ ์ ์์ต๋๋ค. ๊ทธ๋์ ๋ด๊ฐ ๋์ํ๋ ์ฌ๋์ด ๋๊ตฌ์ธ์ง ๋ช ํํ์ง ์์ต๋๋ค. :)
ํผ๋์ค๋ฌ์ ๋ณด์ด๊ธฐ ๋๋ฌธ์ ์์ํ๋ ๋ ๊ฐ์ ๋๋ฝ ๋ epoch (db-sync 231 ๋ฐ db-sync 234)๋ฅผ ๋ณด์ฌ์ฃผ๋ ์ฌ์ง์ ๋ง๋ค์์ต๋๋ค.
ํผ๋์ 231์ด ๊ธฐ์ ์ ์ผ๋ก ๋๋ฝ๋์ง ์์์ ์ ์๋ค๋ ์ฌ์ค์์ ๋น๋กฏ๋ ๊ฒ์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค. ์์ฅ ์ํ๊ฐ ์ฌ์ฉ์ ๋์ ์๋น๊ธ์ ๋ฐฐํฌ ๋ ๊ฒ์ผ๋ก ๊ฐ์ฃผ ํ ์ ์์ต๋๋ค. ์์ฅ ์ํ ๊ด์ ์์ ๋ณด์์ด ์กด์ฌํ์ง๋ง (์๋น๊ธ์ ๋ถ๋ฐฐ ๋จ) ์ฌ์ฉ์ ๊ด์ ์์ 231์ ํฌํจ๋์ง ์์์ผํฉ๋๋ค.
๋ ๊ฐ์ง ์์ ๋๋ฝ ๋ epoch (db-sync 231 ๋ฐ db-sync 234)๋ฅผ ๋ณด์ฌ์ฃผ๋ ์ฌ์ง์ ๋ง๋ค์์ต๋๋ค.
๊ทธ๋ฌ๋ db-sync
๋ณด๊ณ ํ ์ค์ ๋ณด์์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
cexplorer=# select stake_address.hash_raw as "stakeAddress", "totalReward".* from stake_address
left outer join (SELECT addr_id, amount, epoch_no FROM reward) as "totalReward"
on stake_address.id = "totalReward".addr_id
where stake_address.hash_raw = '\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde' ;
stakeAddress | addr_id | amount | epoch_no
--------------------------------------------------------------+---------+-----------+----------
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 162720747 | 211
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 162485461 | 212
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 167344099 | 213
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 167043060 | 214
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 200722225 | 215
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 191413549 | 216
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 143111843 | 217
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 147836812 | 218
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 154740829 | 219
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 145433327 | 220
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 165631299 | 221
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 151825651 | 222
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 169141624 | 223
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 165184716 | 224
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 148899668 | 225
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 157838234 | 226
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 223252352 | 227
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 147889017 | 228
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 151858721 | 229
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 165782849 | 230
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 192969560 | 231
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 135711434 | 232
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 145964545 | 233
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 100702 | 235
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 102078 | 236
(25 rows)
๊ทธ๋ฆฌ๊ณ 234
์๋์๋ง ๋ณด์์ด ์์ต๋๋ค. db-sync
๋ ์์ฅ ์ํ์์์ด ํ
์ด๋ธ์ ๋ด์ฉ์ ๊ฐ์ ธ์ค๊ณ db-sync
์ถ๊ฐํ๋ ์ ์ผํ ๊ฒ์ epoch_no
์ด์
๋๋ค.
๋ค์ด์ด๊ทธ๋จ์ด์ด ํ์ ์ผ์นํ์ง ์์ผ๋ฏ๋ก ๋ค์ด์ด๊ทธ๋จ์ด ์ฌ๋ฐ๋ฅด์ง ์์ ์ ์์ต๋๋ค. node
(ํนํ ์ฃผ์ ๋ณด์ ์์ก ๊ณ์ฐ)์๋ ๋ฒ๊ทธ๊ฐ์์ ์ ์์ง๋ง ์ง๊ธ์ ๋จ์ผ ๋ณ์ ( db-sync
) ๋ง ์ฒ๋ฆฌํ๋ ๊ฒ์ด ์ข์ต๋๋ค.
๋น์ ์ ๋ค์ด์ด๊ทธ๋จ์์ ๋น์ ์ ์ํฌํฌ 233์ ๋ํด "๋ณด์ ์ ๋ฌ"์ ์ง์ฐ๊ณ , Jared์ ์ ๋ ๊ทธ๊ฒ์ด ํ ๋ ธ์ผ๋ฉฐ ๋ณด์์ด ์ ๋ฌ๋์ด์ผํ๋ค๊ณ ์๊ฐํฉ๋๋ค. ์ฌ์ฌ).
@SebastienGllmt ๋งํ๋ค :
ํผ๋์ 231์ด ๊ธฐ์ ์ ์ผ๋ก ๋๋ฝ๋์ง ์์์ ์ ์๋ค๋ ์ฌ์ค์์ ๋น๋กฏ๋ ๊ฒ์ด๋ผ๊ณ ์๊ฐํฉ๋๋ค. ์์ฅ ์ํ๊ฐ ์ฌ์ฉ์ ๋์ ์๋น๊ธ์ ๋ฐฐํฌ ๋ ๊ฒ์ผ๋ก ๊ฐ์ฃผ ํ ์ ์์ต๋๋ค.
๊ทธ๋ฌ๋ rewards
ํ
์ด๋ธ์ ์คํ
์ดํฌ ์ฃผ์๋ก ๋ถ๋ฐฐ๋๋ ๋ณด์์ ๋ณด์ฌ์ค๋๋ค. ์๋น๊ธ์ ๋ถ๋ฐฐ ๋ ๊ฒฝ์ฐ์ด ํ
์ด๋ธ์ ์์ต๋๋ค. db-sync
๋์ด ๋ณด์ ์ ๋ณด๋ฅผ ์คํ
์ดํฌ ์ฃผ์์์ ๋ณด์ ๊ธ์ก์ ๋ํ ๋งต์ผ๋ก๋ฐ์ต๋๋ค. ์ด์ ์์ฅ ์ํ ์์ฒด๊ฐ ์๋ชป๋์์ ์ ์์ง๋ง ์์ฅ ์ํ์์ ๋งต์ ๊ฒ์ ํ ํ์๋ ์ค๋ฅ๊ฐ ๋ฐ์ํ ์ฌ์ง๊ฐ ๊ฑฐ์ ์์ต๋๋ค.
๋ด๊ฐ ๋งํ์ ๋ ๋๋ ํ๋ ธ๋ค.
๋ํ (์ฌ) ๋ฑ๋ก ์ธ์ฆ์๊ฐ 233 ๋ ์ ๊ฑฐ๋์ ๋ค์ด๊ฐ๋ค๋ฉด ์ด๊ฒ์ด ๋์น ์ ์ผํ ๋ณด์ ์ ๋ฐ์ดํธ๊ฐ ๋ ๊ฒ์ ๋๋ค.
์ค์ ๋ก @SebastienGllmt ๋ ๋ค์๊ณผ ๊ฐ์ด
๋ ์๋๊ฐ ๋๋ฝ ๋ ๊ฒ์ผ๋ก ์์ํด์ผํฉ๋๋ค.
- ์ง๋ถ ํค๊ฐ ๋ฑ๋ก๋์ง ์์๊ธฐ ๋๋ฌธ์ ๋ณด์์ด ์๋น๊ธ์ผ๋ก ๋ค์ ์ ์ก ๋ ์๋
- ํค ๋ฑ๋ก ์ทจ์ ์์ ๊ณผ ์ฌ ๋ฑ๋ก ์์ ์ฌ์ด์ 1 ์ธ๋ ๊ฐ๊ฒฉ์ ๋ํ๋ด๋ ์๋
232/233 epoch ๊ฒฝ๊ณ์ ๋ฑ๋ก๋์ง ์์ ์คํ ์ดํฌ ์๊ฒฉ ์ฆ๋ช ์ ๋ค์๊ณผ ๊ฐ์ต๋๋ค.
๋๋ db-sync๊ฐ 232/233 ๊ฒฝ๊ณ (์ค์ ๋ก๋ @SebastienGllmt ์ ์ถ์ธก ์ผ ๊ณต์ ์ฌ์์ Figure 51: Reward Update Application
์ฐธ์กฐ). db-sync๊ฐ ๋ฑ๋ก๋์ง ์์ ์๊ฒฉ ์ฆ๋ช
์ ์ ๊ฑฐํ์ง ์์ ์ ์์ต๋๋ค.
์์ @SebastienGllmt ์ ์ฌ์ง์ ๋ฉ์ ธ ๋ณด์ด์ง๋ง ์ค์ ๋ก ํ์ดํ๋ ๋ธ๋ก ์์ฑ ๋จ๊ณ๋ฅผ ์ค๋ช ํ๊ธฐ ์ํด ๋ค๋ฅธ ์๋์ ๊ฑธ์ณ ์์ด์ผํฉ๋๋ค. ์๋ฅผ ๋ค์ด, 230/231 ๊ฒฝ๊ณ์์ ์ฐ์ ์ค๋ ์ท์ ๋ณด์์ 233/234 ๊ฒฝ๊ณ๊น์ง ์ค์ ๋ก ๋๋ ์ง์ง ์์ต๋๋ค.
์ด์ ์ด์ ๋ํ ์ค๋ช
์ด ์์ต๋๋ค. db-sync
๋ legder-state๋ฅผ ์ ์งํ๊ณ epoch ๋ณด์์ Map StakeAddress Coin
๊ฐ์ ธ ์์ ๋ฐ์ดํฐ๋ฒ ์ด์ค์ ์ฝ์
ํฉ๋๋ค. ๊ทธ๋ฌ๋ ํด๋น ๋งต์๋ ์ ํจํ์ง ์์ StakeAddress
ํญ๋ชฉ์ด ํฌํจ๋์ด ์์ผ๋ฉฐ, legder-state๋ ์ด๋ฌํ ํญ๋ชฉ์ ์ญ์ ํ์ฌ ์ ๋ฆฝ๊ธ์ ๋ํ ๋ณด์์ ํจ๊ณผ์ ์ผ๋ก ๊ธฐ์ฌํฉ๋๋ค.
ํด๊ฒฐ์ฑ
์ ๋ํ ์์ฅ ์ํ์์ ์ ํจํ StakeAddress
์งํฉ์ ๊ฐ์ ธ์จ ๋ค์ ์ ํจํ StakeAddress
es ์งํฉ์์ ๋ฐ์ํ์ง ์๋ ๋ชจ๋ ํญ๋ชฉ์ ์ญ์ ํ์ฌ Map
๋ฅผ ํํฐ๋งํ๋ ๊ฒ์
๋๋ค.
์ด 'ํฌํ '๋ณด์์ด 'nondistributed_rewards'๋๋ ์ด์ ๋น์ทํ ์๋ก์ด ํ ์ด๋ธ์ ๋ฐฐ์น๋๋ฉด ์ข์ ๊ฒ์ ๋๋ค. ์ด๋ฅผ ํตํด ํ ์์ต์ฑ์ ์ ํํ๊ฒ ๊ณ์ฐํ ์ ์์ต๋๋ค.
@dmitrystas :
์ด 'ํฌํ '๋ณด์์ด 'nondistributed_rewards'๋๋ ์ด์ ๋น์ทํ ์๋ก์ด ํ ์ด๋ธ์ ๋ฐฐ์น๋๋ฉด ์ข์ ๊ฒ์ ๋๋ค. ์ด๋ฅผ ํตํด ํ ์์ต์ฑ์ ์ฌ๋ฐ๋ฅด๊ฒ ๊ณ์ฐํ ์ ์์ต๋๋ค.
๋๋ (์๋น๋ก ๋์๊ฐ)์ด ์ ๋ณด ๋ณด์์ด ๊ณ์ฐ ์ค๋ฌธ ์กฐ์ฌ ์์ต์ฑ์ ์ฌ์ฉํ์ง๋ง ๋ ํ์ ์ต์ ํ๊ฑฐ๋ ๊ณ์ฐํ๋ ๊ฐ์ฅ ์ฌ์ด ๋ฐฉ๋ฒ์ ์๋๋ผ๊ณ ์๊ฐ ๋ ์ ์์์ ์ ์์๋ค.
์ด ๋ฌธ์ ์ ๋ํ ํฐ์ผ์ ํน๋ณํ ๋ง๋ค์์ต๋๋ค.
์ข์, ์ฝ์
ํ๊ธฐ ์ ์ ๋ณด์ ๋ชฉ๋ก์์ ์๋ชป๋ ๋ณด์์ ๊ฑธ๋ฌ๋ด๋ ์๋ฃจ์
์ด ์์ผ๋ฉฐ ์ค์ ๋ก ํด๋น ์ฃผ์์ ๋ํ ๋ณด์์ด 231
์์ต๋๋ค.
์ด์ ์ด๋ฌํ "์๋ชป๋"๋ณด์์ ๋ณ๋์ ํ ์ด๋ธ์ ์ถ๊ฐ ํ ์ ์๋๋ก ์์ ํด์ผํฉ๋๋ค.
PR # 469์์ db-sync
๋ฒ์ ์ฌ์ฉ. ์คํ
์ดํฌ ์ฃผ์ \xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde
๋ํ ๋ณด์์ด orphaned_rewards
ํ
์ด๋ธ์ ์ฌ๋ฐ๋ฅด๊ฒ ์ฝ์
๋์์ต๋๋ค.
cexplorer=# select stake_address.hash_raw, orphaned_reward.epoch_no, orphaned_reward.amount
from orphaned_reward inner join stake_address on stake_address.id = orphaned_reward.addr_id
where stake_address.hash_raw = '\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde';
hash_raw | epoch_no | amount
--------------------------------------------------------------+----------+-----------
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 231 | 192969560
๋ํ ๋ณด์ ํ ์ด๋ธ์๋ ์์ต๋๋ค.
cexplorer=# select stake_address.hash_raw as "stakeAddress", "totalReward".* from stake_address
left outer join (SELECT addr_id, amount, epoch_no FROM reward) as "totalReward"
on stake_address.id = "totalReward".addr_id
where stake_address.hash_raw = '\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde' ;
stakeAddress | addr_id | amount | epoch_no
--------------------------------------------------------------+---------+-----------+----------
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 162720747 | 211
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 162485461 | 212
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 167344099 | 213
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 167043060 | 214
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 200722225 | 215
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 191413549 | 216
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 143111843 | 217
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 147836812 | 218
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 154740829 | 219
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 145433327 | 220
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 165631299 | 221
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 151825651 | 222
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 169141624 | 223
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 165184716 | 224
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 148899668 | 225
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 157838234 | 226
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 223252352 | 227
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 147889017 | 228
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 151858721 | 229
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 165782849 | 230
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 135711434 | 232
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 145964545 | 233
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 100702 | 235
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 102078 | 236
\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde | 38266 | 65 | 238
(25 rows)
๊ฐ์ฅ ์ ์ฉํ ๋๊ธ
PR # 469์์
db-sync
๋ฒ์ ์ฌ์ฉ. ์คํ ์ดํฌ ์ฃผ์\xe1e27b674f2c9e5c88689526e987ecc7911c034a0f553289e6d3a38fde
๋ํ ๋ณด์์ดorphaned_rewards
ํ ์ด๋ธ์ ์ฌ๋ฐ๋ฅด๊ฒ ์ฝ์ ๋์์ต๋๋ค.๋ํ ๋ณด์ ํ ์ด๋ธ์๋ ์์ต๋๋ค.