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

New messaging specification (replacing old deposit/withdrawal spec) #318

Merged

Conversation

pixelcircuits
Copy link
Contributor

@pixelcircuits pixelcircuits commented May 20, 2022

Changes to keep track of messages going in and out

Implementation:

@pixelcircuits pixelcircuits linked an issue May 20, 2022 that may be closed by this pull request
@rakita
Copy link
Contributor

rakita commented May 20, 2022

Just a comment for clarity, in my head, the message could contain:

  • GatewayIdFrom -> Registered gateway from this side of the bridge.
  • GatewayIdTo -> Registered gateway from the other side of the bridge.
  • Data -> whatever it is. It is gateway specific
  • Nonce -> so that we don't have a replay attack.

The Data field contains all needed information as it depends on what we want for the gateway to do, for erc20 example, we will need info on who is the new owner of the token, token id, and amount.

MessageId can be hash over message fields.

It feels like we could remove GatewayFrom and use just GatewayIdTo but we need to think about how to do the registration procedure and unique mapping in the router.

@pixelcircuits
Copy link
Contributor Author

In the same style as Arbitrum/Optimism, I tried to keep the core message object as generic as possible to facilitate more than gateways. For example, a gateway deposit from Fuel to Ethereum would work like this:

  • EVM address: Ethereum side gateway address (to)
  • FuelVM address: Fuel side gateway address (from)
  • Message ABI: The call to execute on the "to" contract address which in this example is the Ethereum side gateway abi.encodeWithSignature("finalizeDeposit(uint256,uint256,uint256,uint256,uint256,bytes)", l1Token, l2Token, from, to, amount, data)
  • Nonce: Enforces ID uniqueness

I also imagined that there wouldn't be any onchain router and it would be up to the front end UI to help a user pick a gateway contract for a particular asset. Similar to how uniswap uses their off chain token lists to help a user swap with the correct token address they're looking for.

I'm currently in the process of diagraming everything up to be scrutinized before we start writing contracts.

@pixelcircuits pixelcircuits marked this pull request as ready for review May 24, 2022 02:25
@pixelcircuits pixelcircuits self-assigned this May 24, 2022
@pixelcircuits pixelcircuits removed the request for review from SilentCicero May 24, 2022 02:28
@pixelcircuits

This comment was marked as outdated.

@pixelcircuits

This comment was marked as resolved.

@pixelcircuits pixelcircuits changed the title Replaced deposit ID concept with message ID New messaging specification (replacing old deposit/withdrawal spec) May 27, 2022
@adlerjohn adlerjohn added enhancement New feature or request comp:FVM Component: FuelVM labels Jun 6, 2022
specs/vm/instruction_set.md Outdated Show resolved Hide resolved
Copy link
Contributor

@vlopes11 vlopes11 left a comment

Choose a reason for hiding this comment

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

LGTM

@adlerjohn adlerjohn mentioned this pull request Jun 20, 2022
2 tasks
@pixelcircuits pixelcircuits merged commit 4367798 into master Jun 21, 2022
@pixelcircuits pixelcircuits deleted the pixelcircuits-refactor-depositwithdraw-to-flat-messaging branch June 21, 2022 15:59
vlopes11 added a commit to FuelLabs/fuel-types that referenced this pull request Jun 22, 2022
vlopes11 added a commit to FuelLabs/fuel-types that referenced this pull request Jun 23, 2022
@adlerjohn adlerjohn mentioned this pull request Jun 24, 2022
vlopes11 added a commit to FuelLabs/fuel-tx that referenced this pull request Jun 24, 2022
Include message input and output with their respective validation rules.

This commit will introduce a stateful property to the transaction
validation. A valid transaction might not be validated anymore in
post-execution since its outputs might be mutated at runtime in the VM.

Related issue: FuelLabs/fuel-specs#318
vlopes11 added a commit to FuelLabs/fuel-tx that referenced this pull request Jun 24, 2022
Include message input and output with their respective validation rules.

