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

added miner address extracting for Bor in block api response #6080

Merged
merged 1 commit into from
Nov 22, 2022
Merged

added miner address extracting for Bor in block api response #6080

merged 1 commit into from
Nov 22, 2022

Conversation

alexqrid
Copy link
Contributor

This PR adds correct miner address to the response of eth_getBlockByNumber/eth_getBlockByHash API methods.

Currently miner address is returned as zero address (0x000...000) for Polygon - https://wiki.polygon.technology/docs/edge/faq/validators/#why-do-the-json-rpc-commands-eth_getblockbynumber-and-eth_getblockbyhash-not-return-the-miners-address .
Unfortunately this behaviour confuses a lot, I've succeeded in restoring the miner address in block related API, want this to be the default behaviour.

@quickchase
Copy link
Contributor

There is one problem with doing this...the block hash changes, so if you try to re-calculate the hash of the block, you have to zero out the miner field again. But that feels like a niche problem with a simple solution, most people want the validator address in the field over JSON-RPC, so 🤷‍♂️

@alexqrid
Copy link
Contributor Author

Agree with:

that feels like a niche problem with a simple solution, most people want the validator address in the field over JSON-RPC, so

@quickchase
Copy link
Contributor

The polygon team reverted this change in bor

@alexqrid
Copy link
Contributor Author

alexqrid commented Feb 9, 2023

The polygon team reverted this change in bor

