diff --git a/rolling-shutter/app/app.go b/rolling-shutter/app/app.go index 00aa67bd..e118c36f 100644 --- a/rolling-shutter/app/app.go +++ b/rolling-shutter/app/app.go @@ -522,7 +522,10 @@ func (app *ShutterApp) handlePolyEvalMsg(msg *shmsg.PolyEval, sender common.Addr } } -func (app *ShutterApp) handlePolyCommitmentMsg(msg *shmsg.PolyCommitment, sender common.Address) abcitypes.ResponseDeliverTx { +func (app *ShutterApp) handlePolyCommitmentMsg( + msg *shmsg.PolyCommitment, + sender common.Address, +) abcitypes.ResponseDeliverTx { appMsg, err := ParsePolyCommitmentMsg(msg, sender) if err != nil { msg := fmt.Sprintf("Error: Failed to parse PolyCommitment message: %+v", err) @@ -717,7 +720,8 @@ func (app *ShutterApp) EndBlock(req abcitypes.RequestEndBlock) abcitypes.Respons }.MakeABCIEvent()) } } - if config.Started && !config.ValidatorsUpdated && app.countCheckedInKeypers(config.Keypers) >= numRequiredTransitionValidators(config) { + if config.Started && !config.ValidatorsUpdated && + app.countCheckedInKeypers(config.Keypers) >= numRequiredTransitionValidators(config) { config.ValidatorsUpdated = true } } diff --git a/rolling-shutter/app/dkg.go b/rolling-shutter/app/dkg.go index eaf7e459..6cb2285e 100644 --- a/rolling-shutter/app/dkg.go +++ b/rolling-shutter/app/dkg.go @@ -40,7 +40,11 @@ func (dkg *DKGInstance) RegisterPolyEvalMsg(msg PolyEval) error { } _, ok := dkg.PolyEvalsSeen[SenderReceiverPair{sender, receiver}] if ok { - return errors.Errorf("polynomial evaluation from keyper %s for receiver %s already present", sender.Hex(), receiver.Hex()) + return errors.Errorf( + "polynomial evaluation from keyper %s for receiver %s already present", + sender.Hex(), + receiver.Hex(), + ) } } diff --git a/rolling-shutter/app/messages.go b/rolling-shutter/app/messages.go index 5f552a55..5bfc82c5 100644 --- a/rolling-shutter/app/messages.go +++ b/rolling-shutter/app/messages.go @@ -28,7 +28,11 @@ func validateAddress(address []byte) (common.Address, error) { // ParsePolyEvalMsg converts a shmsg.PolyEvalMsg to an app.PolyEvalMsg. func ParsePolyEvalMsg(msg *shmsg.PolyEval, sender common.Address) (*PolyEval, error) { if len(msg.Receivers) != len(msg.EncryptedEvals) { - return nil, errors.Errorf("number of receivers %d does not match number of evals %d", len(msg.Receivers), len(msg.EncryptedEvals)) + return nil, errors.Errorf( + "number of receivers %d does not match number of evals %d", + len(msg.Receivers), + len(msg.EncryptedEvals), + ) } receivers := []common.Address{} @@ -95,7 +99,11 @@ func ParseAccusationMsg(msg *shmsg.Accusation, sender common.Address) (*Accusati // ParseApologyMsg converts a shmsg.ApologyMsg to an app.ApologyMsg. func ParseApologyMsg(msg *shmsg.Apology, sender common.Address) (*Apology, error) { if len(msg.Accusers) != len(msg.PolyEvals) { - return nil, errors.Errorf("number of accusers %d and apology evals %d not equal", len(msg.Accusers), len(msg.PolyEvals)) + return nil, errors.Errorf( + "number of accusers %d and apology evals %d not equal", + len(msg.Accusers), + len(msg.PolyEvals), + ) } accusers := []common.Address{} diff --git a/rolling-shutter/cmd/chain/init.go b/rolling-shutter/cmd/chain/init.go index bcc6e103..904a3c63 100644 --- a/rolling-shutter/cmd/chain/init.go +++ b/rolling-shutter/cmd/chain/init.go @@ -211,7 +211,10 @@ func initFilesWithConfig(tendermintConfig *cfg.Config, config *Config, appState if err != nil { return errors.Wrapf(err, "Could not write to %s", validatorPubKeyPath) } - log.Info().Str("path", validatorPubKeyPath).Str("validatorPublicKey", validatorPublicKeyHex).Msg("Saved private validator publickey") + log.Info(). + Str("path", validatorPubKeyPath). + Str("validatorPublicKey", validatorPublicKeyHex). + Msg("Saved private validator publickey") // genesis file genFile := tendermintConfig.GenesisFile() diff --git a/rolling-shutter/collator/batcher/batcher_test.go b/rolling-shutter/collator/batcher/batcher_test.go index 5beadf1e..00c4c535 100644 --- a/rolling-shutter/collator/batcher/batcher_test.go +++ b/rolling-shutter/collator/batcher/batcher_test.go @@ -97,7 +97,13 @@ func TestConfirmTransactionsIntegration(t *testing.T) { assert.NilError(t, err) assert.Equal(t, 5, len(txs), "should have exactly one tx: %+v", txs) for nonce := 0; nonce < 5; nonce++ { - assert.Equal(t, cltrdb.TxstatusCommitted, txs[nonce].Status, "expected tx to have status committed: %+v", txs[nonce]) + assert.Equal( + t, + cltrdb.TxstatusCommitted, + txs[nonce].Status, + "expected tx to have status committed: %+v", + txs[nonce], + ) } } diff --git a/rolling-shutter/keyper/epochkghandler/eonpublickey.go b/rolling-shutter/keyper/epochkghandler/eonpublickey.go index 6108a954..bfab810d 100644 --- a/rolling-shutter/keyper/epochkghandler/eonpublickey.go +++ b/rolling-shutter/keyper/epochkghandler/eonpublickey.go @@ -25,7 +25,11 @@ func (*EonPublicKeyHandler) MessagePrototypes() []p2pmsg.Message { func (handler *EonPublicKeyHandler) ValidateMessage(_ context.Context, msg p2pmsg.Message) (bool, error) { key := msg.(*p2pmsg.EonPublicKey) if key.GetInstanceID() != handler.config.GetInstanceID() { - return false, errors.Errorf("instance ID mismatch (want=%d, have=%d)", handler.config.GetInstanceID(), key.GetInstanceID()) + return false, errors.Errorf( + "instance ID mismatch (want=%d, have=%d)", + handler.config.GetInstanceID(), + key.GetInstanceID(), + ) } return true, nil } diff --git a/rolling-shutter/keyper/epochkghandler/key.go b/rolling-shutter/keyper/epochkghandler/key.go index 1f27e7fe..c4a1056c 100644 --- a/rolling-shutter/keyper/epochkghandler/key.go +++ b/rolling-shutter/keyper/epochkghandler/key.go @@ -33,7 +33,11 @@ func (*DecryptionKeyHandler) MessagePrototypes() []p2pmsg.Message { func (handler *DecryptionKeyHandler) ValidateMessage(ctx context.Context, msg p2pmsg.Message) (bool, error) { key := msg.(*p2pmsg.DecryptionKey) if key.GetInstanceID() != handler.config.GetInstanceID() { - return false, errors.Errorf("instance ID mismatch (want=%d, have=%d)", handler.config.GetInstanceID(), key.GetInstanceID()) + return false, errors.Errorf( + "instance ID mismatch (want=%d, have=%d)", + handler.config.GetInstanceID(), + key.GetInstanceID(), + ) } if _, err := epochid.BytesToEpochID(key.EpochID); err != nil { return false, errors.Wrapf(err, "invalid epoch id") diff --git a/rolling-shutter/keyper/epochkghandler/keyshare.go b/rolling-shutter/keyper/epochkghandler/keyshare.go index 51001589..17d26276 100644 --- a/rolling-shutter/keyper/epochkghandler/keyshare.go +++ b/rolling-shutter/keyper/epochkghandler/keyshare.go @@ -36,7 +36,11 @@ func (*DecryptionKeyShareHandler) MessagePrototypes() []p2pmsg.Message { func (handler *DecryptionKeyShareHandler) ValidateMessage(ctx context.Context, msg p2pmsg.Message) (bool, error) { keyShare := msg.(*p2pmsg.DecryptionKeyShares) if keyShare.GetInstanceID() != handler.config.GetInstanceID() { - return false, errors.Errorf("instance ID mismatch (want=%d, have=%d)", handler.config.GetInstanceID(), keyShare.GetInstanceID()) + return false, errors.Errorf( + "instance ID mismatch (want=%d, have=%d)", + handler.config.GetInstanceID(), + keyShare.GetInstanceID(), + ) } if keyShare.Eon > math.MaxInt64 { return false, errors.Errorf("eon %d overflows int64", keyShare.Eon) @@ -78,7 +82,10 @@ func (handler *DecryptionKeyShareHandler) ValidateMessage(ctx context.Context, m return true, nil } -func (handler *DecryptionKeyShareHandler) HandleMessage(ctx context.Context, m p2pmsg.Message) ([]p2pmsg.Message, error) { +func (handler *DecryptionKeyShareHandler) HandleMessage( + ctx context.Context, + m p2pmsg.Message, +) ([]p2pmsg.Message, error) { metricsEpochKGDecryptionKeySharesReceived.Inc() msg := m.(*p2pmsg.DecryptionKeyShares) // Insert the share into the db. We assume that it's valid as it already passed the libp2p diff --git a/rolling-shutter/keyper/epochkghandler/trigger.go b/rolling-shutter/keyper/epochkghandler/trigger.go index 18fb4b6b..8fa7216e 100644 --- a/rolling-shutter/keyper/epochkghandler/trigger.go +++ b/rolling-shutter/keyper/epochkghandler/trigger.go @@ -33,7 +33,11 @@ func (*DecryptionTriggerHandler) MessagePrototypes() []p2pmsg.Message { func (handler *DecryptionTriggerHandler) ValidateMessage(ctx context.Context, msg p2pmsg.Message) (bool, error) { trigger := msg.(*p2pmsg.DecryptionTrigger) if trigger.GetInstanceID() != handler.config.GetInstanceID() { - return false, errors.Errorf("instance ID mismatch (want=%d, have=%d)", handler.config.GetInstanceID(), trigger.GetInstanceID()) + return false, errors.Errorf( + "instance ID mismatch (want=%d, have=%d)", + handler.config.GetInstanceID(), + trigger.GetInstanceID(), + ) } if _, err := epochid.BytesToEpochID(trigger.EpochID); err != nil { return false, errors.Wrapf(err, "invalid epoch id") @@ -53,12 +57,20 @@ func (handler *DecryptionTriggerHandler) ValidateMessage(ctx context.Context, ms collator, err := shdb.DecodeAddress(chainCollator.Collator) if err != nil { - return false, errors.Wrapf(err, "error while converting collator from string to address: %s", chainCollator.Collator) + return false, errors.Wrapf( + err, + "error while converting collator from string to address: %s", + chainCollator.Collator, + ) } signatureValid, err := p2pmsg.VerifySignature(trigger, collator) if err != nil { - return false, errors.Wrapf(err, "error while verifying decryption trigger signature for epoch: %x", trigger.EpochID) + return false, errors.Wrapf( + err, + "error while verifying decryption trigger signature for epoch: %x", + trigger.EpochID, + ) } if !signatureValid { return false, errors.Errorf("decryption trigger signature invalid for epoch: %x", trigger.EpochID) @@ -66,7 +78,10 @@ func (handler *DecryptionTriggerHandler) ValidateMessage(ctx context.Context, ms return signatureValid, nil } -func (handler *DecryptionTriggerHandler) HandleMessage(ctx context.Context, m p2pmsg.Message) ([]p2pmsg.Message, error) { +func (handler *DecryptionTriggerHandler) HandleMessage( + ctx context.Context, + m p2pmsg.Message, +) ([]p2pmsg.Message, error) { msg, ok := m.(*p2pmsg.DecryptionTrigger) if !ok { return nil, errors.New("Message type assertion mismatch") diff --git a/rolling-shutter/keyper/keyper.go b/rolling-shutter/keyper/keyper.go index 65ce9e2f..ebb373d0 100644 --- a/rolling-shutter/keyper/keyper.go +++ b/rolling-shutter/keyper/keyper.go @@ -267,7 +267,8 @@ func (kpr *keyper) handleOnChainKeyperSetChanges( } // We *MUST* check if the l1BlockNumber is smaller than the activationBlockNumber since both are uint64 and therefore subtraction can never result in negative numbers. // This means that if we missed the activationBlockNumber we will never submit the config. - if l1BlockNumber < activationBlockNumber && activationBlockNumber-l1BlockNumber > kpr.config.Shuttermint.DKGStartBlockDelta { + if l1BlockNumber < activationBlockNumber && + activationBlockNumber-l1BlockNumber > kpr.config.Shuttermint.DKGStartBlockDelta { log.Info().Interface("keyper-set", keyperSet). Uint64("l1-block-number", l1BlockNumber). Uint64("dkg-start-delta", kpr.config.Shuttermint.DKGStartBlockDelta). diff --git a/rolling-shutter/medley/eventsyncer/eventsyncer.go b/rolling-shutter/medley/eventsyncer/eventsyncer.go index 0fc2124e..99cd6ae4 100644 --- a/rolling-shutter/medley/eventsyncer/eventsyncer.go +++ b/rolling-shutter/medley/eventsyncer/eventsyncer.go @@ -73,7 +73,13 @@ type EventSyncer struct { // New creates a new event syncer. It will look for events starting at a certain block number and // log index. The types of events to filter for are specified as a set of EventTypes. The finality // offset is the number of blocks we trail behind the current block to be safe from reorgs. -func New(client *ethclient.Client, finalityOffset uint64, events []*EventType, fromBlock uint64, fromLogIndex uint64) *EventSyncer { +func New( + client *ethclient.Client, + finalityOffset uint64, + events []*EventType, + fromBlock uint64, + fromLogIndex uint64, +) *EventSyncer { return &EventSyncer{ Client: client, FinalityOffset: finalityOffset, @@ -219,7 +225,12 @@ func (s *EventSyncer) syncAllInRange(ctx context.Context, fromBlock uint64, toBl } // syncSingleInRange returns the events matching the given type in the given block range. -func (s *EventSyncer) syncSingleInRange(ctx context.Context, event *EventType, fromBlock uint64, toBlock uint64) ([]logChannelItem, error) { +func (s *EventSyncer) syncSingleInRange( + ctx context.Context, + event *EventType, + fromBlock uint64, + toBlock uint64, +) ([]logChannelItem, error) { topic := event.ABI.Events[event.Name].ID query := ethereum.FilterQuery{ BlockHash: nil, diff --git a/rolling-shutter/medley/revert.go b/rolling-shutter/medley/revert.go index 748f1e97..7fac47ee 100644 --- a/rolling-shutter/medley/revert.go +++ b/rolling-shutter/medley/revert.go @@ -15,7 +15,13 @@ import ( // Adapted from https://ethereum.stackexchange.com/a/80766 // GetRevertReason returns the reason for a failed transaction. -func GetRevertReason(ctx context.Context, b ethereum.ContractCaller, from common.Address, tx *types.Transaction, blockNum *big.Int) error { +func GetRevertReason( + ctx context.Context, + b ethereum.ContractCaller, + from common.Address, + tx *types.Transaction, + blockNum *big.Int, +) error { msg := ethereum.CallMsg{ From: from, To: tx.To(), diff --git a/rolling-shutter/medley/testkeygen/keygenerator.go b/rolling-shutter/medley/testkeygen/keygenerator.go index c8f55048..29784300 100644 --- a/rolling-shutter/medley/testkeygen/keygenerator.go +++ b/rolling-shutter/medley/testkeygen/keygenerator.go @@ -59,7 +59,10 @@ func (tkg *TestKeyGenerator) EonKeysForEpoch(epochID epochid.EpochID) *EonKeys { return res } -func (tkg *TestKeyGenerator) EonPublicKeyShare(epochID epochid.EpochID, keyperIndex uint64) *shcrypto.EonPublicKeyShare { +func (tkg *TestKeyGenerator) EonPublicKeyShare( + epochID epochid.EpochID, + keyperIndex uint64, +) *shcrypto.EonPublicKeyShare { tkg.t.Helper() return tkg.EonKeysForEpoch(epochID).keyperShares[keyperIndex].eonPublicKeyShare } @@ -69,12 +72,18 @@ func (tkg *TestKeyGenerator) EonPublicKey(epochID epochid.EpochID) *shcrypto.Eon return tkg.EonKeysForEpoch(epochID).publicKey } -func (tkg *TestKeyGenerator) EonSecretKeyShare(epochID epochid.EpochID, keyperIndex uint64) *shcrypto.EonSecretKeyShare { +func (tkg *TestKeyGenerator) EonSecretKeyShare( + epochID epochid.EpochID, + keyperIndex uint64, +) *shcrypto.EonSecretKeyShare { tkg.t.Helper() return tkg.EonKeysForEpoch(epochID).keyperShares[keyperIndex].eonSecretKeyShare } -func (tkg *TestKeyGenerator) EpochSecretKeyShare(epochID epochid.EpochID, keyperIndex uint64) *shcrypto.EpochSecretKeyShare { +func (tkg *TestKeyGenerator) EpochSecretKeyShare( + epochID epochid.EpochID, + keyperIndex uint64, +) *shcrypto.EpochSecretKeyShare { tkg.t.Helper() return tkg.EonKeysForEpoch(epochID).keyperShares[keyperIndex].ComputeEpochSecretKeyShare(epochID) } diff --git a/rolling-shutter/medley/txbatch/txbatch.go b/rolling-shutter/medley/txbatch/txbatch.go index 892be107..58050c9d 100644 --- a/rolling-shutter/medley/txbatch/txbatch.go +++ b/rolling-shutter/medley/txbatch/txbatch.go @@ -54,7 +54,13 @@ func (txbatch *TXBatch) WaitMined(ctx context.Context) ([]*types.Receipt, error) } res = append(res, receipt) if receipt.Status != 1 { - err = medley.GetRevertReason(ctx, txbatch.Ethclient, crypto.PubkeyToAddress(txbatch.key.PublicKey), tx, receipt.BlockNumber) + err = medley.GetRevertReason( + ctx, + txbatch.Ethclient, + crypto.PubkeyToAddress(txbatch.key.PublicKey), + tx, + receipt.BlockNumber, + ) fmt.Print("\n") log.Info().Err(err).Str("hash", tx.Hash().Hex()).Int("index", i). Msg("transaction reverted") @@ -71,7 +77,11 @@ func (txbatch *TXBatch) WaitMined(ctx context.Context) ([]*types.Receipt, error) } // InitTransactOpts initializes the transact options struct. -func InitTransactOpts(ctx context.Context, client *ethclient.Client, key *ecdsa.PrivateKey) (*bind.TransactOpts, error) { +func InitTransactOpts( + ctx context.Context, + client *ethclient.Client, + key *ecdsa.PrivateKey, +) (*bind.TransactOpts, error) { chainID, err := client.ChainID(ctx) if err != nil { return nil, err diff --git a/rolling-shutter/mocksequencer/rpc/service_admin.go b/rolling-shutter/mocksequencer/rpc/service_admin.go index 53d38c78..c9a45784 100644 --- a/rolling-shutter/mocksequencer/rpc/service_admin.go +++ b/rolling-shutter/mocksequencer/rpc/service_admin.go @@ -29,7 +29,11 @@ func (s *AdminService) Name() string { func (s *AdminService) AddCollator(address string, l1BlockNumber uint64) (int, error) { var err error defer func() { - log.Info().Err(err).Str("address", address).Uint64("l1-blocknumber", l1BlockNumber).Msg("admin method AddCollator called") + log.Info(). + Err(err). + Str("address", address). + Uint64("l1-blocknumber", l1BlockNumber). + Msg("admin method AddCollator called") }() collator, err := encoding.StringToAddress(address) diff --git a/rolling-shutter/mocksequencer/rpc/service_eth.go b/rolling-shutter/mocksequencer/rpc/service_eth.go index b67c0ab3..11446144 100644 --- a/rolling-shutter/mocksequencer/rpc/service_eth.go +++ b/rolling-shutter/mocksequencer/rpc/service_eth.go @@ -57,7 +57,10 @@ func (s *EthService) Name() string { return "eth" } -func (s *EthService) GetTransactionCount(address common.Address, blockNrOrHash ethrpc.BlockNumberOrHash) (*hexutil.Uint64, error) { +func (s *EthService) GetTransactionCount( + address common.Address, + blockNrOrHash ethrpc.BlockNumberOrHash, +) (*hexutil.Uint64, error) { s.processor.Mux.RLock() defer s.processor.Mux.RUnlock() block, err := s.processor.GetBlock(blockNrOrHash) @@ -86,7 +89,11 @@ func (s *EthService) ChainId() *hexutil.Big { return (*hexutil.Big)(s.processor.ChainID()) } -func (s *EthService) GetBlockByNumber(_ context.Context, blockNumber ethrpc.BlockNumber, _ bool) (map[string]interface{}, error) { +func (s *EthService) GetBlockByNumber( + _ context.Context, + blockNumber ethrpc.BlockNumber, + _ bool, +) (map[string]interface{}, error) { var result map[string]interface{} s.processor.Mux.RLock() defer s.processor.Mux.RUnlock() diff --git a/rolling-shutter/mocksequencer/sequencer.go b/rolling-shutter/mocksequencer/sequencer.go index 8d96c3c2..173eaf42 100644 --- a/rolling-shutter/mocksequencer/sequencer.go +++ b/rolling-shutter/mocksequencer/sequencer.go @@ -116,7 +116,12 @@ func (b *BlockData) GetNonce(a common.Address) uint64 { return nonce } -func CreateNextBlockData(baseFee *big.Int, gasLimit uint64, feeBeneficiary common.Address, previous *BlockData) *BlockData { +func CreateNextBlockData( + baseFee *big.Int, + gasLimit uint64, + feeBeneficiary common.Address, + previous *BlockData, +) *BlockData { gasPool := core.GasPool(gasLimit) bd := &BlockData{ mux: sync.Mutex{}, @@ -404,7 +409,11 @@ func (proc *Sequencer) ProcessEncryptedTx( } shutterTxStr, _ := tx.MarshalJSON() - log.Ctx(ctx).Info().Str("signer", sender.Hex()).RawJSON("transaction", shutterTxStr).Msg("received shutter transaction") + log.Ctx(ctx). + Info(). + Str("signer", sender.Hex()). + RawJSON("transaction", shutterTxStr). + Msg("received shutter transaction") if tx.L1BlockNumber() != batchL1BlockNumber { return errors.New("l1-block-number mismatch") diff --git a/rolling-shutter/p2p/message.go b/rolling-shutter/p2p/message.go index f503c3b6..4970083e 100644 --- a/rolling-shutter/p2p/message.go +++ b/rolling-shutter/p2p/message.go @@ -20,7 +20,10 @@ func UnmarshalPubsubMessage(msg *pubsub.Message) (p2pmsg.Message, *p2pmsg.TraceC err = unmshl.Validate() if err != nil { - return nil, traceContext, errors.Wrap(err, fmt.Sprintf("verification failed <%s>", reflect.TypeOf(unmshl).String())) + return nil, traceContext, errors.Wrap( + err, + fmt.Sprintf("verification failed <%s>", reflect.TypeOf(unmshl).String()), + ) } return unmshl, traceContext, nil } diff --git a/rolling-shutter/p2pmsg/messages_test.go b/rolling-shutter/p2pmsg/messages_test.go index 70165201..047e112f 100644 --- a/rolling-shutter/p2pmsg/messages_test.go +++ b/rolling-shutter/p2pmsg/messages_test.go @@ -13,7 +13,11 @@ import ( "github.com/shutter-network/rolling-shutter/rolling-shutter/trace" ) -func marshalUnmarshalMessage[M Message](t *testing.T, message M, traceContext *TraceContext) (M, *TraceContext) { //nolint:thelper +func marshalUnmarshalMessage[M Message]( //nolint:thelper + t *testing.T, + message M, + traceContext *TraceContext, +) (M, *TraceContext) { var ( err error ok bool diff --git a/rolling-shutter/snapshot/handler.go b/rolling-shutter/snapshot/handler.go index af99d1df..8f9a7bc6 100644 --- a/rolling-shutter/snapshot/handler.go +++ b/rolling-shutter/snapshot/handler.go @@ -59,7 +59,11 @@ func (handler *DecryptionKeyHandler) ValidateMessage(ctx context.Context, msg p2 decryptionKeyMsg := msg.(*p2pmsg.DecryptionKey) // FIXME: check snapshot business logic for decryptionKeyMsg validation if decryptionKeyMsg.GetInstanceID() != handler.config.InstanceID { - return false, errors.Errorf("instance ID mismatch (want=%d, have=%d)", handler.config.InstanceID, decryptionKeyMsg.GetInstanceID()) + return false, errors.Errorf( + "instance ID mismatch (want=%d, have=%d)", + handler.config.InstanceID, + decryptionKeyMsg.GetInstanceID(), + ) } key, err := decryptionKeyMsg.GetEpochSecretKey() @@ -103,7 +107,11 @@ func (handler *DecryptionKeyHandler) ValidateMessage(ctx context.Context, msg p2 func (handler *EonPublicKeyHandler) ValidateMessage(_ context.Context, msg p2pmsg.Message) (bool, error) { eonKeyMsg := msg.(*p2pmsg.EonPublicKey) if eonKeyMsg.GetInstanceID() != handler.config.InstanceID { - return false, errors.Errorf("instance ID mismatch (want=%d, have=%d)", handler.config.InstanceID, eonKeyMsg.GetInstanceID()) + return false, errors.Errorf( + "instance ID mismatch (want=%d, have=%d)", + handler.config.InstanceID, + eonKeyMsg.GetInstanceID(), + ) } eon := eonKeyMsg.GetEon() if eon == 0 { diff --git a/rolling-shutter/snapshotkeyper/snapshotkeyper.go b/rolling-shutter/snapshotkeyper/snapshotkeyper.go index 5edba7f4..e576f2f9 100644 --- a/rolling-shutter/snapshotkeyper/snapshotkeyper.go +++ b/rolling-shutter/snapshotkeyper/snapshotkeyper.go @@ -234,7 +234,8 @@ func (snkpr *snapshotkeyper) handleOnChainKeyperSetChanges(ctx context.Context, } // We *MUST* check if the l1BlockNumber is smaller than the activationBlockNumber since both are uint64 and therefore subtraction can never result in negative numbers. // This means that if we missed the activationBlockNumber we will never submit the config. - if l1BlockNumber < activationBlockNumber && activationBlockNumber-l1BlockNumber > snkpr.config.Shuttermint.DKGStartBlockDelta { + if l1BlockNumber < activationBlockNumber && + activationBlockNumber-l1BlockNumber > snkpr.config.Shuttermint.DKGStartBlockDelta { log.Info().Interface("keyper-set", keyperSet). Uint64("l1-block-number", l1BlockNumber). Uint64("dkg-start-delta", snkpr.config.Shuttermint.DKGStartBlockDelta).