From 97b1c2bf440499ad6baa0f0d36057b7b223f0eb8 Mon Sep 17 00:00:00 2001 From: Kolby Moroz Liebl <31669092+KolbyML@users.noreply.github.com> Date: Wed, 28 Jan 2026 08:58:47 -0700 Subject: [PATCH 1/3] stylus params: only use one byte for MaxFragmentCount --- arbos/programs/params.go | 6 +++--- arbos/programs/programs.go | 2 +- contracts-local/src/precompiles | 2 +- precompiles/ArbOwner.go | 2 +- precompiles/ArbOwnerPublic.go | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/arbos/programs/params.go b/arbos/programs/params.go index e7caffc291..5835747b20 100644 --- a/arbos/programs/params.go +++ b/arbos/programs/params.go @@ -61,7 +61,7 @@ type StylusParams struct { KeepaliveDays uint16 BlockCacheSize uint16 MaxWasmSize uint32 - MaxFragmentCount uint16 + MaxFragmentCount uint8 } // Provides a view of the Stylus parameters. Call Save() to persist. @@ -113,7 +113,7 @@ func (p Programs) Params() (*StylusParams, error) { stylusParams.MaxWasmSize = initialMaxWasmSize } if p.ArbosVersion >= params.ArbosVersion_StylusContractLimit { - stylusParams.MaxFragmentCount = arbmath.BytesToUint16(take(2)) + stylusParams.MaxFragmentCount = arbmath.BytesToUint8(take(1)) } else { stylusParams.MaxFragmentCount = 0 } @@ -147,7 +147,7 @@ func (p *StylusParams) Save() error { data = append(data, arbmath.Uint32ToBytes(p.MaxWasmSize)...) } if p.arbosVersion >= params.ArbosVersion_StylusContractLimit { - data = append(data, arbmath.Uint16ToBytes(p.MaxFragmentCount)...) + data = append(data, arbmath.Uint8ToBytes(p.MaxFragmentCount)...) } slot := uint64(0) diff --git a/arbos/programs/programs.go b/arbos/programs/programs.go index 0eecc758e4..aaf5ca40a3 100644 --- a/arbos/programs/programs.go +++ b/arbos/programs/programs.go @@ -339,7 +339,7 @@ func handleClassicStylus(data []byte, maxSize uint32) ([]byte, error) { return arbcompress.DecompressWithDictionary(wasm, int(maxSize), dict) } -func handleRootStylus(statedb vm.StateDB, data []byte, maxSize uint32, maxFragments uint16, isActivation bool) ([]byte, error) { +func handleRootStylus(statedb vm.StateDB, data []byte, maxSize uint32, maxFragments uint8, isActivation bool) ([]byte, error) { root, err := state.NewStylusRoot(data) if err != nil { return nil, err diff --git a/contracts-local/src/precompiles b/contracts-local/src/precompiles index b0777f7a3f..fc3e7865b9 160000 --- a/contracts-local/src/precompiles +++ b/contracts-local/src/precompiles @@ -1 +1 @@ -Subproject commit b0777f7a3f6382a109e4481bacbbe679560ab667 +Subproject commit fc3e7865b925fd98eef596289671527bfa621eca diff --git a/precompiles/ArbOwner.go b/precompiles/ArbOwner.go index 332b3f1a40..0485285845 100644 --- a/precompiles/ArbOwner.go +++ b/precompiles/ArbOwner.go @@ -602,7 +602,7 @@ func (con ArbOwner) SetMultiGasPricingConstraints( return nil } -func (con ArbOwner) SetMaxStylusContractFragments(c ctx, evm mech, maxFragments uint16) error { +func (con ArbOwner) SetMaxStylusContractFragments(c ctx, evm mech, maxFragments uint8) error { params, err := c.State.Programs().Params() if err != nil { return err diff --git a/precompiles/ArbOwnerPublic.go b/precompiles/ArbOwnerPublic.go index 4f7bdeb032..26744d32dc 100644 --- a/precompiles/ArbOwnerPublic.go +++ b/precompiles/ArbOwnerPublic.go @@ -110,7 +110,7 @@ func (con ArbOwnerPublic) GetParentGasFloorPerToken(c ctx, evm mech) (uint64, er return c.State.L1PricingState().ParentGasFloorPerToken() } -func (con ArbOwnerPublic) GetMaxStylusContractFragments(c ctx, evm mech) (uint16, error) { +func (con ArbOwnerPublic) GetMaxStylusContractFragments(c ctx, evm mech) (uint8, error) { params, err := c.State.Programs().Params() if err != nil { return 0, err From 618f2efe91546154dc0d41c0fe98718b798a5deb Mon Sep 17 00:00:00 2001 From: Kolby Moroz Liebl <31669092+KolbyML@users.noreply.github.com> Date: Wed, 28 Jan 2026 10:15:02 -0700 Subject: [PATCH 2/3] update tests --- system_tests/stylus_contract_limit_increase_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/system_tests/stylus_contract_limit_increase_test.go b/system_tests/stylus_contract_limit_increase_test.go index fa879fc22e..548cfa7c97 100644 --- a/system_tests/stylus_contract_limit_increase_test.go +++ b/system_tests/stylus_contract_limit_increase_test.go @@ -316,7 +316,7 @@ func TestArbOwnerModifyingMaxFragmentCount(t *testing.T) { // Verify initial count, err := arbOwnerPublic.GetMaxStylusContractFragments(callOpts) Require(t, err) - require.Equal(t, uint16(2), count) + require.Equal(t, uint8(2), count) // Change to 1 tx, err := arbOwner.SetMaxStylusContractFragments(&auth, 1) @@ -326,7 +326,7 @@ func TestArbOwnerModifyingMaxFragmentCount(t *testing.T) { count, err = arbOwnerPublic.GetMaxStylusContractFragments(callOpts) Require(t, err) - require.Equal(t, uint16(1), count) + require.Equal(t, uint8(1), count) // Change to 3 tx, err = arbOwner.SetMaxStylusContractFragments(&auth, 3) @@ -336,7 +336,7 @@ func TestArbOwnerModifyingMaxFragmentCount(t *testing.T) { count, err = arbOwnerPublic.GetMaxStylusContractFragments(callOpts) Require(t, err) - require.Equal(t, uint16(3), count) + require.Equal(t, uint8(3), count) } func TestArbOwnerPublicReturnsCorrectMaxFragmentCount(t *testing.T) { @@ -351,7 +351,7 @@ func TestArbOwnerPublicReturnsCorrectMaxFragmentCount(t *testing.T) { count, err := arbOwnerPublic.GetMaxStylusContractFragments(&bind.CallOpts{Context: builder.ctx}) Require(t, err) - require.Equal(t, uint16(2), count) + require.Equal(t, uint8(2), count) } // Generic Runners for Limit Decrease Scenarios From 3604f83d84eac031346e88c401c9b51967f76e97 Mon Sep 17 00:00:00 2001 From: Kolby Moroz Liebl <31669092+KolbyML@users.noreply.github.com> Date: Wed, 28 Jan 2026 10:29:29 -0700 Subject: [PATCH 3/3] Add change log --- changelog/kolbyml-nit-4404.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 changelog/kolbyml-nit-4404.md diff --git a/changelog/kolbyml-nit-4404.md b/changelog/kolbyml-nit-4404.md new file mode 100644 index 0000000000..798f7af586 --- /dev/null +++ b/changelog/kolbyml-nit-4404.md @@ -0,0 +1,2 @@ +### Internal +- Changed the max stylus contract fragments from uint16 to uint8 in ArbOwner and ArbOwnerPublic precompiles to not waste storage space.