From 415708f1b8c503670b69036f74f7942a18b990cc Mon Sep 17 00:00:00 2001 From: andytudhope <13001517+andytudhope@users.noreply.github.com> Date: Thu, 21 Dec 2023 19:46:28 +0200 Subject: [PATCH 1/3] a few more bids goodbye --- suave/devenv/cmd/main.go | 10 +++++----- suave/e2e/contracts.go | 4 ++-- suave/sol/scripts/forge_example.sol | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/suave/devenv/cmd/main.go b/suave/devenv/cmd/main.go index 2e2157af2..f5a5ec9ab 100644 --- a/suave/devenv/cmd/main.go +++ b/suave/devenv/cmd/main.go @@ -28,8 +28,8 @@ var ( ) var ( - bundleBidContract = e2e.BundleBidContract - mevShareArtifact = e2e.MevShareBidContract + bundleContract = e2e.BundleContract + mevShareArtifact = e2e.MevShareContract ) func main() { @@ -124,7 +124,7 @@ func main() { targetBlock := uint64(1) allowedPeekers := []common.Address{mevShareContract.Address()} - confidentialDataBytes, _ := bundleBidContract.Abi.Methods["fetchConfidentialBundleData"].Outputs.Pack(bundleBytes) + confidentialDataBytes, _ := bundleContract.Abi.Methods["fetchConfidentialBundleData"].Outputs.Pack(bundleBytes) txnResult, err := mevShareContract.SendTransaction("newTransaction", []interface{}{targetBlock + 1, allowedPeekers, []common.Address{}}, confidentialDataBytes) if err != nil { @@ -163,7 +163,7 @@ func main() { } backRunBundleBytes, _ := json.Marshal(backRunBundle) - confidentialDataMatchBytes, _ := bundleBidContract.Abi.Methods["fetchConfidentialBundleData"].Outputs.Pack(backRunBundleBytes) + confidentialDataMatchBytes, _ := bundleContract.Abi.Methods["fetchConfidentialBundleData"].Outputs.Pack(backRunBundleBytes) // backrun inputs targetBlock := uint64(1) @@ -282,7 +282,7 @@ type DataRecordEvent struct { } func (b *DataRecordEvent) Unpack(log *types.Log) error { - unpacked, err := bundleBidContract.Abi.Events["DataRecordEvent"].Inputs.Unpack(log.Data) + unpacked, err := bundleContract.Abi.Events["DataRecordEvent"].Inputs.Unpack(log.Data) if err != nil { return err } diff --git a/suave/e2e/contracts.go b/suave/e2e/contracts.go index bac5eca14..ddb59bbad 100644 --- a/suave/e2e/contracts.go +++ b/suave/e2e/contracts.go @@ -12,8 +12,8 @@ import ( ) var ( - MevShareBidContract = newArtifact("bids.sol/MevShareContract.json") - BundleBidContract = newArtifact("bids.sol/BundleContract.json") + MevShareContract = newArtifact("bids.sol/MevShareContract.json") + BundleContract = newArtifact("bids.sol/BundleContract.json") EthBundleSenderContract = newArtifact("bids.sol/EthBundleSenderContract.json") MevShareBundleSenderContract = newArtifact("bids.sol/MevShareBundleSenderContract.json") buildEthBlockContract = newArtifact("bids.sol/EthBlockContract.json") diff --git a/suave/sol/scripts/forge_example.sol b/suave/sol/scripts/forge_example.sol index e27e2a744..24a7f62d2 100644 --- a/suave/sol/scripts/forge_example.sol +++ b/suave/sol/scripts/forge_example.sol @@ -10,8 +10,8 @@ contract Example is Script { function run() public { Suave.DataRecord memory record = SuaveForge.newDataRecord(0, addressList, addressList, "default:v0:ethBundles"); - Suave.DataRecord[] memory allShareMatchBids = SuaveForge.fetchDataRecords(0, "default:v0:ethBundles"); - console.log(allShareMatchBids.length); + Suave.DataRecord[] memory allShareMatchRecords = SuaveForge.fetchDataRecords(0, "default:v0:ethBundles"); + console.log(allShareMatchRecords.length); SuaveForge.confidentialStore(record.id, "a", abi.encodePacked("bbbbbb")); bytes memory result = SuaveForge.confidentialRetrieve(record.id, "a"); From acfac1138dff01b148d93aeae13a86709b6372d7 Mon Sep 17 00:00:00 2001 From: andytudhope <13001517+andytudhope@users.noreply.github.com> Date: Fri, 22 Dec 2023 10:24:46 +0200 Subject: [PATCH 2/3] renames SubmitEthBlockBidToRelay to SubmitEthBlockToRelay --- core/vm/contracts_suave_eth.go | 4 +- core/vm/contracts_suave_runtime_adapter.go | 20 ++++----- .../contracts_suave_runtime_adapter_test.go | 2 +- core/vm/contracts_suave_test.go | 8 ++-- suave/artifacts/SuaveLib.json | 2 +- suave/artifacts/addresses.go | 8 ++-- suave/e2e/redis_transport_test.go | 6 +-- suave/e2e/workflow_test.go | 44 +++++++++---------- suave/gen/suave_spec.yaml | 2 +- suave/sol/libraries/Suave.sol | 8 ++-- suave/sol/libraries/SuaveForge.sol | 4 +- suave/sol/standard_peekers/bids.sol | 2 +- 12 files changed, 55 insertions(+), 55 deletions(-) diff --git a/core/vm/contracts_suave_eth.go b/core/vm/contracts_suave_eth.go index bfca64caf..5c95ee36b 100644 --- a/core/vm/contracts_suave_eth.go +++ b/core/vm/contracts_suave_eth.go @@ -277,13 +277,13 @@ func (b *suaveRuntime) buildEthBlock(blockArgs types.BuildBlockArgs, dataID type return bidBytes, envelopeBytes, nil } -func (b *suaveRuntime) submitEthBlockBidToRelay(relayUrl string, builderBidJson []byte) ([]byte, error) { +func (b *suaveRuntime) submitEthBlockToRelay(relayUrl string, builderDataRecordJson []byte) ([]byte, error) { endpoint := relayUrl + "/relay/v1/builder/blocks" httpReq := types.HttpRequest{ Method: http.MethodPost, Url: endpoint, - Body: builderBidJson, + Body: builderDataRecordJson, Headers: []string{ "Content-Type:application/json", "Accept:application/json", diff --git a/core/vm/contracts_suave_runtime_adapter.go b/core/vm/contracts_suave_runtime_adapter.go index d42579bc7..658b43441 100644 --- a/core/vm/contracts_suave_runtime_adapter.go +++ b/core/vm/contracts_suave_runtime_adapter.go @@ -30,7 +30,7 @@ type SuaveRuntime interface { signEthTransaction(txn []byte, chainId string, signingKey string) ([]byte, error) simulateBundle(bundleData []byte) (uint64, error) submitBundleJsonRPC(url string, method string, params []byte) ([]byte, error) - submitEthBlockBidToRelay(relayUrl string, builderBid []byte) ([]byte, error) + submitEthBlockToRelay(relayUrl string, builderBid []byte) ([]byte, error) } var ( @@ -47,11 +47,11 @@ var ( signEthTransactionAddr = common.HexToAddress("0x0000000000000000000000000000000040100001") simulateBundleAddr = common.HexToAddress("0x0000000000000000000000000000000042100000") submitBundleJsonRPCAddr = common.HexToAddress("0x0000000000000000000000000000000043000001") - submitEthBlockBidToRelayAddr = common.HexToAddress("0x0000000000000000000000000000000042100002") + submitEthBlockToRelayAddr = common.HexToAddress("0x0000000000000000000000000000000042100002") ) var addrList = []common.Address{ - buildEthBlockAddr, confidentialInputsAddr, confidentialRetrieveAddr, confidentialStoreAddr, doHTTPRequestAddr, ethcallAddr, extractHintAddr, fetchDataRecordsAddr, fillMevShareBundleAddr, newDataRecordAddr, signEthTransactionAddr, simulateBundleAddr, submitBundleJsonRPCAddr, submitEthBlockBidToRelayAddr, + buildEthBlockAddr, confidentialInputsAddr, confidentialRetrieveAddr, confidentialStoreAddr, doHTTPRequestAddr, ethcallAddr, extractHintAddr, fetchDataRecordsAddr, fillMevShareBundleAddr, newDataRecordAddr, signEthTransactionAddr, simulateBundleAddr, submitBundleJsonRPCAddr, submitEthBlockToRelayAddr, } type SuaveRuntimeAdapter struct { @@ -99,8 +99,8 @@ func (b *SuaveRuntimeAdapter) run(addr common.Address, input []byte) ([]byte, er case submitBundleJsonRPCAddr: return b.submitBundleJsonRPC(input) - case submitEthBlockBidToRelayAddr: - return b.submitEthBlockBidToRelay(input) + case submitEthBlockToRelayAddr: + return b.submitEthBlockToRelay(input) default: return nil, fmt.Errorf("suave precompile not found for " + addr.String()) @@ -621,7 +621,7 @@ func (b *SuaveRuntimeAdapter) submitBundleJsonRPC(input []byte) (res []byte, err } -func (b *SuaveRuntimeAdapter) submitEthBlockBidToRelay(input []byte) (res []byte, err error) { +func (b *SuaveRuntimeAdapter) submitEthBlockToRelay(input []byte) (res []byte, err error) { var ( unpacked []interface{} result []byte @@ -630,7 +630,7 @@ func (b *SuaveRuntimeAdapter) submitEthBlockBidToRelay(input []byte) (res []byte _ = unpacked _ = result - unpacked, err = artifacts.SuaveAbi.Methods["submitEthBlockBidToRelay"].Inputs.Unpack(input) + unpacked, err = artifacts.SuaveAbi.Methods["submitEthBlockToRelay"].Inputs.Unpack(input) if err != nil { err = errFailedToUnpackInput return @@ -638,17 +638,17 @@ func (b *SuaveRuntimeAdapter) submitEthBlockBidToRelay(input []byte) (res []byte var ( relayUrl string - builderBid []byte + builderDataRecord []byte ) relayUrl = unpacked[0].(string) - builderBid = unpacked[1].([]byte) + builderDataRecord = unpacked[1].([]byte) var ( output1 []byte ) - if output1, err = b.impl.submitEthBlockBidToRelay(relayUrl, builderBid); err != nil { + if output1, err = b.impl.submitEthBlockToRelay(relayUrl, builderDataRecord); err != nil { return } diff --git a/core/vm/contracts_suave_runtime_adapter_test.go b/core/vm/contracts_suave_runtime_adapter_test.go index cc131f403..0f0a8b26c 100644 --- a/core/vm/contracts_suave_runtime_adapter_test.go +++ b/core/vm/contracts_suave_runtime_adapter_test.go @@ -63,7 +63,7 @@ func (m *mockRuntime) submitBundleJsonRPC(url string, method string, params []by return []byte{0x1}, nil } -func (m *mockRuntime) submitEthBlockBidToRelay(relayUrl string, builderBid []byte) ([]byte, error) { +func (m *mockRuntime) submitEthBlockToRelay(relayUrl string, builderDataRecord []byte) ([]byte, error) { return []byte{0x1}, nil } diff --git a/core/vm/contracts_suave_test.go b/core/vm/contracts_suave_test.go index 6bc50ca33..eb02ccb0d 100644 --- a/core/vm/contracts_suave_test.go +++ b/core/vm/contracts_suave_test.go @@ -36,15 +36,15 @@ func (m *mockSuaveBackend) SubmitBid(types.DataRecord) error { return nil } -func (m *mockSuaveBackend) FetchEngineBidById(suave.DataId) (suave.DataRecord, error) { +func (m *mockSuaveBackend) FetchEngineDataRecordById(suave.DataId) (suave.DataRecord, error) { return suave.DataRecord{}, nil } -func (m *mockSuaveBackend) FetchBidById(suave.DataId) (suave.DataRecord, error) { +func (m *mockSuaveBackend) FetchDataRecordById(suave.DataId) (suave.DataRecord, error) { return suave.DataRecord{}, nil } -func (m *mockSuaveBackend) FetchBidsByProtocolAndBlock(blockNumber uint64, namespace string) []suave.DataRecord { +func (m *mockSuaveBackend) FetchDataRecordsByProtocolAndBlock(blockNumber uint64, namespace string) []suave.DataRecord { return nil } @@ -91,7 +91,7 @@ func newTestBackend(t *testing.T) *suaveRuntime { return b } -func TestSuave_BidWorkflow(t *testing.T) { +func TestSuave_DataRecordWorkflow(t *testing.T) { b := newTestBackend(t) d5, err := b.newDataRecord(5, []common.Address{{0x1}}, nil, "a") diff --git a/suave/artifacts/SuaveLib.json b/suave/artifacts/SuaveLib.json index 0621c8e46..8c2e3b579 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":"dataId","type":"bytes16","internalType":"struct Suave.DataId"},{"name":"namespace","type":"string","internalType":"string"}],"outputs":[{"name":"output1","type":"bytes","internalType":"bytes"},{"name":"output2","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"confidentialInputs","outputs":[{"name":"output1","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":"output1","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"confidentialStore","inputs":[{"name":"dataId","type":"bytes16","internalType":"struct Suave.DataId"},{"name":"key","type":"string","internalType":"string"},{"name":"data1","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"}]}],"outputs":[{"name":"response","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"ethcall","inputs":[{"name":"contractAddr","type":"address","internalType":"address"},{"name":"input1","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"output1","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"extractHint","inputs":[{"name":"bundleData","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"output1","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":"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":"signEthTransaction","inputs":[{"name":"txn","type":"bytes","internalType":"bytes"},{"name":"chainId","type":"string","internalType":"string"},{"name":"signingKey","type":"string","internalType":"string"}],"outputs":[{"name":"output1","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"simulateBundle","inputs":[{"name":"bundleData","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"output1","type":"uint64","internalType":"uint64"}]},{"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":"output1","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"submitEthBlockBidToRelay","inputs":[{"name":"relayUrl","type":"string","internalType":"string"},{"name":"builderBid","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"output1","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":"dataId","type":"bytes16","internalType":"struct Suave.DataId"},{"name":"namespace","type":"string","internalType":"string"}],"outputs":[{"name":"output1","type":"bytes","internalType":"bytes"},{"name":"output2","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"confidentialInputs","outputs":[{"name":"output1","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":"output1","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"confidentialStore","inputs":[{"name":"dataId","type":"bytes16","internalType":"struct Suave.DataId"},{"name":"key","type":"string","internalType":"string"},{"name":"data1","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"}]}],"outputs":[{"name":"response","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"ethcall","inputs":[{"name":"contractAddr","type":"address","internalType":"address"},{"name":"input1","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"output1","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"extractHint","inputs":[{"name":"bundleData","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"output1","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":"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":"signEthTransaction","inputs":[{"name":"txn","type":"bytes","internalType":"bytes"},{"name":"chainId","type":"string","internalType":"string"},{"name":"signingKey","type":"string","internalType":"string"}],"outputs":[{"name":"output1","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"simulateBundle","inputs":[{"name":"bundleData","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"output1","type":"uint64","internalType":"uint64"}]},{"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":"output1","type":"bytes","internalType":"bytes"}]},{"type":"function","name":"submitEthBlockToRelay","inputs":[{"name":"relayUrl","type":"string","internalType":"string"},{"name":"builderBid","type":"bytes","internalType":"bytes"}],"outputs":[{"name":"output1","type":"bytes","internalType":"bytes"}]}] \ No newline at end of file diff --git a/suave/artifacts/addresses.go b/suave/artifacts/addresses.go index 64fb67580..28d9038e5 100644 --- a/suave/artifacts/addresses.go +++ b/suave/artifacts/addresses.go @@ -21,7 +21,7 @@ var ( signEthTransactionAddr = common.HexToAddress("0x0000000000000000000000000000000040100001") simulateBundleAddr = common.HexToAddress("0x0000000000000000000000000000000042100000") submitBundleJsonRPCAddr = common.HexToAddress("0x0000000000000000000000000000000043000001") - submitEthBlockBidToRelayAddr = common.HexToAddress("0x0000000000000000000000000000000042100002") + submitEthBlockToRelayAddr = common.HexToAddress("0x0000000000000000000000000000000042100002") ) var SuaveMethods = map[string]common.Address{ @@ -38,7 +38,7 @@ var SuaveMethods = map[string]common.Address{ "signEthTransaction": signEthTransactionAddr, "simulateBundle": simulateBundleAddr, "submitBundleJsonRPC": submitBundleJsonRPCAddr, - "submitEthBlockBidToRelay": submitEthBlockBidToRelayAddr, + "submitEthBlockToRelay": submitEthBlockToRelayAddr, } func PrecompileAddressToName(addr common.Address) string { @@ -69,8 +69,8 @@ func PrecompileAddressToName(addr common.Address) string { return "simulateBundle" case submitBundleJsonRPCAddr: return "submitBundleJsonRPC" - case submitEthBlockBidToRelayAddr: - return "submitEthBlockBidToRelay" + case submitEthBlockToRelayAddr: + return "submitEthBlockToRelay" } return "" } diff --git a/suave/e2e/redis_transport_test.go b/suave/e2e/redis_transport_test.go index fe114d680..a4137c60b 100644 --- a/suave/e2e/redis_transport_test.go +++ b/suave/e2e/redis_transport_test.go @@ -50,12 +50,12 @@ func TestRedisBackends(t *testing.T) { { // Send a bundle bid allowedPeekers := []common.Address{newBlockBidAddress, newBundleBidAddress, buildEthBlockAddress} - confidentialDataBytes, err := BundleBidContract.Abi.Methods["fetchConfidentialBundleData"].Outputs.Pack(bundleBytes) + confidentialDataBytes, err := BundleContract.Abi.Methods["fetchConfidentialBundleData"].Outputs.Pack(bundleBytes) require.NoError(t, err) - bundleBidContractI := sdk.GetContract(newBundleBidAddress, BundleBidContract.Abi, clt1) + BundleContractI := sdk.GetContract(newBundleBidAddress, BundleContract.Abi, clt1) - _, err = bundleBidContractI.SendTransaction("newBundle", []interface{}{targetBlock + 1, allowedPeekers, []common.Address{fr1.KettleAddress(), fr2.KettleAddress()}}, confidentialDataBytes) + _, err = BundleContractI.SendTransaction("newBundle", []interface{}{targetBlock + 1, allowedPeekers, []common.Address{fr1.KettleAddress(), fr2.KettleAddress()}}, confidentialDataBytes) requireNoRpcError(t, err) } diff --git a/suave/e2e/workflow_test.go b/suave/e2e/workflow_test.go index bf2b96d3b..717d3c545 100644 --- a/suave/e2e/workflow_test.go +++ b/suave/e2e/workflow_test.go @@ -296,11 +296,11 @@ func TestBundleBid(t *testing.T) { bundleBytes, err := json.Marshal(bundle) require.NoError(t, err) - confidentialDataBytes, err := BundleBidContract.Abi.Methods["fetchConfidentialBundleData"].Outputs.Pack(bundleBytes) + confidentialDataBytes, err := BundleContract.Abi.Methods["fetchConfidentialBundleData"].Outputs.Pack(bundleBytes) require.NoError(t, err) - bundleBidContractI := sdk.GetContract(newBundleBidAddress, BundleBidContract.Abi, clt) - _, err = bundleBidContractI.SendTransaction("newBundle", []interface{}{targetBlock, allowedPeekers, []common.Address{}}, confidentialDataBytes) + BundleContractI := sdk.GetContract(newBundleBidAddress, BundleContract.Abi, clt) + _, err = BundleContractI.SendTransaction("newBundle", []interface{}{targetBlock, allowedPeekers, []common.Address{}}, confidentialDataBytes) requireNoRpcError(t, err) block := fr.suethSrv.ProgressChain() @@ -312,7 +312,7 @@ func TestBundleBid(t *testing.T) { require.Equal(t, uint64(1), receipts[0].Status) require.Equal(t, 1, len(block.Transactions())) - unpacked, err := BundleBidContract.Abi.Methods["emitDataRecord"].Inputs.Unpack(block.Transactions()[0].Data()[4:]) + unpacked, err := BundleContract.Abi.Methods["emitDataRecord"].Inputs.Unpack(block.Transactions()[0].Data()[4:]) require.NoError(t, err) record := unpacked[0].(struct { Id [16]uint8 "json:\"id\"" @@ -328,7 +328,7 @@ func TestBundleBid(t *testing.T) { require.NotNil(t, receipts[0].Logs[0]) require.Equal(t, newBundleBidAddress, receipts[0].Logs[0].Address) - unpacked, err = BundleBidContract.Abi.Events["DataRecordEvent"].Inputs.Unpack(receipts[0].Logs[0].Data) + unpacked, err = BundleContract.Abi.Events["DataRecordEvent"].Inputs.Unpack(receipts[0].Logs[0].Data) require.NoError(t, err) require.Equal(t, record.Id, unpacked[0].([16]byte)) @@ -396,7 +396,7 @@ func TestBundleSenderContract(t *testing.T) { bundleBytes, err := json.Marshal(bundle) require.NoError(t, err) - confidentialDataBytes, err := BundleBidContract.Abi.Methods["fetchConfidentialBundleData"].Outputs.Pack(bundleBytes) + confidentialDataBytes, err := BundleContract.Abi.Methods["fetchConfidentialBundleData"].Outputs.Pack(bundleBytes) require.NoError(t, err) constructorArgs, err := EthBundleSenderContract.Abi.Constructor.Inputs.Pack([]string{fakeRelayServer.URL}) @@ -461,7 +461,7 @@ func prepareMevShareBundle(t *testing.T) (*types.Transaction, types.SBundle, []b bundleBytes, err := json.Marshal(bundle) require.NoError(t, err) - confidentialDataBytes, err := BundleBidContract.Abi.Methods["fetchConfidentialBundleData"].Outputs.Pack(bundleBytes) + confidentialDataBytes, err := BundleContract.Abi.Methods["fetchConfidentialBundleData"].Outputs.Pack(bundleBytes) require.NoError(t, err) return ethTx, *bundle, confidentialDataBytes @@ -485,7 +485,7 @@ func prepareMevShareBackrun(t *testing.T, shareBidId types.DataId) (*types.Trans backRunBundleBytes, err := json.Marshal(backRunBundle) require.NoError(t, err) - confidentialDataMatchBytes, err := BundleBidContract.Abi.Methods["fetchConfidentialBundleData"].Outputs.Pack(backRunBundleBytes) + confidentialDataMatchBytes, err := BundleContract.Abi.Methods["fetchConfidentialBundleData"].Outputs.Pack(backRunBundleBytes) require.NoError(t, err) return backrunTx, *backRunBundle, confidentialDataMatchBytes @@ -513,8 +513,8 @@ func TestMevShare(t *testing.T) { // Send a bundle record allowedPeekers := []common.Address{{0x41, 0x42, 0x43}, newBlockBidAddress, buildEthBlockAddress, mevShareAddress} - bundleBidContractI := sdk.GetContract(mevShareAddress, MevShareBidContract.Abi, clt) - _, err := bundleBidContractI.SendTransaction("newTransaction", []interface{}{targetBlock + 1, allowedPeekers, []common.Address{fr.KettleAddress()}}, confidentialDataBytes) + BundleContractI := sdk.GetContract(mevShareAddress, MevShareContract.Abi, clt) + _, err := BundleContractI.SendTransaction("newTransaction", []interface{}{targetBlock + 1, allowedPeekers, []common.Address{fr.KettleAddress()}}, confidentialDataBytes) requireNoRpcError(t, err) // 1a. confirm submission @@ -533,7 +533,7 @@ func TestMevShare(t *testing.T) { require.NotEmpty(t, r.Logs) // extract share DataId - unpacked, err := MevShareBidContract.Abi.Events["HintEvent"].Inputs.Unpack(r.Logs[1].Data) + unpacked, err := MevShareContract.Abi.Events["HintEvent"].Inputs.Unpack(r.Logs[1].Data) require.NoError(t, err) shareBidId := unpacked[0].([16]byte) @@ -541,7 +541,7 @@ func TestMevShare(t *testing.T) { backrunTx, _, confidentialDataMatchBytes := prepareMevShareBackrun(t, shareBidId) - cc := sdk.GetContract(mevShareAddress, MevShareBidContract.Abi, clt) + cc := sdk.GetContract(mevShareAddress, MevShareContract.Abi, clt) _, err = cc.SendTransaction("newMatch", []interface{}{targetBlock + 1, allowedPeekers, []common.Address{fr.KettleAddress()}, shareBidId}, confidentialDataMatchBytes) requireNoRpcError(t, err) @@ -585,7 +585,7 @@ func TestMevShare(t *testing.T) { require.Equal(t, 2, len(receipts[0].Logs)) require.NotNil(t, receipts[0].Logs[1]) - unpacked, err := BundleBidContract.Abi.Events["DataRecordEvent"].Inputs.Unpack(receipts[0].Logs[1].Data) + unpacked, err := BundleContract.Abi.Events["DataRecordEvent"].Inputs.Unpack(receipts[0].Logs[1].Data) require.NoError(t, err) bidId := unpacked[0].([16]byte) @@ -669,7 +669,7 @@ func TestMevShareBundleSenderContract(t *testing.T) { require.NotEmpty(t, receipt.Logs) // extract share DataId - unpacked, err := MevShareBidContract.Abi.Events["HintEvent"].Inputs.Unpack(receipt.Logs[1].Data) + unpacked, err := MevShareContract.Abi.Events["HintEvent"].Inputs.Unpack(receipt.Logs[1].Data) require.NoError(t, err) shareBidId := unpacked[0].([16]byte) @@ -843,12 +843,12 @@ func TestBlockBuildingContract(t *testing.T) { { // Send a bundle record allowedPeekers := []common.Address{newBlockBidAddress, newBundleBidAddress, buildEthBlockAddress} - confidentialDataBytes, err := BundleBidContract.Abi.Methods["fetchConfidentialBundleData"].Outputs.Pack(bundleBytes) + confidentialDataBytes, err := BundleContract.Abi.Methods["fetchConfidentialBundleData"].Outputs.Pack(bundleBytes) require.NoError(t, err) - bundleBidContractI := sdk.GetContract(newBundleBidAddress, BundleBidContract.Abi, clt) + BundleContractI := sdk.GetContract(newBundleBidAddress, BundleContract.Abi, clt) - _, err = bundleBidContractI.SendTransaction("newBundle", []interface{}{targetBlock + 1, allowedPeekers, []common.Address{}}, confidentialDataBytes) + _, err = BundleContractI.SendTransaction("newBundle", []interface{}{targetBlock + 1, allowedPeekers, []common.Address{}}, confidentialDataBytes) require.NoError(t, err) } @@ -963,11 +963,11 @@ func TestRelayBlockSubmissionContract(t *testing.T) { { // Send a bundle record allowedPeekers := []common.Address{ethBlockBidSenderAddr, newBundleBidAddress, buildEthBlockAddress} - confidentialDataBytes, err := BundleBidContract.Abi.Methods["fetchConfidentialBundleData"].Outputs.Pack(bundleBytes) + confidentialDataBytes, err := BundleContract.Abi.Methods["fetchConfidentialBundleData"].Outputs.Pack(bundleBytes) require.NoError(t, err) - bundleBidContractI := sdk.GetContract(newBundleBidAddress, BundleBidContract.Abi, clt) - _, err = bundleBidContractI.SendTransaction("newBundle", []interface{}{targetBlock + 1, allowedPeekers, []common.Address{}}, confidentialDataBytes) + BundleContractI := sdk.GetContract(newBundleBidAddress, BundleContract.Abi, clt) + _, err = BundleContractI.SendTransaction("newBundle", []interface{}{targetBlock + 1, allowedPeekers, []common.Address{}}, confidentialDataBytes) requireNoRpcError(t, err) } @@ -1407,9 +1407,9 @@ var ( Alloc: core.GenesisAlloc{ testAddr: {Balance: testBalance}, testAddr2: {Balance: testBalance}, - newBundleBidAddress: {Balance: big.NewInt(0), Code: BundleBidContract.DeployedCode}, + newBundleBidAddress: {Balance: big.NewInt(0), Code: BundleContract.DeployedCode}, newBlockBidAddress: {Balance: big.NewInt(0), Code: buildEthBlockContract.DeployedCode}, - mevShareAddress: {Balance: big.NewInt(0), Code: MevShareBidContract.DeployedCode}, + mevShareAddress: {Balance: big.NewInt(0), Code: MevShareContract.DeployedCode}, testAddr3: {Balance: big.NewInt(0), Code: exampleCallSourceContract.DeployedCode}, }, } diff --git a/suave/gen/suave_spec.yaml b/suave/gen/suave_spec.yaml index 0e8adde31..809308a56 100644 --- a/suave/gen/suave_spec.yaml +++ b/suave/gen/suave_spec.yaml @@ -159,7 +159,7 @@ functions: type: bytes - name: output2 type: bytes - - name: submitEthBlockBidToRelay + - name: submitEthBlockToRelay address: "0x0000000000000000000000000000000042100002" isConfidential: true input: diff --git a/suave/sol/libraries/Suave.sol b/suave/sol/libraries/Suave.sol index 884be1626..bf2019144 100644 --- a/suave/sol/libraries/Suave.sol +++ b/suave/sol/libraries/Suave.sol @@ -71,7 +71,7 @@ library Suave { address public constant SUBMIT_BUNDLE_JSON_RPC = 0x0000000000000000000000000000000043000001; - address public constant SUBMIT_ETH_BLOCK_BID_TO_RELAY = 0x0000000000000000000000000000000042100002; + address public constant SUBMIT_ETH_BLOCK_TO_RELAY = 0x0000000000000000000000000000000042100002; // Returns whether execution is off- or on-chain function isConfidential() internal view returns (bool b) { @@ -223,15 +223,15 @@ library Suave { return data; } - function submitEthBlockBidToRelay(string memory relayUrl, bytes memory builderBid) + function submitEthBlockToRelay(string memory relayUrl, bytes memory builderDataRecord) internal view returns (bytes memory) { require(isConfidential()); - (bool success, bytes memory data) = SUBMIT_ETH_BLOCK_BID_TO_RELAY.staticcall(abi.encode(relayUrl, builderBid)); + (bool success, bytes memory data) = SUBMIT_ETH_BLOCK_TO_RELAY.staticcall(abi.encode(relayUrl, builderDataRecord)); if (!success) { - revert PeekerReverted(SUBMIT_ETH_BLOCK_BID_TO_RELAY, data); + revert PeekerReverted(SUBMIT_ETH_BLOCK_TO_RELAY, data); } return data; diff --git a/suave/sol/libraries/SuaveForge.sol b/suave/sol/libraries/SuaveForge.sol index 5e0d14851..7a9f81bd8 100644 --- a/suave/sol/libraries/SuaveForge.sol +++ b/suave/sol/libraries/SuaveForge.sol @@ -133,12 +133,12 @@ library SuaveForge { return data; } - function submitEthBlockBidToRelay(string memory relayUrl, bytes memory builderBid) + function submitEthBlockToRelay(string memory relayUrl, bytes memory builderDataRecord) internal view returns (bytes memory) { - bytes memory data = forgeIt("0x0000000000000000000000000000000042100002", abi.encode(relayUrl, builderBid)); + bytes memory data = forgeIt("0x0000000000000000000000000000000042100002", abi.encode(relayUrl, builderDataRecord)); return data; } diff --git a/suave/sol/standard_peekers/bids.sol b/suave/sol/standard_peekers/bids.sol index 297f8dc6e..aff8a761c 100644 --- a/suave/sol/standard_peekers/bids.sol +++ b/suave/sol/standard_peekers/bids.sol @@ -358,7 +358,7 @@ contract EthBlockBidSenderContract is EthBlockContract { (Suave.DataRecord memory blockDataRecord, bytes memory builderBid) = this.doBuild(blockArgs, blockHeight, dataRecords, namespace); - Suave.submitEthBlockBidToRelay(boostRelayUrl, builderBid); + Suave.submitEthBlockToRelay(boostRelayUrl, builderBid); emit DataRecordEvent(blockDataRecord.id, blockDataRecord.decryptionCondition, blockDataRecord.allowedPeekers); return bytes.concat(this.emitDataRecord.selector, abi.encode(blockDataRecord)); From 5c19726a25afe9250d9bca01161993fc01784aaa Mon Sep 17 00:00:00 2001 From: andytudhope <13001517+andytudhope@users.noreply.github.com> Date: Fri, 22 Dec 2023 10:36:06 +0200 Subject: [PATCH 3/3] bids.sol -> bundles.sol + formatting --- suave/e2e/contracts.go | 12 ++++++------ suave/sol/libraries/Suave.sol | 3 ++- suave/sol/libraries/SuaveForge.sol | 3 ++- suave/sol/standard_peekers/{bids.sol => bundles.sol} | 0 4 files changed, 10 insertions(+), 8 deletions(-) rename suave/sol/standard_peekers/{bids.sol => bundles.sol} (100%) diff --git a/suave/e2e/contracts.go b/suave/e2e/contracts.go index ddb59bbad..5b3e2c82f 100644 --- a/suave/e2e/contracts.go +++ b/suave/e2e/contracts.go @@ -12,12 +12,12 @@ import ( ) var ( - MevShareContract = newArtifact("bids.sol/MevShareContract.json") - BundleContract = newArtifact("bids.sol/BundleContract.json") - EthBundleSenderContract = newArtifact("bids.sol/EthBundleSenderContract.json") - MevShareBundleSenderContract = newArtifact("bids.sol/MevShareBundleSenderContract.json") - buildEthBlockContract = newArtifact("bids.sol/EthBlockContract.json") - ethBlockBidSenderContract = newArtifact("bids.sol/EthBlockBidSenderContract.json") + MevShareContract = newArtifact("bundles.sol/MevShareContract.json") + BundleContract = newArtifact("bundles.sol/BundleContract.json") + EthBundleSenderContract = newArtifact("bundles.sol/EthBundleSenderContract.json") + MevShareBundleSenderContract = newArtifact("bundles.sol/MevShareBundleSenderContract.json") + buildEthBlockContract = newArtifact("bundles.sol/EthBlockContract.json") + ethBlockBidSenderContract = newArtifact("bundles.sol/EthBlockBidSenderContract.json") exampleCallSourceContract = newArtifact("example.sol/ExampleEthCallSource.json") exampleCallTargetContract = newArtifact("example.sol/ExampleEthCallTarget.json") ) diff --git a/suave/sol/libraries/Suave.sol b/suave/sol/libraries/Suave.sol index bf2019144..e77a50cc3 100644 --- a/suave/sol/libraries/Suave.sol +++ b/suave/sol/libraries/Suave.sol @@ -229,7 +229,8 @@ library Suave { returns (bytes memory) { require(isConfidential()); - (bool success, bytes memory data) = SUBMIT_ETH_BLOCK_TO_RELAY.staticcall(abi.encode(relayUrl, builderDataRecord)); + (bool success, bytes memory data) = + SUBMIT_ETH_BLOCK_TO_RELAY.staticcall(abi.encode(relayUrl, builderDataRecord)); if (!success) { revert PeekerReverted(SUBMIT_ETH_BLOCK_TO_RELAY, data); } diff --git a/suave/sol/libraries/SuaveForge.sol b/suave/sol/libraries/SuaveForge.sol index 7a9f81bd8..f0e45e9df 100644 --- a/suave/sol/libraries/SuaveForge.sol +++ b/suave/sol/libraries/SuaveForge.sol @@ -138,7 +138,8 @@ library SuaveForge { view returns (bytes memory) { - bytes memory data = forgeIt("0x0000000000000000000000000000000042100002", abi.encode(relayUrl, builderDataRecord)); + bytes memory data = + forgeIt("0x0000000000000000000000000000000042100002", abi.encode(relayUrl, builderDataRecord)); return data; } diff --git a/suave/sol/standard_peekers/bids.sol b/suave/sol/standard_peekers/bundles.sol similarity index 100% rename from suave/sol/standard_peekers/bids.sol rename to suave/sol/standard_peekers/bundles.sol