Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Streator
Copy link
Contributor

@Streator Streator commented Sep 22, 2025

PR Type

Enhancement, Tests


Description

• Major refactoring to introduce inheritance-based architecture with abstract base contracts
• Created SymbioticCoreInitBase and SymbioticCoreBindingsBase abstract contracts to eliminate code duplication
• Refactored integration scripts and tests to inherit from base classes, removing over 1600 lines of duplicated code
• Added comprehensive deployment base contracts for vaults, hints, and core components
• Improved test organization by introducing local variable structs in delegator and vault tests
• Added base/contracts submodule dependency
• Disabled IR compilation in Foundry configuration
• Simplified SymbioticInit contracts by removing counter functionality


Diagram Walkthrough

flowchart LR
  A["Duplicated Code"] --> B["Abstract Base Contracts"]
  B --> C["SymbioticCoreInitBase"]
  B --> D["SymbioticCoreBindingsBase"]
  B --> E["DeployVaultBase"]
  C --> F["SymbioticCoreInit"]
  D --> G["SymbioticCoreBindings"]
  H["Test Files"] --> I["Structured Variables"]
  I --> J["Local Variable Structs"]
Loading

File Walkthrough

Relevant files
Enhancement
10 files
SymbioticCoreInitBase.sol
Add comprehensive SymbioticCoreInitBase abstract contract

test/integration/base/SymbioticCoreInitBase.sol

• Created a new abstract base contract SymbioticCoreInitBase with
comprehensive Symbiotic Core initialization functionality
• Added
extensive helper methods for vault, operator, network, staker, and
curator management
• Implemented configuration constants for epoch
durations, token amounts, and delegation limits
• Included signature
generation and validation methods for opt-in/opt-out operations

+1624/-0
SymbioticCoreInit.sol
Refactor SymbioticCoreInit to use base contract                   

script/integration/SymbioticCoreInit.sol

• Refactored to inherit from SymbioticCoreInitBase instead of
duplicating functionality
• Simplified the contract by removing
hundreds of lines of duplicated code
• Updated import to use
SymbioticCoreBindingsScript instead of SymbioticCoreBindings
• Added
broadcast helper method implementations for different caller modes

+35/-1204
SymbioticInit.sol
Simplify SymbioticInit by removing counter functionality 

script/integration/SymbioticInit.sol

• Updated import from SymbioticCounter to SymbioticUtils
• Removed
inheritance from SymbioticCounter class
• Removed SYMBIOTIC_SEED
configuration variable and run method
• Simplified contract to focus
only on token dealing functionality

+2/-120 
SymbioticInit.sol
Update SymbioticInit test to use SymbioticUtils                   

test/integration/SymbioticInit.sol

• Updated import from SymbioticCounter to SymbioticUtils
• Removed
inheritance from SymbioticCounter class
• Removed SYMBIOTIC_SEED
configuration variable
• Kept timestamp and block configuration
constants

+2/-114 
SymbioticCoreInit.sol
Major refactoring to use base class inheritance pattern   

test/integration/SymbioticCoreInit.sol

• Removed extensive configuration constants and helper methods (over
1100 lines)
• Added import for SymbioticCoreInitBase base class

Refactored contract to inherit from SymbioticCoreInitBase instead of
implementing everything directly
• Kept only essential methods like
_getStaker_SymbioticCore and broadcast helper methods

+31/-1538
SymbioticCoreBindings.sol
Refactor to use base class with broadcast modifier override

test/integration/SymbioticCoreBindings.sol

• Removed all implementation methods (over 500 lines of binding
functions)
• Added import for SymbioticCoreBindingsBase base class

Refactored to inherit from base class with only a broadcast modifier
override
• Simplified contract to minimal implementation using
inheritance pattern

+5/-527 
SymbioticCoreBindings.sol
Refactor SymbioticCoreBindings to inherit from base class

script/integration/SymbioticCoreBindings.sol

• Replaced concrete implementation with inheritance from
SymbioticCoreBindingsBase
• Removed all function implementations (~500
lines of code)
• Added a simple broadcast modifier that wraps
vm.startBroadcast and vm.stopBroadcast
• Changed class name from
SymbioticCoreBindings to SymbioticCoreBindingsScript

+5/-527 
SymbioticCoreBindingsBase.sol
Create abstract base class for SymbioticCore bindings       

test/integration/base/SymbioticCoreBindingsBase.sol

• Created new abstract base class containing all the core binding
functions
• Moved all function implementations from the original
SymbioticCoreBindings class
• Added abstract broadcast modifier to be
implemented by child classes
• Provides common functionality for both
test and script contexts

