Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Build Deneb block in buildEthBlock. #188

Merged
merged 2 commits into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions core/vm/contracts_suave_eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"math/big"
"net/http"
Expand All @@ -20,12 +21,12 @@ import (
"github.com/flashbots/go-boost-utils/ssz"
"github.com/holiman/uint256"

builderCapella "github.com/attestantio/go-builder-client/api/capella"
builderDeneb "github.com/attestantio/go-builder-client/api/deneb"
builderV1 "github.com/attestantio/go-builder-client/api/v1"
"github.com/attestantio/go-eth2-client/spec/bellatrix"
specCapella "github.com/attestantio/go-eth2-client/spec/capella"
specDeneb "github.com/attestantio/go-eth2-client/spec/deneb"
"github.com/attestantio/go-eth2-client/spec/phase0"
boostTypes "github.com/flashbots/go-boost-utils/types"
boostUtils "github.com/flashbots/go-boost-utils/utils"
)

Expand Down Expand Up @@ -217,7 +218,7 @@ func (b *suaveRuntime) buildEthBlock(blockArgs types.BuildBlockArgs, dataID type

log.Info("built block from bundles", "payload", *envelope.ExecutionPayload)

payload, err := executableDataToCapellaExecutionPayload(envelope.ExecutionPayload)
payload, err := executableDataToDenebExecutionPayload(envelope.ExecutionPayload)
if err != nil {
return nil, nil, fmt.Errorf("could not format execution payload as capella payload: %w", err)
}
Expand Down Expand Up @@ -259,7 +260,7 @@ func (b *suaveRuntime) buildEthBlock(blockArgs types.BuildBlockArgs, dataID type
return nil, nil, fmt.Errorf("could not sign builder record: %w", err)
}

bidRequest := builderCapella.SubmitBlockRequest{
bidRequest := builderDeneb.SubmitBlockRequest{
Message: &blockBidMsg,
ExecutionPayload: payload,
Signature: signature,
Expand Down Expand Up @@ -307,7 +308,7 @@ func (b *suaveRuntime) submitEthBlockToRelay(relayUrl string, builderDataRecordJ
return resp, nil
}

func executableDataToCapellaExecutionPayload(data *engine.ExecutableData) (*specCapella.ExecutionPayload, error) {
func executableDataToDenebExecutionPayload(data *engine.ExecutableData) (*specDeneb.ExecutionPayload, error) {
transactionData := make([]bellatrix.Transaction, len(data.Transactions))
for i, tx := range data.Transactions {
transactionData[i] = bellatrix.Transaction(tx)
Expand All @@ -323,13 +324,12 @@ func executableDataToCapellaExecutionPayload(data *engine.ExecutableData) (*spec
}
}

baseFeePerGas := new(boostTypes.U256Str)
err := baseFeePerGas.FromBig(data.BaseFeePerGas)
if err != nil {
return nil, err
baseFeePerGas := new(uint256.Int)
if baseFeePerGas.SetFromBig(data.BaseFeePerGas) {
return nil, errors.New("base fee per gas: overflow")
}

return &specCapella.ExecutionPayload{
return &specDeneb.ExecutionPayload{
ParentHash: [32]byte(data.ParentHash),
FeeRecipient: [20]byte(data.FeeRecipient),
StateRoot: [32]byte(data.StateRoot),
Expand All @@ -341,7 +341,7 @@ func executableDataToCapellaExecutionPayload(data *engine.ExecutableData) (*spec
GasUsed: data.GasUsed,
Timestamp: data.Timestamp,
ExtraData: data.ExtraData,
BaseFeePerGas: *baseFeePerGas,
BaseFeePerGas: baseFeePerGas,
BlockHash: [32]byte(data.BlockHash),
Transactions: transactionData,
Withdrawals: withdrawalData,
Expand Down
32 changes: 16 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ require (
github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0
github.com/VictoriaMetrics/fastcache v1.6.0
github.com/alicebob/miniredis/v2 v2.30.5
github.com/attestantio/go-builder-client v0.3.0
github.com/attestantio/go-eth2-client v0.16.4
github.com/attestantio/go-builder-client v0.4.2
github.com/attestantio/go-eth2-client v0.19.7
github.com/aws/aws-sdk-go-v2 v1.2.0
github.com/aws/aws-sdk-go-v2/config v1.1.1
github.com/aws/aws-sdk-go-v2/credentials v1.1.1
Expand Down Expand Up @@ -35,7 +35,7 @@ require (
github.com/go-stack/stack v1.8.1
github.com/gofrs/flock v0.8.1
github.com/golang-jwt/jwt/v4 v4.3.0
github.com/golang/protobuf v1.5.2
github.com/golang/protobuf v1.5.3
github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb
github.com/google/gofuzz v1.2.0
github.com/google/uuid v1.3.1
Expand All @@ -53,7 +53,7 @@ require (
github.com/karalabe/usb v0.0.2
github.com/kylelemons/godebug v1.1.0
github.com/mattn/go-colorable v0.1.13
github.com/mattn/go-isatty v0.0.18
github.com/mattn/go-isatty v0.0.20
github.com/mitchellh/mapstructure v1.5.0
github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416
github.com/olekukonko/tablewriter v0.0.5
Expand All @@ -68,10 +68,10 @@ require (
github.com/tyler-smith/go-bip39 v1.1.0
github.com/umbracle/ethgo v0.1.3
github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa
golang.org/x/crypto v0.13.0
golang.org/x/crypto v0.14.0
golang.org/x/exp v0.0.0-20230810033253-352e893a4cad
golang.org/x/sync v0.1.0
golang.org/x/sys v0.12.0
golang.org/x/sync v0.2.0
golang.org/x/sys v0.13.0
golang.org/x/text v0.13.0
golang.org/x/time v0.0.0-20220922220347-f3bd1da661af
golang.org/x/tools v0.7.0
Expand Down Expand Up @@ -109,29 +109,29 @@ require (
github.com/getsentry/sentry-go v0.18.0 // indirect
github.com/go-ole/go-ole v1.2.1 // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/goccy/go-yaml v1.11.0 // indirect
github.com/goccy/go-yaml v1.11.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097 // 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.4 // 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-runewidth v0.0.9 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect
github.com/minio/sha256-simd v1.0.0 // indirect
github.com/minio/sha256-simd v1.0.1 // indirect
github.com/mitchellh/pointerstructure v1.2.0 // indirect
github.com/mmcloughlin/addchain v0.4.0 // indirect
github.com/naoina/go-stringutil v0.1.0 // indirect
github.com/opentracing/opentracing-go v1.1.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.14.0 // indirect
github.com/prometheus/client_golang v1.16.0 // indirect
github.com/prometheus/client_model v0.3.0 // indirect
github.com/prometheus/common v0.39.0 // indirect
github.com/prometheus/procfs v0.9.0 // indirect
github.com/prometheus/common v0.42.0 // indirect
github.com/prometheus/procfs v0.10.1 // indirect
github.com/prysmaticlabs/go-bitfield v0.0.0-20210809151128-385d8c5e3fb7 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/rogpeppe/go-internal v1.11.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/tklauser/go-sysconf v0.3.5 // indirect
github.com/tklauser/numcpus v0.2.2 // indirect
Expand All @@ -141,8 +141,8 @@ require (
github.com/yuin/gopher-lua v1.1.0 // indirect
golang.org/x/mod v0.11.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/protobuf v1.28.1 // indirect
golang.org/x/xerrors v0.0.0-20231012003039-104605ab7028 // indirect
google.golang.org/protobuf v1.30.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
rsc.io/tmplfunc v0.0.3 // indirect
)
Loading
Loading