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

Type safety from iota.go #403

Merged
merged 7 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from 4 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
2 changes: 1 addition & 1 deletion components/dashboard/explorer_routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func setupExplorerRoutes(routeGroup *echo.Group) {
search := c.Param("search")
result := &SearchResult{}

blockID, err := iotago.SlotIdentifierFromHexString(search)
blockID, err := iotago.BlockIDFromHexString(search)
if err != nil {
return ierrors.Wrapf(ErrInvalidParameter, "search ID %s", search)
}
Expand Down
2 changes: 1 addition & 1 deletion components/debugapi/blocks.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func getSlotBlockIDs(index iotago.SlotIndex) (*BlockChangesResponse, error) {
}

includedBlocks := make([]string, 0)
tangleTree := ads.NewSet(mapdb.NewMapDB(), iotago.SlotIdentifier.Bytes, iotago.SlotIdentifierFromBytes)
tangleTree := ads.NewSet(mapdb.NewMapDB(), iotago.BlockID.Bytes, iotago.BlockIDFromBytes)

_ = blocksForSlot.StreamKeys(func(blockID iotago.BlockID) error {
includedBlocks = append(includedBlocks, blockID.String())
Expand Down
4 changes: 2 additions & 2 deletions components/restapi/core/transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
func blockIDByTransactionID(c echo.Context) (iotago.BlockID, error) {
txID, err := httpserver.ParseTransactionIDParam(c, restapipkg.ParameterTransactionID)
if err != nil {
return iotago.EmptyBlockID(), ierrors.Wrapf(err, "failed to parse transaction ID: %s", c.Param(restapipkg.ParameterTransactionID))
return iotago.EmptyBlockID, ierrors.Wrapf(err, "failed to parse transaction ID: %s", c.Param(restapipkg.ParameterTransactionID))
}

return blockIDFromTransactionID(txID)
Expand All @@ -27,7 +27,7 @@ func blockIDFromTransactionID(transactionID iotago.TransactionID) (iotago.BlockI

output, err := deps.Protocol.MainEngineInstance().Ledger.Output(outputID)
if err != nil {
return iotago.EmptyBlockID(), ierrors.Wrapf(err, "failed to get output: %s", outputID.String())
return iotago.EmptyBlockID, ierrors.Wrapf(err, "failed to get output: %s", outputID.String())
}

return output.BlockID(), nil
Expand Down
32 changes: 16 additions & 16 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,21 @@ require (
github.com/gorilla/websocket v1.5.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/iotaledger/hive.go/ads v0.0.0-20230928074706-d58e32f86729
github.com/iotaledger/hive.go/app v0.0.0-20230928074706-d58e32f86729
github.com/iotaledger/hive.go/constraints v0.0.0-20230929122509-67f34bfed40d
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20230929122509-67f34bfed40d
github.com/iotaledger/hive.go/crypto v0.0.0-20230929122509-67f34bfed40d
github.com/iotaledger/hive.go/ds v0.0.0-20230928074706-d58e32f86729
github.com/iotaledger/hive.go/ierrors v0.0.0-20230929122509-67f34bfed40d
github.com/iotaledger/hive.go/app v0.0.0-20231005142627-86973b2edb3b
github.com/iotaledger/hive.go/constraints v0.0.0-20231005142627-86973b2edb3b
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231005142627-86973b2edb3b
github.com/iotaledger/hive.go/crypto v0.0.0-20231005142627-86973b2edb3b
github.com/iotaledger/hive.go/ds v0.0.0-20231005142627-86973b2edb3b
github.com/iotaledger/hive.go/ierrors v0.0.0-20231005142627-86973b2edb3b
github.com/iotaledger/hive.go/kvstore v0.0.0-20230928074706-d58e32f86729
github.com/iotaledger/hive.go/lo v0.0.0-20230929122509-67f34bfed40d
github.com/iotaledger/hive.go/logger v0.0.0-20230928074706-d58e32f86729
github.com/iotaledger/hive.go/runtime v0.0.0-20230929122509-67f34bfed40d
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230929122509-67f34bfed40d
github.com/iotaledger/hive.go/stringify v0.0.0-20230929122509-67f34bfed40d
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231001095511-32be422a567e
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231001095356-923e8f138951
github.com/iotaledger/iota.go/v4 v4.0.0-20231003181920-a3245ad7a737
github.com/iotaledger/hive.go/lo v0.0.0-20231005142627-86973b2edb3b
github.com/iotaledger/hive.go/logger v0.0.0-20231005142627-86973b2edb3b
github.com/iotaledger/hive.go/runtime v0.0.0-20231005142627-86973b2edb3b
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231005142627-86973b2edb3b
github.com/iotaledger/hive.go/stringify v0.0.0-20231005142627-86973b2edb3b
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231005192108-08a985c2e217
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231005191759-16a3636128c4
github.com/iotaledger/iota.go/v4 v4.0.0-20231005184534-62e6761a7b7c
github.com/labstack/echo/v4 v4.11.1
github.com/labstack/gommon v0.4.0
github.com/libp2p/go-libp2p v0.30.0
Expand All @@ -41,7 +41,7 @@ require (
github.com/zyedidia/generic v1.2.1
go.uber.org/atomic v1.11.0
go.uber.org/dig v1.17.0
golang.org/x/crypto v0.13.0
golang.org/x/crypto v0.14.0
google.golang.org/grpc v1.58.2
google.golang.org/protobuf v1.31.0
)
Expand Down Expand Up @@ -174,7 +174,7 @@ require (
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.15.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.12.0 // indirect
golang.org/x/sys v0.13.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.12.1-0.20230815132531-74c255bcf846 // indirect
Expand Down
64 changes: 32 additions & 32 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -277,36 +277,36 @@ github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7 h1:dTrD7X2PT
github.com/iotaledger/grocksdb v1.7.5-0.20230220105546-5162e18885c7/go.mod h1:ZRdPu684P0fQ1z8sXz4dj9H5LWHhz4a9oCtvjunkSrw=
github.com/iotaledger/hive.go/ads v0.0.0-20230928074706-d58e32f86729 h1:HHxgNhbtD6WDCwSQBbPrQe8c4ZNjNi0KcgCJo0nm9bY=
github.com/iotaledger/hive.go/ads v0.0.0-20230928074706-d58e32f86729/go.mod h1:IAWZ/5It5P8B41mWyJXJVcG0vuikVRaTFKQnr2D2q+c=
github.com/iotaledger/hive.go/app v0.0.0-20230928074706-d58e32f86729 h1:rBADf+IZDKkDOuZznwIdonxF9jcOSQJU/qOYSNInX84=
github.com/iotaledger/hive.go/app v0.0.0-20230928074706-d58e32f86729/go.mod h1:eiZgbcwTDZ7d9hEait2EAwAhixWhceW4MXmuVk2EcEw=
github.com/iotaledger/hive.go/constraints v0.0.0-20230929122509-67f34bfed40d h1:bZXrxulDoDBsNg0wtXowrAyltjfgZahiGYuAoS5GKU4=
github.com/iotaledger/hive.go/constraints v0.0.0-20230929122509-67f34bfed40d/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s=
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20230929122509-67f34bfed40d h1:pRcB0wfWAlfDJ10ZZ6LK1ukRXcPaL299LLU/zbYWnsQ=
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20230929122509-67f34bfed40d/go.mod h1:jn3TNmiNRIiQm/rS4VD+7wFHI2+UXABHvCA3PbQxBqI=
github.com/iotaledger/hive.go/crypto v0.0.0-20230929122509-67f34bfed40d h1:Vn8BY/hLTcKJWh8LCw6PDTbCK2562wq93MPynV1pHjE=
github.com/iotaledger/hive.go/crypto v0.0.0-20230929122509-67f34bfed40d/go.mod h1:jP68na941d9uq7RtnA8aQ/FtIGRGz/51cU4uXrInQFU=
github.com/iotaledger/hive.go/ds v0.0.0-20230928074706-d58e32f86729 h1:hHdIZn95+HdP1JdjV8TAsuL5kU4eb4gncehyjXo/feQ=
github.com/iotaledger/hive.go/ds v0.0.0-20230928074706-d58e32f86729/go.mod h1:ZrqsjIJS2QCgGp7Ki+l4hWJQgzfBObUCemb5Upwlx18=
github.com/iotaledger/hive.go/ierrors v0.0.0-20230929122509-67f34bfed40d h1:tmaZvkBCP/OrQrwC728AEFtRAW8YUHBVNE8IXxtd4C4=
github.com/iotaledger/hive.go/ierrors v0.0.0-20230929122509-67f34bfed40d/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8=
github.com/iotaledger/hive.go/app v0.0.0-20231005142627-86973b2edb3b h1:OQ/4K7+2YMMuc2V7oTTpErHYWAwBw7exkQ1UdQUNH1U=
github.com/iotaledger/hive.go/app v0.0.0-20231005142627-86973b2edb3b/go.mod h1:eiZgbcwTDZ7d9hEait2EAwAhixWhceW4MXmuVk2EcEw=
github.com/iotaledger/hive.go/constraints v0.0.0-20231005142627-86973b2edb3b h1:8FdKoB755PjCL1aHTi+2rPt9lCUS4B2wg2fNKykw5dc=
github.com/iotaledger/hive.go/constraints v0.0.0-20231005142627-86973b2edb3b/go.mod h1:dOBOM2s4se3HcWefPe8sQLUalGXJ8yVXw58oK8jke3s=
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231005142627-86973b2edb3b h1:gQ+Wqg8h/LRpgX3CsmaOZYdMIBVL4fAPIrZbmA6Wn3Q=
github.com/iotaledger/hive.go/core v1.0.0-rc.3.0.20231005142627-86973b2edb3b/go.mod h1:jn3TNmiNRIiQm/rS4VD+7wFHI2+UXABHvCA3PbQxBqI=
github.com/iotaledger/hive.go/crypto v0.0.0-20231005142627-86973b2edb3b h1:F91AhJfeVN/XdvzUObUXa5mA38VezBZ9GHhdfQw4fVg=
github.com/iotaledger/hive.go/crypto v0.0.0-20231005142627-86973b2edb3b/go.mod h1:jP68na941d9uq7RtnA8aQ/FtIGRGz/51cU4uXrInQFU=
github.com/iotaledger/hive.go/ds v0.0.0-20231005142627-86973b2edb3b h1:KBactiBVwAvuStyE08lSFVWqMWea6wo5hOny9r3N9HA=
github.com/iotaledger/hive.go/ds v0.0.0-20231005142627-86973b2edb3b/go.mod h1:ZrqsjIJS2QCgGp7Ki+l4hWJQgzfBObUCemb5Upwlx18=
github.com/iotaledger/hive.go/ierrors v0.0.0-20231005142627-86973b2edb3b h1:D07ocbgOyj2d/AGjrIuAxIaQC5SQDndiKp9UaaQwLas=
github.com/iotaledger/hive.go/ierrors v0.0.0-20231005142627-86973b2edb3b/go.mod h1:HcE8B5lP96enc/OALTb2/rIIi+yOLouRoHOKRclKmC8=
github.com/iotaledger/hive.go/kvstore v0.0.0-20230928074706-d58e32f86729 h1:XCYvP8XwETTXF5LNz8q9X3EajDut7+UwTwqJ2TQ0TJo=
github.com/iotaledger/hive.go/kvstore v0.0.0-20230928074706-d58e32f86729/go.mod h1:DeP4JF4N995LteD0+/o7NsW1bO5IXURIJ27A69Ca5+Y=
github.com/iotaledger/hive.go/lo v0.0.0-20230929122509-67f34bfed40d h1:qNmg1DUvge8zPvygQEoulQjLG7gFzWKqPMJ3r7ZESm0=
github.com/iotaledger/hive.go/lo v0.0.0-20230929122509-67f34bfed40d/go.mod h1:4oKCdMEhHMLCudBz79kuvJmgSY/DhfVePNIyJhew/80=
github.com/iotaledger/hive.go/logger v0.0.0-20230928074706-d58e32f86729 h1:FOQetJY2scpCtCGrZQWGw3RwB3lRIDdyu+M6P1NACM4=
github.com/iotaledger/hive.go/logger v0.0.0-20230928074706-d58e32f86729/go.mod h1:sxqWRdZ1OOxwkxVczuGcW034Mpt2vFh5ebJHO++ZYeI=
github.com/iotaledger/hive.go/runtime v0.0.0-20230929122509-67f34bfed40d h1:mn2Gax95UuUpuzEi4osLk+1IBjv5q56LwcxF/lAxk38=
github.com/iotaledger/hive.go/runtime v0.0.0-20230929122509-67f34bfed40d/go.mod h1:fXVyQ1MAwxe/EmjAnG8WcQqbzGk9EW/FsJ/n16H/f/w=
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230929122509-67f34bfed40d h1:1839CFkegKrSvTfWkgYHpH1pudehOXxX05Mzy1KSR7I=
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20230929122509-67f34bfed40d/go.mod h1:IJgaaxbgKCsNat18jlJJEAxCY2oVYR3F30B+M4vJ89I=
github.com/iotaledger/hive.go/stringify v0.0.0-20230929122509-67f34bfed40d h1:ekHWRypoaiCXgrJVUQS7rCewsK3FuG1gTbPxu5jYn9c=
github.com/iotaledger/hive.go/stringify v0.0.0-20230929122509-67f34bfed40d/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs=
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231001095511-32be422a567e h1:Mwoe7M6gI2DAjJIXmIskgnI8KdxCY1LyEEhtJCNYBsU=
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231001095511-32be422a567e/go.mod h1:jhzexR5X8m6qcmrwt5OX477O/ZwT7Ak9sPT83ByPkAo=
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231001095356-923e8f138951 h1:qUf1W0fE1IyZzVy3Exv0Kj+SKECXG3S26c9m2ETb07U=
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231001095356-923e8f138951/go.mod h1:c5778OnWpLq108YE+Eb2m8Ri/t/4ydV0TvI/Sy5YivQ=
github.com/iotaledger/iota.go/v4 v4.0.0-20231003181920-a3245ad7a737 h1:6fuDHswgN9zTwsMuKRKNClnT+rJCojvWf3Hk8f03cvc=
github.com/iotaledger/iota.go/v4 v4.0.0-20231003181920-a3245ad7a737/go.mod h1:+e3bsJFDr9HxmUMe+eQOLNut5wfcB/ivhJdouOJgOnE=
github.com/iotaledger/hive.go/lo v0.0.0-20231005142627-86973b2edb3b h1:UnWVwiVj/BceDDL9J/nCAVRlUDVnbTsCf7PI4lWrdfU=
github.com/iotaledger/hive.go/lo v0.0.0-20231005142627-86973b2edb3b/go.mod h1:4oKCdMEhHMLCudBz79kuvJmgSY/DhfVePNIyJhew/80=
github.com/iotaledger/hive.go/logger v0.0.0-20231005142627-86973b2edb3b h1:fYJ2yrb9cYyoLzlEIxLsdPSSufxh0Xw/AoawlGdpdU8=
github.com/iotaledger/hive.go/logger v0.0.0-20231005142627-86973b2edb3b/go.mod h1:sxqWRdZ1OOxwkxVczuGcW034Mpt2vFh5ebJHO++ZYeI=
github.com/iotaledger/hive.go/runtime v0.0.0-20231005142627-86973b2edb3b h1:skHzoSAI2TNmoJwgW7/aq/Il3JZ5Fa9D5d9U41oWKYg=
github.com/iotaledger/hive.go/runtime v0.0.0-20231005142627-86973b2edb3b/go.mod h1:fXVyQ1MAwxe/EmjAnG8WcQqbzGk9EW/FsJ/n16H/f/w=
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231005142627-86973b2edb3b h1:6anjtWbaCszD5h43psnE8lsgIM0etpjr62ZlN59t0H8=
github.com/iotaledger/hive.go/serializer/v2 v2.0.0-rc.1.0.20231005142627-86973b2edb3b/go.mod h1:IJgaaxbgKCsNat18jlJJEAxCY2oVYR3F30B+M4vJ89I=
github.com/iotaledger/hive.go/stringify v0.0.0-20231005142627-86973b2edb3b h1:cc9VsDzLxPAaC8fj96EA1bJxbmrEZndJV+3SmG+HHOs=
github.com/iotaledger/hive.go/stringify v0.0.0-20231005142627-86973b2edb3b/go.mod h1:FTo/UWzNYgnQ082GI9QVM9HFDERqf9rw9RivNpqrnTs=
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231005192108-08a985c2e217 h1:DdrsW+J04ne2j6bjU1yVu+4C4CjpjGFYDEVMtmg0zyA=
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231005192108-08a985c2e217/go.mod h1:OWZGwG4q2Ypd/D6LJicgdPXtw9yYkhaZEvJFhkIm2Ck=
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231005191759-16a3636128c4 h1:uI+sZeZnGzAkM34JDbZBfyRIXrkkd1L0w8qVJ5rGy3E=
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231005191759-16a3636128c4/go.mod h1:w+DK7WqSka5dzqztfA/l50owI4VhoxcmMAypJq6jf/M=
github.com/iotaledger/iota.go/v4 v4.0.0-20231005184534-62e6761a7b7c h1:3gWmDG+XNtTcT4FxcID6hijCUVs3kRGhAfhdv3FiWJs=
github.com/iotaledger/iota.go/v4 v4.0.0-20231005184534-62e6761a7b7c/go.mod h1:l5yEhEf90+V0sv8kgWINTsM/O6W75bgEDHxWrIlC4AY=
github.com/ipfs/boxo v0.10.0 h1:tdDAxq8jrsbRkYoF+5Rcqyeb91hgWe2hp7iLu7ORZLY=
github.com/ipfs/boxo v0.10.0/go.mod h1:Fg+BnfxZ0RPzR0nOodzdIq3A7KgoWAOWsEIImrIQdBM=
github.com/ipfs/go-cid v0.4.1 h1:A/T3qGvxi4kpKWWcPC/PgbvDA2bjVLO7n4UeVwnbs/s=
Expand Down Expand Up @@ -715,8 +715,8 @@ golang.org/x/crypto v0.0.0-20200602180216-279210d13fed/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/crypto v0.14.0 h1:wBqGXzWJW6m1XrIKlAH0Hs1JJ7+9KBwnIO8v66Q9cHc=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63 h1:m64FZMko/V45gv0bNmrNYoDEq8U5YUhetc9cBWKS1TQ=
golang.org/x/exp v0.0.0-20230817173708-d852ddb80c63/go.mod h1:0v4NqG35kSWCMzLaMeX+IQrlSnVE/bqGSyC2cz/9Le8=
Expand Down Expand Up @@ -830,8 +830,8 @@ golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
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=
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
Expand Down
2 changes: 1 addition & 1 deletion pkg/blockfactory/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (e *Ed25519Account) PrivateKey() ed25519.PrivateKey {
}

func AccountFromParams(accountHex, privateKey string) Account {
accountID, err := iotago.IdentifierFromHexString(accountHex)
accountID, err := iotago.AccountIDFromHexString(accountHex)
if err != nil {
panic(fmt.Sprintln("invalid accountID hex string", err))
}
Expand Down
22 changes: 11 additions & 11 deletions pkg/blockfactory/blockissuer.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func (i *BlockIssuer) AttachBlock(ctx context.Context, iotaBlock *iotago.Protoco

apiForVesion, err := i.protocol.APIForVersion(iotaBlock.ProtocolVersion)
if err != nil {
return iotago.EmptyBlockID(), ierrors.Wrapf(ErrBlockAttacherInvalidBlock, "protocolVersion invalid: %d", iotaBlock.ProtocolVersion)
return iotago.EmptyBlockID, ierrors.Wrapf(ErrBlockAttacherInvalidBlock, "protocolVersion invalid: %d", iotaBlock.ProtocolVersion)
}

protoParams := apiForVesion.ProtocolParameters()
Expand All @@ -294,14 +294,14 @@ func (i *BlockIssuer) AttachBlock(ctx context.Context, iotaBlock *iotago.Protoco
switch payload := innerBlock.Payload.(type) {
case *iotago.SignedTransaction:
if payload.Transaction.NetworkID != protoParams.NetworkID() {
return iotago.EmptyBlockID(), ierrors.Wrapf(ErrBlockAttacherInvalidBlock, "invalid payload, error: wrong networkID: %d", payload.Transaction.NetworkID)
return iotago.EmptyBlockID, ierrors.Wrapf(ErrBlockAttacherInvalidBlock, "invalid payload, error: wrong networkID: %d", payload.Transaction.NetworkID)
}
}

if len(iotaBlock.Parents()) == 0 {
references, referencesErr := i.getReferences(ctx, innerBlock.Payload)
if referencesErr != nil {
return iotago.EmptyBlockID(), ierrors.Wrapf(ErrBlockAttacherAttachingNotPossible, "tipselection failed, error: %w", referencesErr)
return iotago.EmptyBlockID, ierrors.Wrapf(ErrBlockAttacherAttachingNotPossible, "tipselection failed, error: %w", referencesErr)
}

innerBlock.StrongParents = references[iotago.StrongParentType]
Expand All @@ -327,7 +327,7 @@ func (i *BlockIssuer) AttachBlock(ctx context.Context, iotaBlock *iotago.Protoco
}

if err = i.validateReferences(iotaBlock.IssuingTime, iotaBlock.SlotCommitmentID.Slot(), references); err != nil {
return iotago.EmptyBlockID(), ierrors.Wrapf(ErrBlockAttacherAttachingNotPossible, "invalid block references, error: %w", err)
return iotago.EmptyBlockID, ierrors.Wrapf(ErrBlockAttacherAttachingNotPossible, "invalid block references, error: %w", err)
}

if basicBlock, isBasicBlock := iotaBlock.Block.(*iotago.BasicBlock); isBasicBlock && basicBlock.MaxBurnedMana == 0 {
Expand All @@ -337,13 +337,13 @@ func (i *BlockIssuer) AttachBlock(ctx context.Context, iotaBlock *iotago.Protoco
}
rmc, err := i.protocol.MainEngineInstance().Ledger.RMCManager().RMC(rmcSlot)
if err != nil {
return iotago.EmptyBlockID(), ierrors.Wrapf(err, "error loading commitment of slot %d from storage to get RMC", rmcSlot)
return iotago.EmptyBlockID, ierrors.Wrapf(err, "error loading commitment of slot %d from storage to get RMC", rmcSlot)
}

// only set the burned Mana as the last step before signing, so workscore calculation is correct.
basicBlock.MaxBurnedMana, err = basicBlock.ManaCost(rmc, apiForVesion.ProtocolParameters().WorkScoreStructure())
if err != nil {
return iotago.EmptyBlockID(), ierrors.Wrapf(err, "could not calculate Mana cost for block")
return iotago.EmptyBlockID, ierrors.Wrapf(err, "could not calculate Mana cost for block")
}
resign = true
}
Expand All @@ -355,30 +355,30 @@ func (i *BlockIssuer) AttachBlock(ctx context.Context, iotaBlock *iotago.Protoco

signature, signatureErr := iotaBlock.Sign(iotago.NewAddressKeysForEd25519Address(issuerAccount.Address().(*iotago.Ed25519Address), issuerAccount.PrivateKey()))
if signatureErr != nil {
return iotago.EmptyBlockID(), ierrors.Wrapf(ErrBlockAttacherInvalidBlock, "%w", signatureErr)
return iotago.EmptyBlockID, ierrors.Wrapf(ErrBlockAttacherInvalidBlock, "%w", signatureErr)
}

edSig, isEdSig := signature.(*iotago.Ed25519Signature)
if !isEdSig {
return iotago.EmptyBlockID(), ierrors.Wrap(ErrBlockAttacherInvalidBlock, "unsupported signature type")
return iotago.EmptyBlockID, ierrors.Wrap(ErrBlockAttacherInvalidBlock, "unsupported signature type")
}

iotaBlock.Signature = edSig
} else {
return iotago.EmptyBlockID(), ierrors.Wrap(ErrBlockAttacherIncompleteBlockNotAllowed, "signature needed")
return iotago.EmptyBlockID, ierrors.Wrap(ErrBlockAttacherIncompleteBlockNotAllowed, "signature needed")
}
}

modelBlock, err := model.BlockFromBlock(iotaBlock)
if err != nil {
return iotago.EmptyBlockID(), ierrors.Wrap(err, "error serializing block to model block")
return iotago.EmptyBlockID, ierrors.Wrap(err, "error serializing block to model block")
}

if !i.optsRateSetterEnabled || i.protocol.MainEngineInstance().Scheduler.IsBlockIssuerReady(modelBlock.ProtocolBlock().IssuerID) {
i.events.BlockConstructed.Trigger(modelBlock)

if err = i.IssueBlockAndAwaitEvent(ctx, modelBlock, i.protocol.Events.Engine.BlockDAG.BlockAttached); err != nil {
return iotago.EmptyBlockID(), ierrors.Wrap(err, "error issuing model block")
return iotago.EmptyBlockID, ierrors.Wrap(err, "error issuing model block")
}
}

Expand Down
Loading
Loading