Skip to content

Commit

Permalink
v4: removing forcing user to post to specific providers (#414)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheMarstonConnell committed Apr 4, 2024
2 parents 9789b7f + 3e7b4ce commit a13f5b5
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 30 deletions.
29 changes: 0 additions & 29 deletions x/storage/keeper/msg_server_post_file.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,6 @@ func (k msgServer) PostFile(goCtx context.Context, msg *types.MsgPostFile) (*typ
}

window := k.GetParams(ctx).ProofWindow
// if msg.ProofInterval != window {
// return nil, sdkerrors.Wrapf(sdkerrors.ErrUnauthorized, "cannot create a file with a window different than %d", window)
//}

providers := k.GetActiveProviders(ctx, "")
if len(providers) == 0 {
allProviders := k.GetRandomizedProviders(ctx)

l := make([]types.ActiveProviders, len(allProviders))
for i, provider := range allProviders {
l[i] = types.ActiveProviders{Address: provider.Address}
}

providers = l
}

file := types.UnifiedFile{
Merkle: msg.Merkle,
Expand All @@ -50,20 +35,6 @@ func (k msgServer) PostFile(goCtx context.Context, msg *types.MsgPostFile) (*typ

ips := make([]string, 0)

for i, provider := range providers { // adding all provers
if i >= int(msg.MaxProofs) {
break
}
file.AddProver(ctx, k, provider.Address)

prv, found := k.GetProviders(ctx, provider.Address)
if !found {
continue
}

ips = append(ips, prv.Ip)
}

res := &types.MsgPostFileResponse{ProviderIps: ips, StartBlock: ctx.BlockHeight()}

totalSize := msg.FileSize * msg.MaxProofs
Expand Down
2 changes: 1 addition & 1 deletion x/storage/keeper/msg_server_post_file_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (suite *KeeperTestSuite) TestPostFile() {
} else {
suite.Require().NoError(err)

suite.Require().Equal(1, len(res.ProviderIps))
suite.Require().Equal(0, len(res.ProviderIps)) // we do not pre-populate the provider IPs in v4 since the econ change. Change this to > 1 if ever the econ changes and required pre-population
}
})
}
Expand Down

0 comments on commit a13f5b5

Please sign in to comment.