Actually can't understand why they had reverted the change.
Giving 0x0... address in response is useless, because:

  1. Developers need the miner address in most cases, and when one gets 0x0... as miner adderess, he tries to make dirty hacks, to retrieve the real miner address.
  2. Everyone who parses block info and is aware of blockchain and forks (how he couldn't if he develops app for blockchain), writes appropriate code, that looks past 20-30 blocks comparing its hashes for changes. If one is not doing it he'll also have problems with its own way decoding the miner.
  3. Bor community reverted the change, because their tests hadn't passed, may be the appropriate solution was to fix the tests for this case without purging the useful information.

P.S. By the way, there's no any code samples neither from bor community nor in official docs how to decode the block validator, the only thing they have is the mention of the case
IMHO, this should be reverted back.

@quickchase
Copy link
Contributor

There is an rpc method bor_author, which has the code required to recover the validator from the extraData field.

@alexqrid
Copy link
Contributor Author

alexqrid commented Feb 9, 2023

Yes,but why to make 2 rpc calls to get the needed info?
As you mentioned:

that feels like a niche problem with a simple solution

To write block.miner = "0x000...00" is simpler, than making the second request, which give you the same result. This is especially the case when somebody uses NaaS providers like QuickNode or another one, where every api call has the cost, reverting the PR would result in increasing rpc requests by 2x, but nothing changes: the one should check for the forks again (past 20-30 blocks or more).

I mean the argument This led to breaking some assertions in EIP-1559 test script. This PR fixes that. looks really weak.

@quickchase
Copy link
Contributor

It does not require two calls, as the validator's address can be recovered. It's just a pain:

package main

import (
	"encoding/hex"
	"fmt"

	"github.com/ethereum/go-ethereum/consensus/clique"
	ethtypes "github.com/ethereum/go-ethereum/core/types"
	ethcrypto "github.com/ethereum/go-ethereum/crypto"
)

func main() {
        // Block body goes here, example:
	data := []byte(`{"difficulty":"0x13","extraData":"0xd783010a0183626f7288676f312e31352e37856c696e757800000000000000001773f3919f1b1b0601f6be24bcda93fdb4d0b2fb01204799c2d42af1dc910a2547d572b2ca59cc8eaa79ecb5ce4f1fca670fe5039fb212beba9422d57a6d2eb001","gasLimit":"0x13d7780","gasUsed":"0x13d5024","hash":"0x9f4487125f7b346b7be24f5db3ebe6a40d9195f6aa4191e0732c7a4b94c81dbd","logsBloom":"0x64a18024491165e567100430808c432f969551e085352c420991104091d00c00091b7513c9a236b059e284175402810248c08108008311002852010420b2680c0d357d848250432081268219d4a89ee8bb81976d790c52405067253c8c022240d1649285121cca092ebb0e705823c9541424c0c900800c07888252d04742148010170b800f89055896d0f9216894154c8193a48300c00838d01739e120200046f288a49b12004800046965b032e08180da484a0480a10c930866a42913165a51118274122200c46185a90e01019f1810d04083900910c4392016922295427222ed510ce5a08801a1b907096601895a0c94613142c2e8605d203480180930b980","miner":"0x0000000000000000000000000000000000000000","mixHash":"0x0000000000000000000000000000000000000000000000000000000000000000","nonce":"0x0000000000000000","number":"0x117c3d6","parentHash":"0xb1d832be578b40fa2dcdba37734035e19402539d1dc38ee519a8ceb777517404","receiptsRoot":"0xc508789a245f546e81d59a6c19af6452539d7ecb6d469a9b1b7d3618c6dc100e","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","size":"0x12e90","stateRoot":"0x4083b6656bf62b676330ee9661a3fdde14e7eaef937e9eed01677ff200c412c1","timestamp":"0x612492ca","totalDifficulty":"0xc3f2583","transactions":["0xbaa0b31db5242bb09447dfb4aeb53b029ff03873e6503a1e9068a941331793c0","0x260c7475bba51a2bd408aa5eed93f0cc951548c05401ac9590c0202b667ee12f","0x5a0908d3657c9f6abb6dec313543ab8fccb0c90c324a80e6a080f43e2f89aa96","0x31e35ad7aed6e139405a1f67e9f8c236fc44b77d01e8e3e4eb0a28f9614860a7","0xf2333e2b2116eb96718bdc0df0778cc3d119f6d77bed99a63a5830c2674e0fec","0x3665bb70b77b187d15621252dae1f7b85a9cc908cff07171bc88a4d52c7351f9","0xacccc8e2d8203898af28d751530a4c3b165691c0b9c6b86fc8dfba52a3d01fa0","0x087afd061af0fed291a45cc1b9140f78aefd745e4f90b5d7dd99756da3bd01cd","0x65e536edd07ee6af5df52836c5e9a8d0e6e48e4cd63e5a1dc8368bca198ca930","0xece0e21ebedfda282fe1ad941dad062e210389554f14ed4747778dfccfaefc3a","0xabaf0174e12358dc59f3c5a3bd0a6a6e378b676876b296611210a59a54271578","0x4e0b9fc3406152d504a0348d977183ab5b6feab8e978e5e76dc6d0470cdcc592","0xa5ec52e879e84f497cffdffd74ce8c5b9f86d95b6efe2a5e7d7cf190913cd07f","0xa2c40353873d52192a3479348921d16f2e1fe4ef95a900d7f480c4bcbf122e5d","0x164b6e07bab6e66ca9c6638b26fe66497bc6848d668a60482af84768f2911d30","0x64138646fa20a70c66a970334612dbdab32abed97ff36f7932a4e3abd9a29bff","0x51215c03a2953be32c7f4e65c44e200e0c39bbcd5ee714f4c913dca54aa97a41","0x56cc1ec7b53d35933308ce8d7840dc3f346cdc7c9bc6fb83f60ec9b6c0c86e79","0x82044494fe714de72055bf7dae2a7a72089f96c1be70bd7ca6100b0ece66870b","0xd12ad33979b74ebde2fa3bef1ed471bb26ac33607f4a189821a201858dcd2bc1","0x59e046147926759913f59b83c36c038c2f38a15a6a6a25009aa480959d0b8998","0xec01b3d8b06f4c35101061af8e2ffce52f1c442d390161f0c13e00a3e63bb381","0xd4cbf5a145e7fa65a3f3c334b4f894b6d641b2ee4f80a0a1cb6f5c59cc8ac6ba","0x036e734ddaa9d100add2da03bc581d8ba4020ceed0f561d8943dba26020dd2cc","0x8d87fdc71c4dc764fe129df4007bd64ae3d595140f126eecbb1ffd6a35ab0c8e","0x3574adfaa32aced7bbeaf2cedaa06dbbdb3c0fc6222eafa5c31bcce416cbaddf","0x211e61b8e1dd020cab80fd0d613ac041d37aab5520ae376c7e9714489b62cd38","0x67fa31e8918fbbed583c7e4f97e6f0cb8c12313166f511817c9b819c00a0c317","0xfa8208cb39d22e690f914176667a5885c290c8e482dfce337efbd5e4d963831e","0x24c62d2c49f1b14276a19e3b9e7fd65046e1e05c2ad154e3b6a5b95b24264a8e","0xb4ed11a568571faa3460426add86105769f64b60b35e29dfa87128260b7cd0d6","0x2326df800bd4848e6443da7bd8746144a6173f260480b59a33c8353f5a38ceb8","0x02a6e59996e23f079dc29aba6e614b49b9e8dd4823e56d18aea3b8bdb7b83a60","0x8e6de6c2f377534814e73315edcd92e09fd70b402decf3667af6a932d040ea39","0x089a9fc6f97e798f2f664221bb22832b3588aa83ea6520f0291a29b6dcee6b07","0xcfaeb98495cd68bbb2b1bdb1b8e80c8a94498da5c729451c99ff72b42e887158","0xefc8eb4eb521c888401b4281966775f9a0eff175e3d42af57ced75e8708eb804","0x00b67c100005c553ecf3d6016adf0c230eb4f8cc7a7c67e090aecab99f792522","0xcd3ebe2a2fab66c13fdaecca91fdffe67c2bffe6b190ce61907a87b807149029","0x9acd7dfcde756d3ff8307f79e98483770a20c2c935487b765d97a70334b66e79","0x2a3aa2a492aa47aef143905a2bac91f6092d8192741872b0bb14bd71bb4db3bc","0x50ceefc4ac0da8327b23c62d39072a4ee7170723ab89b6af54d1acdfed4652e3","0x16bdd351ea4d3d4668a4e4f54dcb05c2d01802b0c93272d03737a4cccbc45ddb","0x84a60f3b279d1957f603d1da0f82b55d9ba3cd07c44296b3f4a47bd92c896ffd","0x506d77da651a259f8bf103b2a2ad68d648061a94afd23a22731a55b0ef0510f1","0x384287e7c0091c33fa60ac9cf5607ad17253a8312bba1c680c26eb0fe5b2ff80","0x462b81a2ecfc14da11abfed15ee31ed4cbbf8c4e1f7972d14e6e4a6624f27cc1","0x9b1e575d03e643daa3ced7186e99d75971a632c352f58f75aa87a51f65aeea5c","0x7e8b08e57ae3ab2a91c686cbee5de4a65861a3053ae91d16c0b7f63d92098f05","0xc3869093765900a2a026b6f6eacece969e4160f3bb20ced7956db9ec39dd8ea0","0x2634d9b2009a06acfe327f637622755a0ecb1f5b09198dde6776f9e04c9dea44","0x8aa852573c63e70d415ed6a91c54a16379d63649edc6946e364768f0c74f81fc","0x4b5327e39241572ffce2df5c86583f16638ce08ff9bda64e5203a68aaf07be00","0xd05e56d6b43a2d0bad8dbc420062811b6e55be9d7d52b2df4d1fa1883806e73c","0x25a63a76c968d064e0f65984da12b5628a8dc4128b5b6afeb51b7f2b809564d4","0xa4b34852d6993c59fa08e0b4c7f1662c4262b952b2e5e2e0e2bac2cb0e7a5e25","0x088e39415619626493dabd9e212611abf6726f41845f95f40663aec9d19ceef8","0x662803aedc38db8c5c57981df95f97615c2ded4d51fe6014f419e7ba15f223b6","0x59255851ea2ef7b0aae1768760a92d4a15bc0a47348f8d835fa4a24d539df4c2","0x3d74007b2ab48a9d80e64956b1270d5ef78c531ec5b33bddbd3bed3754b75de4","0x6ae58dd743bf2604b8f45e74412268e287b19e3eb8ec6186e231276ebc7c6189","0x8bfa45b7cbe41b68186826b6f9e1a0ad15ba5067baa4c07134b7e6601dcfb4f6","0x127fc840f6f9a20036b8d4058a103f246b9392fbc1266951e1bb905ab4e4e560","0xaf645b6946df6d6ce81eda029305de443b6093e264a4cce93eee9cecfb5705ec","0x42dbbd25846e5045f4e121905fbd550c37aeb4a6efe3c4d65d6076bef2b9efe3","0x22f7f1822d3caa194244f64e8594133690dd8b3ec86cd0bd0d1c1829a056176c","0x54729a6c9ca43ddd8ce8a80f84afb384281fe7c484ebfd80dc5ec278389da0e7","0x7bb43feef37bbafd39f77627d2a4688ba46a913089518f62212d1ef373df7134","0xb984bbf7995ae79ce400ded591c00744af2043fa6641efce5d0a05dad2d6404f","0x96b4db5a209cf1fe578ab587347d191f7b6d4edc616f95852810fa14403e9021","0x58e9cdfe5177fdb5dba454c9bf76aa5b940eb0897a3cf93e6fa76cb86469a2aa","0x82c5518179000e60e5a119f26f6a6ee538413658d448857739e26dbc832a6dc5","0x9d3fb228976f3201b97dddf87862b1b73d498809e28976e104d3d68793fbcdd5","0x2cb5d9991e63523d27a03189fec64bf686ca6177ad69361061e6e3ad2d400724","0x32415fb962be97be9a58552a95b9f028d6f09eb8611dc97c00a575944a3b3655","0x34f0d5a4625990dc81152992e4e7e2c4de045c3a53ea430ae8d81443b3e66916","0x40eeb2116825f3996f0e2df999ffbebb531575a21889561959a00c55c4d9a6ae","0x1e741bf1bbc6f96525e25aa9edf46f364e28299e093c34bed38e4fd88dba410f","0x43d0eb073a5aefdacfa1624c29e8435be32cd6da3ed80ad0c802bde3fb136488","0xf279d07d287fa8228b4f65c4116e9e4178d931eca986b6a60debee45b1da4083","0x05dba6a851502085404803fb5ff916e46fdcdfe5728532c89a3916da83f39cdb","0xf5a1f7ed5c0a298cca9f10f0f0ff17f320bb66117ceeeda0b0f69257793f410f","0xbb65e04e16c0280e7467ad8ae3a5462fd45cf5e0d38ccdd898151475e5779542","0x1bed3f259bea29e65ef68f94593ab850f0a94182749851416512f82462d2317b","0x1a98f2cb9c3c0fecbfc036f9cd0400dbd445b185a9c9f2577a1d0b3676eb7386","0x1ae70bbc446e053cba54c25eea3f0ee09574a0b89f2363ff4bbae3f43113940a","0x4a9f28ac08fcfae4d3cfed29d3e916a85a281b1373601ce9724a98edef589448","0xb5aab5c306da4c554554d2d5a4af6d2d613773632c4dacddd6ba333429dc9c5f","0x2d395aa317a30a65012547500d77ccf295790ca6aefa9c67a9a1f6dce00cddf8","0xa71d8b32b5bf2d762508a75771b8ddbbcd33d3892d2bea9508074189e2b8fd9a","0x10e29b59097d80605560e51e059a3325afe820ce33df9008eb031c8bac329a4a","0x0d9887999c612bf4e586d902d17c4645873ef2a159e2808779b802df6223bd18","0xcb81d1830e6377db9dd32d3e1dcd807ed2f0c04bf586d2d64f7eee7014c34644","0x5facc7a2159c7522acfc5d4853f9b275c5924d950b122133265e8ac5eae68aae","0xb314fb2f62edfe95f1aced4adfcb4ad41a2922c7eff094779d5c32c926137e1e","0xabca9be42bebaf50eb666859cd8992cfd1d2c0c8c997c76f13a6f8b8d6118abd","0x022b3dc2a459a4850db119c7817f749d4e5412f9c39fd96f3564b350acaf22f5","0x4e6f59aec7037d893289cedf534b1626643a9de1c19109fedba2317c7d9e6a6f","0x1a8265e72b330b13378a1dbf4a4f7a61badd0e6113dead3072452e867ec0f2e6","0xf808e64fe6fb20a1cecb92cb320758f8d1629e4e8ff1e66ce2a1fb0014bfecd4","0x8042fde36114420904558ceb321c303fae3d09a14a0924ae0c1add4894e6c973","0x9275ec6ca333895f9fd7359a9a3839245746222abd6e8f2a8fcb6d1ea295e738","0x670e8ca3ecd059b6e37ba931dd9969971925c9cc70c09178726853dda26684a8","0x4fa33edd4d44fa6b0c81e1c87dfd8a6c66f1acf339383ba0a804f3391cb7c070","0x5f984cef346c78913d73e0cee2ed9a1e80a4d266a402e091a986a6a7f0d08efe","0x52b78d840d3a1fbb2c3942e2c6aaaf6d6517e3b2d00190b2d028c1a0ffc24c13","0x2bf2d90815d5b88569ecc306f10a7a0cb6ccc94b18c0d42a0b84519898b56bcb","0x26d7d92c4ad84fc9b9a2a872717dd98fe2fe92ccd143324c591d2d69e0b1f2c7","0x5906f668f3b330abd2c0cbf2ac506c30bcdc3d713c832307a50e8a2e27793a3c","0x5c7421ed7c56c0c275dfa866b2cf119e78aff01bb9ae258f81da485bc2068761","0x0e767762527b4788ccad71275d958205a62863c996efa1eb9db0d872d3fd224e","0xe5cd218f0ea691699ae6765cf250e97f14bf3c3fc193493520a293e32d974ddd","0xc90e77c75bdd5b0e54601757c94c966c6c74ede557ede9cc5214b74d33af817d","0xc4d788bd3c74b951156a147ea39423194b80662025f3d73d1267f6aa6e995110","0x5eff4609c6250eddee7b725260ceead5668f1ae3b363281e84f6327f855082a3","0x2e811975b1365cb4e2425091e5fd667d4b839563a08b9a15ac31ec39353b2852","0x617292886e8e58b2db2fa989e2c0d016349dc697276cdfba7a931fa53aad1bdf","0xd39d88223722450be2f67a8375c2fcdc7423ad98939499588c538216103173b9","0x63a649455d8fe59798df8229a84511c4e66babb7083bf64451ba45a1d025ed81","0xe7c1479547d5ff0e3d717381452955bd016a22aaa014fd298701ed4ceb948ea8","0x9543e4d1d2c6293027321c64cfd038eb64c51080e94573115827ad2058af212d","0x8920d4d989b5cef7f72868b3222d8cb833527482759b2d23fd8fd7deb2dec42c","0x83649b8af0dd4ba5cbe4fcef39d24ce721d493af44fdbb85023c6f9a7c7aa100","0x02dbaeb90e34ca78e3efbc5748fe763de709d3e97b074c22cfc2ff8270a23054","0x28695247cd3cbeb5cb73e685f5b1ca2807292c2b3f7a5ae5538de65828ba9e13","0xb6a4962a0fbfb98042c5a9c83fb3c98e21d63960821d70a3866dbeefb6bcb7ab","0x11cde2c5eac9788a5336e4ac68366c1716c5aad0a91fc92d59f73beb587a1be6","0xe1c994c6cd5631c8f27eab39693d6a076c0b955bac69caec9c379da7d2e80f14","0x39030a744902453aeba5c6b6d929c315c3b4ea274baea169085058526aa112da","0xf8e9ae9cd75fdd93b74a47cc31d5a8c91453869629eb240a3a61e406b7ac1888","0xcbdf1d359383e8e511f80b0147b6554e24fec38c44638140265ba514a14b1698","0xd6347c203fd345ca047a92943e17b860a5d5f1dcea853fc32214cf6737d873e6","0x54c133b2222fe5232367e8d9b33dc73aeaf177c493d3322bc6ec059bf8010a5b","0x73e5b264b381a08050bed53d64403547dce8d677284bea018109b90119b42222","0x4aeb6c55aed18c3f0d3ae7a474219c7664d9962c80d97439d4c68ae84eac3a98","0x35cc5ff13f091f8bad25e76ab528e806c0933fa2383c5a59674b1a86862dcc36","0xbe4fa1a2b62869f405e103f24ebf2cf9074a875880783ae7037f6956ae5be947","0x6549b8020fac3aca9812045a0455fc80e92570ce232e5b88ebb568de674da8fa","0xea53783a148389cee0db6dc57182596cb9395a2768abab2690ba6bb97cd51081","0x6482ca6a0052cba5a7c6b84990221b2671e0aa2170596853a69626256c8a119f","0xc3c96b60ce79e4a18dfbe15a6c37970b5b30c0b1476cb04cc56fc1f93bddf3dd","0x1fe22147e337d4b929463c0ef9551e8bf094272ddb99bb88a1f82026083a984c","0x2e5f8939b6635c7cfd3a0e53fe9a0f701942fb1d65e6de666a1caa41cd955f9e","0xe465347455a141e4968188f8906d076a248f8b0ba4c32951fcceee96cc9f7ca3","0x8dfa7d560cbdc8c088f55939163899be7023bd866c96a858679842ec0201b53f","0x15fb96ff76212ef0ba2c338cd4db97de958fcc62c74ccf488e8e78a6d7ab638a","0x1bc0d89c7387bd6ed46e5b6fa3b29bb0f6b73ccd5445bcc4d539204d1b26efa1","0x440ff4540f06cd12e3ea903eefc9dfec72ee2beeabd037723dfb2cc863cf1ab7","0x8f1c81b07f41502988f19275ab2ba95b7ba80475883298dbcadc4a8eab251c5b","0x86ef901cf803b46453da28b6300a253ac07d0baa207f5d6cc081fffabe2de785","0x6f14764d483abb4a999251f778c88b6c48bcdcf332a451d99281d42a07cac21c","0x2dd4495b4509c6db794341c1719d764739304d60df6f6c862a339d760c48f439","0x15d26288cd62d4dcf5778ebf62de31320fff4e465bdc46934f90f02a05d4fb57","0x404977631aed9049f58ea662ba283d9b58c417fed115f88c6119bfa2e5a0315f","0x1c4f9f2149a457526904e6cc0887d4489956066949b9072ef191a97c9bcfd23d","0x4b97a91d3ce5d0183858512f502e38c9b2366283e3c8a1dfab4387a9694464cc","0x335dda670386de9111a90eb9df8899392906f8ac89a95e4587d530483058411c","0x9d5cb2e133363f8923881920e447ade593268b6d3397dd1db023fa857211a208","0x32a3f98f8a91c3d3bf7a01c74e3a56828ea8dd3efad1d209d2dce1c067248aa7","0x90ef17a52aa0ff59ad7f6b98b978a6cf48055495cb7ed93a01df59806bfe6786","0x0fa1c3dce5326329cd5b2518e981cd5ec07b56ac1201d16dabd9e11d8eecdb08","0x6d328e35bacfcc2de73e9c4d3db266a0c9e89690d5cb33716f4c7378a9598c9e","0xacfcb073393b8b77048d9fddd5937c4cf0387ce5ba76f8300c85933d2e92c423","0x7f581c3a52027fca2fd87d6d8cbd962d0b204f569466a5448451a30aa9f17871","0xc571ecec8ffcdb2a0fca3025b238f14a3e2b8211455b1a0a59eb6e367dc6d11a","0x280fb09fc5026f83e0189629cd83f0d30ae6e63d85b355e6e89cd4853503890e","0x7640ffad741f89e588c1cd0a502cba58eba0f820a0765dc057e53de488a2cf3c","0x9c4416b26969614960f940c26f6cd3f0bcd62811bbef307af590c9edf464bc4c","0xa24b440c89dea3a25069d90b58edde0e6270647d3d5af21c129aed99f50ac426","0x6fb0b99f170335db38160234e9621692100a60bcbaa88ecf6fb99ac9074f6d2c","0x4a3ee8524b2e800f64a2ca6992f05851cec2b3819322be5fbf89a6096e3978c2","0xe8627532b47dee13d225d1c81e87a48c937d6b76ccad26b8747a8ea4b1cdf9e5","0xaf0311073cd74c7cfd0a4dc13f2aa1886bf12b1e46f3af4004196cc03774070b","0x589a7a82e6a93703f4ac7b77e9d5b118d0677fb5fe10a3d3f2bcfa972f421577","0xfa4b04fc0d268a642f7f1aee55373bf51a5e5b4f2e3d4d53d8f17dded38d429a","0x11be352a477126e4761f8dc366ec577e067b7f53d1e6c161b1af3ea1ef15607b","0xfbed23b35ddb4f4c9bb8780d3ab5a05126beb803b839489aa730e716e6cf0a9e","0x31e9a3e5822a5b6dec3314f0c98cfc835141e3f7c4e068dfcad2597590780cf3","0x9342cc258462dc0ddf85a701e772030d87cff01007ddd629d99517983057cb8e","0x4bd352e4557601eb2421f9cd368ed116e79a4750bf153a6623d97c81bcde6961","0xcf1e24f44a4eaf9b2e683edba12de7fae4257a2c6da2ed6938aad774b7b45589","0xa5eeb34ba95cd77bd4b998604e879940f9481858e46028dd14922ee474780037","0x3923249a3717aedd690428fa413e41fdc797e3324803f64e52aa6b7d362f6a55","0x17f7541175c66c1f057d77554eb63c1e5ed41def189649ebd8f9f6bd4078854b","0x97bfe92ef170c19f3c76c06d19d4f0a18a0ba5fcdc564c7c9d747177d43e96bf","0xb3f3241c04507770dd84f99c14c84b8335a967d099e005a577c99f8b46b96e1c","0x7a8aa7043cc699cff77ad70fb2c28fe63d7594ae4e147ac315bd3142e45b273d","0xeba922ec65f7d21663eae77d43e2426cd7aa56fe5fd66b53942813a5d958f3bf","0xeb1567cde717ac5ac3da84ce584153d95ca6f6560f1cdbd415ab6cd49651593b","0xbc6b2a16a949dbbb5e7b9748f8ee5016848e4bf91066e72b3df90452ba8959b8","0x2d50b375388f4d6f1ca02b9831c789898b351616f17ab35c1ebae49a05d0ef09","0x9ea18ff332df00d9a257a242297298ac8e38289c4cf03acf8535e9c6efd5de86","0xa070f6335cfac0884cd2421223b9a05a633902fc4056ab342309587258c274eb","0x40eaede4ea1cec9d620f6c20061d884ee46b984ec4d7ed04451ed482382cfdda","0x6ff760777237006f33b78a858f87bd52ac536d8968458c8e2cdf90318789f9ec","0x26fd72ab06e96c0a5bdc33654edaa05e3d6189a9933871bfe1dd85652ae251c7","0x4e49c00f796909921ee1753b76df51b7cdaeb57abec6af02fca2a7a4ad1f0093","0x9a213ae344c5c60964cea1c4fc3a78f1b1742328656d650924ed7e395fe1df0c","0xaef9e53a1f373699b882f717632f2e3613abc6424048d8f3fdb76181c3608dd9","0x287eedbcb2ad2c2c0b9c342b679ff731a99d875da6240f6a286427814a6cdfca","0x613e0917ae9ec6f25f1e244940daa7fb9204cecbb0c456fc6405db21874ff96a","0x9344fe254e373d722589b351c76163171c116b52d0064d745c994c231de20439","0x6b7168c78191cea10db61be0516f6d49a54cf54c0179e936af37238267355861","0xc54ddb2e4f1d375fe175e50db7a86073540f888cfe32d4743f8efd462bd53466","0x33ea1762f7f85616070807a6c42fde0bd6c4c1d47c28a3688ee8169b447d020c","0x1c1bfcbceffebe70f4756b2beb8bc350e0e37abcbe14e4509d1a49bba8b18d28","0xefd1bcdd2de72b95cb2529172fcdbdeae30e444eef6c800a787c121b8db69c9d","0x7dd84e51d4b802c8af28bde316398086169305af88d623dbfc83023e6703fd06","0x4f3cf2ff00e6546ef2b745f0aa3db2d73b8352c17e3606a00f5dd697388cc05e","0x596026d0ac13a17e61838c358685b23c7045146a0f2b13e6bd624ab3e1793d8a","0x29b544579d3b675fa4b47185be735db726195aa582d1538f187d50aaef5c4aaf","0xe29e6bc210ecab6e77301a84200592ec44414b2e0032fc433e05c534b307dec3","0x291129ddb6143b70b1f523cad2cd1341d233fcfc40f84c5ce853315ff79669f2","0x0dd2d6820b58a98ef4df943cb2e4cfb9ec2dcfeb7fda3fba6d883adbb61b35a3","0xdb6438a359f43683122476d87f5fed8eb26d306621b14ce0f2cf83dc7d697c80","0x73f1a29fefbbb80544ac55d70adc8a477e68f677bdab33b37014d28bb2c22d81","0xf4c47aeb22db353afb9c3659b7c129b4fdb1514d783dadd9620f5ec6b9fec007","0xf606a813eed270753b717cd7331c79ef832373f4e998b0092d0735f176834002","0x5e9ef8cd5676c5a5756c64e92b7bf416a23c17c2725116aeefd4a7cce0544cc3","0x58b93540d17ef98904bc3f646f78997a84b41d3aaab9b54d872dd4098adc52b6","0x079907d29d6e6436666c55958e4e5e84dee7ce951fb7479165611822c11915bc","0xc709aa54f8f40535b1c20168f1e518a0ba8afa5803068828ad2b89f5309b743f","0xe4cd9e8998c804abf32597af380468fe6461cdb7fde282904de77fb8f0162491","0x823f4f96ff7cc189a2e50a9edba8adb449b1313d25c93686700719904c2e51e6","0xa0f853fcfe20bfb5a6a435b76e07f46285f7b66f5036f28e0767de911b32e7ea","0xa8f3daeb4ffe01536f3be8b39686572dd5919f2dff82eb3941c5f5a5708897f1","0xfe5a8a50727b727d31d866ee6aebf5dfbf862334309ce4145de51d9dc8077ea0","0x65402fe2c3924539bd332e7407c48267e6e334c601c898b2b948782b25051d7e","0x279daaec4991b7475321e3213a9502fb84f990e99219cf7e22195f290fe65f22","0xcd2c7e9140f37f53aba5acb0a28840ca1aa629b081929db968d5bc6014011b2e","0x7996ca6d6ccf08e72710fb03fc5c6b346e73be69c45e3e4ca75c22a6dee45aba","0x19b5add17647dbc77e1614b7ba1e8b31038f25f5f766b6671cd06b93ec740fc8","0x0c1e01cac22b8dd7e1d0f6496f9d09d643f4eb26f41b252fe8bdc8f7c293b013","0x94c45290a2fcc407476ac54bb928c162108c2821641830e6cb54427912df9d52","0xcddb7c94b0d4be77662a0a5b67ec82f107576f5bdab928e48178dbbd85ab8b1c","0xa775516354e2ba0c77c893d771e5d71256e43c4d87f04b8ef43379fd310735e8","0x3c634bb1b6f0c832c8619b137491878e918af75e0b73be25f1d5896d48348d45","0xd7ba5723233cdb2fd66a41252a48f4e73c379fbf9418b37e7fbfd613b8996bf2","0x9ed0df4a8e0c689b898a20721888eb9f7d470f069ac0ba9739a5eefb1068ea83","0x05abde75be28c4ca4903c1bbbb4abfcaed8634b632589369beba9fa5a2aabad0","0x7315d638afe9f35e6b50a779c27da7acfbb9af442ffac9bb64bb8d10c51881c7","0xf9c72e7c82ce2a0dc6b091fa8dee8c95ce3e07e0a472b21b6270a432d7413a33","0x1fef529ee5b5ebd54301d35b2e1f039707f300fae561f93a05308494be485832","0xaba4c7429618118d9d02cf840e2ab8e029f6fe14c961d67e65124785810c5275","0xc0d3b11bd084e06285eb33be9b78d0fe4474ffe9d2597e2891369a1436245968","0x814c71094a5ac103cec08e16dbeeb8fff9a04f77e36df0d6dc7d91962f6e197d","0xfd8eb84ec098a570089360d77ce84446705e67e136f0bac0357c469a3482b0a2","0xb8a5440707e05af5d74765e3c146c588ad5f9a20213356b49e4bf574c5e709b7","0xb5b9b85b5787856e3a04c81a5d88f2921bb39deb2c833b470a54264b7a0b29d9","0x9e164e7dfede91c193ccaf0ab20a2f810f6947ce5e7a438f30a51163053e4608","0xc176c725fb0a264c8389cccd92868179f32dc73be506254ab2b4470067bff17e","0xab4efd42e885c31b4d2ce12d258089842a0bfb75ec5960188147bee28b23f7b7","0x560cc56287190df6174db4b157dda3098f2fa432d2980cc60e93d85235f18568","0x862c7bfe9a406d67114566e5c365e2a4133832133db0ebe5257670d742821732","0x4098804d3c3f3ff03b562864ec8321a714ac5a08ff1998bcc083ac292a006c58","0x280d37be49cd87830c16faa64f1f59a599cde3a2ffede9ff78ce17e28ea2f748","0x4eadf7e2b663f46914bb4a079c47c75ff4d5071ac30ef341775be68fec77a736","0x6e81f62d4af83ea8bdd22e51ae9744cd03678d37f37be1e4b48e454dc5882d5b","0xaa9b01679f63fccb5cefd31202e3c6077a55a5a70b5fe6f3e47baef7db91f814","0xc96ec72eab7de3fa1a87f3f8f55328a3844924ff67f8090a1f6620762b49876c","0x830798b4a3f9159fd241c4d54ca9d75e17ba6434db1f25afade088cd8fb9e697","0x69bcaa9d4dcf54b7051652ab54c1d8a03931052a042457cb82e8f6f90318bed1","0x3dcf61129aee2aaebf996d33881bece4baa9d8e966b2acda57139a04c30bcac1","0xcea10fe97620e10ebacc451eb1608eca07f40d366cf51fdd021c16c37ee792cd","0x0f3420130a6213a1008d8a423933148e3e1c1d3753c4f28594c3df7dc13ec07d","0x744b75edf7535e568f9ce388ccc3c0b5896381fb6fe1e0ffc9b2f1762078bdd8","0x5172217d1ed17c067fa8b0ab20bcbb821920d5ab2ffa55a9837d3d242beb1c05","0x1f0baa7716a200a012f863472e8970c8720ba6f2ffe02261e187389ef288bc6b","0xcb5aa46e549015ce56802e453940cb0f47e779bce184342c0ac4f278cb999acc","0x2ecf94f579b76b1f01f494c66aa090420ef6b6b7b6f3d37018dda5ca3afc49a6","0xad37a12946e386c141cc3c379bcb7daa33c7af5de95db637b86b69ad333d5de4","0x5a38c57a7c65014a6ce2f7ec64dbb127279780390d345f58c5b065e3c81d7d3e","0xa713de4873bcc7214c8e3df164288d65afaf6f1b87c7c6af55c9b3d06bb625bf","0xb2b26cd6b68e6edfaede09b15aacb5baefa9b3597fc64a82959b0d04482d2013","0xd5d993d5279527bb1f8aae5f397bd54ec731b410d537032329ba72187ff75017","0x61825f21c38678bbf3c23ef7d8cb6b744076ad2fb722e1cec6dbba3b87bd726f","0xb44b91a805ecf744d3e2d99d3ce5f40834a2eba95e1381bba96ce87043ef224d","0x9bd48e3b8f5bba82741207c405eea00bfa1874221cdd6b7cde75900fb7a78907","0x56927860a12c6035e7f4a8efd2b914fcaeed4ea9ce6683e57902870db191d3e1","0xad9f5af189769a3788c414307548c619fcefcda94fc74413a297d23d2a025e02","0x3d4b49b845927f16faef030b68a5c27430e76a13d767725e1d21efa1a8234e1e","0x0b401ddc056117cb0a4e888b8d746caa2767c0dc106e774599f7cc7dbf5d23e3","0x9baa5831d123d669303871302dd3c036e4c5c992ce9842a479659a1ae6ac8de1","0xdfd9a80562c29c4a35ff5a0959a8fea45adbf5311eeccd3d01541b46c4a6ad54","0x9a15fc8a5f7d1b786d86e80cd2106ff17952082cf0505f42c220e5084c201d13","0x336e29b5c55767ea7d6fd3f5b66b00af1f04ec061f4926d1a834f83ba33ee250","0x3a03e006591903bcd2dc4ded082a2d39361f268d7a4a120b1429e60c98609769","0x46133e31ef744ae7bf77700034bbfa3cca07e1de68c09bd3f7a95ae6f5b97440","0x8c178adae69bd40dbfb5525c34e4559dced9a3d17120edb9e03f67e07effbfd2","0xf1b6c11a6460151d5a873e1d0d1b7f93ad3c0102499d527186b06ad4150a72e5","0xdcb8a69d2fc8ec9f13a3b788bfd1fa6586f0d3bf1e3238bbcb0429fa5c718aa0","0x4f5e03c26e7a1f0278bcb263278e65ca3899830d7348ea2abbb98990d9f1366f","0x15295cade2de7b6d2d5f05b1dad8d0670409ae43f6eb0e5cff7a35412df4404a","0x69e7e74d5ff7773764c200523e0612886ce75d47aebf1172b1155a74abbd02cc"],"transactionsRoot":"0xb1e1e510561e0df912ce6297453a65bbca49d08845b0c51e20e76e239309feee","uncles":[]}`)
	_, signer, err := ecrecover(data)
	if err != nil {
		panic(err)
	}
	fmt.Println(hex.EncodeToString(signer))
}

func ecrecover(data []byte) (*ethtypes.Header, []byte, error) {
	header := new(ethtypes.Header)
	err := header.UnmarshalJSON(data)
	if err != nil {
		return header, nil, err
	}
	sigStart := len(header.Extra) - ethcrypto.SignatureLength
	if sigStart < 0 || sigStart > len(header.Extra) {
		return header, nil, fmt.Errorf("Unable to recover signature")
	}
	signature := header.Extra[sigStart:]
	pubkey, err := ethcrypto.Ecrecover(clique.SealHash(header).Bytes(), signature)
	if err != nil {
		return header, nil, err
	}
	signer := ethcrypto.Keccak256(pubkey[1:])[12:]

	return header, signer, nil
}

I don't really have a bone in this argument; I'm just trying to help maintain compatibility between clients.

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.

3 participants