Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions mev-boost-relay/mev-boost-relay.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"io"
"log"
"math/big"
"net"
"net/http"
"os"
Expand Down Expand Up @@ -109,7 +110,7 @@ func New(config *Config) (*MevBoostRelay, error) {
}

// create the mockDB
pqDB := newInmemoryDB()
pqDB := newInmemoryDB(log)

// datastore
ds, err := datastore.NewDatastore(redis, nil, pqDB)
Expand Down Expand Up @@ -169,6 +170,7 @@ func New(config *Config) (*MevBoostRelay, error) {
ProposerAPI: true,
BlockBuilderAPI: true,
DataAPI: true,
InternalAPI: true,
}
apiSrv, err := api.NewRelayAPI(apiOpts)
if err != nil {
Expand Down Expand Up @@ -283,18 +285,23 @@ func startMockBlockValidationServiceServer() (string, error) {
type inmemoryDB struct {
*database.MockDB

log *logrus.Entry

validatorRegistryEntriesLock sync.Mutex
validatorRegistryEntries map[string]*database.ValidatorRegistrationEntry

deliveredPayloadsLock sync.Mutex
deliveredPayloads []*database.DeliveredPayloadEntry
}

func newInmemoryDB() *inmemoryDB {
func newInmemoryDB(log *logrus.Entry) *inmemoryDB {
return &inmemoryDB{
MockDB: &database.MockDB{},
MockDB: &database.MockDB{
Builders: make(map[string]*database.BlockBuilderEntry),
},
validatorRegistryEntries: make(map[string]*database.ValidatorRegistrationEntry),
deliveredPayloads: make([]*database.DeliveredPayloadEntry, 0),
log: log,
}
}

Expand Down Expand Up @@ -354,6 +361,16 @@ func (i *inmemoryDB) SaveDeliveredPayload(bidTrace *common.BidTraceV2WithBlobFie
i.deliveredPayloadsLock.Lock()
defer i.deliveredPayloadsLock.Unlock()

builderPubKey := bidTrace.BuilderPubkey.String()
if _, ok := i.MockDB.Builders[builderPubKey]; !ok {
i.MockDB.Builders[builderPubKey] = &database.BlockBuilderEntry{
BuilderPubkey: builderPubKey,
Collateral: big.NewInt(0).Set(bidTrace.Value.ToBig()).String() + "000",
IsOptimistic: true,
}
i.log.WithField("pubkey", builderPubKey).Info("saved builder")
}
Comment thread
canercidam marked this conversation as resolved.
Comment thread
canercidam marked this conversation as resolved.

_signedBlindedBeaconBlock, err := json.Marshal(signedBlindedBeaconBlock)
if err != nil {
return err
Expand Down
2 changes: 1 addition & 1 deletion playground/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (

var (
defaultJWTToken = "04592280e1778419b7aa954d43871cb2cfb2ebda754fb735e8adeb293a88f9bf"
latestPlaygroundUtilsTag = "cc6f172493d7ef6b88a5b7895f4b8619806c99f9"
latestPlaygroundUtilsTag = "07ec800c3651b05ef1946c38b8d04745946818c7"
)

type RollupBoost struct {
Expand Down