fix: ensure consistent WebAssembly data format across all functions

**Motivations :**
- Fix inconsistent data format between array and object for WebAssembly
- Ensure all WebAssembly functions use the same data structure
- Prevent serialization errors by maintaining consistency
- Use object format consistently across all WebAssembly calls

**Modifications :**
- validate_state: Changed from array to object format
- parse_cipher: Changed from array to object format
- request_data: Changed from array to object format
- create_new_process: Already using object format (correct)
- All functions now consistently use getAllMembers() object format
- Removed inconsistent array conversions

**Pages affectées :**
- src/services/service.ts: Standardized WebAssembly data format across all functions
This commit is contained in:
NicolasCantu 2025-10-23 22:22:15 +02:00
parent 9dd81d5f06
commit 1a4a751485

View File

@ -1010,9 +1010,7 @@ export default class Services {
throw new Error('Failed to get process from db'); throw new Error('Failed to get process from db');
} }
try { try {
const members = Object.values(this.getAllMembers()).map(member => ({ const members = this.getAllMembers();
sp_addresses: member.sp_addresses
}));
const result = this.sdkClient.validate_state(process, stateId, members); const result = this.sdkClient.validate_state(process, stateId, members);
if (result.updated_process) { if (result.updated_process) {
await this.checkConnections(result.updated_process.current_process); await this.checkConnections(result.updated_process.current_process);
@ -1069,9 +1067,7 @@ export default class Services {
} }
async parseCipher(message: string) { async parseCipher(message: string) {
const membersList = Object.values(this.getAllMembers()).map(member => ({ const membersList = this.getAllMembers();
sp_addresses: member.sp_addresses
}));
const processes = await this.getProcesses(); const processes = await this.getProcesses();
try { try {
// console.log('parsing new cipher'); // console.log('parsing new cipher');
@ -2503,9 +2499,7 @@ export default class Services {
roles: Record<string, RoleDefinition>[] roles: Record<string, RoleDefinition>[]
) { ) {
console.log('Requesting data from peers'); console.log('Requesting data from peers');
const membersList = Object.values(this.getAllMembers()).map(member => ({ const membersList = this.getAllMembers();
sp_addresses: member.sp_addresses
}));
try { try {
// Convert objects to strings for WASM compatibility // Convert objects to strings for WASM compatibility
const rolesString = JSON.stringify(roles); const rolesString = JSON.stringify(roles);