Skip to content

Commit

Permalink
chore(*): fix typos found during cantina
Browse files Browse the repository at this point in the history
  • Loading branch information
corverroos committed Jan 23, 2025
1 parent c154426 commit 8a1a2f4
Show file tree
Hide file tree
Showing 21 changed files with 74 additions and 74 deletions.
2 changes: 1 addition & 1 deletion e2e/app/admin/planupgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
2 changes: 1 addition & 1 deletion e2e/app/portalregistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
10 changes: 5 additions & 5 deletions halo/attest/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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")
}
Expand All @@ -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,
Expand Down Expand Up @@ -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
Expand All @@ -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()]++
Expand Down
4 changes: 2 additions & 2 deletions halo/attest/types/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
Expand Down
20 changes: 10 additions & 10 deletions halo/attest/voter/voter.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down Expand Up @@ -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()]++
}

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion halo/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion halo/evmslashing/evmslashing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
2 changes: 1 addition & 1 deletion halo/evmupgrade/evmupgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
6 changes: 3 additions & 3 deletions halo/portal/keeper/portal.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions halo/portal/keeper/portal.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ 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;
primary_key: { fields: "id", auto_increment: true }
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.
Expand Down
26 changes: 13 additions & 13 deletions halo/registry/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions halo/registry/keeper/logeventproc.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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())
Expand Down
26 changes: 13 additions & 13 deletions halo/valsync/keeper/keeper.go
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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
}

Expand Down
10 changes: 5 additions & 5 deletions halo/valsync/keeper/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
Expand All @@ -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
}
Expand Down
8 changes: 4 additions & 4 deletions lib/cchain/provider/abci.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
8 changes: 4 additions & 4 deletions lib/cchain/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion lib/cchain/provider/xblock.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/xchain/connect/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/xchain/provider/fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion octane/evmengine/types/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 8a1a2f4

Please sign in to comment.