Skip to content

Revert sidecar/trace data with "write" semantics in failed AtomicBatch #22516

@tinker-michaelj

Description

@tinker-michaelj

Here there is a hidden assumption that successful EVM tx executions in a batch will not have a later operation fail. C.f. a temporary workaround,

                            if (value == null) {
                                Bytes valueFromState;
                                if (executingHookId == null
                                        || contractId.contractNumOrThrow() != HTS_HOOKS_CONTRACT_NUM) {
                                    valueFromState = writtenSlots.get(slotKey);
                                } else {
                                    valueFromState = writtenLambdaSlots.get(
                                            new LambdaSlotKey(executingHookId, minimalKey(slotKey.key())));
                                }
                                if (valueFromState == null) {
                                    // (FUTURE) - uncomment throw below once we have determined the right way to
                                    // unblock BlockItem -> TransactionSidecarRecord translation for the scenario in
                                    // ContractGetInfoSuite#userPaysTheGasUsed()
                                    //                                    throw new IllegalStateException("No written
                                    // value found for write to " + slotKey
                                    //                                            + " in " + remainingStateChanges);
                                    valueFromState = Bytes.fromHex("02");
                                }
                                value = HookUtils.minimalRepresentationOf(valueFromState);
                            }

The fix actually applies to both record stream sidecars and block stream trace data:

  • When an AtomicBatch fails, revert or revise any data with "write" semantics.

Metadata

Metadata

Labels

P2Required to be completed in the assigned milestone, but may or may not impact the release schedule.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions