Skip to content
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

Transaction with multiple actions can create identical requests #901

Closed
mattlockyer opened this issue Oct 17, 2024 · 4 comments · Fixed by #909
Closed

Transaction with multiple actions can create identical requests #901

mattlockyer opened this issue Oct 17, 2024 · 4 comments · Fixed by #909
Assignees
Labels
Emerging Tech Emerging Tech flying formation at Pagoda Near BOS NEAR BOS team at Pagoda

Comments

@mattlockyer
Copy link

Description

If a transaction is executed with multiple actions to call sign with identical payloads, all of these sign calls will pass the check at line:

if !self.request_already_exists(&request) {

Because the contract only adds the request after an async call to sign_helper.

If multiple actions are used, then multiple calls to sign_helper will be fired, resulting in multiple calls to env::promise_yield_create which may go on to create further issues.

See transaction here:
https://testnet.nearblocks.io/txns/FWB6Wq8tYNLFgB3zFnHZ5rmunfEHuVKscowakeenLAMq#execution

@ppca
Copy link
Contributor

ppca commented Oct 21, 2024

This check problem can be fixed by marking such request present before going into sign_helper().
Before I fix it, I want to know do you hope to be able to send multiple sign() with exactly same payload in one batch transaction? What is the use case?
@mattlockyer

@ppca ppca moved this from Backlog to In Progress in Emerging Technologies Oct 21, 2024
@ppca ppca self-assigned this Oct 21, 2024
@mattlockyer
Copy link
Author

No. I do not wish to send multiple sign requests with the same payload.

I was just flagging this because it may have caused further issues later in the runtime of the contract.

@volovyks
Copy link
Collaborator

@ppca our testnet contract is broken and I think this issue is the reason.
When submitting a transaction with 3 sign actions we increase our counter by 3, but then clear_state_on_finish fails with "out_of_gas" error. As a result - the counter never decreases and the price is maxed out. All the following requests are failing because of this.

@ppca
Copy link
Contributor

ppca commented Oct 25, 2024

this should be fixed by the PR too.

@ppca ppca linked a pull request Oct 25, 2024 that will close this issue
@ppca ppca closed this as completed in #909 Oct 29, 2024
@github-project-automation github-project-automation bot moved this from In Progress to Done in Emerging Technologies Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Emerging Tech Emerging Tech flying formation at Pagoda Near BOS NEAR BOS team at Pagoda
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants