Skip to content

Commit c9be5a0

Browse files
committed
feat: add legacy transaction option
1 parent 43fd83b commit c9be5a0

10 files changed

Lines changed: 1048 additions & 17 deletions

File tree

‎contracts/.gitignore‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,5 @@ broadcast
2323
contracts/coverage_report
2424
coverage_report
2525
config-local
26+
/tools/forge-wrapper/dist
2627

‎contracts/tools/forge-wrapper/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
},
99
"scripts": {
1010
"build": "tsc -p tsconfig.json",
11-
"dev": "ts-node src/index.ts"
11+
"dev": "ts-node --transpile-only src/index.ts"
1212
},
1313
"dependencies": {
1414
"chalk": "^5.3.0",

‎contracts/tools/forge-wrapper/src/commands/call.ts‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ export function registerCallCommand(program: Command): void {
5656
);
5757
}
5858
castArgs.push("send", ...baseArgs, "--rpc-url", rpcUrl, "--private-key", privateKey);
59+
60+
// Add legacy flag if network requires it
61+
if (networkConfig.legacy) {
62+
castArgs.push("--legacy");
63+
}
5964
} else {
6065
castArgs.push("call", ...baseArgs, "--rpc-url", rpcUrl);
6166
}

‎contracts/tools/forge-wrapper/src/commands/configure.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,18 @@ function buildCastArgs(
6767
to: string,
6868
signature: string,
6969
params: string[],
70-
value?: string
70+
value?: string,
71+
useLegacy?: boolean
7172
): string[] {
7273
const args = ["send", to, signature, ...params];
7374
const trimmedValue = value?.trim();
7475
if (trimmedValue && trimmedValue.length > 0) {
7576
args.push("--value", trimmedValue);
7677
}
7778
args.push("--rpc-url", rpcUrl, "--private-key", privateKey);
79+
if (useLegacy) {
80+
args.push("--legacy");
81+
}
7882
return args;
7983
}
8084

@@ -115,7 +119,8 @@ export async function executeContractSend(
115119
record.address,
116120
options.signature,
117121
options.params,
118-
options.value
122+
options.value,
123+
networkConfig.legacy
119124
);
120125
const printable = formatCommand("cast", maskCastArgs(castArgs));
121126
// eslint-disable-next-line no-console

‎contracts/tools/forge-wrapper/src/commands/deploy.ts‎

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,11 @@ export async function executeDeploy(options: DeployOptions): Promise<DeploymentR
105105
String(networkConfig.chain_id),
106106
];
107107

108+
// Add legacy flag early if needed
109+
if (options.legacy || networkConfig.legacy) {
110+
displayArgs.push("--legacy");
111+
}
112+
108113
let constructorArgs = options.constructorArgs;
109114
if (constructorArgs.length === 0) {
110115
const template = getTemplate(options.alias);
@@ -123,10 +128,6 @@ export async function executeDeploy(options: DeployOptions): Promise<DeploymentR
123128
displayArgs.push("--constructor-args", ...constructorArgs);
124129
}
125130

126-
if (options.salt) {
127-
displayArgs.push("--salt", options.salt);
128-
}
129-
130131
const actualForgeArgs = [...displayArgs, "--json"];
131132

132133
const maskedCommand = formatCommand("forge", maskSensitiveArgs(displayArgs));
@@ -233,7 +234,9 @@ export function registerDeployCommand(program: Command): void {
233234
.option("--constructor-arg <value>", "Constructor argument", collectArgs, [])
234235
.option("--salt <salt>", "Deterministic deployment salt")
235236
.option("--dry-run", "Print command without executing")
236-
.action(async (alias: string, cmdOptions) => {
237+
.option("--legacy", "Use legacy transactions instead of EIP1559")
238+
239+
.action(async (alias: string, cmdOptions) => {
237240
const network = cmdOptions.network ?? getDefaultNetwork();
238241
if (!network) {
239242
throw new Error("Network is required (pass --network or set FORGE_WRAPPER_NETWORK)");
@@ -253,6 +256,7 @@ export function registerDeployCommand(program: Command): void {
253256
rpcUrl: cmdOptions.rpcUrl,
254257
dryRun: Boolean(cmdOptions.dryRun),
255258
salt: cmdOptions.salt,
259+
legacy: Boolean(cmdOptions.legacy),
256260
});
257261

258262
if (!cmdOptions.dryRun) {

‎contracts/tools/forge-wrapper/src/types.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export const networkConfigSchema = z.object({
5858
.transform((value) => value ?? {}),
5959
gas: gasConfigSchema.optional(),
6060
verification: verificationConfigSchema.optional(),
61+
legacy: z.boolean().optional(),
6162
});
6263

6364
export type NetworkConfig = z.infer<typeof networkConfigSchema>;
@@ -102,6 +103,7 @@ export interface DeployOptions {
102103
salt?: string;
103104
privateKeyOverride?: string;
104105
deployerAddress?: string;
106+
legacy?: boolean;
105107
}
106108

107109
export interface CallOptions {

‎services/bridge/internal/bridge/transaction_handler.go‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -407,17 +407,15 @@ func (h *TransactionHandler) getMonitoringInfo(txCtx *TransactionContext) string
407407
func (h *TransactionHandler) waitForReceipt(ctx context.Context, client rpc.EthClient, txHash common.Hash, routerID string) (*types.Receipt, error) {
408408
logger.Infof("Waiting for transaction receipt: %s, router=%s", txHash.Hex(), routerID)
409409

410-
timeout := time.After(5 * time.Minute)
411410
ticker := time.NewTicker(5 * time.Second)
412411
defer ticker.Stop()
413412

414413
attempts := 0
415414
for {
416415
select {
417416
case <-ctx.Done():
417+
logger.Warnf("Context canceled while waiting for receipt %s, router=%s: %v", txHash.Hex(), routerID, ctx.Err())
418418
return nil, ctx.Err()
419-
case <-timeout:
420-
return nil, fmt.Errorf("timeout waiting for transaction receipt after 5 minutes")
421419
case <-ticker.C:
422420
attempts++
423421
receipt, err := client.TransactionReceipt(ctx, txHash)

0 commit comments

Comments
 (0)