public ConsumerSession Decode(RlpStream rlpStream, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { rlpStream.ReadSequenceLength(); Keccak id = rlpStream.DecodeKeccak(); Keccak depositId = rlpStream.DecodeKeccak(); Keccak dataAssetId = rlpStream.DecodeKeccak(); Address consumerAddress = rlpStream.DecodeAddress(); PublicKey consumerNodeId = new PublicKey(rlpStream.DecodeByteArray()); Address providerAddress = rlpStream.DecodeAddress(); PublicKey providerNodeId = new PublicKey(rlpStream.DecodeByteArray()); SessionState state = (SessionState)rlpStream.DecodeInt(); uint startUnitsFromProvider = rlpStream.DecodeUInt(); uint startUnitsFromConsumer = rlpStream.DecodeUInt(); ulong startTimestamp = rlpStream.DecodeUlong(); ulong finishTimestamp = rlpStream.DecodeUlong(); uint consumedUnits = rlpStream.DecodeUInt(); uint unpaidUnits = rlpStream.DecodeUInt(); uint paidUnits = rlpStream.DecodeUInt(); uint settledUnits = rlpStream.DecodeUInt(); uint consumedUnitsFromProvider = rlpStream.DecodeUInt(); DataAvailability dataAvailability = (DataAvailability)rlpStream.DecodeInt(); return(new ConsumerSession(id, depositId, dataAssetId, consumerAddress, consumerNodeId, providerAddress, providerNodeId, state, startUnitsFromProvider, startUnitsFromConsumer, startTimestamp, finishTimestamp, consumedUnits, unpaidUnits, paidUnits, settledUnits, consumedUnitsFromProvider, dataAvailability)); }
public PingMessage Deserialize(byte[] msg) { (PingMessage Message, byte[] Mdc, byte[] Data)results = PrepareForDeserialization <PingMessage>(msg); RlpStream rlp = results.Data.AsRlpStream(); rlp.ReadSequenceLength(); int version = rlp.DecodeInt(); rlp.ReadSequenceLength(); byte[] sourceAddress = rlp.DecodeByteArray(); IPEndPoint source = GetAddress(sourceAddress, rlp.DecodeInt()); rlp.DecodeInt(); // UDP port rlp.ReadSequenceLength(); byte[] destinationAddress = rlp.DecodeByteArray(); IPEndPoint destination = GetAddress(destinationAddress, rlp.DecodeInt()); rlp.DecodeInt(); // UDP port long expireTime = rlp.DecodeLong(); PingMessage message = results.Message; message.SourceAddress = source; message.DestinationAddress = destination; message.Mdc = results.Mdc; message.Version = version; message.ExpirationTime = expireTime; return(message); }
public Session Decode(RlpStream rlpStream, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { var sequenceLength = rlpStream.ReadSequenceLength(); if (sequenceLength == 0) { return(null); } var id = rlpStream.DecodeKeccak(); var depositId = rlpStream.DecodeKeccak(); var dataAssetId = rlpStream.DecodeKeccak(); var consumerAddress = rlpStream.DecodeAddress(); var consumerNodeId = new PublicKey(rlpStream.DecodeByteArray()); var providerAddress = rlpStream.DecodeAddress(); var providerNodeId = new PublicKey(rlpStream.DecodeByteArray()); var state = (SessionState)rlpStream.DecodeInt(); var startUnitsFromProvider = rlpStream.DecodeUInt(); var startUnitsFromConsumer = rlpStream.DecodeUInt(); var startTimestamp = rlpStream.DecodeUlong(); var finishTimestamp = rlpStream.DecodeUlong(); var consumedUnits = rlpStream.DecodeUInt(); var unpaidUnits = rlpStream.DecodeUInt(); var paidUnits = rlpStream.DecodeUInt(); var settledUnits = rlpStream.DecodeUInt(); return(new Session(id, depositId, dataAssetId, consumerAddress, consumerNodeId, providerAddress, providerNodeId, state, startUnitsFromProvider, startUnitsFromConsumer, startTimestamp, finishTimestamp, consumedUnits, unpaidUnits, paidUnits, settledUnits)); }
public UserOperationWithEntryPoint Decode(RlpStream rlpStream, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { rlpStream.SkipLength(); UserOperationRpc userOperationRpc = new UserOperationRpc { Sender = rlpStream.DecodeAddress() ?? Address.Zero, Nonce = rlpStream.DecodeUInt256(), InitCode = rlpStream.DecodeByteArray(), CallData = rlpStream.DecodeByteArray(), CallGas = rlpStream.DecodeUInt256(), VerificationGas = rlpStream.DecodeUInt256(), PreVerificationGas = rlpStream.DecodeUInt256(), MaxFeePerGas = rlpStream.DecodeUInt256(), MaxPriorityFeePerGas = rlpStream.DecodeUInt256(), Paymaster = rlpStream.DecodeAddress() ?? Address.Zero, PaymasterData = rlpStream.DecodeByteArray(), Signature = rlpStream.DecodeByteArray() }; Address entryPoint = rlpStream.DecodeAddress() ?? Address.Zero; // TODO: Make instantiation simpler? return(new UserOperationWithEntryPoint(new UserOperation(userOperationRpc), entryPoint)); }
private static ParityTraceAction DecodeAction(RlpStream rlpStream) { ParityTraceAction action = new ParityTraceAction(); int sequenceLength = rlpStream.ReadSequenceLength(); if (rlpStream.ReadNumberOfItemsRemaining(rlpStream.Position + sequenceLength) == 3) { action.CallType = "reward"; action.RewardType = rlpStream.DecodeString(); action.Author = rlpStream.DecodeAddress(); action.Value = rlpStream.DecodeUInt256(); action.TraceAddress = Array.Empty <int>(); } else { action.CallType = rlpStream.DecodeString(); action.From = rlpStream.DecodeAddress(); action.To = rlpStream.DecodeAddress(); action.Value = rlpStream.DecodeUInt256(); action.Gas = rlpStream.DecodeLong(); action.Input = rlpStream.DecodeByteArray(); action.Result = new ParityTraceResult(); action.Result.Output = rlpStream.DecodeByteArray(); action.Result.GasUsed = rlpStream.DecodeLong(); action.TraceAddress = rlpStream.DecodeArray(c => c.DecodeInt()); int subtracesCount = rlpStream.DecodeInt(); action.Subtraces = new List <ParityTraceAction>(subtracesCount); for (int i = 0; i < subtracesCount; i++) { action.Subtraces.Add(DecodeAction(rlpStream)); } } return(action); }
public AckEip8Message Deserialize(byte[] bytes) { RlpStream rlpStream = bytes.AsRlpStream(); AckEip8Message authEip8Message = new AckEip8Message(); rlpStream.ReadSequenceLength(); authEip8Message.EphemeralPublicKey = new PublicKey(rlpStream.DecodeByteArray()); authEip8Message.Nonce = rlpStream.DecodeByteArray(); return(authEip8Message); }
public AuthEip8Message Deserialize(byte[] data) { RlpStream rlpStream = data.AsRlpStream(); AuthEip8Message authMessage = new AuthEip8Message(); rlpStream.ReadSequenceLength(); byte[] sigAllBytes = rlpStream.DecodeByteArray(); Signature signature = new Signature(sigAllBytes.Slice(0, 64), sigAllBytes[64]); // since Signature class is Ethereum style it expects V as the 64th byte, hence we use RecoveryID constructor authMessage.Signature = signature; authMessage.PublicKey = new PublicKey(rlpStream.DecodeByteArray()); authMessage.Nonce = rlpStream.DecodeByteArray(); int version = rlpStream.DecodeInt(); return authMessage; }
public PaymentClaim Decode(RlpStream rlpStream, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { _ = rlpStream.ReadSequenceLength(); var id = rlpStream.DecodeKeccak(); var depositId = rlpStream.DecodeKeccak(); var assetId = rlpStream.DecodeKeccak(); var assetName = rlpStream.DecodeString(); var units = rlpStream.DecodeUInt(); var claimedUnits = rlpStream.DecodeUInt(); var unitsRange = Nethermind.Serialization.Rlp.Rlp.Decode <UnitsRange>(rlpStream); var value = rlpStream.DecodeUInt256(); var claimedValue = rlpStream.DecodeUInt256(); var expiryTime = rlpStream.DecodeUInt(); var pepper = rlpStream.DecodeByteArray(); var provider = rlpStream.DecodeAddress(); var consumer = rlpStream.DecodeAddress(); var transactions = Rlp.DecodeArray <TransactionInfo>(rlpStream); var transactionCost = rlpStream.DecodeUInt256(); var timestamp = rlpStream.DecodeUlong(); var status = (PaymentClaimStatus)rlpStream.DecodeInt(); var signature = SignatureDecoder.DecodeSignature(rlpStream); var paymentClaim = new PaymentClaim(id, depositId, assetId, assetName, units, claimedUnits, unitsRange, value, claimedValue, expiryTime, pepper, provider, consumer, signature, timestamp, transactions, status); if (status == PaymentClaimStatus.Claimed) { paymentClaim.SetTransactionCost(transactionCost); } return(paymentClaim); }
public HelloMessage Deserialize(byte[] bytes) { RlpStream rlpStream = bytes.AsRlpStream(); rlpStream.ReadSequenceLength(); HelloMessage helloMessage = new HelloMessage(); helloMessage.P2PVersion = rlpStream.DecodeByte(); helloMessage.ClientId = string.Intern(rlpStream.DecodeString()); helloMessage.Capabilities = rlpStream.DecodeArray(ctx => { ctx.ReadSequenceLength(); string protocolCode = string.Intern(ctx.DecodeString()); int version = ctx.DecodeByte(); return(new Capability(protocolCode, version)); }).ToList(); helloMessage.ListenPort = rlpStream.DecodeInt(); byte[] publicKeyBytes = rlpStream.DecodeByteArray(); if (publicKeyBytes.Length != PublicKey.LengthInBytes && publicKeyBytes.Length != PublicKey.PrefixedLengthInBytes) { throw new NetworkingException($"Client {helloMessage.ClientId} sent an invalid public key format (length was {publicKeyBytes.Length})", NetworkExceptionType.HandshakeOrInit); } else { helloMessage.NodeId = new PublicKey(publicKeyBytes); } return(helloMessage); }
private PathGroup DecodeGroup(RlpStream stream) { PathGroup group = new PathGroup(); group.Group = stream.DecodeArray(s => stream.DecodeByteArray()); return(group); }
private PathWithStorageSlot DecodeSlot(RlpStream stream) { stream.ReadSequenceLength(); Keccak path = stream.DecodeKeccak(); byte[] value = stream.DecodeByteArray(); PathWithStorageSlot data = new(path, value); return(data); }
private static HiMessage Deserialize(RlpStream rlpStream) { rlpStream.ReadSequenceLength(); var protocolVersion = rlpStream.DecodeByte(); var providerAddress = rlpStream.DecodeAddress(); var consumerAddress = rlpStream.DecodeAddress(); var nodeId = new PublicKey(rlpStream.DecodeByteArray()); var signature = SignatureDecoder.DecodeSignature(rlpStream); return(new HiMessage(protocolVersion, providerAddress, consumerAddress, nodeId, signature)); }
public FindNodeMsg Deserialize(byte[] msgBytes) { (PublicKey FarPublicKey, byte[] Mdc, byte[] Data)results = PrepareForDeserialization(msgBytes); RlpStream rlpStream = results.Data.AsRlpStream(); rlpStream.ReadSequenceLength(); byte[] searchedNodeId = rlpStream.DecodeByteArray(); long expirationTime = rlpStream.DecodeLong(); FindNodeMsg findNodeMsg = new (results.FarPublicKey, expirationTime, searchedNodeId); return(findNodeMsg); }
private ParityStateChange <byte[]> DecodeByteChange(RlpStream rlpStream) { int sequenceLength = rlpStream.ReadSequenceLength(); if (sequenceLength == 0) { return(null); } ParityStateChange <byte[]> change = new ParityStateChange <byte[]>(rlpStream.DecodeByteArray(), rlpStream.DecodeByteArray()); return(change); }
public UserOperation Decode(RlpStream rlpStream, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { rlpStream.SkipLength(); UserOperationRpc userOperationRpc = new UserOperationRpc { Sender = rlpStream.DecodeAddress() ?? Address.Zero, Nonce = rlpStream.DecodeUInt256(), InitCode = rlpStream.DecodeByteArray(), CallData = rlpStream.DecodeByteArray(), CallGas = rlpStream.DecodeUInt256(), VerificationGas = rlpStream.DecodeUInt256(), PreVerificationGas = rlpStream.DecodeUInt256(), MaxFeePerGas = rlpStream.DecodeUInt256(), MaxPriorityFeePerGas = rlpStream.DecodeUInt256(), Paymaster = rlpStream.DecodeAddress() ?? Address.Zero, PaymasterData = rlpStream.DecodeByteArray(), Signature = rlpStream.DecodeByteArray() }; return(new UserOperation(userOperationRpc)); }
public PongMessage Deserialize(byte[] msg) { (PongMessage Message, byte[] Mdc, byte[] Data)results = PrepareForDeserialization <PongMessage>(msg); RlpStream rlp = results.Data.AsRlpStream(); rlp.ReadSequenceLength(); rlp.ReadSequenceLength(); // GetAddress(rlp.DecodeByteArray(), rlp.DecodeInt()); rlp.DecodeByteArray(); rlp.DecodeInt(); // UDP port (we ignore and take it from Netty) rlp.DecodeInt(); // TCP port byte[] token = rlp.DecodeByteArray(); long expirationTime = rlp.DecodeLong(); PongMessage message = results.Message; message.PingMdc = token; message.ExpirationTime = expirationTime; return(message); }
public DataRequest Decode(RlpStream rlpStream, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { rlpStream.ReadSequenceLength(); Keccak assetId = rlpStream.DecodeKeccak(); uint units = rlpStream.DecodeUInt(); UInt256 value = rlpStream.DecodeUInt256(); uint expiryTime = rlpStream.DecodeUInt(); var salt = rlpStream.DecodeByteArray(); Address provider = rlpStream.DecodeAddress(); Address consumer = rlpStream.DecodeAddress(); Signature signature = SignatureDecoder.DecodeSignature(rlpStream); return(new DataRequest(assetId, units, value, expiryTime, salt, provider, consumer, signature)); }
public DataDeliveryReceiptDetails Decode(RlpStream rlpStream, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { rlpStream.ReadSequenceLength(); Keccak id = rlpStream.DecodeKeccak(); Keccak sessionId = rlpStream.DecodeKeccak(); Keccak dataAssetId = rlpStream.DecodeKeccak(); PublicKey consumerNodeId = new PublicKey(rlpStream.DecodeByteArray()); DataDeliveryReceiptRequest request = Serialization.Rlp.Rlp.Decode <DataDeliveryReceiptRequest>(rlpStream); DataDeliveryReceipt receipt = Serialization.Rlp.Rlp.Decode <DataDeliveryReceipt>(rlpStream); ulong timestamp = rlpStream.DecodeUlong(); bool isClaimed = rlpStream.DecodeBool(); return(new DataDeliveryReceiptDetails(id, sessionId, dataAssetId, consumerNodeId, request, receipt, timestamp, isClaimed)); }
public AuthEip8Message Deserialize(byte[] msgBytes) { RlpStream rlpStream = msgBytes.AsRlpStream(); AuthEip8Message authMessage = new(); rlpStream.ReadSequenceLength(); ReadOnlySpan <byte> sigAllBytes = rlpStream.DecodeByteArraySpan(); Signature signature = new(sigAllBytes.Slice(0, 64), sigAllBytes[64]); // since Signature class is Ethereum style it expects V as the 65th byte, hence we use RecoveryID constructor authMessage.Signature = signature; authMessage.PublicKey = new PublicKey(rlpStream.DecodeByteArraySpan()); authMessage.Nonce = rlpStream.DecodeByteArray(); int version = rlpStream.DecodeInt(); return(authMessage); }
public FindNodeMessage Deserialize(byte[] msg) { var results = PrepareForDeserialization <FindNodeMessage>(msg); RlpStream rlpStream = results.Data.AsRlpStream(); rlpStream.ReadSequenceLength(); var searchedNodeId = rlpStream.DecodeByteArray(); var expirationTime = rlpStream.DecodeLong(); var message = results.Message; message.SearchedNodeId = searchedNodeId; message.ExpirationTime = expirationTime; return(message); }
public PongMsg Deserialize(byte[] msgBytes) { (PublicKey FarPublicKey, byte[] Mdc, byte[] Data)results = PrepareForDeserialization(msgBytes); RlpStream rlp = results.Data.AsRlpStream(); rlp.ReadSequenceLength(); rlp.ReadSequenceLength(); // GetAddress(rlp.DecodeByteArray(), rlp.DecodeInt()); rlp.DecodeByteArraySpan(); rlp.DecodeInt(); // UDP port (we ignore and take it from Netty) rlp.DecodeInt(); // TCP port byte[] token = rlp.DecodeByteArray(); long expirationTime = rlp.DecodeLong(); PongMsg msg = new(results.FarPublicKey, expirationTime, token); return(msg); }
public static GetBlockHeadersMessage Deserialize(RlpStream rlpStream) { GetBlockHeadersMessage message = new(); rlpStream.ReadSequenceLength(); byte[] startingBytes = rlpStream.DecodeByteArray(); if (startingBytes.Length == 32) { message.StartBlockHash = new Keccak(startingBytes); } else { message.StartBlockNumber = (long)new UInt256(startingBytes, true); } message.MaxHeaders = rlpStream.DecodeInt(); message.Skip = rlpStream.DecodeInt(); message.Reverse = rlpStream.DecodeByte(); return(message); }
public DataRequest Decode(RlpStream rlpStream, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { var sequenceLength = rlpStream.ReadSequenceLength(); if (sequenceLength == 0) { return(null); } var assetId = rlpStream.DecodeKeccak(); var units = rlpStream.DecodeUInt(); var value = rlpStream.DecodeUInt256(); var expiryTime = rlpStream.DecodeUInt(); var salt = rlpStream.DecodeByteArray(); var provider = rlpStream.DecodeAddress(); var consumer = rlpStream.DecodeAddress(); var signature = SignatureDecoder.DecodeSignature(rlpStream); return(new DataRequest(assetId, units, value, expiryTime, salt, provider, consumer, signature)); }
private static GetBlockHeadersMessage Deserialize(RlpStream rlpStream) { GetBlockHeadersMessage message = new GetBlockHeadersMessage(); rlpStream.ReadSequenceLength(); byte[] startingBytes = rlpStream.DecodeByteArray(); if (startingBytes.Length == 32) { message.StartingBlockHash = new Keccak(startingBytes); } else { UInt256.CreateFromBigEndian(out UInt256 result, startingBytes); message.StartingBlockNumber = (long)result; } message.MaxHeaders = rlpStream.DecodeInt(); message.Skip = rlpStream.DecodeInt(); message.Reverse = rlpStream.DecodeByte(); return(message); }
private static StatusMessage Deserialize(RlpStream rlpStream) { StatusMessage statusMessage = new StatusMessage(); rlpStream.ReadSequenceLength(); statusMessage.ProtocolVersion = rlpStream.DecodeByte(); statusMessage.ChainId = rlpStream.DecodeUInt256(); statusMessage.TotalDifficulty = rlpStream.DecodeUInt256(); statusMessage.BestHash = rlpStream.DecodeKeccak(); statusMessage.GenesisHash = rlpStream.DecodeKeccak(); if (rlpStream.Position < rlpStream.Length) { rlpStream.ReadSequenceLength(); byte[] forkHash = rlpStream.DecodeByteArray(); long next = (long)rlpStream.DecodeUlong(); ForkId forkId = new(forkHash, next); statusMessage.ForkId = forkId; } return(statusMessage); }
public DataDeliveryReceiptDetails Decode(RlpStream rlpStream, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { var sequenceLength = rlpStream.ReadSequenceLength(); if (sequenceLength == 0) { return(null); } var id = rlpStream.DecodeKeccak(); var sessionId = rlpStream.DecodeKeccak(); var dataAssetId = rlpStream.DecodeKeccak(); var consumerNodeId = new PublicKey(rlpStream.DecodeByteArray()); var request = Nethermind.Core.Encoding.Rlp.Decode <DataDeliveryReceiptRequest>(rlpStream); var receipt = Nethermind.Core.Encoding.Rlp.Decode <DataDeliveryReceipt>(rlpStream); var timestamp = rlpStream.DecodeUlong(); var isClaimed = rlpStream.DecodeBool(); return(new DataDeliveryReceiptDetails(id, sessionId, dataAssetId, consumerNodeId, request, receipt, timestamp, isClaimed)); }
public HelloMessage Deserialize(byte[] bytes) { RlpStream rlpStream = bytes.AsRlpStream(); rlpStream.ReadSequenceLength(); HelloMessage helloMessage = new HelloMessage(); helloMessage.P2PVersion = rlpStream.DecodeByte(); helloMessage.ClientId = string.Intern(rlpStream.DecodeString()); helloMessage.Capabilities = rlpStream.DecodeArray(ctx => { ctx.ReadSequenceLength(); string protocolCode = string.Intern(ctx.DecodeString()); int version = ctx.DecodeByte(); return(new Capability(protocolCode, version)); }).ToList(); helloMessage.ListenPort = rlpStream.DecodeInt(); helloMessage.NodeId = new PublicKey(rlpStream.DecodeByteArray()); return(helloMessage); }
public NetworkNode Decode(RlpStream rlpStream, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { rlpStream.ReadSequenceLength(); PublicKey publicKey = new PublicKey(rlpStream.DecodeByteArray()); string ip = rlpStream.DecodeString(); int port = (int)rlpStream.DecodeByteArraySpan().ReadEthUInt64(); rlpStream.SkipItem(); long reputation = 0L; try { reputation = rlpStream.DecodeLong(); } catch (RlpException) { // regression - old format } NetworkNode networkNode = new NetworkNode(publicKey, ip != string.Empty ? ip : null, port, reputation); return(networkNode); }
public DepositDetails Decode(RlpStream rlpStream, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { rlpStream.ReadSequenceLength(); Deposit deposit = Serialization.Rlp.Rlp.Decode <Deposit>(rlpStream); DataAsset dataAsset = Serialization.Rlp.Rlp.Decode <DataAsset>(rlpStream); Address consumer = rlpStream.DecodeAddress(); var pepper = rlpStream.DecodeByteArray(); uint timestamp = rlpStream.DecodeUInt(); var transactions = Serialization.Rlp.Rlp.DecodeArray <TransactionInfo>(rlpStream); uint confirmationTimestamp = rlpStream.DecodeUInt(); bool rejected = rlpStream.DecodeBool(); bool cancelled = rlpStream.DecodeBool(); EarlyRefundTicket earlyRefundTicket = Serialization.Rlp.Rlp.Decode <EarlyRefundTicket>(rlpStream); var claimedRefundTransactions = Serialization.Rlp.Rlp.DecodeArray <TransactionInfo>(rlpStream); bool refundClaimed = rlpStream.DecodeBool(); bool refundCancelled = rlpStream.DecodeBool(); string kyc = rlpStream.DecodeString(); uint confirmations = rlpStream.DecodeUInt(); uint requiredConfirmations = rlpStream.DecodeUInt(); return(new DepositDetails(deposit, dataAsset, consumer, pepper, timestamp, transactions, confirmationTimestamp, rejected, cancelled, earlyRefundTicket, claimedRefundTransactions, refundClaimed, refundCancelled, kyc, confirmations, requiredConfirmations)); }
public DepositDetails Decode(RlpStream rlpStream, RlpBehaviors rlpBehaviors = RlpBehaviors.None) { try { var sequenceLength = rlpStream.ReadSequenceLength(); if (sequenceLength == 0) { return(null); } var deposit = Nethermind.Core.Encoding.Rlp.Decode <Deposit>(rlpStream); var dataAsset = Nethermind.Core.Encoding.Rlp.Decode <DataAsset>(rlpStream); var consumer = rlpStream.DecodeAddress(); var pepper = rlpStream.DecodeByteArray(); var timestamp = rlpStream.DecodeUInt(); var transaction = Nethermind.Core.Encoding.Rlp.Decode <TransactionInfo>(rlpStream); var confirmationTimestamp = rlpStream.DecodeUInt(); var rejected = rlpStream.DecodeBool(); var earlyRefundTicket = Nethermind.Core.Encoding.Rlp.Decode <EarlyRefundTicket>(rlpStream); var claimedRefundTransaction = Nethermind.Core.Encoding.Rlp.Decode <TransactionInfo>(rlpStream); var refundClaimed = rlpStream.DecodeBool(); var kyc = rlpStream.DecodeString(); var confirmations = rlpStream.DecodeUInt(); var requiredConfirmations = rlpStream.DecodeUInt(); return(new DepositDetails(deposit, dataAsset, consumer, pepper, timestamp, transaction, confirmationTimestamp, rejected, earlyRefundTicket, claimedRefundTransaction, refundClaimed, kyc, confirmations, requiredConfirmations)); } catch (Exception) { rlpStream.Position = 0; var sequenceLength = rlpStream.ReadSequenceLength(); if (sequenceLength == 0) { return(null); } var deposit = Nethermind.Core.Encoding.Rlp.Decode <Deposit>(rlpStream); var dataAsset = Nethermind.Core.Encoding.Rlp.Decode <DataAsset>(rlpStream); var consumer = rlpStream.DecodeAddress(); var pepper = rlpStream.DecodeByteArray(); var transaction = Nethermind.Core.Encoding.Rlp.Decode <TransactionInfo>(rlpStream); var confirmationTimestamp = rlpStream.DecodeUInt(); var rejected = rlpStream.DecodeBool(); var earlyRefundTicket = Nethermind.Core.Encoding.Rlp.Decode <EarlyRefundTicket>(rlpStream); var claimedRefundTransaction = Nethermind.Core.Encoding.Rlp.Decode <TransactionInfo>(rlpStream); var refundClaimed = rlpStream.DecodeBool(); var kyc = rlpStream.DecodeString(); var confirmations = rlpStream.DecodeUInt(); var requiredConfirmations = rlpStream.DecodeUInt(); uint timestamp = 0; if (rlpStream.Position != rlpStream.Data.Length) { timestamp = rlpStream.DecodeUInt(); } return(new DepositDetails(deposit, dataAsset, consumer, pepper, timestamp, transaction, confirmationTimestamp, rejected, earlyRefundTicket, claimedRefundTransaction, refundClaimed, kyc, confirmations, requiredConfirmations)); } }