Skip to content
Business logic Audit finding Intermediate

Non-deterministic Ranges in Inference Synthesis Causing Inconsistent State Across Nodes

The inference synthesis process uses non-deterministic ranges, causing different nodes to produce inconsistent state. This can lead to inconsistent inference and forecast results, difficulty in debugging, potential data corruption, and consensus issues.

0x416 Follow with defsec, imsrybr0 and 1 other

Originally disclosed on Sherlock

Source: https://github.com/sherlock-audit/2024-06-allora-judging/issues/38

Found by

0x416, defsec, imsrybr0, volodya

Summary

In the inference_synthesis package, the inference synthesis process is utilizing non-deterministic ranges. This non-deterministic behavior can lead to inconsistent state across different nodes, particularly for any data saved from the inference synthesis. The inconsistency can cause significant issues in the system's overall functionality and reliability.

Vulnerability Detail

In the inference_synthesis package, the inference synthesis process is utilizing non-deterministic ranges. This non-deterministic behavior can lead to inconsistent state across different nodes, particularly for any data saved from the inference synthesis. The inconsistency can cause significant issues in the system's overall functionality and reliability.

The code section in question involves creating deep copies of various maps and structs within the SynthPalette struct. While the cloning function is properly creating deep copies, the inference synthesis process itself is not deterministic, which leads to the described issue.

Impact

This issue can cause multiple nodes in a distributed system to have differing states due to the non-deterministic ranges used during inference synthesis. This can result in:

  • Inconsistent inference and forecast results across nodes.
  • Difficulty in debugging and maintaining the system due to unpredictable state changes.
  • Potential data corruption or loss of data integrity, which can affect overall system performance and reliability.
  • Issues in consensus mechanisms if nodes cannot agree on a single state.

Code Snippet

synth_palette_bootstrap.go#L58-L82

Go
func (p SynthPalette) Clone() SynthPalette {
	inferenceByWorker := make(map[Worker]*emissionstypes.Inference, len(p.InferenceByWorker))
	for k, v := range p.InferenceByWorker {
		inferenceCopy := *v
		inferenceByWorker[k] = &inferenceCopy
	}
	forecastByWorker := make(map[Worker]*emissionstypes.Forecast, len(p.ForecastByWorker))
	for k, v := range p.ForecastByWorker {
		forecastCopy := *v
		forecastByWorker[k] = &forecastCopy
	}
	forecastImpliedInferenceByWorker := make(map[Worker]*emissionstypes.Inference, len(p.ForecastImpliedInferenceByWorker))
	for k, v := range p.ForecastImpliedInferenceByWorker {
		inferenceCopy := *v
		forecastImpliedInferenceByWorker[k] = &inferenceCopy
	}
	infererRegrets := make(map[Worker]*StatefulRegret, len(p.InfererRegrets))
	for k, v := range p.InfererRegrets {
		regretCopy := *v
		infererRegrets[k] = &regretCopy
	}
	forecasterRegrets := make(map[Worker]*StatefulRegret, len(p.ForecasterRegrets))
	for k, v := range p.ForecasterRegrets {
		regretCopy := *v
		forecasterRegrets[k] = &regretCopy
	}

Tool used

Manual Review

Recommendation

  • Review the inference synthesis process and identify the sources of non-determinism.
  • Ensure that all ranges and related calculations are deterministic, i.e., they produce the same output given the same input across all nodes.

Discussion

sherlock-admin3

1 comment(s) were left on this issue during the judging contest.

0xmystery commented:

Map is non-deterministic

sherlock-admin2

The protocol team fixed this issue in the following PRs/commits: https://github.com/allora-network/allora-chain/pull/408

The original report as published on Sherlock, by 0x416. Images and videos are our own copies; raw HTML is shown as text. View it on Sherlock.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

Likely, the use of non-deterministic ranges (such as iterating over maps) in the inference synthesis process causes different nodes to compute different results.

Impact

Multiple nodes may have differing states, leading to inconsistent inference and forecast results, debugging difficulties, potential data corruption, and consensus issues.

What the attacker needed

None

The fix

The protocol team fixed this issue in the referenced PRs/commits.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

In a blockchain, all nodes must compute the same result from the same input. Here, the code used a method that could produce different results on different nodes, so they might disagree on the state. This can break the system's reliability.

What is Business logic?

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.

More by 0x416

View all

3 more disclosed reports, best first.

More from Allora

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Business logic flaws

The lesson behind this report.

The application works as coded but not as intended: a negative price, a skipped payment step, a limit that can be crossed.