From 48c863debddbb9d187bc5174e33019b4ea32dc62 Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Tue, 9 Apr 2024 10:23:06 -0700 Subject: [PATCH 01/25] build-eth-block: use live gas price --- examples/build-eth-block/main.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/build-eth-block/main.go b/examples/build-eth-block/main.go index d3bf0b5..e53a5da 100644 --- a/examples/build-eth-block/main.go +++ b/examples/build-eth-block/main.go @@ -23,12 +23,15 @@ func main() { fundBalance := big.NewInt(100000000000000000) maybe(fr.L1.FundAccount(testAddr1.Address(), fundBalance)) + gasPrice, err := fr.L1.RPC().SuggestGasPrice(context.Background()) + maybe(err) + targeAddr := testAddr1.Address() tx, err := fr.L1.SignTx(testAddr1, &types.LegacyTx{ To: &targeAddr, Value: big.NewInt(1000), Gas: 21000, - GasPrice: big.NewInt(6701898710), + GasPrice: gasPrice.Add(gasPrice, big.NewInt(5000000000)), }) maybe(err) From 6ee19b2f79f53457c7ef3d72c5339c5a654fca80 Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Wed, 10 Apr 2024 13:00:12 -0700 Subject: [PATCH 02/25] add chain.DeployContractWithArgs to framework --- framework/framework.go | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/framework/framework.go b/framework/framework.go index b11d995..f810d92 100644 --- a/framework/framework.go +++ b/framework/framework.go @@ -254,13 +254,24 @@ type Chain struct { } func (c *Chain) DeployContract(path string) *Contract { + return c.DeployContractWithArgs(path, make([]interface{}, 0)...) +} + +func (c *Chain) DeployContractWithArgs(path string, constructorArgs ...interface{}) *Contract { artifact, err := ReadArtifact(path) if err != nil { panic(err) } + // encode constructorArgs to append to the contract code + constructorData, err := artifact.Abi.Constructor.Inputs.Pack(constructorArgs...) + if err != nil { + panic(err) + } + deployCode := append(artifact.Code, constructorData...) + // deploy contract - txnResult, err := sdk.DeployContract(artifact.Code, c.clt) + txnResult, err := sdk.DeployContract(deployCode, c.clt) if err != nil { panic(err) } From bb324625bc3586794b5548cd05656fd5790f7bea Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Wed, 10 Apr 2024 23:36:25 -0700 Subject: [PATCH 03/25] sending block to relay (in progress) --- examples/build-eth-block/builder.sol | 17 +++-- examples/build-eth-block/main.go | 71 ++++++++++++++++++--- framework/beacon.go | 93 ++++++++++++++++++++++++++++ framework/framework.go | 10 ++- go.mod | 5 +- go.sum | 5 ++ 6 files changed, 183 insertions(+), 18 deletions(-) create mode 100644 framework/beacon.go diff --git a/examples/build-eth-block/builder.sol b/examples/build-eth-block/builder.sol index e47b57a..485ad3d 100644 --- a/examples/build-eth-block/builder.sol +++ b/examples/build-eth-block/builder.sol @@ -2,6 +2,7 @@ pragma solidity ^0.8.8; import "suave-std/suavelib/Suave.sol"; +import {Suapp} from "suave-std/Suapp.sol"; contract AnyBundleContract { event DataRecordEvent(Suave.DataId dataId, uint64 decryptionCondition, address[] allowedPeekers); @@ -176,9 +177,11 @@ contract EthBlockContract is AnyBundleContract { } } -contract EthBlockBidSenderContract is EthBlockContract { +contract EthBlockBidSenderContract is EthBlockContract, Suapp { string boostRelayUrl; + event SubmitBlockResponse(bytes); + constructor(string memory boostRelayUrl_) { boostRelayUrl = boostRelayUrl_; } @@ -186,16 +189,18 @@ contract EthBlockBidSenderContract is EthBlockContract { function buildAndEmit( Suave.BuildBlockArgs memory blockArgs, uint64 blockHeight, - Suave.DataId[] memory dataRecords, + Suave.DataId bidId, string memory namespace - ) public virtual override returns (bytes memory) { + ) public emitOffchainLogs returns (bytes memory) { require(Suave.isConfidential()); - + Suave.DataId[] memory dataRecords = + abi.decode(Suave.confidentialRetrieve(bidId, "default:v0:mergedDataRecords"), (Suave.DataId[])); (Suave.DataRecord memory blockDataRecord, bytes memory builderBid) = this.doBuild(blockArgs, blockHeight, dataRecords, namespace); - Suave.submitEthBlockToRelay(boostRelayUrl, builderBid); + bytes memory blockRes = Suave.submitEthBlockToRelay(boostRelayUrl, builderBid); - emit DataRecordEvent(blockDataRecord.id, blockDataRecord.decryptionCondition, blockDataRecord.allowedPeekers); + // emit DataRecordEvent(blockDataRecord.id, blockDataRecord.decryptionCondition, blockDataRecord.allowedPeekers); + // emit SubmitBlockResponse(blockRes); return bytes.concat(this.emitDataRecord.selector, abi.encode(blockDataRecord)); } } diff --git a/examples/build-eth-block/main.go b/examples/build-eth-block/main.go index e53a5da..ba00a62 100644 --- a/examples/build-eth-block/main.go +++ b/examples/build-eth-block/main.go @@ -43,12 +43,15 @@ func main() { maybe(err) bundleContract := fr.Suave.DeployContract("builder.sol/BundleContract.json") - ethBlockContract := fr.Suave.DeployContract("builder.sol/EthBlockContract.json") + ethBlockContract := fr.Suave.DeployContractWithArgs( + "builder.sol/EthBlockBidSenderContract.json", + "https://0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae@boost-relay.flashbots.net", + ) - targetBlock := currentBlock(fr).Time() + targetBlock := currentL1Block(fr) { // Send a bundle to the builder - decryptionCondition := targetBlock + 1 + decryptionCondition := targetBlock.NumberU64() + 1 allowedPeekers := []common.Address{ buildEthBlockAddress, bundleContract.Raw().Address(), @@ -67,22 +70,72 @@ func main() { _ = bundleContract.SendConfidentialRequest("newBundle", newBundleArgs, confidentialDataBytes) } + var blockBidID any { // Signal to the builder that it's time to build a new block payloadArgsTuple := types.BuildBlockArgs{ ProposerPubkey: []byte{0x42}, - Timestamp: targetBlock + 12, // ethHead + uint64(12), + Timestamp: targetBlock.Time() + 12, // ethHead + uint64(12), FeeRecipient: common.Address{0x42}, } - _ = ethBlockContract.SendConfidentialRequest("buildFromPool", []any{payloadArgsTuple, targetBlock + 1}, nil) + receipt := ethBlockContract.SendConfidentialRequest("buildFromPool", []any{payloadArgsTuple, targetBlock.NumberU64() + 1}, nil) maybe(err) + + for _, receiptLog := range receipt.Logs { + /// debug stuff ;; free to remove + logJSON, err := receiptLog.MarshalJSON() + maybe(err) + log.Printf("receipt log: %s", string(logJSON)) + //////////////////////////////////////////////// + + if receiptLog.Topics[0] == ethBlockContract.Abi.Events["BuilderBoostBidEvent"].ID { + bids, err := ethBlockContract.Abi.Events["BuilderBoostBidEvent"].Inputs.Unpack(receiptLog.Data) + maybe(err) + blockBidID = bids[0] // the one we want for the merged-bundles data records + } + } + } + + { // Submit block to the relay + // get latest block from live chain + // execBlock, err := fr.L1.RPC().BlockByNumber(context.Background(), nil) + maybe(err) + beaconBlock, beaconRoot, err := fr.L1Beacon.GetBlockHeader(nil) + maybe(err) + blockJSON, err := json.Marshal(beaconBlock) + maybe(err) + log.Printf("beaconBlock: %s", string(blockJSON)) + + blockArgs := types.BuildBlockArgs{ + ProposerPubkey: []byte{0x42}, + Timestamp: getNewSlotTimestamp(beaconBlock.Slot), // head + 12, + FeeRecipient: testAddr1.Address(), + Parent: *beaconRoot, + Slot: beaconBlock.Slot + 1, + } + + /*buildAndEmit( + Suave.BuildBlockArgs memory blockArgs, + uint64 blockHeight, + Suave.DataId bidId, + string memory namespace + ) returns (bytes)*/ + _ = ethBlockContract.SendConfidentialRequest("buildAndEmit", []any{ + blockArgs, + targetBlock.NumberU64() + 1, + blockBidID, + "", + }, nil) } } -func currentBlock(fr *framework.Framework) *types.Block { - n, err := fr.L1.RPC().BlockNumber(context.TODO()) - maybe(err) - b, err := fr.L1.RPC().BlockByNumber(context.TODO(), new(big.Int).SetUint64(n)) +// Calculate the timestamp for a new slot. +func getNewSlotTimestamp(slot uint64) uint64 { + return 1712816195 + (slot-8832680)*12 +} + +func currentL1Block(fr *framework.Framework) *types.Block { + b, err := fr.L1.RPC().BlockByNumber(context.Background(), nil) maybe(err) return b } diff --git a/framework/beacon.go b/framework/beacon.go new file mode 100644 index 0000000..fe75120 --- /dev/null +++ b/framework/beacon.go @@ -0,0 +1,93 @@ +package framework + +import ( + "encoding/json" + "fmt" + "io" + "net/http" + + "github.com/ethereum/go-ethereum/beacon/types" + "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" +) + +type BeaconChain struct { + httpClient *http.Client + baseURL string +} + +type BeaconClient struct { + chain *BeaconChain +} + +func (b *BeaconChain) Http() *BeaconClient { + return &BeaconClient{chain: b} +} + +func (b *BeaconClient) Get(url string) ([]byte, error) { + res, err := b.chain.httpClient.Get(url) + if err != nil { + return nil, err + } + body, err := io.ReadAll(res.Body) + if err != nil { + panic(err) + } + return body, nil +} + +// type BeaconBlockHeader struct { +// Slot string `json:"slot"` +// ProposerIndex string `json:"proposer_index"` +// ParentRoot common.Hash `json:"parent_root"` +// StateRoot common.Hash `json:"state_root"` +// BodyRoot common.Hash `json:"body_root"` +// } + +// type SignedBeaconBlockHeader struct { +// Message BeaconBlockHeader `json:"message"` +// Signature []byte `json:"signature"` +// } + +// type GetBlockHeaderData struct { +// Root common.Hash `json:"root"` +// Canonical bool `json:"canonical"` +// Header SignedBeaconBlockHeader `json:"header"` +// } + +// type GetBlockHeaderResponse struct { +// ExecutionOptimistic bool `json:"execution_optimistic"` +// Finalized bool `json:"finalized"` +// Data []GetBlockHeaderData `json:"data"` +// } + +// GetBlockHeader gets the beacon block header for a given beacon block ID, or the latest block if blockID is nil. +func (b *BeaconChain) GetBlockHeader(blockID *common.Hash) (*types.Header, *common.Hash, error) { + url := fmt.Sprintf("%s/eth/v1/beacon/headers", b.baseURL) + if blockID != nil { + url = fmt.Sprintf("/%s", blockID) + } + + var data struct { + ExecutionOptimistic bool `json:"execution_optimistic"` + Finalized bool `json:"finalized"` + Data []struct { + Root common.Hash `json:"root"` + Canonical bool `json:"canonical"` + Header struct { + Message types.Header `json:"message"` + Signature hexutil.Bytes `json:"signature"` + } `json:"header"` + } `json:"data"` + } + + body, err := b.Http().Get(url) + if err != nil { + return nil, nil, err + } + if err := json.Unmarshal(body, &data); err != nil { + panic(err) + } + + return &data.Data[0].Header.Message, &data.Data[0].Root, nil +} diff --git a/framework/framework.go b/framework/framework.go index f810d92..8d975f0 100644 --- a/framework/framework.go +++ b/framework/framework.go @@ -9,6 +9,7 @@ import ( "fmt" "log" "math/big" + "net/http" "os" "path/filepath" "runtime" @@ -179,8 +180,9 @@ type Framework struct { config *Config KettleAddress common.Address - Suave *Chain - L1 *Chain + Suave *Chain + L1 *Chain + L1Beacon *BeaconChain } type Config struct { @@ -192,6 +194,8 @@ type Config struct { L1RPC string `env:"L1_RPC, default=http://localhost:8555"` + L1BeaconURL string `env:"L1_BEACON_URL, default=https://ethereum-beacon-api.publicnode.com"` + // This account is funded in your local L1 devnet // address: 0xB5fEAfbDD752ad52Afb7e1bD2E40432A485bBB7F FundedAccountL1 *PrivKey `env:"L1_PRIVKEY, default=6c45335a22461ccdb978b78ab61b238bad2fae4544fb55c14eb096c875ccfc52"` @@ -242,6 +246,8 @@ func New(opts ...ConfigOption) *Framework { } l1Clt := sdk.NewClient(l1RPC, config.FundedAccountL1.Priv, common.Address{}) fr.L1 = &Chain{rpc: l1RPC, clt: l1Clt} + + fr.L1Beacon = &BeaconChain{httpClient: http.DefaultClient, baseURL: config.L1BeaconURL} } return fr diff --git a/go.mod b/go.mod index 68ea701..e5dd92e 100644 --- a/go.mod +++ b/go.mod @@ -7,7 +7,7 @@ toolchain go1.21.3 replace github.com/ethereum/go-ethereum => github.com/flashbots/suave-geth v0.1.3 require ( - github.com/ethereum/go-ethereum v1.12.0 + github.com/ethereum/go-ethereum v1.13.14 github.com/sethvargo/go-envconfig v1.0.0 ) @@ -56,6 +56,7 @@ require ( github.com/holiman/uint256 v1.2.3 // indirect github.com/huin/goupnp v1.0.3 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect + github.com/kilic/bls12-381 v0.1.0 // indirect github.com/klauspost/compress v1.15.15 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/kr/pretty v0.3.1 // indirect @@ -74,6 +75,7 @@ require ( github.com/prometheus/client_model v0.3.0 // indirect github.com/prometheus/common v0.42.0 // indirect github.com/prometheus/procfs v0.10.1 // indirect + github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7 // indirect github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/rs/cors v1.7.0 // indirect @@ -100,5 +102,6 @@ require ( gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect rsc.io/tmplfunc v0.0.3 // indirect ) diff --git a/go.sum b/go.sum index a24b79d..e8cf94a 100644 --- a/go.sum +++ b/go.sum @@ -241,6 +241,8 @@ github.com/kataras/iris/v12 v12.1.8/go.mod h1:LMYy4VlP67TQ3Zgriz8RE2h2kMZV2SgMYb github.com/kataras/neffos v0.0.14/go.mod h1:8lqADm8PnbeFfL7CLXh1WHw53dG27MC3pgi2R1rmoTE= github.com/kataras/pio v0.0.2/go.mod h1:hAoW0t9UmXi4R5Oyq5Z4irTbaTsOemSrDGUtaTl7Dro= github.com/kataras/sitemap v0.0.5/go.mod h1:KY2eugMKiPwsJgx7+U103YZehfvNGOXURubcGyk0Bz8= +github.com/kilic/bls12-381 v0.1.0 h1:encrdjqKMEvabVQ7qYOKu1OvhqpK4s47wDYtNiPtlp4= +github.com/kilic/bls12-381 v0.1.0/go.mod h1:vDTTHJONJ6G+P2R74EhnyotQDTliQDnFEwhdmfzw1ig= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= @@ -346,6 +348,8 @@ github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= +github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7 h1:cZC+usqsYgHtlBaGulVnZ1hfKAi8iWtujBnRLQE698c= +github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7/go.mod h1:IToEjHuttnUzwZI5KBSM/LOOW3qLbbrHOEfp3SbECGY= github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7 h1:0tVE4tdWQK9ZpYygoV7+vS6QkDvQVySboMVEIxBJmXw= github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7/go.mod h1:wmuf/mdK4VMD+jA9ThwcUKjg3a2XWM9cVfFYjDyY4j4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= @@ -505,6 +509,7 @@ golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201101102859-da207088b7d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= From 1dd3155aa8e3a314b251370fd89d830aa7bc6288 Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Thu, 11 Apr 2024 00:46:51 -0700 Subject: [PATCH 04/25] handle ascii-decimal-array error from http calls --- framework/framework.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/framework/framework.go b/framework/framework.go index 8d975f0..d04c211 100644 --- a/framework/framework.go +++ b/framework/framework.go @@ -13,6 +13,7 @@ import ( "os" "path/filepath" "runtime" + "strconv" "strings" "github.com/ethereum/go-ethereum" @@ -145,12 +146,27 @@ func (c *Contract) Raw() *sdk.Contract { var executionRevertedPrefix = "execution reverted: 0x" +// parseASCIIDecimals parses an ASCII array string into a byte array. +// +// parse("0 1 2 3") == []byte{0, 1, 2, 3} +func parseASCIIDecimals(asciiArray string) *[]byte { + // parse "byte array" bytes (decimals) into actual byte array + decodedBytes := make([]byte, len(asciiArray)) + decimalWords := strings.Split(asciiArray, " ") + for i := 0; i < len(decimalWords); i++ { + b, _ := strconv.ParseUint(decimalWords[i], 10, 8) + decodedBytes[i] = byte(b) + } + return &decodedBytes +} + // SendConfidentialRequest sends the confidential request to the kettle func (c *Contract) SendConfidentialRequest(method string, args []interface{}, confidentialBytes []byte) *types.Receipt { txnResult, err := c.contract.SendTransaction(method, args, confidentialBytes) if err != nil { // decode the PeekerReverted error errMsg := err.Error() + log.Printf("suffix %s %v", errMsg[len(errMsg)-4:], strings.HasSuffix(errMsg, "10]'")) if strings.HasPrefix(errMsg, executionRevertedPrefix) { errMsg = errMsg[len(executionRevertedPrefix):] errMsgBytes, _ := hex.DecodeString(errMsg) @@ -160,6 +176,13 @@ func (c *Contract) SendConfidentialRequest(method string, args []interface{}, co addr, _ := unpacked[0].(common.Address) eventErr, _ := unpacked[1].([]byte) panic(fmt.Sprintf("peeker 0x%x reverted: %s", addr, eventErr)) + } else if strings.HasSuffix(errMsg, "10]'") { // ascii decimal array + log.Printf("found suffix") + // split "byte array" from error string + errChunks := strings.SplitAfter(errMsg, "[") + callErr := errChunks[0][:len(errChunks[0])-1] // removes "[" at the end + internalErr := parseASCIIDecimals(errChunks[1][:len(errChunks[1])-2]) // removes "']" at the end + panic(fmt.Sprintf("%s%s", callErr, string(*internalErr))) } panic(err) } From bdea359a9bd69628ef52ae2c5740ecf6af9972a4 Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Thu, 11 Apr 2024 00:47:42 -0700 Subject: [PATCH 05/25] remove unneeded log --- framework/framework.go | 1 - 1 file changed, 1 deletion(-) diff --git a/framework/framework.go b/framework/framework.go index d04c211..d141ef5 100644 --- a/framework/framework.go +++ b/framework/framework.go @@ -166,7 +166,6 @@ func (c *Contract) SendConfidentialRequest(method string, args []interface{}, co if err != nil { // decode the PeekerReverted error errMsg := err.Error() - log.Printf("suffix %s %v", errMsg[len(errMsg)-4:], strings.HasSuffix(errMsg, "10]'")) if strings.HasPrefix(errMsg, executionRevertedPrefix) { errMsg = errMsg[len(executionRevertedPrefix):] errMsgBytes, _ := hex.DecodeString(errMsg) From 48038c4f2b121b9039931cb8b3cea0bc0e33f0fc Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Thu, 11 Apr 2024 00:50:38 -0700 Subject: [PATCH 06/25] remove unneeded log --- framework/framework.go | 1 - 1 file changed, 1 deletion(-) diff --git a/framework/framework.go b/framework/framework.go index d141ef5..dfad40c 100644 --- a/framework/framework.go +++ b/framework/framework.go @@ -176,7 +176,6 @@ func (c *Contract) SendConfidentialRequest(method string, args []interface{}, co eventErr, _ := unpacked[1].([]byte) panic(fmt.Sprintf("peeker 0x%x reverted: %s", addr, eventErr)) } else if strings.HasSuffix(errMsg, "10]'") { // ascii decimal array - log.Printf("found suffix") // split "byte array" from error string errChunks := strings.SplitAfter(errMsg, "[") callErr := errChunks[0][:len(errChunks[0])-1] // removes "[" at the end From 9de5ad30646e44812a3dc523d00946e2303e262f Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Thu, 11 Apr 2024 18:30:11 -0700 Subject: [PATCH 07/25] (WIP) using beacon chain for block-building data --- examples/build-eth-block/builder.sol | 36 +++++----- examples/build-eth-block/main.go | 102 ++++++++++++++++----------- framework/beacon.go | 102 +++++++++++++-------------- 3 files changed, 130 insertions(+), 110 deletions(-) diff --git a/examples/build-eth-block/builder.sol b/examples/build-eth-block/builder.sol index 485ad3d..e655305 100644 --- a/examples/build-eth-block/builder.sol +++ b/examples/build-eth-block/builder.sol @@ -4,7 +4,7 @@ pragma solidity ^0.8.8; import "suave-std/suavelib/Suave.sol"; import {Suapp} from "suave-std/Suapp.sol"; -contract AnyBundleContract { +contract AnyBundleContract is Suapp { event DataRecordEvent(Suave.DataId dataId, uint64 decryptionCondition, address[] allowedPeekers); function fetchConfidentialBundleData() public returns (bytes memory) { @@ -177,30 +177,30 @@ contract EthBlockContract is AnyBundleContract { } } -contract EthBlockBidSenderContract is EthBlockContract, Suapp { +contract EthBlockBidSenderContract is EthBlockContract { string boostRelayUrl; - event SubmitBlockResponse(bytes); + event SubmitBlockResponse(bytes, bytes); constructor(string memory boostRelayUrl_) { boostRelayUrl = boostRelayUrl_; } - function buildAndEmit( - Suave.BuildBlockArgs memory blockArgs, - uint64 blockHeight, - Suave.DataId bidId, - string memory namespace - ) public emitOffchainLogs returns (bytes memory) { + function submitToRelay(Suave.BuildBlockArgs calldata blockArgs, Suave.DataId bidId, string calldata namespace) + public + emitOffchainLogs + returns (bytes memory) + { require(Suave.isConfidential()); - Suave.DataId[] memory dataRecords = - abi.decode(Suave.confidentialRetrieve(bidId, "default:v0:mergedDataRecords"), (Suave.DataId[])); - (Suave.DataRecord memory blockDataRecord, bytes memory builderBid) = - this.doBuild(blockArgs, blockHeight, dataRecords, namespace); - bytes memory blockRes = Suave.submitEthBlockToRelay(boostRelayUrl, builderBid); - - // emit DataRecordEvent(blockDataRecord.id, blockDataRecord.decryptionCondition, blockDataRecord.allowedPeekers); - // emit SubmitBlockResponse(blockRes); - return bytes.concat(this.emitDataRecord.selector, abi.encode(blockDataRecord)); + + // bytes memory payload = this.unlock(bidId, hex""); + (bytes memory builderBid, bytes memory payload) = Suave.buildEthBlock(blockArgs, bidId, namespace); + bytes memory response = Suave.submitEthBlockToRelay(boostRelayUrl, builderBid); + + return bytes.concat(this.emitBlockSubmissionResponse.selector, abi.encode(builderBid, response)); + } + + function emitBlockSubmissionResponse(bytes memory payload, bytes memory response) public { + emit SubmitBlockResponse(payload, response); } } diff --git a/examples/build-eth-block/main.go b/examples/build-eth-block/main.go index ba00a62..02d4176 100644 --- a/examples/build-eth-block/main.go +++ b/examples/build-eth-block/main.go @@ -7,7 +7,9 @@ import ( "math/big" "github.com/ethereum/go-ethereum/common" + "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" + "github.com/ethereum/go-ethereum/crypto" "github.com/flashbots/suapp-examples/framework" ) @@ -68,64 +70,82 @@ func main() { maybe(err) _ = bundleContract.SendConfidentialRequest("newBundle", newBundleArgs, confidentialDataBytes) + log.Printf("finished newBundle") } - var blockBidID any - { // Signal to the builder that it's time to build a new block - payloadArgsTuple := types.BuildBlockArgs{ - ProposerPubkey: []byte{0x42}, - Timestamp: targetBlock.Time() + 12, // ethHead + uint64(12), - FeeRecipient: common.Address{0x42}, + var blockBidID [16]byte + // get latest blocks (exec & beacon) from live chain + execBlock, err := fr.L1.RPC().BlockByNumber(context.Background(), nil) + maybe(err) + execHeaderJSON, err := execBlock.Header().MarshalJSON() + log.Printf("execBlock header: %s", string(execHeaderJSON)) + beaconRes, err := fr.L1Beacon.GetBlockHeader(nil) + maybe(err) + beaconBlock := beaconRes.Data[0] + blockJSON, err := json.Marshal(beaconBlock) + maybe(err) + log.Printf("beaconBlock header: %s (root=%s)", string(blockJSON), "") + var proposerPubkey []byte + + targetSlot := beaconBlock.Header.Message.Slot + 1 + epoch := beaconBlock.Header.Message.Epoch() + proposerDuties, err := fr.L1Beacon.GetProposerDuties(epoch) + maybe(err) + // find proposer duties for target slot + for _, duty := range proposerDuties.Data { + if duty.Slot == targetSlot { + dutyJSON, err := json.Marshal(duty) + maybe(err) + log.Printf("found proposer duty for slot %d, %s", targetSlot, dutyJSON) + proposerPubkey = duty.Pubkey + maybe(err) + break } + } + pubkey, err := crypto.UnmarshalPubkey(proposerPubkey) + maybe(err) + proposerAddress := crypto.PubkeyToAddress(*pubkey) + + blockArgs := types.BuildBlockArgs{ + ProposerPubkey: proposerPubkey, + Timestamp: getNewSlotTimestamp(beaconBlock.Header.Message.Slot), + FeeRecipient: proposerAddress, + Parent: execBlock.Hash(), + Slot: targetSlot, + BeaconRoot: *&beaconBlock.Root, + } - receipt := ethBlockContract.SendConfidentialRequest("buildFromPool", []any{payloadArgsTuple, targetBlock.NumberU64() + 1}, nil) + { // Signal to the builder that it's time to build a new block + receipt := ethBlockContract.SendConfidentialRequest("buildFromPool", []any{blockArgs, targetBlock.NumberU64() + 1}, nil) maybe(err) for _, receiptLog := range receipt.Logs { - /// debug stuff ;; free to remove - logJSON, err := receiptLog.MarshalJSON() - maybe(err) - log.Printf("receipt log: %s", string(logJSON)) - //////////////////////////////////////////////// - - if receiptLog.Topics[0] == ethBlockContract.Abi.Events["BuilderBoostBidEvent"].ID { - bids, err := ethBlockContract.Abi.Events["BuilderBoostBidEvent"].Inputs.Unpack(receiptLog.Data) + buildEvent := ethBlockContract.Abi.Events["BuilderBoostBidEvent"] + if receiptLog.Topics[0] == buildEvent.ID { + bids, err := buildEvent.Inputs.Unpack(receiptLog.Data) maybe(err) - blockBidID = bids[0] // the one we want for the merged-bundles data records + blockBidID = bids[0].([16]byte) + break } } + log.Printf("finished buildFromPool") } { // Submit block to the relay - // get latest block from live chain - // execBlock, err := fr.L1.RPC().BlockByNumber(context.Background(), nil) - maybe(err) - beaconBlock, beaconRoot, err := fr.L1Beacon.GetBlockHeader(nil) - maybe(err) - blockJSON, err := json.Marshal(beaconBlock) - maybe(err) - log.Printf("beaconBlock: %s", string(blockJSON)) - - blockArgs := types.BuildBlockArgs{ - ProposerPubkey: []byte{0x42}, - Timestamp: getNewSlotTimestamp(beaconBlock.Slot), // head + 12, - FeeRecipient: testAddr1.Address(), - Parent: *beaconRoot, - Slot: beaconBlock.Slot + 1, - } - - /*buildAndEmit( - Suave.BuildBlockArgs memory blockArgs, - uint64 blockHeight, - Suave.DataId bidId, - string memory namespace - ) returns (bytes)*/ - _ = ethBlockContract.SendConfidentialRequest("buildAndEmit", []any{ + log.Printf("blockBidID: %s", hexutil.Encode(blockBidID[:])) + receipt := ethBlockContract.SendConfidentialRequest("submitToRelay", []any{ blockArgs, - targetBlock.NumberU64() + 1, blockBidID, "", }, nil) + log.Printf("finished submitToRelay") + + // get logs from ccr + for _, receiptLog := range receipt.Logs { + if receiptLog.Topics[0] == ethBlockContract.Abi.Events["SubmitBlockResponse"].ID { + log.Printf("SubmitBlockResponse: %s", receiptLog.Data) + } + } } } diff --git a/framework/beacon.go b/framework/beacon.go index fe75120..41bc95b 100644 --- a/framework/beacon.go +++ b/framework/beacon.go @@ -4,6 +4,7 @@ import ( "encoding/json" "fmt" "io" + "log" "net/http" "github.com/ethereum/go-ethereum/beacon/types" @@ -11,83 +12,82 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" ) +// BeaconChain is a very-minimal client for interacting with the beacon chain. type BeaconChain struct { httpClient *http.Client baseURL string } -type BeaconClient struct { - chain *BeaconChain +// GetBlockHeaderResponse is returned from GetBlockHeader. +type GetBlockHeaderResponse struct { + ExecutionOptimistic bool `json:"execution_optimistic"` + Finalized bool `json:"finalized"` + Data []struct { + Root common.Hash `json:"root"` + Canonical bool `json:"canonical"` + Header struct { + Message types.Header `json:"message"` + Signature hexutil.Bytes `json:"signature"` + } `json:"header"` + } `json:"data"` } -func (b *BeaconChain) Http() *BeaconClient { - return &BeaconClient{chain: b} +// GetProposerDutiesResponse is returned from GetProposerDuties. +type GetProposerDutiesResponse struct { + DependentRoot common.Hash `json:"dependent_root"` + ExecutionOptimistic bool `json:"execution_optimistic"` + Data []struct { + Pubkey hexutil.Bytes `json:"pubkey"` + ValidatorIndex uint64 `json:"validator_index,string"` + Slot uint64 `json:"slot,string"` + } `json:"data"` } -func (b *BeaconClient) Get(url string) ([]byte, error) { - res, err := b.chain.httpClient.Get(url) +// GetAndParse makes a GET request to the given URL and unmarshals the response into v. +func GetAndParse[V interface{}](b *BeaconChain, url string, v V) error { + res, err := b.httpClient.Get(url) if err != nil { - return nil, err + return err } body, err := io.ReadAll(res.Body) if err != nil { + return err + } + if err := json.Unmarshal(body, v); err != nil { panic(err) } - return body, nil + return nil } -// type BeaconBlockHeader struct { -// Slot string `json:"slot"` -// ProposerIndex string `json:"proposer_index"` -// ParentRoot common.Hash `json:"parent_root"` -// StateRoot common.Hash `json:"state_root"` -// BodyRoot common.Hash `json:"body_root"` -// } - -// type SignedBeaconBlockHeader struct { -// Message BeaconBlockHeader `json:"message"` -// Signature []byte `json:"signature"` -// } - -// type GetBlockHeaderData struct { -// Root common.Hash `json:"root"` -// Canonical bool `json:"canonical"` -// Header SignedBeaconBlockHeader `json:"header"` -// } - -// type GetBlockHeaderResponse struct { -// ExecutionOptimistic bool `json:"execution_optimistic"` -// Finalized bool `json:"finalized"` -// Data []GetBlockHeaderData `json:"data"` -// } +// getAndParse calls GetAndParse with the BeaconChain receiver. +func (b *BeaconChain) getAndParse(url string, v any) error { + return GetAndParse(b, url, v) +} // GetBlockHeader gets the beacon block header for a given beacon block ID, or the latest block if blockID is nil. -func (b *BeaconChain) GetBlockHeader(blockID *common.Hash) (*types.Header, *common.Hash, error) { +func (b *BeaconChain) GetBlockHeader(blockID *common.Hash) (*GetBlockHeaderResponse, error) { url := fmt.Sprintf("%s/eth/v1/beacon/headers", b.baseURL) if blockID != nil { url = fmt.Sprintf("/%s", blockID) } - var data struct { - ExecutionOptimistic bool `json:"execution_optimistic"` - Finalized bool `json:"finalized"` - Data []struct { - Root common.Hash `json:"root"` - Canonical bool `json:"canonical"` - Header struct { - Message types.Header `json:"message"` - Signature hexutil.Bytes `json:"signature"` - } `json:"header"` - } `json:"data"` + data := new(GetBlockHeaderResponse) + if err := b.getAndParse(url, data); err != nil { + panic(err) } - body, err := b.Http().Get(url) - if err != nil { - return nil, nil, err - } - if err := json.Unmarshal(body, &data); err != nil { - panic(err) + return data, nil +} + +// GetProposerDuties gets the proposer duties for a given epoch. +func (b *BeaconChain) GetProposerDuties(epoch uint64) (*GetProposerDutiesResponse, error) { + url := fmt.Sprintf("%s/eth/v1/validator/duties/proposer/%d", b.baseURL, epoch) + log.Printf("url: %s", url) + + data := new(GetProposerDutiesResponse) + if err := b.getAndParse(url, data); err != nil { + return nil, err } - return &data.Data[0].Header.Message, &data.Data[0].Root, nil + return data, nil } From 6a152c8332429849b655ff87a4cb83f88b1acb55 Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Sat, 13 Apr 2024 16:19:36 -0700 Subject: [PATCH 08/25] (temp) add timers --- examples/build-eth-block/main.go | 32 +++--- framework/beacon.go | 2 +- go.mod | 41 +++++--- go.sum | 162 ++++++++++++++++++------------- 4 files changed, 141 insertions(+), 96 deletions(-) diff --git a/examples/build-eth-block/main.go b/examples/build-eth-block/main.go index 02d4176..f8cc761 100644 --- a/examples/build-eth-block/main.go +++ b/examples/build-eth-block/main.go @@ -5,12 +5,11 @@ import ( "encoding/json" "log" "math/big" + "time" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" - "github.com/ethereum/go-ethereum/crypto" - "github.com/flashbots/suapp-examples/framework" ) @@ -69,8 +68,11 @@ func main() { confidentialDataBytes, err := bundleContract.Abi.Methods["fetchConfidentialBundleData"].Outputs.Pack(bundleBytes) maybe(err) + // get current timestamp from system + startTime := time.Now().UnixMilli() _ = bundleContract.SendConfidentialRequest("newBundle", newBundleArgs, confidentialDataBytes) - log.Printf("finished newBundle") + duration := time.Now().UnixMilli() - startTime + log.Printf("finished newBundle in %d ms", duration) } var blockBidID [16]byte @@ -85,38 +87,42 @@ func main() { blockJSON, err := json.Marshal(beaconBlock) maybe(err) log.Printf("beaconBlock header: %s (root=%s)", string(blockJSON), "") - var proposerPubkey []byte targetSlot := beaconBlock.Header.Message.Slot + 1 epoch := beaconBlock.Header.Message.Epoch() proposerDuties, err := fr.L1Beacon.GetProposerDuties(epoch) + var slotDuty struct { // TODO: replace w/ proper eth2 lib + Pubkey hexutil.Bytes `json:"pubkey"` + ValidatorIndex uint64 `json:"validator_index,string"` + Slot uint64 `json:"slot,string"` + } maybe(err) // find proposer duties for target slot for _, duty := range proposerDuties.Data { if duty.Slot == targetSlot { + slotDuty = duty dutyJSON, err := json.Marshal(duty) maybe(err) log.Printf("found proposer duty for slot %d, %s", targetSlot, dutyJSON) - proposerPubkey = duty.Pubkey maybe(err) break } } - pubkey, err := crypto.UnmarshalPubkey(proposerPubkey) - maybe(err) - proposerAddress := crypto.PubkeyToAddress(*pubkey) - + // decode BLS pubkey to Ethereum address blockArgs := types.BuildBlockArgs{ - ProposerPubkey: proposerPubkey, + ProposerPubkey: slotDuty.Pubkey, Timestamp: getNewSlotTimestamp(beaconBlock.Header.Message.Slot), - FeeRecipient: proposerAddress, + FeeRecipient: common.Address(testAddr1.Address()), Parent: execBlock.Hash(), Slot: targetSlot, BeaconRoot: *&beaconBlock.Root, } { // Signal to the builder that it's time to build a new block + startTime := time.Now().UnixMilli() receipt := ethBlockContract.SendConfidentialRequest("buildFromPool", []any{blockArgs, targetBlock.NumberU64() + 1}, nil) + duration := time.Now().UnixMilli() - startTime + log.Printf("finished buildFromPool in %d ms", duration) maybe(err) for _, receiptLog := range receipt.Logs { @@ -133,12 +139,14 @@ func main() { { // Submit block to the relay log.Printf("blockBidID: %s", hexutil.Encode(blockBidID[:])) + startTime := time.Now().UnixMilli() receipt := ethBlockContract.SendConfidentialRequest("submitToRelay", []any{ blockArgs, blockBidID, "", }, nil) - log.Printf("finished submitToRelay") + duration := time.Now().UnixMilli() - startTime + log.Printf("finished submitToRelay in %d ms", duration) // get logs from ccr for _, receiptLog := range receipt.Logs { diff --git a/framework/beacon.go b/framework/beacon.go index 41bc95b..91222ed 100644 --- a/framework/beacon.go +++ b/framework/beacon.go @@ -73,7 +73,7 @@ func (b *BeaconChain) GetBlockHeader(blockID *common.Hash) (*GetBlockHeaderRespo data := new(GetBlockHeaderResponse) if err := b.getAndParse(url, data); err != nil { - panic(err) + return nil, err } return data, nil diff --git a/go.mod b/go.mod index e5dd92e..abc8da7 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( require ( github.com/DataDog/zstd v1.5.2 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect github.com/VictoriaMetrics/fastcache v1.6.0 // indirect github.com/attestantio/go-builder-client v0.4.2 // indirect @@ -29,9 +30,10 @@ require ( github.com/consensys/gnark-crypto v0.11.0 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect github.com/crate-crypto/go-kzg-4844 v0.7.0 // indirect - github.com/davecgh/go-spew v1.1.1 // indirect + github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/deckarep/golang-set/v2 v2.1.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect + github.com/docker/go-units v0.5.0 // indirect github.com/ethereum/c-kzg-4844 v0.2.0 // indirect github.com/fatih/color v1.15.0 // indirect github.com/ferranbt/fastssz v0.1.3 // indirect @@ -41,6 +43,7 @@ require ( github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect github.com/getsentry/sentry-go v0.18.0 // indirect github.com/go-ole/go-ole v1.2.1 // indirect + github.com/go-playground/validator/v10 v10.14.0 // indirect github.com/go-stack/stack v1.8.1 // indirect github.com/goccy/go-yaml v1.11.2 // indirect github.com/gofrs/flock v0.8.1 // indirect @@ -49,56 +52,62 @@ require ( github.com/golang/protobuf v1.5.3 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/google/gofuzz v1.2.0 // indirect - github.com/google/uuid v1.3.1 // indirect - github.com/gorilla/websocket v1.4.2 // indirect + github.com/google/uuid v1.4.0 // indirect + github.com/gorilla/websocket v1.5.0 // indirect github.com/hashicorp/go-bexpr v0.1.10 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/holiman/uint256 v1.2.3 // indirect - github.com/huin/goupnp v1.0.3 // indirect + github.com/huin/goupnp v1.1.0 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/kilic/bls12-381 v0.1.0 // indirect - github.com/klauspost/compress v1.15.15 // indirect + github.com/klauspost/compress v1.17.1 // indirect github.com/klauspost/cpuid/v2 v2.2.5 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-runewidth v0.0.9 // indirect + github.com/mattn/go-runewidth v0.0.14 // indirect github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect github.com/minio/sha256-simd v1.0.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mitchellh/pointerstructure v1.2.0 // indirect github.com/mmcloughlin/addchain v0.4.0 // indirect github.com/olekukonko/tablewriter v0.0.5 // indirect + github.com/onsi/gomega v1.27.4 // indirect github.com/pkg/errors v0.9.1 // indirect - github.com/prometheus/client_golang v1.16.0 // indirect - github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.10.1 // indirect + github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect + github.com/prometheus/client_golang v1.17.0 // indirect + github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect + github.com/prometheus/common v0.44.0 // indirect + github.com/prometheus/procfs v0.11.1 // indirect github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7 // indirect github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7 // indirect + github.com/rivo/uniseg v0.2.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/rs/cors v1.7.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/status-im/keycard-go v0.2.0 // indirect github.com/supranational/blst v0.3.11-0.20230406105308-e9dfc5ee724b // indirect - github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 // indirect + github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tklauser/go-sysconf v0.3.5 // indirect github.com/tklauser/numcpus v0.2.2 // indirect github.com/tyler-smith/go-bip39 v1.1.0 // indirect - github.com/umbracle/ethgo v0.1.3 // indirect - github.com/umbracle/fastrlp v0.0.0-20220527094140-59d5dd30e722 // indirect + github.com/umbracle/ethgo v0.1.4-0.20231006072852-6b068360fc97 // indirect + github.com/umbracle/fastrlp v0.1.1-0.20230504065717-58a1b8a9929d // indirect github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa // indirect - github.com/valyala/fastjson v1.4.1 // indirect + github.com/valyala/fastjson v1.6.3 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect golang.org/x/crypto v0.14.0 // indirect golang.org/x/exp v0.0.0-20230810033253-352e893a4cad // indirect - golang.org/x/sync v0.2.0 // indirect + golang.org/x/net v0.17.0 // indirect + golang.org/x/sync v0.4.0 // indirect golang.org/x/sys v0.13.0 // indirect golang.org/x/text v0.13.0 // indirect + golang.org/x/time v0.3.0 // indirect + golang.org/x/tools v0.14.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect - google.golang.org/protobuf v1.30.0 // indirect + google.golang.org/protobuf v1.31.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index e8cf94a..4e3ff21 100644 --- a/go.sum +++ b/go.sum @@ -10,8 +10,8 @@ github.com/CloudyKit/jet/v3 v3.0.0/go.mod h1:HKQPgSJmdK8hdoAbKUUWajkHyHo4RaU5rMd github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= github.com/DataDog/zstd v1.5.2/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKzY= -github.com/Microsoft/go-winio v0.4.13 h1:Hmi80lzZuI/CaYmlJp/b+FjZdRZhKu9c2mDVqKlLWVs= -github.com/Microsoft/go-winio v0.4.13/go.mod h1:qXqCSQ3Xa7+6tgxaGTIe4Kpcdsi+P8jBhyzoq1bpyYA= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0= @@ -49,6 +49,9 @@ github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= @@ -68,8 +71,8 @@ github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/Yj github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= github.com/consensys/gnark-crypto v0.11.0 h1:QqzHQlwEqlQr5jfWblGDkwlKHpT+4QodYqqExkAtyks= github.com/consensys/gnark-crypto v0.11.0/go.mod h1:Iq/P3HHl0ElSjsg2E1gsMwhAyxnxoKK5nVyZKd+/KhU= -github.com/containerd/continuity v0.0.0-20191214063359-1097c8bae83b h1:pik3LX++5O3UiNWv45wfP/WT81l7ukBJzd3uUiifbSU= -github.com/containerd/continuity v0.0.0-20191214063359-1097c8bae83b/go.mod h1:Dq467ZllaHgAtVp4p1xUQWBrFXR9s/wyoTpG8zOJGkY= +github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= +github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -80,8 +83,9 @@ github.com/crate-crypto/go-kzg-4844 v0.7.0 h1:C0vgZRk4q4EZ/JgPfzuSoxdCq3C3mOZMBS github.com/crate-crypto/go-kzg-4844 v0.7.0/go.mod h1:1kMhvPgI0Ky3yIa+9lFySEBUBXkYxeOi8ZF1sYioxhc= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= +github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/deckarep/golang-set/v2 v2.1.0 h1:g47V4Or+DUdzbs8FxCCmgb6VYd+ptPAngjM6dtGktsI= github.com/deckarep/golang-set/v2 v2.1.0/go.mod h1:VAky9rY/yGXJOLEDv3OMci+7wtDpOF4IN+y82NBOac4= github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= @@ -94,8 +98,8 @@ github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f h1:lO4WD4F/r github.com/dgryski/go-rendezvous v0.0.0-20200823014737-9f7001d12a5f/go.mod h1:cuUVRXasLTGF7a8hSLbxyZXjz+1KgoB3wDUb6vlszIc= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= -github.com/docker/go-units v0.4.0 h1:3uh0PgVws3nIA0Q+MwDC8yjEPf9zjRfZZWXZYDct3Tw= -github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= +github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -121,8 +125,11 @@ github.com/flashbots/suave-geth v0.1.3 h1:yTmt5Iez8GbwleG5D0Qpf7qTyQXyILC+KxWjfx github.com/flashbots/suave-geth v0.1.3/go.mod h1:fUoPFJkZQ0Q2E+DsixtdqJm/4oWuuFzJ7Ukz8pmgHeA= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= +github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= github.com/fsnotify/fsnotify v1.6.0 h1:n+5WquG0fcWoWp6xPWfHdbskMCQaFnG6PfBrh1Ky4HY= github.com/fsnotify/fsnotify v1.6.0/go.mod h1:sl3t1tCWJFWoRz9R8WJCbQihKKwmorjAbSClcnxKAGw= +github.com/gabriel-vasile/mimetype v1.4.2 h1:w5qFW6JKBz9Y393Y4q372O9A7cUSequkh1Q7OhCmWKU= +github.com/gabriel-vasile/mimetype v1.4.2/go.mod h1:zApsH/mKG4w07erKIaJPFiX0Tsq9BFQgN3qGY5GnNgA= github.com/gavv/httpexpect v2.0.0+incompatible/go.mod h1:x+9tiU1YnrOvnB725RkpoLv1M62hOWzwo5OXotisrKc= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff h1:tY80oXqGNY4FhTFhk+o9oFHGINQ/+vhlm8HFzi6znCI= github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= @@ -138,16 +145,17 @@ github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3Bop github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= -github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= -github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= -github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= -github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= -github.com/go-playground/validator/v10 v10.11.1 h1:prmOlTVv+YjZjmRmNSF3VmspqJIxJWXmqUsHwfTRRkQ= -github.com/go-playground/validator/v10 v10.11.1/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= +github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= +github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= +github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJnYK9S473LQFuzCbDbfSFY= +github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= +github.com/go-playground/validator/v10 v10.14.0 h1:vgvQWe3XCz3gIeFDm/HnTIbj6UGmg/+t63MyGU2n5js= +github.com/go-playground/validator/v10 v10.14.0/go.mod h1:9iXMNT7sEkjXb0I+enO7QXmzG6QCsPWY4zveKFVRSyU= github.com/go-redis/redis/v8 v8.11.5 h1:AcZZR7igkdvfVmQTPnu9WE37LRrO/YrBH5zWyjDC0oI= github.com/go-redis/redis/v8 v8.11.5/go.mod h1:gREzHqY1hg6oD9ngVRbLStwAWKhA0FEgq8Jd4h5lpwo= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= @@ -169,7 +177,6 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk= github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= @@ -198,14 +205,15 @@ github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/subcommands v1.2.0/go.mod h1:ZjhPrFU+Olkh9WazFPsl27BQ4UPiG37m3yTrtFlrHVk= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.3.1 h1:KjJaJ9iWZ3jOFZIf1Lqf4laDRCasjl0BCmnEGxkdLb4= -github.com/google/uuid v1.3.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.4.0 h1:MtMxsa51/r9yyhkyLsVeVt0B+BGQZzpQiTQ4eHZ8bc4= +github.com/google/uuid v1.4.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= +github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= @@ -219,10 +227,10 @@ github.com/huandu/go-clone v1.6.0 h1:HMo5uvg4wgfiy5FoGOqlFLQED/VGRm2D9Pi8g1FXPGc github.com/huandu/go-clone v1.6.0/go.mod h1:ReGivhG6op3GYr+UY3lS6mxjKp7MIGTknuU5TbTVaXE= github.com/huandu/go-clone/generic v1.6.0 h1:Wgmt/fUZ28r16F2Y3APotFD59sHk1p78K0XLdbUYN5U= github.com/huandu/go-clone/generic v1.6.0/go.mod h1:xgd9ZebcMsBWWcBx5mVMCoqMX24gLWr5lQicr+nVXNs= -github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= -github.com/huin/goupnp v1.0.3/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= +github.com/huin/goupnp v1.1.0 h1:gEe0Dp/lZmPZiDFzJJaOfUpOvv2MKUkoBX8lDrn9vKU= +github.com/huin/goupnp v1.1.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/hydrogen18/memlistener v0.0.0-20200120041712-dcc25e7acd91/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= +github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/iris-contrib/blackfriday v2.0.0+incompatible/go.mod h1:UzZ2bDEoaSGPbkg6SAB4att1aAwTmVIx/5gCVqeyUdI= @@ -247,8 +255,8 @@ github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.9.7/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.15.15 h1:EF27CXIuDsYJ6mmvtBRlEuB2UVOqHG1tAXgZ7yIO+lw= -github.com/klauspost/compress v1.15.15/go.mod h1:ZcK2JAFqKOpnBlxcLsJzYfrS9X1akm9fHZNnD9+Vo/4= +github.com/klauspost/compress v1.17.1 h1:NE3C767s2ak2bweCZo3+rdP4U/HoyVXLv/X9f2gPS5g= +github.com/klauspost/compress v1.17.1/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= @@ -266,8 +274,8 @@ github.com/labstack/echo/v4 v4.5.0/go.mod h1:czIriw4a0C1dFun+ObrXp7ok03xON0N1awS github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= github.com/leanovate/gopter v0.2.9 h1:fQjYxZaynp97ozCzfOyOuAGOU4aU/z37zf/tOujFk7c= github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= -github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= -github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= +github.com/leodido/go-urn v1.2.4 h1:XlAE/cm/ms7TE/VMVoduSpNBoyc2dOxHs5MZSwAN63Q= +github.com/leodido/go-urn v1.2.4/go.mod h1:7ZrI8mTSeBSHl/UaRyKQW1qZeMgak41ANeCNaVckg+4= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= @@ -282,8 +290,9 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/mattn/go-runewidth v0.0.14 h1:+xnbZSEeDbOIg5/mE6JF0w6n9duR1l3/WmbinWVwUuU= +github.com/mattn/go-runewidth v0.0.14/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= @@ -310,24 +319,30 @@ github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5Vgl github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzEE/Zbp4w= github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/nxadm/tail v1.4.4 h1:DQuhQpB1tVlglWS2hLQ5OV6B5r8aGxSrPc5Qo6uTN78= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= +github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= +github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= github.com/olekukonko/tablewriter v0.0.5 h1:P2Ga83D34wi1o9J6Wh1mRuqd4mF/x/lgBS7N7AbDhec= github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.10.3/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= -github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= -github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= +github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= +github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/opencontainers/go-digest v1.0.0-rc1 h1:WzifXhOVOEOuFYOJAW6aQqW0TooG2iki3E3Ii+WN7gQ= -github.com/opencontainers/go-digest v1.0.0-rc1/go.mod h1:cMLVZDEM3+U2I4VmLI6N8jQYUd2OVphdqWwCJHrFt2s= -github.com/opencontainers/image-spec v1.0.1 h1:JMemWkRwHx4Zj+fVxWoMCFm/8sYGGrUVojFA6h/TRcI= -github.com/opencontainers/image-spec v1.0.1/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= -github.com/opencontainers/runc v0.1.1 h1:GlxAyO6x8rfZYN9Tt0Kti5a/cP41iuiO2yYT0IJGY8Y= -github.com/opencontainers/runc v0.1.1/go.mod h1:qT5XzbpPznkRYVz/mWwUaVBUv2rmF59PVA73FjuZG0U= +github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= +github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= +github.com/onsi/gomega v1.27.4 h1:Z2AnStgsdSayCMDiCU42qIz+HLqEPcgiOCXjAU/w+8E= +github.com/onsi/gomega v1.27.4/go.mod h1:riYq/GJKh8hhoM01HN6Vmuy93AarCXCBGpvFDK3q3fQ= +github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= +github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= +github.com/opencontainers/image-spec v1.0.2 h1:9yCKha/T5XdGtO0q9Q9a6T5NUCsTn/DrBg0D7ufOcFM= +github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= +github.com/opencontainers/runc v1.1.5 h1:L44KXEpKmfWDcS02aeGm8QNTFXTo2D+8MYGDIJ/GDEs= +github.com/opencontainers/runc v1.1.5/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4Emza6EbVUUGA= github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= @@ -337,21 +352,24 @@ github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsK github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= -github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= +github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.17.0 h1:rl2sfwZMtSthVU752MqfjQozy7blglC+1SOtjMAMh+Q= +github.com/prometheus/client_golang v1.17.0/go.mod h1:VeL+gMmOAxkS2IqfCq0ZmHSL+LjWfWDUmp1mBz9JgUY= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= -github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= -github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= -github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= -github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= +github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 h1:v7DLqVdK4VrYkVD5diGdl4sxJurKJEMnODWRJlxV9oM= +github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU= +github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY= +github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= +github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= +github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7 h1:cZC+usqsYgHtlBaGulVnZ1hfKAi8iWtujBnRLQE698c= github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7/go.mod h1:IToEjHuttnUzwZI5KBSM/LOOW3qLbbrHOEfp3SbECGY= github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7 h1:0tVE4tdWQK9ZpYygoV7+vS6QkDvQVySboMVEIxBJmXw= github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7/go.mod h1:wmuf/mdK4VMD+jA9ThwcUKjg3a2XWM9cVfFYjDyY4j4= +github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= +github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= @@ -388,12 +406,13 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= github.com/supranational/blst v0.3.11-0.20230406105308-e9dfc5ee724b h1:u49mjRnygnB34h8OKbnNJFVUtWSKIKb1KukdV8bILUM= github.com/supranational/blst v0.3.11-0.20230406105308-e9dfc5ee724b/go.mod h1:jZJtfjgudtNl4en1tzwPIV3KjUnQUvG3/j+w+fVonLw= -github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70Z7CTTCmYQn2CKbY8j86K7/FAIr141uY= -github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= +github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs= +github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48= github.com/tklauser/go-sysconf v0.3.5 h1:uu3Xl4nkLzQfXNsWn15rPc/HQCJKObbt1dKJeWp3vU4= github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= github.com/tklauser/numcpus v0.2.2 h1:oyhllyrScuYI6g+h/zUvNXNp1wy7x8qQy3t/piefldA= @@ -406,10 +425,10 @@ github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGr github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= -github.com/umbracle/ethgo v0.1.3 h1:s8D7Rmphnt71zuqrgsGTMS5gTNbueGO1zKLh7qsFzTM= -github.com/umbracle/ethgo v0.1.3/go.mod h1:g9zclCLixH8liBI27Py82klDkW7Oo33AxUOr+M9lzrU= -github.com/umbracle/fastrlp v0.0.0-20220527094140-59d5dd30e722 h1:10Nbw6cACsnQm7r34zlpJky+IzxVLRk6MKTS2d3Vp0E= -github.com/umbracle/fastrlp v0.0.0-20220527094140-59d5dd30e722/go.mod h1:c8J0h9aULj2i3umrfyestM6jCq0LK0U6ly6bWy96nd4= +github.com/umbracle/ethgo v0.1.4-0.20231006072852-6b068360fc97 h1:BAVsVHkgvBlQcE+/vUG58w/p7vAhgYaY/yUo4eHTfc8= +github.com/umbracle/ethgo v0.1.4-0.20231006072852-6b068360fc97/go.mod h1:J+OZNfRCtbaYW3AEc0m47GhwAzlNJjcr9vO86nzOr6E= +github.com/umbracle/fastrlp v0.1.1-0.20230504065717-58a1b8a9929d h1:HAg1Kpr9buwRxEiC2UXU9oT2AU8uCU7o3/WTH+Lt5wo= +github.com/umbracle/fastrlp v0.1.1-0.20230504065717-58a1b8a9929d/go.mod h1:5RHgqiFjd4vLJESMWagP/E7su+5Gzk0iqqmrotR8WdA= github.com/umbracle/gohashtree v0.0.2-alpha.0.20230207094856-5b775a815c10 h1:CQh33pStIp/E30b7TxDlXfM0145bn2e8boI30IxAhTg= github.com/umbracle/gohashtree v0.0.2-alpha.0.20230207094856-5b775a815c10/go.mod h1:x/Pa0FF5Te9kdrlZKJK82YmAkvL8+f989USgz6Jiw7M= github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa h1:5SqCsI/2Qya2bCzK15ozrqo2sZxkh0FHynJZOTVoV6Q= @@ -417,8 +436,8 @@ github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa/go.mod h1:1CNUng3 github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKnmiohz4= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= -github.com/valyala/fastjson v1.4.1 h1:hrltpHpIpkaxll8QltMU8c3QZ5+qIiCL8yKqPFJI/yE= -github.com/valyala/fastjson v1.4.1/go.mod h1:nV6MsjxL2IMJQUoHDIrjEI7oLyeqK6aBD7EFWPsvP8o= +github.com/valyala/fastjson v1.6.3 h1:tAKFnnwmeMGPbwJ7IwxcTPCNr3uIzoIj3/Fh90ra4xc= +github.com/valyala/fastjson v1.6.3/go.mod h1:CLCAqky6SMuOcxStkYQvblddUtoRxhYMGLrsQns1aXY= github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= @@ -443,7 +462,6 @@ golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8U golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= @@ -459,6 +477,8 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.13.0 h1:I/DsJXRlw/8l/0c24sM9yb0T4z9liZTduXvdAWYiysY= +golang.org/x/mod v0.13.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -473,13 +493,15 @@ golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= -golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= +golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk= golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.10.0 h1:X2//UzNDwYmtCLn7To6G58Wr6f5ahEAQgKNzv9Y951M= -golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg= +golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= +golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= +golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -489,8 +511,8 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.2.0 h1:PUR+T4wwASmuSTYdKjYHI5TD22Wy5ogLU5qZCOLxBrI= -golang.org/x/sync v0.2.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ= +golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -501,16 +523,15 @@ golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200519105757-fe76b779f299/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201101102859-da207088b7d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -521,15 +542,18 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -539,8 +563,8 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20220922220347-f3bd1da661af h1:Yx9k8YCG3dvF87UAn2tu2HQLf2dt/eR1bXxpLMWeH+Y= -golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= +golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20181221001348-537d06c36207/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -552,12 +576,16 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.14.0 h1:jvNa2pY0M4r62jkRQ6RwEZZyPcymeL9XZMLBbV7U2nc= +golang.org/x/tools v0.14.0/go.mod h1:uYBEerGOWcJyEORxN+Ek8+TT266gXkNlHdJBwexUsBg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 h1:+cNy6SZtPcJQH3LJVLOSmiC7MMxXNOb3PU/VUEz+EhU= golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028/go.mod h1:NDW/Ps6MPRej6fsCIbMTohpP40sJ/P/vI1MoTEGwX90= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= @@ -584,8 +612,8 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= -google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng= -google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= +google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 73ca641e934dd2e768a7b745a44b31897008877d Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Sat, 13 Apr 2024 16:20:53 -0700 Subject: [PATCH 09/25] nitpick --- framework/beacon.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/beacon.go b/framework/beacon.go index 91222ed..9b5ba57 100644 --- a/framework/beacon.go +++ b/framework/beacon.go @@ -54,7 +54,7 @@ func GetAndParse[V interface{}](b *BeaconChain, url string, v V) error { return err } if err := json.Unmarshal(body, v); err != nil { - panic(err) + return err } return nil } From bcf4c57ab0aa1e60c1749757467b7e940178e1f0 Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Thu, 18 Apr 2024 16:55:08 -0700 Subject: [PATCH 10/25] fix pubkey error. new error: "payload attributes not (yet) found" --- examples/build-eth-block/main.go | 60 ++++++++++----------- framework/beacon.go | 93 -------------------------------- framework/boost.go | 64 ++++++++++++++++++++++ framework/framework.go | 15 ++++-- go.mod | 27 ++++++---- go.sum | 60 ++++++++++++++------- 6 files changed, 165 insertions(+), 154 deletions(-) delete mode 100644 framework/beacon.go create mode 100644 framework/boost.go diff --git a/examples/build-eth-block/main.go b/examples/build-eth-block/main.go index f8cc761..0382c42 100644 --- a/examples/build-eth-block/main.go +++ b/examples/build-eth-block/main.go @@ -7,6 +7,7 @@ import ( "math/big" "time" + "github.com/attestantio/go-eth2-client/api" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" @@ -80,42 +81,41 @@ func main() { execBlock, err := fr.L1.RPC().BlockByNumber(context.Background(), nil) maybe(err) execHeaderJSON, err := execBlock.Header().MarshalJSON() - log.Printf("execBlock header: %s", string(execHeaderJSON)) - beaconRes, err := fr.L1Beacon.GetBlockHeader(nil) maybe(err) - beaconBlock := beaconRes.Data[0] - blockJSON, err := json.Marshal(beaconBlock) + log.Printf("execBlock header: %s", string(execHeaderJSON)) + beaconRes, err := fr.L1Boost.Eth2Client.BeaconBlockHeader( + context.Background(), + &api.BeaconBlockHeaderOpts{ + Block: "head", + }, + ) + log.Printf("beaconRes: %v", beaconRes) maybe(err) - log.Printf("beaconBlock header: %s (root=%s)", string(blockJSON), "") - - targetSlot := beaconBlock.Header.Message.Slot + 1 - epoch := beaconBlock.Header.Message.Epoch() - proposerDuties, err := fr.L1Beacon.GetProposerDuties(epoch) - var slotDuty struct { // TODO: replace w/ proper eth2 lib - Pubkey hexutil.Bytes `json:"pubkey"` - ValidatorIndex uint64 `json:"validator_index,string"` - Slot uint64 `json:"slot,string"` - } + beaconHeader := beaconRes.Data.Header + targetSlot := beaconHeader.Message.Slot + 1 + beaconRoot := beaconRes.Data.Root + + validators, err := fr.L1Boost.GetValidators() + var slotDuty framework.BuilderGetValidatorsResponseEntry maybe(err) - // find proposer duties for target slot - for _, duty := range proposerDuties.Data { - if duty.Slot == targetSlot { - slotDuty = duty - dutyJSON, err := json.Marshal(duty) - maybe(err) - log.Printf("found proposer duty for slot %d, %s", targetSlot, dutyJSON) - maybe(err) + for _, validator := range *validators { + if validator.Slot == uint64(targetSlot) { + slotDuty = validator + log.Printf("found proposer duty for slot %d, %v", targetSlot, slotDuty) break } } + // decode BLS pubkey to Ethereum address + proposerPubkey, err := slotDuty.Entry.Message.Pubkey.MarshalJSON() + maybe(err) blockArgs := types.BuildBlockArgs{ - ProposerPubkey: slotDuty.Pubkey, - Timestamp: getNewSlotTimestamp(beaconBlock.Header.Message.Slot), - FeeRecipient: common.Address(testAddr1.Address()), + ProposerPubkey: proposerPubkey, + Timestamp: getNewSlotTimestamp(uint64(targetSlot)), + FeeRecipient: common.Address(slotDuty.Entry.Message.FeeRecipient), Parent: execBlock.Hash(), - Slot: targetSlot, - BeaconRoot: *&beaconBlock.Root, + Slot: uint64(targetSlot), + BeaconRoot: common.Hash(beaconRoot), } { // Signal to the builder that it's time to build a new block @@ -158,9 +158,9 @@ func main() { } // Calculate the timestamp for a new slot. -func getNewSlotTimestamp(slot uint64) uint64 { - return 1712816195 + (slot-8832680)*12 -} +func getNewSlotTimestamp(targetSlot uint64) uint64 { + return 1712816195 + (targetSlot-8832681)*12 +} // lol func currentL1Block(fr *framework.Framework) *types.Block { b, err := fr.L1.RPC().BlockByNumber(context.Background(), nil) diff --git a/framework/beacon.go b/framework/beacon.go deleted file mode 100644 index 9b5ba57..0000000 --- a/framework/beacon.go +++ /dev/null @@ -1,93 +0,0 @@ -package framework - -import ( - "encoding/json" - "fmt" - "io" - "log" - "net/http" - - "github.com/ethereum/go-ethereum/beacon/types" - "github.com/ethereum/go-ethereum/common" - "github.com/ethereum/go-ethereum/common/hexutil" -) - -// BeaconChain is a very-minimal client for interacting with the beacon chain. -type BeaconChain struct { - httpClient *http.Client - baseURL string -} - -// GetBlockHeaderResponse is returned from GetBlockHeader. -type GetBlockHeaderResponse struct { - ExecutionOptimistic bool `json:"execution_optimistic"` - Finalized bool `json:"finalized"` - Data []struct { - Root common.Hash `json:"root"` - Canonical bool `json:"canonical"` - Header struct { - Message types.Header `json:"message"` - Signature hexutil.Bytes `json:"signature"` - } `json:"header"` - } `json:"data"` -} - -// GetProposerDutiesResponse is returned from GetProposerDuties. -type GetProposerDutiesResponse struct { - DependentRoot common.Hash `json:"dependent_root"` - ExecutionOptimistic bool `json:"execution_optimistic"` - Data []struct { - Pubkey hexutil.Bytes `json:"pubkey"` - ValidatorIndex uint64 `json:"validator_index,string"` - Slot uint64 `json:"slot,string"` - } `json:"data"` -} - -// GetAndParse makes a GET request to the given URL and unmarshals the response into v. -func GetAndParse[V interface{}](b *BeaconChain, url string, v V) error { - res, err := b.httpClient.Get(url) - if err != nil { - return err - } - body, err := io.ReadAll(res.Body) - if err != nil { - return err - } - if err := json.Unmarshal(body, v); err != nil { - return err - } - return nil -} - -// getAndParse calls GetAndParse with the BeaconChain receiver. -func (b *BeaconChain) getAndParse(url string, v any) error { - return GetAndParse(b, url, v) -} - -// GetBlockHeader gets the beacon block header for a given beacon block ID, or the latest block if blockID is nil. -func (b *BeaconChain) GetBlockHeader(blockID *common.Hash) (*GetBlockHeaderResponse, error) { - url := fmt.Sprintf("%s/eth/v1/beacon/headers", b.baseURL) - if blockID != nil { - url = fmt.Sprintf("/%s", blockID) - } - - data := new(GetBlockHeaderResponse) - if err := b.getAndParse(url, data); err != nil { - return nil, err - } - - return data, nil -} - -// GetProposerDuties gets the proposer duties for a given epoch. -func (b *BeaconChain) GetProposerDuties(epoch uint64) (*GetProposerDutiesResponse, error) { - url := fmt.Sprintf("%s/eth/v1/validator/duties/proposer/%d", b.baseURL, epoch) - log.Printf("url: %s", url) - - data := new(GetProposerDutiesResponse) - if err := b.getAndParse(url, data); err != nil { - return nil, err - } - - return data, nil -} diff --git a/framework/boost.go b/framework/boost.go new file mode 100644 index 0000000..54c25a9 --- /dev/null +++ b/framework/boost.go @@ -0,0 +1,64 @@ +package framework + +import ( + "encoding/json" + "fmt" + "io" + "log" + "net/http" + + builderApiV1 "github.com/attestantio/go-builder-client/api/v1" + ethHttp "github.com/attestantio/go-eth2-client/http" +) + +// BoostHelper is a very-minimal client for interacting with the beacon chain. +type BoostHelper struct { + httpClient *http.Client + Eth2Client *ethHttp.Service + relayURL string +} + +/* +BuilderGetValidatorsResponseEntry is a single entry in the response from $BOOST_RELAY_URL/relay/v1/builder/validators. +Copied from [mev-boost-relay types](https://github.com/flashbots/mev-boost-relay/blob/main/common/types.go) +rather than importing mev-boost-relay, because it has conflicting dependencies w/ suave-geth. +*/ +type BuilderGetValidatorsResponseEntry struct { + Slot uint64 `json:"slot,string"` + ValidatorIndex uint64 `json:"validator_index,string"` + Entry *builderApiV1.SignedValidatorRegistration `json:"entry"` +} + +// GetAndParse makes a GET request to the given URL and unmarshals the response into v. +func GetAndParse[V interface{}](b *BoostHelper, url string, v V) error { + res, err := b.httpClient.Get(url) + if err != nil { + return err + } + body, err := io.ReadAll(res.Body) + if err != nil { + return err + } + if err := json.Unmarshal(body, v); err != nil { + return err + } + return nil +} + +// getAndParse calls GetAndParse with the BoostHelper receiver. +func (b *BoostHelper) getAndParse(url string, v any) error { + return GetAndParse(b, url, v) +} + +// GetValidators gets current & upcoming validators from the mev-boost relay. +func (b *BoostHelper) GetValidators() (*[]BuilderGetValidatorsResponseEntry, error) { + url := fmt.Sprintf("%s/relay/v1/builder/validators", b.relayURL) + log.Printf("url: %s", url) + + data := new([]BuilderGetValidatorsResponseEntry) + if err := b.getAndParse(url, data); err != nil { + return nil, err + } + + return data, nil +} diff --git a/framework/framework.go b/framework/framework.go index dfad40c..938b17a 100644 --- a/framework/framework.go +++ b/framework/framework.go @@ -16,6 +16,7 @@ import ( "strconv" "strings" + ethHttp "github.com/attestantio/go-eth2-client/http" "github.com/ethereum/go-ethereum" "github.com/ethereum/go-ethereum/accounts/abi" "github.com/ethereum/go-ethereum/common" @@ -201,9 +202,9 @@ type Framework struct { config *Config KettleAddress common.Address - Suave *Chain - L1 *Chain - L1Beacon *BeaconChain + Suave *Chain + L1 *Chain + L1Boost *BoostHelper } type Config struct { @@ -216,6 +217,7 @@ type Config struct { L1RPC string `env:"L1_RPC, default=http://localhost:8555"` L1BeaconURL string `env:"L1_BEACON_URL, default=https://ethereum-beacon-api.publicnode.com"` + L1RelayURL string `env:"L1_RELAY_URL, default=https://boost-relay.flashbots.net"` // This account is funded in your local L1 devnet // address: 0xB5fEAfbDD752ad52Afb7e1bD2E40432A485bBB7F @@ -267,8 +269,13 @@ func New(opts ...ConfigOption) *Framework { } l1Clt := sdk.NewClient(l1RPC, config.FundedAccountL1.Priv, common.Address{}) fr.L1 = &Chain{rpc: l1RPC, clt: l1Clt} + beaconClient, err := ethHttp.New(context.Background(), ethHttp.WithAddress(config.L1BeaconURL)) - fr.L1Beacon = &BeaconChain{httpClient: http.DefaultClient, baseURL: config.L1BeaconURL} + fr.L1Boost = &BoostHelper{ + httpClient: http.DefaultClient, + relayURL: config.L1RelayURL, + Eth2Client: beaconClient.(*ethHttp.Service), + } } return fr diff --git a/go.mod b/go.mod index abc8da7..94694dd 100644 --- a/go.mod +++ b/go.mod @@ -16,8 +16,8 @@ require ( github.com/Microsoft/go-winio v0.6.1 // indirect github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect github.com/VictoriaMetrics/fastcache v1.6.0 // indirect - github.com/attestantio/go-builder-client v0.4.2 // indirect - github.com/attestantio/go-eth2-client v0.19.7 // indirect + github.com/attestantio/go-builder-client v0.4.5 // indirect + github.com/attestantio/go-eth2-client v0.21.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.7.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -35,13 +35,15 @@ require ( github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/ethereum/c-kzg-4844 v0.2.0 // indirect - github.com/fatih/color v1.15.0 // indirect + github.com/fatih/color v1.16.0 // indirect github.com/ferranbt/fastssz v0.1.3 // indirect github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect github.com/flashbots/go-boost-utils v1.7.0 // indirect github.com/fsnotify/fsnotify v1.6.0 // indirect github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff // indirect github.com/getsentry/sentry-go v0.18.0 // indirect + github.com/go-logr/logr v1.2.4 // indirect + github.com/go-logr/stdr v1.2.2 // indirect github.com/go-ole/go-ole v1.2.1 // indirect github.com/go-playground/validator/v10 v10.14.0 // indirect github.com/go-stack/stack v1.8.1 // indirect @@ -56,12 +58,13 @@ require ( github.com/gorilla/websocket v1.5.0 // indirect github.com/hashicorp/go-bexpr v0.1.10 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect - github.com/holiman/uint256 v1.2.3 // indirect + github.com/holiman/uint256 v1.2.4 // indirect + github.com/huandu/go-clone v1.6.0 // indirect github.com/huin/goupnp v1.1.0 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/kilic/bls12-381 v0.1.0 // indirect github.com/klauspost/compress v1.17.1 // indirect - github.com/klauspost/cpuid/v2 v2.2.5 // indirect + github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect @@ -82,9 +85,11 @@ require ( github.com/prometheus/procfs v0.11.1 // indirect github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7 // indirect github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7 // indirect + github.com/r3labs/sse/v2 v2.10.0 // indirect github.com/rivo/uniseg v0.2.0 // indirect github.com/rogpeppe/go-internal v1.11.0 // indirect github.com/rs/cors v1.7.0 // indirect + github.com/rs/zerolog v1.32.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible // indirect github.com/status-im/keycard-go v0.2.0 // indirect @@ -98,16 +103,20 @@ require ( github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa // indirect github.com/valyala/fastjson v1.6.3 // indirect github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect - golang.org/x/crypto v0.14.0 // indirect + go.opentelemetry.io/otel v1.16.0 // indirect + go.opentelemetry.io/otel/metric v1.16.0 // indirect + go.opentelemetry.io/otel/trace v1.16.0 // indirect + golang.org/x/crypto v0.21.0 // indirect golang.org/x/exp v0.0.0-20230810033253-352e893a4cad // indirect - golang.org/x/net v0.17.0 // indirect + golang.org/x/net v0.21.0 // indirect golang.org/x/sync v0.4.0 // indirect - golang.org/x/sys v0.13.0 // indirect - golang.org/x/text v0.13.0 // indirect + golang.org/x/sys v0.18.0 // indirect + golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.3.0 // indirect golang.org/x/tools v0.14.0 // indirect golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect google.golang.org/protobuf v1.31.0 // indirect + gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index 4e3ff21..77657c8 100644 --- a/go.sum +++ b/go.sum @@ -27,10 +27,10 @@ github.com/alicebob/miniredis/v2 v2.30.5/go.mod h1:b25qWj4fCEsBeAAR2mlb0ufImGC6u github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156 h1:eMwmnE/GDgah4HI848JfFxHt+iPb26b4zyfspmqY0/8= github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= -github.com/attestantio/go-builder-client v0.4.2 h1:EycfAFqQV+ooc2z6hmTsbuH4TCLknr0aO0nHLHLMpJM= -github.com/attestantio/go-builder-client v0.4.2/go.mod h1:e02i/WO4fjs3/u9oIZEjiC8CK1Qyxy4cpiMMGKx4VqQ= -github.com/attestantio/go-eth2-client v0.19.7 h1:1cX2rYz9tMZGhXTCe5Ax3C9fmHx1igih21+MU1eO5ls= -github.com/attestantio/go-eth2-client v0.19.7/go.mod h1:mZve1kV9Ctj0I1HH9gdg+MnI8lZ+Cb2EktEtOYrBlsM= +github.com/attestantio/go-builder-client v0.4.5 h1:L11DGcQbMMNNYLJyme2aLeruNK3lXZ7M9QzvpoMPNPs= +github.com/attestantio/go-builder-client v0.4.5/go.mod h1:ZMmatuguvfy/JRHF8eFUy9RQgkHzdslCCVMofiywRkE= +github.com/attestantio/go-eth2-client v0.21.1 h1:yvsMd/azPUbxiJzWZhgqfOJJRNF1zLvAJpcBXTHzyh8= +github.com/attestantio/go-eth2-client v0.21.1/go.mod h1:Tb412NpzhsC0sbtpXS4D51y5se6nDkWAi6amsJrqX9c= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= @@ -76,6 +76,7 @@ github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1A github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.2 h1:p1EgwI/C7NhT0JmVkwCD2ZBK8j4aeHQX2pMHHBfMQ6w= github.com/cpuguy83/go-md2man/v2 v2.0.2/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= @@ -110,8 +111,8 @@ github.com/etcd-io/bbolt v1.3.3/go.mod h1:ZF2nL25h33cCyBtcyWeZ2/I3HQOfTP+0PIEvHj github.com/ethereum/c-kzg-4844 v0.2.0 h1:+cUvymlnoDDQgMInp25Bo3OmLajmmY8mLJ/tLjqd77Q= github.com/ethereum/c-kzg-4844 v0.2.0/go.mod h1:WI2Nd82DMZAAZI1wV2neKGost9EKjvbpQR9OqE5Qqa8= github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= -github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= -github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= +github.com/fatih/color v1.16.0 h1:zmkK9Ngbjj+K0yRhTVONQh1p/HknKYSlNT+vZCzyokM= +github.com/fatih/color v1.16.0/go.mod h1:fL2Sau1YI5c0pdGEVCbKQbLXB6edEj1ZgiY4NijnWvE= github.com/fatih/structs v1.1.0/go.mod h1:9NiDSp5zOcgEDl+j00MP/WkGVPOlPRLejGD8Ga6PJ7M= github.com/ferranbt/fastssz v0.1.3 h1:ZI+z3JH05h4kgmFXdHuR1aWYsgrg7o+Fw7/NCzM16Mo= github.com/ferranbt/fastssz v0.1.3/go.mod h1:0Y9TEd/9XuFlh7mskMPfXiI2Dkw4Ddg9EyXt1W7MRvE= @@ -142,6 +143,11 @@ github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclK github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= +github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-martini/martini v0.0.0-20170121215854-22fa46961aab/go.mod h1:/P9AEU963A2AYjv4d1V5eVL1CQbEJq6aCNHDDjibzu8= github.com/go-ole/go-ole v1.2.1 h1:2lOsA72HgjxAuMlKpFiCbHTvu44PIVkZ5hqm3RSdI/E= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= @@ -161,6 +167,7 @@ github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6Wezm github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/goccy/go-yaml v1.11.2 h1:joq77SxuyIs9zzxEjgyLBugMQ9NEgTWxXfz2wVqwAaQ= github.com/goccy/go-yaml v1.11.2/go.mod h1:wKnAMd44+9JAAnGQpWVEgBzGt3YuTaQ4uXoHvE4m7WU= +github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/gofrs/flock v0.8.1 h1:+gYjHKf32LDeiEEFhQaotPbLuUXjY5ZqxKgXy7n59aw= github.com/gofrs/flock v0.8.1/go.mod h1:F1TvTiK9OcQqauNUHlbJvyl9Qa1QvF/gOUDKA14jxHU= github.com/gogo/googleapis v0.0.0-20180223154316-0cd9801be74a/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= @@ -220,9 +227,10 @@ github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09 github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/holiman/bloomfilter/v2 v2.0.3 h1:73e0e/V0tCydx14a0SCYS/EWCxgwLZ18CZcZKVu0fao= github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= -github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o= -github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw= +github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= +github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= github.com/huandu/go-clone v1.6.0 h1:HMo5uvg4wgfiy5FoGOqlFLQED/VGRm2D9Pi8g1FXPGc= github.com/huandu/go-clone v1.6.0/go.mod h1:ReGivhG6op3GYr+UY3lS6mxjKp7MIGTknuU5TbTVaXE= github.com/huandu/go-clone/generic v1.6.0 h1:Wgmt/fUZ28r16F2Y3APotFD59sHk1p78K0XLdbUYN5U= @@ -258,8 +266,8 @@ github.com/klauspost/compress v1.9.7/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0 github.com/klauspost/compress v1.17.1 h1:NE3C767s2ak2bweCZo3+rdP4U/HoyVXLv/X9f2gPS5g= github.com/klauspost/compress v1.17.1/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= -github.com/klauspost/cpuid/v2 v2.2.5 h1:0E5MSMDEoAulmXNFquVs//DdoomxaoTY1kUhbc/qbZg= -github.com/klauspost/cpuid/v2 v2.2.5/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= +github.com/klauspost/cpuid/v2 v2.2.7 h1:ZWSB3igEs+d0qvnxR/ZBzXVmxkgt8DdzP6m9pfuVLDM= +github.com/klauspost/cpuid/v2 v2.2.7/go.mod h1:Lcz8mBdAVJIBVzewtcLocK12l3Y+JytZYpaMropDUws= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= @@ -288,6 +296,7 @@ github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2y github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= +github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= @@ -368,6 +377,8 @@ github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7 h1:cZC+ github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7/go.mod h1:IToEjHuttnUzwZI5KBSM/LOOW3qLbbrHOEfp3SbECGY= github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7 h1:0tVE4tdWQK9ZpYygoV7+vS6QkDvQVySboMVEIxBJmXw= github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7/go.mod h1:wmuf/mdK4VMD+jA9ThwcUKjg3a2XWM9cVfFYjDyY4j4= +github.com/r3labs/sse/v2 v2.10.0 h1:hFEkLLFY4LDifoHdiCN/LlGBAdVJYsANaLqNYa1l/v0= +github.com/r3labs/sse/v2 v2.10.0/go.mod h1:Igau6Whc+F17QUgML1fYe1VPZzTV6EMCnYktEmkNJ7I= github.com/rivo/uniseg v0.2.0 h1:S1pD9weZBuJdFmowNwbpi7BJ8TNftyUImj/0WQi72jY= github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= @@ -377,6 +388,9 @@ github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDN github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= +github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= +github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= +github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -456,6 +470,12 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= github.com/yuin/gopher-lua v1.1.0 h1:BojcDhfyDWgU2f2TOzYK/g5p2gxMrku8oupLDqlnSqE= github.com/yuin/gopher-lua v1.1.0/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw= +go.opentelemetry.io/otel v1.16.0 h1:Z7GVAX/UkAXPKsy94IU+i6thsQS4nb7LviLpnaNeW8s= +go.opentelemetry.io/otel v1.16.0/go.mod h1:vl0h9NUa1D5s1nv3A5vZOYWn8av4K8Ml6JDeHrT/bx4= +go.opentelemetry.io/otel/metric v1.16.0 h1:RbrpwVG1Hfv85LgnZ7+txXioPDoh6EdbZHo26Q3hqOo= +go.opentelemetry.io/otel/metric v1.16.0/go.mod h1:QE47cpOmkwipPiefDwo2wDzwJrlfxxNYodqc4xnGCo4= +go.opentelemetry.io/otel/trace v1.16.0 h1:8JRpaObFoW0pxuVPapkgH8UhHQj+bJW8jJsCZEu5MQs= +go.opentelemetry.io/otel/trace v1.16.0/go.mod h1:Yt9vYq1SdNz3xdjZZK7wcXv1qv2pwLkqr2QVwea0ef0= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= @@ -464,8 +484,8 @@ golang.org/x/crypto v0.0.0-20191227163750-53104e6ec876/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc= -golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20230810033253-352e893a4cad h1:g0bG7Z4uG+OgH2QDODnjp6ggkk1bJDsINcuWmJN1iJU= golang.org/x/exp v0.0.0-20230810033253-352e893a4cad/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= @@ -490,6 +510,7 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn golang.org/x/net v0.0.0-20190503192946-f4e77d36d62c/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20191116160921-f9c825593386/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200520004742-59133d7f0dd7/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= @@ -500,8 +521,8 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= -golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM= -golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= +golang.org/x/net v0.21.0 h1:AQyQV4dYCvJ7vGmJyKki9+PBdyvhkSd8EIx/qb0AYv4= +golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -550,8 +571,9 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE= -golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -560,8 +582,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= -golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k= -golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4= golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -614,6 +636,8 @@ google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp0 google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8= google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= +gopkg.in/cenkalti/backoff.v1 v1.1.0 h1:Arh75ttbsvlpVA7WtVpH4u9h6Zl46xuptxqLxPiSo4Y= +gopkg.in/cenkalti/backoff.v1 v1.1.0/go.mod h1:J6Vskwqd+OMVJl8C33mmtxTBs2gyzfv7UDAkHu8BrjI= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From bb1670f5daf462b3b6d0682316ffe8829f891baa Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Thu, 18 Apr 2024 17:03:22 -0700 Subject: [PATCH 11/25] remove needless nesting & confusing naming --- examples/build-eth-block/main.go | 4 ++-- framework/framework.go | 12 ++++++------ framework/{boost.go => relay.go} | 14 ++++++-------- 3 files changed, 14 insertions(+), 16 deletions(-) rename framework/{boost.go => relay.go} (77%) diff --git a/examples/build-eth-block/main.go b/examples/build-eth-block/main.go index 0382c42..5d8165f 100644 --- a/examples/build-eth-block/main.go +++ b/examples/build-eth-block/main.go @@ -83,7 +83,7 @@ func main() { execHeaderJSON, err := execBlock.Header().MarshalJSON() maybe(err) log.Printf("execBlock header: %s", string(execHeaderJSON)) - beaconRes, err := fr.L1Boost.Eth2Client.BeaconBlockHeader( + beaconRes, err := fr.L1Beacon.BeaconBlockHeader( context.Background(), &api.BeaconBlockHeaderOpts{ Block: "head", @@ -95,7 +95,7 @@ func main() { targetSlot := beaconHeader.Message.Slot + 1 beaconRoot := beaconRes.Data.Root - validators, err := fr.L1Boost.GetValidators() + validators, err := fr.L1Relay.GetValidators() var slotDuty framework.BuilderGetValidatorsResponseEntry maybe(err) for _, validator := range *validators { diff --git a/framework/framework.go b/framework/framework.go index 938b17a..e134f30 100644 --- a/framework/framework.go +++ b/framework/framework.go @@ -202,9 +202,10 @@ type Framework struct { config *Config KettleAddress common.Address - Suave *Chain - L1 *Chain - L1Boost *BoostHelper + Suave *Chain + L1 *Chain + L1Relay *RelayClient + L1Beacon *ethHttp.Service } type Config struct { @@ -270,11 +271,10 @@ func New(opts ...ConfigOption) *Framework { l1Clt := sdk.NewClient(l1RPC, config.FundedAccountL1.Priv, common.Address{}) fr.L1 = &Chain{rpc: l1RPC, clt: l1Clt} beaconClient, err := ethHttp.New(context.Background(), ethHttp.WithAddress(config.L1BeaconURL)) - - fr.L1Boost = &BoostHelper{ + fr.L1Beacon = beaconClient.(*ethHttp.Service) + fr.L1Relay = &RelayClient{ httpClient: http.DefaultClient, relayURL: config.L1RelayURL, - Eth2Client: beaconClient.(*ethHttp.Service), } } diff --git a/framework/boost.go b/framework/relay.go similarity index 77% rename from framework/boost.go rename to framework/relay.go index 54c25a9..aafeaeb 100644 --- a/framework/boost.go +++ b/framework/relay.go @@ -8,13 +8,11 @@ import ( "net/http" builderApiV1 "github.com/attestantio/go-builder-client/api/v1" - ethHttp "github.com/attestantio/go-eth2-client/http" ) -// BoostHelper is a very-minimal client for interacting with the beacon chain. -type BoostHelper struct { +// RelayClient is a very-minimal client for interacting with the mev-boost relay. +type RelayClient struct { httpClient *http.Client - Eth2Client *ethHttp.Service relayURL string } @@ -30,7 +28,7 @@ type BuilderGetValidatorsResponseEntry struct { } // GetAndParse makes a GET request to the given URL and unmarshals the response into v. -func GetAndParse[V interface{}](b *BoostHelper, url string, v V) error { +func GetAndParse[V interface{}](b *RelayClient, url string, v V) error { res, err := b.httpClient.Get(url) if err != nil { return err @@ -45,13 +43,13 @@ func GetAndParse[V interface{}](b *BoostHelper, url string, v V) error { return nil } -// getAndParse calls GetAndParse with the BoostHelper receiver. -func (b *BoostHelper) getAndParse(url string, v any) error { +// getAndParse calls GetAndParse with the RelayClient receiver. +func (b *RelayClient) getAndParse(url string, v any) error { return GetAndParse(b, url, v) } // GetValidators gets current & upcoming validators from the mev-boost relay. -func (b *BoostHelper) GetValidators() (*[]BuilderGetValidatorsResponseEntry, error) { +func (b *RelayClient) GetValidators() (*[]BuilderGetValidatorsResponseEntry, error) { url := fmt.Sprintf("%s/relay/v1/builder/validators", b.relayURL) log.Printf("url: %s", url) From 5defdad182d550b577fdd83a9931c3a7a9d10de3 Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Tue, 23 Apr 2024 14:24:58 -0700 Subject: [PATCH 12/25] wait for block time --- examples/build-eth-block/main.go | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/examples/build-eth-block/main.go b/examples/build-eth-block/main.go index 5d8165f..364149c 100644 --- a/examples/build-eth-block/main.go +++ b/examples/build-eth-block/main.go @@ -121,9 +121,10 @@ func main() { { // Signal to the builder that it's time to build a new block startTime := time.Now().UnixMilli() receipt := ethBlockContract.SendConfidentialRequest("buildFromPool", []any{blockArgs, targetBlock.NumberU64() + 1}, nil) + maybe(err) + duration := time.Now().UnixMilli() - startTime log.Printf("finished buildFromPool in %d ms", duration) - maybe(err) for _, receiptLog := range receipt.Logs { buildEvent := ethBlockContract.Abi.Events["BuilderBoostBidEvent"] @@ -139,12 +140,19 @@ func main() { { // Submit block to the relay log.Printf("blockBidID: %s", hexutil.Encode(blockBidID[:])) + pre := uint64(1) + for uint64(time.Now().Unix()) < blockArgs.Timestamp-pre { + log.Printf("waiting for block. T-%d seconds...", blockArgs.Timestamp-pre-uint64(time.Now().Unix())) + time.Sleep(1 * time.Second) + } + startTime := time.Now().UnixMilli() receipt := ethBlockContract.SendConfidentialRequest("submitToRelay", []any{ blockArgs, blockBidID, "", }, nil) + duration := time.Now().UnixMilli() - startTime log.Printf("finished submitToRelay in %d ms", duration) From 7b7096e7131da3e9b1be9e827f7b92779522683e Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Tue, 14 May 2024 22:14:01 -0700 Subject: [PATCH 13/25] subscribe to payload_attributes, use that to send proper relay reqs --- examples/build-eth-block/main.go | 104 ++++++++++++++++++------------- framework/framework.go | 36 +++++++++++ framework/relay.go | 4 -- go.mod | 11 ++-- go.sum | 10 +-- 5 files changed, 104 insertions(+), 61 deletions(-) diff --git a/examples/build-eth-block/main.go b/examples/build-eth-block/main.go index 364149c..3127353 100644 --- a/examples/build-eth-block/main.go +++ b/examples/build-eth-block/main.go @@ -5,9 +5,11 @@ import ( "encoding/json" "log" "math/big" + "strings" "time" - "github.com/attestantio/go-eth2-client/api" + eth2 "github.com/attestantio/go-eth2-client" + v1 "github.com/attestantio/go-eth2-client/api/v1" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/core/types" @@ -16,9 +18,7 @@ import ( var buildEthBlockAddress = common.HexToAddress("0x42100001") -func main() { - fr := framework.New(framework.WithL1()) - +func buildBlock(fr *framework.Framework, payloadAttributes *v1.PayloadAttributesEvent) { testAddr1 := framework.GeneratePrivKey() log.Printf("Test address 1: %s", testAddr1.Address().Hex()) @@ -50,10 +50,11 @@ func main() { "https://0xac6e77dfe25ecd6110b8e780608cce0dab71fdd5ebea22a16c0205200f2f8e2e3ad3b71d3499c54ad14d6c21b41a37ae@boost-relay.flashbots.net", ) - targetBlock := currentL1Block(fr) + targetBlock := payloadAttributes.Data.ParentBlockNumber + 1 + targetSlot := payloadAttributes.Data.ProposalSlot { // Send a bundle to the builder - decryptionCondition := targetBlock.NumberU64() + 1 + decryptionCondition := targetBlock allowedPeekers := []common.Address{ buildEthBlockAddress, bundleContract.Raw().Address(), @@ -83,21 +84,10 @@ func main() { execHeaderJSON, err := execBlock.Header().MarshalJSON() maybe(err) log.Printf("execBlock header: %s", string(execHeaderJSON)) - beaconRes, err := fr.L1Beacon.BeaconBlockHeader( - context.Background(), - &api.BeaconBlockHeaderOpts{ - Block: "head", - }, - ) - log.Printf("beaconRes: %v", beaconRes) - maybe(err) - beaconHeader := beaconRes.Data.Header - targetSlot := beaconHeader.Message.Slot + 1 - beaconRoot := beaconRes.Data.Root validators, err := fr.L1Relay.GetValidators() - var slotDuty framework.BuilderGetValidatorsResponseEntry maybe(err) + var slotDuty framework.BuilderGetValidatorsResponseEntry for _, validator := range *validators { if validator.Slot == uint64(targetSlot) { slotDuty = validator @@ -106,21 +96,35 @@ func main() { } } - // decode BLS pubkey to Ethereum address proposerPubkey, err := slotDuty.Entry.Message.Pubkey.MarshalJSON() maybe(err) + + // map payloadAttributes.Data.V3.Withdrawals to types.Withdrawals + withdrawals := make([]*types.Withdrawal, len(payloadAttributes.Data.V3.Withdrawals)) + for i, withdrawal := range payloadAttributes.Data.V3.Withdrawals { + withdrawals[i] = &types.Withdrawal{ + Index: uint64(withdrawal.Index), + Validator: uint64(withdrawal.ValidatorIndex), + Address: common.Address(withdrawal.Address), + Amount: uint64(withdrawal.Amount), + } + } + blockArgs := types.BuildBlockArgs{ - ProposerPubkey: proposerPubkey, - Timestamp: getNewSlotTimestamp(uint64(targetSlot)), - FeeRecipient: common.Address(slotDuty.Entry.Message.FeeRecipient), - Parent: execBlock.Hash(), Slot: uint64(targetSlot), - BeaconRoot: common.Hash(beaconRoot), + Parent: common.Hash(payloadAttributes.Data.ParentBlockHash), + Timestamp: payloadAttributes.Data.V3.Timestamp, + Random: payloadAttributes.Data.V3.PrevRandao, + FeeRecipient: common.Address(slotDuty.Entry.Message.FeeRecipient), + GasLimit: uint64(slotDuty.Entry.Message.GasLimit), + ProposerPubkey: proposerPubkey, + BeaconRoot: common.Hash(payloadAttributes.Data.ParentBlockRoot), + Withdrawals: withdrawals, } { // Signal to the builder that it's time to build a new block startTime := time.Now().UnixMilli() - receipt := ethBlockContract.SendConfidentialRequest("buildFromPool", []any{blockArgs, targetBlock.NumberU64() + 1}, nil) + receipt := ethBlockContract.SendConfidentialRequest("buildFromPool", []any{blockArgs, targetBlock}, nil) maybe(err) duration := time.Now().UnixMilli() - startTime @@ -135,23 +139,30 @@ func main() { break } } - log.Printf("finished buildFromPool") } { // Submit block to the relay log.Printf("blockBidID: %s", hexutil.Encode(blockBidID[:])) - pre := uint64(1) - for uint64(time.Now().Unix()) < blockArgs.Timestamp-pre { - log.Printf("waiting for block. T-%d seconds...", blockArgs.Timestamp-pre-uint64(time.Now().Unix())) - time.Sleep(1 * time.Second) - } startTime := time.Now().UnixMilli() - receipt := ethBlockContract.SendConfidentialRequest("submitToRelay", []any{ - blockArgs, - blockBidID, - "", - }, nil) + var receipt *types.Receipt + for { + receipt, err = ethBlockContract.MaybeSendConfidentialRequest("submitToRelay", []any{ + blockArgs, + blockBidID, + "", + }, nil) + if err == nil { + break + } else { + log.Printf("submitToRelay error: %s. retrying in 3 seconds...", err.Error()) + if strings.Contains(err.Error(), "payload attributes not (yet) known") { + time.Sleep(3 * time.Second) + } else { + panic(err) + } + } + } duration := time.Now().UnixMilli() - startTime log.Printf("finished submitToRelay in %d ms", duration) @@ -165,15 +176,22 @@ func main() { } } -// Calculate the timestamp for a new slot. -func getNewSlotTimestamp(targetSlot uint64) uint64 { - return 1712816195 + (targetSlot-8832681)*12 -} // lol +func main() { + fr := framework.New(framework.WithL1()) + + eventProvider := eth2.EventsProvider(fr.L1Beacon) -func currentL1Block(fr *framework.Framework) *types.Block { - b, err := fr.L1.RPC().BlockByNumber(context.Background(), nil) + // subscribe to the beacon chain event `payload_attributes` + err := eventProvider.Events(context.Background(), []string{"payload_attributes"}, func(e *v1.Event) { + log.Printf("payload_attributes received: %v", e) + payloadAttributes := e.Data.(*v1.PayloadAttributesEvent) + + buildBlock(fr, payloadAttributes) + }) maybe(err) - return b + + // wait forever + select {} } func maybe(err error) { diff --git a/framework/framework.go b/framework/framework.go index e134f30..2398fdc 100644 --- a/framework/framework.go +++ b/framework/framework.go @@ -198,6 +198,42 @@ func (c *Contract) SendConfidentialRequest(method string, args []interface{}, co return receipt } +func (c *Contract) MaybeSendConfidentialRequest(method string, args []interface{}, confidentialBytes []byte) (*types.Receipt, error) { + txnResult, err := c.contract.SendTransaction(method, args, confidentialBytes) + if err != nil { + // decode the PeekerReverted error + errMsg := err.Error() + if strings.HasPrefix(errMsg, executionRevertedPrefix) { + errMsg = errMsg[len(executionRevertedPrefix):] + errMsgBytes, _ := hex.DecodeString(errMsg) + + unpacked, _ := artifacts.SuaveAbi.Errors["PeekerReverted"].Inputs.Unpack(errMsgBytes[4:]) + + addr, _ := unpacked[0].(common.Address) + eventErr, _ := unpacked[1].([]byte) + return nil, fmt.Errorf("peeker 0x%x reverted: %s", addr, eventErr) + } else if strings.HasSuffix(errMsg, "10]'") { // ascii decimal array + // split "byte array" from error string + errChunks := strings.SplitAfter(errMsg, "[") + callErr := errChunks[0][:len(errChunks[0])-1] // removes "[" at the end + internalErr := parseASCIIDecimals(errChunks[1][:len(errChunks[1])-2]) // removes "']" at the end + return nil, fmt.Errorf("%s%s", callErr, string(*internalErr)) + } + return nil, err + } + + log.Printf("transaction hash: %s", txnResult.Hash().Hex()) + + receipt, err := txnResult.Wait() + if err != nil { + return nil, err + } + if receipt.Status == 0 { + return nil, fmt.Errorf("receipt status: failed") + } + return receipt, nil +} + type Framework struct { config *Config KettleAddress common.Address diff --git a/framework/relay.go b/framework/relay.go index aafeaeb..bd8ddd3 100644 --- a/framework/relay.go +++ b/framework/relay.go @@ -4,7 +4,6 @@ import ( "encoding/json" "fmt" "io" - "log" "net/http" builderApiV1 "github.com/attestantio/go-builder-client/api/v1" @@ -51,12 +50,9 @@ func (b *RelayClient) getAndParse(url string, v any) error { // GetValidators gets current & upcoming validators from the mev-boost relay. func (b *RelayClient) GetValidators() (*[]BuilderGetValidatorsResponseEntry, error) { url := fmt.Sprintf("%s/relay/v1/builder/validators", b.relayURL) - log.Printf("url: %s", url) - data := new([]BuilderGetValidatorsResponseEntry) if err := b.getAndParse(url, data); err != nil { return nil, err } - return data, nil } diff --git a/go.mod b/go.mod index 94694dd..1da47ae 100644 --- a/go.mod +++ b/go.mod @@ -4,10 +4,12 @@ go 1.21 toolchain go1.21.3 -replace github.com/ethereum/go-ethereum => github.com/flashbots/suave-geth v0.1.3 +replace github.com/ethereum/go-ethereum => github.com/flashbots/suave-geth v0.1.5 require ( - github.com/ethereum/go-ethereum v1.13.14 + github.com/attestantio/go-builder-client v0.4.5 + github.com/attestantio/go-eth2-client v0.21.1 + github.com/ethereum/go-ethereum v1.14.3 github.com/sethvargo/go-envconfig v1.0.0 ) @@ -16,8 +18,6 @@ require ( github.com/Microsoft/go-winio v0.6.1 // indirect github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 // indirect github.com/VictoriaMetrics/fastcache v1.6.0 // indirect - github.com/attestantio/go-builder-client v0.4.5 // indirect - github.com/attestantio/go-eth2-client v0.21.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.7.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect @@ -62,7 +62,6 @@ require ( github.com/huandu/go-clone v1.6.0 // indirect github.com/huin/goupnp v1.1.0 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect - github.com/kilic/bls12-381 v0.1.0 // indirect github.com/klauspost/compress v1.17.1 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/kr/pretty v0.3.1 // indirect @@ -83,7 +82,6 @@ require ( github.com/prometheus/client_model v0.4.1-0.20230718164431-9a2bf3000d16 // indirect github.com/prometheus/common v0.44.0 // indirect github.com/prometheus/procfs v0.11.1 // indirect - github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7 // indirect github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7 // indirect github.com/r3labs/sse/v2 v2.10.0 // indirect github.com/rivo/uniseg v0.2.0 // indirect @@ -120,6 +118,5 @@ require ( gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce // indirect gopkg.in/yaml.v2 v2.4.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect rsc.io/tmplfunc v0.0.3 // indirect ) diff --git a/go.sum b/go.sum index 77657c8..e8a8c56 100644 --- a/go.sum +++ b/go.sum @@ -122,8 +122,8 @@ github.com/flashbots/go-boost-utils v1.7.0 h1:BaLeGl71nD/ro0aUzCYqHc8PiqIIaErLwc github.com/flashbots/go-boost-utils v1.7.0/go.mod h1:1Y0rD/e57KZZIRgkCcXRvvztW+v+eZHnWu25wxtGstU= github.com/flashbots/go-utils v0.4.13-0.20230919094729-c049be707f79 h1:y2obQCUIvqKISLxWxC0Tz8Oc618vA3q1xmn9GwElvfI= github.com/flashbots/go-utils v0.4.13-0.20230919094729-c049be707f79/go.mod h1:LauDwifaRdSK0mS5X34GR59pJtUu1T/lOFNdff1BqtI= -github.com/flashbots/suave-geth v0.1.3 h1:yTmt5Iez8GbwleG5D0Qpf7qTyQXyILC+KxWjfxRftD0= -github.com/flashbots/suave-geth v0.1.3/go.mod h1:fUoPFJkZQ0Q2E+DsixtdqJm/4oWuuFzJ7Ukz8pmgHeA= +github.com/flashbots/suave-geth v0.1.5 h1:55HcpKVl3ROs6botDHH0tZTpheuviETSJPm/BXmvxMQ= +github.com/flashbots/suave-geth v0.1.5/go.mod h1:fUoPFJkZQ0Q2E+DsixtdqJm/4oWuuFzJ7Ukz8pmgHeA= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.4/go.mod h1:OVB6XrOHzAwXMpEM7uPOzcehqUV2UqJxmVXmkdnm1bU= @@ -230,6 +230,7 @@ github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iU github.com/holiman/uint256 v1.2.4 h1:jUc4Nk8fm9jZabQuqr2JzednajVmBpC+oiTiXZJEApU= github.com/holiman/uint256 v1.2.4/go.mod h1:EOMSn4q6Nyt9P6efbI3bueV4e1b3dGlUCXeiRV4ng7E= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= +github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= github.com/huandu/go-clone v1.6.0 h1:HMo5uvg4wgfiy5FoGOqlFLQED/VGRm2D9Pi8g1FXPGc= github.com/huandu/go-clone v1.6.0/go.mod h1:ReGivhG6op3GYr+UY3lS6mxjKp7MIGTknuU5TbTVaXE= @@ -257,8 +258,6 @@ github.com/kataras/iris/v12 v12.1.8/go.mod h1:LMYy4VlP67TQ3Zgriz8RE2h2kMZV2SgMYb github.com/kataras/neffos v0.0.14/go.mod h1:8lqADm8PnbeFfL7CLXh1WHw53dG27MC3pgi2R1rmoTE= github.com/kataras/pio v0.0.2/go.mod h1:hAoW0t9UmXi4R5Oyq5Z4irTbaTsOemSrDGUtaTl7Dro= github.com/kataras/sitemap v0.0.5/go.mod h1:KY2eugMKiPwsJgx7+U103YZehfvNGOXURubcGyk0Bz8= -github.com/kilic/bls12-381 v0.1.0 h1:encrdjqKMEvabVQ7qYOKu1OvhqpK4s47wDYtNiPtlp4= -github.com/kilic/bls12-381 v0.1.0/go.mod h1:vDTTHJONJ6G+P2R74EhnyotQDTliQDnFEwhdmfzw1ig= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= @@ -373,8 +372,6 @@ github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdO github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY= github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI= github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY= -github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7 h1:cZC+usqsYgHtlBaGulVnZ1hfKAi8iWtujBnRLQE698c= -github.com/protolambda/bls12-381-util v0.0.0-20220416220906-d8552aa452c7/go.mod h1:IToEjHuttnUzwZI5KBSM/LOOW3qLbbrHOEfp3SbECGY= github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7 h1:0tVE4tdWQK9ZpYygoV7+vS6QkDvQVySboMVEIxBJmXw= github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7/go.mod h1:wmuf/mdK4VMD+jA9ThwcUKjg3a2XWM9cVfFYjDyY4j4= github.com/r3labs/sse/v2 v2.10.0 h1:hFEkLLFY4LDifoHdiCN/LlGBAdVJYsANaLqNYa1l/v0= @@ -550,7 +547,6 @@ golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20201101102859-da207088b7d1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210112080510-489259a85091/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= From 5e4a7029b0ff59b3afcdc346570f23eb7661323b Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Fri, 17 May 2024 13:33:58 -0700 Subject: [PATCH 14/25] clean up bb demo --- examples/build-eth-block/main.go | 39 +++++++++++++++++++------------- 1 file changed, 23 insertions(+), 16 deletions(-) diff --git a/examples/build-eth-block/main.go b/examples/build-eth-block/main.go index 3127353..816d235 100644 --- a/examples/build-eth-block/main.go +++ b/examples/build-eth-block/main.go @@ -18,7 +18,7 @@ import ( var buildEthBlockAddress = common.HexToAddress("0x42100001") -func buildBlock(fr *framework.Framework, payloadAttributes *v1.PayloadAttributesEvent) { +func buildBlock(fr *framework.Framework, payloadAttributes *v1.PayloadAttributesEvent) bool { testAddr1 := framework.GeneratePrivKey() log.Printf("Test address 1: %s", testAddr1.Address().Hex()) @@ -51,7 +51,6 @@ func buildBlock(fr *framework.Framework, payloadAttributes *v1.PayloadAttributes ) targetBlock := payloadAttributes.Data.ParentBlockNumber + 1 - targetSlot := payloadAttributes.Data.ProposalSlot { // Send a bundle to the builder decryptionCondition := targetBlock @@ -89,15 +88,16 @@ func buildBlock(fr *framework.Framework, payloadAttributes *v1.PayloadAttributes maybe(err) var slotDuty framework.BuilderGetValidatorsResponseEntry for _, validator := range *validators { - if validator.Slot == uint64(targetSlot) { + if validator.Slot == uint64(payloadAttributes.Data.ProposalSlot) { slotDuty = validator - log.Printf("found proposer duty for slot %d, %v", targetSlot, slotDuty) + log.Printf("found proposer duty for slot %d, %v", payloadAttributes.Data.ProposalSlot, slotDuty) break } } - - proposerPubkey, err := slotDuty.Entry.Message.Pubkey.MarshalJSON() - maybe(err) + if slotDuty.Entry == nil { + log.Printf("no proposer duty found for slot %d", payloadAttributes.Data.ProposalSlot) + return false + } // map payloadAttributes.Data.V3.Withdrawals to types.Withdrawals withdrawals := make([]*types.Withdrawal, len(payloadAttributes.Data.V3.Withdrawals)) @@ -111,13 +111,13 @@ func buildBlock(fr *framework.Framework, payloadAttributes *v1.PayloadAttributes } blockArgs := types.BuildBlockArgs{ - Slot: uint64(targetSlot), + Slot: uint64(payloadAttributes.Data.ProposalSlot), Parent: common.Hash(payloadAttributes.Data.ParentBlockHash), Timestamp: payloadAttributes.Data.V3.Timestamp, Random: payloadAttributes.Data.V3.PrevRandao, FeeRecipient: common.Address(slotDuty.Entry.Message.FeeRecipient), GasLimit: uint64(slotDuty.Entry.Message.GasLimit), - ProposerPubkey: proposerPubkey, + ProposerPubkey: slotDuty.Entry.Message.Pubkey[:], BeaconRoot: common.Hash(payloadAttributes.Data.ParentBlockRoot), Withdrawals: withdrawals, } @@ -155,8 +155,8 @@ func buildBlock(fr *framework.Framework, payloadAttributes *v1.PayloadAttributes if err == nil { break } else { - log.Printf("submitToRelay error: %s. retrying in 3 seconds...", err.Error()) if strings.Contains(err.Error(), "payload attributes not (yet) known") { + log.Printf("submitToRelay error: %s. retrying in 3 seconds...", err.Error()) time.Sleep(3 * time.Second) } else { panic(err) @@ -174,24 +174,31 @@ func buildBlock(fr *framework.Framework, payloadAttributes *v1.PayloadAttributes } } } + return true } func main() { fr := framework.New(framework.WithL1()) - eventProvider := eth2.EventsProvider(fr.L1Beacon) + done := make(chan bool) // subscribe to the beacon chain event `payload_attributes` err := eventProvider.Events(context.Background(), []string{"payload_attributes"}, func(e *v1.Event) { - log.Printf("payload_attributes received: %v", e) payloadAttributes := e.Data.(*v1.PayloadAttributesEvent) - - buildBlock(fr, payloadAttributes) + bbRes := buildBlock(fr, payloadAttributes) + if bbRes { + done <- true + } }) maybe(err) - // wait forever - select {} + // wait for exit conditions + select { + case <-done: + log.Printf("block sent to relay successfully") + case <-time.After(30 * time.Second): + log.Fatalf("timeout") + } } func maybe(err error) { From 1bf06201070cd31b18e734bf872feef50eaf651c Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Fri, 17 May 2024 13:36:14 -0700 Subject: [PATCH 15/25] remove unnecessary code/comments --- examples/build-eth-block/main.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/examples/build-eth-block/main.go b/examples/build-eth-block/main.go index 816d235..1bbb4a6 100644 --- a/examples/build-eth-block/main.go +++ b/examples/build-eth-block/main.go @@ -77,12 +77,7 @@ func buildBlock(fr *framework.Framework, payloadAttributes *v1.PayloadAttributes } var blockBidID [16]byte - // get latest blocks (exec & beacon) from live chain - execBlock, err := fr.L1.RPC().BlockByNumber(context.Background(), nil) - maybe(err) - execHeaderJSON, err := execBlock.Header().MarshalJSON() - maybe(err) - log.Printf("execBlock header: %s", string(execHeaderJSON)) + log.Printf("blockBidID: %s", hexutil.Encode(blockBidID[:])) validators, err := fr.L1Relay.GetValidators() maybe(err) @@ -99,7 +94,6 @@ func buildBlock(fr *framework.Framework, payloadAttributes *v1.PayloadAttributes return false } - // map payloadAttributes.Data.V3.Withdrawals to types.Withdrawals withdrawals := make([]*types.Withdrawal, len(payloadAttributes.Data.V3.Withdrawals)) for i, withdrawal := range payloadAttributes.Data.V3.Withdrawals { withdrawals[i] = &types.Withdrawal{ @@ -142,8 +136,6 @@ func buildBlock(fr *framework.Framework, payloadAttributes *v1.PayloadAttributes } { // Submit block to the relay - log.Printf("blockBidID: %s", hexutil.Encode(blockBidID[:])) - startTime := time.Now().UnixMilli() var receipt *types.Receipt for { @@ -167,7 +159,6 @@ func buildBlock(fr *framework.Framework, payloadAttributes *v1.PayloadAttributes duration := time.Now().UnixMilli() - startTime log.Printf("finished submitToRelay in %d ms", duration) - // get logs from ccr for _, receiptLog := range receipt.Logs { if receiptLog.Topics[0] == ethBlockContract.Abi.Events["SubmitBlockResponse"].ID { log.Printf("SubmitBlockResponse: %s", receiptLog.Data) From 1d9d28327d997fc2bae43067447d3f5ccce01719 Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Sun, 19 May 2024 12:20:15 -0700 Subject: [PATCH 16/25] flesh out mainnet BB example README --- examples/build-eth-block/README.md | 104 +++++++++++++++++++++++++---- 1 file changed, 90 insertions(+), 14 deletions(-) diff --git a/examples/build-eth-block/README.md b/examples/build-eth-block/README.md index e31c683..7879a62 100644 --- a/examples/build-eth-block/README.md +++ b/examples/build-eth-block/README.md @@ -1,30 +1,106 @@ # Example Ethereum L1 Block Builder SUAPP -This example demonstrates a simple block building contract that receives bundles and returns an Ethereum L1 block. +This example demonstrates a simple block building contract that receives bundles and submits a block to mainnet Ethereum. -## How to use +## Requirements -Start the `suave-geth` development environment +- [suave-geth](https://github.com/flashbots/suave-geth/tree/brock/mainnet-builder) +- [suavex-foundry](https://github.com/flashbots/suavex-foundry) +- [foundry](https://getfoundry.sh/) (system installation) +- [Golang](https://go.dev/doc/install) toolchain +- [Rust](https://rustup.rs/) toolchain +## Setup + +This demo requires *suave-geth* to be configured for mainnet. Currently, it's hard-coded for Holesky testnet. + +Check out this branch to reconfigure the node for mainnet: + +```sh +# in suave-geth/ +git checkout brock/mainnet-builder ``` -$ make devnet-up # from suave-geth root directory + +Run suave-geth devnet with the following flags to ensure we connect to our own Ethereum provider, which we'll set up afterwards. + +```sh +suave-geth --suave.dev \ + --suave.eth.remote_endpoint=http://localhost:8555 \ + --suave.eth.external-whitelist='*' ``` -Execute the deployment script: +This demo uses [suavex-anvil](https://github.com/flashbots/suavex-foundry)'s as the Ethereum provider for suave-geth, to replicate the conditions of building blocks for mainnet by forking a mainnet RPC provider. +Set `RPC_URL` (to a real mainnet RPC provider) in your environment, then run the following to download and run suavex-anvil. + +```sh +git clone https://github.com/flashbots/suavex-foundry +cd suavex-foundry +cargo run --bin anvil -- -p 8555 --chain-id 1 -f $RPC_URL ``` -$ go run main.go + +The default account which is funded by suave-execution-geth (which we're replacing with suavex-anvil) isn't funded on this fork of anvil by default, so we'll need to send it some ether from one of the default anvil accounts. +We can do this with cast (from Foundry): + +```sh +cast send \ + -r http://localhost:8555 \ + --value 999ether \ + --private-key 0x2a871d0798f97d79848a013d4936a73bf4cc922c825d33c1cf7073dff6d409c6 \ + 0xb5feafbdd752ad52afb7e1bd2e40432a485bbb7f +``` + +> For this demo, a mainnet beacon node with access to the `/eth/v1/events` endpoint is required. We use this to listen to the `payload_attributes` event, which gives us data we need to build blocks for mainnet. + +Now back in this codebase, set `L1_BEACON_URL` to your beacon node's RPC in .env (in the project root directory), or in your shell's environment, and run the deployment script: + +```sh +# in examples/build-eth-block/ +go run main.go ``` Expected output: +```txt + +2024/05/19 12:07:46 Test address 1: 0x85E6919588CF2C82A5489c4606EC9C16Ab960cc9 +2024/05/19 12:07:46 funding account 0x85E6919588CF2C82A5489c4606EC9C16Ab960cc9 with 100000000000000000 +2024/05/19 12:07:46 funder 0xB5fEAfbDD752ad52Afb7e1bD2E40432A485bBB7F 998799840409509787000 +2024/05/19 12:07:47 transaction hash: 0x1421782aadd47d8a033233b6bd8d376d79fe2c983be8e00c5613a3efe94914f3 +2024/05/19 12:07:47 deployed contract at 0x19aE73489C3C76f27f110a9Bf51D03bbA99eF38d +2024/05/19 12:07:47 deployed contract at 0x010249e143b3b31286da7aAC26Ad2fCAB3A60a0D +2024/05/19 12:07:47 transaction hash: 0x8d5d492ff7b693d44b7d34972f2220b1bf4446360ff7b88b035fd61d5ef7f9c4 +2024/05/19 12:07:47 finished newBundle in 117 ms +2024/05/19 12:07:47 found proposer duty for slot 9110137, {9110137 1229602 {message: {fee_recipient: '0x13F2241aa64bb6DA2B74553fA9E12B713b74F334', gas_limit: 30000000, timestamp: 1708476504, pubkey: '0x8e815d6361afd8475e9ca1388aeadbea8abd1e21a80e7cffae85e3ccb8eaad8704168e96210bdd6c4b778ecd913ce17d'}, signature: '0xa29ede14583f65253d5477b53a171fb5473aa25018c97b544eb43bb0ed02c45f9bf60f48dad6e7f1f07524da72165cc303e36d509791a97a0cb581f6d6d88f5dbeda118e5985247b588d4e7d3c9e81d224b2632616297b2b5a79aff587bb7287'} +} +2024/05/19 12:07:47 transaction hash: 0x1725273667a59c32e7a818516955118f90d5c62feaec08e40e6c9bbcc2ff10df +2024/05/19 12:07:47 finished buildFromPool in 123 ms +2024/05/19 12:07:47 blockBidID: 0x2a20347f1f6a5e749380e856e663e478 +2024/05/19 12:07:48 transaction hash: 0xc8f617046e0f0e2acda8eef51a98b1e871ae896cb366227bd00a469d8bf4523f +2024/05/19 12:07:48 finished submitToRelay in 298 ms +2024/05/19 12:07:48 SubmitBlockResponse: @ {"message":{"slot":"9110137","parent_hash":"0x7e3da03170e94cae80e6d40ab8bf144c523f1496c0bb72a24edbd710ed96e13c","block_hash":"0x91f4a5437385cfc026ba229ed7c37d5d22c9a789b97ebe1b11ffc895419000a0","builder_pubkey":"0xaddea0de71ac5a8bc243bec7f7c7d9767aa8b129e54420217603e34faf519be8f57f42850a16539e803a13031dd4cd6b","proposer_pubkey":"0x8e815d6361afd8475e9ca1388aeadbea8abd1e21a80e7cffae85e3ccb8eaad8704168e96210bdd6c4b778ecd913ce17d","proposer_fee_recipient":"0x13F2241aa64bb6DA2B74553fA9E12B713b74F334","gas_limit":"30000000","gas_used":"21000","value":"42035392455000"},"execution_payload":{"parent_hash":"0x7e3da03170e94cae80e6d40ab8bf144c523f1496c0bb72a24edbd710ed96e13c","fee_recipient":"0x13F2241aa64bb6DA2B74553fA9E12B713b74F334","state_root":"0x0000000000000000000000000000000000000000000000000000000000000000","receipts_root":"0x056b23fbba480696b65fe5a59b8f2148a1299103c4f57df839233af2cf4ca2d2","logs_bloom":"0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000","prev_randao":"0x15c2cb2e95db2e4c1f62c72c4cd2a83c2cf012595066e89bcb6106df372109ab","block_number":"19905873","gas_limit":"30000000","gas_used":"21000","timestamp":"1716145667","extra_data":"0x","base_fee_per_gas":"2001685355","block_hash":"0x91f4a5437385cfc026ba229ed7c37d5d22c9a789b97ebe1b11ffc895419000a0","transactions":["0xf866808501dcf0076b8252089485e6919588cf2c82a5489c4606ec9c16ab960cc98203e88026a08ee0d6fea35637429d39f477a9c6709116e2287801582d8d9daa4d5f7478da09a06e27aa208b99a05b1b0f3483b14ee278a5b2e011f992a5f78aa66fa0bb2d1852"],"withdrawals":[{"index":"45936075","validator_index":"1083174","address":"0x210b3cb99fa1de0a64085fa80e18c22fe4722a1b","amount":"18290423"},{"index":"45936076","validator_index":"1083175","address":"0x210b3cb99fa1de0a64085fa80e18c22fe4722a1b","amount":"18432792"},{"index":"45936077","validator_index":"1083176","address":"0x210b3cb99fa1de0a64085fa80e18c22fe4722a1b","amount":"18315290"},{"index":"45936078","validator_index":"1083177","address":"0x210b3cb99fa1de0a64085fa80e18c22fe4722a1b","amount":"18286639"},{"index":"45936079","validator_index":"1083178","address":"0x210b3cb99fa1de0a64085fa80e18c22fe4722a1b","amount":"18340866"},{"index":"45936080","validator_index":"1083179","address":"0x210b3cb99fa1de0a64085fa80e18c22fe4722a1b","amount":"18329346"},{"index":"45936081","validator_index":"1083180","address":"0x210b3cb99fa1de0a64085fa80e18c22fe4722a1b","amount":"18456127"},{"index":"45936082","validator_index":"1083181","address":"0x210b3cb99fa1de0a64085fa80e18c22fe4722a1b","amount":"18361575"},{"index":"45936083","validator_index":"1083182","address":"0x210b3cb99fa1de0a64085fa80e18c22fe4722a1b","amount":"18410121"},{"index":"45936084","validator_index":"1083183","address":"0x210b3cb99fa1de0a64085fa80e18c22fe4722a1b","amount":"63239113"},{"index":"45936085","validator_index":"1083184","address":"0x210b3cb99fa1de0a64085fa80e18c22fe4722a1b","amount":"18314522"},{"index":"45936086","validator_index":"1083185","address":"0x210b3cb99fa1de0a64085fa80e18c22fe4722a1b","amount":"18463203"},{"index":"45936087","validator_index":"1083186","address":"0x210b3cb99fa1de0a64085fa80e18c22fe4722a1b","amount":"18370225"},{"index":"45936088","validator_index":"1083187","address":"0x210b3cb99fa1de0a64085fa80e18c22fe4722a1b","amount":"18426274"},{"index":"45936089","validator_index":"1083188","address":"0x210b3cb99fa1de0a64085fa80e18c22fe4722a1b","amount":"18347389"},{"index":"45936090","validator_index":"1083189","address":"0x2641c2ded63a0c640629f5edf1189e0f53c06561","amount":"18172407"}],"blob_gas_used":"0","excess_blob_gas":"0"},"blobs_bundle":{"commitments":[],"proofs":[],"blobs":[]},"signature":"0x89d1bd5453693e8ded23c0058fb69cf22e17e44cd1b6404d2245012acb7650fd26ed7aa72ff56775d8ed92f6fe300b1e01355a2c44dd2ce688c1a655470d21bd3910f2bb75c434a5346249e5bd382a490093acfa7a53237aae9c81876126cc77"};{"message":"accepted bid below floor, skipped validation"} ``` -2024/02/29 14:59:09 Test address 1: 0x675d92a306187fBC280f8Dd98465770FBAEFf8Ab -2024/02/29 14:59:09 funding account 0x675d92a306187fBC280f8Dd98465770FBAEFf8Ab with 100000000000000000 -2024/02/29 14:59:09 funder 0xB5fEAfbDD752ad52Afb7e1bD2E40432A485bBB7F 115792089237316195423570985008687907853269984665640564039457584007913129639927 -2024/02/29 14:59:09 transaction hash: 0x29e67f56dfd1a01ab210dcad889eba7a99028ec1bf2206b66d8054efc14e6fda -2024/02/29 14:59:09 deployed contract at 0xd594760B2A36467ec7F0267382564772D7b0b73c -2024/02/29 14:59:09 deployed contract at 0x8f21Fdd6B4f4CacD33151777A46c122797c8BF17 -2024/02/29 14:59:09 transaction hash: 0x99a95bc20ea3e8c9d8a2ac21943c1c7a51599b57e4254a48f3773f923d881f2b -2024/02/29 14:59:09 transaction hash: 0xbf9ff92a229c76f59ed7d2be06297763b796c390d725fb1863e199cdb9cff1eb + +The block submitted won't be considered for inclusion because the transactions used to build the block in this demo aren't valid on mainnet. However, those transactions could easily be replaced with real transactions in another SUAPP. + +You may encounter an error `payload attributes not (yet) found`. This is common, and typically results from the beacon node being out of sync. Running the demo again often works. If it doesn't, you may need to check your node. + +The `/eth/v1/node/syncing` endpoint is helpful in diagnosing this issue: + +```sh +curl $L1_BEACON_URL/eth/v1/node/syncing +``` + +If your node is healthy, the response should look similar to this: + +```json +{ + "data": { + "is_syncing":false, + "is_optimistic":false, + "el_offline":false, + "head_slot":"9110162", + "sync_distance":"0" + } +} ``` From 9738ecda6c374571398de3c1f865b0789f8bfe34 Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Sun, 19 May 2024 12:21:03 -0700 Subject: [PATCH 17/25] fix log of uninitialized var --- examples/build-eth-block/main.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/build-eth-block/main.go b/examples/build-eth-block/main.go index 1bbb4a6..2cbd5a5 100644 --- a/examples/build-eth-block/main.go +++ b/examples/build-eth-block/main.go @@ -77,7 +77,6 @@ func buildBlock(fr *framework.Framework, payloadAttributes *v1.PayloadAttributes } var blockBidID [16]byte - log.Printf("blockBidID: %s", hexutil.Encode(blockBidID[:])) validators, err := fr.L1Relay.GetValidators() maybe(err) @@ -130,6 +129,7 @@ func buildBlock(fr *framework.Framework, payloadAttributes *v1.PayloadAttributes bids, err := buildEvent.Inputs.Unpack(receiptLog.Data) maybe(err) blockBidID = bids[0].([16]byte) + log.Printf("blockBidID: %s", hexutil.Encode(blockBidID[:])) break } } From a8075193a9eaf11abbfa74d2079710493cdb6ccf Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Sun, 19 May 2024 12:28:30 -0700 Subject: [PATCH 18/25] spruce readme --- examples/build-eth-block/README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/examples/build-eth-block/README.md b/examples/build-eth-block/README.md index 7879a62..8151615 100644 --- a/examples/build-eth-block/README.md +++ b/examples/build-eth-block/README.md @@ -83,7 +83,7 @@ Expected output: The block submitted won't be considered for inclusion because the transactions used to build the block in this demo aren't valid on mainnet. However, those transactions could easily be replaced with real transactions in another SUAPP. -You may encounter an error `payload attributes not (yet) found`. This is common, and typically results from the beacon node being out of sync. Running the demo again often works. If it doesn't, you may need to check your node. +⚠️ You may encounter an error `payload attributes not (yet) found`. This is common, and typically results from the beacon node being out of sync. Running the demo again often works. If it doesn't, you may need to check your node. The `/eth/v1/node/syncing` endpoint is helpful in diagnosing this issue: @@ -91,7 +91,7 @@ The `/eth/v1/node/syncing` endpoint is helpful in diagnosing this issue: curl $L1_BEACON_URL/eth/v1/node/syncing ``` -If your node is healthy, the response should look similar to this: +If your node is healthy, the response should look like this: ```json { @@ -99,7 +99,7 @@ If your node is healthy, the response should look similar to this: "is_syncing":false, "is_optimistic":false, "el_offline":false, - "head_slot":"9110162", + "head_slot":"9110069", "sync_distance":"0" } } From 6ad7039540f24719098fe53ec223ee229fa48381 Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Mon, 20 May 2024 11:24:30 -0700 Subject: [PATCH 19/25] add missing instruction in bb readme --- examples/build-eth-block/README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/build-eth-block/README.md b/examples/build-eth-block/README.md index 8151615..0afcdf5 100644 --- a/examples/build-eth-block/README.md +++ b/examples/build-eth-block/README.md @@ -14,17 +14,19 @@ This example demonstrates a simple block building contract that receives bundles This demo requires *suave-geth* to be configured for mainnet. Currently, it's hard-coded for Holesky testnet. -Check out this branch to reconfigure the node for mainnet: +Check out this branch to reconfigure the node for mainnet and rebuild the binary: ```sh # in suave-geth/ git checkout brock/mainnet-builder +make suave ``` Run suave-geth devnet with the following flags to ensure we connect to our own Ethereum provider, which we'll set up afterwards. ```sh -suave-geth --suave.dev \ +# in suave-geth/ +./build/bin/suave-geth --suave.dev \ --suave.eth.remote_endpoint=http://localhost:8555 \ --suave.eth.external-whitelist='*' ``` From 0e366dacff965efe9095416d651cec6929ff304a Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Mon, 20 May 2024 11:33:47 -0700 Subject: [PATCH 20/25] add beacon node to top requirements list --- examples/build-eth-block/README.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/build-eth-block/README.md b/examples/build-eth-block/README.md index 0afcdf5..1804ed8 100644 --- a/examples/build-eth-block/README.md +++ b/examples/build-eth-block/README.md @@ -9,6 +9,7 @@ This example demonstrates a simple block building contract that receives bundles - [foundry](https://getfoundry.sh/) (system installation) - [Golang](https://go.dev/doc/install) toolchain - [Rust](https://rustup.rs/) toolchain +- ETH2 beacon RPC with access to `/eth/v1/events` ## Setup @@ -31,9 +32,9 @@ Run suave-geth devnet with the following flags to ensure we connect to our own E --suave.eth.external-whitelist='*' ``` -This demo uses [suavex-anvil](https://github.com/flashbots/suavex-foundry)'s as the Ethereum provider for suave-geth, to replicate the conditions of building blocks for mainnet by forking a mainnet RPC provider. +This demo uses [suavex-anvil](https://github.com/flashbots/suavex-foundry) as the Ethereum provider for suave-geth, to replicate the conditions of building blocks for mainnet by forking a mainnet RPC provider. -Set `RPC_URL` (to a real mainnet RPC provider) in your environment, then run the following to download and run suavex-anvil. +Set `RPC_URL` to a real mainnet RPC provider in your environment, then run the following to download and run suavex-anvil. ```sh git clone https://github.com/flashbots/suavex-foundry From 870f3ad819290879a525b798680485076211f5c8 Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Mon, 20 May 2024 12:42:48 -0700 Subject: [PATCH 21/25] add missing step to bb readme, last bit of cleanup --- examples/build-eth-block/README.md | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/examples/build-eth-block/README.md b/examples/build-eth-block/README.md index 1804ed8..b34ad2a 100644 --- a/examples/build-eth-block/README.md +++ b/examples/build-eth-block/README.md @@ -6,7 +6,7 @@ This example demonstrates a simple block building contract that receives bundles - [suave-geth](https://github.com/flashbots/suave-geth/tree/brock/mainnet-builder) - [suavex-foundry](https://github.com/flashbots/suavex-foundry) -- [foundry](https://getfoundry.sh/) (system installation) +- [foundry](https://getfoundry.sh/) (system installation to use `cast` and `forge`) - [Golang](https://go.dev/doc/install) toolchain - [Rust](https://rustup.rs/) toolchain - ETH2 beacon RPC with access to `/eth/v1/events` @@ -15,7 +15,7 @@ This example demonstrates a simple block building contract that receives bundles This demo requires *suave-geth* to be configured for mainnet. Currently, it's hard-coded for Holesky testnet. -Check out this branch to reconfigure the node for mainnet and rebuild the binary: +In another terminal, checkout this branch to configure the node for mainnet and rebuild the binary: ```sh # in suave-geth/ @@ -34,7 +34,7 @@ Run suave-geth devnet with the following flags to ensure we connect to our own E This demo uses [suavex-anvil](https://github.com/flashbots/suavex-foundry) as the Ethereum provider for suave-geth, to replicate the conditions of building blocks for mainnet by forking a mainnet RPC provider. -Set `RPC_URL` to a real mainnet RPC provider in your environment, then run the following to download and run suavex-anvil. +In another terminal, set `RPC_URL` in your environment to a real mainnet RPC provider, then run the following to download and run suavex-anvil. ```sh git clone https://github.com/flashbots/suavex-foundry @@ -53,9 +53,16 @@ cast send \ 0xb5feafbdd752ad52afb7e1bd2e40432a485bbb7f ``` +Now back in this repository, if you haven't already built the contracts, do so now: + +```sh +# in suapp-examples/examples/build-eth-block/ +forge build +``` + > For this demo, a mainnet beacon node with access to the `/eth/v1/events` endpoint is required. We use this to listen to the `payload_attributes` event, which gives us data we need to build blocks for mainnet. -Now back in this codebase, set `L1_BEACON_URL` to your beacon node's RPC in .env (in the project root directory), or in your shell's environment, and run the deployment script: +Set `L1_BEACON_URL` to your beacon node's RPC in .env (in the project root directory), or in your shell's environment, and run the deployment script: ```sh # in examples/build-eth-block/ From 6e0b614b01b0938227ef5285efb7f07695056dd9 Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Mon, 20 May 2024 13:02:00 -0700 Subject: [PATCH 22/25] handle unused err in framework --- framework/framework.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/framework/framework.go b/framework/framework.go index 2398fdc..9ea4c97 100644 --- a/framework/framework.go +++ b/framework/framework.go @@ -307,6 +307,9 @@ func New(opts ...ConfigOption) *Framework { l1Clt := sdk.NewClient(l1RPC, config.FundedAccountL1.Priv, common.Address{}) fr.L1 = &Chain{rpc: l1RPC, clt: l1Clt} beaconClient, err := ethHttp.New(context.Background(), ethHttp.WithAddress(config.L1BeaconURL)) + if err != nil { + panic(err) + } fr.L1Beacon = beaconClient.(*ethHttp.Service) fr.L1Relay = &RelayClient{ httpClient: http.DefaultClient, From 5ce903e893b7807d83bdb10cd0e19a11f48cfd26 Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Mon, 20 May 2024 13:02:34 -0700 Subject: [PATCH 23/25] simplify one-shot channel usage --- examples/build-eth-block/main.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/examples/build-eth-block/main.go b/examples/build-eth-block/main.go index 2cbd5a5..d9f327c 100644 --- a/examples/build-eth-block/main.go +++ b/examples/build-eth-block/main.go @@ -171,14 +171,14 @@ func buildBlock(fr *framework.Framework, payloadAttributes *v1.PayloadAttributes func main() { fr := framework.New(framework.WithL1()) eventProvider := eth2.EventsProvider(fr.L1Beacon) - done := make(chan bool) + done := make(chan struct{}) // subscribe to the beacon chain event `payload_attributes` err := eventProvider.Events(context.Background(), []string{"payload_attributes"}, func(e *v1.Event) { payloadAttributes := e.Data.(*v1.PayloadAttributesEvent) bbRes := buildBlock(fr, payloadAttributes) if bbRes { - done <- true + close(done) } }) maybe(err) From 85f4c9e5dac31a6cc8eb438cd229ca2cea010d29 Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Mon, 20 May 2024 13:11:36 -0700 Subject: [PATCH 24/25] fix unclosed body & unchecked beacon client --- framework/framework.go | 3 +++ framework/relay.go | 1 + 2 files changed, 4 insertions(+) diff --git a/framework/framework.go b/framework/framework.go index 9ea4c97..d5b3d72 100644 --- a/framework/framework.go +++ b/framework/framework.go @@ -311,6 +311,9 @@ func New(opts ...ConfigOption) *Framework { panic(err) } fr.L1Beacon = beaconClient.(*ethHttp.Service) + if fr.L1Beacon == nil { + panic("failed to create L1 beacon client") + } fr.L1Relay = &RelayClient{ httpClient: http.DefaultClient, relayURL: config.L1RelayURL, diff --git a/framework/relay.go b/framework/relay.go index bd8ddd3..8ea4d93 100644 --- a/framework/relay.go +++ b/framework/relay.go @@ -32,6 +32,7 @@ func GetAndParse[V interface{}](b *RelayClient, url string, v V) error { if err != nil { return err } + defer res.Body.Close() body, err := io.ReadAll(res.Body) if err != nil { return err From 5c21b0ddfacb6c1fb5b83c879d3e3c6294701475 Mon Sep 17 00:00:00 2001 From: zeroXbrock <2791467+zeroXbrock@users.noreply.github.com> Date: Mon, 20 May 2024 13:23:35 -0700 Subject: [PATCH 25/25] properly handle beacon service type assertion --- framework/framework.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/framework/framework.go b/framework/framework.go index d5b3d72..9fba436 100644 --- a/framework/framework.go +++ b/framework/framework.go @@ -310,10 +310,11 @@ func New(opts ...ConfigOption) *Framework { if err != nil { panic(err) } - fr.L1Beacon = beaconClient.(*ethHttp.Service) - if fr.L1Beacon == nil { + beaconService, ok := beaconClient.(*ethHttp.Service) + if !ok { panic("failed to create L1 beacon client") } + fr.L1Beacon = beaconService fr.L1Relay = &RelayClient{ httpClient: http.DefaultClient, relayURL: config.L1RelayURL,