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

Add support for GenesisSlot protocol parameters to have a genesis != 0 #5

Merged
merged 3 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
4 changes: 2 additions & 2 deletions components/validator/issuer.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ func reviveChain(ctx context.Context, issuingTime time.Time) (*iotago.Commitment
}

// Get a rootblock as recent as possible for the parent.
parentBlockID := iotago.EmptyBlockID
parentBlockID := deps.NodeBridge.APIProvider().APIForTime(issuingTime).ProtocolParameters().GenesisBlockID()
for rootBlock := range activeRootBlocks {
if rootBlock.Slot() > parentBlockID.Slot() {
parentBlockID = rootBlock
Expand Down Expand Up @@ -255,7 +255,7 @@ func getAddressableCommitment(ctx context.Context, blockSlot iotago.SlotIndex) (
}

if blockSlot < commitment.Slot+protoParams.MinCommittableAge() {
if blockSlot < protoParams.MinCommittableAge() || commitment.Slot < protoParams.MinCommittableAge() {
if blockSlot < protoParams.GenesisSlot()+protoParams.MinCommittableAge() || commitment.Slot < protoParams.GenesisSlot()+protoParams.MinCommittableAge() {
return commitment, nil
}

Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ require (
github.com/iotaledger/hive.go/ierrors v0.0.0-20231027195901-620bd7470e42
github.com/iotaledger/hive.go/runtime v0.0.0-20231027195901-620bd7470e42
github.com/iotaledger/inx-app v1.0.0-rc.3.0.20231031135002-4c79ea5193f5
github.com/iotaledger/iota.go/v4 v4.0.0-20231031113109-5d7d59311967
github.com/iotaledger/iota.go/v4 v4.0.0-20231031141917-e514cdca2d25
go.uber.org/dig v1.17.1

)
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,8 @@ github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231031134131-b6ad918dc1ac h1:c7R33+
github.com/iotaledger/inx/go v1.0.0-rc.2.0.20231031134131-b6ad918dc1ac/go.mod h1:qPuMUvCTaghsnYRDnRoRuztTyEKFlmi2S7gb44rH7WM=
github.com/iotaledger/iota.go/v4 v4.0.0-20231031113109-5d7d59311967 h1:qiBW4TiRdzVJshLu7RoWn9ur64SFLCOQ0oFtQWtz4bk=
github.com/iotaledger/iota.go/v4 v4.0.0-20231031113109-5d7d59311967/go.mod h1:jqbLYq4a/FwuiPBqFfkAwwxU8vs3+kReRq2/tyX5qRA=
github.com/iotaledger/iota.go/v4 v4.0.0-20231031141917-e514cdca2d25 h1:GXzRrRohi46SPhwcz+9455PaEh2j+wyc7r0sBFTX6PM=
github.com/iotaledger/iota.go/v4 v4.0.0-20231031141917-e514cdca2d25/go.mod h1:jqbLYq4a/FwuiPBqFfkAwwxU8vs3+kReRq2/tyX5qRA=
github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo=
github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfCI6z80xFu9LTZmf1ZRjMHUOPmWr69U=
github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc=
Expand Down