diff --git a/README.md b/README.md index 86e0a726f5..cdb31cbdaa 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ Let’s take a look at how you can request confidential computation through an e ```go allowedPeekers := []common.Address{newBlockBidPeeker, newBundleBidPeeker, buildEthBlockPeeker} // express which contracts should have access to your data (by their addresses) confidentialComputeRecord := &types.ConfidentialComputeRecord{ - ExecutionNode: "0x4E2B0c0e428AE1CDE26d5BcF17Ba83f447068E5B", + KettleAddress: "0x4E2B0c0e428AE1CDE26d5BcF17Ba83f447068E5B", Nonce: suaveAccNonce, To: &newBundleBidAddress, Value: nil, @@ -189,7 +189,7 @@ We introduce a few new transaction types. ```go type ConfidentialComputeRecord struct { - ExecutionNode common.Address + KettleAddress common.Address ConfidentialInputsHash common.Hash // LegacyTx fields @@ -217,11 +217,11 @@ We introduce a few new transaction types. * `SuaveTransaction` - A specialized transaction type that encapsulates the result of a confidential computation request. It includes the `ConfidentialComputeRequest`, signed by the user, which ensures that the result comes from the expected computor, as the `SuaveTransaction`'s signer must match the `ExecutionNode`. + A specialized transaction type that encapsulates the result of a confidential computation request. It includes the `ConfidentialComputeRequest`, signed by the user, which ensures that the result comes from the expected computor, as the `SuaveTransaction`'s signer must match the `KettleAddress`. ```go type SuaveTransaction struct { - ExecutionNode common.Address + KettleAddress common.Address ConfidentialComputeRequest ConfidentialComputeRecord ConfidentialComputeResult []byte /* Execution node's signature fields */ @@ -374,8 +374,8 @@ The mempool operates on the underlying Confidential Store, thereby maintaining t ### Changes to RPC methods -1. New `IsConfidential` and `ExecutionNode` fields are added to TransactionArgs, used in `eth_sendTransaction` and `eth_call` methods. -If `IsConfidential` is set to true, the call will be performed as a confidential call, using the `ExecutionNode` passed in for constructing `ConfidentialComputeRequest`. +1. New `IsConfidential` and `KettleAddress` fields are added to TransactionArgs, used in `eth_sendTransaction` and `eth_call` methods. +If `IsConfidential` is set to true, the call will be performed as a confidential call, using the `KettleAddress` passed in for constructing `ConfidentialComputeRequest`. `SuaveTransaction` is the result of `eth_sendTransaction`! 2. New optional argument - `confidential_data` is added to `eth_sendRawTransaction`, `eth_sendTransaction` and `eth_call` methods. diff --git a/core/types/confidential.go b/core/types/confidential.go index 1f38945d5e..b88d674972 100644 --- a/core/types/confidential.go +++ b/core/types/confidential.go @@ -14,7 +14,7 @@ type ConfidentialComputeRecord struct { Value *big.Int Data []byte - ExecutionNode common.Address + KettleAddress common.Address ConfidentialInputsHash common.Hash ChainID *big.Int @@ -28,7 +28,7 @@ func (tx *ConfidentialComputeRecord) copy() TxData { To: copyAddressPtr(tx.To), Data: common.CopyBytes(tx.Data), Gas: tx.Gas, - ExecutionNode: tx.ExecutionNode, + KettleAddress: tx.KettleAddress, ConfidentialInputsHash: tx.ConfidentialInputsHash, Value: new(big.Int), @@ -132,11 +132,11 @@ func (tx *ConfidentialComputeRequest) setSignatureValues(chainID, v, r, s *big.I } type SuaveTransaction struct { - ExecutionNode common.Address `json:"executionNode" gencodec:"required"` + KettleAddress common.Address `json:"kettleAddress" gencodec:"required"` ConfidentialComputeRequest ConfidentialComputeRecord `json:"confidentialComputeRequest" gencodec:"required"` ConfidentialComputeResult []byte `json:"confidentialComputeResult" gencodec:"required"` - // ExecutionNode's signature + // KettleAddress's signature ChainID *big.Int V *big.Int R *big.Int @@ -146,7 +146,7 @@ type SuaveTransaction struct { // copy creates a deep copy of the transaction data and initializes all fields. func (tx *SuaveTransaction) copy() TxData { cpy := &SuaveTransaction{ - ExecutionNode: tx.ExecutionNode, + KettleAddress: tx.KettleAddress, ConfidentialComputeRequest: tx.ConfidentialComputeRequest, ConfidentialComputeResult: common.CopyBytes(tx.ConfidentialComputeResult), ChainID: new(big.Int), diff --git a/core/types/confidential_test.go b/core/types/confidential_test.go index b756e9f257..59f8ecbff7 100644 --- a/core/types/confidential_test.go +++ b/core/types/confidential_test.go @@ -15,7 +15,7 @@ func TestCCRequestToRecord(t *testing.T) { signer := NewSuaveSigner(new(big.Int)) unsignedTx := NewTx(&ConfidentialComputeRequest{ ConfidentialComputeRecord: ConfidentialComputeRecord{ - ExecutionNode: crypto.PubkeyToAddress(testKey.PublicKey), + KettleAddress: crypto.PubkeyToAddress(testKey.PublicKey), }, ConfidentialInputs: []byte{0x46}, }) @@ -80,7 +80,7 @@ func TestSuaveTx(t *testing.T) { signer := NewSuaveSigner(new(big.Int)) signedCCR, err := SignTx(NewTx(&ConfidentialComputeRecord{ - ExecutionNode: crypto.PubkeyToAddress(testKey.PublicKey), + KettleAddress: crypto.PubkeyToAddress(testKey.PublicKey), }), signer, testKey) require.NoError(t, err) @@ -88,7 +88,7 @@ func TestSuaveTx(t *testing.T) { require.True(t, ok) unsignedTx := NewTx(&SuaveTransaction{ - ExecutionNode: crypto.PubkeyToAddress(testKey.PublicKey), + KettleAddress: crypto.PubkeyToAddress(testKey.PublicKey), ConfidentialComputeRequest: *signedInnerCCR, }) signedTx, err := SignTx(unsignedTx, signer, testKey) diff --git a/core/types/transaction_marshalling.go b/core/types/transaction_marshalling.go index 20c41e697c..c21dfe4542 100644 --- a/core/types/transaction_marshalling.go +++ b/core/types/transaction_marshalling.go @@ -42,7 +42,7 @@ type txJSON struct { Input *hexutil.Bytes `json:"input"` AccessList *AccessList `json:"accessList,omitempty"` BlobVersionedHashes []common.Hash `json:"blobVersionedHashes,omitempty"` - ExecutionNode *common.Address `json:"executionNode,omitempty"` + KettleAddress *common.Address `json:"kettleAddress,omitempty"` ConfidentialInputsHash *common.Hash `json:"confidentialInputsHash,omitempty"` ConfidentialInputs *hexutil.Bytes `json:"confidentialInputs,omitempty"` Wrapped *json.RawMessage `json:"wrapped,omitempty"` @@ -119,7 +119,7 @@ func (tx *Transaction) MarshalJSON() ([]byte, error) { enc.S = (*hexutil.Big)(itx.S.ToBig()) case *ConfidentialComputeRecord: - enc.ExecutionNode = &itx.ExecutionNode + enc.KettleAddress = &itx.KettleAddress enc.ConfidentialInputsHash = &itx.ConfidentialInputsHash enc.Nonce = (*hexutil.Uint64)(&itx.Nonce) enc.To = tx.To() @@ -133,7 +133,7 @@ func (tx *Transaction) MarshalJSON() ([]byte, error) { enc.S = (*hexutil.Big)(itx.S) case *ConfidentialComputeRequest: - enc.ExecutionNode = &itx.ExecutionNode + enc.KettleAddress = &itx.KettleAddress enc.ConfidentialInputs = (*hexutil.Bytes)(&itx.ConfidentialInputs) enc.ConfidentialInputsHash = &itx.ConfidentialInputsHash enc.Nonce = (*hexutil.Uint64)(&itx.Nonce) @@ -148,7 +148,7 @@ func (tx *Transaction) MarshalJSON() ([]byte, error) { enc.S = (*hexutil.Big)(itx.S) case *SuaveTransaction: - enc.ExecutionNode = &itx.ExecutionNode + enc.KettleAddress = &itx.KettleAddress wrapped, err := NewTx(&itx.ConfidentialComputeRequest).MarshalJSON() if err != nil { @@ -401,10 +401,10 @@ func (tx *Transaction) UnmarshalJSON(input []byte) error { var itx ConfidentialComputeRequest inner = &itx - if dec.ExecutionNode == nil { - return errors.New("missing required field 'executionNode' in transaction") + if dec.KettleAddress == nil { + return errors.New("missing required field 'kettleAddress' in transaction") } - itx.ExecutionNode = *dec.ExecutionNode + itx.KettleAddress = *dec.KettleAddress if dec.ConfidentialInputsHash != nil { itx.ConfidentialInputsHash = *dec.ConfidentialInputsHash @@ -460,10 +460,10 @@ func (tx *Transaction) UnmarshalJSON(input []byte) error { var itx ConfidentialComputeRequest inner = &itx - if dec.ExecutionNode == nil { - return errors.New("missing required field 'executionNode' in transaction") + if dec.KettleAddress == nil { + return errors.New("missing required field 'kettleAddress' in transaction") } - itx.ExecutionNode = *dec.ExecutionNode + itx.KettleAddress = *dec.KettleAddress if dec.ConfidentialInputsHash != nil { itx.ConfidentialInputsHash = *dec.ConfidentialInputsHash @@ -523,11 +523,11 @@ func (tx *Transaction) UnmarshalJSON(input []byte) error { var itx SuaveTransaction inner = &itx - if dec.ExecutionNode == nil { - return errors.New("missing required field 'executionNode' in transaction") + if dec.KettleAddress == nil { + return errors.New("missing required field 'kettleAddress' in transaction") } - itx.ExecutionNode = *dec.ExecutionNode + itx.KettleAddress = *dec.KettleAddress if dec.Wrapped == nil { return errors.New("missing required field 'wrapped' in transaction") diff --git a/core/types/transaction_signing.go b/core/types/transaction_signing.go index 9386eed9c3..f0b7340b9b 100644 --- a/core/types/transaction_signing.go +++ b/core/types/transaction_signing.go @@ -285,8 +285,8 @@ func (s suaveSigner) Sender(tx *Transaction) (common.Address, error) { return common.Address{}, err } - if recovered != txdata.ExecutionNode { - return common.Address{}, fmt.Errorf("compute request %s signed by incorrect execution node %s, expected %s", tx.Hash().Hex(), recovered.Hex(), txdata.ExecutionNode.Hex()) + if recovered != txdata.KettleAddress { + return common.Address{}, fmt.Errorf("compute request %s signed by incorrect execution node %s, expected %s", tx.Hash().Hex(), recovered.Hex(), txdata.KettleAddress.Hex()) } case *ConfidentialComputeRequest: ccr = &txdata.ConfidentialComputeRecord @@ -354,7 +354,7 @@ func (s suaveSigner) Hash(tx *Transaction) common.Hash { return prefixedRlpHash( tx.Type(), []interface{}{ - txdata.ExecutionNode, + txdata.KettleAddress, s.Hash(NewTx(&txdata.ConfidentialComputeRequest)), txdata.ConfidentialComputeResult, }) @@ -362,7 +362,7 @@ func (s suaveSigner) Hash(tx *Transaction) common.Hash { return prefixedRlpHash( ConfidentialComputeRecordTxType, // Note: this is the same as the Record so that hashes match! []interface{}{ - txdata.ExecutionNode, + txdata.KettleAddress, txdata.ConfidentialInputsHash, tx.Nonce(), tx.GasPrice(), @@ -375,7 +375,7 @@ func (s suaveSigner) Hash(tx *Transaction) common.Hash { return prefixedRlpHash( tx.Type(), []interface{}{ - txdata.ExecutionNode, + txdata.KettleAddress, txdata.ConfidentialInputsHash, tx.Nonce(), tx.GasPrice(), diff --git a/core/vm/contracts_suave_test.go b/core/vm/contracts_suave_test.go index 6de2de3b2f..6bdbd4feae 100644 --- a/core/vm/contracts_suave_test.go +++ b/core/vm/contracts_suave_test.go @@ -86,7 +86,7 @@ func TestSuavePrecompileStub(t *testing.T) { reqTx := types.NewTx(&types.ConfidentialComputeRequest{ ConfidentialComputeRecord: types.ConfidentialComputeRecord{ - ExecutionNode: common.Address{}, + KettleAddress: common.Address{}, }, }) @@ -175,7 +175,7 @@ func newTestBackend(t *testing.T) *suaveRuntime { reqTx := types.NewTx(&types.ConfidentialComputeRequest{ ConfidentialComputeRecord: types.ConfidentialComputeRecord{ - ExecutionNode: common.Address{}, + KettleAddress: common.Address{}, }, }) diff --git a/internal/ethapi/api.go b/internal/ethapi/api.go index 44d6434592..2c50babc37 100644 --- a/internal/ethapi/api.go +++ b/internal/ethapi/api.go @@ -1023,9 +1023,9 @@ func DoCall(ctx context.Context, b Backend, args TransactionArgs, blockNrOrHash } if args.IsConfidential { - if args.ExecutionNode == nil { + if args.KettleAddress == nil { acc := b.AccountManager().Accounts()[0] - args.ExecutionNode = &acc + args.KettleAddress = &acc } tx := args.ToTransaction() @@ -1370,7 +1370,7 @@ type RPCTransaction struct { Type hexutil.Uint64 `json:"type"` Accesses *types.AccessList `json:"accessList,omitempty"` ChainID *hexutil.Big `json:"chainId,omitempty"` - ExecutionNode *common.Address `json:"executionNode,omitempty"` + KettleAddress *common.Address `json:"kettleAddress,omitempty"` ConfidentialInputsHash *common.Hash `json:"confidentialInputsHash,omitempty"` ConfidentialInputs *hexutil.Bytes `json:"confidentialInputs,omitempty"` RequestRecord *json.RawMessage `json:"requestRecord,omitempty"` @@ -1437,7 +1437,7 @@ func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber return nil } - result.ExecutionNode = &inner.ExecutionNode + result.KettleAddress = &inner.KettleAddress // if a legacy transaction has an EIP-155 chain id, include it explicitly if id := tx.ChainId(); id.Sign() != 0 { @@ -1452,7 +1452,7 @@ func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber return nil } - result.ExecutionNode = &inner.ExecutionNode + result.KettleAddress = &inner.KettleAddress // if a legacy transaction has an EIP-155 chain id, include it explicitly if id := tx.ChainId(); id.Sign() != 0 { @@ -1468,7 +1468,7 @@ func newRPCTransaction(tx *types.Transaction, blockHash common.Hash, blockNumber return nil } - result.ExecutionNode = &inner.ExecutionNode + result.KettleAddress = &inner.KettleAddress // TODO: should be rpc marshaled rrBytes, err := types.NewTx(&inner.ConfidentialComputeRequest).MarshalJSON() @@ -1956,7 +1956,7 @@ func runMEVM(ctx context.Context, b Backend, state *state.StateDB, header *types } // Look up the wallet containing the requested execution node - account := accounts.Account{Address: confidentialRequest.ExecutionNode} + account := accounts.Account{Address: confidentialRequest.KettleAddress} wallet, err := b.AccountManager().Find(account) if err != nil { return nil, nil, nil, err @@ -2005,7 +2005,7 @@ func runMEVM(ctx context.Context, b Backend, state *state.StateDB, header *types computeResult = result.ReturnData // Or should it be nil maybe in this case? } - suaveResultTxData := &types.SuaveTransaction{ExecutionNode: confidentialRequest.ExecutionNode, ConfidentialComputeRequest: confidentialRequest.ConfidentialComputeRecord, ConfidentialComputeResult: computeResult} + suaveResultTxData := &types.SuaveTransaction{KettleAddress: confidentialRequest.KettleAddress, ConfidentialComputeRequest: confidentialRequest.ConfidentialComputeRecord, ConfidentialComputeResult: computeResult} signed, err := wallet.SignTx(account, types.NewTx(suaveResultTxData), tx.ChainId()) if err != nil { @@ -2334,7 +2334,7 @@ func toHexSlice(b [][]byte) []string { return r } -// ExecutionAddress returns the execution addresseses available in the Kettle. -func (s *TransactionAPI) ExecutionAddress(ctx context.Context) ([]common.Address, error) { +// KettleAddress returns the execution addresseses available in the Kettle. +func (s *TransactionAPI) KettleAddress(ctx context.Context) ([]common.Address, error) { return s.b.AccountManager().Accounts(), nil } diff --git a/internal/ethapi/transaction_args.go b/internal/ethapi/transaction_args.go index ea2d7e455c..d7e35b2a27 100644 --- a/internal/ethapi/transaction_args.go +++ b/internal/ethapi/transaction_args.go @@ -43,7 +43,7 @@ type TransactionArgs struct { MaxPriorityFeePerGas *hexutil.Big `json:"maxPriorityFeePerGas"` Value *hexutil.Big `json:"value"` IsConfidential bool `json:"isConfidential"` - ExecutionNode *common.Address `json:"executionNode"` + KettleAddress *common.Address `json:"kettleAddress"` ConfidentialInputs *hexutil.Bytes `json:"confidentialInputs"` // TODO: testme ConfidentialResult *hexutil.Bytes `json:"confidentialResult"` // TODO: testme Nonce *hexutil.Uint64 `json:"nonce"` @@ -286,9 +286,9 @@ func (args *TransactionArgs) ToMessage(globalGasCap uint64, baseFee *big.Int) (* // toTransaction converts the arguments to a transaction. // This assumes that setDefaults has been called. func (args *TransactionArgs) toTransaction() *types.Transaction { - var executionNode common.Address - if args.IsConfidential && args.ExecutionNode != nil { - executionNode = *args.ExecutionNode + var kettleAddress common.Address + if args.IsConfidential && args.KettleAddress != nil { + kettleAddress = *args.KettleAddress } var data types.TxData @@ -338,12 +338,12 @@ func (args *TransactionArgs) toTransaction() *types.Transaction { } data = &types.SuaveTransaction{ - ExecutionNode: executionNode, + KettleAddress: kettleAddress, ChainID: (*big.Int)(args.ChainID), ConfidentialComputeRequest: ccr, ConfidentialComputeResult: confResult, } - case args.ExecutionNode != nil: + case args.KettleAddress != nil: var confidentialInputs []byte if args.ConfidentialInputs != nil { confidentialInputs = *args.ConfidentialInputs @@ -351,7 +351,7 @@ func (args *TransactionArgs) toTransaction() *types.Transaction { data = &types.ConfidentialComputeRequest{ ConfidentialComputeRecord: types.ConfidentialComputeRecord{ - ExecutionNode: executionNode, + KettleAddress: kettleAddress, // TODO: hashme To: args.To, Nonce: uint64(*args.Nonce), diff --git a/suave/cmd/suavecli/README.md b/suave/cmd/suavecli/README.md index 425d51a5e2..dc8300ac90 100644 --- a/suave/cmd/suavecli/README.md +++ b/suave/cmd/suavecli/README.md @@ -87,7 +87,7 @@ Ensure these details for the command line tool are on hand: - `suave_rpc` : address of suave rpc - `goerli_rpc` : address of goerli execution node rpc - `goerli_beacon_rpc` : address of goerli beacon rpc -- `ex_node_addr` : wallet address of execution node +- `kettleAddress` : wallet address of execution node - `privKeyHex` : private key as hex (for testing) - `relay_url` : address of boost relay that the contract will send blocks to @@ -185,7 +185,7 @@ Similar as above, `sendBlockSenderCreationTx` operates like any other contract d Once our contracts have been succesfully deployed we will craft a goerli bundle and send it to our newly deployed mev-share contract. ```go - mevShareTx, err := sendMevShareBidTx(suaveClient, goerliClient, suaveSigner, goerliSigner, 5, mevShareAddr, blockSenderAddr, executionNodeAddress, privKey) + mevShareTx, err := sendMevShareBidTx(suaveClient, goerliClient, suaveSigner, goerliSigner, 5, mevShareAddr, blockSenderAddr, kettleAddress, privKey) if err != nil { err = errors.Wrap(err, unwrapPeekerError(err).Error()) panic(err.Error()) @@ -252,7 +252,7 @@ func sendMevShareBidTx( } mevShareTx, err := types.SignTx(types.NewTx(&types.ConfidentialComputeRequestTx{ - ExecutionNode: executionNodeAddr, + KettleAddress: kettleAddress, Wrapped: *types.NewTx(wrappedTxData), }), suaveSigner, privKey) if err != nil { @@ -282,7 +282,7 @@ func sendMevShareBidTx( ``` -A SUAVE transaction, referred to as a mevshare bid in the code, takes in two extra arguments: `allowedPeekers` and `executionNodeAddr`. These arguement are to utilize a new transaction primitive `types.ConfidentialComputeRequest`, which you can read more about [here](https://github.com/flashbots/suave-geth/tree/suave-poc/suave#confidential-compute-requests). The role of `allowedPeekers` is to dictate which contracts can view the confidential data, in our scenario, the goerli bundle being submitted. Meanwhile, `executionNodeAddr` points to the intended execution node for the transaction. Lastly, Suave nodes have a modified `ethSendRawTransaction` to support this new transaction type. +A SUAVE transaction, referred to as a mevshare bid in the code, takes in two extra arguments: `allowedPeekers` and `kettleAddress`. These arguement are to utilize a new transaction primitive `types.ConfidentialComputeRequest`, which you can read more about [here](https://github.com/flashbots/suave-geth/tree/suave-poc/suave#confidential-compute-requests). The role of `allowedPeekers` is to dictate which contracts can view the confidential data, in our scenario, the goerli bundle being submitted. Meanwhile, `kettleAddress` points to the intended execution node for the transaction. Lastly, Suave nodes have a modified `ethSendRawTransaction` to support this new transaction type. ### 4. Send Mevshare Matches 🎯 @@ -302,7 +302,7 @@ Now that a MEV-share bid has been sent in we can simulate sending in a match. On mevShareTx.blockNumber, mevShareAddr, blockSenderAddr, - executionNodeAddress, + kettleAddress, bidIdBytes, privKey, ) @@ -318,7 +318,7 @@ Now that a MEV-share bid has been sent in we can simulate sending in a match. On Now that our SUAVE node's bidpool has a mevshare bid and match, we can trigger block building to combine these transactions, simulate for validity, and insert the refund transaction. ```go - _, err = sendBuildShareBlockTx(suaveClient, suaveSigner, privKey, executionNodeAddress, blockSenderAddr, payloadArgsTuple, uint64(goerliBlockNum)+1) + _, err = sendBuildShareBlockTx(suaveClient, suaveSigner, privKey, kettleAddress, blockSenderAddr, payloadArgsTuple, uint64(goerliBlockNum)+1) if err != nil { err = errors.Wrap(err, unwrapPeekerError(err).Error()) if strings.Contains(err.Error(), "no bids") { diff --git a/suave/cmd/suavecli/buildGoerliBlocks.go b/suave/cmd/suavecli/buildGoerliBlocks.go index b70c44e0f9..8aa35ccb25 100644 --- a/suave/cmd/suavecli/buildGoerliBlocks.go +++ b/suave/cmd/suavecli/buildGoerliBlocks.go @@ -18,14 +18,14 @@ func cmdBuildGoerliBlocks() { flagset := flag.NewFlagSet("deployBlockSenderContract", flag.ExitOnError) var ( - suaveRpc = flagset.String("suave_rpc", "http://127.0.0.1:8545", "address of suave rpc") - goerliRpc = flagset.String("goerli_rpc", "http://127.0.0.1:8545", "address of goerli rpc") - goerliBeaconRpc = flagset.String("goerli_beacon_rpc", "http://127.0.0.1:5052", "address of goerli beacon rpc") - executionNodeAddressHex = flagset.String("ex_node_addr", "0x4E2B0c0e428AE1CDE26d5BcF17Ba83f447068E5B", "wallet address of execution node") - privKeyHex = flagset.String("privkey", "", "private key as hex (for testing)") - boostRelayUrl = flagset.String("relay_url", "http://127.0.0.1:8091", "address of boost relay that the contract will send blocks to") - verbosity = flagset.Int("verbosity", int(log.LvlInfo), "log verbosity (0-5)") - privKey *ecdsa.PrivateKey + suaveRpc = flagset.String("suave_rpc", "http://127.0.0.1:8545", "address of suave rpc") + goerliRpc = flagset.String("goerli_rpc", "http://127.0.0.1:8545", "address of goerli rpc") + goerliBeaconRpc = flagset.String("goerli_beacon_rpc", "http://127.0.0.1:5052", "address of goerli beacon rpc") + kettleAddressHex = flagset.String("kettleAddress", "0x4E2B0c0e428AE1CDE26d5BcF17Ba83f447068E5B", "wallet address of execution node") + privKeyHex = flagset.String("privkey", "", "private key as hex (for testing)") + boostRelayUrl = flagset.String("relay_url", "http://127.0.0.1:8091", "address of boost relay that the contract will send blocks to") + verbosity = flagset.Int("verbosity", int(log.LvlInfo), "log verbosity (0-5)") + privKey *ecdsa.PrivateKey ) flagset.Parse(os.Args[2:]) @@ -34,7 +34,7 @@ func cmdBuildGoerliBlocks() { log.Root().SetHandler(glogger) glogger.Verbosity(log.Lvl(*verbosity)) - privKey, executionNodeAddress, suaveClient, goerliClient, suaveSigner, _ := setUpSuaveAndGoerli(privKeyHex, executionNodeAddressHex, suaveRpc, goerliRpc) + privKey, kettleAddress, suaveClient, goerliClient, suaveSigner, _ := setUpSuaveAndGoerli(privKeyHex, kettleAddressHex, suaveRpc, goerliRpc) // ********** Deploy Builder Contract ********** @@ -112,7 +112,7 @@ func cmdBuildGoerliBlocks() { } for i := 0; i < 3; i++ { - _, err = sendBuildShareBlockTx(suaveClient, suaveSigner, privKey, executionNodeAddress, blockSenderAddr, payloadArgsTuple, uint64(goerliBlockNum)+1) + _, err = sendBuildShareBlockTx(suaveClient, suaveSigner, privKey, kettleAddress, blockSenderAddr, payloadArgsTuple, uint64(goerliBlockNum)+1) if err != nil { err = errors.Wrap(err, unwrapPeekerError(err).Error()) if strings.Contains(err.Error(), "no bids") { diff --git a/suave/cmd/suavecli/main.go b/suave/cmd/suavecli/main.go index 728268a089..9e36b1d982 100644 --- a/suave/cmd/suavecli/main.go +++ b/suave/cmd/suavecli/main.go @@ -140,12 +140,12 @@ func extractBidId(suaveClient *rpc.Client, txHash common.Hash) (suave.BidId, err return suave.BidId{0}, err } -func setUpSuaveAndGoerli(privKeyHex *string, executionNodeAddressHex *string, suaveRpc *string, goerliRpc *string) (*ecdsa.PrivateKey, common.Address, *rpc.Client, *rpc.Client, types.Signer, types.Signer) { +func setUpSuaveAndGoerli(privKeyHex *string, kettleAddressHex *string, suaveRpc *string, goerliRpc *string) (*ecdsa.PrivateKey, common.Address, *rpc.Client, *rpc.Client, types.Signer, types.Signer) { privKey, err := crypto.HexToECDSA(*privKeyHex) RequireNoErrorf(err, "-nodekeyhex: %v", err) /* shush linter */ privKey.Public() - executionNodeAddress := common.HexToAddress(*executionNodeAddressHex) + kettleAddress := common.HexToAddress(*kettleAddressHex) suaveClient, err := rpc.DialContext(context.TODO(), *suaveRpc) RequireNoErrorf(err, "could not connect to suave rpc: %v", err) @@ -158,5 +158,5 @@ func setUpSuaveAndGoerli(privKeyHex *string, executionNodeAddressHex *string, su goerliSigner := types.LatestSigner(core.DefaultGoerliGenesisBlock().Config) - return privKey, executionNodeAddress, suaveClient, goerliClient, suaveSigner, goerliSigner + return privKey, kettleAddress, suaveClient, goerliClient, suaveSigner, goerliSigner } diff --git a/suave/cmd/suavecli/sendBuildShareBlock.go b/suave/cmd/suavecli/sendBuildShareBlock.go index a0803396fe..b494c8cbb0 100644 --- a/suave/cmd/suavecli/sendBuildShareBlock.go +++ b/suave/cmd/suavecli/sendBuildShareBlock.go @@ -40,15 +40,15 @@ func cmdSendBuildShareBlock() { flagset := flag.NewFlagSet("sendBuildShareBlock", flag.ExitOnError) var ( - suaveRpc = flagset.String("suave_rpc", "http://127.0.0.1:8545", "address of suave rpc") - goerliRpc = flagset.String("goerli_rpc", "http://127.0.0.1:8545", "address of goerli rpc") - goerliBeaconRpc = flagset.String("goerli_beacon_rpc", "http://127.0.0.1:5052", "address of goerli beacon rpc") - boostRelayUrl = flagset.String("relay_url", "http://127.0.0.1:8091", "address of boost relay that the contract will send blocks to") - blockSenderAddressHex = flagset.String("block_sender_addr", "0x42042042028AE1CDE26d5BcF17Ba83f447068E5B", "address of block sender contract") - executionNodeAddressHex = flagset.String("ex_node_addr", "0x4E2B0c0e428AE1CDE26d5BcF17Ba83f447068E5B", "wallet address of execution node") - privKeyHex = flagset.String("privkey", "", "private key as hex (for testing)") - verbosity = flagset.Int("verbosity", int(log.LvlInfo), "log verbosity (0-5)") - privKey *ecdsa.PrivateKey + suaveRpc = flagset.String("suave_rpc", "http://127.0.0.1:8545", "address of suave rpc") + goerliRpc = flagset.String("goerli_rpc", "http://127.0.0.1:8545", "address of goerli rpc") + goerliBeaconRpc = flagset.String("goerli_beacon_rpc", "http://127.0.0.1:5052", "address of goerli beacon rpc") + boostRelayUrl = flagset.String("relay_url", "http://127.0.0.1:8091", "address of boost relay that the contract will send blocks to") + blockSenderAddressHex = flagset.String("block_sender_addr", "0x42042042028AE1CDE26d5BcF17Ba83f447068E5B", "address of block sender contract") + kettleAddressHex = flagset.String("kettleAddress", "0x4E2B0c0e428AE1CDE26d5BcF17Ba83f447068E5B", "wallet address of execution node") + privKeyHex = flagset.String("privkey", "", "private key as hex (for testing)") + verbosity = flagset.Int("verbosity", int(log.LvlInfo), "log verbosity (0-5)") + privKey *ecdsa.PrivateKey ) flagset.Parse(os.Args[2:]) @@ -61,10 +61,10 @@ func cmdSendBuildShareBlock() { RequireNoErrorf(err, "-nodekeyhex: %v", err) /* shush linter */ privKey.Public() - if executionNodeAddressHex == nil || *executionNodeAddressHex == "" { - utils.Fatalf("please provide ex_node_addr") + if kettleAddressHex == nil || *kettleAddressHex == "" { + utils.Fatalf("please provide kettleAddress") } - executionNodeAddress := common.HexToAddress(*executionNodeAddressHex) + kettleAddress := common.HexToAddress(*kettleAddressHex) blockSenderAddr := common.HexToAddress(*blockSenderAddressHex) suaveClient, err := rpc.DialContext(context.TODO(), *suaveRpc) @@ -138,7 +138,7 @@ func cmdSendBuildShareBlock() { } for i := 0; i < 3; i++ { - _, err = sendBuildShareBlockTx(suaveClient, suaveSigner, privKey, executionNodeAddress, blockSenderAddr, payloadArgsTuple, uint64(goerliBlockNum)+1) + _, err = sendBuildShareBlockTx(suaveClient, suaveSigner, privKey, kettleAddress, blockSenderAddr, payloadArgsTuple, uint64(goerliBlockNum)+1) if err != nil { err = errors.Wrap(err, unwrapPeekerError(err).Error()) if strings.Contains(err.Error(), "no bids") { @@ -161,7 +161,7 @@ func sendBuildShareBlockTx( suaveClient *rpc.Client, suaveSigner types.Signer, privKey *ecdsa.PrivateKey, - executionNodeAddress common.Address, + kettleAddress common.Address, blockSenderAddr common.Address, payloadArgsTuple payloadArgs, goerliBlockNum uint64, @@ -176,7 +176,7 @@ func sendBuildShareBlockTx( wrappedTxData := &types.ConfidentialComputeRequest{ ConfidentialComputeRecord: types.ConfidentialComputeRecord{ - ExecutionNode: executionNodeAddress, + KettleAddress: kettleAddress, Nonce: suaveAccNonce, To: &blockSenderAddr, Value: nil, diff --git a/suave/cmd/suavecli/sendBundle.go b/suave/cmd/suavecli/sendBundle.go index 0ebe424c4f..2763f99f1a 100644 --- a/suave/cmd/suavecli/sendBundle.go +++ b/suave/cmd/suavecli/sendBundle.go @@ -23,12 +23,12 @@ func cmdSendBundle() { flagset := flag.NewFlagSet("sendBundle", flag.ExitOnError) var ( - suaveRpc = flagset.String("suave_rpc", "http://127.0.0.1:8545", "address of suave rpc") - executionNodeAddressHex = flagset.String("ex_node_addr", "0x4E2B0c0e428AE1CDE26d5BcF17Ba83f447068E5B", "wallet address of execution node") - goerliRpc = flagset.String("goerli_rpc", "http://127.0.0.1:8545", "address of goerli rpc") - privKeyHex = flagset.String("privkey", "", "private key as hex (for testing)") - verbosity = flagset.Int("verbosity", int(log.LvlInfo), "log verbosity (0-5)") - privKey *ecdsa.PrivateKey + suaveRpc = flagset.String("suave_rpc", "http://127.0.0.1:8545", "address of suave rpc") + kettleAddressHex = flagset.String("kettleAddress", "0x4E2B0c0e428AE1CDE26d5BcF17Ba83f447068E5B", "wallet address of execution node") + goerliRpc = flagset.String("goerli_rpc", "http://127.0.0.1:8545", "address of goerli rpc") + privKeyHex = flagset.String("privkey", "", "private key as hex (for testing)") + verbosity = flagset.Int("verbosity", int(log.LvlInfo), "log verbosity (0-5)") + privKey *ecdsa.PrivateKey ) flagset.Parse(os.Args[2:]) @@ -41,10 +41,10 @@ func cmdSendBundle() { RequireNoErrorf(err, "-nodekeyhex: %v", err) /* shush linter */ privKey.Public() - if executionNodeAddressHex == nil || *executionNodeAddressHex == "" { - utils.Fatalf("please provide ex_node_addr") + if kettleAddressHex == nil || *kettleAddressHex == "" { + utils.Fatalf("please provide kettleAddress") } - executionNodeAddress := common.HexToAddress(*executionNodeAddressHex) + kettleAddress := common.HexToAddress(*kettleAddressHex) suaveClient, err := rpc.DialContext(context.TODO(), *suaveRpc) RequireNoErrorf(err, "could not connect to suave rpc: %v", err) @@ -148,7 +148,7 @@ func cmdSendBundle() { confidentialRequestInner := *confidentialInnerTxTemplate confidentialInnerTxTemplate.Nonce += 1 confidentialRequestInner.Data = calldata - confidentialRequestInner.ExecutionNode = executionNodeAddress + confidentialRequestInner.KettleAddress = kettleAddress confidentialRequestTx, err := types.SignTx(types.NewTx(&confidentialRequestInner), suaveSigner, privKey) RequireNoErrorf(err, "could not sign confidentialRequestTx: %v", err) @@ -238,7 +238,7 @@ func cmdSendBundle() { wrappedTxData := &types.ConfidentialComputeRequest{ ConfidentialComputeRecord: types.ConfidentialComputeRecord{ - ExecutionNode: executionNodeAddress, + KettleAddress: kettleAddress, Nonce: suaveAccNonce, To: &newBlockBidAddress, Value: nil, diff --git a/suave/cmd/suavecli/sendBundleToBuilder.go b/suave/cmd/suavecli/sendBundleToBuilder.go index 8eefd99fc4..2ba02ecea5 100644 --- a/suave/cmd/suavecli/sendBundleToBuilder.go +++ b/suave/cmd/suavecli/sendBundleToBuilder.go @@ -28,13 +28,13 @@ func cmdSendBundleToBuilder() { goerliBuilderUrl := "https://relay-goerli.flashbots.net/" var ( - suaveRpc = flagset.String("suave_rpc", "http://127.0.0.1:8545", "address of suave rpc") - executionNodeAddressHex = flagset.String("ex_node_addr", "0x4E2B0c0e428AE1CDE26d5BcF17Ba83f447068E5B", "wallet address of execution node") - goerliRpc = flagset.String("goerli_rpc", "http://127.0.0.1:8555", "address of goerli rpc") - privKeyHex = flagset.String("privkey", "", "private key as hex (for testing)") - contractAddressFlag = flagset.String("contract", "", "contract address to use (default: deploy new one)") - verbosity = flagset.Int("verbosity", int(log.LvlInfo), "log verbosity (0-5)") - privKey *ecdsa.PrivateKey + suaveRpc = flagset.String("suave_rpc", "http://127.0.0.1:8545", "address of suave rpc") + kettleAddressHex = flagset.String("kettleAddress", "0x4E2B0c0e428AE1CDE26d5BcF17Ba83f447068E5B", "wallet address of execution node") + goerliRpc = flagset.String("goerli_rpc", "http://127.0.0.1:8555", "address of goerli rpc") + privKeyHex = flagset.String("privkey", "", "private key as hex (for testing)") + contractAddressFlag = flagset.String("contract", "", "contract address to use (default: deploy new one)") + verbosity = flagset.Int("verbosity", int(log.LvlInfo), "log verbosity (0-5)") + privKey *ecdsa.PrivateKey ) flagset.Parse(os.Args[2:]) @@ -47,15 +47,15 @@ func cmdSendBundleToBuilder() { RequireNoErrorf(err, "-nodekeyhex: %v", err) /* shush linter */ privKey.Public() - if executionNodeAddressHex == nil || *executionNodeAddressHex == "" { - utils.Fatalf("please provide ex_node_addr") + if kettleAddressHex == nil || *kettleAddressHex == "" { + utils.Fatalf("please provide kettleAddress") } - executionNodeAddress := common.HexToAddress(*executionNodeAddressHex) + kettleAddress := common.HexToAddress(*kettleAddressHex) suaveClient, err := rpc.DialContext(context.TODO(), *suaveRpc) RequireNoErrorf(err, "could not connect to suave rpc: %v", err) - suaveSdkClient := sdk.NewClient(suaveClient, privKey, executionNodeAddress) + suaveSdkClient := sdk.NewClient(suaveClient, privKey, kettleAddress) goerliClient, err := rpc.DialContext(context.TODO(), *goerliRpc) RequireNoErrorf(err, "could not connect to goerli rpc: %v", err) diff --git a/suave/cmd/suavecli/sendMevShareBundle.go b/suave/cmd/suavecli/sendMevShareBundle.go index 93483e9338..46b504e454 100644 --- a/suave/cmd/suavecli/sendMevShareBundle.go +++ b/suave/cmd/suavecli/sendMevShareBundle.go @@ -22,13 +22,13 @@ func cmdSendMevShareBundle() { flagset := flag.NewFlagSet("sendBundle", flag.ExitOnError) var ( - suaveRpc = flagset.String("suave_rpc", "http://127.0.0.1:8545", "address of suave rpc") - executionNodeAddressHex = flagset.String("ex_node_addr", "0x4E2B0c0e428AE1CDE26d5BcF17Ba83f447068E5B", "wallet address of execution node") - mevshareAddressHex = flagset.String("mev_share_addr", "0x42042042028AE1CDE26d5BcF17Ba83f447068E5B", "address of mev share contract") - goerliRpc = flagset.String("goerli_rpc", "http://127.0.0.1:8545", "address of goerli rpc") - privKeyHex = flagset.String("privkey", "", "private key as hex (for testing)") - verbosity = flagset.Int("verbosity", int(log.LvlInfo), "log verbosity (0-5)") - privKey *ecdsa.PrivateKey + suaveRpc = flagset.String("suave_rpc", "http://127.0.0.1:8545", "address of suave rpc") + kettleAddressHex = flagset.String("kettleAddress", "0x4E2B0c0e428AE1CDE26d5BcF17Ba83f447068E5B", "wallet address of execution node") + mevshareAddressHex = flagset.String("mev_share_addr", "0x42042042028AE1CDE26d5BcF17Ba83f447068E5B", "address of mev share contract") + goerliRpc = flagset.String("goerli_rpc", "http://127.0.0.1:8545", "address of goerli rpc") + privKeyHex = flagset.String("privkey", "", "private key as hex (for testing)") + verbosity = flagset.Int("verbosity", int(log.LvlInfo), "log verbosity (0-5)") + privKey *ecdsa.PrivateKey ) flagset.Parse(os.Args[2:]) @@ -41,10 +41,10 @@ func cmdSendMevShareBundle() { RequireNoErrorf(err, "-nodekeyhex: %v", err) /* shush linter */ privKey.Public() - if executionNodeAddressHex == nil || *executionNodeAddressHex == "" { - utils.Fatalf("please provide ex_node_addr") + if kettleAddressHex == nil || *kettleAddressHex == "" { + utils.Fatalf("please provide kettleAddress") } - executionNodeAddress := common.HexToAddress(*executionNodeAddressHex) + kettleAddress := common.HexToAddress(*kettleAddressHex) mevshareAddresss := common.HexToAddress(*mevshareAddressHex) @@ -61,7 +61,7 @@ func cmdSendMevShareBundle() { log.Root().SetHandler(log.LvlFilterHandler(log.LvlInfo, log.StreamHandler(os.Stdout, log.TerminalFormat(true)))) - _, err = sendMevShareBidTxs(suaveClient, goerliClient, suaveSigner, goerliSigner, 1, mevshareAddresss, mevshareAddresss, executionNodeAddress, privKey) + _, err = sendMevShareBidTxs(suaveClient, goerliClient, suaveSigner, goerliSigner, 1, mevshareAddresss, mevshareAddresss, kettleAddress, privKey) if err != nil { log.Info("err", "error", err.Error()) panic(err.Error()) @@ -84,10 +84,10 @@ func sendMevShareBidTxs( nBlocks uint64, mevShareAddr common.Address, blockBuilderAddr common.Address, - executionNodeAddr common.Address, + kettleAddress common.Address, privKey *ecdsa.PrivateKey, ) ([]mevShareBidData, error) { - log.Info("sendMevShareBidTx", "executionNodeAddr", executionNodeAddr) + log.Info("sendMevShareBidTx", "kettleAddress", kettleAddress) var startingGoerliBlockNum uint64 err = goerliClient.Call((*hexutil.Uint64)(&startingGoerliBlockNum), "eth_blockNumber") @@ -117,7 +117,7 @@ func sendMevShareBidTxs( return mevShareTxHashes, err } - mevShareTx, mevShareTxBytes, err := prepareMevShareBidTx(suaveSigner, privKey, executionNodeAddr, uint64(suaveAccNonce), calldata, mevShareAddr) + mevShareTx, mevShareTxBytes, err := prepareMevShareBidTx(suaveSigner, privKey, kettleAddress, uint64(suaveAccNonce), calldata, mevShareAddr) if err != nil { return mevShareTxHashes, err } @@ -174,10 +174,10 @@ func prepareEthBundle( return *bundle, bundleBytes, nil } -func prepareMevShareBidTx(suaveSigner types.Signer, privKey *ecdsa.PrivateKey, executionNodeAddr common.Address, suaveAccNonce uint64, calldata []byte, mevShareAddr common.Address) (*types.Transaction, hexutil.Bytes, error) { +func prepareMevShareBidTx(suaveSigner types.Signer, privKey *ecdsa.PrivateKey, kettleAddress common.Address, suaveAccNonce uint64, calldata []byte, mevShareAddr common.Address) (*types.Transaction, hexutil.Bytes, error) { wrappedTxData := &types.ConfidentialComputeRequest{ ConfidentialComputeRecord: types.ConfidentialComputeRecord{ - ExecutionNode: executionNodeAddr, + KettleAddress: kettleAddress, Nonce: suaveAccNonce, To: &mevShareAddr, Value: nil, diff --git a/suave/cmd/suavecli/sendMevShareMatch.go b/suave/cmd/suavecli/sendMevShareMatch.go index b7795941c7..1c9a59c14b 100644 --- a/suave/cmd/suavecli/sendMevShareMatch.go +++ b/suave/cmd/suavecli/sendMevShareMatch.go @@ -23,15 +23,15 @@ func cmdSendMevShareMatch() { flagset := flag.NewFlagSet("sendBundle", flag.ExitOnError) var ( - suaveRpc = flagset.String("suave_rpc", "http://127.0.0.1:8545", "address of suave rpc") - executionNodeAddressHex = flagset.String("ex_node_addr", "0x4E2B0c0e428AE1CDE26d5BcF17Ba83f447068E5B", "wallet address of execution node") - mevshareAddressHex = flagset.String("mev_share_addr", "0x42042042028AE1CDE26d5BcF17Ba83f447068E5B", "address of mev share contract") - blockSenderHex = flagset.String("block_sender_addr", "0x42042042028AE1CDE26d5BcF17Ba83f447068E5B", "address of mev share contract") - matchBidId = flagset.String("match_bid_id", "123-123-123", "ID of mev share bundle bid to back run") - goerliRpc = flagset.String("goerli_rpc", "http://127.0.0.1:8545", "address of goerli rpc") - privKeyHex = flagset.String("privkey", "", "private key as hex (for testing)") - verbosity = flagset.Int("verbosity", int(log.LvlInfo), "log verbosity (0-5)") - privKey *ecdsa.PrivateKey + suaveRpc = flagset.String("suave_rpc", "http://127.0.0.1:8545", "address of suave rpc") + kettleAddressHex = flagset.String("kettleAddress", "0x4E2B0c0e428AE1CDE26d5BcF17Ba83f447068E5B", "wallet address of execution node") + mevshareAddressHex = flagset.String("mev_share_addr", "0x42042042028AE1CDE26d5BcF17Ba83f447068E5B", "address of mev share contract") + blockSenderHex = flagset.String("block_sender_addr", "0x42042042028AE1CDE26d5BcF17Ba83f447068E5B", "address of mev share contract") + matchBidId = flagset.String("match_bid_id", "123-123-123", "ID of mev share bundle bid to back run") + goerliRpc = flagset.String("goerli_rpc", "http://127.0.0.1:8545", "address of goerli rpc") + privKeyHex = flagset.String("privkey", "", "private key as hex (for testing)") + verbosity = flagset.Int("verbosity", int(log.LvlInfo), "log verbosity (0-5)") + privKey *ecdsa.PrivateKey ) flagset.Parse(os.Args[2:]) @@ -44,10 +44,10 @@ func cmdSendMevShareMatch() { RequireNoErrorf(err, "-nodekeyhex: %v", err) /* shush linter */ privKey.Public() - if executionNodeAddressHex == nil || *executionNodeAddressHex == "" { - utils.Fatalf("please provide ex_node_addr") + if kettleAddressHex == nil || *kettleAddressHex == "" { + utils.Fatalf("please provide kettleAddress") } - executionNodeAddress := common.HexToAddress(*executionNodeAddressHex) + kettleAddress := common.HexToAddress(*kettleAddressHex) mevshareAddresss := common.HexToAddress(*mevshareAddressHex) blockSenderAddress := common.HexToAddress(*blockSenderHex) @@ -76,7 +76,7 @@ func cmdSendMevShareMatch() { 26, mevshareAddresss, blockSenderAddress, - executionNodeAddress, + kettleAddress, matchBidIdBytes, privKey, ) @@ -97,7 +97,7 @@ func sendMevShareMatchTx( targetBlock uint64, mevShareAddr common.Address, blockSenderAddr common.Address, - executionNodeAddr common.Address, + kettleAddress common.Address, matchBidId types.BidId, // account specific privKey *ecdsa.PrivateKey, @@ -117,7 +117,7 @@ func sendMevShareMatchTx( err = suaveClient.Call(&suaveAccNonce, "eth_getTransactionCount", crypto.PubkeyToAddress(privKey.PublicKey), "pending") RequireNoErrorf(err, "could not call eth_getTransactionCount on suave: %v", err) - _, backrunBidTxBytes, err := prepareMevBackrunBidTx(suaveSigner, privKey, executionNodeAddr, uint64(suaveAccNonce), matchCalldata, mevShareAddr) + _, backrunBidTxBytes, err := prepareMevBackrunBidTx(suaveSigner, privKey, kettleAddress, uint64(suaveAccNonce), matchCalldata, mevShareAddr) RequireNoErrorf(err, "could not prepare backrun bid: %v", err) // TODO : reusing this function selector from bid contract to avoid creating another ABI @@ -170,10 +170,10 @@ func prepareEthBackrunBundle( return *bundle, bundleBytes, nil } -func prepareMevBackrunBidTx(suaveSigner types.Signer, privKey *ecdsa.PrivateKey, executionNodeAddr common.Address, suaveAccNonce uint64, calldata []byte, mevShareAddr common.Address) (*types.Transaction, hexutil.Bytes, error) { +func prepareMevBackrunBidTx(suaveSigner types.Signer, privKey *ecdsa.PrivateKey, kettleAddress common.Address, suaveAccNonce uint64, calldata []byte, mevShareAddr common.Address) (*types.Transaction, hexutil.Bytes, error) { wrappedTxData := &types.ConfidentialComputeRequest{ ConfidentialComputeRecord: types.ConfidentialComputeRecord{ - ExecutionNode: executionNodeAddr, + KettleAddress: kettleAddress, Nonce: suaveAccNonce, To: &mevShareAddr, Value: nil, diff --git a/suave/cmd/suavecli/testDeployAndShare.go b/suave/cmd/suavecli/testDeployAndShare.go index b432f7731b..ecca077b60 100644 --- a/suave/cmd/suavecli/testDeployAndShare.go +++ b/suave/cmd/suavecli/testDeployAndShare.go @@ -18,14 +18,14 @@ func cmdTestDeployAndShare() { flagset := flag.NewFlagSet("deployBlockSenderContract", flag.ExitOnError) var ( - suaveRpc = flagset.String("suave_rpc", "http://127.0.0.1:8545", "address of suave rpc") - goerliRpc = flagset.String("goerli_rpc", "http://127.0.0.1:8545", "address of goerli rpc") - goerliBeaconRpc = flagset.String("goerli_beacon_rpc", "http://127.0.0.1:5052", "address of goerli beacon rpc") - executionNodeAddressHex = flagset.String("ex_node_addr", "0x4E2B0c0e428AE1CDE26d5BcF17Ba83f447068E5B", "wallet address of execution node") - privKeyHex = flagset.String("privkey", "", "private key as hex (for testing)") - boostRelayUrl = flagset.String("relay_url", "http://127.0.0.1:8091", "address of boost relay that the contract will send blocks to") - verbosity = flagset.Int("verbosity", int(log.LvlInfo), "log verbosity (0-5)") - privKey *ecdsa.PrivateKey + suaveRpc = flagset.String("suave_rpc", "http://127.0.0.1:8545", "address of suave rpc") + goerliRpc = flagset.String("goerli_rpc", "http://127.0.0.1:8545", "address of goerli rpc") + goerliBeaconRpc = flagset.String("goerli_beacon_rpc", "http://127.0.0.1:5052", "address of goerli beacon rpc") + kettleAddressHex = flagset.String("kettleAddress", "0x4E2B0c0e428AE1CDE26d5BcF17Ba83f447068E5B", "wallet address of execution node") + privKeyHex = flagset.String("privkey", "", "private key as hex (for testing)") + boostRelayUrl = flagset.String("relay_url", "http://127.0.0.1:8091", "address of boost relay that the contract will send blocks to") + verbosity = flagset.Int("verbosity", int(log.LvlInfo), "log verbosity (0-5)") + privKey *ecdsa.PrivateKey ) flagset.Parse(os.Args[2:]) @@ -34,7 +34,7 @@ func cmdTestDeployAndShare() { log.Root().SetHandler(glogger) glogger.Verbosity(log.Lvl(*verbosity)) - privKey, executionNodeAddress, suaveClient, goerliClient, suaveSigner, goerliSigner := setUpSuaveAndGoerli(privKeyHex, executionNodeAddressHex, suaveRpc, goerliRpc) + privKey, kettleAddress, suaveClient, goerliClient, suaveSigner, goerliSigner := setUpSuaveAndGoerli(privKeyHex, kettleAddressHex, suaveRpc, goerliRpc) // ********** Deploy Builder Contract ********** @@ -68,7 +68,7 @@ func cmdTestDeployAndShare() { // ********** 3. Send Mevshare Bundles for the next 26 blocks ********** - mevShareTxs, err := sendMevShareBidTxs(suaveClient, goerliClient, suaveSigner, goerliSigner, 5, mevShareAddr, blockSenderAddr, executionNodeAddress, privKey) + mevShareTxs, err := sendMevShareBidTxs(suaveClient, goerliClient, suaveSigner, goerliSigner, 5, mevShareAddr, blockSenderAddr, kettleAddress, privKey) if err != nil { err = errors.Wrap(err, unwrapPeekerError(err).Error()) panic(err.Error()) @@ -94,7 +94,7 @@ func cmdTestDeployAndShare() { mevShareTx.blockNumber, mevShareAddr, blockSenderAddr, - executionNodeAddress, + kettleAddress, bidIdBytes, privKey, ) @@ -175,7 +175,7 @@ func cmdTestDeployAndShare() { } for i := 0; i < 3; i++ { - _, err = sendBuildShareBlockTx(suaveClient, suaveSigner, privKey, executionNodeAddress, blockSenderAddr, payloadArgsTuple, uint64(goerliBlockNum)+1) + _, err = sendBuildShareBlockTx(suaveClient, suaveSigner, privKey, kettleAddress, blockSenderAddr, payloadArgsTuple, uint64(goerliBlockNum)+1) if err != nil { err = errors.Wrap(err, unwrapPeekerError(err).Error()) if strings.Contains(err.Error(), "no bids") { diff --git a/suave/cstore/engine.go b/suave/cstore/engine.go index c50894ad44..1f3760ab13 100644 --- a/suave/cstore/engine.go +++ b/suave/cstore/engine.go @@ -186,7 +186,7 @@ func (e *ConfidentialStoreEngine) InitializeBid(bid types.Bid, creationTx *types return suave.Bid{}, fmt.Errorf("confidential engine: could not hash bid for signing: %w", err) } - signingAccount, err := ExecutionNodeFromTransaction(creationTx) + signingAccount, err := KettleAddressFromTransaction(creationTx) if err != nil { return suave.Bid{}, fmt.Errorf("confidential engine: could not recover execution node from creation transaction: %w", err) } @@ -254,7 +254,7 @@ func (e *ConfidentialStoreEngine) Finalize(tx *types.Transaction, newBids map[su return fmt.Errorf("confidential engine: could not hash message for signing: %w", err) } - signingAccount, err := ExecutionNodeFromTransaction(tx) + signingAccount, err := KettleAddressFromTransaction(tx) if err != nil { return fmt.Errorf("confidential engine: could not recover execution node from source transaction: %w", err) } @@ -282,7 +282,7 @@ func (e *ConfidentialStoreEngine) NewMessage(message DAMessage) error { if err != nil { return fmt.Errorf("confidential engine: incorrect message signature: %w", err) } - expectedMessageSigner, err := ExecutionNodeFromTransaction(message.SourceTx) + expectedMessageSigner, err := KettleAddressFromTransaction(message.SourceTx) if err != nil { return fmt.Errorf("confidential engine: could not recover signer from message: %w", err) } @@ -332,7 +332,7 @@ func (e *ConfidentialStoreEngine) NewMessage(message DAMessage) error { if err != nil { return fmt.Errorf("confidential engine: incorrect bid signature: %w", err) } - expectedBidSigner, err := ExecutionNodeFromTransaction(sw.Bid.CreationTx) + expectedBidSigner, err := KettleAddressFromTransaction(sw.Bid.CreationTx) if err != nil { return fmt.Errorf("confidential engine: could not recover signer from bid: %w", err) } @@ -439,15 +439,15 @@ func (MockChainSigner) Sender(tx *types.Transaction) (common.Address, error) { return types.NewSuaveSigner(tx.ChainId()).Sender(tx) } -func ExecutionNodeFromTransaction(tx *types.Transaction) (common.Address, error) { +func KettleAddressFromTransaction(tx *types.Transaction) (common.Address, error) { innerExecutedTx, ok := types.CastTxInner[*types.SuaveTransaction](tx) if ok { - return innerExecutedTx.ExecutionNode, nil + return innerExecutedTx.KettleAddress, nil } innerRequestTx, ok := types.CastTxInner[*types.ConfidentialComputeRequest](tx) if ok { - return innerRequestTx.ExecutionNode, nil + return innerRequestTx.KettleAddress, nil } return common.Address{}, fmt.Errorf("transaction is not of confidential type") diff --git a/suave/cstore/engine_test.go b/suave/cstore/engine_test.go index 5037d872fe..c7d5b2bfb0 100644 --- a/suave/cstore/engine_test.go +++ b/suave/cstore/engine_test.go @@ -70,7 +70,7 @@ func TestOwnMessageDropping(t *testing.T) { // testKeyAddress := crypto.PubkeyToAddress(testKey.PublicKey) dummyCreationTx, err := types.SignTx(types.NewTx(&types.ConfidentialComputeRequest{ ConfidentialComputeRecord: types.ConfidentialComputeRecord{ - ExecutionNode: common.Address{0x42}, + KettleAddress: common.Address{0x42}, }, }), types.NewSuaveSigner(new(big.Int)), testKey) require.NoError(t, err) diff --git a/suave/cstore/redis_backends_test.go b/suave/cstore/redis_backends_test.go index c7186c455f..465326418d 100644 --- a/suave/cstore/redis_backends_test.go +++ b/suave/cstore/redis_backends_test.go @@ -85,7 +85,7 @@ func TestEngineOnRedis(t *testing.T) { testKey, _ := crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291") dummyCreationTx, err := types.SignTx(types.NewTx(&types.ConfidentialComputeRequest{ ConfidentialComputeRecord: types.ConfidentialComputeRecord{ - ExecutionNode: common.Address{}, + KettleAddress: common.Address{}, }, }), types.NewSuaveSigner(new(big.Int)), testKey) require.NoError(t, err) diff --git a/suave/cstore/transactional_store_test.go b/suave/cstore/transactional_store_test.go index f86b3380bf..788a06a740 100644 --- a/suave/cstore/transactional_store_test.go +++ b/suave/cstore/transactional_store_test.go @@ -17,7 +17,7 @@ func TestTransactionalStore(t *testing.T) { testKey, _ := crypto.HexToECDSA("b71c71a67e1177ad4e901695e1b4b9ee17ae16c6668d313eac2f96dbcda3f291") dummyCreationTx, err := types.SignTx(types.NewTx(&types.ConfidentialComputeRequest{ ConfidentialComputeRecord: types.ConfidentialComputeRecord{ - ExecutionNode: common.Address{0x42}, + KettleAddress: common.Address{0x42}, }, }), types.NewSuaveSigner(new(big.Int)), testKey) require.NoError(t, err) diff --git a/suave/docs/conf_comp_request_flow.png b/suave/docs/conf_comp_request_flow.png index 0964c14004..b7f0427dcb 100644 Binary files a/suave/docs/conf_comp_request_flow.png and b/suave/docs/conf_comp_request_flow.png differ diff --git a/suave/e2e/redis_transport_test.go b/suave/e2e/redis_transport_test.go index 082e57efa3..1d6fbd4aaa 100644 --- a/suave/e2e/redis_transport_test.go +++ b/suave/e2e/redis_transport_test.go @@ -16,13 +16,13 @@ import ( func TestRedisBackends(t *testing.T) { withMiniredisTransportOpt := WithRedisTransportOpt(t) - fr1 := newFramework(t, WithExecutionNode(), WithRedisStoreBackend(), withMiniredisTransportOpt) + fr1 := newFramework(t, WithKettleAddress(), WithRedisStoreBackend(), withMiniredisTransportOpt) t.Cleanup(fr1.Close) var keystoreBackend *keystore.KeyStore = fr1.suethSrv.service.APIBackend.AccountManager().Backends(keystore.KeyStoreType)[0].(*keystore.KeyStore) keystoreBackend.ImportECDSA(testKey, "") - fr2 := newFramework(t, WithExecutionNode(), WithRedisStoreBackend(), withMiniredisTransportOpt) + fr2 := newFramework(t, WithKettleAddress(), WithRedisStoreBackend(), withMiniredisTransportOpt) t.Cleanup(fr2.Close) clt1 := fr1.NewSDKClient() @@ -55,7 +55,7 @@ func TestRedisBackends(t *testing.T) { bundleBidContractI := sdk.GetContract(newBundleBidAddress, BundleBidContract.Abi, clt1) - _, err = bundleBidContractI.SendTransaction("newBid", []interface{}{targetBlock + 1, allowedPeekers, []common.Address{fr1.ExecutionNode(), fr2.ExecutionNode()}}, confidentialDataBytes) + _, err = bundleBidContractI.SendTransaction("newBid", []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 a5f9c6c676..eb6980d5ce 100644 --- a/suave/e2e/workflow_test.go +++ b/suave/e2e/workflow_test.go @@ -72,7 +72,7 @@ func TestIsConfidential(t *testing.T) { // Verify sending computation requests and onchain transactions to isConfidentialAddress confidentialRequestTx, err := types.SignTx(types.NewTx(&types.ConfidentialComputeRequest{ ConfidentialComputeRecord: types.ConfidentialComputeRecord{ - ExecutionNode: fr.ExecutionNode(), + KettleAddress: fr.KettleAddress(), Nonce: 0, To: &isConfidentialAddress, Value: nil, @@ -136,7 +136,7 @@ func TestMempool(t *testing.T) { targetBlock := uint64(16103213) creationTx := types.NewTx(&types.ConfidentialComputeRequest{ ConfidentialComputeRecord: types.ConfidentialComputeRecord{ - ExecutionNode: fr.ExecutionNode(), + KettleAddress: fr.KettleAddress(), }, }) @@ -195,7 +195,7 @@ func TestMempool(t *testing.T) { // Verify via transaction confidentialRequestTx, err := types.SignTx(types.NewTx(&types.ConfidentialComputeRequest{ ConfidentialComputeRecord: types.ConfidentialComputeRecord{ - ExecutionNode: fr.ExecutionNode(), + KettleAddress: fr.KettleAddress(), Nonce: 0, To: &fetchBidsAddress, Value: nil, @@ -499,7 +499,7 @@ func TestMevShare(t *testing.T) { // 3. build share block // 3a. confirm share bundle - fr := newFramework(t, WithExecutionNode()) + fr := newFramework(t, WithKettleAddress()) defer fr.Close() rpc := fr.suethSrv.RPCNode() @@ -514,7 +514,7 @@ func TestMevShare(t *testing.T) { allowedPeekers := []common.Address{{0x41, 0x42, 0x43}, newBlockBidAddress, buildEthBlockAddress, mevShareAddress} bundleBidContractI := sdk.GetContract(mevShareAddress, BundleBidContract.Abi, clt) - _, err := bundleBidContractI.SendTransaction("newBid", []interface{}{targetBlock + 1, allowedPeekers, []common.Address{fr.ExecutionNode()}}, confidentialDataBytes) + _, err := bundleBidContractI.SendTransaction("newBid", []interface{}{targetBlock + 1, allowedPeekers, []common.Address{fr.KettleAddress()}}, confidentialDataBytes) requireNoRpcError(t, err) // 1a. confirm submission @@ -542,7 +542,7 @@ func TestMevShare(t *testing.T) { backrunTx, _, confidentialDataMatchBytes := prepareMevShareBackrun(t, shareBidId) cc := sdk.GetContract(mevShareAddress, MevShareBidContract.Abi, clt) - _, err = cc.SendTransaction("newMatch", []interface{}{targetBlock + 1, allowedPeekers, []common.Address{fr.ExecutionNode()}, shareBidId}, confidentialDataMatchBytes) + _, err = cc.SendTransaction("newMatch", []interface{}{targetBlock + 1, allowedPeekers, []common.Address{fr.KettleAddress()}, shareBidId}, confidentialDataMatchBytes) requireNoRpcError(t, err) block = fr.suethSrv.ProgressChain() @@ -677,7 +677,7 @@ func TestMevShareBundleSenderContract(t *testing.T) { matchTx, _, confidentialDataMatchBytes := prepareMevShareBackrun(t, shareBidId) - txRes, err = bundleSenderContract.SendTransaction("newMatch", []interface{}{targetBlock, allowedPeekers, []common.Address{fr.ExecutionNode()}, shareBidId}, confidentialDataMatchBytes) + txRes, err = bundleSenderContract.SendTransaction("newMatch", []interface{}{targetBlock, allowedPeekers, []common.Address{fr.KettleAddress()}, shareBidId}, confidentialDataMatchBytes) requireNoRpcError(t, err) fr.suethSrv.ProgressChain() @@ -707,7 +707,7 @@ func TestMevShareBundleSenderContract(t *testing.T) { } func TestBlockBuildingPrecompiles(t *testing.T) { - fr := newFramework(t, WithExecutionNode()) + fr := newFramework(t, WithKettleAddress()) defer fr.Close() rpc := fr.suethSrv.RPCNode() @@ -756,7 +756,7 @@ func TestBlockBuildingPrecompiles(t *testing.T) { dummyCreationTx, err := types.SignNewTx(testKey, signer, &types.ConfidentialComputeRequest{ ConfidentialComputeRecord: types.ConfidentialComputeRecord{ - ExecutionNode: fr.ExecutionNode(), + KettleAddress: fr.KettleAddress(), }, }) require.NoError(t, err) @@ -764,7 +764,7 @@ func TestBlockBuildingPrecompiles(t *testing.T) { bid, err := fr.ConfidentialEngine().InitializeBid(types.Bid{ DecryptionCondition: uint64(1), AllowedPeekers: []common.Address{suave.AllowedPeekerAny}, - AllowedStores: []common.Address{fr.ExecutionNode()}, + AllowedStores: []common.Address{fr.KettleAddress()}, Version: "default:v0:ethBundles", }, dummyCreationTx) require.NoError(t, err) @@ -816,7 +816,7 @@ func TestBlockBuildingPrecompiles(t *testing.T) { } func TestBlockBuildingContract(t *testing.T) { - fr := newFramework(t, WithExecutionNode()) + fr := newFramework(t, WithKettleAddress()) defer fr.Close() clt := fr.NewSDKClient() @@ -876,7 +876,7 @@ func TestBlockBuildingContract(t *testing.T) { func TestRelayBlockSubmissionContract(t *testing.T) { skOpt, signingPubkey := WithBlockSigningKeyOpt(t) - fr := newFramework(t, WithExecutionNode(), skOpt) + fr := newFramework(t, WithKettleAddress(), skOpt) defer fr.Close() rpc := fr.suethSrv.RPCNode() @@ -1010,7 +1010,7 @@ func TestRelayBlockSubmissionContract(t *testing.T) { func TestE2E_ForgeIntegration(t *testing.T) { // This end-to-end test ensures that the precompile lifecycle expected in Forge works - fr := newFramework(t, WithExecutionNode()) + fr := newFramework(t, WithKettleAddress()) defer fr.Close() rpcClient := fr.suethSrv.RPCNode() @@ -1071,7 +1071,7 @@ func TestE2E_ForgeIntegration(t *testing.T) { func TestE2EPrecompile_Call(t *testing.T) { // This end-to-end tests that the callx precompile gets called from a confidential request - fr := newFramework(t, WithExecutionNode()) + fr := newFramework(t, WithKettleAddress()) defer fr.Close() clt := fr.NewSDKClient() @@ -1089,14 +1089,14 @@ func TestE2EPrecompile_Call(t *testing.T) { require.Error(t, err) } -func TestE2EExecutionAddressEndpoint(t *testing.T) { - // this end-to-end tests ensures that we can call eth_executionAddress endpoint in a MEVM node +func TestE2EKettleAddressEndpoint(t *testing.T) { + // this end-to-end tests ensures that we can call eth_kettleAddress endpoint in a MEVM node // and return the correct execution address list - fr := newFramework(t, WithExecutionNode()) + fr := newFramework(t, WithKettleAddress()) defer fr.Close() var addrs []common.Address - require.NoError(t, fr.suethSrv.RPCNode().Call(&addrs, "eth_executionAddress")) + require.NoError(t, fr.suethSrv.RPCNode().Call(&addrs, "eth_kettleAddress")) require.NotEmpty(t, addrs) } @@ -1147,22 +1147,22 @@ type framework struct { } type frameworkConfig struct { - executionNode bool + kettleAddress bool redisStoreBackend bool suaveConfig suave.Config } var defaultFrameworkConfig = frameworkConfig{ - executionNode: false, + kettleAddress: false, redisStoreBackend: false, suaveConfig: suave.Config{}, } type frameworkOpt func(*frameworkConfig) -func WithExecutionNode() frameworkOpt { +func WithKettleAddress() frameworkOpt { return func(c *frameworkConfig) { - c.executionNode = true + c.kettleAddress = true } } @@ -1203,7 +1203,7 @@ func newFramework(t *testing.T, opts ...frameworkOpt) *framework { var ethSrv *clientWrapper - if cfg.executionNode { + if cfg.kettleAddress { ethNode, ethEthService := startEthService(t, testEthGenesis, nil) ethEthService.APIs() @@ -1229,7 +1229,7 @@ func newFramework(t *testing.T, opts ...frameworkOpt) *framework { } func (f *framework) NewSDKClient() *sdk.Client { - return sdk.NewClient(f.suethSrv.RPCNode(), testKey, f.ExecutionNode()) + return sdk.NewClient(f.suethSrv.RPCNode(), testKey, f.KettleAddress()) } func (f *framework) ConfidentialStoreBackend() cstore.ConfidentialStorageBackend { @@ -1240,7 +1240,7 @@ func (f *framework) ConfidentialEngine() *cstore.ConfidentialStoreEngine { return f.suethSrv.service.APIBackend.SuaveEngine() } -func (f *framework) ExecutionNode() common.Address { +func (f *framework) KettleAddress() common.Address { return f.suethSrv.service.AccountManager().Accounts()[0] } diff --git a/suave/sdk/sdk.go b/suave/sdk/sdk.go index dcf856c210..c04b69ca04 100644 --- a/suave/sdk/sdk.go +++ b/suave/sdk/sdk.go @@ -66,7 +66,7 @@ func (c *Contract) SendTransaction(method string, args []interface{}, confidenti computeRequest, err := types.SignTx(types.NewTx(&types.ConfidentialComputeRequest{ ConfidentialComputeRecord: types.ConfidentialComputeRecord{ - ExecutionNode: c.client.execNode, + KettleAddress: c.client.kettleAddress, Nonce: nonce, To: &c.addr, Value: nil, @@ -135,16 +135,16 @@ func (t *TransactionResult) Hash() common.Hash { } type Client struct { - rpc *ethclient.Client - key *ecdsa.PrivateKey - execNode common.Address + rpc *ethclient.Client + key *ecdsa.PrivateKey + kettleAddress common.Address } -func NewClient(rpc *rpc.Client, key *ecdsa.PrivateKey, execNode common.Address) *Client { +func NewClient(rpc *rpc.Client, key *ecdsa.PrivateKey, kettleAddress common.Address) *Client { c := &Client{ - rpc: ethclient.NewClient(rpc), - key: key, - execNode: execNode, + rpc: ethclient.NewClient(rpc), + key: key, + kettleAddress: kettleAddress, } return c }