Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: execution method for creation + batches #1924

Merged
merged 8 commits into from
May 3, 2023
Merged

Conversation

iamacook
Copy link
Member

What it solves

Resolves #1894 (Safe creation and batch transactions)

How this PR fixes it

The execution method selector has been added to the review step of the Safe creation flow, as well as the batch transaction modal.

How to test it

  • Create a Safe and observe the execution method in the review step:

    • Relaying a Safe creation should work.
    • Executing a Safe creation should work when relaying is possible.
    • Executing a Safe creation should work when relaying is not possible.
  • Create a batch and observe the execution method in the modal:

    • Relaying a batch should work.
    • Executing a batch should work when relaying is possible.
    • Executing a batch should work when relaying is not possible.

Note: standard transactions should work as before: relay and standard executions.

Screenshots

Safe creation

image

image

image

Batch execution

image

image

image

Checklist

  • I've tested the branch on mobile 📱
  • I've documented how it affects the analytics (if at all) 📊
  • I've written a unit/e2e test for it (if applicable) 🧑‍💻

@github-actions
Copy link

github-actions bot commented Apr 28, 2023

Branch preview

✅ Deploy successful!

https://batch_creation_method--webcore.review-web-core.5afe.dev

@github-actions
Copy link

github-actions bot commented Apr 28, 2023

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: ✅ success
  • Annotations: 0 total

Report generated by eslint-plus-action

Copy link
Member

@DiogoSoaress DiogoSoaress left a comment

Choose a reason for hiding this comment

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

Looks good to me. Left a few comments though

@@ -35,12 +35,14 @@ const ReviewStep = ({ data, onSubmit, onBack, setStep }: StepRenderProps<NewSafe
const { maxFeePerGas, maxPriorityFeePerGas } = useGasPrice()
const saltNonce = useMemo(() => Date.now(), [])
const [_, setPendingSafe] = useLocalStorage<PendingSafeData | undefined>(SAFE_PENDING_CREATION_STORAGE_KEY)
const [executionMethod, setExecutionMethod] = useState(ExecutionMethod.RELAY)

const ownerAddresses = useMemo(() => data.owners.map((owner) => owner.address), [data.owners])
const [minRelays] = useLeastRemainingRelays(ownerAddresses)

// Chain supports relaying and relay transactions are available
Copy link
Member

Choose a reason for hiding this comment

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

This comment is outdated I think. If we decide to keep it I suggest
"Every owner address has remaining relay transactions and relay method is selected"

</Typography>
{!noLabel ? (
<Typography variant="body2" className={css.label}>
Choose execution method
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Choose execution method
Choose execution method:

Comment on lines 32 to 34
// Chain has relaying feature and available relays
const willRelay = relays && relays.remaining > 0
const canRelay = relays && relays.remaining > 0
const willRelay = canRelay && executionMethod === ExecutionMethod.RELAY
Copy link
Member

Choose a reason for hiding this comment

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

Time to make an util for this logic? It will become less prone to inconsistencies

@francovenica
Copy link
Contributor

LGTM. Tried it in the GNO chain

Tried safe creation with the relayer, with the wallet and run out of relayer funds where you have to pay with your wallet.
Same as before with batched tx
Regular tx with and w/o relayer work fine as well.

@katspaugh
Copy link
Member

@iamacook please check the unit tests, something got changed after pulling from dev.

@iamacook iamacook merged commit 2e15b2d into dev May 3, 2023
@iamacook iamacook deleted the batch-creation-method branch May 3, 2023 10:44
@github-actions github-actions bot locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Relaying] Allow execution via connected wallet as an alternative when relaying is enabled
4 participants