-
Notifications
You must be signed in to change notification settings - Fork 491
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
CI: ensure msgp generator has been run and is clean #3978
Conversation
scripts/buildtools/go.sum
Outdated
@@ -23,6 +23,8 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy | |||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= | |||
github.com/algorand/msgp v1.1.50 h1:Mvsjs5LCE6HsXXbwJXD8ol1Y+c+QMoFNM4j0CY+mFGo= |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
go mod tidy to remove the old version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried and it cleared out all of go.mod! I guess all of these packages are unused. TBH I'm not really sure long-term whether it is a good idea to keep installing CLI tools this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see now that install_buildtools.sh is just grepping go.mod to pull version numbers, so I changed it to a flat text file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does that make it harder to create though? Presumably it was created my some go tool automatically, but the versions
file will need to be edited by hand. Could it grep the root go.mod instead? I don't really know what this one is, how it was made, or why it might differ.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO it is much easier to maintain a simple "versions" file now by hand — I would even be OK to just move the tool versions into install_buildtools.sh directly, as it's the only user. The reason it's not in root go.mod is because these tools are not dependencies of go-algorand. (They don't even really need to be implemented in go — they're just CLI tools to install)
if err != nil { | ||
err = msgp.WrapError(err, "struct-from-array", "Sha256Commitment") | ||
err = msgp.WrapError(err, "struct-from-array", "NativeSha512_256Commitment") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Aharonee @algoidan wanted to makes sure this was as expected?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I know what happened.
04814e1
(#3829)
This is the commit where I've renamed the TxnRoot
to TxnCommitments
, and its nested fields.
While doing that I've regenerated msgp, but after noticing the fields in TxnCommitments
where no longer in alphabetical order, I swapped them.
TxnCommitments struct {
_struct struct{} `codec:",omitempty,omitemptyarray"`
Sha256Commitment crypto.Digest `codec:"txn256"`
NativeSha512_256Commitment crypto.Digest `codec:"txn"`
to
TxnCommitments struct {
_struct struct{} `codec:",omitempty,omitemptyarray"`
NativeSha512_256Commitment crypto.Digest `codec:"txn"`
Sha256Commitment crypto.Digest `codec:"txn256"`
This doesn't break any tests of course, and wasn't caught the the codegen_verification
script, but when generating msgp after this change the resulting code will be different (it seems to be generated in a sequential manner) even though its logic is identical.
Any idea why it complains about protocol now?
|
I am trying to figure it out still, but yes.. something is weird about running make msgp in CircleCI.. even when I ssh into the CircleCI VM and run it manually it works ... |
Look, the msgp's master misses it: writeImportHeader(
testbuf,
"github.com/algorand/msgp/msgp", "github.com/algorand/go-algorand/test/partitiontest", "testing") |
I think |
@algorandskiy see in the latest commit, even after downgrading msgp to the old version the protocol package is not detected. However again when I ssh in and rerun msgp manually I can get it to work (and also locally). There is something strange about the environment in CircleCI. But perhaps the easiest thing to do is to just add the protocol import to the msgp generator. |
This reverts commit db418d9.
Updated msgp to explicitly import missing package: algorand/msgp#17 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM but why did scripts/buildtools/go.mod
and go.sum
go?
@algorandskiy we don't have any go code in that directory, so "go mod tidy" stopped working in there (it detected no dependencies) and we are only using go.mod to track a few version numbers used by a single shell script (install_buildtools.sh), so I switched it to use a text file containing those numbers instead. |
Codecov Report
@@ Coverage Diff @@
## master #3978 +/- ##
==========================================
+ Coverage 49.77% 49.82% +0.04%
==========================================
Files 409 409
Lines 69157 69157
==========================================
+ Hits 34426 34460 +34
+ Misses 31011 30983 -28
+ Partials 3720 3714 -6
Continue to review full report at Codecov.
|
This should ensure make msgp has been run for changes that impact msgp serialization on CI builds. It looks like algorand#3829 was merged but missed changes to agreement/msgp_gen.go and gci updates from algorand/msgp#14 were not incorporated into algorand#3919.
Summary
This should ensure
make msgp
has been run for changes that impact msgp serialization on CI builds.It looks like #3829 was merged but missed changes to agreement/msgp_gen.go and gci updates from algorand/msgp#14 were not incorporated into #3919.
Test Plan
Tests should fail in the codgen_verification.sh job for the first build on this PR, then should pass after a commit is pushed that updates the msgp-generated files with the latest on master.