From 7630e0910c7615abe4eabf0368521bc8550679d8 Mon Sep 17 00:00:00 2001 From: halo3mic <46010359+halo3mic@users.noreply.github.com> Date: Mon, 22 Apr 2024 08:33:57 +0200 Subject: [PATCH] add support for blob txs (#234) * add support for blob txs * attach blobs only if bid directly submitted inside the precompile * goerli -> holesky versionedHash in test * test update: goerli -> holesky * fix test: omit arg on repurposed build-block param --- core/types/suave_structs.go | 2 +- core/vm/contracts_suave_eth.go | 71 ++++++++++++++++++++-- core/vm/contracts_suave_runtime_adapter.go | 10 +-- suave/artifacts/SuaveLib.json | 2 +- suave/artifacts/addresses.go | 2 +- suave/e2e/workflow_test.go | 5 +- suave/gen/suave_spec.yaml | 6 +- suave/sol/libraries/Suave.sol | 8 +-- suave/sol/standard_peekers/bundles.sol | 10 +-- 9 files changed, 90 insertions(+), 26 deletions(-) diff --git a/core/types/suave_structs.go b/core/types/suave_structs.go index 5899f46ad..4f27df31f 100755 --- a/core/types/suave_structs.go +++ b/core/types/suave_structs.go @@ -1,5 +1,5 @@ // Code generated by suave/gen. DO NOT EDIT. -// Hash: 57cfbd2dbe351bd9d6694240e1aa982a099858a11175c4a0544da15372aef986 +// Hash: 7a53bc3490ced97366af883bb45a9dce2d5dcdcaa93dc61171d9940706691299 package types import "github.com/ethereum/go-ethereum/common" diff --git a/core/vm/contracts_suave_eth.go b/core/vm/contracts_suave_eth.go index e0bb617b4..5ee3dd129 100644 --- a/core/vm/contracts_suave_eth.go +++ b/core/vm/contracts_suave_eth.go @@ -8,6 +8,7 @@ import ( "fmt" "math/big" "net/http" + "reflect" "time" "github.com/ethereum/go-ethereum/accounts" @@ -112,7 +113,8 @@ func (b *suaveRuntime) ethcall(contractAddr common.Address, input []byte) ([]byt return b.suaveContext.Backend.ConfidentialEthBackend.Call(context.Background(), contractAddr, input) } -func (b *suaveRuntime) buildEthBlock(blockArgs types.BuildBlockArgs, dataID types.DataId, namespace string) ([]byte, []byte, error) { +// This is a temp solution and will be replaced with block building session +func (b *suaveRuntime) buildEthBlock(blockArgs types.BuildBlockArgs, dataID types.DataId, relayUrl string) ([]byte, []byte, error) { dataIDs := [][16]byte{} // first check for merged record, else assume regular record if mergedDataRecordsBytes, err := b.suaveContext.Backend.ConfidentialStore.Retrieve(dataID, buildEthBlockAddr, "default:v0:mergedDataRecords"); err == nil { @@ -256,8 +258,8 @@ func (b *suaveRuntime) buildEthBlock(blockArgs types.BuildBlockArgs, dataID type Value: value, } - // hardcoded for goerli, should be passed in with the inputs - genesisForkVersion := phase0.Version{0x00, 0x00, 0x10, 0x20} + // hardcoded for holesky, should be passed in with the inputs + genesisForkVersion := phase0.Version{0x01, 0x01, 0x70, 0x00} builderSigningDomain := ssz.ComputeDomain(ssz.DomainTypeAppBuilder, genesisForkVersion, phase0.Root{}) signature, err := ssz.SignMessage(&blockBidMsg, builderSigningDomain, b.suaveContext.Backend.EthBlockSigningKey) if err != nil { @@ -271,11 +273,32 @@ func (b *suaveRuntime) buildEthBlock(blockArgs types.BuildBlockArgs, dataID type BlobsBundle: &builderDeneb.BlobsBundle{}, } + if len(relayUrl) != 0 { + // Only attach blobs if bid is submitted outside EVM + blobsBundle, err := parseBlobs(envelope.BlobsBundle) + if err != nil { + return nil, nil, fmt.Errorf("could not parse blobs: %w", err) + } + bidRequest.BlobsBundle = blobsBundle + bidBytes, err := bidRequest.MarshalJSON() + if err != nil { + return nil, nil, fmt.Errorf("could not marshal builder record request: %w", err) + } + + res, err := b.submitEthBlockToRelay(relayUrl, bidBytes) + if err != nil { + return nil, nil, fmt.Errorf("could not submit block to relay: %w", err) + } + log.Info("submitted block to relay", "response", res) + } + + // Remove blobs before returning to prevent EVM from running out of memory + bidRequest.BlobsBundle = &builderDeneb.BlobsBundle{} bidBytes, err := bidRequest.MarshalJSON() if err != nil { return nil, nil, fmt.Errorf("could not marshal builder record request: %w", err) } - + envelope.BlobsBundle = &dencun.BlobsBundleV1{} envelopeBytes, err := json.Marshal(envelope) if err != nil { return nil, nil, fmt.Errorf("could not marshal payload envelope: %w", err) @@ -497,3 +520,43 @@ func (c *suaveRuntime) fillMevShareBundle(dataID types.DataId) ([]byte, error) { return json.Marshal(shareBundle) } + +func parseBlobs(bundle *dencun.BlobsBundleV1) (*builderDeneb.BlobsBundle, error) { + blobsBundle := &builderDeneb.BlobsBundle{} + for i, blob := range bundle.Blobs { + blobFixed, err := convertToFixedArray(blob, [131072]byte{}) + if err != nil { + return nil, fmt.Errorf("could not convert blob to fixed array: %w", err) + } + blobsBundle.Blobs = append(blobsBundle.Blobs, blobFixed) + + committmentFixed, err := convertToFixedArray(bundle.Commitments[i], [48]byte{}) + if err != nil { + return nil, fmt.Errorf("could not convert commitments to fixed array: %w", err) + } + blobsBundle.Commitments = append(blobsBundle.Commitments, committmentFixed) + + proofFixed, err := convertToFixedArray(bundle.Proofs[i], [48]byte{}) + if err != nil { + return nil, fmt.Errorf("could not convert proofs to fixed array: %w", err) + } + blobsBundle.Proofs = append(blobsBundle.Proofs, proofFixed) + } + + return blobsBundle, nil +} + +func convertToFixedArray[T any](src []byte, dst T) (T, error) { + dstVal := reflect.ValueOf(&dst).Elem() + if dstVal.Kind() != reflect.Array { + return dst, errors.New("destination is not an array") + } + + dstLen := dstVal.Len() + if len(src) > dstLen { + return dst, fmt.Errorf("source slice is too large: %d bytes", len(src)) + } + + reflect.Copy(dstVal, reflect.ValueOf(src)) + return dst, nil +} diff --git a/core/vm/contracts_suave_runtime_adapter.go b/core/vm/contracts_suave_runtime_adapter.go index ba82c671f..705b81499 100644 --- a/core/vm/contracts_suave_runtime_adapter.go +++ b/core/vm/contracts_suave_runtime_adapter.go @@ -1,5 +1,5 @@ // Code generated by suave/gen. DO NOT EDIT. -// Hash: 57cfbd2dbe351bd9d6694240e1aa982a099858a11175c4a0544da15372aef986 +// Hash: 7a53bc3490ced97366af883bb45a9dce2d5dcdcaa93dc61171d9940706691299 package vm import ( @@ -17,7 +17,7 @@ var ( ) type SuaveRuntime interface { - buildEthBlock(blockArgs types.BuildBlockArgs, dataId types.DataId, namespace string) ([]byte, []byte, error) + buildEthBlock(blockArgs types.BuildBlockArgs, dataId types.DataId, relayUrl string) ([]byte, []byte, error) confidentialInputs() ([]byte, error) confidentialRetrieve(dataId types.DataId, key string) ([]byte, error) confidentialStore(dataId types.DataId, key string, value []byte) error @@ -155,7 +155,7 @@ func (b *SuaveRuntimeAdapter) buildEthBlock(input []byte) (res []byte, err error var ( blockArgs types.BuildBlockArgs dataId types.DataId - namespace string + relayUrl string ) if err = mapstructure.Decode(unpacked[0], &blockArgs); err != nil { @@ -168,14 +168,14 @@ func (b *SuaveRuntimeAdapter) buildEthBlock(input []byte) (res []byte, err error return } - namespace = unpacked[2].(string) + relayUrl = unpacked[2].(string) var ( blockBid []byte executionPayload []byte ) - if blockBid, executionPayload, err = b.impl.buildEthBlock(blockArgs, dataId, namespace); err != nil { + if blockBid, executionPayload, err = b.impl.buildEthBlock(blockArgs, dataId, relayUrl); err != nil { return } diff --git a/suave/artifacts/SuaveLib.json b/suave/artifacts/SuaveLib.json index ad6f95297..aa6b9a2d4 100644 --- a/suave/artifacts/SuaveLib.json +++ b/suave/artifacts/SuaveLib.json @@ -1 +1 @@ -[{"type":"error","name":"PeekerReverted","inputs":[{"name":"addr","type":"address"},{"name":"err","type":"bytes"}]},{"type":"function","name":"buildEthBlock","inputs":[{"name":"blockArgs","type":"tuple","internalType":"struct Suave.BuildBlockArgs","components":[{"name":"slot","type":"uint64","internalType":"uint64"},{"name":"proposerPubkey","type":"bytes","internalType":"bytes"},{"name":"parent","type":"bytes32","internalType":"bytes32"},{"name":"timestamp","type":"uint64","internalType":"uint64"},{"name":"feeRecipient","type":"address","internalType":"address"},{"name":"gasLimit","type":"uint64","internalType":"uint64"},{"name":"random","type":"bytes32","internalType":"bytes32"},{"name":"withdrawals","type":"tuple[]","internalType":"struct Suave.Withdrawal[]","components":[{"name":"index","type":"uint64","internalType":"uint64"},{"name":"validator","type":"uint64","internalType":"uint64"},{"name":"Address","type":"address","internalType":"address"},{"name":"amount","type":"uint64","internalType":"uint64"}]},{"name":"extra","type":"bytes","internalType":"bytes"},{"name":"beaconRoot","type":"bytes32","internalType":"bytes32"},{"name":"fillPending","type":"bool","internalType":"bool"}]},{"name":"dataId","type":"bytes16","internalType":"struct Suave.DataId"},{"name":"namespace","type":"string","internalType":"string"}],"outputs":[{"name":"blockBid","type":"bytes","internalType":"bytes"},{"name":"executionPayload","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"confidentialInputs","outputs":[{"name":"confindentialData","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"confidentialRetrieve","inputs":[{"name":"dataId","type":"bytes16","internalType":"struct Suave.DataId"},{"name":"key","type":"string","internalType":"string"}],"outputs":[{"name":"value","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"confidentialStore","inputs":[{"name":"dataId","type":"bytes16","internalType":"struct Suave.DataId"},{"name":"key","type":"string","internalType":"string"},{"name":"value","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"contextGet","inputs":[{"name":"key","type":"string","internalType":"string"}],"outputs":[{"name":"value","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"doHTTPRequest","inputs":[{"name":"request","type":"tuple","internalType":"struct Suave.HttpRequest","components":[{"name":"url","type":"string","internalType":"string"},{"name":"method","type":"string","internalType":"string"},{"name":"headers","type":"string[]","internalType":"string[]"},{"name":"body","type":"bytes","internalType":"bytes"},{"name":"withFlashbotsSignature","type":"bool","internalType":"bool"}]}],"outputs":[{"name":"httpResponse","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"ethcall","inputs":[{"name":"contractAddr","type":"address","internalType":"address"},{"name":"input1","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"callOutput","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"extractHint","inputs":[{"name":"bundleData","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"hints","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"fetchDataRecords","inputs":[{"name":"cond","type":"uint64","internalType":"uint64"},{"name":"namespace","type":"string","internalType":"string"}],"outputs":[{"name":"dataRecords","type":"tuple[]","internalType":"struct Suave.DataRecord[]","components":[{"name":"id","type":"bytes16","internalType":"struct Suave.DataId"},{"name":"salt","type":"bytes16","internalType":"struct Suave.DataId"},{"name":"decryptionCondition","type":"uint64","internalType":"uint64"},{"name":"allowedPeekers","type":"address[]","internalType":"address[]"},{"name":"allowedStores","type":"address[]","internalType":"address[]"},{"name":"version","type":"string","internalType":"string"}]}]},{"type":"function","name":"fillMevShareBundle","inputs":[{"name":"dataId","type":"bytes16","internalType":"struct Suave.DataId"}],"outputs":[{"name":"encodedBundle","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"newBuilder","outputs":[{"name":"sessionid","type":"string","internalType":"string"}]},{"type":"function","name":"newDataRecord","inputs":[{"name":"decryptionCondition","type":"uint64","internalType":"uint64"},{"name":"allowedPeekers","type":"address[]","internalType":"address[]"},{"name":"allowedStores","type":"address[]","internalType":"address[]"},{"name":"dataType","type":"string","internalType":"string"}],"outputs":[{"name":"dataRecord","type":"tuple","internalType":"struct Suave.DataRecord","components":[{"name":"id","type":"bytes16","internalType":"struct Suave.DataId"},{"name":"salt","type":"bytes16","internalType":"struct Suave.DataId"},{"name":"decryptionCondition","type":"uint64","internalType":"uint64"},{"name":"allowedPeekers","type":"address[]","internalType":"address[]"},{"name":"allowedStores","type":"address[]","internalType":"address[]"},{"name":"version","type":"string","internalType":"string"}]}]},{"type":"function","name":"privateKeyGen","inputs":[{"name":"crypto","type":"uint8","internalType":"struct Suave.CryptoSignature"}],"outputs":[{"name":"privateKey","type":"string","internalType":"string"}]},{"type":"function","name":"randomBytes","inputs":[{"name":"numBytes","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"value","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"signEthTransaction","inputs":[{"name":"txn","type":"bytes","internalType":"bytes"},{"name":"chainId","type":"string","internalType":"string"},{"name":"signingKey","type":"string","internalType":"string"}],"outputs":[{"name":"signedTxn","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"signMessage","inputs":[{"name":"digest","type":"bytes","internalType":"bytes"},{"name":"crypto","type":"uint8","internalType":"struct Suave.CryptoSignature"},{"name":"signingKey","type":"string","internalType":"string"}],"outputs":[{"name":"signature","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"simulateBundle","inputs":[{"name":"bundleData","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"effectiveGasPrice","type":"uint64","internalType":"uint64"}]},{"type":"function","name":"simulateTransaction","inputs":[{"name":"sessionid","type":"string","internalType":"string"},{"name":"txn","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"simulationResult","type":"tuple","internalType":"struct Suave.SimulateTransactionResult","components":[{"name":"egp","type":"uint64","internalType":"uint64"},{"name":"logs","type":"tuple[]","internalType":"struct Suave.SimulatedLog[]","components":[{"name":"data","type":"bytes","internalType":"bytes"},{"name":"addr","type":"address","internalType":"address"},{"name":"topics","type":"bytes32[]","internalType":"bytes32[]"}]},{"name":"success","type":"bool","internalType":"bool"},{"name":"error","type":"string","internalType":"string"}]}]},{"type":"function","name":"submitBundleJsonRPC","inputs":[{"name":"url","type":"string","internalType":"string"},{"name":"method","type":"string","internalType":"string"},{"name":"params","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"errorMessage","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"submitEthBlockToRelay","inputs":[{"name":"relayUrl","type":"string","internalType":"string"},{"name":"builderBid","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"blockBid","type":"bytes","internalType":"bytes"}]}] \ No newline at end of file +[{"type":"error","name":"PeekerReverted","inputs":[{"name":"addr","type":"address"},{"name":"err","type":"bytes"}]},{"type":"function","name":"buildEthBlock","inputs":[{"name":"blockArgs","type":"tuple","internalType":"struct Suave.BuildBlockArgs","components":[{"name":"slot","type":"uint64","internalType":"uint64"},{"name":"proposerPubkey","type":"bytes","internalType":"bytes"},{"name":"parent","type":"bytes32","internalType":"bytes32"},{"name":"timestamp","type":"uint64","internalType":"uint64"},{"name":"feeRecipient","type":"address","internalType":"address"},{"name":"gasLimit","type":"uint64","internalType":"uint64"},{"name":"random","type":"bytes32","internalType":"bytes32"},{"name":"withdrawals","type":"tuple[]","internalType":"struct Suave.Withdrawal[]","components":[{"name":"index","type":"uint64","internalType":"uint64"},{"name":"validator","type":"uint64","internalType":"uint64"},{"name":"Address","type":"address","internalType":"address"},{"name":"amount","type":"uint64","internalType":"uint64"}]},{"name":"extra","type":"bytes","internalType":"bytes"},{"name":"beaconRoot","type":"bytes32","internalType":"bytes32"},{"name":"fillPending","type":"bool","internalType":"bool"}]},{"name":"dataId","type":"bytes16","internalType":"struct Suave.DataId"},{"name":"relayUrl","type":"string","internalType":"string"}],"outputs":[{"name":"blockBid","type":"bytes","internalType":"bytes"},{"name":"executionPayload","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"confidentialInputs","outputs":[{"name":"confindentialData","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"confidentialRetrieve","inputs":[{"name":"dataId","type":"bytes16","internalType":"struct Suave.DataId"},{"name":"key","type":"string","internalType":"string"}],"outputs":[{"name":"value","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"confidentialStore","inputs":[{"name":"dataId","type":"bytes16","internalType":"struct Suave.DataId"},{"name":"key","type":"string","internalType":"string"},{"name":"value","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"contextGet","inputs":[{"name":"key","type":"string","internalType":"string"}],"outputs":[{"name":"value","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"doHTTPRequest","inputs":[{"name":"request","type":"tuple","internalType":"struct Suave.HttpRequest","components":[{"name":"url","type":"string","internalType":"string"},{"name":"method","type":"string","internalType":"string"},{"name":"headers","type":"string[]","internalType":"string[]"},{"name":"body","type":"bytes","internalType":"bytes"},{"name":"withFlashbotsSignature","type":"bool","internalType":"bool"}]}],"outputs":[{"name":"httpResponse","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"ethcall","inputs":[{"name":"contractAddr","type":"address","internalType":"address"},{"name":"input1","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"callOutput","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"extractHint","inputs":[{"name":"bundleData","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"hints","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"fetchDataRecords","inputs":[{"name":"cond","type":"uint64","internalType":"uint64"},{"name":"namespace","type":"string","internalType":"string"}],"outputs":[{"name":"dataRecords","type":"tuple[]","internalType":"struct Suave.DataRecord[]","components":[{"name":"id","type":"bytes16","internalType":"struct Suave.DataId"},{"name":"salt","type":"bytes16","internalType":"struct Suave.DataId"},{"name":"decryptionCondition","type":"uint64","internalType":"uint64"},{"name":"allowedPeekers","type":"address[]","internalType":"address[]"},{"name":"allowedStores","type":"address[]","internalType":"address[]"},{"name":"version","type":"string","internalType":"string"}]}]},{"type":"function","name":"fillMevShareBundle","inputs":[{"name":"dataId","type":"bytes16","internalType":"struct Suave.DataId"}],"outputs":[{"name":"encodedBundle","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"newBuilder","outputs":[{"name":"sessionid","type":"string","internalType":"string"}]},{"type":"function","name":"newDataRecord","inputs":[{"name":"decryptionCondition","type":"uint64","internalType":"uint64"},{"name":"allowedPeekers","type":"address[]","internalType":"address[]"},{"name":"allowedStores","type":"address[]","internalType":"address[]"},{"name":"dataType","type":"string","internalType":"string"}],"outputs":[{"name":"dataRecord","type":"tuple","internalType":"struct Suave.DataRecord","components":[{"name":"id","type":"bytes16","internalType":"struct Suave.DataId"},{"name":"salt","type":"bytes16","internalType":"struct Suave.DataId"},{"name":"decryptionCondition","type":"uint64","internalType":"uint64"},{"name":"allowedPeekers","type":"address[]","internalType":"address[]"},{"name":"allowedStores","type":"address[]","internalType":"address[]"},{"name":"version","type":"string","internalType":"string"}]}]},{"type":"function","name":"privateKeyGen","inputs":[{"name":"crypto","type":"uint8","internalType":"struct Suave.CryptoSignature"}],"outputs":[{"name":"privateKey","type":"string","internalType":"string"}]},{"type":"function","name":"randomBytes","inputs":[{"name":"numBytes","type":"uint8","internalType":"uint8"}],"outputs":[{"name":"value","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"signEthTransaction","inputs":[{"name":"txn","type":"bytes","internalType":"bytes"},{"name":"chainId","type":"string","internalType":"string"},{"name":"signingKey","type":"string","internalType":"string"}],"outputs":[{"name":"signedTxn","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"signMessage","inputs":[{"name":"digest","type":"bytes","internalType":"bytes"},{"name":"crypto","type":"uint8","internalType":"struct Suave.CryptoSignature"},{"name":"signingKey","type":"string","internalType":"string"}],"outputs":[{"name":"signature","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"simulateBundle","inputs":[{"name":"bundleData","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"effectiveGasPrice","type":"uint64","internalType":"uint64"}]},{"type":"function","name":"simulateTransaction","inputs":[{"name":"sessionid","type":"string","internalType":"string"},{"name":"txn","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"simulationResult","type":"tuple","internalType":"struct Suave.SimulateTransactionResult","components":[{"name":"egp","type":"uint64","internalType":"uint64"},{"name":"logs","type":"tuple[]","internalType":"struct Suave.SimulatedLog[]","components":[{"name":"data","type":"bytes","internalType":"bytes"},{"name":"addr","type":"address","internalType":"address"},{"name":"topics","type":"bytes32[]","internalType":"bytes32[]"}]},{"name":"success","type":"bool","internalType":"bool"},{"name":"error","type":"string","internalType":"string"}]}]},{"type":"function","name":"submitBundleJsonRPC","inputs":[{"name":"url","type":"string","internalType":"string"},{"name":"method","type":"string","internalType":"string"},{"name":"params","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"errorMessage","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"submitEthBlockToRelay","inputs":[{"name":"relayUrl","type":"string","internalType":"string"},{"name":"builderBid","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"blockBid","type":"bytes","internalType":"bytes"}]}] \ No newline at end of file diff --git a/suave/artifacts/addresses.go b/suave/artifacts/addresses.go index b0babde5e..b22bf0144 100644 --- a/suave/artifacts/addresses.go +++ b/suave/artifacts/addresses.go @@ -1,5 +1,5 @@ // Code generated by suave/gen. DO NOT EDIT. -// Hash: 57cfbd2dbe351bd9d6694240e1aa982a099858a11175c4a0544da15372aef986 +// Hash: 7a53bc3490ced97366af883bb45a9dce2d5dcdcaa93dc61171d9940706691299 package artifacts import ( diff --git a/suave/e2e/workflow_test.go b/suave/e2e/workflow_test.go index c0bdec9a2..90d4819ea 100644 --- a/suave/e2e/workflow_test.go +++ b/suave/e2e/workflow_test.go @@ -925,7 +925,8 @@ func TestRelayBlockSubmissionContract(t *testing.T) { return } - genesisForkVersion := phase0.Version{0x00, 0x00, 0x10, 0x20} + // Hardcoded for Holesky + genesisForkVersion := phase0.Version{0x01, 0x01, 0x70, 0x00} builderSigningDomain := ssz.ComputeDomain(ssz.DomainTypeAppBuilder, genesisForkVersion, phase0.Root{}) ok, err := ssz.VerifySignature(blockPayloadSentToRelay.Message, builderSigningDomain, bls.PublicKeyToBytes(signingPubkey), blockPayloadSentToRelay.Signature[:]) require.NoError(t, err) @@ -1044,7 +1045,7 @@ func TestRelayBlockSubmissionContract(t *testing.T) { builderPubkey := blockPayloadSentToRelay.Message.BuilderPubkey signature := blockPayloadSentToRelay.Signature - builderSigningDomain := ssz.ComputeDomain(ssz.DomainTypeAppBuilder, phase0.Version{0x00, 0x00, 0x10, 0x20}, phase0.Root{}) + builderSigningDomain := ssz.ComputeDomain(ssz.DomainTypeAppBuilder, phase0.Version{0x01, 0x01, 0x70, 0x00}, phase0.Root{}) ok, err := ssz.VerifySignature(blockPayloadSentToRelay.Message, builderSigningDomain, builderPubkey[:], signature[:]) require.NoError(t, err) require.True(t, ok) diff --git a/suave/gen/suave_spec.yaml b/suave/gen/suave_spec.yaml index ae2c2f40c..c335fd2ec 100644 --- a/suave/gen/suave_spec.yaml +++ b/suave/gen/suave_spec.yaml @@ -243,7 +243,7 @@ functions: description: "List of hints encoded in JSON" - name: buildEthBlock address: "0x0000000000000000000000000000000042100001" - description: "Constructs an Ethereum block based on the provided data records." + description: "Constructs an Ethereum block based on the provided data records. No blobs are returned." input: - name: blockArgs type: BuildBlockArgs @@ -251,9 +251,9 @@ functions: - name: dataId type: DataId description: "ID of the data record with mev-share bundle data" - - name: namespace + - name: relayUrl type: string - description: "deprecated" + description: "If specified the built block will be submitted to the relay" output: fields: - name: blockBid diff --git a/suave/sol/libraries/Suave.sol b/suave/sol/libraries/Suave.sol index 46789bc86..7bc111782 100644 --- a/suave/sol/libraries/Suave.sol +++ b/suave/sol/libraries/Suave.sol @@ -161,17 +161,17 @@ library Suave { } } - /// @notice Constructs an Ethereum block based on the provided data records. + /// @notice Constructs an Ethereum block based on the provided data records. No blobs are returned. /// @param blockArgs Arguments to build the block /// @param dataId ID of the data record with mev-share bundle data - /// @param namespace deprecated + /// @param relayUrl If specified the built block will be submitted to the relay /// @return blockBid Block Bid encoded in JSON /// @return executionPayload Execution payload encoded in JSON - function buildEthBlock(BuildBlockArgs memory blockArgs, DataId dataId, string memory namespace) + function buildEthBlock(BuildBlockArgs memory blockArgs, DataId dataId, string memory relayUrl) internal returns (bytes memory, bytes memory) { - (bool success, bytes memory data) = BUILD_ETH_BLOCK.call(abi.encode(blockArgs, dataId, namespace)); + (bool success, bytes memory data) = BUILD_ETH_BLOCK.call(abi.encode(blockArgs, dataId, relayUrl)); if (!success) { revert PeekerReverted(BUILD_ETH_BLOCK, data); } diff --git a/suave/sol/standard_peekers/bundles.sol b/suave/sol/standard_peekers/bundles.sol index b8a85c9f5..bd3c6600c 100644 --- a/suave/sol/standard_peekers/bundles.sol +++ b/suave/sol/standard_peekers/bundles.sol @@ -248,7 +248,7 @@ contract EthBlockContract is AnyBundleContract { alldataIds[i] = bidsByEGP[i].dataId; } - return buildAndEmit(blockArgs, blockHeight, alldataIds, "mevshare:v0"); + return buildAndEmit(blockArgs, blockHeight, alldataIds, ""); } function buildFromPool(Suave.BuildBlockArgs memory blockArgs, uint64 blockHeight) public returns (bytes memory) { @@ -290,12 +290,12 @@ contract EthBlockContract is AnyBundleContract { Suave.BuildBlockArgs memory blockArgs, uint64 blockHeight, Suave.DataId[] memory records, - string memory namespace + string memory relayUrl ) public virtual returns (bytes memory) { require(Suave.isConfidential()); (Suave.DataRecord memory blockBid, bytes memory builderBid) = - this.doBuild(blockArgs, blockHeight, records, namespace); + this.doBuild(blockArgs, blockHeight, records, relayUrl); emit BuilderBoostBidEvent(blockBid.id, builderBid); emit DataRecordEvent(blockBid.id, blockBid.decryptionCondition, blockBid.allowedPeekers); @@ -352,12 +352,12 @@ contract EthBlockBidSenderContract is EthBlockContract { Suave.BuildBlockArgs memory blockArgs, uint64 blockHeight, Suave.DataId[] memory dataRecords, - string memory namespace + string memory relayUrl ) public virtual override returns (bytes memory) { require(Suave.isConfidential()); (Suave.DataRecord memory blockDataRecord, bytes memory builderBid) = - this.doBuild(blockArgs, blockHeight, dataRecords, namespace); + this.doBuild(blockArgs, blockHeight, dataRecords, relayUrl); Suave.submitEthBlockToRelay(boostRelayUrl, builderBid); emit DataRecordEvent(blockDataRecord.id, blockDataRecord.decryptionCondition, blockDataRecord.allowedPeekers);