Sovereign-Labs / sovereign-sdk

A framework for building seamlessly scalable and interoperable rollups that can run on any blockchain
https://sovereign.xyz
Apache License 2.0
365 stars 104 forks source link

Add serde (Serialize, Deserialize) bounds to CallMessage associated type #378

Open dubbelosix opened 1 year ago

dubbelosix commented 1 year ago

We use json serde on CallMessage to support sov-cli parsing. The current path we follow is -> user supplies json that matches the CallMessage -> cli_parser attribute macro is used to annotate runtime and provides a function that can deserialize from JSON to a value of the CallMessage enum for that module -> cli_parser attribute macro also serializes the CallMessage into Borsh to prep the transaction for submission to DA layer

The problem is in step 2. we derive Serialize and Deserialize for each CallMessage in our runtime that we want to support, but adding it as a bound for the CallMessage associated type of the module has some ripple effects where it requires even Context to have the serde bounds.

This is fixable, but creating this issue to track instead of doing it as part of the cli parser since its a bit more involved

citizen-stig commented 1 year ago

I guess this problem is kind of leftover from situation where we had borsh and serde mixed. Since we are on track to have it solved, this issue aligns with what needs to be done.