Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[API] Added committers' corresponding public keys to consensus API #2088

Merged
merged 3 commits into from
Jan 17, 2024

Conversation

hyunsooda
Copy link
Contributor

@hyunsooda hyunsooda commented Jan 11, 2024

Proposed changes

Added committers' corresponding public keys to consensus API

> klay.getBlockWithConsensusInfo(klay.blockNumber)
...
committee: ["0x03bd63587021afe0c406d3e8feb19ba6a3247b81", "0x4227104ddcab424d57eaf7f4c62ed5083cb13d8d", "0x86615dab81d609857651f412fc300bdeeea88cf2", "0x96f88b4e427ece99584d7bc8f711b8213a512b30"],
committers: ["0x96f88b4e427ece99584d7bc8f711b8213a512b30", "0x03bd63587021afe0c406d3e8feb19ba6a3247b81", "0x86615dab81d609857651f412fc300bdeeea88cf2"],
...
},
...
> ./ken util decode-extra header.json
....
"committers": [
  "0x36ff2aa21d5c6828ee12cd2bc3de0e987bc0d4e7",
  "0xe85d197a80d60564616983f5d2a112b97f61a0ff",
  "0xed6ee8a1877f9582858dbe2509abb0ac33e5f24e",
  "0x74f64cb6c2db9e0b270df1d4e563920381aec034",
  "0xc0cbe1c770fbce1eb7786bfba1ac2115d5c0a456",
  "0x20685d7bbcb07dddbd8dbdc824c31fe2bfb31c92",
  "0xe3d92072d8b9a59a0427485a1b5f459271df457c",
  "0x4c921e2b4ac183b9b8ab32805ef4da8d59d49eae",
  "0x52d41ca72af615a1ac3301b0a93efa222ecc7541",
  "0xe93a890fb7ec5e993b1a7fd77b0d13a0763eff3d",
  "0xc180ca565b34b5b63877674f5fe647e7da079022",
  "0x0b59cae1f03534209fdb9ddf5ea65b310cd7060c",
  "0x21eea769292304d12e378ddb098f762a248eeff3",
  "0xbca8ffa45cc8e30bbc0522cdf1a1e0ebf540dfe2",
  "0xec6c1cede510be308f0fdbbc8dbdf238829bdb34",
  "0xa3b387b7b0dc914a4f106ad645a0ad079d70ebdc",
  "0xd6d7762dd7fadf0512d83d0143685fc85488b64e",
  "0x6873352021fe9226884616dc6f189f289aeb0cc5",
  "0xdf6571ab9f25eb365c65ff9ee915298580681b82",
  "0xbc28b81e73a66747695d9236dc20491d65f74381",
  "0x1390eab3ad2e674646a8f92460098886409fd57b"
],...

Types of changes

Please put an x in the boxes related to your change.

  • Bugfix
  • New feature or enhancement
  • Others

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING GUIDELINES doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes ($ make test)
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Related issues

  • Please leave the issue numbers or links related to this PR here.

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

ian0371
ian0371 previously approved these changes Jan 11, 2024
@blukat29
Copy link
Contributor

blukat29 commented Jan 11, 2024

@hyunsooda I think committers []Address type betters matches with existing fields.

If GetSignatureAddress (wrapper to ecrecover) fails we can just return the error. Same as how we handle proposer ecrecover failure https://github.com/klaytn/klaytn/blob/v1.12.0/consensus/istanbul/backend/engine.go#L789-L792

