mojtaba-eshghie / HighGuard

The runtime monitoring tool for smart contracts high-level properties.
https://arxiv.org/abs/2305.08254
MIT License
5 stars 2 forks source link

A violation should lead to a violated trace (not just a violation step) #73

Closed mojtaba-eshghie closed 2 months ago

mojtaba-eshghie commented 2 months ago

If in a simulation (monitoring) job, a violation happens, the trace should always be a violated trace. The behavior now is that a violation transaction leads to only violation step. In the trace example below, the third transaction is considered violation: false wherease it should still be deemed a violation (the wrong order of activities).


The retrieved activity using the translator is:  [ { activityId: 'getGreeted', dcrValue: null, dcrType: null } ]
Trying to execute the following DCR activity
requestBody: {}
nextEventAddress: https://repository.dcrgraphs.net/api/graphs/1702173/sims/1946477/events/getGreeted
DCR Activity executed: {
  name: 'getGreeted',
  time: 'Thu, 07 Mar 2024 13:54:35 GMT',
  violation: true
}

The retrieved activity using the translator is:  [ { activityId: 'getGreeted', dcrValue: null, dcrType: null } ]
Trying to execute the following DCR activity
requestBody: {}
nextEventAddress: https://repository.dcrgraphs.net/api/graphs/1702173/sims/1946477/events/getGreeted
DCR Activity executed: {
  name: 'getGreeted',
  time: 'Thu, 07 Mar 2024 13:54:50 GMT',
  violation: true
}

The retrieved activity using the translator is:  [ { activityId: 'setGreet', dcrValue: null, dcrType: null } ]
Trying to execute the following DCR activity
requestBody: {}
nextEventAddress: https://repository.dcrgraphs.net/api/graphs/1702173/sims/1946477/events/setGreet
DCR Activity executed: {
  name: 'setGreet',
  time: 'Thu, 07 Mar 2024 13:55:23 GMT',
  violation: false
}
mojtaba-eshghie commented 2 months ago

The commit resolves this through https://github.com/mojtaba-eshghie/HighGuard/commit/0ee1e74fbb99d0f5b43fc0f7234561d0fcfe0b52

activity2 (violation:true) -> activity1 (violation:false) -> activity3 (violation:false)

It is just easily possible to count on the whole trace exactly from the point we have the first violation.