From a3c899d6245a5d9792af12614806d6be3b6e7d23 Mon Sep 17 00:00:00 2001 From: dmarzzz Date: Thu, 16 Nov 2023 14:49:10 +0300 Subject: [PATCH 1/2] add maxBlock to sbundle --- core/types/sbundle.go | 6 +++++- core/vm/contracts_suave_eth.go | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/core/types/sbundle.go b/core/types/sbundle.go index cbe2dbc2a..c88dd4f3b 100644 --- a/core/types/sbundle.go +++ b/core/types/sbundle.go @@ -12,6 +12,7 @@ import ( type SBundle struct { BlockNumber *big.Int `json:"blockNumber,omitempty"` // if BlockNumber is set it must match DecryptionCondition! + MaxBlock *big.Int `json:"maxBlock,omitempty"` Txs Transactions `json:"txs"` RevertingHashes []common.Hash `json:"revertingHashes,omitempty"` RefundPercent *int `json:"percent,omitempty"` @@ -19,6 +20,7 @@ type SBundle struct { type RpcSBundle struct { BlockNumber *hexutil.Big `json:"blockNumber,omitempty"` + MaxBlock *hexutil.Big `json:"maxBlock,omitempty"` Txs []hexutil.Bytes `json:"txs"` RevertingHashes []common.Hash `json:"revertingHashes,omitempty"` RefundPercent *int `json:"percent,omitempty"` @@ -66,6 +68,7 @@ func (s *SBundle) UnmarshalJSON(data []byte) error { } s.BlockNumber = (*big.Int)(rpcSBundle.BlockNumber) + s.MaxBlock = (*big.Int)(rpcSBundle.MaxBlock) s.Txs = txs s.RevertingHashes = rpcSBundle.RevertingHashes s.RefundPercent = rpcSBundle.RefundPercent @@ -76,7 +79,8 @@ func (s *SBundle) UnmarshalJSON(data []byte) error { type RPCMevShareBundle struct { Version string `json:"version"` Inclusion struct { - Block string `json:"block"` + Block string `json:"block"` + MaxBlock string `json:"maxBlock"` } `json:"inclusion"` Body []struct { Tx string `json:"tx"` diff --git a/core/vm/contracts_suave_eth.go b/core/vm/contracts_suave_eth.go index 80e1c1f88..0e21f8838 100644 --- a/core/vm/contracts_suave_eth.go +++ b/core/vm/contracts_suave_eth.go @@ -454,6 +454,7 @@ func (c *suaveRuntime) fillMevShareBundle(bidId types.BidId) ([]byte, error) { } shareBundle.Inclusion.Block = hexutil.EncodeUint64(bid.DecryptionCondition) + shareBundle.Inclusion.Block = hexutil.EncodeUint64(bid.DecryptionCondition + 25) // Assumes 25 block inclusion range for _, tx := range append(userBundle.Txs, matchBundle.Txs...) { txBytes, err := tx.MarshalBinary() From 462e1c1acefc1425955aed478822528a2005863d Mon Sep 17 00:00:00 2001 From: dmarzzz Date: Thu, 16 Nov 2023 15:53:16 +0300 Subject: [PATCH 2/2] fix incorrect setting --- core/vm/contracts_suave_eth.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/vm/contracts_suave_eth.go b/core/vm/contracts_suave_eth.go index 0e21f8838..ac2b9be5f 100644 --- a/core/vm/contracts_suave_eth.go +++ b/core/vm/contracts_suave_eth.go @@ -454,7 +454,7 @@ func (c *suaveRuntime) fillMevShareBundle(bidId types.BidId) ([]byte, error) { } shareBundle.Inclusion.Block = hexutil.EncodeUint64(bid.DecryptionCondition) - shareBundle.Inclusion.Block = hexutil.EncodeUint64(bid.DecryptionCondition + 25) // Assumes 25 block inclusion range + shareBundle.Inclusion.MaxBlock = hexutil.EncodeUint64(bid.DecryptionCondition + 25) // Assumes 25 block inclusion range for _, tx := range append(userBundle.Txs, matchBundle.Txs...) { txBytes, err := tx.MarshalBinary()