Skip to content

Commit

Permalink
fix(nayduck) - fixing the resharding_rpc_tx nayduck test (near#11292)
Browse files Browse the repository at this point in the history
There were two new issues in this test, fixing both. 
- congestion control was not properly initialized for some feature
configuration
- the response had more values in the receipt outcomes
  • Loading branch information
wacban authored May 13, 2024
1 parent 0a61a29 commit 657aa11
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 4 deletions.
10 changes: 8 additions & 2 deletions core/primitives/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -795,6 +795,13 @@ pub mod chunk_extra {
/// for resharding where we only need the state root. This should not be
/// used as part of regular processing.
pub fn new_with_only_state_root(state_root: &StateRoot) -> Self {
// TODO(congestion_control) - integration with resharding
let congestion_control = if ProtocolFeature::CongestionControl.enabled(PROTOCOL_VERSION)
{
Some(CongestionInfo::default())
} else {
None
};
Self::new(
PROTOCOL_VERSION,
state_root,
Expand All @@ -803,8 +810,7 @@ pub mod chunk_extra {
0,
0,
0,
// TODO(congestion_control) - integration with resharding
None,
congestion_control,
)
}

Expand Down
13 changes: 11 additions & 2 deletions pytest/tests/sanity/resharding_rpc_tx.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ def setUp(self) -> None:
# test checks the right things.
super().setUp(epoch_length=20)

# Print full diff in case of assertion failure. It's handy when the
# responses from submit and get transaction differ.
self.maxDiff = None

def __setup_account(self, account_id, nonce):
""" Create an account with full access key and balance. """
encoded_block_hash = self.node.get_latest_block().hash_bytes
Expand Down Expand Up @@ -69,8 +73,13 @@ def __verify_tx_status(self, transfer_response, sender_account_id):
transfer_response['result']['final_execution_status'] = "IGNORE_ME"
response['result']['final_execution_status'] = "IGNORE_ME"

assert response == transfer_response, response
pass
response = response['result']
transfer_response = transfer_response['result']

# Do not compare receipts_outcome field it may have more values in the
# latter response.
for key in ['status', 'transaction', 'transaction_outcome']:
self.assertEqual(response[key], transfer_response[key])

def test_resharding_rpc_tx(self):
num_nodes = 2
Expand Down

0 comments on commit 657aa11

Please sign in to comment.