status-go/rpc/chain/ethclient/geth_test_data.go

29 lines
16 KiB
Go
Raw Permalink Normal View History

package ethclient
import (
"encoding/json"
"fmt"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/types"
)
func getTestBlockHeader() (*big.Int, common.Hash, *types.Header) {
/* Response from command eth_getBlockByHash */
const blockJSON = `{"baseFeePerGas":"0x59309590","blobGasUsed":"0x0","difficulty":"0x0","excessBlobGas":"0xc0000","extraData":"0x546974616e2028746974616e6275696c6465722e78797a29","gasLimit":"0x1c9c380","gasUsed":"0xd5cb1c","hash":"0x89f810428b7dd314f70af66e6564402a6dbf8f437a120bcb7ede86d9f2bebca2","logsBloom":"0x07e51d29c48a4140f9116c149d21d143910232990c25d529068d5156dc9b816204fbe50aa86c8d31de96f480088ec735dba1d93a9ffe2b3379943246533e62d7bb7398cc90f89eab7c234109a461f07ab15f771009645a931869741d80ad6b6d8a480c2816754ba4c31e0c96927a7d5f6d25242380182e027bd2139f537b1065a0243ed92d883bed38d9a32d23fe2a0d7835dff5e18d36bbd0a528cb80be692f03ea319999ee6dfcbac511c2cc829fed26a544a664c59b5994e80318fa209bffcf82080747534f704190ca2178638fbcc0ea0cce97350194834178676861e087353d255af118c6e80907898e9464289c4d2cb20577cd98c69ad150665801168b","miner":"0x4838b106fce9647bdf1e7877bf73ce8b0bad5f97","mixHash":"0x0f55c89e7a4d66da6e7142dee0984b9a52845372490467ab12805bfb28f7b12f","nonce":"0x0000000000000000","number":"0x13ae2e2","parentBeaconBlockRoot":"0x74964cbfb50e903d24beeacc874c7f690cd0882d6800324fec14838c0318fbfc","parentHash":"0x7b1b5f3b3bffd5c1edfaf7acc79b703127bc2f12e35eddbc2b7e20e8b7835157","receiptsRoot":"0xfd2851cf1339b69cf952af6b5af702a2de08ebdcba8dcbcef57f6f6def87c851","sha3Uncles":"0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347","size":"0xf33e","stateRoot":"0x0956b0b590f412d3cbc3f0143fb92940c6a3381ddfac8d1aeb2520c49eb2d27c","timestamp":"0x66d0ce8f","totalDifficulty":"0xc70d815d562d3cfa955","transactions":["0xa2ed591a06b0953e6e5f9b46aaed6badad4b47ea76dcffd9f74b8516aaed3280","0x808f0d0bbf91d05262a331832699c3f58020a620b16e1c683dbe12470682ebcd","0x099da59611b6997dca3e66a1b3d205828d2f72daf46abccbf5832cbcb0e225a4","0x8c41206d5c819bb2dd049b58d0ebe3785f11324d101d15357d31af6ee30cc38c","0x07032cfdc4859795fdd99f35017ef88908c0f9886f5098535f2fc3a4431bb2cf","0x2ad7db0e90380ab95b68a02d964e3c6ac233017b6eb91141f24d52c11f006e14","0xa9a08330b89dbe4c153c4fb1fd72b0f6b7cf41b0b6bdd2dbd755ef54e6cf7efe","0x186a5de3e3b72e4d5bfd02df4d300cf8aa85748d8c6a389de132560788757e08","0x862cac29777179b4ef5c0172221336082c2760c0ae35a8fa17de42ed1b6e0381","0x58ef687afc0a40754238f329b55f52e4078198b3de7f462b60aadb9b8a51a433","0xc2d5ab44609caecde64db9e21e2333aa3de3c3803c5624dae2aa94bb2ef3484f","0xf09f39420320cd423f4aac2c248f1c0eb9c2a8b023892c57b831c86c4588ce4a","0x2e07f4e4431a7cef3205b0f2ff93eb4e9a601030b14268b8c4a48d95f515dc40","0x5e4cc65e98fd658c6228445f8a13fa1c66591bc060b7ebe65ef7edc01a5fdb01","0xaccb9a3ad72d2352e80100c0973e029658a5a9a1250050177f6aebc3a6543346","0x24185265d5175ab0580d8d3cef5d73b2cc25e374add97ef3f687c6869bdb3e71","0xbfb55c404106162c12812079b2b61a4e391ec589c7772fcf949cc55b477d214c","0x8ee90e0611da0457e364f0770148154d6e92c35e1129222021e063106aef98ab","0x857c20dba0f9ff2dbcb3434e6ebb7d5e71967a8d138a07ff0c13b395415ecd28","0x9d4c09925d6cccf88134e4513ae5f92663bba63eea2ada22c96789eaeaa133e8","0xd6b9be2fa773ab2fbbcf15e25ce61056e986b4b9e37966a6056f004c4df781ef","0x129cd35a1d00a7a38cca236e3a72514cb68a9a55b23adda277d559a3274bb999","0x27cbcf6bbc9217e4ac15d1b900e5981e5230dfddac59193ae9076156304bc213","0x0951a0cab06ed088248b73d672018b66732ca060b825ac692489fb7878237f6e","0x669494e9e5285edaca54b53addc0a277330ed40151b0a07715ffcd4aed3954c7","0x8f18744f1e2faddaa393fbea175a3eec8de90c9100081b9eceef53f9949cc59b","0x4bf748c5b0c01ea6a5ff4f1ef4c38e88426ebfc00a99cbc3cc6d2be7ff4d8ff1","0x1f1d26fd1a3c7d269bda2b7dfc2d717eab7cc9616299124e2e048a6e4e73c57e","0xb9145bdad50cb5a15cfea9fc8541027bd4d5f4abfa32b2393a593fde7d3351b6","0x5c4a01d65be2fb7cb321de3e4a6fc879b11e9d4a8554d59c05eecc55f0b3cb2a","0xe2926d0a406d77f88cd40aa876c67da8571226db7e9656763e595775fc0124f6","0x9d570d8a026a81bd7279e9377e6ad917230c6c7ef9f897083934a8086ded3e69","0x2e6b4691b4ca95b23736037fbd3a0fa9a37131020f10c8cf4d0e04e83b4d6ae5","0xa9787fb5fd8c5de8c62b31c4aceaf0056578a10477cbd7d19db1fb7b9724e582","0x842ac737ae47034f41ce412cb4a01dd35ac59a07e6ab27a0a00e6345d6ef7eac","0xb0ce684235c4b1c824a8aaf6c829a161837dbb1f7d5fdbfa11b90e0f548b7558","0xf4bce10d4a6b91e050bc161c97b951308cefb933485222c4e956cda23dfa93c8","0xbcdc781
blockNumber, ok := new(big.Int).SetString("13ae2e2", 16)
if !ok {
panic("could not parse block number")
}
blockHash := common.HexToHash("0x89f810428b7dd314f70af66e6564402a6dbf8f437a120bcb7ede86d9f2bebca2")
blockHeader := &types.Header{}
err := json.Unmarshal([]byte(blockJSON), blockHeader)
if err != nil {
panic(fmt.Sprintf("could not unmarshal block header: %s", err.Error()))
}
return blockNumber, blockHash, blockHeader
}