ChainSafe / ChainSafe/EthereumRPCSharp

EncodeList not working correctly

Aperta
#14 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Type: Bug
Lingua principale
C#
Stelle
3
Fork
1
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

**Context**
I'm trying to test that if a encode a list of values, I get the expected decoded value.

**Problem**
This is what I'm trying to achieve:
```
List byteArrayList = new List();

byte[] byte1 = HexByteConvertorExtensions.HexToByteArray("0x");
byte[] byte2 = HexByteConvertorExtensions.HexToByteArray("0x");
byte[] byte3 = HexByteConvertorExtensions.HexToByteArray("0x");

byteArrayList.Add(byte1);
byteArrayList.Add(byte2);
byteArrayList.Add(byte3);

byte[] expectedEncoded2 = HexByteConvertorExtensions.HexToByteArray("0xc3808080");


byte[] encoded = RLP.EncodeList(byteArrayList.ToArray());

// Assert
Assert.AreEqual(expectedEncoded2, encoded);
```

I send a list to encode and then I expect that the result is the expected one. For assertions I'm using the test data that ethersjs uses for their RLP tests (https://github.com/ethers-io/ethers.js/blob/main/src.ts/_tests/test-rlp.ts), for example:
Screenshot 2023-04-04 at 17 21 13

**Additional context**
I have this problem only with **EncodeList** method, because the method **EncodeElement** is working as expected.

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Direzione di ricerca

Inizia dal punto di ingresso RLP.EncodeList e confronta il suo comportamento con quello del metodo EncodeElement funzionante. Riproduci l’assertion utilizzando i dati di test RLP di ethers.js, quindi verifica che la codifica delle liste produca i valori codificati e decodificati previsti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
csharp
Ambito
blockchain
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.