Skip to content

Conversation

@RodrigoVillar
Copy link
Contributor

@RodrigoVillar RodrigoVillar commented Sep 16, 2025

Why this should be merged

As mentioned in #4245, there's currently a flake in the load test where the following error(s) will appear early on:

[09-16|17:10:45.042] ERROR tests/simple_test_context.go:57 
        Error Trace:    /Users/rodrigo.villar/go/src/github.com/ava-labs/avalanchego/tests/load/tests.go:375
                                                /Users/rodrigo.villar/go/src/github.com/ava-labs/avalanchego/tests/load/tests.go:297
                                                /Users/rodrigo.villar/go/src/github.com/ava-labs/avalanchego/tests/load/tests.go:213
                                                /Users/rodrigo.villar/go/src/github.com/ava-labs/avalanchego/tests/load/generator.go:103
                                                /Users/rodrigo.villar/go/src/github.com/ava-labs/avalanchego/tests/load/generator.go:87
                                                /Users/rodrigo.villar/go/1.23.9/pkg/mod/golang.org/x/sync@v0.12.0/errgroup/errgroup.go:78
                                                /Users/rodrigo.villar/.goenv/versions/1.23.9/src/runtime/asm_arm64.s:1223
        Error:          Received unexpected error:
                        transaction accepted but failed to execute entirely

This error occurs frequently when setting the number of workers to a high value. After some debugging, it appears that the source of this error is from execution of ModifyTest. Looking at modify()(which ModifyTest calls) in the simulator contract, the current implementation is flawed in that it is allows for modifications of the first two storage slots, which should never happen.

The consequence of this current implementation is a transaction could set latestEmptySlot to an arbitrarily high value, which could result in subsequent transactions failing due to writing to empty slots (via running out of gas), as opposed to writing to non-empty slots.

How this works

Updates modify() to never modify the first 2 contract slots.

How this was tested

CI + ran load test locally with high number of workers

Need to be documented in RELEASES.md?

No

@RodrigoVillar RodrigoVillar marked this pull request as ready for review September 17, 2025 15:11
Copilot AI review requested due to automatic review settings September 17, 2025 15:11
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a flake in the load test by preventing the modify() function from modifying reserved storage slots (first two slots). The issue was causing transactions to fail when latestEmptySlot was set to arbitrarily high values.

  • Updates the assembly code in the modify() function to skip the first 2 contract storage slots
  • Adds an offset to ensure modifications only occur on non-reserved slots
  • Regenerates the contract bindings to reflect the code changes

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
tests/load/contracts/LoadSimulator.sol Updates modify() function assembly to skip first 2 storage slots
tests/load/contracts/LoadSimulator.bindings.go Regenerated Go bindings with updated contract bytecode

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@joshua-kim joshua-kim moved this to In Progress 🏗️ in avalanchego Sep 17, 2025
@maru-ava maru-ava added this pull request to the merge queue Sep 26, 2025
Merged via the queue into master with commit dbbfa66 Sep 26, 2025
35 checks passed
@maru-ava maru-ava deleted the rodrigo/fix-modify-overwrites branch September 26, 2025 04:18
@github-project-automation github-project-automation bot moved this from In Progress 🏗️ to Done 🎉 in avalanchego Sep 26, 2025
joshua-kim added a commit that referenced this pull request Sep 30, 2025
commit 47550e9
Author: Austin Larson <78000745+alarso16@users.noreply.github.com>
Date:   Mon Sep 29 11:24:22 2025 -0400

    Add generics to x/sync (#4275)

commit 8b8ac94
Author: Stephen Buttolph <stephen@avalabs.org>
Date:   Mon Sep 29 11:08:40 2025 -0400

    Use `acp226.DelayExcess` rather than `uint64` (#4358)

commit 32806e0
Author: Geoff Stuart <geoff.vball@gmail.com>
Date:   Fri Sep 26 16:40:10 2025 -0400

    Support all validator set diffs by height (#4342)

    Signed-off-by: Geoff Stuart <geoff.vball@gmail.com>
    Co-authored-by: Stephen Buttolph <stephen@avalabs.org>

commit 57a308a
Author: Jonathan Oppenheimer <jonathan.oppenheimer@avalabs.org>
Date:   Fri Sep 26 13:42:10 2025 -0400

    Set `activationTime` equal to `upgrade.InitiallyActiveTime` for `propservm` (#4351)

    Signed-off-by: Jonathan Oppenheimer <147infiniti@gmail.com>
    Co-authored-by: Stephen Buttolph <stephen@avalabs.org>

commit d57e124
Author: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
Date:   Fri Sep 26 13:29:20 2025 -0400

    Remove UptimeManager#IsConnected (#4333)

    Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>

commit 0985c16
Author: Geoff Stuart <geoff.vball@gmail.com>
Date:   Fri Sep 26 11:19:34 2025 -0400

    Implement GetProposedHeight API in Proposervm (#4222)

    Signed-off-by: Michael Kaplan <55204436+michaelkaplan13@users.noreply.github.com>
    Co-authored-by: ylg <yang.linguan@avalabs.org>
    Co-authored-by: Michael Kaplan <55204436+michaelkaplan13@users.noreply.github.com>
    Co-authored-by: Stephen Buttolph <stephen@avalabs.org>
    Co-authored-by: Michael Kaplan <michael@avalabs.org>

commit dfdd6a7
Author: aaronbuchwald <aaron.buchwald56@gmail.com>
Date:   Fri Sep 26 10:07:08 2025 -0400

    Update daily re-execution benchmark (#4340)

commit d8aa95f
Author: letreturn <letreturn@outlook.com>
Date:   Fri Sep 26 22:12:02 2025 +0800

    Typo Fixes (#4353)

    Signed-off-by: letreturn <letreturn@outlook.com>

commit dbbfa66
Author: rodrigo <77309055+RodrigoVillar@users.noreply.github.com>
Date:   Fri Sep 26 00:02:29 2025 -0400

    fix(load): only modify non-reserved slots (#4283)

commit d0bcd73
Author: Stephen Buttolph <stephen@avalabs.org>
Date:   Thu Sep 25 16:46:19 2025 -0400

    Replace `mockable.MaxTime` with `upgrade.UnscheduledActivationTime` (#4322)

commit 23c5718
Author: Stephen Buttolph <stephen@avalabs.org>
Date:   Thu Sep 25 15:20:33 2025 -0400

    Refactor Warp Verification Tests (#4335)

commit cc72910
Author: Stephen Buttolph <stephen@avalabs.org>
Date:   Thu Sep 25 15:16:19 2025 -0400

    Remove premature optimization in validator manager (#4346)

commit 36baa05
Author: Austin Larson <78000745+alarso16@users.noreply.github.com>
Date:   Thu Sep 25 14:38:53 2025 -0400

    Granite ACP-176 (#4336)

commit d74d90c
Author: rodrigo <77309055+RodrigoVillar@users.noreply.github.com>
Date:   Thu Sep 25 14:38:42 2025 -0400

    refactor(metervm): remove mockable clock (#4338)

Signed-off-by: Joshua Kim <20001595+joshua-kim@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

4 participants