Damn, that is one hell of a question. I am spitballing here so bear with me:
The immediate consequence would be terror in the Petrograd Soviet, given that Trotsky was a prominent figure in the Soviet and wasn't actually a Bolshevik at this point in time (He was still in the Mezhraiontsy at the time of the July Days) and his murder by the government would send shockwaves through the Soviet. There are a couple of ways events could go from there - the Soviet could find itself sidelined like IOTL until Kerensky and Kornilov butt heads like IOTL, but it could also serve as a spur to action for the Soviet. Now granted, with the July Days having just ended in miserable failure they are unlikely to be able to provoke an uprising in Petrograd itself but you might see people follow Lenin's lead and flee for the hills. If the Soviet feels sufficiently scared of the Provisional government it might well fracture. On the other hand, the Soviet as a whole might be radicalized by Trotsky's murder. You could also see protests, demonstrations and the like spread to other Russian cities as word of Trotsky's murder spreads. Trotsky was the most prominent and well known politician at this point in time both nationally and internationally so his death would set off a fire storm.
Now if we move forward to the Kornilov Affair, then the first question to ask is what has happened with the Mezhraiontsy following Trotsky's death? Are they still independent of the Bolsheviks? Have they joined the Mensheviks? Bolsheviks? From there it is a question of whether the Bolsheviks, without Trotsky's presence in the Petrograd Soviet, would be able to muster sufficient resistance to Kornilov's attempted coup for it to fall apart as IOTL. If it doesn't fall apart then we get into a scenario similar to my TL, but lets focus on if it proceeds at least somewhat like OTL and falls apart. Then we get into the twilight of Kerensky's rule.
This is when the question about the Mezhraiontsy becomes important because Trotsky was a major voice supporting Lenin in favor of the October Revolution and many of the people he brought with him to the Bolsheviks from the Mezhraiontsy were key players in the October Revolution and its aftermath - including Antonov-Osveenko, Lunacharsky, Joffe and many more. Without those talented leaders, the Bolsheviks are going to have a much harder time pulling off their attempted coup. Additionally, without Trotsky Lenin is going to be in a much weaker position when trying to argue in favor of a Revolution. To be honest, I am not sure he would be able to convince Zinoviev and Kamenev without Trotsky on side. That would lead into a scenario where the Bolsheviks do't attempt their coup and Lenin is instead forced into working with the other Soviet parties against his will. This actually has some really interesting prospects.
Kerensky is unlikely to hold onto power past New Years 1917 and the Soviet parties are the most likely to take his place at the top. The composition of the coalition that resulted from this would be important to what followed, as would be whether the new government goes ahead with the election of a Constituent Assembly. From here I could see Lenin trying to sabotage the coalition from the inside while worming his way to power. That said, I am not sure Lenin would be particularly good at functioning in a coalition government and he was growing more sickly as we move forward from this point. You probably see Zinoviev and Kamenev emerge as early power players, but I wouldn't count out Stalin and his incredible ability to saturate any network or group he enters with his own supporters. Given time, I could see Stalin maneuvering his way to the top by playing the others off against each other - although he might be too closely tied to Lenin, at least early on, for him to make too many gains.
At this point it gets too vague to really go further without more specificity as regards the points I laid out.