Skip to content

Commit

Permalink
add maxBlock to sbundle (#102)
Browse files Browse the repository at this point in the history
* add maxBlock to sbundle

* fix incorrect setting
  • Loading branch information
dmarzzz authored Dec 11, 2023
1 parent 11f4230 commit fe73d2c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion core/types/sbundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,15 @@ 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"`
}

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"`
Expand Down Expand Up @@ -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
Expand All @@ -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"`
Expand Down
1 change: 1 addition & 0 deletions core/vm/contracts_suave_eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit fe73d2c

Please sign in to comment.