Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 1 addition & 32 deletions sei-tendermint/crypto/tmhash/hash.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ import (
)

const (
Size = sha256.Size
BlockSize = sha256.BlockSize
Size = sha256.Size
)

// New returns a new hash.Hash.
Expand All @@ -20,33 +19,3 @@ func Sum(bz []byte) []byte {
h := sha256.Sum256(bz)
return h[:]
}

//-------------------------------------------------------------

const (
TruncatedSize = 20
)

type sha256trunc struct {
sha256 hash.Hash
}

func (h sha256trunc) Write(p []byte) (n int, err error) {
return h.sha256.Write(p)
}
func (h sha256trunc) Sum(b []byte) []byte {
shasum := h.sha256.Sum(b)
return shasum[:TruncatedSize]
}

func (h sha256trunc) Reset() {
h.sha256.Reset()
}

func (h sha256trunc) Size() int {
return TruncatedSize
}

func (h sha256trunc) BlockSize() int {
return h.sha256.BlockSize()
}
2 changes: 1 addition & 1 deletion sei-tendermint/internal/consensus/reactor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func setup(
NopMetrics(),
config.DefaultConfig(),
)

require.NoError(t, err)
blocksSub, err := state.eventBus.SubscribeWithArgs(ctx, tmpubsub.SubscribeArgs{
ClientID: testSubscriber,
Query: types.EventQueryNewBlock,
Expand Down
1 change: 1 addition & 0 deletions sei-tendermint/internal/consensus/state_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2440,6 +2440,7 @@ func TestGossipTransactionKeyOnlyConfig(t *testing.T) {

proposalMsg := ProposalMessage{&proposal}
peerID, err := types.NewNodeID("AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA")
require.NoError(t, err)
startTestRound(ctx, cs1, height, round)
cs1.handleMsg(ctx, msgInfo{&proposalMsg, peerID, time.Now()}, false)
rs := cs1.GetRoundState()
Expand Down
1 change: 0 additions & 1 deletion sei-tendermint/internal/mempool/mempool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ func (app *application) CheckTx(_ context.Context, req *abci.RequestCheckTxV2) (
// format is evm-sender-0=account=priority=nonce
// split into respective vars
parts := bytes.Split(req.Tx, []byte("="))
sender = string(parts[0])
account := string(parts[1])
v, err := strconv.ParseInt(string(parts[2]), 10, 64)
if err != nil {
Expand Down
1 change: 0 additions & 1 deletion sei-tendermint/internal/p2p/peermanager_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func minBy[T any, I cmp.Ordered](vals iter.Seq[T], by func(T) I) utils.Option[T]
// - no parallel upgrades allowed even if permit is provided.
func TestPoolManager_TryStartDial_MaxOut(t *testing.T) {
rng := utils.TestRng()
const maxIn = 0
const maxOut = 5
fixedAddrs := make([]NodeAddress, maxOut)
want := map[types.NodeID][]NodeAddress{}
Expand Down
1 change: 1 addition & 0 deletions sei-tendermint/internal/store/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,7 @@ func seenCommitKey() []byte {
return key
}

//lint:ignore U1000 Method retained for completeness
func extCommitKey(height int64) []byte {
key, err := orderedcode.Append(nil, prefixExtCommit, height)
if err != nil {
Expand Down
35 changes: 0 additions & 35 deletions sei-tendermint/libs/cli/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,38 +132,3 @@ func (e Executor) Execute() error {
}
return err
}

// Bind all flags and read the config into viper
func bindFlagsLoadViper(cmd *cobra.Command, args []string) error {
// cmd.Flags() includes flags from this command and all persistent flags from the parent
if err := viper.BindPFlags(cmd.Flags()); err != nil {
return err
}

homeDir := viper.GetString(HomeFlag)
viper.Set(HomeFlag, homeDir)
viper.SetConfigName("config") // name of config file (without extension)
viper.AddConfigPath(homeDir) // search root directory
viper.AddConfigPath(filepath.Join(homeDir, "config")) // search root directory /config

// If a config file is found, read it in.
if err := viper.ReadInConfig(); err == nil {
// stderr, so if we redirect output to json file, this doesn't appear
// fmt.Fprintln(os.Stderr, "Using config file:", viper.ConfigFileUsed())
} else if _, ok := err.(viper.ConfigFileNotFoundError); !ok {
// ignore not found error, return other errors
return err
}
return nil
}

func validateOutput(cmd *cobra.Command, args []string) error {
// validate output format
output := viper.GetString(OutputFlag)
switch output {
case "text", "json":
default:
return fmt.Errorf("unsupported output format: %s", output)
}
return nil
}
5 changes: 0 additions & 5 deletions sei-tendermint/libs/json/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,8 +207,3 @@ func decodeStdlib(bz []byte, rv reflect.Value) error {
rv.Set(target.Elem())
return nil
}

type interfaceWrapper struct {
Type string `json:"type"`
Value json.RawMessage `json:"value"`
}
1 change: 0 additions & 1 deletion sei-tendermint/node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ type nodeImpl struct {

// network
router *p2p.Router
routerRestartCh chan struct{} // Used to signal a restart the node on the application level
ServiceRestartCh chan []string
nodeInfo types.NodeInfo
nodeKey types.NodeKey // our node privkey
Expand Down
44 changes: 0 additions & 44 deletions sei-tendermint/types/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"crypto/sha256"
"errors"
"fmt"
"sort"

"github.com/sei-protocol/sei-chain/sei-tendermint/crypto"
"github.com/sei-protocol/sei-chain/sei-tendermint/crypto/merkle"
Expand Down Expand Up @@ -93,49 +92,6 @@ func (txs Txs) ToSliceOfBytes() [][]byte {
return txBzs
}

func sortedCopy(txs Txs) Txs {
cp := make(Txs, len(txs))
copy(cp, txs)
sort.Sort(cp)
return cp
}

// containsAny checks that list a contains one of the transactions in list
// b. If a match is found, the index in b of the matching transaction is returned.
// Both lists must be sorted.
func containsAny(a, b []Tx) (int, bool) {
for i, cur := range b {
if _, ok := contains(a, cur); ok {
return i, true
}
}
return -1, false
}

// containsAll checks that super contains all of the transactions in the sub
// list. If not all values in sub are present in super, the index in sub of the
// first Tx absent from super is returned.
func containsAll(super, sub Txs) (int, bool) {
for i, cur := range sub {
if _, ok := contains(super, cur); !ok {
return i, false
}
}
return -1, true
}

// contains checks that the sorted list, set contains elem. If set does contain elem, then the
// index in set of elem is returned.
func contains(set []Tx, elem Tx) (int, bool) {
n := sort.Search(len(set), func(i int) bool {
return bytes.Compare(elem, set[i]) <= 0
})
if n == len(set) || !bytes.Equal(elem, set[n]) {
return -1, false
}
return n, true
}

// TxProof represents a Merkle proof of the presence of a transaction in the Merkle tree.
type TxProof struct {
RootHash tmbytes.HexBytes `json:"root_hash"`
Expand Down
14 changes: 7 additions & 7 deletions sei-tendermint/types/validator_set_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ func TestValidatorSetBasic(t *testing.T) {

assert.EqualValues(t, vset, vset.Copy())
assert.False(t, vset.HasAddress([]byte("some val")))
idx, val, ok := vset.GetByAddress([]byte("some val"))
_, _, ok := vset.GetByAddress([]byte("some val"))
require.False(t, ok)
addr, val, ok := vset.GetByIndex(-100)
_, _, ok = vset.GetByIndex(-100)
require.False(t, ok)
addr, val, ok = vset.GetByIndex(0)
_, _, ok = vset.GetByIndex(0)
require.False(t, ok)
addr, val, ok = vset.GetByIndex(100)
_, _, ok = vset.GetByIndex(100)
require.False(t, ok)
assert.Zero(t, vset.Size())
assert.Equal(t, int64(0), vset.TotalVotingPower())
Expand All @@ -49,14 +49,14 @@ func TestValidatorSetBasic(t *testing.T) {
0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95,
0x99, 0x1b, 0x78, 0x52, 0xb8, 0x55}, vset.Hash())
// add
val = randModuloValidator(vset.TotalVotingPower())
val := randModuloValidator(vset.TotalVotingPower())
assert.NoError(t, vset.UpdateWithChangeSet([]*Validator{val}))

assert.True(t, vset.HasAddress(val.Address))
idx, _, ok = vset.GetByAddress(val.Address)
idx, _, ok := vset.GetByAddress(val.Address)
assert.True(t, ok)
assert.EqualValues(t, 0, idx)
addr, _, ok = vset.GetByIndex(0)
addr, _, ok := vset.GetByIndex(0)
assert.True(t, ok)
assert.Equal(t, []byte(val.Address), addr)
assert.Equal(t, 1, vset.Size())
Expand Down
Loading