Skip to content

Conversation

@kayibal
Copy link
Collaborator

@kayibal kayibal commented Nov 14, 2025

No description provided.

@github-project-automation github-project-automation bot moved this to Todo in Tycho Nov 14, 2025
@kayibal kayibal changed the title Feat: Add FluidV1 feat: Add FluidV1 Nov 14, 2025
pub mod vm;

mod cpmm;
pub mod fluid;
Copy link
Contributor

Choose a reason for hiding this comment

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

sorry but OCD asks to put this on like 9 below uniswapV4 😅

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Moved it there, but it sorts it automatically to line 3

.or_insert_with(HashSet::new)
.insert(id.clone());
}
// Add DCI contracts so changes to these contracts trigger
Copy link
Contributor

Choose a reason for hiding this comment

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

oof good catch!

@github-project-automation github-project-automation bot moved this from Todo to In Progress in Tycho Nov 14, 2025
Copy link
Collaborator

@dianacarvalho1 dianacarvalho1 left a comment

Choose a reason for hiding this comment

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

Thank you @kayibal ! Gave it a quick review and it looks good! ✨
One question just for my understanding though.. Fluid is a native integration where we use the vm state to update the state right? 😵‍💫 I find this a bit strange.. What motivated this decision? It was too hard to track everything in substreams? (No need to give super detailed answers, just trying to understand the high level)

@kayibal
Copy link
Collaborator Author

kayibal commented Nov 17, 2025

@dianacarvalho1 Yes it is very hard if not impossible to track all values required by Fluid pools with a subtreams.

  1. The values are not stored plain in storage, instead they have to go through a big set of operations
  2. Some of the values require an oracle or price feed call which we can't easily get in substreams without doing an RPC call

Both of the above are resolved by doing a call against our local VM at decoding/delta transition time. This shouldn't take longer than 1-2ms and just happens once per block and only if there is an update to any of the underlying contracts.

@kayibal kayibal force-pushed the ah/ENG-5054/fluid-native branch from 3f3e5c5 to 4070bcc Compare November 17, 2025 12:57
@kayibal kayibal enabled auto-merge November 17, 2025 13:06
@kayibal kayibal disabled auto-merge November 17, 2025 13:08
@kayibal kayibal force-pushed the ah/ENG-5054/fluid-native branch from a436805 to 6192ba7 Compare November 17, 2025 13:12
@dianacarvalho1
Copy link
Collaborator

@dianacarvalho1 Yes it is very hard if not impossible to track all values required by Fluid pools with a subtreams.

  1. The values are not stored plain in storage, instead they have to go through a big set of operations
  2. Some of the values require an oracle or price feed call which we can't easily get in substreams without doing an RPC call

Both of the above are resolved by doing a call against our local VM at decoding/delta transition time. This shouldn't take longer than 1-2ms and just happens once per block and only if there is an update to any of the underlying contracts.

@kayibal Thank you for this answer! 🙏🏼 Are we "advertising" this way of integrating to external integrators?

@kayibal
Copy link
Collaborator Author

kayibal commented Nov 17, 2025

Are we "advertising" this way of integrating to external integrators?

@dianacarvalho1 I think it is a valid approach but it is the first time we try it. So I would say yes but only after we observe how this integration goes.

Most of this implementation of taken from the Kyberswap reference implementation.
This function is custom since it calls the VM to rebuild the full state, then update the internal state from that.

To enable this to work correctly and catch all state changes, we need to call this method also if a DCI indexed contract had a change. Therefore the contracts_map in the Decoder was changed accordingly as well.
Updates tycho-execution locked version to include fluid encoder.
@kayibal kayibal force-pushed the ah/ENG-5054/fluid-native branch from 7dd954c to d68858c Compare November 18, 2025 12:27
@kayibal kayibal merged commit c9c1c75 into main Nov 18, 2025
5 of 7 checks passed
@kayibal kayibal deleted the ah/ENG-5054/fluid-native branch November 18, 2025 13:13
@github-project-automation github-project-automation bot moved this from In Progress to Done in Tycho Nov 18, 2025
@propellerci
Copy link

propellerci bot commented Nov 18, 2025

This PR is included in version 0.198.0 🎉

@propellerci propellerci bot added the true label Nov 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

4 participants