babylonlabs-io / babylon-contract

CosmWasm smart contracts for Babylon integration
Other
10 stars 6 forks source link

OP: validate `num_pub_rand` in handle_public_randomness_commit() #20

Open maurolacy opened 3 months ago

maurolacy commented 3 months ago

@bap2pecs cloned issue babylonchain/babylon-contract#186 on 2024-06-23:

in FP, we will add logic in fast sync:


      for lastCommitStartHeight, val := range lastCommitPR {

          if endHeight > lastCommitStartHeight+val.NumPubRand-1 {

              return nil, nil

          }

      }

if both lastCommitStartHeight and val.NumPubRand is 0, integer underflow can happen.

but in reality, we shouldn't allow NumPubRand to be 0. it should at least have 1 pubrand.

we should enforce this check in the CW contract

maurolacy commented 3 months ago

@bap2pecs commented on 2024-07-08:

closing for https://www.github.com/babylonchain/pm-integration/issues/5