+490/-0 
DeployVaultBase.sol
Create base contract for vault deployment scripts               

script/deploy/base/DeployVaultBase.sol

• Created new base contract for vault deployment functionality
• Added
comprehensive parameter structs for vault, delegator, and slasher
configuration
• Implemented deployment logic with role management and
ownership transfer validation
• Provides reusable deployment
infrastructure for different vault types

+356/-0 
DeployVaultTokenizedBase.sol
Create specialized base for tokenized vault deployment     

script/deploy/base/DeployVaultTokenizedBase.sol

• Created specialized deployment base for tokenized vaults
• Extended
DeployVaultBase with tokenized-specific parameters (name and symbol)

Overrode vault version to return 2 and customized parameter encoding
for tokenized vaults

+43/-0   
Dependencies
1 files
.gitmodules
Add base contracts submodule                                                         

.gitmodules

• Added new git submodule entry for lib/contracts pointing to
base/contracts repository

+3/-0     
Tests
6 files
Slasher.t.sol
Refactor test methods to use structured local variables   

test/slasher/Slasher.t.sol

• Added local variable structs TestSlashSubnetworksLocalVariables and
TestSlashWithBurnerGasLocalVariables
• Refactored complex test methods
to use structured local variables instead of function parameters

Improved code organization and readability by grouping related
variables into structs
• Enhanced test method structure with better
variable scoping

+334/-178
NetworkRestakeDelegator.t.sol
Refactor test functions to use local variable structs       

test/delegator/NetworkRestakeDelegator.t.sol

• Added SlashWithHookLocalVariables struct to organize local variables
in test functions
• Refactored test_SlashWithHookBase and
test_SlashWithHookGas to use struct for variable management
• Improved
code organization by grouping related variables into a single struct

+132/-100
FullRestakeDelegator.t.sol
Refactor test functions to use local variable structs       

test/delegator/FullRestakeDelegator.t.sol

• Added SlashWithHookLocalVariables struct to organize local variables
in test functions
• Refactored test_SlashWithHookBase and
test_SlashWithHookGas to use struct for variable management
• Improved
code organization by grouping related variables into a single struct

+125/-93
VaultTokenized.t.sol
Refactor vault test functions with local variable structs

test/vault/VaultTokenized.t.sol

• Added TestCreate2LocalVariables and
GetVaultAndDelegatorAndSlasherLocalVariables structs
• Refactored
test_Create2 and _getVaultAndDelegatorAndSlasher functions to use
struct-based variable organization
• Improved code readability by
grouping related variables into structured data types

+117/-62
OperatorSpecificDelegator.t.sol
Refactor delegator test functions with variable structs   

test/delegator/OperatorSpecificDelegator.t.sol

• Added SlashWithHookLocalVariables struct for organizing test
variables
• Refactored test_SlashWithHook and test_SlashWithHookGas
functions to use struct-based approach
• Improved code organization
and readability in test functions

+81/-60 
OperatorNetworkSpecificDelegator.t.sol
Refactor delegator test functions and fix timestamp handling

test/delegator/OperatorNetworkSpecificDelegator.t.sol

• Added SlashWithHookLocalVariables struct for test variable
organization
• Refactored test_SlashWithHook and test_SlashWithHookGas
functions to use struct-based variable management
• Fixed timestamp
calculation to use vm.getBlockTimestamp() instead of complex
block.timestamp operations

+79/-58 
Configuration changes
2 files
DeployHintsBase.s.sol
Add deployment script for hints base contracts                     

script/deploy/base/DeployHintsBase.s.sol

• Added new deployment script for hints contracts
• Implements
deployment of OptInServiceHints, VaultHints, BaseDelegatorHints, and
BaseSlasherHints
• Includes logging functionality for deployed
contract addresses
• Provides structured deployment workflow for hint
system components

+29/-0   
foundry.toml
Disable IR compilation in Foundry configuration                   

foundry.toml

• Changed via_ir setting from true to false
• Disabled intermediate
representation compilation optimization

