diff --git a/pkg/contracts/preconf/preconf.go b/pkg/contracts/preconf/preconf.go index 328b8c9..dfdd9c7 100644 --- a/pkg/contracts/preconf/preconf.go +++ b/pkg/contracts/preconf/preconf.go @@ -128,11 +128,11 @@ func (p *preconfContract) OpenCommitment( callData, err := p.preconfABI.Pack( "openCommitment", eciBytes, - bidAmt, - big.NewInt(blockNumber), + bidAmt.Uint64(), + big.NewInt(blockNumber).Uint64(), txnHash, - big.NewInt(decayStartTimeStamp), - big.NewInt(decayEndTimeStamp), + big.NewInt(decayStartTimeStamp).Uint64(), + big.NewInt(decayEndTimeStamp).Uint64(), bidSignature, commitmentSignature, sharedSecretKey, @@ -142,7 +142,7 @@ func (p *preconfContract) OpenCommitment( return common.Hash{}, err } - _, err = p.client.Send(ctx, &evmclient.TxRequest{ + txHash, err := p.client.Send(ctx, &evmclient.TxRequest{ To: &p.preconfContractAddr, CallData: callData, }) @@ -150,5 +150,5 @@ func (p *preconfContract) OpenCommitment( return common.Hash{}, err } - return common.Hash{}, fmt.Errorf("commitmentIndex not found in transaction receipt") + return txHash, nil } diff --git a/pkg/preconfirmation/preconfirmation.go b/pkg/preconfirmation/preconfirmation.go index a79f5fc..d18ce07 100644 --- a/pkg/preconfirmation/preconfirmation.go +++ b/pkg/preconfirmation/preconfirmation.go @@ -352,7 +352,7 @@ func (p *Preconfirmation) HandleNewL1BlockEvent(ctx context.Context, event block p.logger.Info("New L1 Block event received", "blockNumber", event.BlockNumber, "winner", event.Winner, "window", event.Window) // todo: for provider check if winner == providerAddress, for bidder if committerAddress for _, commitment := range p.commitmentByBlockNumber[event.BlockNumber.Int64()] { - _, err := p.commitmentDA.OpenCommitment( + txHash, err := p.commitmentDA.OpenCommitment( ctx, commitment.EncryptedPreConfirmation.CommitmentIndex, commitment.PreConfirmation.Bid.BidAmount, @@ -368,7 +368,7 @@ func (p *Preconfirmation) HandleNewL1BlockEvent(ctx context.Context, event block p.logger.Error("Failed to open commitment", "error", err) continue } else { - p.logger.Info("Opened commitment", "txHash", commitment.PreConfirmation.Bid.TxHash) + p.logger.Info("Opened commitment", "txHash", txHash) } } delete(p.commitmentByBlockNumber, event.BlockNumber.Int64())