This commit will introduce a stateful property to the transaction
validation. A valid transaction might not be validated anymore in
post-execution since its outputs might be mutated at runtime in the VM.

Related issue: FuelLabs/fuel-specs#318
vlopes11 added a commit to FuelLabs/fuel-tx that referenced this pull request Jun 24, 2022
Include message input and output with their respective validation rules.

This commit will introduce a stateful property to the transaction
validation. A valid transaction might not be validated anymore in
post-execution since its outputs might be mutated at runtime in the VM.

Related issue: FuelLabs/fuel-specs#318
vlopes11 added a commit to FuelLabs/fuel-tx that referenced this pull request Jun 24, 2022
Include message input and output with their respective validation rules.

This commit will introduce a stateful property to the transaction
validation. A valid transaction might not be validated anymore in
post-execution since its outputs might be mutated at runtime in the VM.

Related issue: FuelLabs/fuel-specs#318
vlopes11 added a commit to FuelLabs/fuel-tx that referenced this pull request Jun 24, 2022
Include message input and output with their respective validation rules.

This commit will introduce a stateful property to the transaction
validation. A valid transaction might not be validated anymore in
post-execution since its outputs might be mutated at runtime in the VM.

Related issue: FuelLabs/fuel-specs#318
vlopes11 added a commit to FuelLabs/fuel-tx that referenced this pull request Jun 24, 2022
Include message input and output with their respective validation rules.

This commit will introduce a stateful property to the transaction
validation. A valid transaction might not be validated anymore in
post-execution since its outputs might be mutated at runtime in the VM.

Related issue: FuelLabs/fuel-specs#318
vlopes11 added a commit to FuelLabs/fuel-tx that referenced this pull request Jun 24, 2022
Include message input and output with their respective validation rules.

This commit will introduce a stateful property to the transaction
validation. A valid transaction might not be validated anymore in
post-execution since its outputs might be mutated at runtime in the VM.

Related issue: FuelLabs/fuel-specs#318
vlopes11 added a commit to FuelLabs/fuel-tx that referenced this pull request Jul 1, 2022
Include message input and output with their respective validation rules.

This commit will introduce a stateful property to the transaction
validation. A valid transaction might not be validated anymore in
post-execution since its outputs might be mutated at runtime in the VM.

Related issue: FuelLabs/fuel-specs#318
ControlCplusControlV pushed a commit to FuelLabs/fuel-vm that referenced this pull request Dec 1, 2022
Include message input and output with their respective validation rules.

This commit will introduce a stateful property to the transaction
validation. A valid transaction might not be validated anymore in
post-execution since its outputs might be mutated at runtime in the VM.

Related issue: FuelLabs/fuel-specs#318
ControlCplusControlV pushed a commit to FuelLabs/fuel-vm that referenced this pull request Dec 1, 2022
xgreenx pushed a commit to FuelLabs/fuel-vm that referenced this pull request Dec 20, 2022
Include message input and output with their respective validation rules.

This commit will introduce a stateful property to the transaction
validation. A valid transaction might not be validated anymore in
post-execution since its outputs might be mutated at runtime in the VM.

Related issue: FuelLabs/fuel-specs#318
xgreenx pushed a commit to FuelLabs/fuel-vm that referenced this pull request Dec 20, 2022
xgreenx pushed a commit to FuelLabs/fuel-vm that referenced this pull request Dec 20, 2022
Include message input and output with their respective validation rules.

This commit will introduce a stateful property to the transaction
validation. A valid transaction might not be validated anymore in
post-execution since its outputs might be mutated at runtime in the VM.

Related issue: FuelLabs/fuel-specs#318
xgreenx pushed a commit to FuelLabs/fuel-vm that referenced this pull request Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
comp:FVM Component: FuelVM comp:VAL Component: Transaction Validity outside the Fuel VM enhancement New feature or request
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Refactor deposit/withdraw to flat messaging
5 participants