+1/-1     
Additional files
74 files
contracts +1/-0     
remappings.txt +1/-0     
Core.s.sol +0/-156 
DeployCore.s.sol +12/-0   
DeployHints.s.sol +10/-0   
DeployMetadataService.s.sol +12/-0   
DeployNetworkMiddlewareService.s.sol +12/-0   
DeployNetworkRegistry.s.sol +10/-0   
DeployOperatorRegistry.s.sol +10/-0   
DeployOptInService.s.sol +14/-0   
DeployVault.s.sol +91/-0   
DeployVaultFactory.s.sol +12/-0   
DeployVaultTokenized.s.sol +99/-0   
Hints.s.sol +0/-28   
MetadataService.s.sol +0/-18   
NetworkMiddlewareService.s.sol +0/-18   
NetworkRegistry.s.sol +0/-16   
OperatorRegistry.s.sol +0/-16   
OptInService.s.sol +0/-16   
Vault.s.sol +0/-170 
VaultFactory.s.sol +0/-18   
VaultTokenized.s.sol +0/-177 
DeployCoreBase.s.sol +193/-0 
DeployMetadataServiceBase.s.sol +19/-0   
DeployNetworkMiddlewareServiceBase.s.sol +19/-0   
DeployNetworkRegistryBase.s.sol +17/-0   
DeployOperatorRegistryBase.s.sol +17/-0   
DeployOptInServiceBase.s.sol +17/-0   
DeployVaultFactoryBase.s.sol +19/-0   
logs.txt [link]   
ExecuteSlash.s.sol +17/-0   
OptInNetwork.s.sol +17/-0   
OptInVault.s.sol +17/-0   
RegisterOperator.s.sol +16/-0   
RequestSlash.s.sol +20/-0   
SetHook.s.sol +17/-0   
SetMaxNetworkLimit.s.sol +18/-0   
SetNetworkLimit.s.sol +18/-0   
SetOperatorNetworkLimit.s.sol +19/-0   
SetOperatorNetworkShares.s.sol +19/-0   
SetResolver.s.sol +18/-0   
Slash.s.sol +20/-0   
VetoSlash.s.sol +17/-0   
ExecuteSlashBase.s.sol +24/-0   
OptInNetworkBase.s.sol +22/-0   
OptInVaultBase.s.sol +19/-0   
RegisterOperatorBase.s.sol +21/-0   
RequestSlashBase.s.sol +43/-0   
SetHookBase.s.sol +20/-0   
SetMaxNetworkLimitBase.s.sol +35/-0   
SetNetworkLimitBase.s.sol +36/-0   
SetOperatorNetworkLimitBase.s.sol +39/-0   
SetOperatorNetworkSharesBase.s.sol +40/-0   
SetResolverBase.s.sol +34/-0   
SlashBase.s.sol +42/-0   
VetoSlashBase.s.sol +24/-0   
ExecuteSlashMultisig.s.sol +23/-0   
OptInNetworkMultisig.s.sol +23/-0   
OptInVaultMultisig.s.sol +23/-0   
RegisterOperatorMultisig.s.sol +26/-0   
RequestSlashMultisig.s.sol +26/-0   
SetHookMultisig.s.sol +23/-0   
SetMaxNetworkLimitMultisig.s.sol +28/-0   
SetNetworkLimitMultisig.s.sol +24/-0   
SetOperatorNetworkLimitMultisig.s.sol +29/-0   
SetOperatorNetworkSharesMultisig.s.sol +29/-0   
SetResolverMultisig.s.sol +24/-0   
SlashMultisig.s.sol +26/-0   
VetoSlashMultisig.s.sol +23/-0   
Create3.sol +91/-0   
Logs.sol +26/-0   
ScriptBase.s.sol +15/-0   
VaultConfigurator.t.sol +24/-14 
SymbioticUtils.sol +127/-0 

Streator and others added 30 commits September 9, 2025 14:49
Turned config vars into constants
@sherlock-ai-beta
Copy link

Sherlock AI Findings

The automated tool identified the following potential security issues in the codebase. Please review the details for each issue in the linked dashboard.

# Title Severity Details
1 Under-Burning of Shares in Withdraw Function Due to Non-Standard +1 Offset in Share Calculation High View Details
2 Attacker Can Override Initialized Hook in Same Transaction by Self-Granting Role High View Details
3 Unrestricted initialization lets first caller seize HOOK_SET_ROLE and hijack the hook via setHook High View Details
4 Unrestricted initialization enables self-assignment of OPERATOR_NETWORK_SHARES_SET_ROLE with no admin, allowing arbitrary share setting Medium View Details
5 Unprotected slasher initialization allows permanent disabling of slashing via setSlasher(address(0)) before initialize Medium View Details

Next Steps: Review the linked issues in the dashboard and address high-severity bugs first. Contact the team if you need assistance.

Full report available at: https://ai.sherlock.xyz/runs/e5a228ed-5359-41cd-8fc9-505977ca53ab

@1kresh 1kresh self-requested a review October 29, 2025 13:35
@1kresh 1kresh merged commit 74c0c6f into main Oct 29, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants