Skip to content

Commit

Permalink
rm prove message received
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberhorsey committed Apr 1, 2024
1 parent 55c91d5 commit ffe7867
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 36 deletions.
1 change: 0 additions & 1 deletion packages/relayer/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ type Bridge interface {
FilterMessageReceived(opts *bind.FilterOpts, msgHash [][32]byte) (*bridge.BridgeMessageReceivedIterator, error)
MessageStatus(opts *bind.CallOpts, msgHash [32]byte) (uint8, error)
ProcessMessage(opts *bind.TransactOpts, _message bridge.IBridgeMessage, _proof []byte) (*types.Transaction, error)
ProveMessageReceived(opts *bind.CallOpts, _message bridge.IBridgeMessage, _proof []byte) (bool, error)
FilterMessageStatusChanged(
opts *bind.FilterOpts,
msgHash [][32]byte,
Expand Down
12 changes: 0 additions & 12 deletions packages/relayer/pkg/mock/bridge.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,6 @@ func (b *Bridge) ProcessMessage(
return ProcessMessageTx, nil
}

func (b *Bridge) ProveMessageReceived(
opts *bind.CallOpts,
_message bridge.IBridgeMessage,
_proof []byte,
) (bool, error) {
if _message.Id.Uint64() == SuccessId.Uint64() {
return true, nil
}

return false, nil
}

func (b *Bridge) ParseMessageSent(log types.Log) (*bridge.BridgeMessageSent, error) {
return &bridge.BridgeMessageSent{}, nil
}
Expand Down
26 changes: 3 additions & 23 deletions packages/relayer/processor/process_message.go
Original file line number Diff line number Diff line change
Expand Up @@ -417,28 +417,6 @@ func (p *Processor) generateEncodedSignalProof(ctx context.Context,
return nil, errors.Wrap(err, "p.prover.GetEncodedSignalProof")
}

// check if message is received first. if not, it will definitely fail,
// so we can exit early on this one. there is most likely
// an issue with the signal generation.
received, err := p.destBridge.ProveMessageReceived(&bind.CallOpts{
Context: ctx,
}, event.Message, encodedSignalProof)
if err != nil {
return nil, errors.Wrap(err, "p.destBridge.ProveMessageReceived")
}

// message will fail when we try to process it
if !received {
slog.Warn("Message not received on dest chain",
"msgHash", common.Hash(event.MsgHash).Hex(),
"srcChainId", event.Message.SrcChainId,
)

relayer.MessagesNotReceivedOnDestChain.Inc()

return nil, errors.New("message not received")
}

return encodedSignalProof, nil
}

Expand Down Expand Up @@ -712,11 +690,13 @@ func (p *Processor) getCost(ctx context.Context, gas uint64, gasTipCap *big.Int,
if p.taikoL2 != nil {
gasUsed := uint32(blk.GasUsed())
timeSince := uint64(time.Since(time.Unix(int64(blk.Time()), 0)))
baseFee, err = p.taikoL2.GetBasefee(&bind.CallOpts{Context: ctx}, timeSince, gasUsed)
bf, err := p.taikoL2.GetBasefee(&bind.CallOpts{Context: ctx}, timeSince, gasUsed)

if err != nil {
return nil, errors.Wrap(err, "p.taikoL2.GetBasefee")
}

baseFee = bf.Basefee
} else {
cfg := params.NetworkIDToChainConfigOrDefault(p.destChainId)
baseFee = eip1559.CalcBaseFee(cfg, blk.Header())
Expand Down

0 comments on commit ffe7867

Please sign in to comment.