Documentation
¶
Index ¶
- Constants
- func ExecuteRecovery(ctx context.Context, cfg *Config, env *Env, diagnosis *DiagnosisResult) error
- func GetClaimsByGER(ctx context.Context, bridgeService *client.Client, networkID uint32, ...) ([]*claimsynctypes.Claim, error)
- func PrintDiagnosis(result *DiagnosisResult)
- func Run(c *cli.Context) error
- func RunGenerate(c *cli.Context) error
- func RunScanInvalidClaims(c *cli.Context) error
- func ScanInvalidClaims(ctx context.Context, env *Env, params ScanInvalidClaimsParams) ([]invalidGERUsage, int, uint64, error)
- type BridgeData
- type ClaimDiagnosis
- type Config
- type DiagnosisResult
- type Env
- type GERExistsOnL1Error
- type GenerateParams
- type GeneratedInvalidGER
- type RemoveGERConfig
- type ScanInvalidClaimsParams
- type Scenario
Constants ¶
const DefaultDepositCount = uint32(42069)
DefaultDepositCount is the default deposit count for generated invalid GER scenarios. Uses a high value (42069) to avoid collisions with real deposits.
Variables ¶
This section is empty.
Functions ¶
func ExecuteRecovery ¶
ExecuteRecovery runs the recovery flow for the given diagnosis. All steps execute on L2. On any error, returns immediately; the bridge may remain in emergency state for manual intervention.
func GetClaimsByGER ¶
func GetClaimsByGER( ctx context.Context, bridgeService *client.Client, networkID uint32, gerHash common.Hash, ) ([]*claimsynctypes.Claim, error)
GetClaimsByGER queries the bridge service for DetailedClaimEvent claims that used the given GER. networkID specifies which network to query (0 for L1, L2 network ID otherwise). Exported so E2E tests can use the same query for wait and assertion as the tool.
func PrintDiagnosis ¶
func PrintDiagnosis(result *DiagnosisResult)
PrintDiagnosis prints a human-readable diagnosis summary and recovery plan to stdout.
func RunGenerate ¶
RunGenerate is the CLI action for the "generate" subcommand.
func RunScanInvalidClaims ¶
RunScanInvalidClaims scans L2 claim logs, validates the GER used by each claim on L1, and prints the invalid GERs that were used in claims.
func ScanInvalidClaims ¶
func ScanInvalidClaims( ctx context.Context, env *Env, params ScanInvalidClaimsParams, ) ([]invalidGERUsage, int, uint64, error)
ScanInvalidClaims scans the L2 bridge logs for claims in the given block range, validates their GER on L1, and returns the invalid GERs used by those claims.
Types ¶
type BridgeData ¶
type BridgeData struct {
LeafType uint8
OriginNetwork uint32
OriginAddress common.Address
DestinationNetwork uint32
DestinationAddress common.Address
Amount *big.Int
Metadata []byte
DepositCount uint32
}
BridgeData holds L1 bridge fields needed for comparison and for CorrectBridge (B.1/B.2).
type ClaimDiagnosis ¶
type ClaimDiagnosis struct {
GlobalIndex *big.Int
DepositCount uint32
OriginNetwork uint32
Category Scenario
CorrectBridge *BridgeData // nil for Category A
}
ClaimDiagnosis holds the classification for a single claim.
type Config ¶
type Config struct {
// L1NetworkConfig contains the L1 RPC URL and contract addresses.
L1NetworkConfig ethermanconfig.L1NetworkConfig `mapstructure:"L1NetworkConfig"`
// Common contains shared settings such as the L2 RPC URL.
Common ethermanconfig.CommonConfig `mapstructure:"Common"`
// BridgeL2Sync contains the L2 bridge contract address used to initialize the binding.
BridgeL2Sync bridgesync.Config `mapstructure:"BridgeL2Sync"`
// L2GERSync contains the L2/L1 GER contract addresses.
L2GERSync l2gersync.Config `mapstructure:"L2GERSync"`
RemoveGER RemoveGERConfig `mapstructure:"RemoveGER"`
}
Config holds the subset of aggkit configuration fields needed by the remove-GER tool, plus tool-specific settings in the RemoveGER section.
func LoadConfig ¶
LoadConfig reads the TOML config file(s) specified by --cfg and unmarshals the fields required by the remove-GER tool. Uses the same template rendering pipeline as the main aggkit binary so that template variables (e.g. L1URL → L1NetworkConfig.RPC.URL) are resolved correctly.
type DiagnosisResult ¶
type DiagnosisResult struct {
InvalidGER common.Hash
GERExistsOnL1 bool
GERExistsOnL2 bool
GERTimestampL2 *big.Int
Claims []ClaimDiagnosis
Scenario Scenario
}
DiagnosisResult holds the result of the diagnosis phase.
type Env ¶
type Env struct {
// RPC clients
L1 *ethclient.Client
L2 *ethclient.Client
// Bridge service REST client (required)
BridgeService *client.Client
// L2NetworkID is the network ID of the L2 network served by the bridge service.
L2NetworkID uint32
// L1 contract bindings
L1GERManager *agglayerger.Agglayerger
// L2 contract bindings
L2Bridge l2BridgeContract
L2GERManager *agglayergerl2.Agglayergerl2
L2BridgeAddr common.Address
// contains filtered or unexported fields
}
Env holds all connections and contract bindings needed by the remove-ger tool. Pass it to diagnosis and recovery methods in later chunks.
func SetupEnv ¶
SetupEnv dials L1/L2, initializes contract bindings and bridge service client. BridgeServiceURL in cfg.RemoveGER is required. Exported for use by E2E tests that invoke the tool programmatically.
func SetupScanEnv ¶
SetupScanEnv dials L1/L2 and initializes the contract bindings needed for scan-invalid-claims.
type GERExistsOnL1Error ¶
GERExistsOnL1Error is returned when the GER exists on L1 (not invalid) and --force was not set.
func (GERExistsOnL1Error) Error ¶
func (e GERExistsOnL1Error) Error() string
type GenerateParams ¶
type GenerateParams struct {
DestinationNetwork uint32
DestinationAddress common.Address
OriginNetwork uint32
OriginAddress common.Address
Amount *big.Int
DepositCount uint32
LeafType uint8
}
GenerateParams holds the input parameters for generating an invalid GER scenario.
type GeneratedInvalidGER ¶
type GeneratedInvalidGER struct {
GER common.Hash
MainnetExitRoot common.Hash
RollupExitRoot common.Hash
ProofLocal [32][32]byte
ProofRollup [32][32]byte
GlobalIndex *big.Int
Params GenerateParams
}
GeneratedInvalidGER holds all computed values for the generated invalid GER scenario.
func GenerateInvalidGER ¶
func GenerateInvalidGER(params GenerateParams) *GeneratedInvalidGER
GenerateInvalidGER computes a deterministic invalid GER from the given parameters. It builds a bridge leaf, places it in a single-leaf merkle tree (zero-hash siblings), and derives the GER from the resulting mainnet exit root.
type RemoveGERConfig ¶
type RemoveGERConfig struct {
// SovereignAdminKey is the signing key with privileges to:
// - activateEmergencyState / deactivateEmergencyState on the L2 bridge
// - removeGlobalExitRoots on the L2 GER manager
// - unsetMultipleClaims / setMultipleClaims on the L2 bridge
// - forceEmitDetailedClaimEvent on the L2 bridge
// Supports local keystore, AWS KMS, and GCP KMS via signertypes.SignerConfig.
SovereignAdminKey signertypes.SignerConfig `mapstructure:"SovereignAdminKey"`
// BridgeServiceURL is the URL of the aggkit bridge service REST API (required).
// Used for querying claims, bridges, and proofs.
BridgeServiceURL string `mapstructure:"BridgeServiceURL"`
// L2NetworkID is the network ID of the L2 network served by the bridge service.
// Required for querying L2 claims via the bridge service.
L2NetworkID uint32 `mapstructure:"L2NetworkID"`
}
RemoveGERConfig contains configuration specific to the remove-GER tool.
type ScanInvalidClaimsParams ¶
ScanInvalidClaimsParams defines the block range and chunk size for scan-invalid-claims.