klay_getBlockWithConsensusInfo

  • committee and committers are related fields. It's natural to have the same type.
{
   "baseFeePerGas": "0x5d21dba00",
   "blockScore": "0x1",
   "committee": [
     "0x571e53df607be97431a5bbefca1dffe5aef56f4d",
     "0x5cb1a7dccbd0dc446e3640898ede8820368554c8",
     "0x99fb17d324fa0e07f23b49d09028ac0919414db6",
     "0xb74ff9dea397fe9e231df545eb53fe2adf776cb2"
   ],
+  "committers": [
+    "0x5cb1a7dccbd0dc446e3640898ede8820368554c8",
+    "0x99fb17d324fa0e07f23b49d09028ac0919414db6",
+    "0xb74ff9dea397fe9e231df545eb53fe2adf776cb2"
+  ],
   "extraData": "0xd883010c00846b6c617988676f312e32302e36856c696e757800000000000000f90164f85494571e53df607be97431a5bbefca1dffe5aef56f4d945cb1a7dccbd0dc446e3640898ede8820368554c89499fb17d324fa0e07f23b49d09028ac0919414db694b74ff9dea397fe9e231df545eb53fe2adf776cb2b84159a0ef003b209de77c89814d1b1224af371cb211240c9ba4272c626140ece7b823f5455e984da9824a0c190b98716dc01475dc95edd6263adcb552017ccd639d01f8c9b8410bf3f9b38d1a01a1b1d7869a6a81e8c740e9af8fc56135763bc2e4f600dad2b272ccc6f32116f4a004dc976bf377e43ec5a26ad14ed88971c3e2355b5c7d052b01b841aa86bf506a91d67ef1059dc68c06c3746bfecdf409159b5945b0be8348ce343b3f737f996ad223fac80d971e9cae45256e02074526389536d13de57fe5e1582700b841e7e12de541bc974e81c8641d9f89d3beb1a29384ff2f1e189a35cf628470abcd3589d456261112a455ce87afc83dc6f176d2390d70c7c47bca5c796c8d12651700",
   "gasUsed": "0xd1a3f",
   "governanceData": "0x",
   "hash": "0x5c2cc15e52444c4c02bbea3a7c73309ee95e2190903679f676bc8c139fdf27bb",

ken util decode-extra

  • validators and committers are related fields. It's natural to have the same type.
  • If you need to know committer-committedSeal relation, we have committers and committedSeals fields in the same order, same size.
 {
   "committedSeal": [
     "0xdb00803e64c3e16cdd8b09b3f4633a6d44a025596f30d171ac42019ddb85a7673846d79e7ba199de6ce7d4f9dfc93510b3b1ba9df526be9e45c537bf6b8050a401",
     "0xb24a29fc57e1bcf7d22c5720d5ddf6c9ad5f55a121b3e78ad92d23bb5f20fde74dab8499a81f9e51b865a7c4b772bbd665567754cf6b1c2374a5aca6c9bd7eba01",
     "0xfdb24127a7842f1b7e22908895c543aa32eed676463315770d6795e6da4795460499aede9266e5cd51ff5517245f7107930ba0efcc65193613800dbe6312af2700"
   ],
   "committedSealSize": 3,
+  "committers": [
+    "0x571E53Df607bE97431a5bBeFcA1DFfE5aEF56F4d",
+    "0x5Cb1A7dccbd0Dc446e3640898EDE8820368554c8",
+    "0x99FB17d324fa0e07F23b49d09028Ac0919414dB6"
+  ],
   "hash": "0xb7128deb19882e10a42b21adf9f6a54143a5793d83aee8a964677b7aa454aa87",
   "proposer": "0xB74Ff9DEa397fE9E231df545eb53fE2ADF776cb2",
   "seal": "0xd3d8d1372ad89ef89015a233e53a652fcab5b066b85a2c642f1b27ec7e5187ca41aea21036c3c8ef337893c5d38fec3075eb5bb7c21718c2451e72298fb9805d00",
   "validatorSize": 4,
   "validators": [
     "0x571E53Df607bE97431a5bBeFcA1DFfE5aEF56F4d",
     "0x5Cb1A7dccbd0Dc446e3640898EDE8820368554c8",
     "0x99FB17d324fa0e07F23b49d09028Ac0919414dB6",
     "0xB74Ff9DEa397fE9E231df545eb53fE2ADF776cb2"
   ]
 }

@hyunsooda
Copy link
Contributor Author

hyunsooda commented Jan 12, 2024

@blukat29,

If GetSignatureAddress (wrapper to ecrecover) fails we can just return the error. Same as how we handle proposer ecrecover failure

If unable to obtain a committer address (or any other errors), should the call return an error even if other information can be retrieved?

validators and committers are related fields. It's natural to have the same type.

I'll do that.

@blukat29
Copy link
Contributor

@hyunsooda Yes just return the error. Nevertheless, I think the error is unlikely because it's just ecrecover.

@hyunsooda
Copy link
Contributor Author

Updated. PTAL

@jiseongnoh
Copy link
Contributor

jiseongnoh commented Jan 17, 2024

What do you think if we call "signer" rather than "committer"?

EDIT: I agree with using "committer" here. Thanks.

@hyunsooda hyunsooda merged commit fdcbda5 into klaytn:dev Jan 17, 2024
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants