Transactions that touch the same contract are never parallelized, are they?

I’m trying to wrap my head around how parallelization works in Fuel.

I understand that the contract id is permanent, and that this is the only property over which users sign transactions ( txID , outputIndex , balanceRoot , stateRoot , and txPointer are initialized to zero).

But how does parallelization work in this case? Suppose you have a contract Foo, two users Alice and Bob, and two transactions like this:

  1. Alice sends a tx to Foo
  2. Bob sends ax to Foo

These transactions will necessarily have to run on the same thread, won’t they?

Hi there!
I think this section of the spec might help you to grasp around it.

As seen in the spec, values such as txID, outputIndex are set after the base sanity checks
.

Let me know if you need further explanation! :palm_tree:

1 Like

Key part of the link @sandusky shared is this:

The validity rules below assume sequential transaction validation for side effects (i.e. state changes). However, by construction, transactions with disjoint write access lists can be validated in parallel, including with overlapping read-only access lists. Transactions with overlapping write access lists must be validated and placed in blocks in topological order.

So in the example you sent, you’re correct that the two transactions would have to be executed in serial.

This is one reason Fuel uses native assets: so that asset transfers can be processed in parallel, and don’t require access to the contract that minted them.

2 Likes

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.