input-output-hk / decentralized-software-updates

Research on a decentralized software update mechanism for blockchain systems
Apache License 2.0
7 stars 2 forks source link

Define safety and liveness tests for the update system prototype #148

Closed dnadales closed 4 years ago

dnadales commented 4 years ago
      -- If the proposal was queued it must be because it cannot __yet__ follow
      -- the current version, or there is a candidate proposal with higher or
      -- the same priority.
      ( getCurrentProtocolVersion (firstState fragment')
           <! supersedesVersion (getProtocol updateSpec)
        ||!
        exists (filter ((/= _id (getProtocol updateSpec)) . _id)
                 $ Update.candidateProtocols (firstState fragment')
               )
             (\protocol ->
                version protocol <=! version (getProtocol updateSpec)))

That test failed because there was a candidate in the queue that superseded the same version as the current version, but it superseded a different id as the current version.

 cannotFollowCurrentVersion       =
      protocolSupersedesVersion < State.getCurrentProtocolVersion st
      ||
      (protocolSupersedesVersion == State.getCurrentProtocolVersion st
      && supersedesId protocol   /= State.getCurrentProtocolId st
      )

We added the supersedesId protocol /= State.getCurrentProtocolId st check.