-
Notifications
You must be signed in to change notification settings - Fork 1
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
enable custom go linter in CI #25
Conversation
2fe3a82
to
2d67a67
Compare
resolves #7 |
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.
Just one comment - otherwise LGTM
eigenda/eigenda.go
Outdated
if !config.Enable { | ||
panic("EigenDA is not enabled") | ||
} |
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.
why panic versus bubbling error up -- also given that there's a precursor check performed within the caller for the Enable
flag we can probably get rid of this
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.
Agreed, updated to bubbling error up.
This check exists purely because of the linter's complain that Enable
hasn't been used even with the caller's check, more detailed reasoning is in the PR comments, happy to learn about alternatives 🤔
func (b BlobVerificationProof) IsEmpty() bool { | ||
return b.BatchID == 0 && | ||
b.BlobIndex == 0 && | ||
b.BatchMetadata.IsEmpty() && | ||
len(b.InclusionProof) == 0 && | ||
len(b.QuorumIndices) == 0 | ||
} | ||
|
||
// IsEmpty checks if BatchMetadata is effectively empty | ||
func (bm BatchMetadata) IsEmpty() bool { | ||
return bm.BatchHeader.IsEmpty() && | ||
len(bm.Fee) == 0 && | ||
bm.SignatoryRecordHash == [32]byte{} && | ||
bm.ConfirmationBlockNumber == 0 && | ||
len(bm.BatchHeaderHash) == 0 | ||
} | ||
|
||
// IsEmpty checks if BatchHeader is effectively empty | ||
func (bh BatchHeader) IsEmpty() bool { | ||
return bh.BlobHeadersRoot == [32]byte{} && | ||
len(bh.QuorumNumbers) == 0 && | ||
len(bh.SignedStakeForQuorums) == 0 && | ||
bh.ReferenceBlockNumber == 0 |
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.
keep meaning to refactor this type conversions - ty! 🙏🏻
eigenda/reader.go
Outdated
@@ -35,11 +35,10 @@ func (d *readerForEigenDA) RecoverPayloadFromBatch( | |||
preimageRecorder daprovider.PreimageRecorder, | |||
validateSeqMsg bool, | |||
) ([]byte, error) { | |||
// offset sequencer message at 41 | |||
// offset sequencer message at 41 |
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.
we can prolly do without these comments
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.
cool! I removed the comments but added a constant SequencerMsgOffset
to hold 41
for clearer usage
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
(disclaimer: I'm not usually this talkative with PR comments, being unusual because I'm new and trying to become familiar with things)
This PR contains minor refactoring to make the linter happy
For the custom
go run ./linters ./...
, the only complain wasAs a new gopher, I've tried using
unused: ignore-field
in.golang.ci.yml
, addingused:"true"
as part of field definitions,//nolint:unused
to disable check for the config struct, modifying the structinit.go analyzer, but nothing worked until I made a dumb initializer for the struct 🤦 If I'm missing anything obvious, please let me know and I will make smarter changes.So then, reviewing that
EigenDAConfig
is only used for initializingEigenDAClient
, I think it makes sense to have arbnode pass in the config struct instead of only theRPC
field. If we want more granular control of client initailization in the future, this change is probably in the right direction. Also included an additional/duplicate check forEnable
to make linter happy; I think we can delete this check in arbnode, but I'm nervous about safety in golanggolangci-lint
a couple of failures there, change explanations:
all files got
go fmt
ed.go sec
^ this is okay when updated local to 1.59.1
go critic
errorlint
govet
🤞 let's see if CI will pass