Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump golang.org/x/net from 0.17.0 to 0.23.0 #1160

Merged
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 5 additions & 1 deletion bridge/setu/listener/rootchain_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ func (rl *RootChainListener) handleStakedLog(vLog types.Log, selectedEvent *abi.
rl.Logger.Error("Error while parsing event", "name", selectedEvent.Name, "error", err)
}

if !util.IsPubKeyFirstByteValid(pubkey[0:1]) {
rl.Logger.Error("public key first byte mismatch", "expected", "0x04", "received", pubkey[0:1])
}

if bytes.Equal(event.SignerPubkey, pubkey[1:]) {
// topup has to be processed first before validator join. so adding delay.
delay := util.TaskDelayBetweenEachVal
Expand Down Expand Up @@ -106,7 +110,7 @@ func (rl *RootChainListener) handleSignerChangeLog(vLog types.Log, selectedEvent
rl.Logger.Error("Error while parsing event", "name", selectedEvent.Name, "error", err)
}

if bytes.Equal(event.SignerPubkey, pubkey[1:]) {
if bytes.Equal(event.SignerPubkey, pubkey[1:]) && util.IsPubKeyFirstByteValid(pubkey[0:1]) {
rl.SendTaskWithDelay("sendSignerChangeToHeimdall", selectedEvent.Name, logBytes, 0, event)
} else if isCurrentValidator, delay := util.CalculateTaskDelay(rl.cliCtx, event); isCurrentValidator {
rl.SendTaskWithDelay("sendSignerChangeToHeimdall", selectedEvent.Name, logBytes, delay, event)
Expand Down
9 changes: 9 additions & 0 deletions bridge/setu/util/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -703,3 +703,12 @@ func LogElapsedTimeForStateSyncedEvent(event interface{}, functionName string, s
"stateSyncId", typedEvent.Id,
"timeElapsed", timeElapsed)
}

// IsPubKeyFirstByteValid checks the validity of the first byte of the public key.
// It must be 0x04 for uncompressed public keys
func IsPubKeyFirstByteValid(pubKey []byte) bool {
prefix := make([]byte, 1)
prefix[0] = byte(0x04)

return bytes.Equal(prefix, pubKey[0:1])
}
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ require (
github.com/tendermint/tm-db v0.6.7
golang.org/x/sync v0.3.0
google.golang.org/grpc v1.58.3
google.golang.org/protobuf v1.31.0
google.golang.org/protobuf v1.33.0
)

require (
Expand Down Expand Up @@ -141,10 +141,10 @@ require (
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.19.0
go.opentelemetry.io/otel/sdk v1.19.0
go.opentelemetry.io/otel/trace v1.19.0
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/crypto v0.21.0 // indirect
golang.org/x/net v0.23.0 // indirect
golang.org/x/oauth2 v0.10.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/api v0.126.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand All @@ -159,7 +159,7 @@ replace github.com/tendermint/tm-db => github.com/tendermint/tm-db v0.2.0

replace github.com/cosmos/cosmos-sdk => github.com/maticnetwork/cosmos-sdk v0.38.4

replace github.com/ethereum/go-ethereum => github.com/maticnetwork/bor v1.2.6-beta
replace github.com/ethereum/go-ethereum => github.com/maticnetwork/bor v1.2.7

replace go.mongodb.org/mongo-driver => go.mongodb.org/mongo-driver v1.5.1

Expand Down
16 changes: 10 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1580,8 +1580,8 @@ github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN
github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc=
github.com/markbates/oncer v0.0.0-20181203154359-bf2de49a0be2/go.mod h1:Ld9puTsIW75CHf65OeIOkyKbteujpZVXDpWK6YGZbxE=
github.com/markbates/safe v1.0.1/go.mod h1:nAqgmRi7cY2nqMc92/bSEeQA+R4OheNU2T1kNSCBdG0=
github.com/maticnetwork/bor v1.2.6-beta h1:pYnrnbWxz+1xqCNM8o45vQRN2pHqgxEg6dxYlf+NsTc=
github.com/maticnetwork/bor v1.2.6-beta/go.mod h1:84m4hX8Ru+n3p/WedvrPpmrjdweSMwGJlB1SjCZiP/M=
github.com/maticnetwork/bor v1.2.7 h1:rSUsFUn8OZHtbFRj6OsmsmxJWLJxrjNQjf+bSy1zsvM=
github.com/maticnetwork/bor v1.2.7/go.mod h1:84m4hX8Ru+n3p/WedvrPpmrjdweSMwGJlB1SjCZiP/M=
github.com/maticnetwork/cosmos-sdk v0.38.4 h1:PAfkMXzHDHJoAf4bXQL4UWgwbu/U3yYuXoXxPhXdpBw=
github.com/maticnetwork/cosmos-sdk v0.38.4/go.mod h1:NbuVdUoqlRF6RrFJp27hpbqSoRB8cJJfUxCzUJWtaLA=
github.com/maticnetwork/crand v1.0.2 h1:Af0tAivC8zrxXDpGWNWVT/0s1fOz8w0eRbahZgURS8I=
Expand Down Expand Up @@ -2175,8 +2175,9 @@ golang.org/x/crypto v0.9.0/go.mod h1:yrmDGqONDYtNj3tH8X9dzUun2m2lzPa9ngI6/RUPGR0
golang.org/x/crypto v0.10.0/go.mod h1:o4eNf7Ede1fv+hwOwZsTHl9EsPFO6q6ZvYR8vYfY45I=
golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIio=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA=
golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand Down Expand Up @@ -2336,8 +2337,9 @@ golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.11.0/go.mod h1:2L/ixqYpgIVXmeoSA/4Lu7BzTG4KIyPIryS4IsOd1oQ=
golang.org/x/net v0.12.0/go.mod h1:zEVYFnQC7m/vmpQFELhcD1EWkZlX69l4oqgmer6hfKA=
golang.org/x/net v0.17.0 h1:pVaXccu2ozPjCXewfr1S7xza/zcXTity9cCdXQYSjIM=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs=
golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -2535,8 +2537,9 @@ golang.org/x/sys v0.9.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.10.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.15.0 h1:h48lPFYpsTvQJZF4EKyI4aLHaev3CxivZmv7yZig9pc=
golang.org/x/sys v0.15.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4=
golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
Expand Down Expand Up @@ -3005,8 +3008,9 @@ google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqw
google.golang.org/protobuf v1.28.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.29.1/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
11 changes: 11 additions & 0 deletions helper/tx.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
package helper

import (
"bytes"
"context"
"encoding/hex"
"errors"
"fmt"
"math/big"
"strings"
Expand Down Expand Up @@ -155,6 +157,15 @@ func (c *ContractCaller) SendTick(signedData []byte, sigs []byte, slashManagerAd
// StakeFor stakes for a validator
func (c *ContractCaller) StakeFor(val common.Address, stakeAmount *big.Int, feeAmount *big.Int, acceptDelegation bool, stakeManagerAddress common.Address, stakeManagerInstance *stakemanager.Stakemanager) error {
signerPubkey := GetPubKey()

prefix := make([]byte, 1)
prefix[0] = byte(0x04)

if !bytes.Equal(prefix, signerPubkey[0:1]) {
Logger.Error("public key first byte mismatch", "expected", "0x04", "received", signerPubkey[0:1])
return errors.New("public key first byte mismatch")
}

signerPubkeyBytes := signerPubkey[1:] // remove 04 prefix

// pack data based on method definition
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/bor_health.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ set -e

while true
do
peers=$(docker exec bor0 bash -c "bor attach /root/var/lib/bor/data/bor.ipc -exec 'admin.peers'")
block=$(docker exec bor0 bash -c "bor attach /root/var/lib/bor/data/bor.ipc -exec 'eth.blockNumber'")
peers=$(docker exec bor0 bash -c "bor attach /var/lib/bor/data/bor.ipc -exec 'admin.peers'")
block=$(docker exec bor0 bash -c "bor attach /var/lib/bor/data/bor.ipc -exec 'eth.blockNumber'")

if [[ -n "$peers" ]] && [[ -n "$block" ]]; then
break
Expand Down
16 changes: 8 additions & 8 deletions integration-tests/smoke_test.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -e

balanceInit=$(docker exec bor0 bash -c "bor attach /root/var/lib/bor/data/bor.ipc -exec 'Math.round(web3.fromWei(eth.getBalance(eth.accounts[0])))'")
balanceInit=$(docker exec bor0 bash -c "bor attach /var/lib/bor/data/bor.ipc -exec 'Math.round(web3.fromWei(eth.getBalance(eth.accounts[0])))'")

stateSyncFound="false"
checkpointFound="false"
Expand All @@ -10,19 +10,19 @@ start_time=$SECONDS

while true
do
balance=$(docker exec bor0 bash -c "bor attach /root/var/lib/bor/data/bor.ipc -exec 'Math.round(web3.fromWei(eth.getBalance(eth.accounts[0])))'")

balance=$(docker exec bor0 bash -c "bor attach /var/lib/bor/data/bor.ipc -exec 'Math.round(web3.fromWei(eth.getBalance(eth.accounts[0])))'")

if ! [[ "$balance" =~ ^[0-9]+$ ]]; then
echo "Something is wrong! Can't find the balance of first account in bor network."
exit 1
fi

if (( $balance > $balanceInit )); then
if [ $stateSyncFound != "true" ]; then
if [ $stateSyncFound != "true" ]; then
stateSyncTime=$(( SECONDS - start_time ))
stateSyncFound="true"
fi
stateSyncFound="true"
fi
fi

checkpointID=$(curl -sL http://localhost:1317/checkpoints/latest | jq .result.id)
Expand All @@ -31,12 +31,12 @@ do
if [ $checkpointFound != "true" ]; then
checkpointTime=$(( SECONDS - start_time ))
checkpointFound="true"
fi
fi
fi

if [ $stateSyncFound == "true" ] && [ $checkpointFound == "true" ]; then
break
fi
fi

done
echo "Both state sync and checkpoint went through. All tests have passed!"
Expand Down
4 changes: 2 additions & 2 deletions packaging/deb/heimdalld/DEBIAN/control
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ Section: develop
Priority: Testing
Maintainer: Polygon <team@polygon.technology>
Build-Depends: debhelper-compat (= 13)
Standards-Version: v1.0.3-amoy-2
Standards-Version: v1.0.5
Homepage: https://polygon.technology
Rules-Requires-Root: no
Package: heimdalld
Version: 1.0.3-amoy-2
Version: 1.0.5
Architecture: amd64
Multi-Arch: foreign
Depends:
Expand Down
2 changes: 1 addition & 1 deletion packaging/templates/package_scripts/control
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: heimdalld
Version: 1.0.3-amoy-2
Version: 1.0.5
Section: develop
Priority: standard
Maintainer: Polygon <release-team@polygon.technology>
Expand Down
2 changes: 1 addition & 1 deletion packaging/templates/package_scripts/control.arm64
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: heimdalld
Version: 1.0.3-amoy-2
Version: 1.0.5
Section: develop
Priority: standard
Maintainer: Polygon <release-team@polygon.technology>
Expand Down
2 changes: 1 addition & 1 deletion packaging/templates/package_scripts/control.profile.amd64
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: heimdalld-profile
Version: 1.0.3-amoy-2
Version: 1.0.5
Section: develop
Priority: standard
Maintainer: Polygon <release-team@polygon.technology>
Expand Down
2 changes: 1 addition & 1 deletion packaging/templates/package_scripts/control.profile.arm64
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Source: heimdalld-profile
Version: 1.0.3-amoy-2
Version: 1.0.5
Section: develop
Priority: standard
Maintainer: Polygon <release-team@polygon.technology>
Expand Down
4 changes: 2 additions & 2 deletions packaging/templates/package_scripts/control.validator
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ Section: develop
Priority: Testing
Maintainer: Polygon <team@polygon.technology>
Build-Depends: debhelper-compat (= 13)
Standards-Version: v1.0.3-amoy-2
Standards-Version: v1.0.5
Homepage: https://polygon.technology
Rules-Requires-Root: no
Package: heimdalld-profile
Version: 1.0.3-amoy-2
Version: 1.0.5
Architecture: amd64
Multi-Arch: foreign
Depends: rabbitmq-server
Expand Down
4 changes: 2 additions & 2 deletions packaging/templates/package_scripts/control.validator.arm64
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ Section: develop
Priority: Testing
Maintainer: Polygon <team@polygon.technology>
Build-Depends: debhelper-compat (= 13)
Standards-Version: v1.0.3-amoy-2
Standards-Version: v1.0.5
Homepage: https://polygon.technology
Rules-Requires-Root: no
Package: heimdalld-profile
Version: 1.0.3-amoy-2
Version: 1.0.5
Architecture: arm64
Multi-Arch: foreign
Depends: rabbitmq-server
Expand Down
8 changes: 8 additions & 0 deletions staking/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,10 @@ func SendValidatorJoinTx(cdc *codec.Codec) *cobra.Command {
return fmt.Errorf("Invalid tx for validator join")
}

if !util.IsPubKeyFirstByteValid(pubkey.Bytes()[0:1]) {
return fmt.Errorf("public key first byte mismatch")
}

if !bytes.Equal(event.SignerPubkey, pubkey.Bytes()[1:]) {
return fmt.Errorf("Public key mismatch with event log")
}
Expand Down Expand Up @@ -276,6 +280,10 @@ func SendValidatorUpdateTx(cdc *codec.Codec) *cobra.Command {
}
pubkey := hmTypes.NewPubKey(pubkeyBytes)

if !util.IsPubKeyFirstByteValid(pubkey.Bytes()[0:1]) {
return fmt.Errorf("public key first byte mismatch")
}

txhash := viper.GetString(FlagTxHash)
if txhash == "" {
return fmt.Errorf("transaction hash has to be supplied")
Expand Down
11 changes: 11 additions & 0 deletions staking/side_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
sdk "github.com/cosmos/cosmos-sdk/types"

authTypes "github.com/maticnetwork/heimdall/auth/types"
"github.com/maticnetwork/heimdall/bridge/setu/util"
"github.com/maticnetwork/heimdall/common"
hmCommon "github.com/maticnetwork/heimdall/common"
"github.com/maticnetwork/heimdall/helper"
Expand Down Expand Up @@ -88,6 +89,11 @@ func SideHandleMsgValidatorJoin(ctx sdk.Context, msg types.MsgValidatorJoin, k K
pubkey := msg.SignerPubKey
signer := pubkey.Address()

if !util.IsPubKeyFirstByteValid(pubkey[0:1]) {
k.Logger(ctx).Error("public key first byte mismatch", "expected", "0x04", "received", pubkey[0:1])
return hmCommon.ErrorSideTx(k.Codespace(), common.CodeInvalidMsg)
}

// check signer pubkey in message corresponds
if !bytes.Equal(pubkey.Bytes()[1:], eventLog.SignerPubkey) {
k.Logger(ctx).Error(
Expand Down Expand Up @@ -237,6 +243,11 @@ func SideHandleMsgSignerUpdate(ctx sdk.Context, msg types.MsgSignerUpdate, k Kee
return hmCommon.ErrorSideTx(k.Codespace(), common.CodeInvalidMsg)
}

if !util.IsPubKeyFirstByteValid(newPubKey.Bytes()[0:1]) {
k.Logger(ctx).Error("public key first byte mismatch", "expected", "0x04", "received", newPubKey.Bytes()[0:1])
return hmCommon.ErrorSideTx(k.Codespace(), common.CodeInvalidMsg)
}

if !bytes.Equal(eventLog.SignerPubkey, newPubKey.Bytes()[1:]) {
k.Logger(ctx).Error("Newsigner pubkey in txhash and msg dont match", "msgPubKey", newPubKey.String(), "pubkeyTx", hmTypes.NewPubKey(eventLog.SignerPubkey[:]).String())
return hmCommon.ErrorSideTx(k.Codespace(), common.CodeInvalidMsg)
Expand Down
3 changes: 2 additions & 1 deletion staking/side_handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
ethTypes "github.com/ethereum/go-ethereum/core/types"

"github.com/maticnetwork/heimdall/app"
"github.com/maticnetwork/heimdall/bridge/setu/util"
chSim "github.com/maticnetwork/heimdall/checkpoint/simulation"
"github.com/maticnetwork/heimdall/common"
errs "github.com/maticnetwork/heimdall/common"
Expand Down Expand Up @@ -89,7 +90,7 @@ func (suite *SideHandlerTestSuite) TestSideHandleMsgValidatorJoin() {
amount, _ := big.NewInt(0).SetString("1000000000000000000", 10)

privKey1 := secp256k1.GenPrivKey()
pubkey := hmTypes.NewPubKey(privKey1.PubKey().Bytes())
pubkey := hmTypes.NewPubKey(util.AppendPrefix(privKey1.PubKey().Bytes()))
address := pubkey.Address()

chainParams := app.ChainKeeper.GetParams(ctx)
Expand Down
3 changes: 2 additions & 1 deletion staking/simulation/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"crypto/rand"
"math/big"

"github.com/maticnetwork/heimdall/bridge/setu/util"
"github.com/maticnetwork/heimdall/types"
"github.com/tendermint/tendermint/crypto/secp256k1"
)
Expand All @@ -12,7 +13,7 @@ import (
func GenRandomVal(count int, startBlock uint64, power int64, timeAlive uint64, randomise bool, startID uint64) (validators []types.Validator) {
for i := 0; i < count; i++ {
privKey1 := secp256k1.GenPrivKey()
pubkey := types.NewPubKey(privKey1.PubKey().Bytes())
pubkey := types.NewPubKey(util.AppendPrefix(privKey1.PubKey().Bytes()))

if randomise {
startBlock = generateRandNumber(10)
Expand Down