File tree 4 files changed +27
-9
lines changed
packages/sources/lido-por
4 files changed +27
-9
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @chainlink/lido-por-adapter ' : minor
3
+ ---
4
+
5
+ Throw error when ripcord is true
Original file line number Diff line number Diff line change @@ -76,14 +76,30 @@ export class BalanceTransport extends SubscriptionTransport<BaseEndpointTypes> {
76
76
const providerDataRequestedUnixMs = Date . now ( )
77
77
78
78
const beaconBalance = await this . _getBeaconBalance ( param . lidoContract )
79
+
80
+ if ( beaconBalance . isNegative ( ) ) {
81
+ return {
82
+ errorMessage : `ethereum-cl-indexer balance endpoint returns negative value ${ beaconBalance } ` ,
83
+ ripcord : true ,
84
+ ripcordDetails : JSON . stringify (
85
+ `ethereum-cl-indexer balance endpoint returns negative value` ,
86
+ ) ,
87
+ statusCode : 502 ,
88
+ timestamps : {
89
+ providerDataRequestedUnixMs,
90
+ providerDataReceivedUnixMs : Date . now ( ) ,
91
+ providerIndicatedTimeUnixMs : undefined ,
92
+ } ,
93
+ }
94
+ }
95
+
79
96
const buffer = await getBufferedEther ( param . lidoContract , this . provider )
80
97
81
98
const balance = beaconBalance . add ( buffer ) . toString ( )
82
99
83
100
return {
84
101
data : {
85
102
result : balance ,
86
- ripcord : beaconBalance . isNegative ( ) ,
87
103
} ,
88
104
result : balance ,
89
105
timestamps : {
Original file line number Diff line number Diff line change 2
2
3
3
exports [` execute reserve endpoint should return ripcord 1` ] = `
4
4
{
5
- " data" : {
6
- " result" : " 499" ,
7
- " ripcord" : true ,
8
- },
9
- " result" : " 499" ,
10
- " statusCode" : 200 ,
5
+ " errorMessage" : " ethereum-cl-indexer balance endpoint returns negative value -1" ,
6
+ " ripcord" : true ,
7
+ " ripcordDetails" : " " ethereum - cl - indexer balance endpoint returns negative value " " ,
8
+ " statusCode" : 502 ,
11
9
" timestamps" : {
12
10
" providerDataReceivedUnixMs" : 978347471111 ,
13
11
" providerDataRequestedUnixMs" : 978347471111 ,
@@ -19,7 +17,6 @@ exports[`execute reserve endpoint should return success 1`] = `
19
17
{
20
18
" data" : {
21
19
" result" : " 800" ,
22
- " ripcord" : false ,
23
20
},
24
21
" result" : " 800" ,
25
22
" statusCode" : 200 ,
Original file line number Diff line number Diff line change @@ -83,7 +83,7 @@ describe('execute', () => {
83
83
}
84
84
mockResponseFailure ( )
85
85
const response = await testAdapter . request ( data )
86
- expect ( response . statusCode ) . toBe ( 200 )
86
+ expect ( response . statusCode ) . toBe ( 502 )
87
87
expect ( response . json ( ) ) . toMatchSnapshot ( )
88
88
} )
89
89
} )
You can’t perform that action at this time.
0 commit comments