-
Notifications
You must be signed in to change notification settings - Fork 108
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add configurable signer latency correction
- Loading branch information
Showing
16 changed files
with
399 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,19 @@ | ||
syntax = "proto3"; | ||
package zetachain.zetacore.observer; | ||
|
||
import "gogoproto/gogo.proto"; | ||
import "google/protobuf/duration.proto"; | ||
|
||
option go_package = "github.com/zeta-chain/node/x/observer/types"; | ||
|
||
// Flags for the top-level operation of zetaclient. | ||
message OperationalFlags { | ||
// Height for a coordinated zetaclient restart. | ||
// Will be ignored if missed. | ||
int64 restart_height = 1; | ||
|
||
// Offset from the zetacore block time to initiate signing. | ||
// Should be calculated and set based on max(zetaclient_core_block_latency). | ||
google.protobuf.Duration signer_block_time_offset = 2 | ||
[ (gogoproto.stdduration) = true ]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,27 @@ | ||
package types | ||
|
||
import ( | ||
"time" | ||
|
||
cosmoserrors "cosmossdk.io/errors" | ||
) | ||
|
||
const ( | ||
signerBlockTimeOffsetLimit = time.Second * 10 | ||
) | ||
|
||
func (f *OperationalFlags) Validate() error { | ||
if f.RestartHeight < 0 { | ||
return ErrOperationalFlagsRestartHeightNegative | ||
} | ||
if f.SignerBlockTimeOffset != nil { | ||
signerBlockTimeOffset := *f.SignerBlockTimeOffset | ||
if signerBlockTimeOffset < 0 { | ||
return ErrOperationalFlagsRestartHeightNegative | ||
} | ||
if signerBlockTimeOffset > signerBlockTimeOffsetLimit { | ||
return cosmoserrors.Wrapf(ErrOperationalFlagsSignerBlockTimeOffsetLimit, "(%s)", signerBlockTimeOffset) | ||
} | ||
} | ||
return nil | ||
} |
Oops, something went wrong.