Skip to content

Commit

Permalink
Re-send messages in critical path to other nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
ranchalp committed Aug 7, 2023
1 parent eafd4e5 commit fdd97de
Show file tree
Hide file tree
Showing 42 changed files with 190 additions and 218 deletions.
1 change: 1 addition & 0 deletions pkg/accountability/simpleacc/accountability.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ func NewReconfigurableModule(mc ModuleConfig, paramsTemplate ModuleParams, logge
// Fill in instance-specific parameters.
moduleParams := paramsTemplate
moduleParams.Membership = accParams.Membership
moduleParams.RetentionIndex = accParams.RetentionIndex

// Create a new instance of the multisig collector.
accountabilityModule, err := NewModule(
Expand Down
9 changes: 7 additions & 2 deletions pkg/accountability/simpleacc/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import (
"github.com/filecoin-project/mir/pkg/logging"
accpbtypes "github.com/filecoin-project/mir/pkg/pb/accountabilitypb/types"
trantorpbtypes "github.com/filecoin-project/mir/pkg/pb/trantorpb/types"
timertypes "github.com/filecoin-project/mir/pkg/timer/types"
tt "github.com/filecoin-project/mir/pkg/trantor/types"
t "github.com/filecoin-project/mir/pkg/types"
)

Expand All @@ -17,15 +19,18 @@ type ModuleConfig struct {
Ordering t.ModuleID // provides Predecisions
App t.ModuleID // receives Decisions and/or PoMs
Crypto t.ModuleID // provides cryptographic primitives
Timer t.ModuleID // provides Timing primitives
Net t.ModuleID // provides network primitives
}

// ModuleParams sets the values for the parameters of an instance of the protocol.
// All replicas are expected to use identical module parameters.
type ModuleParams struct {
Membership *trantorpbtypes.Membership // the list of participating nodes
Membership *trantorpbtypes.Membership // The list of participating nodes.
LightCertificates bool
PomsHandler func(m dsl.Module, // function to be called when PoMs detected
ResendFrequency timertypes.Duration // Frequency with which messages in the critical path are re-sent
RetentionIndex tt.RetentionIndex
PoMsHandler func(m dsl.Module, // Function to be called when PoMs detected.
mc *ModuleConfig,
params *ModuleParams,
state *incommon.State,
Expand Down
2 changes: 1 addition & 1 deletion pkg/accountability/simpleacc/internal/poms/poms.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ func HandlePoMs(
logger.Log(logging.LevelWarn, "Found valid PoMs! sending...")

// Handle PoMs according to the application's logic defined when creating the accountability factory
params.PomsHandler(m, mc, params, state, state.UnhandledPoMs, logger)
params.PoMsHandler(m, mc, params, state, state.UnhandledPoMs, logger)

for _, pom := range state.UnhandledPoMs {
state.HandledPoMs[pom.NodeId] = pom
Expand Down
28 changes: 20 additions & 8 deletions pkg/accountability/simpleacc/internal/predecisions/predecisions.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package predecisions

import (
eventpbdsl "github.com/filecoin-project/mir/pkg/pb/eventpb/dsl"
eventpbtypes "github.com/filecoin-project/mir/pkg/pb/eventpb/types"
"reflect"

"github.com/filecoin-project/mir/pkg/accountability/simpleacc/internal/certificates/lightcertificates"
Expand All @@ -19,6 +21,7 @@ import (
cryptopbdsl "github.com/filecoin-project/mir/pkg/pb/cryptopb/dsl"
cryptopbtypes "github.com/filecoin-project/mir/pkg/pb/cryptopb/types"
transportpbdsl "github.com/filecoin-project/mir/pkg/pb/transportpb/dsl"
transportpbevents "github.com/filecoin-project/mir/pkg/pb/transportpb/events"
t "github.com/filecoin-project/mir/pkg/types"
"github.com/filecoin-project/mir/pkg/util/maputil"
"github.com/filecoin-project/mir/pkg/util/membutil"
Expand Down Expand Up @@ -79,7 +82,13 @@ func IncludePredecisions(
state.LocalPredecision.SignedPredecision.Signature = signature

// Broadcast signed predecision to all participants (including oneself).
transportpbdsl.SendMessage(m, mc.Net, accpbmsgs.SignedPredecision(mc.Self, sr.data, signature), maputil.GetKeys(params.Membership.Nodes))
eventpbdsl.TimerRepeat(m,
mc.Timer,
[]*eventpbtypes.Event{transportpbevents.SendMessage(mc.Net, accpbmsgs.SignedPredecision(mc.Self, sr.data, signature), maputil.GetKeys(params.Membership.Nodes))},
params.ResendFrequency,
params.RetentionIndex,
)

return nil
})

Expand Down Expand Up @@ -230,13 +239,16 @@ func decide(m dsl.Module, mc *common.ModuleConfig, params *common.ModuleParams,
}

// Find the actual predecision from other nodes
transportpbdsl.SendMessage(
m,
mc.Net,
accpbmsgs.RequestSBMessage(mc.Self,
predecision),
state.PredecisionNodeIDs[string(predecision)])

eventpbdsl.TimerRepeat(m,
mc.Timer,
[]*eventpbtypes.Event{transportpbevents.SendMessage(
mc.Net,
accpbmsgs.RequestSBMessage(mc.Self,
predecision),
state.PredecisionNodeIDs[string(predecision)])},
params.ResendFrequency,
params.RetentionIndex,
)
}

func finishWithDecision(
Expand Down
3 changes: 1 addition & 2 deletions pkg/modules/mockmodules/internal/mock_internal/impl.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 3 additions & 5 deletions pkg/net/grpc/grpctransport.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pkg/net/grpc/grpctransport_grpc.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

63 changes: 38 additions & 25 deletions pkg/pb/accountabilitypb/accountabilitypb.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 9 additions & 5 deletions pkg/pb/accountabilitypb/types/types.mir.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions pkg/pb/apppb/apppb.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions pkg/pb/availabilitypb/availabilitypb.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions pkg/pb/availabilitypb/batchdbpb/batchdbpb.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions pkg/pb/availabilitypb/mscpb/mscpb.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 4 additions & 6 deletions pkg/pb/batchfetcherpb/batchfetcherpb.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit fdd97de

Please sign in to comment.