-
Notifications
You must be signed in to change notification settings - Fork 19
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
integrate ACP-118 #408
integrate ACP-118 #408
Conversation
40ef7a5
to
c46fc41
Compare
reqBytes, err = msg.RequestToBytes(codec, req) | ||
} | ||
reqBytes, err := proto.Marshal( | ||
&sdk.SignatureRequest{Message: unsignedMessage.Bytes()}, |
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 should add justification bytes here as well as the API. In the API they should be hex encoded and since their meaning is VM specific we don't need to do any processing to them either just like with the message. We should only pass the non-zero fields since the ACP-118 spec but in the API layer we should do validation that at least one of message
, justification
fields is non-zero.
I would also rename our API to use Message
instead of UnsignedMessage
to match the ACP-118 spec while we are at it
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.
addressed in 557262a
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.
This isn't done yet. I added the justification everywhere (in the API) except for right here 😅
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.
last piece addressed in 29cac30
addresses review comment #408 (comment)
…signature-aggregation-api-acp-118
…signature-aggregation-api-acp-118
…signature-aggregation-api-acp-118
reqBytes, err = msg.RequestToBytes(codec, req) | ||
} | ||
reqBytes, err := proto.Marshal( | ||
&sdk.SignatureRequest{Message: unsignedMessage.Bytes()}, |
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.
This isn't done yet. I added the justification everywhere (in the API) except for right here 😅
Co-authored-by: cam-schultz <[email protected]> Signed-off-by: Ian Suvak <[email protected]>
Co-authored-by: Geoff Stuart <[email protected]> Signed-off-by: Ian Suvak <[email protected]>
@feuGeneA is this PR still relevant? |
…ersions.sh" This reverts commit 47cfef6.
Add `etna-time` configs
addresses review comment #408 (comment)
9a0224b
to
6cd8245
Compare
@@ -43,6 +44,7 @@ func instantiateAggregator(t *testing.T) ( | |||
1024, | |||
sigAggMetrics, | |||
messageCreator, | |||
time.Now().Add(-1*time.Minute), |
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.
What's the purpose of the -1 minute?
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.
This is the etnaTime
parameter. This would make the aggregator in this test run using the post-etna code paths since in this case Etna
was activated a minute ago
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.
A comment clarifying this would be helpful
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.
@@ -67,6 +68,9 @@ type Config struct { | |||
DeciderURL string `mapstructure:"decider-url" json:"decider-url"` | |||
SignatureCacheSize uint64 `mapstructure:"signature-cache-size" json:"signature-cache-size"` | |||
|
|||
// mapstructure doesn't handle time.Time out of the box so handle it manually | |||
EtnaTime time.Time `json:"etna-time"` |
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 could take in a string as well and use time.Parse
in a date foramt
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 like that the v.GetTime()
call will handle both RFC3339 format as well as UNIX timestamps cleanly and output it unambiguously when being written out.
With time.Parse
we would need to manually handle conversion when writing it out to disk and reading it separately.
signature-aggregator/api/api.go
Outdated
if err != nil { | ||
msg := "Error unpacking warp message" | ||
logger.Warn(msg, zap.Error(err)) | ||
writeJSONError(logger, w, msg) | ||
return | ||
} | ||
|
||
justification, err := hex.DecodeString( | ||
strings.TrimPrefix(req.Justification, "0x"), |
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 have HexOrCB58ToID
and SanitizieHexString
utils functions that might apply here
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.
This doesn't decode to an ID
but yeah we should call SanitizeHexString
here
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.
fundedAddress, | ||
relayerKey, | ||
) | ||
relayerConfig.EtnaTime = time.Now().AddDate(0, 0, -1) |
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.
Same here, a comment clarifying the -1 would be helpful
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.
Addressed in 3d7707d
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.
A handful of final nits, but once they as well as the other open comments are addressed, this LGTM
justification []byte, | ||
sourceSubnet ids.ID, | ||
) ([]byte, error) { | ||
if !s.etnaTime.IsZero() && s.etnaTime.Before(time.Now()) { |
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.
It would be nice to combine these two conditions into a helper s.EtnaActivated()
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.
Addressed in 576a375
Why this should be merged
fixes #383