diff --git a/e2e/app/admin/planupgrade.go b/e2e/app/admin/planupgrade.go index 7fe0cbe9d..ea7ec4d41 100644 --- a/e2e/app/admin/planupgrade.go +++ b/e2e/app/admin/planupgrade.go @@ -52,7 +52,7 @@ func PlanUpgrade(ctx context.Context, def app.Definition, cfg Config) error { contract, err := bindings.NewUpgrade(common.HexToAddress(predeploys.Upgrade), backend) if err != nil { - return errors.Wrap(err, "new staking contract") + return errors.Wrap(err, "new upgrade contract") } txOpts, err := backend.BindOpts(ctx, eoa.MustAddress(network, eoa.RoleUpgrader)) diff --git a/e2e/app/portalregistry.go b/e2e/app/portalregistry.go index db5f58fd4..05bc71f6e 100644 --- a/e2e/app/portalregistry.go +++ b/e2e/app/portalregistry.go @@ -252,7 +252,7 @@ func allowStagingValidators(ctx context.Context, def Definition) error { contract, err := bindings.NewStaking(common.HexToAddress(predeploys.Staking), backend) if err != nil { - return errors.Wrap(err, "new staking") + return errors.Wrap(err, "new portal registry") } manager := eoa.MustAddress(def.Testnet.Network, eoa.RoleManager) diff --git a/halo/attest/keeper/keeper.go b/halo/attest/keeper/keeper.go index 85edfcc91..0fd8bc2df 100644 --- a/halo/attest/keeper/keeper.go +++ b/halo/attest/keeper/keeper.go @@ -79,7 +79,7 @@ func New( return nil, errors.Wrap(err, "create module db") } - attstore, err := NewAttestationStore(modDB) + attStore, err := NewAttestationStore(modDB) if err != nil { return nil, errors.Wrap(err, "create attestation store") } @@ -89,8 +89,8 @@ func New( } k := &Keeper{ - attTable: attstore.AttestationTable(), - sigTable: attstore.SignatureTable(), + attTable: attStore.AttestationTable(), + sigTable: attStore.SignatureTable(), cdc: cdc, storeService: storeSvc, skeeper: skeeper, @@ -674,7 +674,7 @@ func (k *Keeper) ExtendVote(ctx sdk.Context, _ *abci.RequestExtendVote) (*abci.R votes := k.voter.GetAvailable() - // Filter by vote window and if limited exceeded. + // Filter by vote window and if limit exceeded. countsByChainVer := make(map[xchain.ChainVersion]int) duplicate := make(map[xchain.AttestHeader]bool) var filtered []*types.Vote @@ -697,7 +697,7 @@ func (k *Keeper) ExtendVote(ctx sdk.Context, _ *abci.RequestExtendVote) (*abci.R if cmp, err := k.windowCompare(ctx, vote.AttestHeader.XChainVersion(), vote.AttestHeader.AttestOffset); err != nil { return nil, errors.Wrap(err, "windower") } else if cmp != 0 { - // Skip votes no in the window + // Skip votes not in the window continue } countsByChainVer[vote.AttestHeader.XChainVersion()]++ diff --git a/halo/attest/types/tx.proto b/halo/attest/types/tx.proto index 00e80de7c..aec6dc3d1 100644 --- a/halo/attest/types/tx.proto +++ b/halo/attest/types/tx.proto @@ -52,7 +52,7 @@ message Vote { AttestHeader attest_header = 1; // AttestHeader uniquely identifies an attestation that requires quorum votes. BlockHeader block_header = 2; // BlockHeader identifies the cross-chain Block bytes msg_root = 3; // Merkle root of all the messages in the cross-chain Block - SigTuple signature = 4; // Validator signatures and public keys + SigTuple signature = 4; // Validator signature and public key } // BlockHeader uniquely identifies a cross chain block. @@ -65,7 +65,7 @@ message BlockHeader { // AttestHeader uniquely identifies an attestation that requires quorum votes. // This is used to determine duplicate votes. message AttestHeader { - uint64 consensus_chain_id = 1; // Omni consensus chain ID this attestation/vote belangs to. Used for replay-protection. + uint64 consensus_chain_id = 1; // Omni consensus chain ID this attestation/vote belongs to. Used for replay-protection. uint64 source_chain_id = 2; // Source Chain ID as per https://chainlist.org uint32 conf_level = 3; // Confirmation level (aka version) of the cross-chain block/attestation. uint64 attest_offset = 4; // Monotonically increasing offset of this vote per chain version. 1-indexed. diff --git a/halo/attest/voter/voter.go b/halo/attest/voter/voter.go index 15793900e..cf702baaf 100644 --- a/halo/attest/voter/voter.go +++ b/halo/attest/voter/voter.go @@ -516,7 +516,7 @@ func (v *Voter) LocalAddress() common.Address { return v.address } -// availableAndProposed returns all the available and proposed votes. +// availableAndProposedUnsafe returns all the available and proposed votes. // It is unsafe since it assumes the lock is held. func (v *Voter) availableAndProposedUnsafe() []*types.Vote { var resp []*types.Vote @@ -537,13 +537,13 @@ func (v *Voter) latestByChain(chainVer xchain.ChainVersion) (*types.Vote, bool) // saveUnsafe saves the state to disk. It is unsafe since it assumes the lock is held. func (v *Voter) saveUnsafe() error { - sortVotes := func(atts []*types.Vote) { - sort.Slice(atts, func(i, j int) bool { - if atts[i].BlockHeader.ChainId != atts[j].BlockHeader.ChainId { - return atts[i].BlockHeader.ChainId < atts[j].BlockHeader.ChainId + sortVotes := func(votes []*types.Vote) { + sort.Slice(votes, func(i, j int) bool { + if votes[i].BlockHeader.ChainId != votes[j].BlockHeader.ChainId { + return votes[i].BlockHeader.ChainId < votes[j].BlockHeader.ChainId } - return atts[i].AttestHeader.AttestOffset < atts[j].AttestHeader.AttestOffset + return votes[i].AttestHeader.AttestOffset < votes[j].AttestHeader.AttestOffset }) } sortVotes(v.available) @@ -581,9 +581,9 @@ func (v *Voter) saveUnsafe() error { // instrumentUnsafe updates metrics. It is unsafe since it assumes the lock is held. func (v *Voter) instrumentUnsafe() { - count := func(atts []*types.Vote, gaugeVec *prometheus.GaugeVec) { + count := func(votes []*types.Vote, gaugeVec *prometheus.GaugeVec) { counts := make(map[xchain.ChainVersion]int) - for _, vote := range atts { + for _, vote := range votes { counts[vote.AttestHeader.XChainVersion()]++ } @@ -682,9 +682,9 @@ func headerMap(headers []*types.AttestHeader) map[xchain.AttestHeader]bool { } // pruneLatestPerChain returns only the latest attestation per chain. -func pruneLatestPerChain(atts []*types.Vote) []*types.Vote { +func pruneLatestPerChain(votes []*types.Vote) []*types.Vote { latest := make(map[uint64]*types.Vote) - for _, vote := range atts { + for _, vote := range votes { latestAtt, ok := latest[vote.BlockHeader.ChainId] if ok && latestAtt.AttestHeader.AttestOffset >= vote.AttestHeader.AttestOffset { continue diff --git a/halo/config/config.go b/halo/config/config.go index 7e84eb7a0..fcffa5ba4 100644 --- a/halo/config/config.go +++ b/halo/config/config.go @@ -36,7 +36,7 @@ const ( DefaultHomeDir = "./halo" // Defaults to "halo" in current directory defaultSnapshotInterval = 100 // Can't be too large, must overlap with geth snapshotcache. defaultSnapshotKeepRecent = 2 - defaultMinRetainBlocks = 1 // Prune all blocks by default, Cosmsos will still respect other needs like snapshots + defaultMinRetainBlocks = 1 // Prune all blocks by default, Cosmos will still respect other needs like snapshots defaultPruningOption = pruningtypes.PruningOptionDefault // Note that Halo interprets this to be PruningEverything defaultDBBackend = db.GoLevelDBBackend diff --git a/halo/evmslashing/evmslashing.go b/halo/evmslashing/evmslashing.go index b2232fd24..978ea60b1 100644 --- a/halo/evmslashing/evmslashing.go +++ b/halo/evmslashing/evmslashing.go @@ -41,7 +41,7 @@ func New(sKeeper skeeper.Keeper) (EventProcessor, error) { address := common.HexToAddress(predeploys.Slashing) contract, err := bindings.NewSlashing(address, nil) // Passing nil backend if safe since only Parse functions are used. if err != nil { - return EventProcessor{}, errors.Wrap(err, "new staking") + return EventProcessor{}, errors.Wrap(err, "new slashing") } return EventProcessor{ diff --git a/halo/evmupgrade/evmupgrade.go b/halo/evmupgrade/evmupgrade.go index 87ae82707..a20d58c5b 100644 --- a/halo/evmupgrade/evmupgrade.go +++ b/halo/evmupgrade/evmupgrade.go @@ -45,7 +45,7 @@ func New(ethCl ethclient.Client, uKeeper *ukeeper.Keeper) (EventProcessor, error address := common.HexToAddress(predeploys.Upgrade) contract, err := bindings.NewUpgrade(address, ethCl) if err != nil { - return EventProcessor{}, errors.Wrap(err, "new staking") + return EventProcessor{}, errors.Wrap(err, "new upgrade") } return EventProcessor{ diff --git a/halo/portal/keeper/portal.pb.go b/halo/portal/keeper/portal.pb.go index 19ba10d69..78fd681d7 100644 --- a/halo/portal/keeper/portal.pb.go +++ b/halo/portal/keeper/portal.pb.go @@ -21,11 +21,11 @@ const ( _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) ) -// Block groups a set of Msgs adding height and offset. +// Block groups a set of Msgs. type Block struct { state protoimpl.MessageState `protogen:"open.v1"` - Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // Auto-incremented ID (BlockHeight, AttestOffset) - CreatedHeight uint64 `protobuf:"varint,2,opt,name=created_height,json=createdHeight,proto3" json:"created_height,omitempty"` // Height this block was created at. + Id uint64 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` // Auto-incremented ID (also used as BlockHeight and AttestOffset) + CreatedHeight uint64 `protobuf:"varint,2,opt,name=created_height,json=createdHeight,proto3" json:"created_height,omitempty"` // Consensus height this block was created at. unknownFields protoimpl.UnknownFields sizeCache protoimpl.SizeCache } diff --git a/halo/portal/keeper/portal.proto b/halo/portal/keeper/portal.proto index 56b3a26bf..b5846e227 100644 --- a/halo/portal/keeper/portal.proto +++ b/halo/portal/keeper/portal.proto @@ -6,7 +6,7 @@ import "cosmos/orm/v1/orm.proto"; option go_package = "halo/portal/keeper"; -// Block groups a set of Msgs adding height and offset. +// Block groups a set of Msgs. message Block { option (cosmos.orm.v1.table) = { id: 1; @@ -14,8 +14,8 @@ message Block { index: {id: 2, fields: "created_height", unique: true} // Allow querying by created_height. }; - uint64 id = 1; // Auto-incremented ID (BlockHeight, AttestOffset) - uint64 created_height = 2; // Height this block was created at. + uint64 id = 1; // Auto-incremented ID (also used as BlockHeight and AttestOffset) + uint64 created_height = 2; // Consensus height this block was created at. } // Msg represents a single cross-chain message emitted by the consensus chain portal. diff --git a/halo/registry/keeper/keeper.go b/halo/registry/keeper/keeper.go index 6f4a50025..b23a33d35 100644 --- a/halo/registry/keeper/keeper.go +++ b/halo/registry/keeper/keeper.go @@ -19,11 +19,11 @@ import ( ) type Keeper struct { - emitPortal ptypes.EmitPortal - networkTable NetworkTable - portalRegAdress common.Address - portalRegistry *bindings.PortalRegistryFilterer - chainNamer types.ChainNameFunc + emitPortal ptypes.EmitPortal + networkTable NetworkTable + portalRegAddress common.Address + portalRegistry *bindings.PortalRegistryFilterer + chainNamer types.ChainNameFunc latestCache *cache } @@ -48,22 +48,22 @@ func NewKeeper( } address := common.HexToAddress(predeploys.PortalRegistry) - protalReg, err := bindings.NewPortalRegistryFilterer(address, nil) // Passing nil backend if safe since only Parse functions are used. + portalReg, err := bindings.NewPortalRegistryFilterer(address, nil) // Passing nil backend if safe since only Parse functions are used. if err != nil { return Keeper{}, errors.Wrap(err, "new portal registry") } return Keeper{ - emitPortal: emitPortal, - networkTable: registryStore.NetworkTable(), - portalRegAdress: address, - portalRegistry: protalReg, - chainNamer: namer, - latestCache: new(cache), + emitPortal: emitPortal, + networkTable: registryStore.NetworkTable(), + portalRegAddress: address, + portalRegistry: portalReg, + chainNamer: namer, + latestCache: new(cache), }, nil } -// getOrCreateEpoch returns a network created in the current height. +// getOrCreateNetwork returns a network created in the current height. // If one already exists, it will be returned. // If none already exists, a new one will be created using the previous as base. // New networks are emitted as cross chain messages to portals. diff --git a/halo/registry/keeper/logeventproc.go b/halo/registry/keeper/logeventproc.go index de4371d02..ee80ab409 100644 --- a/halo/registry/keeper/logeventproc.go +++ b/halo/registry/keeper/logeventproc.go @@ -30,7 +30,7 @@ func (Keeper) Name() string { // FilterParams defines the matching EVM log events, see github.com/ethereum/go-ethereum#FilterQuery. func (k Keeper) FilterParams() ([]common.Address, [][]common.Hash) { - return []common.Address{k.portalRegAdress}, [][]common.Hash{{portalRegEvent.ID}} + return []common.Address{k.portalRegAddress}, [][]common.Hash{{portalRegEvent.ID}} } // Deliver processes a omni portal registry events. @@ -101,7 +101,7 @@ func mergePortal(existing []*Portal, portal *Portal) ([]*Portal, error) { continue } - // Merge new shads with an existing portal + // Merge new shards with an existing portal if !bytes.Equal(e.GetAddress(), portal.GetAddress()) { return nil, errors.New("cannot merge existing portal with mismatching address", "existing", e.GetAddress(), "new", portal.GetAddress()) diff --git a/halo/valsync/keeper/keeper.go b/halo/valsync/keeper/keeper.go index e236984d1..8d764be5b 100644 --- a/halo/valsync/keeper/keeper.go +++ b/halo/valsync/keeper/keeper.go @@ -41,9 +41,9 @@ type Keeper struct { emitPortal ptypes.EmitPortal subscriberInitted bool - ethCl ethclient.Client - portalRegAdress common.Address - portalRegistry *bindings.PortalRegistryFilterer + ethCl ethclient.Client + portalRegAddress common.Address + portalRegistry *bindings.PortalRegistryFilterer } func NewKeeper( @@ -69,21 +69,21 @@ func NewKeeper( } address := common.HexToAddress(predeploys.PortalRegistry) - protalReg, err := bindings.NewPortalRegistryFilterer(address, ethCl) + portalReg, err := bindings.NewPortalRegistryFilterer(address, ethCl) if err != nil { return nil, errors.Wrap(err, "new portal registry") } return &Keeper{ - valsetTable: valSyncStore.ValidatorSetTable(), - valTable: valSyncStore.ValidatorTable(), - sKeeper: sKeeper, - aKeeper: aKeeper, - subscriber: subscriber, - emitPortal: portal, - ethCl: ethCl, - portalRegAdress: address, - portalRegistry: protalReg, + valsetTable: valSyncStore.ValidatorSetTable(), + valTable: valSyncStore.ValidatorTable(), + sKeeper: sKeeper, + aKeeper: aKeeper, + subscriber: subscriber, + emitPortal: portal, + ethCl: ethCl, + portalRegAddress: address, + portalRegistry: portalReg, }, nil } diff --git a/halo/valsync/keeper/query.go b/halo/valsync/keeper/query.go index c11b2dac0..b4734cbba 100644 --- a/halo/valsync/keeper/query.go +++ b/halo/valsync/keeper/query.go @@ -87,14 +87,14 @@ func (k *Keeper) ValidatorSet(ctx context.Context, req *types.ValidatorSetReques } } - vatset, err := k.valsetTable.Get(ctx, valsetID) + valset, err := k.valsetTable.Get(ctx, valsetID) if errors.Is(err, ormerrors.NotFound) { return nil, status.Error(codes.NotFound, "no validator set found for id") } else if err != nil { return nil, status.Error(codes.Internal, err.Error()) } - valIter, err := k.valTable.List(ctx, ValidatorValsetIdIndexKey{}.WithValsetId(vatset.GetId())) + valIter, err := k.valTable.List(ctx, ValidatorValsetIdIndexKey{}.WithValsetId(valset.GetId())) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } @@ -118,9 +118,9 @@ func (k *Keeper) ValidatorSet(ctx context.Context, req *types.ValidatorSetReques } return &types.ValidatorSetResponse{ - Id: vatset.GetId(), - CreatedHeight: vatset.GetCreatedHeight(), - ActivatedHeight: vatset.GetActivatedHeight(), + Id: valset.GetId(), + CreatedHeight: valset.GetCreatedHeight(), + ActivatedHeight: valset.GetActivatedHeight(), Validators: vals, }, nil } diff --git a/lib/cchain/provider/abci.go b/lib/cchain/provider/abci.go index 1a3b05685..0b5e345f9 100644 --- a/lib/cchain/provider/abci.go +++ b/lib/cchain/provider/abci.go @@ -316,10 +316,10 @@ func newABCIValsetFunc(cl vtypes.QueryClient) valsetFunc { } return valSetResponse{ - ValSetID: resp.Id, - Validators: vals, - CreatedHeight: resp.CreatedHeight, - activedHeight: resp.ActivatedHeight, + ValSetID: resp.Id, + Validators: vals, + CreatedHeight: resp.CreatedHeight, + activatedHeight: resp.ActivatedHeight, }, true, nil } } diff --git a/lib/cchain/provider/provider.go b/lib/cchain/provider/provider.go index 7da50e0e8..1371a8712 100644 --- a/lib/cchain/provider/provider.go +++ b/lib/cchain/provider/provider.go @@ -51,10 +51,10 @@ type appliedUpgradeFunc func(ctx context.Context, name string) (upgradetypes.Pla type signingFunc func(ctx context.Context) ([]cchain.SDKSigningInfo, error) type valSetResponse struct { - ValSetID uint64 - Validators []cchain.PortalValidator - CreatedHeight uint64 - activedHeight uint64 + ValSetID uint64 + Validators []cchain.PortalValidator + CreatedHeight uint64 + activatedHeight uint64 } // Provider implements cchain.Provider. diff --git a/lib/cchain/provider/xblock.go b/lib/cchain/provider/xblock.go index 0d735f12c..5a21b8d5e 100644 --- a/lib/cchain/provider/xblock.go +++ b/lib/cchain/provider/xblock.go @@ -111,7 +111,7 @@ func (p Provider) msgNetworkData(ctx context.Context, msg ptypes.Msg) ([]byte, e data, err := portalABI.Pack("setNetwork", toPortalChains(network.Portals)) if err != nil { - return nil, errors.Wrap(err, "pack validators") + return nil, errors.Wrap(err, "pack network") } return data, nil diff --git a/lib/xchain/connect/connect.go b/lib/xchain/connect/connect.go index ab0e5e352..c7a3e6433 100644 --- a/lib/xchain/connect/connect.go +++ b/lib/xchain/connect/connect.go @@ -29,7 +29,7 @@ import ( "github.com/ethereum/go-ethereum/common" ) -// Connector provider a simple abstraction to connect to the Omni network. +// Connector provides a simple abstraction to connect to the Omni network. type Connector struct { Network netconf.Network XProvider xchain.Provider diff --git a/lib/xchain/provider/fetch.go b/lib/xchain/provider/fetch.go index 4d2a5a1fe..24f5af234 100644 --- a/lib/xchain/provider/fetch.go +++ b/lib/xchain/provider/fetch.go @@ -105,7 +105,7 @@ func (p *Provider) GetEmittedCursor(ctx context.Context, ref xchain.Ref, stream offset, err := caller.OutXMsgOffset(opts, stream.DestChainID, uint64(stream.ShardID)) if err != nil { - return xchain.EmitCursor{}, false, errors.Wrap(err, "call OutXMgsOffset") + return xchain.EmitCursor{}, false, errors.Wrap(err, "call OutXMsgOffset") } if offset == 0 { diff --git a/octane/evmengine/types/tx.pb.go b/octane/evmengine/types/tx.pb.go index 63e844dd9..caea03899 100644 --- a/octane/evmengine/types/tx.pb.go +++ b/octane/evmengine/types/tx.pb.go @@ -74,7 +74,7 @@ func (m *GenesisState) GetExecutionBlockHash() []byte { return nil } -// MsgExecutionPayload defines the next EVM execution payload and the +// MsgExecutionPayload defines the next EVM execution payload and the // logs from previous execution payload. type MsgExecutionPayload struct { Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` diff --git a/octane/evmengine/types/tx.proto b/octane/evmengine/types/tx.proto index f326a6d69..de5ce98d7 100644 --- a/octane/evmengine/types/tx.proto +++ b/octane/evmengine/types/tx.proto @@ -20,7 +20,7 @@ service MsgService { rpc ExecutionPayload (MsgExecutionPayload) returns (ExecutionPayloadResponse); } -// MsgExecutionPayload defines the next EVM execution payload and the +// MsgExecutionPayload defines the next EVM execution payload and the // logs from previous execution payload. message MsgExecutionPayload { option (cosmos.msg.v1.signer) = "authority";