Skip to content

Fixture recorder should capture NetworkID from Config #1

@LeJamon

Description

@LeJamon

Problem

The fixture recorder does not capture the NETWORK_ID value from Config when recording env and env_reset steps. This means fixtures for tests that change the network ID mid-test (like NetworkID_test.cpp) produce env configs missing the network_id field.

Example

NetworkID_test.cpp creates three separate Env objects with different network IDs:

test::jtx::Env env{*this, makeNetworkConfig(0)};     // block 1
test::jtx::Env env{*this, makeNetworkConfig(1024)};   // block 2
test::jtx::Env env{*this, makeNetworkConfig(1025)};   // block 3

The recorder captures env_reset steps for blocks 2 and 3 with amendments_enabled, base_fee, reserve_base, reserve_increment — but NOT network_id. This causes conformance consumers to default to network_id=0 for all blocks.

Impact

Without network_id in the fixture, block 3 (networkID=1025) transactions fail with telNETWORK_ID_MAKES_TX_NON_CANONICAL instead of the expected tesSUCCESS or telWRONG_NETWORK, because the consuming test environment doesn't know to set networkID=1025.

Fix

The FixtureRecorder should include network_id in the env config JSON when recording:

  • The initial env section (from the Env constructor)
  • Any env_reset steps (when a new Env is created mid-test)
{
  "env": {
    "amendments_enabled": [...],
    "base_fee": 10,
    "reserve_base": 200000000,
    "reserve_increment": 50000000,
    "network_id": 1025
  }
}

The field can be omitted when network_id is 0 (mainnet default) to keep existing fixtures unchanged.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions