From bf9fc2df6de786b203e2f0a45e7e0e9bfad6fdb9 Mon Sep 17 00:00:00 2001 From: Andy Tudhope <13001517+andytudhope@users.noreply.github.com> Date: Fri, 22 Dec 2023 12:29:43 +0200 Subject: [PATCH] cherrypick and update libs --- core/types/suave_structs.go | 2 +- core/vm/contracts_suave_eth.go | 4 +- core/vm/contracts_suave_runtime_adapter.go | 49 +++++++------- .../contracts_suave_runtime_adapter_test.go | 2 +- core/vm/contracts_suave_test.go | 8 +-- suave/artifacts/SuaveLib.json | 3 +- suave/artifacts/addresses.go | 66 +++++++++---------- suave/devenv/cmd/main.go | 10 +-- suave/e2e/contracts.go | 12 ++-- 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 | 2 +- suave/sol/scripts/forge_example.sol | 4 +- .../{bids.sol => bundles.sol} | 2 +- 16 files changed, 112 insertions(+), 112 deletions(-) rename suave/sol/standard_peekers/{bids.sol => bundles.sol} (99%) diff --git a/core/types/suave_structs.go b/core/types/suave_structs.go index da44e1678..132f5ef81 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: a4c8719330a00a59e661145e1ae24df7280f9c526a37b5a3df1c52f67aa95b29 +// Hash: 1e4312debc072d2aa68e9aa2ddf7ef264f705d23d86a1aea0966c3751b36d318 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 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 2a7384fd9..5410a7f7a 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: a4c8719330a00a59e661145e1ae24df7280f9c526a37b5a3df1c52f67aa95b29 +// Hash: 1e4312debc072d2aa68e9aa2ddf7ef264f705d23d86a1aea0966c3751b36d318 package vm import ( @@ -31,31 +31,32 @@ type SuaveRuntime interface { signMessage(digest []byte, 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 ( - buildEthBlockAddr = common.HexToAddress("0x0000000000000000000000000000000042100001") - confidentialInputsAddr = common.HexToAddress("0x0000000000000000000000000000000042010001") - confidentialRetrieveAddr = common.HexToAddress("0x0000000000000000000000000000000042020001") - confidentialStoreAddr = common.HexToAddress("0x0000000000000000000000000000000042020000") - doHTTPRequestAddr = common.HexToAddress("0x0000000000000000000000000000000043200002") - ethcallAddr = common.HexToAddress("0x0000000000000000000000000000000042100003") - extractHintAddr = common.HexToAddress("0x0000000000000000000000000000000042100037") - fetchDataRecordsAddr = common.HexToAddress("0x0000000000000000000000000000000042030001") - fillMevShareBundleAddr = common.HexToAddress("0x0000000000000000000000000000000043200001") - newDataRecordAddr = common.HexToAddress("0x0000000000000000000000000000000042030000") - signEthTransactionAddr = common.HexToAddress("0x0000000000000000000000000000000040100001") - signMessageAddr = common.HexToAddress("0x0000000000000000000000000000000040100003") - simulateBundleAddr = common.HexToAddress("0x0000000000000000000000000000000042100000") - submitBundleJsonRPCAddr = common.HexToAddress("0x0000000000000000000000000000000043000001") - submitEthBlockBidToRelayAddr = common.HexToAddress("0x0000000000000000000000000000000042100002") + buildEthBlockAddr = common.HexToAddress("0x0000000000000000000000000000000042100001") + confidentialInputsAddr = common.HexToAddress("0x0000000000000000000000000000000042010001") + confidentialRetrieveAddr = common.HexToAddress("0x0000000000000000000000000000000042020001") + confidentialStoreAddr = common.HexToAddress("0x0000000000000000000000000000000042020000") + doHTTPRequestAddr = common.HexToAddress("0x0000000000000000000000000000000043200002") + ethcallAddr = common.HexToAddress("0x0000000000000000000000000000000042100003") + extractHintAddr = common.HexToAddress("0x0000000000000000000000000000000042100037") + fetchDataRecordsAddr = common.HexToAddress("0x0000000000000000000000000000000042030001") + fillMevShareBundleAddr = common.HexToAddress("0x0000000000000000000000000000000043200001") + newDataRecordAddr = common.HexToAddress("0x0000000000000000000000000000000042030000") + signEthTransactionAddr = common.HexToAddress("0x0000000000000000000000000000000040100001") + signMessageAddr = common.HexToAddress("0x0000000000000000000000000000000040100003") + simulateBundleAddr = common.HexToAddress("0x0000000000000000000000000000000042100000") + submitBundleJsonRPCAddr = common.HexToAddress("0x0000000000000000000000000000000043000001") + submitEthBlockToRelayAddr = common.HexToAddress("0x0000000000000000000000000000000042100002") ) var addrList = []common.Address{ - buildEthBlockAddr, confidentialInputsAddr, confidentialRetrieveAddr, confidentialStoreAddr, doHTTPRequestAddr, ethcallAddr, extractHintAddr, fetchDataRecordsAddr, fillMevShareBundleAddr, newDataRecordAddr, signEthTransactionAddr, signMessageAddr, simulateBundleAddr, submitBundleJsonRPCAddr, submitEthBlockBidToRelayAddr, + buildEthBlockAddr, confidentialInputsAddr, confidentialRetrieveAddr, confidentialStoreAddr, doHTTPRequestAddr, ethcallAddr, extractHintAddr, fetchDataRecordsAddr, fillMevShareBundleAddr, newDataRecordAddr, signEthTransactionAddr, signMessageAddr, simulateBundleAddr, submitBundleJsonRPCAddr, submitEthBlockToRelayAddr, } - type SuaveRuntimeAdapter struct { + +type SuaveRuntimeAdapter struct { impl SuaveRuntime } @@ -103,8 +104,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()) @@ -665,7 +666,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 @@ -674,7 +675,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 @@ -692,7 +693,7 @@ func (b *SuaveRuntimeAdapter) submitEthBlockBidToRelay(input []byte) (res []byte output1 []byte ) - if output1, err = b.impl.submitEthBlockBidToRelay(relayUrl, builderBid); err != nil { + if output1, err = b.impl.submitEthBlockToRelay(relayUrl, builderBid); err != nil { return } diff --git a/core/vm/contracts_suave_runtime_adapter_test.go b/core/vm/contracts_suave_runtime_adapter_test.go index 042eca1b3..a166e176c 100644 --- a/core/vm/contracts_suave_runtime_adapter_test.go +++ b/core/vm/contracts_suave_runtime_adapter_test.go @@ -67,7 +67,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 891f8591a..853935c32 100644 --- a/suave/artifacts/SuaveLib.json +++ b/suave/artifacts/SuaveLib.json @@ -1,2 +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":"signMessage","inputs":[{"name":"digest","type":"bytes","internalType":"bytes"},{"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"}]}] - +[{"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":"signMessage","inputs":[{"name":"digest","type":"bytes","internalType":"bytes"},{"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 5908e9e03..409170744 100644 --- a/suave/artifacts/addresses.go +++ b/suave/artifacts/addresses.go @@ -1,5 +1,5 @@ // Code generated by suave/gen. DO NOT EDIT. -// Hash: a4c8719330a00a59e661145e1ae24df7280f9c526a37b5a3df1c52f67aa95b29 +// Hash: 1e4312debc072d2aa68e9aa2ddf7ef264f705d23d86a1aea0966c3751b36d318 package artifacts import ( @@ -8,39 +8,39 @@ import ( // List of suave precompile addresses var ( - buildEthBlockAddr = common.HexToAddress("0x0000000000000000000000000000000042100001") - confidentialInputsAddr = common.HexToAddress("0x0000000000000000000000000000000042010001") - confidentialRetrieveAddr = common.HexToAddress("0x0000000000000000000000000000000042020001") - confidentialStoreAddr = common.HexToAddress("0x0000000000000000000000000000000042020000") - doHTTPRequestAddr = common.HexToAddress("0x0000000000000000000000000000000043200002") - ethcallAddr = common.HexToAddress("0x0000000000000000000000000000000042100003") - extractHintAddr = common.HexToAddress("0x0000000000000000000000000000000042100037") - fetchDataRecordsAddr = common.HexToAddress("0x0000000000000000000000000000000042030001") - fillMevShareBundleAddr = common.HexToAddress("0x0000000000000000000000000000000043200001") - newDataRecordAddr = common.HexToAddress("0x0000000000000000000000000000000042030000") - signEthTransactionAddr = common.HexToAddress("0x0000000000000000000000000000000040100001") - signMessageAddr = common.HexToAddress("0x0000000000000000000000000000000040100003") - simulateBundleAddr = common.HexToAddress("0x0000000000000000000000000000000042100000") - submitBundleJsonRPCAddr = common.HexToAddress("0x0000000000000000000000000000000043000001") - submitEthBlockBidToRelayAddr = common.HexToAddress("0x0000000000000000000000000000000042100002") + buildEthBlockAddr = common.HexToAddress("0x0000000000000000000000000000000042100001") + confidentialInputsAddr = common.HexToAddress("0x0000000000000000000000000000000042010001") + confidentialRetrieveAddr = common.HexToAddress("0x0000000000000000000000000000000042020001") + confidentialStoreAddr = common.HexToAddress("0x0000000000000000000000000000000042020000") + doHTTPRequestAddr = common.HexToAddress("0x0000000000000000000000000000000043200002") + ethcallAddr = common.HexToAddress("0x0000000000000000000000000000000042100003") + extractHintAddr = common.HexToAddress("0x0000000000000000000000000000000042100037") + fetchDataRecordsAddr = common.HexToAddress("0x0000000000000000000000000000000042030001") + fillMevShareBundleAddr = common.HexToAddress("0x0000000000000000000000000000000043200001") + newDataRecordAddr = common.HexToAddress("0x0000000000000000000000000000000042030000") + signEthTransactionAddr = common.HexToAddress("0x0000000000000000000000000000000040100001") + signMessageAddr = common.HexToAddress("0x0000000000000000000000000000000040100003") + simulateBundleAddr = common.HexToAddress("0x0000000000000000000000000000000042100000") + submitBundleJsonRPCAddr = common.HexToAddress("0x0000000000000000000000000000000043000001") + submitEthBlockToRelayAddr = common.HexToAddress("0x0000000000000000000000000000000042100002") ) var SuaveMethods = map[string]common.Address{ - "buildEthBlock": buildEthBlockAddr, - "confidentialInputs": confidentialInputsAddr, - "confidentialRetrieve": confidentialRetrieveAddr, - "confidentialStore": confidentialStoreAddr, - "doHTTPRequest": doHTTPRequestAddr, - "ethcall": ethcallAddr, - "extractHint": extractHintAddr, - "fetchDataRecords": fetchDataRecordsAddr, - "fillMevShareBundle": fillMevShareBundleAddr, - "newDataRecord": newDataRecordAddr, - "signEthTransaction": signEthTransactionAddr, - "signMessage": signMessageAddr, - "simulateBundle": simulateBundleAddr, - "submitBundleJsonRPC": submitBundleJsonRPCAddr, - "submitEthBlockBidToRelay": submitEthBlockBidToRelayAddr, + "buildEthBlock": buildEthBlockAddr, + "confidentialInputs": confidentialInputsAddr, + "confidentialRetrieve": confidentialRetrieveAddr, + "confidentialStore": confidentialStoreAddr, + "doHTTPRequest": doHTTPRequestAddr, + "ethcall": ethcallAddr, + "extractHint": extractHintAddr, + "fetchDataRecords": fetchDataRecordsAddr, + "fillMevShareBundle": fillMevShareBundleAddr, + "newDataRecord": newDataRecordAddr, + "signEthTransaction": signEthTransactionAddr, + "signMessage": signMessageAddr, + "simulateBundle": simulateBundleAddr, + "submitBundleJsonRPC": submitBundleJsonRPCAddr, + "submitEthBlockToRelay": submitEthBlockToRelayAddr, } func PrecompileAddressToName(addr common.Address) string { @@ -73,8 +73,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/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..5b3e2c82f 100644 --- a/suave/e2e/contracts.go +++ b/suave/e2e/contracts.go @@ -12,12 +12,12 @@ import ( ) var ( - MevShareBidContract = newArtifact("bids.sol/MevShareContract.json") - BundleBidContract = 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/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 ef982f520..74aa90101 100644 --- a/suave/e2e/workflow_test.go +++ b/suave/e2e/workflow_test.go @@ -335,11 +335,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() @@ -351,7 +351,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\"" @@ -367,7 +367,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)) @@ -435,7 +435,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}) @@ -500,7 +500,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 @@ -524,7 +524,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 @@ -552,8 +552,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 @@ -572,7 +572,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) @@ -580,7 +580,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) @@ -624,7 +624,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) @@ -708,7 +708,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) @@ -882,12 +882,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) } @@ -1002,11 +1002,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) } @@ -1447,9 +1447,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 314fc9bee..623abdd85 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 8ef747e33..f155bbc88 100644 --- a/suave/sol/libraries/Suave.sol +++ b/suave/sol/libraries/Suave.sol @@ -73,7 +73,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) { @@ -235,15 +235,15 @@ library Suave { return data; } - function submitEthBlockBidToRelay(string memory relayUrl, bytes memory builderBid) + function submitEthBlockToRelay(string memory relayUrl, bytes memory builderBid) 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, builderBid)); 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 c7a631051..4f8602649 100644 --- a/suave/sol/libraries/SuaveForge.sol +++ b/suave/sol/libraries/SuaveForge.sol @@ -139,7 +139,7 @@ library SuaveForge { return data; } - function submitEthBlockBidToRelay(string memory relayUrl, bytes memory builderBid) + function submitEthBlockToRelay(string memory relayUrl, bytes memory builderBid) internal view returns (bytes memory) 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"); diff --git a/suave/sol/standard_peekers/bids.sol b/suave/sol/standard_peekers/bundles.sol similarity index 99% rename from suave/sol/standard_peekers/bids.sol rename to suave/sol/standard_peekers/bundles.sol index 297f8dc6e..aff8a761c 100644 --- a/suave/sol/standard_peekers/bids.sol +++ b/suave/sol/standard_peekers/bundles.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));