From fe73d2c9a24c7389b419b8c16d7f01709916f258 Mon Sep 17 00:00:00 2001 From: dmarz Date: Mon, 11 Dec 2023 18:44:38 +0800 Subject: [PATCH] add maxBlock to sbundle (#102) * add maxBlock to sbundle * fix incorrect setting --- 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 cbe2dbc2a5..c88dd4f3bc 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 80e1c1f88f..ac2b9be5f7 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.MaxBlock = hexutil.EncodeUint64(bid.DecryptionCondition + 25) // Assumes 25 block inclusion range for _, tx := range append(userBundle.Txs, matchBundle.Txs...) { txBytes, err := tx.MarshalBinary()