Skip to content

Conversation

smartcontracts
Copy link
Collaborator

Description
Updates the online and download methods to support verification by providing a Safe tx hash or a link to a Safe tx in the UI.

@smartcontracts smartcontracts requested a review from a team as a code owner October 7, 2025 00:00
@netlify
Copy link

netlify bot commented Oct 7, 2025

Deploy Preview for op-verify canceled.

Name Link
🔨 Latest commit 6335da4
🔍 Latest deploy log https://app.netlify.com/projects/op-verify/deploys/68f0225b91bdb2000766096e

Copy link

Choose a reason for hiding this comment

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

We should update the readme with some example invocations

Required: true,
Name: "network",
Aliases: []string{"n"},
Usage: "Network name: ethereum, op, base (required unless --tx is used)",
Copy link

Choose a reason for hiding this comment

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

Can be a separate PR, but we should support sepolia too

address = core.StripChainPrefix(address)
// Check if using new --tx flag or old --network/--safe/--nonce flags
if txInput != "" {
// New method: fetch by transaction hash or link
Copy link

Choose a reason for hiding this comment

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

nit, would delete the "new" and "old" nomenclature since this won't be new forever

}

// Validate network
if network != "ethereum" && network != "op" && network != "base" {
Copy link

Choose a reason for hiding this comment

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

Does safe maintain a mapping of all networks they support and their APIs? Would be nice if we could just dump in a JSON with metadata to parse to support a bunch of chains easily

Comment on lines 293 to 294
// Check if using new --tx flag or old --network/--safe/--nonce flags
if txInput != "" {
Copy link

Choose a reason for hiding this comment

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

nit, looks like a lot of duplicate code here compared to above

}

func downloadAction(c *cli.Context) error {
txInput := c.String("tx")
Copy link

Choose a reason for hiding this comment

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

Can we add some tests for the new functionality?

core/generate.go Outdated
Comment on lines 388 to 390
// Extract the hash from the data
if len(apiTx.Data) >= 74 {
innerHash := "0x" + apiTx.Data[10:74]
Copy link

Choose a reason for hiding this comment

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

What are the 10 and 74 constants from? Some constants explaining that would be nice

Comment on lines +448 to +453
// Convert string values to appropriate types
var value, safeTxGas, baseGas, gasPrice int
fmt.Sscanf(content.Value, "%d", &value)
fmt.Sscanf(content.SafeTxGas, "%d", &safeTxGas)
fmt.Sscanf(content.BaseGas, "%d", &baseGas)
fmt.Sscanf(content.GasPrice, "%d", &gasPrice)
Copy link

Choose a reason for hiding this comment

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

This feels very likely to overflow an int, doesn't this mean we only support a max value of 2^31 wei, which is a tiny amount of ETH? Should use a bigger type for these values

safeTx := &SafeTransaction{
Safe: safeAddress,
SafeVersion: safeVersion,
Chain: int(chainID),
Copy link

Choose a reason for hiding this comment

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

Similar overflow risk since chainID can be a uint256, in practice uint64 should be big enough though

Comment on lines +244 to +245
MainnetChainID: "https://safe-transaction-mainnet.safe.global",
OPMainnetChainID: "https://safe-transaction-optimism.safe.global",
Copy link

Choose a reason for hiding this comment

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

Missing Base?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants