Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
manojkgorle committed Dec 17, 2024
1 parent 3dee388 commit 159a733
Show file tree
Hide file tree
Showing 11 changed files with 29 additions and 33 deletions.
4 changes: 2 additions & 2 deletions actions/auction.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ func (*Auction) GetTypeID() uint8 {
return AuctionID
}

func (a *Auction) StateKeys(actor codec.Address, _ ids.ID) state.Keys {
func (a *Auction) StateKeys(_ codec.Address, _ ids.ID) state.Keys {
return state.Keys{
string(storage.BalanceKey(a.AuctionInfo.BuilderSEQAddress)): state.Read | state.Write,
string(storage.BalanceKey(ArcadiaFundAddress())): state.All,
Expand Down Expand Up @@ -130,7 +130,7 @@ func (*Auction) ComputeUnits(codec.Address, chain.Rules) uint64 {
return AuctionComputeUnits
}

func (a *Auction) Size() int {
func (*Auction) Size() int {
return 2*consts.Uint64Len + bls.PublicKeyLen + bls.SignatureLen + codec.AddressLen
}

Expand Down
4 changes: 2 additions & 2 deletions actions/epoch_exit.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func (*EpochExit) GetTypeID() uint8 {
return hactions.EpochExitID
}

func (e *EpochExit) StateKeys(actor codec.Address, _ ids.ID) state.Keys {
func (e *EpochExit) StateKeys(_ codec.Address, _ ids.ID) state.Keys {
return state.Keys{
string(hactions.EpochExitsKey(e.Epoch)): state.All,
string(storage.RollupInfoKey(e.Info.Namespace)): state.Read,
Expand All @@ -50,7 +50,7 @@ func (e *EpochExit) Execute(
ctx context.Context,
_ chain.Rules,
mu state.Mutable,
ts int64,
_ int64,
_ uint64,
actor codec.Address,
_ ids.ID,
Expand Down
18 changes: 9 additions & 9 deletions actions/rollup_register.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func (*RollupRegistration) GetTypeID() uint8 {
return hactions.RollupRegisterID
}

func (r *RollupRegistration) StateKeys(actor codec.Address, _ ids.ID) state.Keys {
func (r *RollupRegistration) StateKeys(_ codec.Address, _ ids.ID) state.Keys {
return state.Keys{
string(storage.RollupInfoKey(r.Namespace)): state.All,
string(storage.RollupRegistryKey()): state.All,
Expand Down Expand Up @@ -131,20 +131,20 @@ func (r *RollupRegistration) Marshal(p *codec.Packer) {
}

func UnmarshalRollupRegister(p *codec.Packer) (chain.Action, error) {
var RollupReg RollupRegistration
var rollupReg RollupRegistration
info, err := hactions.UnmarshalRollupInfo(p)
if err != nil {
return nil, err
}
RollupReg.Info = *info
p.UnpackBytes(-1, false, &RollupReg.Namespace)
RollupReg.OpCode = p.UnpackInt(false)
if RollupReg.OpCode == CreateRollup {
RollupReg.StartEpoch = p.UnpackUint64(true)
rollupReg.Info = *info
p.UnpackBytes(-1, false, &rollupReg.Namespace)
rollupReg.OpCode = p.UnpackInt(false)
if rollupReg.OpCode == CreateRollup {
rollupReg.StartEpoch = p.UnpackUint64(true)
} else {
RollupReg.StartEpoch = p.UnpackUint64(false)
rollupReg.StartEpoch = p.UnpackUint64(false)
}
return &RollupReg, nil
return &rollupReg, nil
}

func (*RollupRegistration) ValidRange(chain.Rules) (int64, int64) {
Expand Down
2 changes: 1 addition & 1 deletion cmd/seq-cli/cmd/action.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ var auctionCmd = &cobra.Command{
return err
}

epochNumber := uint64(hght/12*hconsts.MillisecondsPerSecond) + 1
epochNumber := hght/12*hconsts.MillisecondsPerSecond + 1

p, err := bls.GeneratePrivateKey()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/AnomalyFi/nodekit-seq
go 1.21.12

require (
github.com/AnomalyFi/hypersdk v0.9.7-arcadia.9
github.com/AnomalyFi/hypersdk v0.9.7-arcadia.11
github.com/ava-labs/avalanche-network-runner v1.7.4-rc.0
github.com/ava-labs/avalanchego v1.11.10
github.com/ethereum/go-ethereum v1.13.14
Expand Down
10 changes: 4 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,10 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7
filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek=
filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
github.com/AndreasBriese/bbloom v0.0.0-20190306092124-e2d15f34fcf9/go.mod h1:bOvUY6CB00SOBii9/FifXqc0awNKxLFCL/+pkDPuyl8=
github.com/AnomalyFi/hypersdk v0.9.7-arcadia.7 h1:SjoKEjhJ1lWLqwyv/SaiHQnFQooPv82vcu/7EhcT1ww=
github.com/AnomalyFi/hypersdk v0.9.7-arcadia.7/go.mod h1:0Vj2PdwSFN7pat4Sno39IfmtOiv/gO9mxZXyRKnoKtI=
github.com/AnomalyFi/hypersdk v0.9.7-arcadia.8 h1:/ZfefOH39125oxY6kZ6+LzrLG4mfLqsFtC+QLaP39gs=
github.com/AnomalyFi/hypersdk v0.9.7-arcadia.8/go.mod h1:0Vj2PdwSFN7pat4Sno39IfmtOiv/gO9mxZXyRKnoKtI=
github.com/AnomalyFi/hypersdk v0.9.7-arcadia.9 h1:r++xui2FjCI5k7nmaijLhstOCRq3XEE+lGkvpeeOEOo=
github.com/AnomalyFi/hypersdk v0.9.7-arcadia.9/go.mod h1:0Vj2PdwSFN7pat4Sno39IfmtOiv/gO9mxZXyRKnoKtI=
github.com/AnomalyFi/hypersdk v0.9.7-arcadia.10 h1:Hlv6JnBR0vWWjp1Pp/bYPl+UqZjx05b8DqUXm+ChqDE=
github.com/AnomalyFi/hypersdk v0.9.7-arcadia.10/go.mod h1:0Vj2PdwSFN7pat4Sno39IfmtOiv/gO9mxZXyRKnoKtI=
github.com/AnomalyFi/hypersdk v0.9.7-arcadia.11 h1:LJxJVrAjNCc5wgEkgMKTIFTHMtiyaw/6gF2XkICOFT0=
github.com/AnomalyFi/hypersdk v0.9.7-arcadia.11/go.mod h1:0Vj2PdwSFN7pat4Sno39IfmtOiv/gO9mxZXyRKnoKtI=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8=
github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
Expand Down
2 changes: 1 addition & 1 deletion rpc/jsonrpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ func (j *JSONRPCServer) GetBuilder(req *http.Request, args *types.GetBuilderArgs
return nil
}

func (j *JSONRPCServer) GetRollupRegistry(req *http.Request, args *struct{}, reply *types.RegistryReply) error {
func (j *JSONRPCServer) GetRollupRegistry(req *http.Request, _ *struct{}, reply *types.RegistryReply) error {
ctx, span := j.c.Tracer().Start(req.Context(), "Server.GetRollupRegistry")
defer span.End()

Expand Down
4 changes: 2 additions & 2 deletions storage/epoch_exit.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ func setEpochExits(
}

p := codec.NewWriter(size, consts.NetworkSizeLimit)
err := info.Marshal(p)
if err != nil {
info.Marshal(p)
if err := p.Err(); err != nil {
return err
}
infoBytes := p.Bytes()
Expand Down
6 changes: 3 additions & 3 deletions storage/rollup_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ func GetRollupInfoFromState(
func innerGetRollupInfo(
v []byte,
err error,
) (*hactions.RollupInfo, bool, error) {
) (*hactions.RollupInfo, bool, error) { //nolint:unparam
if errors.Is(err, database.ErrNotFound) {
return nil, false, nil
}
Expand All @@ -63,8 +63,8 @@ func SetRollupInfo(
) error {
k := RollupInfoKey(namespace)
p := codec.NewWriter(info.Size(), consts.NetworkSizeLimit)
err := info.Marshal(p)
if err != nil {
info.Marshal(p)
if err := p.Err(); err != nil {
return err
}
infoBytes := p.Bytes()
Expand Down
2 changes: 1 addition & 1 deletion storage/rollup_registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func GetRollupRegistryFromState(
func innerGetRegistry(
v []byte,
err error,
) ([][]byte, bool, error) {
) ([][]byte, bool, error) { //nolint:unparam
if errors.Is(err, database.ErrNotFound) {
return nil, false, nil
}
Expand Down
8 changes: 3 additions & 5 deletions tests/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -347,21 +347,20 @@ var _ = ginkgo.BeforeSuite(func() {
}
}
require.NoError(err)
// valuri := strings.Split(info.Uri, ":")
purl, err := url.Parse(info.Uri)
require.NoError(err)
host, _, err := net.SplitHostPort(purl.Host)
require.NoError(err)
valUri := "http://" + host + hutils.GetPortFromNodeID(nodeID)
hutils.Outf("port url: %s", valUri)
valURI := "http://" + host + hutils.GetPortFromNodeID(nodeID)
hutils.Outf("port url: %s", valURI)
instances = append(instances, instance{
nodeID: nodeID,
uri: u,
cli: cli,
tcli: trpc.NewJSONRPCClient(u, networkID, bid),
wsCli: wsCli,
multicli: trpc.NewMultiJSONRPCClientWithED25519Factory(u, networkID, bid, privBytes),
valCli: rpc.NewJSONRPCValClient(valUri),
valCli: rpc.NewJSONRPCValClient(valURI),
})
}

Expand Down Expand Up @@ -855,7 +854,6 @@ var _ = ginkgo.Describe("[Test]", func() {
require.NoError(err)
require.Equal(len(resp.Blocks), 2)
})

})

// TODO: This is a flaky test. It passes only if the transaction is included just in right blocks. If not tests fails.
Expand Down

0 comments on commit 159a733

Please sign in to comment.