Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Viper data collection changes #751

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

Simon-Hostettler
Copy link

This PR contains changes to facilitate submissions to the Viper data collection server.

  • Added a submitForEvaluation flag to the config
  • Added submitters to GoVerifier

@@ -765,6 +771,13 @@ class ScallopGobraConfig(arguments: Seq[String], isInputOptional: Boolean = fals
default = Some(ConfigDefaults.DefaultDisableSetAxiomatization),
noshort = true,
)

val submitForEvaluation = opt[Boolean](name = "submitForEvaluation",
descr = "Whether to allow storing the current program for future evaluation.",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
descr = "Whether to allow storing the current program for future evaluation.",
descr = "Upload the verified program to Gobra's servers. This information will be used to improve Gobra.",

(I think there is already a variable for the tool name, we can use that directly instead of hardcoding "Gobra")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding a sentence saying that we collect only the program and no other information would also be important.

Comment on lines +93 to +94
case CarbonBackend => "Carbon"
case SiliconBackend => "Silicon"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not exhaustive. What if we have a viper server with silicon or carbon?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, we should extend the trait ViperBackend with an extra method or field of type string named name and use it instead, instead of matching on all available ones.

@@ -51,6 +56,8 @@ object GoVerifier {

trait GoVerifier extends StrictLogging {

protected var submitters: Map[String, ManualProgramSubmitter] = Map()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add some documentation on this? what is the purpose of this field? what are the keys and the values?

@@ -275,6 +279,7 @@ case class BaseConfig(gobraDirectory: Path = ConfigDefaults.DefaultGobraDirector
case _ => Some(positions.toVector)
}
}
def allowSubmission: Boolean = submitForEvaluation && !shouldChop
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why can't we submit chopped programs?

val timeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss");
config.packageInfoInputMap.keys.foreach(pkgInfo => {
val pkgId = pkgInfo.id

//adds a submitter for this package to submitters if config.submitForEvaluation is set, key is pkgId
Copy link
Contributor

@jcp19 jcp19 Mar 30, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks like the wrong place for this comment. Sth like this should be in createSubmitter and and the description of what we store in keys/values should be on the declaration of submitters

@@ -143,6 +165,13 @@ trait GoVerifier extends StrictLogging {
if (allErrors.isEmpty) VerifierResult.Success else VerifierResult.Failure(allErrors)
}

private def createSubmitter(allowSubmission: Boolean, id: String, verifier: String): Unit = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should make the signature of createSubmitter by having verifier of type ViperBackend. We could obtain a the name using the name field that I suggested.

s.setSuccess(result == VerifierResult.Success)
s.submit()}
)
submitters = submitters.removed(pkgId)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we removing this here?

@@ -143,6 +165,13 @@ trait GoVerifier extends StrictLogging {
if (allErrors.isEmpty) VerifierResult.Success else VerifierResult.Failure(allErrors)
}

private def createSubmitter(allowSubmission: Boolean, id: String, verifier: String): Unit = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe a better name would be registerSubmitter

@@ -143,6 +165,13 @@ trait GoVerifier extends StrictLogging {
if (allErrors.isEmpty) VerifierResult.Success else VerifierResult.Failure(allErrors)
}

private def createSubmitter(allowSubmission: Boolean, id: String, verifier: String): Unit = {
if (allowSubmission) {
val submitter = new ManualProgramSubmitter(true, "", "Gobra", verifier, Array())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are we actually submitting anything if the second parameter is always ""?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw, I find it a bit odd that we have a flag ProgramSubmitter has a field allowSubmission. Maybe I misunderstand its purpose, but if this object was registered, it should be submitted. Otherwise, we should not register it. I don't see the need for this field.

@jcp19 jcp19 marked this pull request as draft May 20, 2024 08:53
@jcp19
Copy link
Contributor

jcp19 commented Sep 4, 2024

@Dspil is this still relevant, or shall I close it?

@Dspil
Copy link
Contributor

Dspil commented Sep 4, 2024

It is, just not very high in my todo list.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants