-
Notifications
You must be signed in to change notification settings - Fork 654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(runtime) - Mitigate the receipt size limit bug #12633
base: master
Are you sure you want to change the base?
Changes from 1 commit
5270c47
838b2df
8770203
012f5e4
0f5d97b
ec572a2
37000a2
fc84695
9adc521
a8172a6
083cae3
0c476fc
ff8c7b1
48765df
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -388,12 +388,30 @@ impl ReceiptSinkV2 { | |
fn try_forward( | ||
receipt: Receipt, | ||
gas: u64, | ||
size: u64, | ||
mut size: u64, | ||
shard: ShardId, | ||
outgoing_limit: &mut HashMap<ShardId, OutgoingLimit>, | ||
outgoing_receipts: &mut Vec<Receipt>, | ||
apply_state: &ApplyState, | ||
) -> Result<ReceiptForwarding, RuntimeError> { | ||
// There is a bug which allows to create receipts that are above the size limit. Receipts | ||
// above the size limit might not fit under the maximum outgoing size limit. Let's pretend | ||
// that all receipts are at most `max_receipt_size` to avoid receipts getting stuck. | ||
// See https://github.com/near/nearcore/issues/12606 | ||
let max_receipt_size = apply_state.config.wasm_config.limit_config.max_receipt_size; | ||
if size > max_receipt_size { | ||
if size > max_receipt_size { | ||
tracing::warn!( | ||
target: "runtime", | ||
"try_forward observed a receipt with size exceeding the size limit! receipt_id: {} size: {} size_limit: {}", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: use structured logging - set the values as fields rather than in the formatted message
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I find these structured logs a bit harder to read than manually formatted messages, but I guess that's the proper way to do it. Changed to structured. |
||
receipt.receipt_id(), | ||
size, | ||
max_receipt_size, | ||
); | ||
size = max_receipt_size; | ||
} | ||
} | ||
|
||
// Default case set to `Gas::MAX`: If no outgoing limit was defined for the receiving | ||
// shard, this usually just means the feature is not enabled. Or, it | ||
// could be a special case during resharding events. Or even a bug. In | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this condition got duplicated