Skip to content

Commit 970426e

Browse files
committed
Add acceptance tests
Signed-off-by: Luis Mastrangelo <[email protected]>
1 parent bee68a1 commit 970426e

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

packages/server/tests/acceptance/sendRawTransactionExtension.spec.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
// External resources
44
import { ConfigService } from '@hashgraph/json-rpc-config-service/dist/services';
5+
import { ConfigServiceTestHelper } from '@hashgraph/json-rpc-config-service/tests/configServiceTestHelper';
56
// Other imports
67
import { numberTo0x } from '@hashgraph/json-rpc-relay/dist/formatters';
78
import Constants from '@hashgraph/json-rpc-relay/dist/lib/constants';
@@ -180,4 +181,26 @@ describe('@sendRawTransactionExtension Acceptance Tests', function () {
180181
expect(info).to.exist;
181182
});
182183
});
184+
185+
describe('Read-Only mode', function () {
186+
it('@release should fail to execute "eth_sendRawTransaction" in Read-Only mode', async function () {
187+
const readOnly = ConfigService.get('READ_ONLY');
188+
ConfigServiceTestHelper.dynamicOverride('READ_ONLY', true);
189+
190+
const transaction = {
191+
type: 2,
192+
chainId: Number(CHAIN_ID),
193+
nonce: 1234,
194+
gasLimit: defaultGasLimit,
195+
to: accounts[0].address,
196+
data: '0x00',
197+
};
198+
199+
const signedTx = await accounts[1].wallet.signTransaction(transaction);
200+
const error = predefined.UNSUPPORTED_OPERATION('Relay is in read-only mode');
201+
await Assertions.assertPredefinedRpcError(error, sendRawTransaction, false, relay, [signedTx, requestDetails]);
202+
203+
ConfigServiceTestHelper.dynamicOverride('READ_ONLY', readOnly);
204+
});
205+
});
183206
});

0 commit comments

Comments
 (0)