Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

Commit

Permalink
fix!: dirty hack to signing successfully the first data commitment ra…
Browse files Browse the repository at this point in the history
…nge (#340)

* fix!: dirty hack to signing successfully the first data commitment range

* chore: update also the E2E test

* chore: update also the relayer

* chore: remaining changes
  • Loading branch information
rach-id authored May 4, 2023
1 parent 765ef7d commit efeed21
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/qgb/query/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,9 @@ func getSignaturesAndPrintThem(
if !ok {
return errors.Wrap(types.ErrAttestationNotDataCommitmentRequest, strconv.FormatUint(nonce, 10))
}
if dc.BeginBlock == 0 {
dc.BeginBlock = 1
}
commitment, err := tmQuerier.QueryCommitment(
ctx,
dc.BeginBlock,
Expand Down
9 changes: 9 additions & 0 deletions e2e/qgb_network.go
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,9 @@ func (network QGBNetwork) WaitForOrchestratorToStart(_ctx context.Context, dht *
if !ok {
continue
}
if dc.BeginBlock == 0 {
dc.BeginBlock = 1
}
commitment, err := tmQuerier.QueryCommitment(ctx, dc.BeginBlock, dc.EndBlock)
if err != nil {
continue
Expand Down Expand Up @@ -660,6 +663,9 @@ func (network QGBNetwork) GetDataCommitmentConfirmByHeight(
if err != nil {
return nil, err
}
if attestation.BeginBlock == 0 {
attestation.BeginBlock = 1
}
dcConfirm, err := network.GetDataCommitmentConfirm(_ctx, dht, attestation.Nonce, evmAddr)
if err != nil {
return nil, err
Expand Down Expand Up @@ -748,6 +754,9 @@ func (network QGBNetwork) WasAttestationSigned(
if !ok {
continue
}
if dc.BeginBlock == 0 {
dc.BeginBlock = 1
}
commitment, err := tmQuerier.QueryCommitment(ctx, dc.BeginBlock, dc.EndBlock)
if err != nil {
continue
Expand Down
3 changes: 3 additions & 0 deletions orchestrator/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,9 @@ func (orch Orchestrator) Process(ctx context.Context, nonce uint64) error {
if !ok {
return errors.Wrap(types.ErrAttestationNotDataCommitmentRequest, strconv.FormatUint(nonce, 10))
}
if dc.BeginBlock == 0 {
dc.BeginBlock = 1
}
commitment, err := orch.TmQuerier.QueryCommitment(
ctx,
dc.BeginBlock,
Expand Down
3 changes: 3 additions & 0 deletions relayer/relayer.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,9 @@ func (r *Relayer) ProcessAttestation(ctx context.Context, opts *bind.TransactOpt
if !ok {
return nil, ErrAttestationNotDataCommitmentRequest
}
if dc.BeginBlock == 0 {
dc.BeginBlock = 1
}
valset, err := r.AppQuerier.QueryLastValsetBeforeNonce(ctx, dc.Nonce)
if err != nil {
return nil, err
Expand Down
3 changes: 3 additions & 0 deletions rpc/app_querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ func (aq *AppQuerier) QueryDataCommitmentByNonce(ctx context.Context, nonce uint
return nil, types.ErrAttestationNotDataCommitmentRequest
}

if dcc.BeginBlock == 0 {
dcc.BeginBlock = 1
}
return dcc, nil
}

Expand Down

0 comments on commit efeed21

Please sign in to comment.